Ejemplo n.º 1
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Display the UI.
     $this->display();
 }
Ejemplo n.º 2
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Possibly prepare the preview customizer frame.
     add_action(current_filter(), array($this, 'maybe_prepare_preview'));
 }
Ejemplo n.º 3
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Prevent WPSEO from stripping out needed query args for the Preview frame.
     add_filter('wpseo_whitelist_permalink_vars', array($this, 'whitelist_query_args'));
 }
Ejemplo n.º 4
0
 /**
  * Class constructor.
  *
  * @param wpdb $db
  *
  * @since 2.0.0
  */
 public function __construct(wpdb $db)
 {
     $this->db = $db;
     $this->base = Optin_Monster::get_instance();
     // Save the table name
     $this->table = $this->db->prefix . 'om_leads';
 }
Ejemplo n.º 5
0
 /**
  * The class constructor.
  *
  * @since 2.0.0
  *
  * @param string $slug The optin slug.
  */
 public function __construct($slug)
 {
     // Set class properties.
     $this->slug = $slug;
     $this->optin = Optin_Monster::get_instance()->get_optin_by_slug($this->slug);
     // Set the response.
     $this->response = $this->get_optin_data($this->optin);
 }
Ejemplo n.º 6
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Load hooks and filters.
     add_shortcode('optin-monster', array($this, 'shortcode'));
     add_shortcode('optin-monster-shortcode', array($this, 'shortcode_v1'));
     add_filter('widget_text', 'do_shortcode');
 }
Ejemplo n.º 7
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Load available providers
     $common = Optin_Monster_Common::get_instance();
     $this->all_providers = $this->parse_providers($common->get_email_providers());
     // Display the UI.
     $this->display();
 }
Ejemplo n.º 8
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Load actions for this view.
     add_action('optin_monster_tab_optins', array($this, 'optins_tab'));
     add_action('optin_monster_tab_addons', array($this, 'addons_tab'));
     add_action('optin_monster_tab_integrations', array($this, 'integrations_tab'));
     add_action('optin_monster_tab_settings', array($this, 'settings_tab'));
 }
Ejemplo n.º 9
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Build out the post type arguments.
     $args = apply_filters('optin_monster_post_type_args', array('labels' => array(), 'public' => false, 'exclude_from_search' => false, 'show_ui' => false, 'show_in_admin_bar' => false, 'rewrite' => false, 'query_var' => false, 'menu_position' => apply_filters('optin_monster_post_type_menu_position', 279), 'menu_icon' => plugins_url('assets/css/images/menu-icon@2x.png', $this->base->file), 'supports' => array('title')));
     // Register the post type with WordPress.
     register_post_type('optin', $args);
     // Register any image sizes that will be needed for optin themes.
     $this->register_image_sizes();
 }
Ejemplo n.º 10
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Ensure the preview page can't be tampered with.
     add_action('admin_head', array($this, 'preview_lockdown'));
     add_filter('page_row_actions', array($this, 'row_actions'), 10, 2);
     // Handle any admin notices.
     add_action('admin_notices', array($this, 'notices'));
     // Delete any extra cropped images.
     add_action('delete_attachment', array($this, 'delete_cropped_image'));
 }
