private function loadDefaultFromOptions()
 {
     $this->default_image = ESSBOptionValuesHelper::options_value($this->options, 'sso_default_image');
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_apply_the_content')) {
         $this->apply_the_content = true;
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'opengraph_tags')) {
         $this->ogtags_active = true;
         $this->fbadmins = isset($this->options['opengraph_tags_fbadmins']) ? $this->options['opengraph_tags_fbadmins'] : '';
         $this->fbpage = isset($this->options['opengraph_tags_fbpage']) ? $this->options['opengraph_tags_fbpage'] : '';
         $this->fbapp = isset($this->options['opengraph_tags_fbapp']) ? $this->options['opengraph_tags_fbapp'] : '';
         $this->fb_author_profile = isset($this->options['opengraph_tags_fbauthor']) ? $this->options['opengraph_tags_fbauthor'] : '';
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'twitter_card')) {
         $this->twitter_cards_active = true;
         $this->card_type = isset($this->options['twitter_card_type']) ? $this->options['twitter_card_type'] : '';
         $this->twitter_user = isset($this->options['twitter_card_user']) ? $this->options['twitter_card_user'] : '';
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_google_author')) {
         $this->google_authorship = true;
         $this->google_author = isset($this->options['ss_google_author_profile']) ? $this->options['ss_google_author_profile'] : '';
         $this->google_publisher = isset($this->options['ss_google_author_publisher']) ? $this->options['ss_google_author_publisher'] : '';
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_google_markup')) {
         $this->google_markup = true;
     }
     if ($this->ogtags_active || $this->twitter_cards_active || $this->google_authorship || $this->google_markup) {
         $this->sso_active = true;
     }
 }
 /**
  * load
  * 
  * Load global plugin settings for single call use
  * 
  * @param array $options
  * @since 3.4.1
  */
 public static function load($options = array())
 {
     self::$legacy_class = ESSBOptionValuesHelper::options_bool_value($options, 'legacy_class');
     self::$counter_total_text = ESSBOptionValuesHelper::options_value($options, 'counter_total_text');
     self::$button_counter_hidden_till = ESSBOptionValuesHelper::options_value($options, 'button_counter_hidden_till');
     self::$mycred_group = ESSBOptionValuesHelper::options_value($options, 'mycred_group', 'mycred_default');
     self::$mycred_points = ESSBOptionValuesHelper::options_value($options, 'mycred_points', '1');
     self::$more_button_icon = ESSBOptionValuesHelper::options_value($options, 'more_button_icon');
     self::$comments_address = ESSBOptionValuesHelper::options_value($options, 'comments_address');
     self::$use_rel_me = ESSBOptionValuesHelper::options_bool_value($options, 'use_rel_me');
     self::$essb_encode_text = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_text');
     self::$essb_encode_url = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_url');
     self::$essb_encode_text_plus = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_text_plus');
     self::$print_use_printfriendly = ESSBOptionValuesHelper::options_bool_value($options, 'print_use_printfriendly');
     self::$pinterest_sniff_disable = ESSBOptionValuesHelper::options_bool_value($options, 'pinterest_sniff_disable');
     self::$facebookadvanced = ESSBOptionValuesHelper::options_bool_value($options, 'facebookadvanced');
     self::$facebookadvancedappid = ESSBOptionValuesHelper::options_value($options, 'facebookadvancedappid');
     self::$activate_ga_campaign_tracking = ESSBOptionValuesHelper::options_value($options, 'activate_ga_campaign_tracking');
     self::$twitter_message_optimize = ESSBOptionValuesHelper::options_bool_value($options, 'twitter_message_optimize');
     self::$sidebar_pos = ESSBOptionValuesHelper::options_value($options, 'sidebar_pos');
     self::$telegram_alternative = ESSBOptionValuesHelper::options_bool_value($options, 'telegram_alternative');
     // @since 3.5 - runtime cache via WordPress functions
     self::$cache_runtime = ESSBOptionValuesHelper::options_bool_value($options, 'essb_cache_runtime');
     $personalized_networks = ESSBOptionValuesHelper::get_active_social_networks_by_position('mobile');
     $personalized_network_order = ESSBOptionValuesHelper::get_order_of_social_networks_by_position('mobile');
     // added in @since 3.4.2
     if (is_array($personalized_networks) && count($personalized_networks) > 0) {
         self::$mobile_networks = $personalized_networks;
         self::$mobile_networks_active = true;
     }
     if (is_array($personalized_network_order) && count($personalized_network_order) > 0) {
         self::$mobile_networks_order = $personalized_network_order;
         self::$mobile_networks_order_active = true;
     }
 }
