PluginProbe
GetResponse Forms by Optin Cat / 1.4.0
GetResponse Forms by Optin Cat v1.4.0
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
getresponse / getresponse-wp.php

getresponse-wp.php in GetResponse Forms by Optin Cat 1.4.0, at getresponse-wp.php

300 lines 11.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 Viisots Into Email Subscribers. Set It Up In 2 Minutes.
6 Author: Fatcat Apps
7 Version: 1.4.0
8 Author URI: https://fatcatapps.com/
9 */
10
11 // define( 'FCA_EOI_DEBUG', true );
12 if ( ! function_exists( 'is_admin' ) ) {
13 exit();
14 }
15
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 define( 'FCA_EOI_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
29 define( 'FCA_EOI_PLUGIN_FILE', __FILE__ );
30 define( 'FCA_EOI_PLUGIN_URL', plugins_url( '', __FILE__ ) );
31
32 if( ! defined ( 'FCA_EOI_DEBUG' ) ) {
33 define( 'FCA_EOI_DEBUG', false );
34 }
35 if ( ! class_exists ( 'Mustache_Engine' ) ) {
36 require FCA_EOI_PLUGIN_DIR . 'includes/classes/Mustache/Autoloader.php';
37 Mustache_Autoloader::register();
38 }
39
40 /**
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__
46 */
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 }
53 }
54
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 }
61
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' );
65
66 $fca_eoi_animation_enabled = false; //ONLY ENQUEUE WHEN ITS TURNED ON
67
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
76 if( ! class_exists( 'DhEasyOptIns' ) ) {
77 class DhEasyOptIns {
78
79 var $ver = '1.4.0';
80 var $distro = '';
81 var $shortcode = 'optin-cat';
82 var $shortcode_aliases = array(
83 'easy-opt-in',
84 'optincat',
85 'opt-in-cat',
86 );
87 var $settings;
88 var $provider = '';
89 var $providers = array();
90
91 function __construct() {
92
93 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-error-handler.php';
94 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-post-types.php';
95 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-settings.php';
96 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-layout.php';
97 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-shortcode.php';
98 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-widget.php';
99 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-pointer.php';
100 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-tour-pointer.php';
101 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
102 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-init.php';
103 require FCA_EOI_PLUGIN_DIR . 'includes/compatibility-mode/eoi-compatibility-mode.php';
104
105 global $fca_eoi_shortcodes;
106
107 $post_type = $this->get_current_post_type();
108 $eoi_settings = get_option('easy_opt_in_settings');
109
110 // Settings
111 $this->settings();
112
113 // Add provider to settings
114 $providers_available = array_keys( $this->settings[ 'providers' ] );
115
116 //set current post type to setting array
117 $this->settings[ 'post_type' ] = $post_type;
118
119 // If there is only one provider, use it
120 if( 1 == count( $providers_available ) ) {
121 $this->provider = $this->settings[ 'provider' ] = $providers_available[ 0 ];
122 }
123
124 // Distributions
125 if( 1 == count( $providers_available ) ) {
126 $this->distro = 'free';
127 $this->settings['distribution'] = 'free';
128 } else {
129 $this->distro = 'premium';
130 $this->settings['distribution'] = 'premium';
131 }
132
133 // Add options that are stored in DB if any
134 $this->settings[ 'eoi_settings' ] = $eoi_settings;
135
136 // Include provider helper class(es)
137 foreach ( $providers_available as $provider ) {
138 require $this->settings[ 'plugin_dir' ] . "providers/$provider/functions.php";
139 }
140
141 // Load extensions
142 $post_types = new EasyOptInsPostTypes($this->settings);
143 $fca_eoi_shortcodes = new EasyOptInsShortcodes($this->settings);
144 $widget = new EasyOptInsWidgetHelper($this->settings);
145 EasyOptInsActivity::get_instance()->settings = $this->settings;
146 EasyOptInsInit::get_instance()->setup();
147
148 // Load subscribing banner for free users
149 if( 1 == count( $providers_available ) ) {
150 $pointer = new EasyOptInsPointer( $this->settings );
151 }
152
153 //Load tour pointer
154 //$tour_pointer = new EOITourPointer($this->settings );
155
156 //load compatibility-mode
157 new EasyOptInsCompatibilityMode( $this->settings );
158
159 //load EasyOptIns Upgrade notifications
160 if( count( $providers_available ) === 1 ) {
161 require plugin_dir_path( __FILE__ ) . 'includes/eoi-upgrade.php';
162 new EasyOptInsUpgrade( $this->settings );
163 }
164 }
165
166 function get_current_post_type() {
167
168 global $post, $typenow, $current_screen;
169
170 if ( $post && $post->post_type ) {
171 return $post->post_type;
172 } elseif( $typenow ) {
173 return $typenow;
174 } elseif( $current_screen && $current_screen->post_type ) {
175 return $current_screen->post_type;
176 } elseif( isset( $_REQUEST['post_type'] ) ) {
177 return sanitize_key( $_REQUEST['post_type'] );
178 } elseif ( isset( $_REQUEST['post'] ) && $_REQUEST['post'] ) {
179 $id = $_REQUEST['post'];
180 $post_obj = get_post( $id );
181 if( $post_obj ) {
182 return $post_obj->post_type;
183 }
184 }
185 return null;
186 }
187
188 function settings() {
189 $this->settings['plugin_dir'] = FCA_EOI_PLUGIN_DIR;
190 $this->settings['plugin_url'] = FCA_EOI_PLUGIN_URL;
191 $this->settings['shortcode'] = $this->shortcode;
192 $this->settings['shortcode_aliases'] = $this->shortcode_aliases;
193 $this->settings['version'] = $this->ver;
194 $this->settings['provider'] = $this->provider;
195
196 // Load all providers
197 foreach ( glob( $this->settings[ 'plugin_dir' ] . 'providers/*', GLOB_ONLYDIR ) as $provider_path ) {
198 $provider_id = basename( $provider_path );
199 require_once "$provider_path/provider.php";
200 $this->settings[ 'providers' ][ $provider_id ] = call_user_func( "provider_$provider_id" );
201 }
202
203 if ( $_SERVER['REQUEST_METHOD'] == 'POST' && ! empty( $_POST['paf_submit'] ) ) {
204 $options_before = get_option('paf');
205 $options_after = empty( $_POST['paf'] ) ? array() : $_POST['paf'];
206 $options_changed = true;
207 } else {
208 $options_changed = false;
209 }
210
211 // Load all powerups
212 foreach ( glob( $this->settings[ 'plugin_dir' ] . 'powerups/*', GLOB_ONLYDIR ) as $powerup_path ) {
213 $powerup_id = basename( $powerup_path );
214 $powerup_id = preg_replace('/(\d+)_/', '', $powerup_id);
215
216 require_once "$powerup_path/powerup.php";
217 $function_name = "powerup_$powerup_id";
218 $this->settings[ 'powerups' ][ $powerup_id ] = call_user_func( $function_name, $this->settings );
219
220 $option_name = 'eoi_' . $function_name;
221 if ( $options_changed ) {
222 $hook_function_name = null;
223
224 if ( empty( $options_before[ $option_name ] ) && ! empty( $options_after[ $option_name ] ) ) {
225 $hook_function_name = $function_name . '_on_activate';
226 } else if ( ! empty( $options_before[ $option_name ] ) && empty( $options_after[ $option_name ] ) ) {
227 $hook_function_name = $function_name . '_on_deactivate';
228 }
229
230 if ( ! empty( $hook_function_name ) && function_exists( $hook_function_name ) ) {
231 call_user_func( $hook_function_name, $this->settings );
232 }
233 }
234 }
235
236 paf_pages( array( 'eoi_powerups' => array(
237 'title' => __( 'Power Ups Settings' ),
238 'menu_title' => __( 'Power Ups' ),
239 'parent' => 'edit.php?post_type=easy-opt-ins',
240 ) ) );
241
242 $this->settings['error_text'] = array(
243 'field_required' => 'Error: This field is required.',
244 'invalid_email' => "Error: Please enter a valid email address. For example \"max@domain.com\"."
245 );
246 }
247 }
248 }
249
250 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
251
252 if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
253 function fca_eoi_fail_activation( $message ) {
254 wp_die( sprintf(
255 '<h2>%s</h2><p>%s</p><p><a class="button button-large" href="%s">%s</a></p>'
256 , __( 'Ooops!' )
257 , __( $message )
258 , admin_url( 'plugins.php' )
259 , __( 'Go to plugins page' )
260 ) );
261 }
262
263 function fca_eoi_activation() {
264 $plugins = get_plugins();
265
266 // Fail to activate the plugin if other Optin Cat plugins are already active
267 foreach ( $plugins as $file => $plugin ) {
268 if ( stripos( $plugin['PluginURI'], 'fatcatapps.com/optincat' ) !== false && is_plugin_active( $file ) ) {
269 $current_plugin = $plugins[ plugin_basename( __FILE__ ) ];
270 fca_eoi_fail_activation(
271 'Only one Optin Cat plugin can be active at a time, but you already have ' .
272 htmlspecialchars( $plugin['Name'] ) . ' active. ' .
273 'Please deactivate it before activating ' .
274 htmlspecialchars( $current_plugin['Name'] ) . '.' );
275 }
276 }
277
278 // Fail to activate the plugin if the providers or layouts directories are empty
279 $providers = glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR );
280 $layouts = glob( FCA_EOI_PLUGIN_DIR . 'layouts/*', GLOB_ONLYDIR );
281
282 if ( empty( $providers ) || empty( $layouts ) ) {
283 fca_eoi_fail_activation( 'Something went wrong. Please delete the plugin and install it again.' );
284 }
285
286 // If everything went well, continue with the activation setup
287 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php';
288 EasyOptInsActivity::get_instance()->setup();
289
290 require FCA_EOI_PLUGIN_DIR . 'includes/eoi-init.php';
291 EasyOptInsInit::get_instance()->on_activate();
292 }
293
294 // If the plugin is not yet active, check for any obstacles in activation
295 register_activation_hook( __FILE__, 'fca_eoi_activation' );
296 return;
297 }
298
299 $dh_easy_opt_ins_plugin = new DhEasyOptIns();
300