settings['shortcode'] = $this->shortcode; $this->settings['shortcode_aliases'] = $this->shortcode_aliases; $this->settings['provider'] = $this->provider; // Load all providers foreach ( glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR ) as $provider_path ) { $provider_id = basename( $provider_path ); require_once "$provider_path/provider.php"; $this->settings[ 'providers' ][ $provider_id ] = call_user_func( "provider_$provider_id" ); } // Add provider to settings $providers_available = array_keys( $this->settings[ 'providers' ] ); //set current post type to setting array $this->settings[ 'post_type' ] = get_post_type(); // If there is only one provider, use it if( 1 == count( $providers_available ) ) { $this->provider = $this->settings[ 'provider' ] = $providers_available[ 0 ]; $this->distro = 'free'; $this->settings['distribution'] = 'free'; } else { $this->distro = 'premium'; $this->settings['distribution'] = 'premium'; } // Include provider helper class(es) foreach ( $providers_available as $provider ) { require_once FCA_EOI_PLUGIN_DIR . "providers/$provider/functions.php"; } // Load extensions $this->post_type_obj = new EasyOptInsPostTypes($this->settings); $fca_eoi_shortcodes = new EasyOptInsShortcodes($this->settings); $widget = new EasyOptInsWidgetHelper($this->settings); EasyOptInsActivity::get_instance()->settings = $this->settings; // Load subscribing banner for free users if( $this->distro == 'free' ) { $pointer = new EasyOptInsPointer( $this->settings ); //load EasyOptIns Upgrade notifications require plugin_dir_path( __FILE__ ) . 'includes/eoi-upgrade.php'; new EasyOptInsUpgrade( $this->settings ); } } } } require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { function fca_eoi_fail_activation( $message ) { wp_die( sprintf( '

%s

%s

%s

' , __( 'Ooops!' ) , __( $message ) , admin_url( 'plugins.php' ) , __( 'Go to plugins page' ) ) ); } function fca_eoi_activation() { $plugins = get_plugins(); // Fail to activate the plugin if other Optin Cat plugins are already active foreach ( $plugins as $file => $plugin ) { if ( stripos( $plugin['PluginURI'], 'fatcatapps.com/optincat' ) !== false && is_plugin_active( $file ) ) { $current_plugin = $plugins[ plugin_basename( __FILE__ ) ]; fca_eoi_fail_activation( 'Only one Optin Cat plugin can be active at a time, but you already have ' . htmlspecialchars( $plugin['Name'] ) . ' active. ' . 'Please deactivate it before activating ' . htmlspecialchars( $current_plugin['Name'] ) . '.' ); } } // Fail to activate the plugin if the providers or layouts directories are empty $providers = glob( FCA_EOI_PLUGIN_DIR . 'providers/*', GLOB_ONLYDIR ); $layouts = glob( FCA_EOI_PLUGIN_DIR . 'layouts/*', GLOB_ONLYDIR ); if ( empty( $providers ) || empty( $layouts ) ) { fca_eoi_fail_activation( 'Something went wrong. Please delete the plugin and install it again.' ); } require FCA_EOI_PLUGIN_DIR . 'includes/eoi-functions.php'; //convert everyone to new Post Meta Format if they are on OLD fca_eoi_convert_post_meta(); //convert options from 'paf' to 'fca_eoi_settings' fca_eoi_convert_option_save(); //check for users of custom form, otherwise that feature is disabled $opt = get_option ( 'fca_eoi_allow_customform', '' ); if ( empty ( $opt ) ) { fca_eoi_set_custom_form_depreciation(); } // If everything went well, continue with the activation setup require FCA_EOI_PLUGIN_DIR . 'includes/eoi-activity.php'; EasyOptInsActivity::get_instance()->setup(); } // If the plugin is not yet active, check for any obstacles in activation register_activation_hook( __FILE__, 'fca_eoi_activation' ); return; } $dh_easy_opt_ins_plugin = new DhEasyOptIns();