advanced-ads
Last commit date
admin
11 years ago
classes
11 years ago
includes
11 years ago
languages
11 years ago
modules
11 years ago
public
11 years ago
LICENSE.txt
11 years ago
advanced-ads.php
11 years ago
composer.json
11 years ago
index.php
11 years ago
readme.txt
11 years ago
uninstall.php
11 years ago
advanced-ads.php
101 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.4.5 |
| 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 | define( 'ADVADS_BASE_DIR', dirname( plugin_basename( __FILE__ ) ) ); // directory of the plugin without any paths |
| 38 | // general and global slug, e.g. to store options in WP, textdomain |
| 39 | define( 'ADVADS_SLUG', 'advanced-ads' ); |
| 40 | |
| 41 | /*----------------------------------------------------------------------------* |
| 42 | * Autoloading Objects |
| 43 | *----------------------------------------------------------------------------*/ |
| 44 | if ( ! class_exists( 'Advanced_Ads', true ) ) { |
| 45 | require_once ADVADS_BASE_PATH . 'includes/autoloader.php'; |
| 46 | require_once ADVADS_BASE_PATH . 'public/class-advanced-ads.php'; |
| 47 | spl_autoload_register( array('Advads_Autoloader', 'load') ); |
| 48 | } |
| 49 | |
| 50 | /*----------------------------------------------------------------------------* |
| 51 | * Public-Facing Functionality |
| 52 | *----------------------------------------------------------------------------*/ |
| 53 | |
| 54 | /* |
| 55 | * Register hooks that are fired when the plugin is activated or deactivated. |
| 56 | * When the plugin is deleted, the uninstall.php file is loaded. |
| 57 | * |
| 58 | */ |
| 59 | register_activation_hook( __FILE__, array( 'Advanced_Ads', 'activate' ) ); |
| 60 | register_deactivation_hook( __FILE__, array( 'Advanced_Ads', 'deactivate' ) ); |
| 61 | |
| 62 | add_action( 'plugins_loaded', array( 'Advanced_Ads', 'get_instance' ) ); |
| 63 | |
| 64 | /*----------------------------------------------------------------------------* |
| 65 | * Dashboard and Administrative Functionality |
| 66 | *----------------------------------------------------------------------------*/ |
| 67 | |
| 68 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 69 | new Advads_Ad_Ajax_Callbacks; |
| 70 | } |
| 71 | // load ad conditions array |
| 72 | require_once ADVADS_BASE_PATH . 'includes/array_ad_conditions.php'; |
| 73 | |
| 74 | if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { |
| 75 | // register all classes with callbacks and hooks here |
| 76 | require_once ADVADS_BASE_PATH . 'admin/class-advanced-ads-admin.php'; |
| 77 | require_once ADVADS_BASE_PATH . 'admin/includes/class-overview-widgets.php'; |
| 78 | require_once ADVADS_BASE_PATH . 'admin/includes/class-notices.php'; |
| 79 | |
| 80 | add_action( 'plugins_loaded', array( 'Advanced_Ads_Admin', 'get_instance' ) ); |
| 81 | } |
| 82 | |
| 83 | // load public functions |
| 84 | require_once ADVADS_BASE_PATH . 'public/functions.php'; |
| 85 | |
| 86 | // load widget |
| 87 | require_once ADVADS_BASE_PATH . 'classes/widget.php'; |
| 88 | function advads_widget_init() { |
| 89 | register_widget( 'Advads_Widget' ); |
| 90 | } |
| 91 | |
| 92 | add_action( 'widgets_init', 'advads_widget_init' ); |
| 93 | |
| 94 | // Load advads extensions |
| 95 | require_once ADVADS_BASE_PATH . 'modules/gadsense/main.php'; |
| 96 | |
| 97 | // load modules, if they exist |
| 98 | if ( file_exists( ADVADS_BASE_PATH . 'modules/pro/advads_pro.php' ) ){ |
| 99 | require_once ADVADS_BASE_PATH . 'modules/pro/advads_pro.php'; |
| 100 | } |
| 101 |