コード例 #1
0
 public static function get_instance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 function __construct()
 {
     include_once ESSB3_PLUGIN_ROOT . 'lib/essb-core-includes.php';
     // begin plugin front end code execution
     $this->essb_resource_builder = ESSBResourceBuilder::get_instance();
     $this->essb = ESSBCore::get_instance();
     // loading social share optimization only when it is active
     if (defined('ESSB3_SSO_ACTIVE')) {
         ESSBSocialShareOptimization::get_instance();
     }
     if (defined('ESSB3_SSA_ACTIVE')) {
         $tracker = ESSBSocialShareAnalytics::get_instance();
         $this->essb_resource_builder->add_js($tracker->generate_tracker_code(), true, 'essb-stats-tracker');
     }
     if (defined('ESSB3_AFTERSHARE_ACTIVE')) {
         $essb_asc = ESSBAfterCloseShare3::get_instance();
         foreach ($essb_asc->resource_files as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         foreach ($essb_asc->js_code as $key => $code) {
             $this->essb_resource_builder->add_js($code, false, 'essbasc_custom' . $key);
         }
         foreach ($essb_asc->social_apis as $key => $code) {
             $this->essb_resource_builder->add_social_api($key);
         }
     }
     if (defined('ESSB3_LOVEYOU_ACTIVE')) {
         $essb_loveyou = ESSBNetworks_LoveThis::get_instance();
         $this->essb_resource_builder->add_js($essb_loveyou->generate_js_code(), true, 'essb-loveyou-code');
     }
     if (defined('ESSB3_IMAGESHARE_ACTIVE')) {
         ESSBSocialImageShare::get_instance();
         $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_imageshare_customizer(), 'essb-imageshare-customizer', 'footer');
     }
     if (defined('ESSB3_SOCIALPROFILES_ACTIVE')) {
         ESSBSocialProfiles::get_instance();
         $this->essb_resource_builder->add_static_resource(ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css', 'easy-social-share-buttons-profles', 'css');
     }
     if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
         ESSBSocialFansCounter::get_instance();
         $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_fanscounter_customizer(), 'essb-fanscounter-customizer', 'footer');
     }
     if (defined('ESSB3_NATIVE_ACTIVE')) {
         // Social Privacy Buttons when active include resources
         $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance();
         ESSBNativeButtonsHelper::$essb_spb = $essb_spb;
         foreach ($essb_spb->resource_files as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         $this->essb_resource_builder->add_css(ESSBSkinnedNativeButtons::generate_skinned_custom_css(), 'essb-skinned-native-buttons');
         // asign instance of native buttons privacy class to helper
         // register active social network apis
         foreach (ESSBNativeButtonsHelper::get_list_of_social_apis() as $key => $code) {
             $this->essb_resource_builder->add_social_api($key);
         }
     }
     if (is_admin()) {
         include_once ESSB3_PLUGIN_ROOT . 'lib/admin/essb-admin-includes.php';
         ESSBAdminControler::get_instance();
         $exist_user_purchase_code = ESSBOptionValuesHelper::options_value($essb_options, 'purchase_code');
         if (!empty($exist_user_purchase_code) || defined('ESSB3_THEME_INTEGRATED')) {
             include ESSB3_PLUGIN_ROOT . 'lib/external/autoupdate/plugin-update-checker.php';
             // @since 1.3.3
             // autoupdate
             // activating autoupdate option
             $essb_autoupdate = PucFactory::buildUpdateChecker('http://update.creoworx.com/essb3/', __FILE__, 'easy-social-share-buttons3');
             // @since 1.3.7.2 - update to avoid issues with other plugins that uses same
             // method
             function addSecretKeyESSB3($query)
             {
                 global $exist_user_purchase_code;
                 $query['license'] = $exist_user_purchase_code;
                 return $query;
             }
             $essb_autoupdate->addQueryArgFilter('addSecretKeyESSB3');
         }
     }
 }
コード例 #3
0
 public function handle_save_settings()
 {
     if (@$_POST && isset($_POST['option_page'])) {
         $changed = false;
         if ('essb_settings_group' == $this->getval($_POST, 'option_page')) {
             $this->update_optons();
             $this->update_fanscounter_options();
             $this->restore_settings();
             $this->apply_readymade();
             //$this->apply_import();
             $changed = true;
             if (class_exists('ESSBDynamicCache')) {
                 ESSBDynamicCache::flush();
             }
             if (function_exists('purge_essb_cache_static_cache')) {
                 purge_essb_cache_static_cache();
             }
         }
         if ($changed) {
             if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
                 ESSBSocialFansCounter::clear_cached_data();
             }
             $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
             $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
             //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
             $goback = esc_url_raw(add_query_arg(array('settings-updated' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
             //$goback = str_replace('#038;', '', $goback);
             wp_redirect($goback);
             die;
         }
     }
     if (@$_REQUEST && isset($_REQUEST['import2x'])) {
         $this->apply_import();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('import2x');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
 }