public static function get_instance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 function __construct()
 {
     global $essb_options;
     $this->resource_builder = ESSBResourceBuilder::get_instance();
     $this->options = $essb_options;
     // load settings and defaults
     $this->load();
     //$this->register_assets();
     $this->register_locations();
     add_action('wp_ajax_nopriv_essb_self_postcount', array($this, 'actions_update_post_count'));
     add_action('wp_ajax_essb_self_postcount', array($this, 'actions_update_post_count'));
     add_action('wp_ajax_nopriv_essb_counts', array($this, 'actions_get_share_counts'));
     add_action('wp_ajax_essb_counts', array($this, 'actions_get_share_counts'));
     add_action('template_redirect', array($this, 'essb_proccess_light_ajax'), 1);
     //add_action ( 'wp_enqueue_scripts', array ($this, 'check_after_postload_settings' ), 1 );
     add_action('wp_enqueue_scripts', array($this, 'register_assets'), 1);
     // shortcodes
     add_shortcode('easy-profiles', array($this, 'essb_shortcode_profiles'));
     add_shortcode('easy-social-like', array($this, 'essb_shortcode_native'));
     add_shortcode('essb', array($this, 'essb_shortcode_share'));
     add_shortcode('easy-share', array($this, 'essb_shortcode_share'));
     add_shortcode('easy-social-share-buttons', array($this, 'essb_shortcode_share'));
     add_shortcode('easy-social-share', array($this, 'essb_shortcode_share_vk'));
     add_shortcode('easy-total-shares', array($this, 'essb_shortcode_total_shares'));
     add_shortcode('easy-social-share-popup', array($this, 'essb_shortcode_share_popup'));
     add_shortcode('easy-social-share-flyin', array($this, 'essb_shortcode_share_flyin'));
     // @since 3.3 myEventOn fix for display buttons in widgets
     if (class_exists('EventON')) {
         add_action('eventon_cal_variable_action', array($this, 'eventon_deactiate_content_filters'));
     }
 }
 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');
         }
     }
 }
 public function widget($args, $instance)
 {
     global $essb_available_social_profiles, $essb_options;
     if (ESSBCoreHelper::is_module_deactivate_on('profiles')) {
         return "";
     }
     extract($args);
     $before_widget = $args['before_widget'];
     $before_title = $args['before_title'];
     $after_title = $args['after_title'];
     $after_widget = $args['after_widget'];
     $show_title = $instance['show_title'];
     $title = $instance['title'];
     $sc_button_type = isset($instance['type']) ? $instance['type'] : 'square';
     $sc_button_size = isset($instance['size']) ? $instance['size'] : 'small';
     $sc_button_fill = isset($instance['style']) ? $instance['style'] : 'fill';
     $sc_nospace = $instance['nospace'];
     if (!empty($sc_nospace) && $sc_nospace != '0') {
         $sc_nospace = "true";
     } else {
         $sc_nospace = "false";
     }
     $sc_nospace = ESSBOptionValuesHelper::unified_true($sc_nospace);
     $sc_allowtext = isset($instance['allowtext']) ? $instance['allowtext'] : '0';
     if (!empty($sc_allowtext) && $sc_allowtext != '0') {
         $sc_allowtext = "true";
     } else {
         $sc_allowtext = "false";
     }
     $sc_allowtext = ESSBOptionValuesHelper::unified_true($sc_allowtext);
     $sc_width = isset($instance['width']) ? $instance['width'] : '';
     $profile_networks = array();
     $profile_networks = ESSBOptionValuesHelper::advanced_array_to_simple_array($essb_available_social_profiles);
     $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order');
     if (is_array($profiles_order)) {
         $profile_networks = $profiles_order;
     }
     $sc_network_address = array();
     foreach ($profile_networks as $network) {
         $value = $instance['profile_' . $network];
         if (!empty($value)) {
             $sc_network_address[$network] = $value;
         }
     }
     $sc_network_texts = array();
     foreach ($profile_networks as $network) {
         $value = $instance['profile_text_' . $network];
         if (!empty($value)) {
             $sc_network_texts[$network] = $value;
         }
     }
     if (!empty($show_title)) {
         echo $before_widget . $before_title . $title . $after_title;
     }
     // if module is not activated include the code
     if (!defined('ESSB3_SOCIALPROFILES_ACTIVE')) {
         include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-profiles/essb-social-profiles.php';
         define('ESSB3_SOCIALPROFILES_ACTIVE', 'true');
         $resource_builder = ESSBResourceBuilder::get_instance();
         $template_url = ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css';
         $resource_builder->add_static_footer_css($template_url, 'easy-social-share-buttons-profiles');
     }
     echo ESSBSocialProfiles::generate_social_profile_icons($sc_network_address, $sc_button_type, $sc_button_size, $sc_button_fill, $sc_nospace, '', $sc_allowtext, $sc_network_texts, $sc_width);
     if (!empty($show_title)) {
         echo $after_widget;
     }
 }