PluginProbe
GetResponse Forms by Optin Cat / 2.0.2
GetResponse Forms by Optin Cat v2.0.2
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
← All changes | getresponse-wp.php +130 -273 1.4.22.0.2 View file →
@@ -1,317 +1,174 @@
1 1 <?php
2 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 Viisots Into Email Subscribers. Set It Up In 2 Minutes.
6 - Author: Fatcat Apps
7 - Version: 1.4.2
8 - Author URI: https://fatcatapps.com/
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.0.2
8 + Author URI: https://fatcatapps.com/
9 9 */
10 10
11 11 // define( 'FCA_EOI_DEBUG', true );
12 +
12 13 if ( ! function_exists( 'is_admin' ) ) {
13 - exit();
14 + exit();
14 15 }
15 16
16 -/* REMOVE LINKS FOR USERS WITH FEWER PERMISSIONS THAN EDITOR */
17 -
18 -function FCA_EOI_remove_admin_bar_link() {
19 - if (!current_user_can( 'delete_others_pages' )){
20 - remove_meta_box( 'fca_eoi_dashboard_widget', 'dashboard', 'normal' );
21 - }
22 -}
23 -
24 -add_action( 'wp_before_admin_bar_render', 'FCA_EOI_remove_admin_bar_link' );
25 -
26 -require 'includes/skelet/skelet.php';
27 -
28 17 define( 'FCA_EOI_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
29 18 define( 'FCA_EOI_PLUGIN_FILE', __FILE__ );
30 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.0.2' );
31 24
32 25 if( ! defined ( 'FCA_EOI_DEBUG' ) ) {
33 - define( 'FCA_EOI_DEBUG', false );
26 + define( 'FCA_EOI_DEBUG', false );
34 27 }
35 -if ( ! class_exists ( 'Mustache_Engine' ) ) {
36 - require FCA_EOI_PLUGIN_DIR . 'includes/classes/Mustache/Autoloader.php';
37 - Mustache_Autoloader::register();
38 -}
39 28
40 29 /**
41 - * Include scssphp
42 - *
43 - * Latest version requires PHP 5.3
44 - * Version 0.0.15 works with PHP 5.2
45 - * We detect PHP > 5.3 by checking the constant __DIR__
30 + * Include and instantiate Mobile Detect
46 31 */
47 -if ( ! class_exists ( 'scssc' ) ) {
48 - if( defined( '__DIR__' ) ) {
49 - require FCA_EOI_PLUGIN_DIR . 'includes/classes/scssphp/scss.inc.php';
50 - } else {
51 - require FCA_EOI_PLUGIN_DIR . 'includes/classes/scssphp-0.0.15/scss.inc.php';
52 - }
32 +if ( !class_exists ( 'Mobile_Detect' ) ) {
33 + require FCA_EOI_PLUGIN_DIR . 'includes/classes/Mobile-Detect/Mobile_Detect.php';
53 34 }
54 35
55 -/**
56 - * Include and instanciate Mobile Detect
57 - */
58 -if ( ! class_exists ( 'Mobile_Detect' ) ) {
59 - require FCA_EOI_PLUGIN_DIR . 'includes/classes/Mobile-Detect/Mobile_Detect.php';
60 -}
36 +if( ! class_exists( 'DhEasyOptIns' ) ) {
37 + class DhEasyOptIns {
61 38
62 -/* ADD ANIMATION CSS TO FRONT-END AND ADMIN PAGES WHEN ENABLED */
63 -add_action( 'fca_eoi_display_lightbox', 'fca_eoi_load_animation_script_popup' );
64 -add_action( 'fca_eoi_render_animation_meta_box', 'fca_eoi_load_animation_script_popup' );
39 + var $distro = '';
40 + var $shortcode = 'optin-cat';
41 + var $shortcode_aliases = array(
42 + 'easy-opt-in',
43 + 'optincat',
44 + 'opt-in-cat',
45 + );
46 + var $settings;
47 + var $provider = '';
48 + var $providers = array();
49 + var $post_type_obj = '';
65 50
66 -$fca_eoi_animation_enabled = false; //ONLY ENQUEUE WHEN ITS TURNED ON
51 + function __construct() {
52 + require_once FCA_EOI_PLUGIN_DIR . 'includes/classes/k/k.php';
53 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-powerups.php';
54 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-post-types.php';
55 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-layout.php';
56 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-shortcode.php';
57 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-widget.php';
58 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-pointer.php';
59 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-tour-pointer.php';
60 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
61 + require_once FCA_EOI_PLUGIN_DIR . 'includes/eoi-functions.php';
67 62
68 -function fca_eoi_load_animation_script_popup() {
69 - global $fca_eoi_animation_enabled;
70 - if ( $fca_eoi_animation_enabled ) {
71 - wp_enqueue_style( 'fca_eoi_powerups_animate', plugin_dir_url( __FILE__ ) . 'assets/vendor/animate/animate.css' );
72 - }
73 -}
74 -
75 -function fca_eoi_get_error_texts($id) {
63 + global $fca_eoi_shortcodes;
76 64
77 - $post_meta = get_post_meta( $id , 'fca_eoi', true );
78 - $errorTexts = array(
79 - 'field_required' => $post_meta[ 'error_text_field_required' ],
80 - 'invalid_email' => $post_meta[ 'error_text_invalid_email' ],
81 - );
82 -
83 - if (!empty($errorTexts['field_required']) AND !empty($errorTexts['invalid_email'])) {
84 - return array(
85 - 'field_required' => $errorTexts['field_required'],
86 - 'invalid_email' => $errorTexts['invalid_email'],
87 - );
88 -
89 - }else{
90 -
91 - return array(
92 - 'field_required' => 'Error: This field is required.',
93 - 'invalid_email' => "Error: Please enter a valid email address. For example \"max@domain.com\"."
94 - );
95 - }
96 -}
65 + // Settings
66 + $this->settings['shortcode'] = $this->shortcode;
67 + $this->settings['shortcode_aliases'] = $this->shortcode_aliases;
68 + $this->settings['provider'] = $this->provider;
97 69
98 -if( ! class_exists( 'DhEasyOptIns' ) ) {
99 -class DhEasyOptIns {
70 + // Load all providers
71 + foreach ( glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR ) as $provider_path ) {
72 + $provider_id = basename( $provider_path );
73 + require_once "$provider_path/provider.php";
74 + $this->settings[ 'providers' ][ $provider_id ] = call_user_func( "provider_$provider_id" );
75 + }
100 76
101 - var $ver = '1.4.2';
102 - var $distro = '';
103 - var $shortcode = 'optin-cat';
104 - var $shortcode_aliases = array(
105 - 'easy-opt-in',
106 - 'optincat',
107 - 'opt-in-cat',
108 - );
109 - var $settings;
110 - var $provider = '';
111 - var $providers = array();
77 + // Add provider to settings
78 + $providers_available = array_keys( $this->settings[ 'providers' ] );
79 +
80 + //set current post type to setting array
81 + $this->settings[ 'post_type' ] = get_post_type();
112 82
113 - function __construct() {
83 + // If there is only one provider, use it
84 + if( 1 == count( $providers_available ) ) {
85 + $this->provider = $this->settings[ 'provider' ] = $providers_available[ 0 ];
86 + $this->distro = 'free';
87 + $this->settings['distribution'] = 'free';
88 + } else {
89 + $this->distro = 'premium';
90 + $this->settings['distribution'] = 'premium';
91 + }
114 92
115 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-error-handler.php';
116 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-post-types.php';
117 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-settings.php';
118 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-layout.php';
119 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-shortcode.php';
120 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-widget.php';
121 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-pointer.php';
122 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-tour-pointer.php';
123 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
124 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-init.php';
125 - require FCA_EOI_PLUGIN_DIR . 'includes/compatibility-mode/eoi-compatibility-mode.php';
93 + // Include provider helper class(es)
94 + foreach ( $providers_available as $provider ) {
95 + require_once FCA_EOI_PLUGIN_DIR . "providers/$provider/functions.php";
96 + }
126 97
127 - global $fca_eoi_shortcodes;
98 + // Load extensions
99 + $this->post_type_obj = new EasyOptInsPostTypes($this->settings);
100 + $fca_eoi_shortcodes = new EasyOptInsShortcodes($this->settings);
101 + $widget = new EasyOptInsWidgetHelper($this->settings);
102 + EasyOptInsActivity::get_instance()->settings = $this->settings;
128 103
129 - $post_type = $this->get_current_post_type();
130 - $eoi_settings = get_option('easy_opt_in_settings');
131 -
132 - // Settings
133 - $this->settings();
134 -
135 - // Add provider to settings
136 - $providers_available = array_keys( $this->settings[ 'providers' ] );
137 -
138 - //set current post type to setting array
139 - $this->settings[ 'post_type' ] = $post_type;
140 -
141 - // If there is only one provider, use it
142 - if( 1 == count( $providers_available ) ) {
143 - $this->provider = $this->settings[ 'provider' ] = $providers_available[ 0 ];
144 - }
145 -
146 - // Distributions
147 - if( 1 == count( $providers_available ) ) {
148 - $this->distro = 'free';
149 - $this->settings['distribution'] = 'free';
150 - } else {
151 - $this->distro = 'premium';
152 - $this->settings['distribution'] = 'premium';
153 - }
154 -
155 - // Add options that are stored in DB if any
156 - $this->settings[ 'eoi_settings' ] = $eoi_settings;
157 -
158 - // Include provider helper class(es)
159 - foreach ( $providers_available as $provider ) {
160 - require $this->settings[ 'plugin_dir' ] . "providers/$provider/functions.php";
161 - }
162 -
163 - // Load extensions
164 - $post_types = new EasyOptInsPostTypes($this->settings);
165 - $fca_eoi_shortcodes = new EasyOptInsShortcodes($this->settings);
166 - $widget = new EasyOptInsWidgetHelper($this->settings);
167 - EasyOptInsActivity::get_instance()->settings = $this->settings;
168 - EasyOptInsInit::get_instance()->setup();
169 -
170 - // Load subscribing banner for free users
171 - if( 1 == count( $providers_available ) ) {
172 - $pointer = new EasyOptInsPointer( $this->settings );
173 - }
174 -
175 - //Load tour pointer
176 - //$tour_pointer = new EOITourPointer($this->settings );
177 -
178 - //load compatibility-mode
179 - new EasyOptInsCompatibilityMode( $this->settings );
180 -
181 - //load EasyOptIns Upgrade notifications
182 - if( count( $providers_available ) === 1 ) {
183 - require plugin_dir_path( __FILE__ ) . 'includes/eoi-upgrade.php';
184 - new EasyOptInsUpgrade( $this->settings );
185 - }
186 - }
187 -
188 - function get_current_post_type() {
189 -
190 - global $post, $typenow, $current_screen;
191 -
192 - if ( $post && $post->post_type ) {
193 - return $post->post_type;
194 - } elseif( $typenow ) {
195 - return $typenow;
196 - } elseif( $current_screen && $current_screen->post_type ) {
197 - return $current_screen->post_type;
198 - } elseif( isset( $_REQUEST['post_type'] ) ) {
199 - return sanitize_key( $_REQUEST['post_type'] );
200 - } elseif ( isset( $_REQUEST['post'] ) && $_REQUEST['post'] ) {
201 - $id = $_REQUEST['post'];
202 - $post_obj = get_post( $id );
203 - if( $post_obj ) {
204 - return $post_obj->post_type;
205 - }
206 - }
207 - return null;
208 - }
209 -
210 - function settings() {
211 - $this->settings['plugin_dir'] = FCA_EOI_PLUGIN_DIR;
212 - $this->settings['plugin_url'] = FCA_EOI_PLUGIN_URL;
213 - $this->settings['shortcode'] = $this->shortcode;
214 - $this->settings['shortcode_aliases'] = $this->shortcode_aliases;
215 - $this->settings['version'] = $this->ver;
216 - $this->settings['provider'] = $this->provider;
217 -
218 - // Load all providers
219 - foreach ( glob( $this->settings[ 'plugin_dir' ] . 'providers/*', GLOB_ONLYDIR ) as $provider_path ) {
220 - $provider_id = basename( $provider_path );
221 - require_once "$provider_path/provider.php";
222 - $this->settings[ 'providers' ][ $provider_id ] = call_user_func( "provider_$provider_id" );
223 - }
224 -
225 - if ( $_SERVER['REQUEST_METHOD'] == 'POST' && ! empty( $_POST['paf_submit'] ) ) {
226 - $options_before = get_option('paf');
227 - $options_after = empty( $_POST['paf'] ) ? array() : $_POST['paf'];
228 - $options_changed = true;
229 - } else {
230 - $options_changed = false;
231 - }
232 -
233 - // Load all powerups
234 - foreach ( glob( $this->settings[ 'plugin_dir' ] . 'powerups/*', GLOB_ONLYDIR ) as $powerup_path ) {
235 - $powerup_id = basename( $powerup_path );
236 - $powerup_id = preg_replace('/(\d+)_/', '', $powerup_id);
237 -
238 - require_once "$powerup_path/powerup.php";
239 - $function_name = "powerup_$powerup_id";
240 - $this->settings[ 'powerups' ][ $powerup_id ] = call_user_func( $function_name, $this->settings );
241 -
242 - $option_name = 'eoi_' . $function_name;
243 - if ( $options_changed ) {
244 - $hook_function_name = null;
245 -
246 - if ( empty( $options_before[ $option_name ] ) && ! empty( $options_after[ $option_name ] ) ) {
247 - $hook_function_name = $function_name . '_on_activate';
248 - } else if ( ! empty( $options_before[ $option_name ] ) && empty( $options_after[ $option_name ] ) ) {
249 - $hook_function_name = $function_name . '_on_deactivate';
250 - }
251 -
252 - if ( ! empty( $hook_function_name ) && function_exists( $hook_function_name ) ) {
253 - call_user_func( $hook_function_name, $this->settings );
254 - }
255 - }
256 - }
257 -
258 - paf_pages( array( 'eoi_powerups' => array(
259 - 'title' => __( 'Power Ups Settings' ),
260 - 'menu_title' => __( 'Power Ups' ),
261 - 'parent' => 'edit.php?post_type=easy-opt-ins',
262 - ) ) );
263 -
104 + // Load subscribing banner for free users
105 + if( $this->distro == 'free' ) {
106 + $pointer = new EasyOptInsPointer( $this->settings );
107 + //load EasyOptIns Upgrade notifications
108 + require plugin_dir_path( __FILE__ ) . 'includes/eoi-upgrade.php';
109 + new EasyOptInsUpgrade( $this->settings );
110 + }
111 + }
264 112 }
265 113 }
266 -}
267 114
268 115 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
269 116
270 117 if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
271 - function fca_eoi_fail_activation( $message ) {
272 - wp_die( sprintf(
273 - '<h2>%s</h2><p>%s</p><p><a class="button button-large" href="%s">%s</a></p>'
274 - , __( 'Ooops!' )
275 - , __( $message )
276 - , admin_url( 'plugins.php' )
277 - , __( 'Go to plugins page' )
278 - ) );
279 - }
118 + function fca_eoi_fail_activation( $message ) {
119 + wp_die( sprintf(
120 + '<h2>%s</h2><p>%s</p><p><a class="button button-large" href="%s">%s</a></p>'
121 + , __( 'Ooops!' )
122 + , __( $message )
123 + , admin_url( 'plugins.php' )
124 + , __( 'Go to plugins page' )
125 + ) );
126 + }
280 127
281 - function fca_eoi_activation() {
282 - $plugins = get_plugins();
128 + function fca_eoi_activation() {
129 + $plugins = get_plugins();
283 130
284 - // Fail to activate the plugin if other Optin Cat plugins are already active
285 - foreach ( $plugins as $file => $plugin ) {
286 - if ( stripos( $plugin['PluginURI'], 'fatcatapps.com/optincat' ) !== false && is_plugin_active( $file ) ) {
287 - $current_plugin = $plugins[ plugin_basename( __FILE__ ) ];
288 - fca_eoi_fail_activation(
289 - 'Only one Optin Cat plugin can be active at a time, but you already have ' .
290 - htmlspecialchars( $plugin['Name'] ) . ' active. ' .
291 - 'Please deactivate it before activating ' .
292 - htmlspecialchars( $current_plugin['Name'] ) . '.' );
293 - }
294 - }
131 + // Fail to activate the plugin if other Optin Cat plugins are already active
132 + foreach ( $plugins as $file => $plugin ) {
133 + if ( stripos( $plugin['PluginURI'], 'fatcatapps.com/optincat' ) !== false && is_plugin_active( $file ) ) {
134 + $current_plugin = $plugins[ plugin_basename( __FILE__ ) ];
135 + fca_eoi_fail_activation(
136 + 'Only one Optin Cat plugin can be active at a time, but you already have ' .
137 + htmlspecialchars( $plugin['Name'] ) . ' active. ' .
138 + 'Please deactivate it before activating ' .
139 + htmlspecialchars( $current_plugin['Name'] ) . '.' );
140 + }
141 + }
295 142
296 - // Fail to activate the plugin if the providers or layouts directories are empty
297 - $providers = glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR );
298 - $layouts = glob( FCA_EOI_PLUGIN_DIR . 'layouts/*', GLOB_ONLYDIR );
143 + // Fail to activate the plugin if the providers or layouts directories are empty
144 + $providers = glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR );
145 + $layouts = glob( FCA_EOI_PLUGIN_DIR . 'layouts/*', GLOB_ONLYDIR );
299 146
300 - if ( empty( $providers ) || empty( $layouts ) ) {
301 - fca_eoi_fail_activation( 'Something went wrong. Please delete the plugin and install it again.' );
302 - }
147 + if ( empty( $providers ) || empty( $layouts ) ) {
148 + fca_eoi_fail_activation( 'Something went wrong. Please delete the plugin and install it again.' );
149 + }
150 +
151 + require FCA_EOI_PLUGIN_DIR . 'includes/eoi-functions.php';
303 152
304 - // If everything went well, continue with the activation setup
305 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
306 - EasyOptInsActivity::get_instance()->setup();
153 + //convert everyone to new Post Meta Format if they are on OLD
154 + fca_eoi_convert_post_meta();
155 + //convert options from 'paf' to 'fca_eoi_settings'
156 + fca_eoi_convert_option_save();
157 +
158 + //check for users of custom form, otherwise that feature is disabled
159 + $opt = get_option ( 'fca_eoi_allow_customform', '' );
160 + if ( empty ( $opt ) ) {
161 + fca_eoi_set_custom_form_depreciation();
162 + }
163 +
164 + // If everything went well, continue with the activation setup
165 + require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
166 + EasyOptInsActivity::get_instance()->setup();
167 + }
307 168
308 - require FCA_EOI_PLUGIN_DIR . 'includes/eoi-init.php';
309 - EasyOptInsInit::get_instance()->on_activate();
310 - }
311 -
312 - // If the plugin is not yet active, check for any obstacles in activation
313 - register_activation_hook( __FILE__, 'fca_eoi_activation' );
314 - return;
169 + // If the plugin is not yet active, check for any obstacles in activation
170 + register_activation_hook( __FILE__, 'fca_eoi_activation' );
171 + return;
315 172 }
316 173
317 174 $dh_easy_opt_ins_plugin = new DhEasyOptIns();