advanced-ads
Last commit date
admin
11 years ago
classes
11 years ago
includes
11 years ago
languages
11 years ago
public
11 years ago
LICENSE.txt
12 years ago
advanced-ads.php
11 years ago
composer.json
11 years ago
index.php
12 years ago
readme.txt
11 years ago
uninstall.php
11 years ago
advanced-ads.php
88 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Advanced Ads. |
| 4 | * |
| 5 | * @package Advanced_Ads_Admin |
| 6 | * @author Thomas Maier <thomas.maier@webgilde.com> |
| 7 | * @license GPL-2.0+ |
| 8 | * @link http://webgilde.com |
| 9 | * @copyright 2013-2014 Thomas Maier, webgilde GmbH |
| 10 | * |
| 11 | * @wordpress-plugin |
| 12 | * Plugin Name: Advanced Ads |
| 13 | * Plugin URI: http://wpadvancedads.com |
| 14 | * Description: Manage and optimize your ads in WordPress |
| 15 | * Version: 1.3.10 |
| 16 | * Author: Thomas Maier |
| 17 | * Author URI: http://webgilde.com |
| 18 | * Text Domain: advanced-ads |
| 19 | * License: GPL-2.0+ |
| 20 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 21 | * Domain Path: /languages |
| 22 | */ |
| 23 | |
| 24 | // If this file is called directly, abort. |
| 25 | if ( ! defined( 'WPINC' ) ) { |
| 26 | die; |
| 27 | } |
| 28 | |
| 29 | // only load if not already existing (maybe included from another plugin) |
| 30 | if( defined('ADVADS_BASE_PATH') ) { |
| 31 | return ; |
| 32 | } |
| 33 | |
| 34 | // load basic path to the plugin |
| 35 | define('ADVADS_BASE_PATH', plugin_dir_path(__FILE__)); |
| 36 | define('ADVADS_BASE_URL', plugin_dir_url(__FILE__)); |
| 37 | // general and global slug, e.g. to store options in WP, textdomain |
| 38 | define('ADVADS_SLUG', 'advanced-ads'); |
| 39 | |
| 40 | /*----------------------------------------------------------------------------* |
| 41 | * Autoloading Objects |
| 42 | *----------------------------------------------------------------------------*/ |
| 43 | if (!class_exists('Advanced_Ads', true)) { |
| 44 | require_once( plugin_dir_path( __FILE__ ) . 'includes/autoloader.php' ); |
| 45 | require_once( plugin_dir_path( __FILE__ ) . 'public/class-advanced-ads.php' ); |
| 46 | spl_autoload_register(array('Advads_Autoloader', 'load')); |
| 47 | } |
| 48 | |
| 49 | /*----------------------------------------------------------------------------* |
| 50 | * Public-Facing Functionality |
| 51 | *----------------------------------------------------------------------------*/ |
| 52 | |
| 53 | /* |
| 54 | * Register hooks that are fired when the plugin is activated or deactivated. |
| 55 | * When the plugin is deleted, the uninstall.php file is loaded. |
| 56 | * |
| 57 | */ |
| 58 | register_activation_hook( __FILE__, array( 'Advanced_Ads', 'activate' ) ); |
| 59 | register_deactivation_hook( __FILE__, array( 'Advanced_Ads', 'deactivate' ) ); |
| 60 | |
| 61 | add_action( 'plugins_loaded', array( 'Advanced_Ads', 'get_instance' ) ); |
| 62 | |
| 63 | /*----------------------------------------------------------------------------* |
| 64 | * Dashboard and Administrative Functionality |
| 65 | *----------------------------------------------------------------------------*/ |
| 66 | |
| 67 | if( defined('DOING_AJAX') ) { |
| 68 | new Advads_Ad_Ajax_Callbacks; |
| 69 | } |
| 70 | // load ad conditions array |
| 71 | require_once( plugin_dir_path( __FILE__ ) . 'includes/array_ad_conditions.php' ); |
| 72 | |
| 73 | if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { |
| 74 | require_once( plugin_dir_path( __FILE__ ) . 'admin/class-advanced-ads-admin.php' ); |
| 75 | add_action( 'plugins_loaded', array( 'Advanced_Ads_Admin', 'get_instance' ) ); |
| 76 | } |
| 77 | |
| 78 | // load public functions |
| 79 | require_once( plugin_dir_path( __FILE__ ) . 'public/functions.php' ); |
| 80 | |
| 81 | // load widget |
| 82 | require_once( plugin_dir_path( __FILE__ ) . 'classes/widget.php' ); |
| 83 | function advads_widget_init() { |
| 84 | register_widget('Advads_Widget'); |
| 85 | } |
| 86 | |
| 87 | add_action('widgets_init', 'advads_widget_init'); |
| 88 |