Exemplo n.º 3
0
 private function __construct()
 {
     global $essb_options;
     $essb_cache_static = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_cache_static');
     $essb_cache_static_js = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_cache_static_js');
     if ($essb_cache_static_js) {
         add_filter('print_scripts_array', array($this, 'init_essb_cache_static_js'));
     }
     if ($essb_cache_static) {
         add_filter('print_styles_array', array($this, 'init_essb_cache_static_css'));
     }
 }
 function include_social_image_share()
 {
     global $essb_options;
     if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) {
         return;
     }
     $mobile_detect = new ESSB_Mobile_Detect();
     if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) {
         return false;
     }
     $current_post_address = ESSBUrlHelper::get_current_page_url();
     $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes');
     $calling = 'jQuery(document).ready(function(){jQuery("' . $this->get_settings('sis_selector', 'img') . '").essbis({selector:"' . $this->get_settings('sis_selector', 'img') . '",dontshow:"' . $this->get_settings('sis_dontshow') . '",minWidth:' . $this->get_settings('sis_minWidth', '100') . ',minHeight:' . $this->get_settings('sis_minHeight', '100') . ',align:{x:"' . $this->get_settings('sis_align_x', 'left') . '",y:"' . $this->get_settings('sis_align_y', 'top') . '"},offset:{x:' . $this->get_settings('sis_offset_x', '0') . ',y:' . $this->get_settings('sis_offset_y', '0') . '},orientation:"' . $this->get_settings('sis_orientation') . '",style:"' . $this->get_settings('sis_style') . '",sharer:"' . ($this->get_settings('sis_sharer') == 'true' ? $current_post_address : '') . '",is_mobile:' . ($mobile_detect->isMobile() ? 'true' : 'false') . ',always_show:' . $this->get_settings('sis_always_show', 'false') . ',pinterest_alt:' . $this->get_settings('sis_pinterest_alt', 'false') . ',primary_menu: [ ' . $this->get_primary_menu() . '],avoid_class: "' . $this->get_settings('sis_dontaddclass') . '"});});';
     essb_resource_builder()->add_js($calling, true, 'essb-onmedia-code');
 }
 function display_profiles()
 {
     global $essb_options, $essb_available_social_profiles;
     if (ESSBCoreHelper::is_module_deactivate_on('profiles')) {
         return "";
     }
     $profiles_display_position = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_display_position');
     $profiles_button_type = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_type');
     $profiles_button_size = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_size');
     $profiles_nospace = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_nospace');
     $profiles_button_fill = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_fill');
     $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order');
     // @new version 3.0.4
     $profiles_allowtext = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_allowtext');
     $profiles_width = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_width');
     if (!is_array($profiles_order)) {
         $profiles_order = array();
         foreach ($essb_available_social_profiles as $network => $text) {
             $profiles_order[] = $network;
         }
     }
     $profiles = array();
     foreach ($profiles_order as $network) {
         $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_' . $network);
         if (!empty($value_address)) {
             $profiles[$network] = $value_address;
         }
     }
     $profiles_texts = array();
     if ($profiles_allowtext) {
         foreach ($profiles_order as $network) {
             $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_text_' . $network);
             if (!empty($value_address)) {
                 $profiles_texts[$network] = $value_address;
             }
         }
     }
     echo $this->generate_social_profile_icons($profiles, $profiles_button_type, $profiles_button_size, $profiles_button_fill, $profiles_nospace, $profiles_display_position, $profiles_allowtext, $profiles_texts, $profiles_width);
 }
    public static function js_build_generate_sidebar_reveal_code()
    {
        global $essb_options;
        $appear_pos = ESSBOptionValuesHelper::options_value($essb_options, 'sidebar_leftright_percent');
        $disappear_pos = ESSBOptionValuesHelper::options_value($essb_options, 'sidebar_leftright_percent_hide');
        if (empty($appear_pos)) {
            $appear_pos = "0";
        }
        if (empty($disappear_pos)) {
            $disappear_pos = "0";
        }
        $output = '';
        //$appear_pos = ESSBOptionValuesHelper::options_value($essb_options, 'sidebar_leftright_percent');
        if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'sidebar_leftright_close')) {
            $output .= '
			jQuery(document).ready(function($){
			
				$(".essb_link_sidebar-close a").each(function() {
				
					$(this).click(function(event) {
						event.preventDefault();
						var links_list = $(this).parent().parent().get(0);
						
						if (!$(links_list).length) { return; }
						
						$(links_list).find(".essb_item").each(function(){
							if (!$(this).hasClass("essb_link_sidebar-close")) {
								$(this).toggleClass("essb-sidebar-closed-item");
							}
							else {
								$(this).toggleClass("essb-sidebar-closed-clicked");
							}
						});
						
					});
				
				});
			});
			
			';
        }
        if ($appear_pos != '' || $disappear_pos != '') {
            $output .= '
		jQuery(document).ready(function($){
		
			$(window).scroll(essb_sidebar_onscroll);
		
			function essb_sidebar_onscroll() {
				var current_pos = $(window).scrollTop();
				var height = $(document).height()-$(window).height();
				var percentage = current_pos/height*100;

				var value_disappear = "' . $disappear_pos . '";
				var value_appear = "' . $appear_pos . '";
				
				var element;
				if ($(".essb_displayed_sidebar").length) {
					element = $(".essb_displayed_sidebar");
				}
				if ($(".essb_displayed_sidebar_right").length) {
					element = $(".essb_displayed_sidebar_right");
				}
				
				if (!element || typeof(element) == "undefined") { return; }
				
				value_disappear = parseInt(value_disappear);
				value_appear = parseInt(value_appear);
				
				if (value_appear > 0 && value_disappear == 0) {
					if (percentage >= value_appear && !element.hasClass("active-sidebar")) {
						element.fadeIn(100);
						element.addClass("active-sidebar");
						return;
					}
					
					if (percentage < value_appear && element.hasClass("active-sidebar")) {
						element.fadeOut(100);
						element.removeClass("active-sidebar");
						return;
					}
				}
				
				if (value_disappear > 0 && value_appear == 0) {
					if (percentage >= value_disappear && !element.hasClass("hidden-sidebar")) {
						element.fadeOut(100);
						element.addClass("hidden-sidebar");
						return;
					}
					
					if (percentage < value_disappear && element.hasClass("hidden-sidebar")) {
						element.fadeIn(100);
						element.removeClass("hidden-sidebar");
						return;
					}
				}
				
				if (value_appear > 0 && value_disappear > 0) {
					if (percentage >= value_appear && percentage < value_disappear && !element.hasClass("active-sidebar")) {
						element.fadeIn(100);
						element.addClass("active-sidebar");
						return;
					}
					
					if ((percentage < value_appear || percentage >= value_disappear) && element.hasClass("active-sidebar")) {
						element.fadeOut(100);
						element.removeClass("active-sidebar");
						return;
					}
				}
			}
		});		
		';
        }
        return $output;
    }
 public static function get_assets()
 {
     global $essb_options;
     $deactivate_fa = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_fa');
     self::$resouce_files[] = array("key" => "easy-social-share-buttons-nativeskinned", "file" => ESSB3_PLUGIN_URL . '/assets/css/essb-native-skinned.min.css', "type" => "css");
     if (!$deactivate_fa) {
         self::$resouce_files[] = array("key" => "essb-fontawsome", "file" => ESSB3_PLUGIN_URL . '/assets/css/font-awesome.min.css', "type" => "css");
     }
     return self::$resouce_files;
 }
 public static function short_url($url, $provider, $post_id = '', $bitly_user = '', $bitly_api = '')
 {
     global $essb_options;
     $deactivate_cache = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_shorturl_cache');
     $shorturl_googlapi = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_googlapi');
     $short_url = "";
     if ($provider == "ssu") {
         if (!defined('ESSB3_SSU_VERSION')) {
             $provider = "wp";
         }
     }
     switch ($provider) {
         case "wp":
             $short_url = wp_get_shortlink();
             break;
         case "goo.gl":
             $short_url = self::short_googl($url, $post_id, $deactivate_cache, $shorturl_googlapi);
             break;
         case "bit.ly":
             $short_url = self::short_bitly($url, $bitly_user, $bitly_api, $post_id, $deactivate_cache);
             break;
         case "ssu":
             $short_url = self::short_ssu($url, $post_id, $deactivate_cache);
             break;
     }
     // @since 3.4 affiliate intergration with wp shorturl
     $affwp_active = ESSBOptionValuesHelper::options_bool_value($essb_options, 'affwp_active');
     if ($affwp_active) {
         $short_url = ESSBUrlHelper::generate_affiliatewp_referral_link($short_url);
     }
     $affs_active = ESSBOptionValuesHelper::options_bool_value($essb_options, 'affs_active');
     if ($affs_active) {
         $short_url = do_shortcode('[affiliates_url]' . $short_url . '[/affiliates_url]');
     }
     return $short_url;
 }
 public static function list_of_all_available_networks_extended()
 {
     $network_list = ESSBSocialFansCounterHelper::available_social_networks();
     $networks_same_authentication = array();
     // @since 3.2.2 Integration with Social Fans Counter Extended
     if (defined('ESSB3_SFCE_OPTIONS_NAME')) {
         $fanscounter_extended_options = get_option(ESSB3_SFCE_OPTIONS_NAME);
         $extended_list = array();
         foreach ($network_list as $network => $title) {
             $is_active_extended = ESSBOptionValuesHelper::options_bool_value($fanscounter_extended_options, 'activate_' . $network);
             $use_same_api = ESSBOptionValuesHelper::options_bool_value($fanscounter_extended_options, 'same_access_' . $network);
             $count_extended = ESSBOptionValuesHelper::options_value($fanscounter_extended_options, 'profile_count_' . $network);
             $count_extended = intval($count_extended);
             $extended_list[$network] = $title;
             if ($is_active_extended) {
                 for ($i = 1; $i <= $count_extended; $i++) {
                     $extended_list[$network . "_" . $i] = $title . " Additional Profile " . $i;
                 }
             }
         }
         $network_list = array();
         foreach ($extended_list as $network => $title) {
             $network_list[$network] = $title;
         }
     }
     return $network_list;
 }
 public static function twitter_message_optimization($tweet, $url, $user, $hashtags, $method = '1')
 {
     global $essb_options;
     $max_message_length = 140;
     $twitter_message_optimize_dots = ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_message_optimize_dots');
     $current_message_length = ESSBButtonHelper::twitter_message_length($tweet, $url, $user, $hashtags);
     $result = array();
     $result['tweet'] = $tweet;
     $result['hashtags'] = $hashtags;
     $result['user'] = $user;
     if ($current_message_length < $max_message_length) {
         return $result;
     } else {
         switch ($method) {
             case "1":
                 $result['hashtags'] = '';
                 $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                 if ($current_message_length > $max_message_length) {
                     $result['user'] = '';
                     $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                     if ($current_message_length > $max_message_length) {
                         $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                         if ($twitter_message_optimize_dots) {
                             $length -= 3;
                         }
                         $last_space = strrpos(substr($result['tweet'], 0, $length), '+');
                         $trimmed_text = substr($result['tweet'], 0, $last_space);
                         if ($twitter_message_optimize_dots) {
                             $trimmed_text .= '...';
                         }
                         $result['tweet'] = $trimmed_text;
                     }
                 }
                 break;
             case "2":
                 $result['user'] = '';
                 $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                 if ($current_message_length > $max_message_length) {
                     $result['hashtags'] = '';
                     $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                     if ($current_message_length > $max_message_length) {
                         $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                         if ($twitter_message_optimize_dots) {
                             $length -= 3;
                         }
                         $last_space = strrpos(substr($result['tweet'], 0, $length), '+');
                         $trimmed_text = substr($result['tweet'], 0, $last_space);
                         if ($twitter_message_optimize_dots) {
                             $trimmed_text .= '...';
                         }
                         $result['tweet'] = $trimmed_text;
                     }
                 }
                 break;
             case "3":
                 $result['user'] = '';
                 $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                 if ($current_message_length > $max_message_length) {
                     $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                     if ($twitter_message_optimize_dots) {
                         $length -= 3;
                     }
                     $last_space = strrpos(substr($result['tweet'], 0, $length), '+');
                     $trimmed_text = substr($result['tweet'], 0, $last_space);
                     if ($twitter_message_optimize_dots) {
                         $trimmed_text .= '...';
                     }
                     $result['tweet'] = $trimmed_text;
                 }
                 break;
             case "4":
                 $result['hashtags'] = '';
                 $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                 if ($current_message_length > $max_message_length) {
                     $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                     if ($twitter_message_optimize_dots) {
                         $length -= 3;
                     }
                     $last_space = strrpos(substr($result['tweet'], 0, $length), '+');
                     $trimmed_text = substr($result['tweet'], 0, $last_space);
                     if ($twitter_message_optimize_dots) {
                         $trimmed_text .= '...';
                     }
                     $result['tweet'] = $trimmed_text;
                 }
                 break;
             case "5":
                 $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']);
                 if ($twitter_message_optimize_dots) {
                     $length -= 3;
                 }
                 $last_space = strrpos(substr($result['tweet'], 0, $length), '+');
                 $trimmed_text = substr($result['tweet'], 0, $last_space);
                 if ($twitter_message_optimize_dots) {
                     $trimmed_text .= '...';
                 }
                 $result['tweet'] = $trimmed_text;
                 break;
         }
         return $result;
     }
 }
    // print $options_page;
    // print admin_url ( 'admin.php?page=essb_options&tab=' . $options_page );
    if ($options_page != '') {
        $current_tab = $options_page;
    }
}
$tabs = $essb_navigation_tabs;
$section = $essb_sidebar_sections[$current_tab];
$options = $essb_section_options[$current_tab];
// cache is running
$general_cache_active = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache');
$general_cache_active_static = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache_static');
$general_cache_active_static_js = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache_static_js');
$general_cache_mode = ESSBOptionValuesHelper::options_value($essb_admin_options, 'essb_cache_mode');
$is_cache_active = false;
$general_precompiled_resources = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'precompiled_resources');
$display_cache_mode = "";
if ($general_cache_active) {
    if ($general_cache_mode == "full") {
        $display_cache_mode = "Cache button render and dynamic resources";
    } else {
        if ($general_cache_mode == "resource") {
            $display_cache_mode = "Cache only dynamic resources";
        } else {
            $display_cache_mode = "Cache only button render";
        }
    }
    $is_cache_active = true;
}
if ($general_cache_active_static || $general_cache_active_static_js) {
    if ($display_cache_mode != '') {
 public function load_social_api_code($network = '')
 {
     global $essb_options;
     if ($this->is_plugin_deactivated_on()) {
         return;
     }
     $facebook_lang = "en_US";
     $user_defined_language_code = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_lang');
     if (!empty($user_defined_language_code)) {
         $facebook_lang = $user_defined_language_code;
     }
     $facebook_appid = "";
     $facebook_async = ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebook_like_button_api_async') ? 'true' : 'false';
     $vk_application = ESSBOptionValuesHelper::options_value($essb_options, 'vklikeappid');
     if ($network == 'facebook') {
         echo $this->generate_facebook_api_code($facebook_lang, $facebook_appid, $facebook_async);
     }
     if ($network == 'google') {
         echo $this->generate_google_api_code();
     }
     if ($network == 'vk') {
         echo $this->generate_vk_api_code($vk_application);
     }
     if ($network == "pinterest") {
         echo $this->generate_pinterst_code();
     }
     if ($network == "twitter") {
         echo $this->generate_twitter_code();
     }
 }
Exemplo n.º 13
0
 public static function is_module_deactivate_on($module = 'share')
 {
     global $essb_options;
     if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'reset_postdata')) {
         wp_reset_postdata();
     }
     //display_deactivate_on
     $is_deactivated = false;
     $exclude_from = ESSBOptionValuesHelper::options_value($essb_options, 'deactivate_on_' . $module);
     if (!empty($exclude_from)) {
         $excule_from = explode(',', $exclude_from);
         $excule_from = array_map('trim', $excule_from);
         if (in_array(get_the_ID(), $excule_from, false)) {
             $is_deactivated = true;
         }
     }
     return $is_deactivated;
 }
 public static function native_button_defaults()
 {
     global $essb_options;
     $defaults = array();
     $facebook_type = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_type', 'like');
     $facebook_url = '';
     if ($facebook_type == 'like') {
         $facebook_url = ESSBOptionValuesHelper::options_value($essb_options, 'custom_url_like_address');
     } else {
         $facebook_url = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_follow_profile');
     }
     $defaults['facebook_type'] = $facebook_type;
     $defaults['facebook_url'] = $facebook_url;
     $google_type = ESSBOptionValuesHelper::options_value($essb_options, 'google_like_type', 'plus');
     $google_url = '';
     if ($google_type == 'plus') {
         $google_url = ESSBOptionValuesHelper::options_value($essb_options, 'custom_url_plusone_address');
     } else {
         $google_url = ESSBOptionValuesHelper::options_value($essb_options, 'google_follow_profile');
     }
     $defaults['google_type'] = $google_type;
     $defaults['google_url'] = $google_url;
     $twitter_type = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_tweet');
     $twitter_user = ESSBOptionValuesHelper::options_value($essb_options, 'twitterfollowuser');
     $defaults['twitter_type'] = $twitter_type;
     $defaults['twitter_user'] = $twitter_user;
     $pinterest_type = ESSBOptionValuesHelper::options_value($essb_options, 'pinterest_native_type');
     $pinterest_url = ESSBOptionValuesHelper::options_value($essb_options, 'pinterestfollow_url');
     $pinterest_text = ESSBOptionValuesHelper::options_value($essb_options, 'pinterestfollow_disp');
     $defaults['pinterest_type'] = $pinterest_type;
     $defaults['pinterest_url'] = $pinterest_url;
     $defaults['pinterest_display'] = $pinterest_text;
     $linkedin_company = ESSBOptionValuesHelper::options_value($essb_options, 'linkedin_follow_id');
     $defaults['linkedin_company'] = $linkedin_company;
     $youtube_channel = ESSBOptionValuesHelper::options_value($essb_options, 'youtubechannel');
     $defaults['youtube_channel'] = $youtube_channel;
     $defaults['sameline'] = ESSBOptionValuesHelper::options_bool_value($essb_options, 'otherbuttons_sameline');
     $defaults['counters'] = ESSBOptionValuesHelper::options_bool_value($essb_options, 'allnative_counters');
     $defaults['skinned'] = ESSBOptionValuesHelper::options_bool_value($essb_options, 'skin_native');
     return $defaults;
 }
    function include_social_image_share()
    {
        global $essb_options;
        if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) {
            return;
        }
        $mobile_detect = new ESSB_Mobile_Detect();
        if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) {
            return false;
        }
        $current_post_address = ESSBUrlHelper::get_current_page_url();
        $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes');
        ?>

