/** * Loads the MailChimp for WP plugin files * * @return boolean True if the plugin files were loaded, false otherwise. */ function mc4wp_load_plugin() { global $mc4wp; // don't load plugin if user has the premium version installed and activated if (defined('MC4WP_VERSION')) { return false; } // load autoloader require_once dirname(__FILE__) . '/vendor/autoload_52.php'; // define some constants require dirname(__FILE__) . '/bootstrap.php'; // Initialize the plugin and store an instance in the global scope $mc4wp = mc4wp(); $mc4wp->init(); if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)) { // load admin class $admin = new MC4WP_Admin(__FILE__); $admin->add_hooks(); $admin->load_translations(); // load promotional elements $promotional_elements = new MC4WP_Admin_Ads(); $promotional_elements->add_hooks(); } return true; }
/** * Registers all hooks */ public function add_hooks() { // Actions used globally throughout WP Admin add_action('admin_menu', array($this, 'build_menu')); add_action('admin_init', array($this, 'initialize')); add_action('current_screen', array($this, 'customize_admin_texts')); add_action('wp_dashboard_setup', array($this, 'register_dashboard_widgets')); add_action('mc4wp_admin_empty_lists_cache', array($this, 'renew_lists_cache')); add_action('admin_enqueue_scripts', array($this, 'enqueue_assets')); $this->ads->add_hooks(); $this->messages->add_hooks(); }