/** * Loads the MailChimp for WP plugin files * * @return boolean True if the plugin files were loaded, false otherwise. */ function mc4wp_load_plugin() { // don't load plugin if user has the premium version installed and activated if (defined('MC4WP_VERSION')) { return false; } // bootstrap the lite plugin define('MC4WP_LITE_VERSION', '2.3.15'); define('MC4WP_LITE_PLUGIN_DIR', dirname(__FILE__) . '/'); define('MC4WP_LITE_PLUGIN_URL', plugins_url('/', __FILE__)); define('MC4WP_LITE_PLUGIN_FILE', __FILE__); require_once MC4WP_LITE_PLUGIN_DIR . 'vendor/autoload_52.php'; require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/general.php'; require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/template.php'; // Initialize admin section of plugin if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)) { new MC4WP_Lite_Admin(); } // Initialize the plugin and store an instance in the global scope MC4WP_Lite::init(); $GLOBALS['mc4wp'] = MC4WP_Lite::instance(); // Doing cron? if (defined('DOING_CRON') && DOING_CRON) { MC4WP_Usage_Tracking::instance()->add_hooks(); } return true; }
public static function get_instance() { if (!isset(self::$instance)) { self::$instance = new MC4WP_Lite(); } return self::$instance; }
/** * Instantiates the plugin * * @return bool */ public static function init() { if (self::$instance instanceof MC4WP_Lite) { return false; } self::$instance = new MC4WP_Lite(); return true; }
/** * Loads the MailChimp for WP plugin files * * @return boolean True if the plugin files were loaded, false otherwise. */ function mc4wp_load_plugin() { // don't load plugin if user has the premium version installed and activated if (defined('MC4WP_VERSION')) { return false; } // bootstrap the lite plugin define('MC4WP_LITE_VERSION', '2.2.9'); define('MC4WP_LITE_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('MC4WP_LITE_PLUGIN_URL', plugins_url('/', __FILE__)); define('MC4WP_LITE_PLUGIN_FILE', __FILE__); require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/general.php'; require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/template.php'; require_once MC4WP_LITE_PLUGIN_DIR . 'includes/class-plugin.php'; // Initialize the plugin and store an instance in the global scope MC4WP_Lite::init(); $GLOBALS['mc4wp'] = MC4WP_Lite::instance(); if (is_admin() && (false === defined('DOING_AJAX') || false === DOING_AJAX)) { // ADMIN require_once MC4WP_LITE_PLUGIN_DIR . 'includes/class-admin.php'; new MC4WP_Lite_Admin(); } return true; }
/** * Gets the MailChimp for WP API class and injects it with the given API key * @since 1.0 * @return MC4WP_API */ function mc4wp_get_api() { return MC4WP_Lite::instance()->get_api(); }
/** * Returns HTML for sign-up form with the given $form_id. * * @param int $form_id. * @return string HTML of given form_id. */ function mc4wp_get_form($id = 0) { $form_manager = MC4WP_Lite::instance()->get_form_manager(); return $form_manager->output_form(array('id' => $id)); }