Ejemplo n.º 11
0
 /**
  * Outputs the widget within the widgetized area.
  *
  * @since 2.0.0
  *
  * @param array $args     The default widget arguments.
  * @param array $instance The input settings for the current widget instance.
  *
  * @return void
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $optin_id = $instance['optin_monster_id'];
     do_action('optin_monster_widget_before_output', $args, $instance);
     echo $args['before_widget'];
     do_action('optin_monster_widget_before_title', $args, $instance);
     // If a title exists, output it.
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     do_action('optin_monster_widget_before_optin', $args, $instance);
     // If a optin has been selected, output it.
     if ($optin_id) {
         // If we are in preview mode, don't output the widget.
         if (Optin_Monster_Output::get_instance()->is_preview()) {
             return;
         }
         // Grab the optin object. If it does not exist, return early.
         $optin = absint($optin_id) ? Optin_Monster::get_instance()->get_optin($optin_id) : Optin_Monster::get_instance()->get_optin_by_slug($optin_id);
         if (!$optin) {
             return;
         }
         // Check for split tests.
         $original = $optin;
         $split_tests = Optin_Monster::get_instance()->get_split_tests($optin->ID);
         if ($split_tests) {
             // Merge the main optin with the split tests, shuffle the array, and set the optin to the first item in the array.
             $split_tests[] = $optin;
             shuffle($split_tests);
             $optin = $split_tests[0];
         }
         // If a clone is selected but it is not enabled, default back to parent optin.
         $clone = get_post_meta($optin->ID, '_om_is_clone', true);
         if (!empty($clone)) {
             $meta = get_post_meta($optin->ID, '_om_meta', true);
             if (empty($meta['display']['enabled']) || !$meta['display']['enabled']) {
                 $optin = $original;
             }
         }
         // If in test mode but not logged in, skip over the optin.
         $test = get_post_meta($optin->ID, '_om_test_mode', true);
         if (!empty($test) && !is_user_logged_in()) {
             return;
         }
         // Load the optin.
         optin_monster($optin->ID);
     }
     do_action('optin_monster_widget_after_optin', $args, $instance);
     echo $args['after_widget'];
     do_action('optin_monster_widget_after_output', $args, $instance);
 }
Ejemplo n.º 12
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // The optins overview screen needs WP_List_Table. If it is not in scope, bring it into scope now.
     if (!class_exists('WP_List_Table')) {
         require ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
     }
     // Load in the list table extension class.
     require plugin_dir_path($this->base->file) . 'includes/admin/ui/optins-table.php';
     // Display the UI.
     $this->display();
 }
Ejemplo n.º 13
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Set the optin ID, object and meta properties.
     $this->optin_id = isset($_GET['om_optin_id']) ? $_GET['om_optin_id'] : $_POST['id'];
     $this->optin = get_post($this->optin_id);
     $this->meta = get_post_meta($this->optin_id, '_om_meta', true);
     // The optins overview screen needs WP_List_Table. If it is not in scope, bring it into scope now.
     if (!class_exists('WP_List_Table')) {
         require ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
     }
     // Load in the list table extension class.
     require plugin_dir_path($this->base->file) . 'includes/admin/ui/split-table.php';
 }
Ejemplo n.º 14
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Set the page UI for the screen (and possibly define an iframe request if using admin previews).
     $this->view = isset($_GET['om_view']) ? $_GET['om_view'] : 'overview';
     if ($this->is_admin_preview() && !defined('IFRAME_REQUEST')) {
         define('IFRAME_REQUEST', true);
     }
     // Possibly dismiss nag.
     add_action('admin_init', array($this, 'saas_dismiss'));
     // Build the custom admin page for managing optins.
     add_action('admin_menu', array($this, 'menu'));
     // Add the settings menu item to the Plugins table.
     add_filter('plugin_action_links_' . plugin_basename(plugin_dir_path(dirname(dirname(__FILE__))) . 'optin-monster.php'), array($this, 'settings_link'));
 }
Ejemplo n.º 15
0
 public function __construct()
 {
     // Get some useful class instances.
     $this->base = Optin_Monster::get_instance();
     $this->common = Optin_Monster_Common::get_instance();
     $this->admin = Optin_Monster_Menu_Admin::get_instance();
     // Make sure get_plugins() is available.
     if (!function_exists('get_plugins')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     // See if we've done this before and save the auth info.
     $this->auth = get_option('awesomemotive_auth');
     // Find out what kind of request we'll be making.
     $this->request_type = $this->get_request_type();
     // Gather the required data.
     $this->data = $this->gather_data();
 }
Ejemplo n.º 16
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Set the optin ID, object and meta properties.
     $this->optin_id = isset($_GET['om_optin_id']) ? $_GET['om_optin_id'] : $_POST['id'];
     $this->optin = get_post($this->optin_id);
     $this->meta = get_post_meta($this->optin_id, '_om_meta', true);
     $this->theme = Optin_Monster_Output::get_instance()->get_optin_monster_theme($this->meta['theme'], $this->optin_id, true);
     // Possibly add custom notes area if editing a split test.
     if (isset($_GET['om_split']) && $_GET['om_split']) {
         $this->split_test_notes();
     }
     // Load Google fonts to the page.
     add_action('admin_print_footer_scripts', array($this, 'load_google_fonts'), 999);
     // Load the theme control filters.
     $this->theme->controls();
 }
Ejemplo n.º 17
0
/**
 * Handles conversion tracking for the Canvas addon.
 *
 * @since 2.0.1
 */
