| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: GetResponse Forms by Optin Cat |
| 4 |
Plugin URI: https://fatcatapps.com/optincat |
| 5 |
Description: The GetResponse Optin Cat WordPress Lets You Convert More Blog Visits Into Email Subscribers. Set It Up In 2 Minutes. |
| 6 |
Author: Fatcat Apps |
| 7 |
Version: 2.2.2 |
| 8 |
Author URI: https://fatcatapps.com/ |
| 9 |
*/ |
| 10 |
|
| 11 |
// define( 'FCA_EOI_DEBUG', true ); |
| 12 |
|
| 13 |
if ( ! function_exists( 'is_admin' ) ) { |
| 14 |
exit(); |
| 15 |
} |
| 16 |
|
| 17 |
define( 'FCA_EOI_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 18 |
define( 'FCA_EOI_PLUGIN_FILE', __FILE__ ); |
| 19 |
define( 'FCA_EOI_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 20 |
define( 'FCA_EOI_EDITION', 'getresponse' ); |
| 21 |
define( 'FCA_EOI_PLUGIN_SLUG', 'getresponse' ); |
| 22 |
define( 'FCA_EOI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 23 |
define( 'FCA_EOI_VER', '2.2.2' ); |
| 24 |
|
| 25 |
if( ! defined ( 'FCA_EOI_DEBUG' ) ) { |
| 26 |
define( 'FCA_EOI_DEBUG', false ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Include and instantiate Mobile Detect |
| 31 |
*/ |
| 32 |
|
| 33 |
if( ! class_exists( 'DhEasyOptIns' ) ) { |
| 34 |
class DhEasyOptIns { |
| 35 |
|
| 36 |
var $distro = ''; |
| 37 |
var $shortcode = 'optin-cat'; |
| 38 |
var $shortcode_aliases = array( |
| 39 |
'easy-opt-in', |
| 40 |
'optincat', |
| 41 |
'opt-in-cat', |
| 42 |
); |
| 43 |
var $settings; |
| 44 |
var $provider = ''; |
| 45 |
var $providers = array(); |
| 46 |
var $post_type_obj = ''; |
| 47 |
|
| 48 |
function __construct() { |
| 49 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/classes/k/k.php'; |
| 50 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-powerups.php'; |
| 51 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-subscribers.php'; |
| 52 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-post-types.php'; |
| 53 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-layout.php'; |
| 54 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-shortcode.php'; |
| 55 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-widget.php'; |
| 56 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-pointer.php'; |
| 57 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-tour-pointer.php'; |
| 58 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php'; |
| 59 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-functions.php'; |
| 60 |
require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-uninstall.php'; |
| 61 |
|
| 62 |
global $fca_eoi_shortcodes; |
| 63 |
|
| 64 |
// Settings |
| 65 |
$this->settings['shortcode'] = $this->shortcode; |
| 66 |
$this->settings['shortcode_aliases'] = $this->shortcode_aliases; |
| 67 |
$this->settings['provider'] = $this->provider; |
| 68 |
|
| 69 |
// Load all providers |
| 70 |
foreach ( glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR ) as $provider_path ) { |
| 71 |
$provider_id = basename( $provider_path ); |
| 72 |
require_once "$provider_path/provider.php"; |
| 73 |
$this->settings[ 'providers' ][ $provider_id ] = call_user_func( "provider_$provider_id" ); |
| 74 |
} |
| 75 |
|
| 76 |
// Add provider to settings |
| 77 |
$providers_available = array_keys( $this->settings[ 'providers' ] ); |
| 78 |
|
| 79 |
//set current post type to setting array |
| 80 |
$this->settings[ 'post_type' ] = get_post_type(); |
| 81 |
|
| 82 |
// If there is only one provider, use it |
| 83 |
if( 1 == count( $providers_available ) ) { |
| 84 |
$this->provider = $this->settings[ 'provider' ] = $providers_available[ 0 ]; |
| 85 |
$this->distro = 'free'; |
| 86 |
$this->settings['distribution'] = 'free'; |
| 87 |
} else { |
| 88 |
$this->distro = 'premium'; |
| 89 |
$this->settings['distribution'] = 'premium'; |
| 90 |
} |
| 91 |
|
| 92 |
// Include provider helper class(es) |
| 93 |
foreach ( $providers_available as $provider ) { |
| 94 |
require_once FCA_EOI_PLUGIN_DIR . "providers/$provider/functions.php"; |
| 95 |
} |
| 96 |
|
| 97 |
// Load extensions |
| 98 |
$this->post_type_obj = new EasyOptInsPostTypes($this->settings); |
| 99 |
$fca_eoi_shortcodes = new EasyOptInsShortcodes($this->settings); |
| 100 |
$widget = new EasyOptInsWidgetHelper($this->settings); |
| 101 |
EasyOptInsActivity::get_instance()->settings = $this->settings; |
| 102 |
|
| 103 |
// Load subscribing banner for free users |
| 104 |
if( $this->distro == 'free' ) { |
| 105 |
$pointer = new EasyOptInsPointer( $this->settings ); |
| 106 |
//load EasyOptIns Upgrade notifications |
| 107 |
require plugin_dir_path( __FILE__ ) . 'includes/eoi-upgrade.php'; |
| 108 |
new EasyOptInsUpgrade( $this->settings ); |
| 109 |
} |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 115 |
|
| 116 |
if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
| 117 |
function fca_eoi_fail_activation( $message ) { |
| 118 |
wp_die( sprintf( |
| 119 |
'<h2>%s</h2><p>%s</p><p><a class="button button-large" href="%s">%s</a></p>' |
| 120 |
, __( 'Ooops!' ) |
| 121 |
, __( $message ) |
| 122 |
, admin_url( 'plugins.php' ) |
| 123 |
, __( 'Go to plugins page' ) |
| 124 |
) ); |
| 125 |
} |
| 126 |
|
| 127 |
function fca_eoi_activation() { |
| 128 |
$plugins = get_plugins(); |
| 129 |
|
| 130 |
// Fail to activate the plugin if other Optin Cat plugins are already active |
| 131 |
foreach ( $plugins as $file => $plugin ) { |
| 132 |
if ( stripos( $plugin['PluginURI'], 'fatcatapps.com/optincat' ) !== false && is_plugin_active( $file ) ) { |
| 133 |
$current_plugin = $plugins[ plugin_basename( __FILE__ ) ]; |
| 134 |
fca_eoi_fail_activation( |
| 135 |
'Only one Optin Cat plugin can be active at a time, but you already have ' . |
| 136 |
htmlspecialchars( $plugin['Name'] ) . ' active. ' . |
| 137 |
'Please deactivate it before activating ' . |
| 138 |
htmlspecialchars( $current_plugin['Name'] ) . '.' ); |
| 139 |
} |
| 140 |
} |
| 141 |
|
| 142 |
// Fail to activate the plugin if the providers or layouts directories are empty |
| 143 |
$providers = glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR ); |
| 144 |
$layouts = glob( FCA_EOI_PLUGIN_DIR . 'layouts/*', GLOB_ONLYDIR ); |
| 145 |
|
| 146 |
if ( empty( $providers ) || empty( $layouts ) ) { |
| 147 |
fca_eoi_fail_activation( 'Something went wrong. Please delete the plugin and install it again.' ); |
| 148 |
} |
| 149 |
|
| 150 |
require FCA_EOI_PLUGIN_DIR . 'includes/eoi-functions.php'; |
| 151 |
|
| 152 |
//convert everyone to new Post Meta Format if they are on OLD |
| 153 |
fca_eoi_convert_post_meta(); |
| 154 |
//convert options from 'paf' to 'fca_eoi_settings' |
| 155 |
fca_eoi_convert_option_save(); |
| 156 |
|
| 157 |
//check for users of custom form, otherwise that feature is disabled |
| 158 |
$opt = get_option ( 'fca_eoi_allow_customform', '' ); |
| 159 |
if ( empty ( $opt ) ) { |
| 160 |
fca_eoi_set_custom_form_depreciation(); |
| 161 |
} |
| 162 |
|
| 163 |
// If everything went well, continue with the activation setup |
| 164 |
require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php'; |
| 165 |
EasyOptInsActivity::get_instance()->setup(); |
| 166 |
} |
| 167 |
|
| 168 |
// If the plugin is not yet active, check for any obstacles in activation |
| 169 |
register_activation_hook( __FILE__, 'fca_eoi_activation' ); |
| 170 |
return; |
| 171 |
} |
| 172 |
|
| 173 |
$dh_easy_opt_ins_plugin = new DhEasyOptIns(); |
| 174 |
|