<script>

				<?php 
        echo $calling = $this->get_settings('sis_always_show') === 'true' ? 'jQuery(window).load(function(){' : 'jQuery(document).ready(function(){';
        ?>
					jQuery('<?php 
        echo $this->get_settings('sis_selector', 'img');
        ?>
').socialImageShare({
						selector: "<?php 
        echo $this->get_settings('sis_selector', 'img');
        ?>
",
						dontshow: "<?php 
        echo $this->get_settings('sis_dontshow');
        ?>
",
						title: "<?php 
        echo $this->get_settings('sis_title');
        ?>
",
						summary: "<?php 
        echo $this->get_settings('sis_summary');
        ?>
",
						minWidth: <?php 
        echo $this->get_settings('sis_minWidth', '100');
        ?>
,
						minHeight: <?php 
        echo $this->get_settings('sis_minHeight', '100');
        ?>
,
						fb_app: "<?php 
        echo $this->get_settings('sis_fb_app');
        ?>
",
						scroll: <?php 
        echo $this->get_settings('sis_scroll', 'false', true);
        ?>
,				
						align: { x: "<?php 
        echo $this->get_settings('sis_align_x', 'left');
        ?>
", y: "<?php 
        echo $this->get_settings('sis_align_y', 'top');
        ?>
" },
						offset: { x: <?php 
        echo $this->get_settings('sis_offset_x', '0');
        ?>
, y: <?php 
        echo $this->get_settings('sis_offset_y', '0');
        ?>
 },
						orientation: "<?php 
        echo $this->get_settings('sis_orientation');
        ?>
",
						style: '<?php 
        echo $this->get_settings('sis_style');
        ?>
',
						sharer: "<?php 
        echo $sharer = $this->get_settings('sis_sharer') == 'true' ? $current_post_address : '';
        ?>
",
						is_mobile: <?php 
        echo $is_mobile = $mobile_detect->isMobile() ? 'true' : 'false';
        ?>
,
						always_show: <?php 
        echo $this->get_settings('sis_always_show', 'false');
        ?>
,	
					    pinterest_alt: <?php 
        echo $this->get_settings('sis_pinterest_alt', 'false');
        ?>
,
						primary_menu: [ <?php 
        echo $this->get_primary_menu();
        ?>
 ],	
					});
				});
				</script>