function optin_monster_canvas_do_conversions()
{
    // If the conversion parameter is empty, return early.
    if (empty($_GET['omcanvas'])) {
        return;
    }
    // Grab the optin.
    $optin = Optin_Monster::get_instance()->get_optin_by_slug(stripslashes($_GET['omcanvas']));
    if (!$optin) {
        return;
    }
    // Process the conversion.
    if (!class_exists('Optin_Monster_Track_Datastore')) {
        require plugin_dir_path(Optin_Monster::get_instance()->file) . 'includes/global/track-datastore.php';
    }
    $track = new Optin_Monster_Track_Datastore($optin->ID);
    $track->save('conversion');
    // Add a hook for custom functionality.
    do_action('optin_monster_canvas_conversion', $optin);
}
Ejemplo n.º 18
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Handle any optin actions in the admin.
     if (empty($_GET['om_action']) && empty($_GET['optin'])) {
         return;
     }
     // Set class properties.
     $this->action = isset($_GET['om_action']) ? $_GET['om_action'] : $_GET['action'];
     $this->optin_id = isset($_GET['om_optin_id']) ? absint($_GET['om_optin_id']) : 0;
     $this->split = isset($_GET['om_optin_split']) ? absint($_GET['om_optin_split']) : false;
     if ($this->split) {
         $id = $this->optin_id;
         $split = $this->split;
         $this->optin_id = $split;
         $this->split = $id;
     }
     $this->optin = get_post($this->optin_id);
     // Do our actions.
     add_action('init', array($this, 'do_actions'));
 }
Ejemplo n.º 19
0
 /**
  * Returns the singleton instance of the class.
  *
  * @since 2.0.0
  *
  * @return object The Optin_Monster object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Optin_Monster) {
         self::$instance = new Optin_Monster();
     }
     return self::$instance;
 }
Ejemplo n.º 20
0
 /**
  * Grabs all the optin data necessary for the table UI.
  *
  * @since 2.0.0
  */
 public function optins_data()
 {
     $splits = Optin_Monster::get_instance()->get_split_tests($this->optin_id);
     $parent_id = isset($_GET['om_optin_id']) ? absint($_GET['om_optin_id']) : false;
     if ($parent_id && $splits) {
         $parent = get_post($parent_id);
         array_unshift($splits, $parent);
         return $splits;
     } else {
         return $splits;
     }
 }
Ejemplo n.º 21
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  *
  * @param array $config Array of updater config args.
  */
 public function __construct(array $config)
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Set class properties.
     $accepted_args = array('plugin_name', 'plugin_slug', 'plugin_path', 'plugin_url', 'remote_url', 'version', 'key');
     foreach ($accepted_args as $arg) {
         $this->{$arg} = $config[$arg];
     }
     // If the user cannot update plugins, stop processing here.
     if (!current_user_can('update_plugins')) {
         return;
     }
     // Load the updater hooks and filters.
     add_filter('pre_set_site_transient_update_plugins', array($this, 'update_plugins_filter'));
     add_filter('http_request_args', array($this, 'http_request_args'), 10, 2);
     add_filter('plugins_api', array($this, 'plugins_api'), 10, 3);
 }
