コード例 #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
 /**
  * Initialize plugin load
  */
 public function init()
 {
     // activate plugin and resource builder
     $this->resourceBuilder();
     $this->essb();
     // Social Share Optimization
     if (defined('ESSB3_SSO_ACTIVE')) {
         $this->factoryActivate('sso', 'ESSBSocialShareOptimization');
     }
     // Social Share Analytics
     if (defined('ESSB3_SSA_ACTIVE')) {
         $tracker = ESSBSocialShareAnalytics::get_instance();
         $this->resourceBuilder()->add_js($this->socialShareAnalytics()->generate_tracker_code(), true, 'essb-stats-tracker');
     }
     // After Share Actions
     if (defined('ESSB3_AFTERSHARE_ACTIVE')) {
         foreach ($this->afterShareActions()->resource_files as $key => $object) {
             $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         foreach ($this->afterShareActions()->js_code as $key => $code) {
             $this->resourceBuilder()->add_js($code, false, 'essbasc_custom' . $key);
         }
         foreach ($this->afterShareActions()->social_apis as $key => $code) {
             $this->resourceBuilder()->add_social_api($key);
         }
     }
     // Love this button
     if (defined('ESSB3_LOVEYOU_ACTIVE')) {
         $this->resourceBuilder()->add_js($this->loveThisButton()->generate_js_code(), true, 'essb-loveyou-code');
     }
     // On Media Sharing
     if (defined('ESSB3_IMAGESHARE_ACTIVE')) {
         $this->factoryActivate('essbis', 'ESSBSocialImageShare');
         $this->resourceBuilder()->add_css(ESSBResourceBuilderSnippets::css_build_imageshare_customizer(), 'essb-imageshare-customizer', 'footer');
     }
     // Social Profiles
     if (!defined('ESSB3_LIGHTMODE')) {
         if (defined('ESSB3_SOCIALPROFILES_ACTIVE')) {
             $this->factoryActivate('essbsp', 'ESSBSocialProfiles');
             $this->resourceBuilder()->add_static_resource(ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css', 'easy-social-share-buttons-profles', 'css');
         }
     }
     // Followers Counter
     if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
         $this->factoryActivate('essbfc', 'ESSBSocialFollowersCounter');
         $this->resourceBuilder()->add_css(ESSBResourceBuilderSnippets::css_build_followerscounter_customizer(), 'essb-followerscounter-customizer', 'footer');
     }
     if (!defined('ESSB3_LIGHTMODE')) {
         if (defined('ESSB3_NATIVE_ACTIVE')) {
             // Social Privacy Buttons when active include resources
             $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance();
             ESSBNativeButtonsHelper::$essb_spb = $essb_spb;
             foreach ($this->privacyNativeButtons()->resource_files as $key => $object) {
                 $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]);
             }
             foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) {
                 $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]);
             }
             $this->resourceBuilder()->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->resourceBuilder()->add_social_api($key);
             }
         }
     }
     if (is_admin()) {
         $this->asAdmin();
     }
 }