<?php 
    }
//print_r($essb_options);
// end: initialize plugin working options
// include options helper functions
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-lightmode-helper.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/options/essb-options-helper.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-global-settings.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-url-helper.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/widgets/essb-share-widget.php';
if (defined('ESSB3_LIGHTMODE')) {
    $essb_options = ESSBLightModeHelper::apply_global_options($essb_options);
}
// initialize global plugin settings from version 3.4.1
ESSBGlobalSettings::load($essb_options);
// init admin bar menu
// admin bar menu
$disable_admin_menu = ESSBOptionValuesHelper::options_bool_value($essb_options, 'disable_adminbar_menu');
// update relted to WordPress 4.4 changes
if (!$disable_admin_menu) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-adminbar-menu.php';
    add_action("init", "ESSBAdminMenuInit3");
    function ESSBAdminMenuInit3()
    {
        global $essb_adminmenu;
        if (is_admin_bar_showing()) {
            $essb_adminmenu = new ESSBAdminBarMenu3();
        }
    }
}
if (ESSBOptionValuesHelper::is_active_module('cachedynamic')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-dynamic-cache.php';
    $cache_mode = ESSBOptionValuesHelper::options_value($essb_options, 'essb_cache_mode');
Exemplo n.º 17
0
 public static function apply_mobile_position_style_settings($postion, $basic_style)
 {
     global $essb_options;
     if (ESSBOptionValuesHelper::options_value($essb_options, $postion . '_template') != "") {
         $basic_style['template'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_template');
     }
     if ($position != 'sharebottom') {
         $basic_style['nospace'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_nospace');
         $basic_style['show_counter'] = ESSBOptionValuesHelper::options_bool_value($essb_options, $postion . '_show_counter');
         $basic_style['counter_pos'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_counter_pos');
         $basic_style['total_counter_pos'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_total_counter_pos');
     }
     return $basic_style;
 }
Exemplo n.º 18
0
 function essb_shortcode_total_shares($atts)
 {
     global $post;
     $atts = shortcode_atts(array('message' => '', 'align' => '', 'url' => '', 'share_text' => '', 'fullnumber' => 'no', 'networks' => ''), $atts);
     $align = isset($atts['align']) ? $atts['align'] : '';
     $message = isset($atts['message']) ? $atts['message'] : '';
     $url = isset($atts['url']) ? $atts['url'] : '';
     $share_text = isset($atts['share_text']) ? $atts['share_text'] : '';
     $fullnumber = isset($atts['fullnumber']) ? $atts['fullnumber'] : 'no';
     $networks = isset($atts['networks']) ? $atts['networks'] : 'no';
     $data_full_number = "false";
     if ($fullnumber == 'yes') {
         $data_full_number = "true";
     }
     // init global options
     $options = $this->options;
     if ($networks != '') {
         $buttons = $networks;
     } else {
         $buttons = implode(',', $this->network_options['networks']);
     }
     $css_class_align = "";
     $data_url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw');
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) {
         $data_url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw');
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) {
         $data_url = ESSBUrlHelper::get_current_page_url();
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) {
         $data_url = str_replace("https://", "http://", $data_url);
     }
     if ($url != '') {
         $data_url = $url;
     }
     $data_post_id = "";
     if (isset($post)) {
         $data_post_id = $post->ID;
     }
     if ($align == "right" || $align == "center") {
         $css_class_align = $align;
     }
     $total_counter_hidden = $this->general_options['total_counter_hidden_till'];
     $use_minifed_js = $this->general_options['use_minified_js'] ? ".min" : "";
     $script_url = ESSB3_PLUGIN_URL . '/assets/js/easy-social-share-buttons-total' . $use_minifed_js . '.js';
     $this->resource_builder->add_static_resource_footer($script_url, 'easy-social-share-buttons-total', 'js');
     $css_hide_total_counter = "";
     if ($total_counter_hidden != '') {
         $css_hide_total_counter = ' style="display: none !important;" data-essb-hide-till="' . $total_counter_hidden . '"';
     }
     $output = "";
     $output .= '<div class="essb-total ' . $css_class_align . '" data-network-list="' . $buttons . '" data-url="' . $data_url . '" data-full-number="' . $data_full_number . '" data-post="' . $data_post_id . '" ' . $css_hide_total_counter . '>';
     if ($message != '') {
         $output .= '<div class="essb-message essb-block">' . $message . '</div>';
     }
     $output .= '<div class="essb-total-value essb-block">0</div>';
     if ($share_text != '') {
         $output .= '<div class="essb-total-text essb-block">' . $share_text . '</div>';
     }
     $output .= '</div>';
     return $output;
 }
Exemplo n.º 19
0
 public static function short_url($url, $provider, $post_id = '', $bitly_user = '', $bitly_api = '')
 {
     global $essb_options;
     $deactivate_cache = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_shorturl_cache');
     $shorturl_googlapi = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_googlapi');
     $short_url = "";
     if ($provider == "ssu") {
         if (!defined('ESSB3_SSU_VERSION')) {
             $provider = "wp";
         }
     }
     switch ($provider) {
         case "wp":
             $short_url = wp_get_shortlink();
             break;
         case "goo.gl":
             $short_url = self::short_googl($url, $post_id, $deactivate_cache, $shorturl_googlapi);
             break;
         case "bit.ly":
             $short_url = self::short_bitly($url, $bitly_user, $bitly_api, $post_id, $deactivate_cache);
             break;
         case "ssu":
             $short_url = self::short_ssu($url, $post_id, $deactivate_cache);
             break;
     }
     return $short_url;
 }
Exemplo n.º 20
0
$active_settings_page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
if (strpos($active_settings_page, 'essb_redirect_') !== false) {
    $options_page = str_replace('essb_redirect_', '', $active_settings_page);
    // print $options_page;
    // print admin_url ( 'admin.php?page=essb_options&tab=' . $options_page );
    if ($options_page != '') {
        $current_tab = $options_page;
    }
}
$tabs = $essb_navigation_tabs;
$section = $essb_sidebar_sections[$current_tab];
$options = $essb_section_options[$current_tab];
// cache is running
$general_cache_active = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache');
$general_cache_active_static = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache_static');
$general_cache_active_static_js = ESSBOptionValuesHelper::options_bool_value($essb_admin_options, 'essb_cache_static_js');
$general_cache_mode = ESSBOptionValuesHelper::options_value($essb_admin_options, 'essb_cache_mode');
$is_cache_active = false;
$display_cache_mode = "";
if ($general_cache_active) {
    if ($general_cache_mode == "full") {
        $display_cache_mode = "Cache button render and dynamic resources";
    } else {
        if ($general_cache_mode == "resource") {
            $display_cache_mode = "Cache only dynamic resources";
        } else {
            $display_cache_mode = "Cache only button render";
        }
    }
    $is_cache_active = true;
}
Exemplo n.º 21
0
 public function update_optons()
 {
     global $essb_navigation_tabs, $essb_sidebar_sections, $essb_section_options;
     $current_options = get_option(ESSB3_OPTIONS_NAME);
     if (!is_array($current_options)) {
         $current_options = array();
     }
     $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
     $user_options = isset($_REQUEST['essb_options']) ? $_REQUEST['essb_options'] : array();
     $reset_settings = isset($_REQUEST['reset_settings']) ? $_REQUEST['reset_settings'] : '';
     //print_r($user_options);
     if ($current_tab == '') {
         return;
     }
     if ($current_tab == 'advanced') {
         $this->temporary_activate_post_type_settings();
     }
     if ($current_tab == "display") {
         $this->temporary_activate_positions_by_posttypes();
     }
     $options = $essb_section_options[$current_tab];
     foreach ($options as $section => $fields) {
         $section_options = $fields;
         foreach ($section_options as $option) {
             $type = $option['type'];
             $id = isset($option['id']) ? $option['id'] : '';
             if ($id == '') {
                 continue;
             }
             if (strpos($id, 'essb3fans_') !== false) {
                 continue;
             }
             // custom ID parser for functions
             if ($id == 'essb3_options_template_select') {
                 $id = 'style';
             }
             if ($id == 'essb3_network_selection') {
                 $type = "network_select";
             }
             if ($id == "essb3_network_rename") {
                 $type = "network_rename";
             }
             if ($id == "essb3_post_type_select") {
                 $id = "display_in_types";
             }
             if ($id == "essb3_esml_post_type_select") {
                 $id = "esml_monitor_types";
             }
             if ($id == 'essb3_network_selection' && defined('ESSB3_LIGHTMODE')) {
                 $twitteruser = isset($user_options['twitteruser']) ? $user_options['twitteruser'] : '';
                 $current_options['twitteruser'] = $twitteruser;
                 $twitterhashtags = isset($user_options['twitterhashtags']) ? $user_options['twitterhashtags'] : '';
                 $current_options['twitterhashtags'] = $twitterhashtags;
             }
             // quick setup options
             if ($id == "quick_setup_recommended") {
                 $current_options['twitter_shareshort'] = 'true';
                 $current_options['twitter_shareshort_service'] = 'wp';
                 $current_options['twitter_message_optimize'] = 'true';
                 $current_options['facebookadvanced'] = 'false';
                 $current_options['buffer_twitter_user'] = '******';
             }
             if ($id == "quick_setup_static") {
                 $current_options['use_minified_css'] = 'true';
                 $current_options['use_minified_js'] = 'true';
                 $current_options['load_js_async'] = 'true';
                 $current_options['load_css_footer'] = 'true';
             }
             if ($id == 'quick_setup_easy') {
                 update_option(ESSB3_EASYMODE_NAME, 'true');
             }
             switch ($type) {
                 case "network_rename":
                     $option_value = isset($_REQUEST['essb_options_names']) ? $_REQUEST['essb_options_names'] : array();
                     foreach ($option_value as $key => $value) {
                         $network_option_value = "user_network_name_" . $key;
                         $current_options[$network_option_value] = $value;
                     }
                     break;
                 case "network_select":
                     $option_value = isset($user_options['networks']) ? $user_options['networks'] : array();
                     $current_options['networks'] = $option_value;
                     $option_value = isset($user_options['networks_order']) ? $user_options['networks_order'] : array();
                     $current_options['networks_order'] = $option_value;
                     break;
                 case "checkbox_list_sortable":
                     $option_value = isset($user_options[$id]) ? $user_options[$id] : '';
                     $current_options[$id] = $option_value;
                     $option_value = isset($user_options[$id . '_order']) ? $user_options[$id . '_order'] : '';
                     $current_options[$id . '_order'] = $option_value;
                     break;
                 default:
                     $option_value = isset($user_options[$id]) ? $user_options[$id] : '';
                     $current_options[$id] = $option_value;
                     if ($id == "stats_active") {
                         if ($option_value == "true") {
                             ESSBSocialShareAnalyticsBackEnd::install();
                         }
                     }
                     break;
             }
         }
     }
     $current_options = $this->clean_blank_values($current_options);
     // initially reset plugin settings to default one
     if ($reset_settings == 'true') {
         $current_options = array();
         $default_options = 'eyJidXR0b25fc3R5bGUiOiJidXR0b24iLCJzdHlsZSI6IjIyIiwiY3NzX2FuaW1hdGlvbnMiOiJubyIsImZ1bGx3aWR0aF9zaGFyZV9idXR0b25zX2NvbHVtbnMiOiIxIiwibmV0d29ya3MiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iXSwibmV0d29ya3Nfb3JkZXIiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iLCJkaWdnIiwiZGVsIiwic3R1bWJsZXVwb24iLCJ0dW1ibHIiLCJ2ayIsInByaW50IiwibWFpbCIsImZsYXR0ciIsInJlZGRpdCIsImJ1ZmZlciIsImxvdmUiLCJ3ZWlibyIsInBvY2tldCIsInhpbmciLCJvayIsIm13cCIsIm1vcmUiLCJ3aGF0c2FwcCIsIm1lbmVhbWUiLCJibG9nZ2VyIiwiYW1hem9uIiwieWFob29tYWlsIiwiZ21haWwiLCJhb2wiLCJuZXdzdmluZSIsImhhY2tlcm5ld3MiLCJldmVybm90ZSIsIm15c3BhY2UiLCJtYWlscnUiLCJ2aWFkZW8iLCJsaW5lIiwiZmxpcGJvYXJkIiwiY29tbWVudHMiLCJ5dW1tbHkiXSwibW9yZV9idXR0b25fZnVuYyI6IjEiLCJtb3JlX2J1dHRvbl9pY29uIjoicGx1cyIsInR3aXR0ZXJfc2hhcmVzaG9ydF9zZXJ2aWNlIjoid3AiLCJtYWlsX2Z1bmN0aW9uIjoiZm9ybSIsIndoYXRzYXBwX3NoYXJlc2hvcnRfc2VydmljZSI6IndwIiwiZmxhdHRyX2xhbmciOiJzcV9BTCIsImNvdW50ZXJfcG9zIjoibGVmdCIsImZvcmNlX2NvdW50ZXJzX2FkbWluX3R5cGUiOiJ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iLCJ0dXJub2ZmX2Vzc2JfYWR2YW5jZWRfYm94IjoidHJ1ZSIsImVzc2JfYWNjZXNzIjoibWFuYWdlX29wdGlvbnMiLCJhcHBseV9jbGVhbl9idXR0b25zX21ldGhvZCI6ImRlZmF1bHQifQ==';
         $options_base = ESSB_Manager::convert_ready_made_option($default_options);
         //print_r($options_base);
         if ($options_base) {
             $current_options = $options_base;
         }
     }
     update_option(ESSB3_OPTIONS_NAME, $current_options);
     $esml_active = ESSBOptionValuesHelper::options_bool_value($current_options, 'esml_active');
     if (!$esml_active) {
         delete_option("esml_version");
         $this->removeAllQueuedMetricsUpdates();
     }
 }
Exemplo n.º 22
0
 function essb_shortcode_total_shares($atts)
 {
     global $post;
     $atts = shortcode_atts(array('message' => '', 'align' => '', 'url' => '', 'share_text' => '', 'fullnumber' => 'no', 'networks' => '', 'inline' => 'no'), $atts);
     $align = isset($atts['align']) ? $atts['align'] : '';
     $message = isset($atts['message']) ? $atts['message'] : '';
     $url = isset($atts['url']) ? $atts['url'] : '';
     $share_text = isset($atts['share_text']) ? $atts['share_text'] : '';
     $fullnumber = isset($atts['fullnumber']) ? $atts['fullnumber'] : 'no';
     $networks = isset($atts['networks']) ? $atts['networks'] : 'no';
     $inline = isset($atts['inline']) ? $atts['inline'] : 'no';
     $data_full_number = "false";
     if ($fullnumber == 'yes') {
         $data_full_number = "true";
     }
     // init global options
     $options = $this->options;
     if ($networks != '') {
         $buttons = $networks;
     } else {
         $buttons = implode(',', $this->network_options['networks']);
     }
     $css_class_align = "";
     $data_url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw');
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) {
         $data_url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw');
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) {
         $data_url = ESSBUrlHelper::get_current_page_url();
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) {
         $data_url = str_replace("https://", "http://", $data_url);
     }
     if ($url != '') {
         $data_url = $url;
     }
     $data_post_id = "";
     if (isset($post)) {
         $data_post_id = $post->ID;
     }
     if ($align == "right" || $align == "center") {
         $css_class_align = $align;
     }
     $total_counter_hidden = $this->general_options['total_counter_hidden_till'];
     // @since 3.3 support for cached counters
     $cached_counters = array();
     $cached_counters_active = false;
     $cached_total_counter = '';
     if (defined('ESSB3_CACHED_COUNTERS')) {
         $share_options = array('url' => $data_url, 'full_url' => $data_url);
         $cached_counter_networks = ESSBCachedCounters::prepare_list_of_networks_with_counter(explode(',', $buttons), explode(',', $buttons));
         $cached_counters = ESSBCachedCounters::get_counters($data_post_id, $share_options, $cached_counter_networks);
         $cached_counters_active = true;
     } else {
         $use_minifed_js = $this->general_options['use_minified_js'] ? ".min" : "";
         $script_url = ESSB3_PLUGIN_URL . '/assets/js/easy-social-share-buttons-total' . $use_minifed_js . '.js';
         essb_resource_builder()->add_static_resource_footer($script_url, 'easy-social-share-buttons-total', 'js');
     }
     $css_hide_total_counter = "";
     if ($total_counter_hidden != '') {
         $css_hide_total_counter = ' style="display: none !important;" data-essb-hide-till="' . $total_counter_hidden . '"';
     }
     if ($cached_counters_active) {
         $cached_total_counter = isset($cached_counters['total']) ? $cached_counters['total'] : '0';
         if ($total_counter_hidden != '') {
             if (intval($cached_total_counter) > intval($total_counter_hidden)) {
                 $css_hide_total_counter = "";
             }
         }
         $cached_total_counter = ESSBButtonHelper::kilomega($cached_total_counter);
     }
     $output = "";
     $tag = $inline == 'yes' ? 'span' : 'div';
     $output .= '<' . $tag . ' class="essb-total ' . $css_class_align . '" data-network-list="' . $buttons . '" data-url="' . $data_url . '" data-full-number="' . $data_full_number . '" data-post="' . $data_post_id . '" ' . $css_hide_total_counter . '>';
     if ($message != '') {
         $output .= '<' . $tag . ' class="essb-message essb-block">' . $message . '</' . $tag . '>';
     }
     $output .= '<' . $tag . ' class="essb-total-value essb-block">' . $cached_total_counter . '</' . $tag . '>';
     if ($share_text != '') {
         $output .= '<' . $tag . ' class="essb-total-text essb-block">' . $share_text . '</' . $tag . '>';
     }
     $output .= '</' . $tag . '>';
     return $output;
 }
 public static function get_alternate_permalink($url, $id)
 {
     global $essb_options;
     $new_url = $url;
     $recover_mode = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_mode');
     $recover_protocol = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_protocol');
     $recover_from_other_domain = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_domain');
     // Setup the Default Permalink Structure
     if ($recover_mode == 'default') {
         $domain = get_site_url();
         $new_url = $domain . '/?p=' . $id;
     }
     // Setup the "Day and name" Permalink Structure
     if ($recover_mode == 'dayname') {
         $domain = get_site_url();
         $date = get_the_date('Y/m/d', $id);
         $slug = basename(get_permalink($id));
         $new_url = $domain . '/' . $date . '/' . $slug . '/';
     }
     // Setup the "Month and name" Permalink Structure
     if ($recover_mode == 'monthname') {
         $domain = get_site_url();
         $date = get_the_date('Y/m', $id);
         $slug = basename(get_permalink($id));
         $new_url = $domain . '/' . $date . '/' . $slug . '/';
     }
     // Setup the "Numeric" Permalink Structure
     if ($recover_mode == 'numeric') {
         $domain = get_site_url();
         $new_url = $domain . '/archives/' . $id . '/';
     }
     // Setup the "Post name" Permalink Structure
     if ($recover_mode == 'postname') {
         $domain = get_site_url();
         $post_data = get_post($id, ARRAY_A);
         $slug = $post_data['post_name'];
         $new_url = $domain . '/' . $slug . '/';
     }
     if ($recover_mode == "domain" && !empty($recover_from_other_domain)) {
         $current_site_url = get_site_url();
         $new_url = str_replace($current_site_url, $recover_from_other_domain, $url);
     }
     if ($recover_protocol == "http2https") {
         $new_url = str_replace('https://', 'http://', $new_url);
     }
     if ($recover_protocol == "https2http") {
         $new_url = str_replace('http://', 'https://', $new_url);
     }
     return $new_url;
 }
Exemplo n.º 24
0
 public function register_css()
 {
     global $essb_options;
     $deactivate_fa = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_fa');
     $this->resource_files[] = array("key" => "essb-native-privacy", "file" => ESSB3_PLUGIN_URL . '/assets/css/essb-native-privacy.min.css', "type" => "css");
     if (!$deactivate_fa) {
         $this->resource_files[] = array("key" => "essb-fontawsome", "file" => ESSB3_PLUGIN_URL . '/assets/css/font-awesome.min.css', "type" => "css");
     }
     $this->resource_files[] = array("key" => "essb-socialprivacy-script", "file" => ESSB3_PLUGIN_URL . '/assets/js/essb-social-privacy.min.js', "type" => "js");
 }
Exemplo n.º 25
0
function essb_ctt_shortcode($atts)
{
    global $essb_options;
    extract(shortcode_atts(array('tweet' => '', 'via' => 'yes', 'url' => 'yes', 'nofollow' => 'no', 'user' => '', 'hashtags' => '', 'usehashtags' => 'yes'), $atts));
    $handle = $user;
    if (function_exists('mb_internal_encoding')) {
        $handle_length = 6 + mb_strlen($handle);
    } else {
        $handle_length = 6 + strlen($handle);
    }
    if (!empty($handle) && $via != 'no') {
        $handle_code = "&amp;via=" . $handle . "&amp;related=" . $handle;
    } else {
        $handle_code = '';
    }
    if ($via != 'yes') {
        $handle = '';
        $handle_code = '';
        $handle_length = 0;
    }
    if ($usehashtags != 'no' && $hashtags != '') {
        $handle_code .= "&amp;hashtags=" . $hashtags;
        if (function_exists('mb_internal_encoding')) {
            $handle_length = 6 + mb_strlen($hashtags);
        } else {
            $handle_length = 6 + strlen($hashtags);
        }
    }
    $text = $tweet;
    $post_url = get_permalink();
    $short_url = "";
    $twitter_shareshort = ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_shareshort');
    if ($twitter_shareshort) {
        $provider = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_shareshort_service');
        $shorturl_bitlyuser = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyuser');
        $shorturl_bitlyapi = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyapi');
        $short_url = ESSBUrlHelper::short_url($post_url, $provider, get_the_ID(), $shorturl_bitlyuser, $shorturl_bitlyapi);
    }
    if (filter_var($url, FILTER_VALIDATE_URL)) {
        $bcttURL = '&amp;url=' . $url;
    } elseif ($url != 'no') {
        if ($short_url != '') {
            $bcttURL = '&amp;url=' . $short_url . '&amp;counturl=' . $post_url;
        } else {
            $bcttURL = '&amp;url=' . $post_url;
        }
    } else {
        $bcttURL = '';
    }
    $bcttBttn = __('Click to Tweet', ESSB3_TEXT_DOMAIN);
    $user_text = ESSBOptionValuesHelper::options_value($essb_options, 'translate_clicktotweet');
    if ($user_text != '') {
        $bcttBttn = $user_text;
    }
    if ($url != 'no') {
        $short = essb_ctt_shorten($text, 117 - $handle_length);
    } else {
        $short = essb_ctt_shorten($text, 140 - $handle_length);
    }
    $link_short = $short;
    //$link_short = str_replace('#', '%23', $link_short);
    if ($nofollow != 'no') {
        $rel = "rel='nofollow'";
    } else {
        $rel = '';
    }
    if (!is_feed()) {
        return "<div class='essb-click-to-tweet' onclick=\"window.open('https://twitter.com/intent/tweet?text=" . urlencode($link_short) . $handle_code . $bcttURL . "', 'essb_share_window', 'height=300,width=500,resizable=1,scrollbars=yes');\">\n\t\t\t<span class='essb-click-to-tweet-quote'>\n\t\t\t" . $short . "\n\t\t\t</span>\n\t\t\t<span class='essb-click-to-tweet-button'>" . $bcttBttn . "<span class='essb-click-to-tweet-button-icon'></span>\n\t\t</div>";
    }
    //else {
    //	return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode ( $short ) . $handle_code . $bcttURL . "' target='_blank' class='essb-ctt-ctt-btn'" . $rel . ">" . $bcttBttn . "</a><br /><hr />";
    //}
}
 private function load($demo_mode = '')
 {
     $acs_type = ESSBOptionValuesHelper::options_value($this->options, 'afterclose_type');
     $always_use_code = ESSBOptionValuesHelper::options_bool_value($this->options, 'afterclose_code_always_use');
     if ($demo_mode != '') {
         $acs_type = $demo_mode;
     }
     switch ($acs_type) {
         case "follow":
             $this->register_asc_assets();
             $this->prepare_required_social_apis();
             add_action('wp_footer', array($this, 'generateFollowWindow'), 99);
             if ($always_use_code) {
                 $this->generateMessageCode();
             }
             break;
         case "message":
             $this->register_asc_assets();
             add_action('wp_footer', array($this, 'generateMessageText'), 99);
             if ($always_use_code) {
                 $this->generateMessageCode();
             }
             break;
         case "code":
             $this->generateMessageCode();
             break;
     }
 }
function essb_prepare_location_advanced_customization($tab_id, $menu_id, $location = '', $post_type = false)
{
    global $essb_avaiable_button_style, $essb_available_tempaltes, $essb_avaliable_counter_positions, $essb_avaiable_total_counter_position, $essb_networks, $essb_options;
    $checkbox_list_networks = array();
    foreach ($essb_networks as $key => $object) {
        $checkbox_list_networks[$key] = $object['name'];
    }
    if ($location != 'mobile') {
        ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_mobile_deactivate', __('Deactivate on mobile', ESSB3_TEXT_DOMAIN), __('Activate this option if you wish that method to be hidden when site is browsed with mobile device.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
        ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_native_deactivate', __('Deactivate native buttons', ESSB3_TEXT_DOMAIN), __('Activate this option if you wish to deactivate native buttons for that display method.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
        if (!$post_type) {
            ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_text_deactivate', __('Do not display message above, before or below', ESSB3_TEXT_DOMAIN), __('Activate this option if you wish to hide message above, before or below for that display.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
        }
    }
    if (!$post_type) {
        ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading2', __('Change default button options for that display location', ESSB3_TEXT_DOMAIN));
    } else {
        ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading2', __('Change default button options for that post type', ESSB3_TEXT_DOMAIN));
    }
    ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_activate', __('I wish to personalize global button settings', ESSB3_TEXT_DOMAIN), __('Activate this option to apply personalized settings for that display location. That will overwrite the global. <br/><span class="essb-user-notice">After switching option to <b>Yes</b> press <b>Update Settings</b> button and advanced configuration fields will appear.</span>', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
    //print "Location = ".$location.', result = '.ESSBOptionValuesHelper::options_bool_value($essb_options, $location.'_activate');
    $are_active_settings = ESSBOptionValuesHelper::options_bool_value($essb_options, $location . '_activate');
    if (!$are_active_settings) {
        return;
    }
    ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading3', __('Visual Changes', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Set button style', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_button_style', __('Buttons Style', ESSB3_TEXT_DOMAIN), __('Select your button display style.', ESSB3_TEXT_DOMAIN), $essb_avaiable_button_style);
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_button_pos', __('Buttons Align', ESSB3_TEXT_DOMAIN), __('Choose how buttons
			to be aligned. Default position is left but you can also select
			Right or Center', ESSB3_TEXT_DOMAIN), array("" => "Left", "center" => "Center", "right" => "Right"));
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_template', __('Template', ESSB3_TEXT_DOMAIN), __('Select your template for that display location.', ESSB3_TEXT_DOMAIN), $essb_available_tempaltes);
    ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_nospace', __('Remove spacing between buttons', ESSB3_TEXT_DOMAIN), __('Activate this option to remove default space between share buttons.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
    $more_options = array("plus" => "Plus icon", "dots" => "Dots icon");
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_more_button_icon', __('More button icon', ESSB3_TEXT_DOMAIN), __('Select more button icon style. You can choose from default + symbol or dots symbol', ESSB3_TEXT_DOMAIN), $more_options);
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Counter settings', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_show_counter', __('Display counter of sharing', ESSB3_TEXT_DOMAIN), __('Activate display of share counters.', ESSB3_TEXT_DOMAIN), '', __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_counter_pos', __('Position of counters', ESSB3_TEXT_DOMAIN), __('Choose your default button counter position', ESSB3_TEXT_DOMAIN), $essb_avaliable_counter_positions);
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_total_counter_pos', __('Position of total counter', ESSB3_TEXT_DOMAIN), __('For vertical display methods left means before buttons (top) and right means after buttons (bottom).', ESSB3_TEXT_DOMAIN), $essb_avaiable_total_counter_position);
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Set button width', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_button_width', __('Width of buttons'), __('Choose between automatic width, pre defined width or display in columns.'), array('' => 'Automatic Width', 'fixed' => 'Fixed Width', 'full' => 'Full Width', "column" => "Display in columns"));
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Fixed width share buttons', ESSB3_TEXT_DOMAIN), __('Customize the fixed width options', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_textbox($tab_id, $menu_id, $location . '_fixed_width_value', __('Custom buttons width', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-arrows-h', 'right');
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_fixed_width_align', __('Choose alignment of network name', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), array("" => "Center", "left" => "Left", "right" => "Right"));
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Full width share buttons', ESSB3_TEXT_DOMAIN), __('Full width option will make buttons to take the width of your post content area.', ESSB3_TEXT_DOMAIN));
    ESSBOptionsStructureHelper::field_textbox($tab_id, $menu_id, $location . '_fullwidth_share_buttons_correction', __('Max width of button on desktop', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-arrows-h', 'right');
    ESSBOptionsStructureHelper::field_textbox($tab_id, $menu_id, $location . '_fullwidth_share_buttons_correction_mobile', __('Max width of button on mobile', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-arrows-h', 'right');
    ESSBOptionsStructureHelper::field_textbox($tab_id, $menu_id, $location . '_fullwidth_share_buttons_container', __('Max width of buttons container element', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), '', 'input60', 'fa-arrows-h', 'right');
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_fullwidth_align', __('Choose alignment of network name', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), array("left" => "Left", "center" => "Center", "right" => "Right"));
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Display in columns', ESSB3_TEXT_DOMAIN), '');
    $listOfOptions = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5");
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_fullwidth_share_buttons_columns', __('Number of columns', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), $listOfOptions);
    ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_fullwidth_share_buttons_columns_align', __('Choose alignment of network name', ESSB3_TEXT_DOMAIN), __('', ESSB3_TEXT_DOMAIN), array("" => "Left", "center" => "Center", "right" => "Right"));
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Personalize social networks', ESSB3_TEXT_DOMAIN), '');
    ESSBOptionsStructureHelper::field_checkbox_list_sortable($tab_id, $menu_id, $location . '_networks', __('Change active social networks', ESSB3_TEXT_DOMAIN), __('Do not select anything if you wish to use default network list' . ESSB3_TEXT_DOMAIN), $checkbox_list_networks);
    ESSBOptionsStructureHelper::field_section_start($tab_id, $menu_id, __('Rename displayed texts for network names', ESSB3_TEXT_DOMAIN), __('Set texts that will appear on selected display method instead of default network names. Use dash (-) if you wish to remove text for that network name.', ESSB3_TEXT_DOMAIN));
    foreach ($checkbox_list_networks as $key => $text) {
        ESSBOptionsStructureHelper::field_textbox_stretched($tab_id, $menu_id, $location . '_' . $key . '_name', $text, '');
    }
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
    ESSBOptionsStructureHelper::field_section_end($tab_id, $menu_id);
}
 public static function apply_postbar_position_style_settings($postion, $basic_style)
 {
     global $essb_options;
     if (ESSBOptionValuesHelper::options_value($essb_options, $postion . '_template') != "") {
         $basic_style['template'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_template');
     }
     $basic_style['nospace'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_nospace');
     $basic_style['show_counter'] = ESSBOptionValuesHelper::options_bool_value($essb_options, $postion . '_show_counter');
     $basic_style['counter_pos'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_counter_pos');
     $basic_style['total_counter_pos'] = 'hidden';
     $basic_style['button_style'] = ESSBOptionValuesHelper::options_value($essb_options, $postion . '_button_style');
     if ($basic_style['button_style'] == 'recommended') {
         $basic_style['button_style'] = 'icon';
     }
     return $basic_style;
 }