Ejemplo n.º 22
0
 /**
  * Retrieves all the necessary data about an optin for loading.
  *
  * @since 2.0.0
  *
  * @param int $optin_id The optin ID.
  *
  * @return bool|array   False on failure, otherwise an array of optin data.
  */
 public function get_optin_monster_data($optin_id)
 {
     // Return false if the optin has already been set in the data.
     if (!empty($this->data[$optin_id])) {
         return false;
     }
     // Return false if the optin cannot be found.
     $optin = Optin_Monster::get_instance()->get_optin($optin_id);
     if (!$optin) {
         // Attempt to retrieve by slug if necessary.
         $optin = Optin_Monster::get_instance()->get_optin_by_slug($optin_id);
         if (!$optin) {
             return false;
         }
     }
     // Prepare variables.
     $meta = get_post_meta($optin->ID, '_om_meta', true);
     $option = get_option('optin_monster');
     $test = get_post_meta($optin->ID, '_om_test_mode', true);
     $data = array();
     // Attempt to retrieve the post ID.
     global $post;
     $post_id = get_queried_object_id();
     if (!$post_id && 'page' == get_option('show_on_front')) {
         $post_id = get_option('page_for_posts');
     } else {
         $post_id = isset($post) ? $post->ID : 0;
     }
     // Prepare the clones variable based on type of optin being output.
     $is_clone = get_post_meta($optin->ID, '_om_is_clone', true);
     if (!empty($is_clone)) {
         $clones = (array) get_post_meta($is_clone, '_om_has_clone', true);
         $clones[] = (int) $is_clone;
         foreach ($clones as $i => $clone) {
             if ($optin->ID == $clone) {
                 unset($clones[$i]);
                 break;
             }
         }
         $clones = array_values($clones);
     } else {
         $clones = (array) get_post_meta($optin->ID, '_om_has_clone', true);
         $sanitized_clones = array();
         foreach ($clones as $i => $clone) {
             $sanitized_clones[$i] = $clone;
         }
         $clones = array_values($sanitized_clones);
     }
     // Build the data array.
     $data['id'] = $optin->ID;
     $data['optin'] = $optin->post_name;
     $data['campaign'] = get_the_title($optin->ID);
     $data['clones'] = $clones;
     $data['hash'] = $optin->post_name;
     $data['optin_js'] = str_replace('-', '_', $optin->post_name);
     $data['type'] = isset($meta['type']) ? $meta['type'] : false;
     $data['theme'] = !empty($_GET['om-live-theme']) ? stripslashes($_GET['om-live-theme']) : $meta['theme'];
     $data['cookie'] = isset($meta['cookie']) ? $meta['cookie'] : 30;
     $data['delay'] = isset($meta['delay']) ? $meta['delay'] : 5000;
     $data['second'] = isset($meta['second']) ? $meta['second'] : false;
     $data['exit'] = isset($meta['exit']) ? $meta['exit'] : false;
     $data['redirect'] = isset($meta['redirect']) ? html_entity_decode(esc_url($meta['redirect']), ENT_NOQUOTES) : false;
     $data['redirect_pass'] = isset($meta['redirect_pass']) && $meta['redirect_pass'] ? true : false;
     $data['custom'] = isset($meta['email']['provider']) && 'custom' == $meta['email']['provider'] ? true : false;
     $data['test'] = !empty($test) ? true : false;
     $data['global_cookie'] = isset($option['cookie']) ? $option['cookie'] : false;
     $data['preview'] = $this->preview;
     $data['ajax'] = $this->get_ajax_route();
     $data['mobile'] = isset($meta['type']) && 'mobile' == $meta['type'] ? true : false;
     $data['post_id'] = $post_id;
     $data['preloader'] = plugins_url('assets/css/images/preloader.gif', $this->base->file);
     $data['error'] = __('There was an error with your submission. Please try again.', 'optin-monster');
     $data['ajax_error'] = __('There was an error with the AJAX request: ', 'optin-monster');
     $data['name_error'] = __('Please enter a valid name.', 'optin-monster');
     $data['email_error'] = __('Please enter a valid email address.', 'optin-monster');
     $data['bot_error'] = __('Honeypot fields have been activated. Your submission is being flagged as potential spam.', 'optin-monster');
     // Get the success message and allow for custom data.
     $data['success'] = $this->get_success_message($optin, $meta);
     // Deprecated filter - DO NOT USE.
     $data = apply_filters('optin_monster_load_optinmonster_bottom', $data);
     // Return and allow the data to be filtered.
     return apply_filters('optin_monster_data', $data, $optin->ID, $meta);
 }
Ejemplo n.º 23
0
 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  *
  * @param int $optin_id The optin ID to target.
  */
 public function __construct($optin_id)
 {
     // Load the base class object and other class properties.
     $this->base = Optin_Monster::get_instance();
     $this->preview = Optin_Monster_Output::get_instance()->is_preview();
     $this->optin_id = $optin_id;
     $this->optin = Optin_Monster::get_instance()->get_optin($this->optin_id);
     $this->meta = get_post_meta($this->optin_id, '_om_meta', true);
 }
