/** * 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(); }
/** * 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')); }
/** * 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'; }
/** * 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')); }
/** * 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); }
/** * 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'); }
/** * 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(); }
/** * 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')); }
/** * Primary class constructor. * * @since 2.0.0 */ public function __construct() { // Load the base class object. $this->base = Optin_Monster::get_instance(); // Bring the old v1 global license key variable into scope. global $optin_monster_license; $optin_monster_license = get_option('optin_monster_license'); // Load legacy and upgrade features. add_action('init', array($this, 'legacy'), 999); }
/** * 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(); }
/** * 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')); }
/** * 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); }
/** * 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(); }
/** * 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'; }
/** * 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')); }
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(); }
/** * 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(); }
/** * Primary class constructor. * * @since 2.0.0 */ public function __construct() { // Load the base class object. $this->base = Optin_Monster::get_instance(); // Possibly verify the key. $this->maybe_verify_key(); // Add potential admin notices for actions around the admin. add_action('admin_notices', array($this, 'notices')); // Grab the license key. If it is not set (even after verification), return early. $this->key = $this->base->get_license_key(); if (!$this->key) { return; } // Possibly handle validating, deactivating and refreshing license keys. $this->maybe_validate_key(); $this->maybe_deactivate_key(); $this->maybe_refresh_key(); }
/** * 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); }
/** * 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')); }
/** * Fired when the plugin is uninstalled. * * @since 2.0.0 * * @global object $wpdb The WordPress database object. */ function optin_monster_uninstall_hook() { // Load the datastore interfaces. require plugin_dir_path(__FILE__) . 'includes/global/datastore-interface.php'; require plugin_dir_path(__FILE__) . 'includes/global/lead-datastore.php'; $instance = Optin_Monster::get_instance(); global $wpdb; if (is_multisite()) { $site_list = $wpdb->get_results("SELECT * FROM {$wpdb->blogs} ORDER BY blog_id"); foreach ((array) $site_list as $site) { switch_to_blog($site->blog_id); delete_option('optin_monster'); delete_option('optin_monster_preview_page'); restore_current_blog(); } } else { delete_option('optin_monster'); delete_option('optin_monster_preview_page'); // Drop the leads table. $leads = new Optin_Monster_Lead_Datastore($wpdb); $leads->remove_table(); } }
/** * 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; } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); }
/** * 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; }
/** * 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); }