PluginProbe
GetResponse Forms by Optin Cat / trunk
GetResponse Forms by Optin Cat vtrunk
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 trunk, at getresponse-wp.php

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