Ejemplo n.º 24
0
 /**
  * Legacy data upgrades from anything prior to version 2.0 of OptinMonster.
  *
  * @since 2.0.0
  */
 public function legacy_20()
 {
     // Grab optins (but not any in cache).
     $optins = get_posts(array('post_type' => 'optin', 'posts_per_page' => -1));
     if (!$optins) {
         return;
     }
     // Loop through each optin and update meta structures.
     foreach ((array) $optins as $optin) {
         $meta = get_post_meta($optin->ID, '_om_meta', true);
         // If the optin is a clone, create its own post meta field.
         if (isset($meta['is_clone']) && $meta['is_clone']) {
             update_post_meta($optin->ID, '_om_is_clone', $meta['is_clone']);
         }
         // If the optin has a clone, create its own post meta field as an array to allow unlimited split tests.
         if (isset($meta['has_clone']) && $meta['has_clone']) {
             $clones = array();
             $clones[] = $meta['has_clone'];
             update_post_meta($optin->ID, '_om_has_clone', $clones);
         }
         // Convert each theme name to the proper name for v2.
         if (!empty($meta['theme'])) {
             switch ($meta['theme']) {
                 case 'balance-theme':
                     $meta['theme'] = 'balance';
                     break;
                 case 'bullseye-theme':
                     $meta['theme'] = 'bullseye';
                     break;
                 case 'case-study-theme':
                     $meta['theme'] = 'case-study';
                     break;
                 case 'chalkboard-theme':
                     $meta['theme'] = 'chalkboard';
                     break;
                 case 'clean-slate-theme':
                     $meta['theme'] = 'clean-slate';
                     break;
                 case 'pendleton-theme':
                     $meta['theme'] = 'pendleton';
                     break;
                 case 'postal-theme':
                     $meta['theme'] = 'postal';
                     break;
                 case 'target-theme':
                     $meta['theme'] = 'target';
                     break;
                 case 'transparent-theme':
                     $meta['theme'] = 'transparent';
                     break;
                 case 'whiteboard-theme':
                     $meta['theme'] = 'whiteboard';
                     break;
                 case 'sleek-theme':
                     $meta['theme'] = 'sleek';
                     break;
                 case 'tiles-theme':
                     $meta['theme'] = 'tiles';
                     break;
                 case 'action-theme':
                     $meta['theme'] = 'action';
                     break;
                 case 'banner-theme':
                     $meta['theme'] = 'banner';
                     break;
                 case 'fabric-theme':
                     $meta['theme'] = 'fabric';
                     break;
                 case 'valley-theme':
                     $meta['theme'] = 'valley';
                     break;
                 case 'converse-theme':
                     $meta['theme'] = 'converse';
                     break;
             }
             // Update the meta so that the theme name is updated.
             update_post_meta($optin->ID, '_om_meta', $meta);
         }
     }
     // Grab options from the old v1 setting and add it to the new setting.
     $v1_option = get_option('optin_monster_license');
     $v2_option = get_option('optin_monster');
     if (!$v2_option || empty($v2_option)) {
         $v2_option = Optin_Monster::default_options();
     }
     if (!empty($v1_option['key'])) {
         $v2_option['key'] = $v1_option['key'];
     }
     if (!empty($v1_option['global_cookie'])) {
         $v2_option['cookie'] = $v1_option['global_cookie'];
     }
     if (!empty($v1_option['aff_link'])) {
         $v2_option['affiliate_link'] = $v1_option['aff_link'];
     }
     if (!empty($v1_option['aff_link_pos'])) {
         $v2_option['affiliate_link_position'] = $v1_option['aff_link_pos'];
     }
     // Update the new option.
     update_option('optin_monster', $v2_option);
     // Update the option to be sure this does not run again.
     update_option('optin_monster_upgrade_2.0', true);
 }
Ejemplo n.º 25
0
/**
 * Adds a custom overlay to mobile optins.
 *
 * @since 2.0.0
 *
 * @param string $output The optin output.
 * @param int $id        The optin ID.
 * @return string        The custom mobile optin overlay.
 */
function optin_monster_mobile_custom_overlay($output, $optin_id)
{
    $optin = Optin_Monster::get_instance()->get_optin($optin_id);
    if (!$optin) {
        return $output;
    }
    $meta = get_post_meta($optin_id, '_om_meta', true);
    if (isset($meta['type']) && 'mobile' !== $meta['type']) {
        return $output;
    }
    return '<div id="om-' . $optin->post_name . '-overlay" class="optin-monster-mobile-overlay"></div>' . $output;
}
Ejemplo n.º 26
0
 /**
  * Grabs all the optin data necessary for the table UI.
  *
  * @since 2.0.0
  */
 public function optins_data()
 {
     return Optin_Monster::get_instance()->get_optins();
 }
Ejemplo n.º 27
0
 /**
  * Deactivates a license key entered by the user.
  *
  * @since 2.0.0
  */
 public function deactivate_key()
 {
     // Perform a request to deactivate the key.
     $deactivate = $this->perform_remote_request('deactivate-key', array('tgm-updater-key' => $_POST['optin-monster-license-key']));
     // If it returns false, send back a generic error message and return.
     if (!$deactivate) {
         $this->errors[] = __('There was an error connecting to the remote key API. Please try again later.', 'optin-monster');
         return;
     }
     // If an error is returned, set the error and return.
     if (!empty($deactivate->error)) {
         $this->errors[] = $deactivate->error;
         return;
     }
     // Otherwise, our request has been done successfully. Reset the option and set the success message.
     $this->success[] = isset($deactivate->success) ? $deactivate->success : __('Congratulations! You have deactivated the key from this site successfully.', 'optin-monster');
     update_option('optin_monster', Optin_Monster::default_options());
 }
Ejemplo n.º 28
0
/**
 * Returns the provider API object for handling email provider interactions.
 *
 * @since 2.0.0
 *
 * @param string $provider The provider to target.
 * @return object $api     The provider API object.
 */
function optin_monster_ajax_get_email_provider($provider)
{
    // Prepare the provider object based on the provider selected.
    $base = Optin_Monster::get_instance();
    $api = false;
    switch ($provider) {
        case 'activecampaign':
            require plugin_dir_path($base->file) . 'includes/providers/activecampaign.php';
            $api = new Optin_Monster_Provider_ActiveCampaign();
            break;
        case 'feedblitz':
            require plugin_dir_path($base->file) . 'includes/providers/feedblitz.php';
            $api = new Optin_Monster_Provider_Feedblitz();
            break;
        case 'mailchimp':
            require plugin_dir_path($base->file) . 'includes/providers/mailchimp.php';
            $api = new Optin_Monster_Provider_Mailchimp();
            break;
        case 'sendinblue':
            require plugin_dir_path($base->file) . 'includes/providers/sendinblue.php';
            $api = new Optin_Monster_Provider_SendinBlue();
            break;
        case 'pardot':
            require plugin_dir_path($base->file) . 'includes/providers/pardot.php';
            $api = new Optin_Monster_Provider_Pardot();
            break;
        case 'madmimi':
            require plugin_dir_path($base->file) . 'includes/providers/madmimi.php';
            $api = new Optin_Monster_Provider_MadMimi();
            break;
        case 'getresponse':
            require plugin_dir_path($base->file) . 'includes/providers/getresponse.php';
            $api = new Optin_Monster_Provider_GetResponse();
            break;
        case 'totalsend':
            require plugin_dir_path($base->file) . 'includes/providers/totalsend.php';
            $api = new Optin_Monster_Provider_TotalSend();
            break;
        case 'aweber':
            require plugin_dir_path($base->file) . 'includes/providers/aweber.php';
            $api = new Optin_Monster_Provider_AWeber();
            break;
        case 'constant-contact':
            require plugin_dir_path($base->file) . 'includes/providers/constantcontact.php';
            $api = new Optin_Monster_Provider_ConstantContact();
            break;
        case 'hubspot':
            require plugin_dir_path($base->file) . 'includes/providers/hubspot.php';
            $api = new Optin_Monster_Provider_HubSpot();
            break;
        case 'campaign-monitor':
            require plugin_dir_path($base->file) . 'includes/providers/campaignmonitor.php';
            $api = new Optin_Monster_Provider_CampaignMonitor();
            break;
        case 'infusionsoft':
            require plugin_dir_path($base->file) . 'includes/providers/infusionsoft.php';
            $api = new Optin_Monster_Provider_Infusionsoft();
            break;
        case 'icontact':
            require plugin_dir_path($base->file) . 'includes/providers/icontact.php';
            $api = new Optin_Monster_Provider_iContact();
            break;
        case 'emma':
            require plugin_dir_path($base->file) . 'includes/providers/emma.php';
            $api = new Optin_Monster_Provider_Emma();
            break;
        case 'customerio':
            require plugin_dir_path($base->file) . 'includes/providers/customerio.php';
            $api = new Optin_Monster_Provider_Customerio();
            break;
        case 'custom':
            require plugin_dir_path($base->file) . 'includes/providers/custom.php';
            $api = new Optin_Monster_Provider_Custom();
            break;
        case 'mailpoet':
            require plugin_dir_path($base->file) . 'includes/providers/mailpoet.php';
            $api = new Optin_Monster_Provider_Mailpoet();
            break;
        case 'marketo':
            require plugin_dir_path($base->file) . 'includes/providers/marketo.php';
            $api = new Optin_Monster_Provider_Marketo();
            break;
        case 'mailerlite':
            require plugin_dir_path($base->file) . 'includes/providers/mailerlite.php';
            $api = new Optin_Monster_Provider_MailerLite();
            break;
    }
    return apply_filters('optin_monster_provider_object', $api, $provider);
}