public function register_front_assets()
 {
     if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('fanscounter')) {
         return;
     }
     essb_resource_builder()->add_static_resource(ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/css/essb-followers-counter.min.css', 'essb-social-followers-counter', 'css');
 }
 public function register_front_assets()
 {
     if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('fanscounter')) {
         return;
     }
     wp_enqueue_script('jquery');
     wp_register_style('essb-social-fanscounter', ESSB3_PLUGIN_URL . '/lib/modules/social-fans-counter/assets/css/essb-social-fanscounter.css', false, ESSB3_VERSION);
     //wp_enqueue_script( 'essb-social-fanscounter-script' , ESSB3_PLUGIN_URL . '/lib/modules/social-fans-counter/assets/js/essb-social-fanscounter.js' , false , ESSB3_VERSION );
     wp_enqueue_style('essb-social-fanscounter');
     //wp_enqueue_script( 'essb-social-fanscounter-script' );
     wp_localize_script('essb-social-fanscounter-script', 'essb3fanscounter_object', array('ajaxurl' => admin_url('admin-ajax.php')));
 }
 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 get_list_of_social_apis()
 {
     global $essb_options;
     $social_apis = array();
     if (!defined('ESSB3_NATIVE_ACTIVE')) {
         return $social_apis;
     }
     if (ESSBCoreHelper::is_module_deactivate_on('native')) {
         return $social_apis;
     }
     if (ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button') && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebook_like_button_api')) {
         if (self::$essb_spb->is_active('facebook')) {
             $social_apis['facebook'] = "facebook";
         }
     }
     if (ESSBOptionValuesHelper::options_value($essb_options, 'googleplus') || ESSBOptionValuesHelper::options_bool_value($essb_options, 'youtubesub')) {
         if (self::$essb_spb->is_active('google') || self::$essb_spb->is_active('youtube')) {
             $social_apis['google'] = "google";
         }
     }
     if (ESSBOptionValuesHelper::options_value($essb_options, 'vklike')) {
         if (self::$essb_spb->is_active('vk')) {
             $social_apis['vk'] = "vk";
         }
     }
     if (ESSBOptionValuesHelper::options_value($essb_options, 'twitterfollow')) {
         if (self::$essb_spb->is_active('twitter')) {
             $social_apis['twitter'] = "twitter";
         }
     }
     if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'pinterestfollow')) {
         if (self::$essb_spb->is_active('pinterest')) {
             $social_apis['pinterest'] = "pinterest";
         }
     }
     return $social_apis;
 }
function essb_ctt_scripts()
{
    if (!ESSBCoreHelper::is_plugin_deactivated_on() && !ESSBCoreHelper::is_module_deactivate_on('ctt')) {
        wp_register_style('essb-cct-style', plugins_url('assets/css/styles.css', __FILE__), false, ESSB3_VERSION, 'all');
        wp_enqueue_style('essb-cct-style');
    }
}
 public static function get_share_address($network, $share = array(), $salt = '')
 {
     global $essb_networks, $essb_options;
     // TODO: add handle of user_image_url
     if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'advanced_custom_share')) {
         $as_url = ESSBOptionValuesHelper::options_value($essb_options, 'as_' . $network . '_url');
         $as_text = ESSBOptionValuesHelper::options_value($essb_options, 'as_' . $network . '_text');
         $as_image = ESSBOptionValuesHelper::options_value($essb_options, 'as_' . $network . '_image');
         $as_desc = ESSBOptionValuesHelper::options_value($essb_options, 'as_' . $network . '_desc');
         if (!empty($as_url)) {
             $share['url'] = $as_url;
         }
         if (!empty($as_text)) {
             $as_text = preg_replace(array('#%title%#', '#%siteurl%#', '#%permalink%#', '#%image%#', '#%shorturl%#'), array($share['title'], get_site_url(), $share['url'], $share['image'], $share['short_url']), $as_text);
             $share['title'] = $as_text;
         }
         if (!empty($as_image)) {
             $share['image'] = $as_image;
         }
         if (!empty($as_desc)) {
             $as_desc = preg_replace(array('#%title%#', '#%siteurl%#', '#%permalink%#', '#%image%#', '#%shorturl%#'), array($share['title'], get_site_url(), $share['url'], $share['image'], $share['short_url']), $as_desc);
             $share['description'] = $as_desc;
         }
     }
     // @since version 3.0.3 - fixes the GA Campaign tracking fields
     $ga_tracking_code = ESSBGlobalSettings::$activate_ga_campaign_tracking;
     //ESSBOptionValuesHelper::options_value($essb_options, 'activate_ga_campaign_tracking');
     if ($ga_tracking_code != '') {
         $share['url'] = str_replace('{network}', $network, $share['url']);
         $share['full_url'] = str_replace('{network}', $network, $share['full_url']);
         $share['url'] = str_replace('{title}', $share['title'], $share['url']);
         $share['full_url'] = str_replace('{title}', $share['title'], $share['full_url']);
         // rebuild shorturls if GA tracking is active
         // code refactor @since 3.4.2
         if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'shorturl_activate')) {
             $global_provider = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_type');
             if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_shareshort')) {
                 $global_shorturl = ESSBUrlHelper::short_url($share['full_url'], $global_provider, get_the_ID(), ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyuser'), ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyapi'));
                 $share['short_url_twitter'] = $global_shorturl;
                 $share['short_url_whatsapp'] = $global_shorturl;
             } else {
                 $share['short_url'] = ESSBUrlHelper::short_url($share['full_url'], $global_provider, get_the_ID(), ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyuser'), ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyapi'));
                 $share['short_url_twitter'] = $share['short_url'];
                 $share['short_url_whatsapp'] = $share['short_url'];
             }
             if ($share['short_url_twitter'] == '') {
                 $share['short_url_twitter'] = $share['url'];
             }
             if ($share['short_url_whatsapp'] == '') {
                 $share['short_url_whatsapp'] = $share['url'];
             }
             if ($share['short_url'] == '') {
                 $share['short_url'] = $share['url'];
             }
         } else {
             $share['twitter_tweet'] .= '%20' . $share['url'];
             $share['short_url_twitter'] = esc_attr($share['url']);
             $share['short_url_whatsapp'] = esc_attr($share['url']);
         }
         /*if (ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'twitter_shareshort' ) || 
         				ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'shorturl_activate' ) || 
         				ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'whatsapp_shareshort' )) {
         			$global_provider = ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_type' );
         			if (ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'shorturl_activate' )) {
         				$share ['short_url'] = ESSBUrlHelper::short_url ( $share ['full_url'], $global_provider, get_the_ID (), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyuser' ), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyapi' ) );
         				
         				$share ['short_url_twitter'] = $share ['short_url'];
         				$share ['short_url_whatsapp'] = $share ['short_url'];
         			} else {
         				if (ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'twitter_shareshort' )) {
         					$provider = ESSBOptionValuesHelper::options_value ( $essb_options, 'twitter_shareshort_service' );
         					$share ['short_url_twitter'] = ESSBUrlHelper::short_url ( $share ['full_url'], $global_provider, get_the_ID (), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyuser' ), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyapi' ) );
         				}
         				
         				if (ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'whatsapp_shareshort' )) {
         					$provider = ESSBOptionValuesHelper::options_value ( $essb_options, 'whatsapp_shareshort_service' );
         					
         					if ($provider == ESSBOptionValuesHelper::options_value ( $essb_options, 'twitter_shareshort_service' ) && ESSBOptionValuesHelper::options_bool_value ( $essb_options, 'twitter_shareshort' )) {
         						$share ['short_url_whatsapp'] = $share ['short_url_twitter'];
         					} else {
         						$share ['short_url_whatsapp'] = ESSBUrlHelper::short_url ( $share ['full_url'], $global_provider, get_the_ID (), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyuser' ), ESSBOptionValuesHelper::options_value ( $essb_options, 'shorturl_bitlyapi' ) );
         					}
         				}
         				
         				if ($share ['short_url_twitter'] == '') {
         					$share ['short_url_twitter'] = $share ['url'];
         				}
         				if ($share ['short_url_whatsapp'] == '') {
         					$share ['short_url_whatsapp'] = $share ['url'];
         				}
         			}
         		} else {
         			$share ['twitter_tweet'] .= '%20' . $share ['url'];
         			$share ['short_url_twitter'] = esc_attr ( $share ['url'] );
         			$share ['short_url_whatsapp'] = esc_attr ( $share ['url'] );
         		}*/
     }
     if (!isset($share['query'])) {
         if (isset($share['essb_encode_url'])) {
             if ($share['essb_encode_url']) {
                 $share['short_url_twitter'] = urlencode($share['short_url_twitter']);
                 $share['full_url'] = urlencode($share['full_url']);
                 $share['url'] = urlencode($share['url']);
                 $share['full_url'] = str_replace('&', '&', $share['full_url']);
                 $share['url'] = str_replace('&', '&', $share['url']);
             }
         }
         if (isset($share['essb_encode_text'])) {
             if ($share['essb_encode_text']) {
                 $share['twitter_tweet'] = str_replace("+", " ", $share['twitter_tweet']);
                 $share['title'] = urlencode($share['title']);
                 $share['twitter_tweet'] = urlencode($share['twitter_tweet']);
                 $share['description'] = urlencode($share['description']);
                 $share['twitter_tweet'] = str_replace(" ", "%20", $share['twitter_tweet']);
                 $share['twitter_tweet'] = str_replace("+", "%20", $share['twitter_tweet']);
                 $share['twitter_tweet'] = str_replace('&', '&', $share['twitter_tweet']);
                 $share['title'] = str_replace('&', '&', $share['title']);
                 $share['description'] = str_replace('&', '&', $share['description']);
             }
         }
         if (isset($share['essb_encode_text_plus'])) {
             if ($share['essb_encode_text_plus']) {
                 $share['twitter_tweet'] = str_replace(" ", "%20", $share['twitter_tweet']);
                 $share['twitter_tweet'] = str_replace("+", "%20", $share['twitter_tweet']);
             }
         }
     }
     $share['url'] = esc_attr($share['url']);
     $share['short_url'] = esc_attr($share['short_url']);
     $share['full_url'] = esc_attr($share['full_url']);
     $share['title'] = esc_attr($share['title']);
     $share['image'] = esc_attr($share['image']);
     $share['description'] = esc_attr($share['description']);
     if (isset($share['mail_subject'])) {
         $share['mail_subject'] = esc_attr(stripslashes($share['mail_subject']));
     }
     if (isset($share['mail_body'])) {
         $share['mail_body'] = esc_attr(stripslashes($share['mail_body']));
     }
     $pinterest_description = $share['description'];
     if (empty($pinterest_description)) {
         $pinterest_description = $share['title'];
     }
     // @since version 3.0.4 - fix for shorturl
     $shorturl_activate = ESSBOptionValuesHelper::options_bool_value($essb_options, 'shorturl_activate');
     if ($shorturl_activate && !empty($share['short_url'])) {
         $share['url'] = $share['short_url'];
     }
     $url = "";
     $api_command = "";
     $network_type = "buildin";
     if (isset($essb_networks[$network])) {
         $network_type = isset($essb_networks[$network]['type']) ? $essb_networks[$network]['type'] : "buildin";
     }
     if (isset($share['query'])) {
         if ($share['query']) {
             $share['short_url_twitter'] = urlencode($share['short_url_twitter']);
             $share['full_url'] = urlencode($share['full_url']);
             $share['url'] = urlencode($share['url']);
         }
     }
     switch ($network) {
         case "facebook":
             $url = sprintf('http://www.facebook.com/sharer/sharer.php?u=%1$s&t=%2$s', $share['url'], $share['title']);
             break;
         case "facebook_advanced":
             $fbappid = ESSBOptionValuesHelper::options_value($essb_options, 'facebookadvancedappid');
             $url = 'https://www.facebook.com/dialog/feed?app_id=' . $fbappid . '&display=popup&name=' . $share['title'] . '&link=' . $share['url'] . '&redirect_uri=https://www.facebook.com';
             if ($share['image'] != '') {
                 $url .= '&picture=' . $share['image'];
             }
             if ($share['description'] != '') {
                 $url .= '&description=' . $share['description'];
             }
             break;
         case "twitter":
             if ($share['short_url_twitter'] == '') {
                 $share['short_url_twitter'] = $share['url'];
             }
             $use_tweet = $share['twitter_tweet'];
             $use_tweet = str_replace('#', '%23', $use_tweet);
             $use_tweet = str_replace('|', '%7C', $use_tweet);
             // @since 3.1 Twitter message optimization
             $twitter_message_optimize = ESSBGlobalSettings::$twitter_message_optimize;
             //ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_message_optimize');
             if ($twitter_message_optimize) {
                 $twitter_message_optimize_method = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_message_optimize_method');
                 $optmized_tweet = ESSBButtonHelper::twitter_message_optimization($use_tweet, $share['short_url_twitter'], $share['twitter_user'], $share['twitter_hashtags'], $twitter_message_optimize_method);
                 $use_tweet = $optmized_tweet['tweet'];
                 $share['twitter_user'] = $optmized_tweet['user'];
                 $share['twitter_hashtags'] = $optmized_tweet['hashtags'];
             }
             $twitter_pass_user = $share['twitter_user'] != '' ? sprintf('&related=%1$s&via=%1$s', $share['twitter_user']) : "";
             $twitter_pass_hastags = $share['twitter_hashtags'] != '' ? sprintf('&hashtags=%1$s', $share['twitter_hashtags']) : '';
             $url = sprintf('https://twitter.com/intent/tweet?text=%1$s&url=%2$s&counturl=%3$s%4$s%5$s', $use_tweet, $share['short_url_twitter'], $share['full_url'], $twitter_pass_user, $twitter_pass_hastags);
             break;
         case "google":
             $url = sprintf('https://plus.google.com/share?url=%1$s', $share['url']);
             break;
         case "pinterest":
             $pin_image = $share['image'];
             $custom_pin_image = isset($share['pinterest_image']) ? $share['pinterest_image'] : '';
             if (!empty($custom_pin_image)) {
                 $pin_image = $custom_pin_image;
             }
             $url = sprintf('http://pinterest.com/pin/create/bookmarklet/?media=%1$s&url=%2$s&title=%3$s&description=%4$s', $pin_image, $share['url'], $share['title'], $pinterest_description);
             break;
         case "pinterest_picker":
             $url = "#";
             $api_command = "essb_pinterest_picker('" . $salt . "'); return false;";
             break;
         case "linkedin":
             $url = sprintf('http://www.linkedin.com/shareArticle?mini=true&ro=true&trk=EasySocialShareButtons&title=%1$s&url=%2$s', $share['title'], $share['url']);
             break;
         case "digg":
             $url = sprintf('http://digg.com/submit?phase=2%20&url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case "reddit":
             $url = sprintf('http://reddit.com/submit?url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case "del":
             $url = sprintf('https://delicious.com/save?v=5&noui&jump=close&url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case "buffer":
             $url = sprintf('https://bufferapp.com/add?url=%1$s&text=%2$s&via=%3$s&picture=&count=horizontal&source=button', $share['url'], $share['title'], $share['twitter_user']);
             break;
         case "love":
             $url = "#";
             $api_command = "essb_lovethis('" . $salt . "'); return false;";
             break;
         case "stumbleupon":
             $url = sprintf('http://www.stumbleupon.com/badge/?url=%1$s', $share['full_url']);
             break;
         case "tumblr":
             $url = sprintf('http://tumblr.com/share?s=&v=3&t=%1$s&u=%2$s', $share['title'], urlencode($share['url']));
             break;
         case "vk":
             $url = sprintf('http://vkontakte.ru/share.php?url=%1$s', $share['url']);
             break;
         case "ok":
             $url = sprintf('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=%1$s', $share['url']);
             break;
         case "weibo":
             $url = sprintf('http://service.weibo.com/share/share.php?url=%1$s&title=%2$s&pic=%3$s', $share['url'], $share['title'], $share['image']);
             break;
         case "xing":
             $url = sprintf('https://www.xing.com/social_plugins/share?h=1;url=%1$s', $share['url']);
             break;
         case "pocket":
             $url = sprintf('https://getpocket.com/save?title=%1$s&url=%2$s', $share['title'], urlencode($share['url']));
             break;
         case "mwp":
             $url = sprintf('http://managewp.org/share/form?url=%1$s', urlencode($share['url']));
             break;
         case "whatsapp":
             if ($share['short_url_whatsapp'] == '') {
                 $share['short_url_whatsapp'] = $share['url'];
             }
             $url = sprintf('whatsapp://send?text=%1$s%3$s%2$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']), '%20');
             $api_command = "essb_tracking_only('', 'whatsapp', '" . $salt . "', true);";
             break;
         case "meneame":
             $url = sprintf('http://www.meneame.net/submit.php?url=%1$s', $share['url']);
             break;
         case "print_friendly":
             $url = sprintf('http://www.printfriendly.com/print/?url=%1$s', $share['url']);
             break;
         case "print":
             $url = "#";
             $api_command = "essb_print('" . $salt . "'); return false;";
             break;
         case "mail":
             if (!$share['mail_subject']) {
                 $share['mail_subject'] = '';
             }
             if (!$share['mail_body']) {
                 $share['mail_body'] = '';
             }
             $url = sprintf('mailto:?subject=%1$s&body=%2$s', $share['mail_subject'], $share['mail_body']);
             $api_command = "essb_tracking_only('', 'mail', '" . $salt . "', true);";
             break;
         case "mail_form":
             $url = "#";
             $api_command = "essb_mailform_" . $salt . "('" . $salt . "'); return false;";
             break;
         case "more":
             $url = "#";
             $api_command = "essb_toggle_more('" . $salt . "'); return false;";
             break;
         case "less":
             $url = "#";
             $api_command = "essb_toggle_less('" . $salt . "'); return false;";
             break;
         case "more_popup":
             $url = "#";
             $api_command = "essb_toggle_more_popup('" . $salt . "'); return false;";
             break;
         case "flattr":
             if (!class_exists('ESSBNetworks_Flattr')) {
                 include_once ESSB3_PLUGIN_ROOT . 'lib/networks/essb-flattr.php';
             }
             $url = ESSBNetworks_Flattr::getStaticFlattrUrl($share);
             break;
             // @since 3.0
         // @since 3.0
         case "blogger":
             $url = sprintf('https://www.blogger.com/blog_this.pyra?t&u=%1$s&n=%2$s', $share['url'], $share['title']);
             break;
         case 'amazon':
             $url = sprintf('http://www.amazon.com/gp/wishlist/static-add?u=%1$s&t=%2$s', $share['url'], $share['title']);
             break;
         case 'yahoomail':
             $url = sprintf('http://compose.mail.yahoo.com/?body=%1$s', $share['url']);
             break;
         case 'gmail':
             $url = sprintf('https://mail.google.com/mail/u/0/?view=cm&fs=1&su=%2$s&body=%1$s&ui=2&tf=1', $share['url'], $share['title']);
             break;
         case 'aol':
             $url = sprintf('http://webmail.aol.com/Mail/ComposeMessage.aspx?subject=%2$s&body=%1$s', $share['url'], $share['title']);
             break;
         case 'newsvine':
             $url = sprintf('http://www.newsvine.com/_tools/seed&save?u=%1$s&h=%2$s', $share['url'], $share['title']);
             break;
         case 'hackernews':
             $url = sprintf('https://news.ycombinator.com/submitlink?u=%1$s&t=%2$s', $share['url'], $share['title']);
             break;
         case 'evernote':
             $url = sprintf('http://www.evernote.com/clip.action?url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case 'myspace':
             $url = sprintf('https://myspace.com/post?u=%1$s', esc_attr($share['url']));
             break;
         case "mailru":
             $url = sprintf('http://connect.mail.ru/share?url=%1$s&title=%2$s&description=%3$s', $share['url'], $share['title'], $share['description']);
             break;
         case "viadeo":
             $url = sprintf('https://www.viadeo.com/?url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case "line":
             //$url = sprintf('http://line.me/R/msg/text/%1$s%20%2$s', ESSBCoreHelper::urlencode ( $share ['title'] ), rawurlencode ( $share ['short_url_whatsapp'] ));
             $url = sprintf('line://msg/text/%1$s%3$s%2$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']), '%20');
             $api_command = "essb_tracking_only('', 'line', '" . $salt . "', true);";
             break;
         case "embedly":
             $url = "";
             $api_command = "embedly.modal();";
             break;
         case "flipboard":
             $url = sprintf('https://share.flipboard.com/bookmarklet/popout?url=%1$s&title=%2$s', $share['url'], $share['title']);
             break;
         case "yummly":
             $url = sprintf('http://www.yummly.com/urb/verify?url=%2$s&title=%3$s&image=%1$s&yumtype=button', $share['image'], $share['url'], $share['title'], $share['description']);
             break;
         case "sms":
             if ($share['short_url_whatsapp'] == '') {
                 $share['short_url_whatsapp'] = $share['url'];
             }
             $url = sprintf('sms:&body=%1$s%3$s%2$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']), '%20');
             break;
         case "viber":
             if ($share['short_url_whatsapp'] == '') {
                 $share['short_url_whatsapp'] = $share['url'];
             }
             $url = sprintf('viber://forward?text=%1$s%3$s%2$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']), '%20');
             $api_command = "essb_tracking_only('', 'viber', '" . $salt . "', true);";
             break;
         case "telegram":
             if ($share['short_url_whatsapp'] == '') {
                 $share['short_url_whatsapp'] = $share['url'];
             }
             // @since 3.4.2 - we include telegram alternative share method
             if (ESSBGlobalSettings::$telegram_alternative) {
                 $url = sprintf('https://telegram.me/share/url?url=%2$s&text=%1$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']));
             } else {
                 $url = sprintf('tg://msg?text=%1$s%3$s%2$s', ESSBCoreHelper::urlencode($share['title_plain']), rawurlencode($share['short_url_whatsapp']), '%20');
             }
             $api_command = "essb_tracking_only('', 'telegram', '" . $salt . "', true);";
             break;
         default:
             // @since 3.0 - module parsing social buttons or custom social buttons
             if ($network_type != 'buildin') {
                 /*$url = '';
                 		$api_command = '';
                 		
                 		$button_object_name = "ESSBNetwork_".$network;
                 		if (method_exists($button_object_name, 'get_share_address')) {
                 			$url = $button_object_name::get_share_address($share);
                 		}
                 		if (method_exists($button_object_name, 'get_api_command')) {
                 			$api_command = $button_object_name::get_api_command($share);
                 		}*/
             }
             break;
     }
     if ($api_command == '') {
         $api_command = sprintf('essb_window('%1$s','%2$s','%3$s'); return false;', $url, $network, $salt);
         if ($network == "twitter") {
             $url = "#";
         }
     }
     if ($share['essb_encode_url']) {
         $url = str_replace('&', '&', $url);
         //print $url;
     }
     return array("url" => $url, 'api_command' => $api_command);
 }
Пример #8
0
 public function import_post_settings()
 {
     global $wpdb;
     $post_types = array("post", "page");
     $querydata = new WP_Query(array('posts_per_page' => -1, 'post_status' => 'publish', 'post_type' => $post_types));
     $translation_settings_map = array();
     $translation_settings_map['essb_position'] = 'complex';
     $translation_settings_map['essb_theme'] = 'essb_post_template';
     $translation_settings_map['essb_names'] = 'complex';
     $translation_settings_map['essb_counter'] = 'essb_post_counters';
     $translation_settings_map['essb_counter_pos'] = 'essb_post_counter_pos';
     $translation_settings_map['essb_total_counter_pos'] = 'essb_post_total_counter_pos';
     $translation_settings_map['essb_hidefb'] = 'complex';
     $translation_settings_map['essb_hideplusone'] = 'complex';
     $translation_settings_map['essb_hidevk'] = 'complex';
     $translation_settings_map['essb_hidetwitter'] = 'complex';
     $translation_settings_map['essb_hideyoutube'] = 'complex';
     $translation_settings_map['essb_hidepinfollow'] = 'complex';
     $translation_settings_map['essb_another_display_sidebar'] = 'essb_post_button_position_sidebar';
     $translation_settings_map['essb_another_display_popup'] = 'essb_post_button_position_popup';
     $translation_settings_map['essb_another_display_postfloat'] = 'essb_post_button_position_postfloat';
     $translation_settings_map['essb_another_display_flyin'] = 'essb_post_button_position_flyin';
     $translation_settings_map['essb_activate_customizer'] = 'essb_post_animations';
     $translation_settings_map['essb_opt_by_bp'] = 'essb_post_optionsbp';
     $translation_settings_map['essb_animation'] = 'essb_post_animations';
     $translation_settings_map['essb_activate_nativeskinned'] = 'essb_post_native_skin';
     if ($querydata->have_posts()) {
         while ($querydata->have_posts()) {
             $querydata->the_post();
             global $post;
             $post_id = $post->ID;
             foreach ($translation_settings_map as $old_key => $new_key) {
                 $value = get_post_meta($post_id, $old_key, true);
                 if (empty($value)) {
                     continue;
                 }
                 if ($old_key == "essb_theme") {
                     $value = ESSBCoreHelper::template_folder($value);
                 }
                 if ($new_key != 'complex') {
                     if ($value == '0') {
                         $value = 'no';
                     }
                     if ($value == '1') {
                         $value = 'yes';
                     }
                     $this->save_metabox_value_simple($post_id, $new_key, $value);
                 } else {
                     switch ($old_key) {
                         case "essb_position":
                             break;
                         case "essb_names":
                             $new_value = "";
                             if ($value == "0") {
                                 $new_value = "button";
                             } else {
                                 $new_value = "icon_hover";
                             }
                             $this->save_metabox_value_simple($post_id, 'essb_post_button_style', $new_value);
                             break;
                         case "essb_hidefb":
                         case "essb_hideplusone":
                         case "essb_hidevk":
                         case "essb_hidetwitter":
                         case "essb_hideyoutube":
                         case "essb_hidepinfollow":
                             if ($value == "1") {
                                 $this->save_metabox_value_simple($post_id, 'essb_post_native', 'no');
                             }
                             break;
                         case "essb_position":
                             if ($value == "top" || $value == "bottom" || $value == "both" || $value == "float") {
                                 $this->save_metabox_value_simple($post_id, 'essb_post_content_position', 'content_' . $value);
                             } else {
                                 if ($value == 'likeshare') {
                                     $this->save_metabox_value_simple($post_id, 'essb_post_content_position', 'content_nativeshare');
                                 } else {
                                     if ($value == 'sharelike') {
                                         $this->save_metabox_value_simple($post_id, 'essb_post_content_position', 'content_sharenative');
                                     } else {
                                         $this->save_metabox_value_simple($post_id, 'essb_post_content_position', 'no');
                                         if ($value == 'sidebar') {
                                             $this->save_metabox_value_simple($post_id, 'essb_post_button_position_sidebar', 'yes');
                                         }
                                         if ($value == 'popup') {
                                             $this->save_metabox_value_simple($post_id, 'essb_post_button_position_popup', 'yes');
                                         }
                                         if ($value == 'flyin') {
                                             $this->save_metabox_value_simple($post_id, 'essb_post_button_position_flyin', 'yes');
                                         }
                                         if ($value == 'postfloat') {
                                             $this->save_metabox_value_simple($post_id, 'essb_post_button_position_postfloat', 'yes');
                                         }
                                     }
                                 }
                             }
                             break;
                     }
                 }
             }
         }
     }
 }
    function generate_custom_footer_js()
    {
        global $post;
        if ($this->is_plugin_deactivated_on()) {
            return;
        }
        $cache_slug = "essb-js-footer";
        if (count($this->js_social_apis) > 0) {
            if (!ESSBCoreHelper::is_module_deactivate_on('native')) {
                foreach ($this->js_social_apis as $network => $loaded) {
                    $this->load_social_api_code($network);
                }
            }
        }
        // load of static scripts async or deferred
        if (count($this->js_static) > 0) {
            if ($this->js_defer || $this->js_async) {
                $js_code_patterns = array();
                $load_mode = $this->js_async ? "po.async=true;" : "po.defer=true;";
                foreach ($this->js_static as $key => $file) {
                    $js_code_patterns[] = sprintf('
					(function() {
					var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s;
					po.src = \'%1$s\';
					var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
					})();', $file, $load_mode);
                }
                printf('<script type="text/javascript">%1$s</script>', implode(" ", $js_code_patterns));
            } else {
                if ($this->js_delayed) {
                    // delayed script loading
                    $js_code_patterns = array();
                    $load_mode = "po.async=true;";
                    foreach ($this->js_static as $key => $file) {
                        $js_code_patterns[] = sprintf('
							(function() {
							var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s;
							po.src = \'%1$s\';
							var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
					})();', $file, $load_mode);
                    }
                    printf('<script type="text/javascript">jQuery( document ).ready(function() { setTimeout(function() { %1$s }, 2000); });</script>', implode(" ", $js_code_patterns));
                }
            }
        }
        if (count($this->js_static_footer)) {
            if ($this->js_defer || $this->js_async) {
                $js_code_patterns = array();
                $load_mode = $this->js_async ? "po.async=true;" : "po.defer=true;";
                foreach ($this->js_static_footer as $key => $file) {
                    $js_code_patterns[] = sprintf('
							(function() {
							var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s;
							po.src = \'%1$s\';
							var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
				})();', $file, $load_mode);
                }
                printf('<script type="text/javascript">%1$s</script>', implode(" ", $js_code_patterns));
            } else {
                if ($this->js_delayed) {
                    // delayed script loading
                    $js_code_patterns = array();
                    $load_mode = "po.async=true;";
                    foreach ($this->js_static_footer as $key => $file) {
                        $js_code_patterns[] = sprintf('
							(function() {
							var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s;
							po.src = \'%1$s\';
							var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
				})();', $file, $load_mode);
                    }
                    printf('<script type="text/javascript">jQuery( document ).ready(function() { setTimeout(function() { %1$s }, 2000); });</script>', implode(" ", $js_code_patterns));
                } else {
                    foreach ($this->js_static_footer as $key => $file) {
                        //wp_enqueue_script ( $key, $file, array ( 'jquery' ), $this->resource_version, false );
                        $this->manual_script_load($key, $file);
                    }
                }
            }
        }
        if (count($this->js_static_noasync_footer)) {
            foreach ($this->js_static_noasync_footer as $key => $file) {
                //wp_enqueue_script ( $key, $file, array ( 'jquery' ), $this->resource_version, true );
                $this->manual_script_load($key, $file);
            }
        }
        if (count($this->js_code_noncachable)) {
            // load non cachable javascript code
            echo implode(" ", $this->js_code_noncachable);
        }
        // dynamic footer javascript that can be cached
        $cache_slug = "essb-js-footer";
        if (isset($post)) {
            if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) {
                $cache_key = $cache_slug . $post->ID;
                $cached_data = ESSBDynamicCache::get_resource($cache_key, 'js');
                if ($cached_data != '') {
                    echo "<script type='text/javascript' src='" . $cached_data . "' defer></script>";
                    return;
                }
            }
        }
        //$js_code = implode(" ", $this->js_code);
        $js_code = '';
        foreach ($this->js_code as $single) {
            $js_code .= $single;
        }
        if (isset($post)) {
            if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) {
                $cache_key = $cache_slug . $post->ID;
                ESSBDynamicCache::put_resource($cache_key, $js_code, 'js');
                $cached_data = ESSBDynamicCache::get_resource($cache_key, 'js');
                if ($cached_data != '') {
                    echo "<script type='text/javascript' src='" . $cached_data . "' defer></script>";
                    return;
                }
            }
        }
        echo '<script type="text/javascript">';
        echo $js_code;
        echo '</script>';
    }
 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;
     }
 }
Пример #11
0
 /**
  * get_post_share_details
  * 
  * Generate post sharing details
  * 
  * @param string $position
  * @return array
  */
 function get_post_share_details($position)
 {
     global $post;
     if ($this->general_options['reset_postdata']) {
         wp_reset_postdata();
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_query_postid')) {
         $current_query_id = get_queried_object_id();
         $post = get_post($current_query_id);
     }
     $url = "";
     $title = "";
     $image = "";
     $description = "";
     $title_plain = "";
     $twitter_user = $this->network_options['twitter_user'];
     $twitter_hashtags = $this->network_options['twitter_hashtags'];
     $twitter_customtweet = "";
     $url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw');
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) {
         $url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw');
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) {
         $url = ESSBUrlHelper::get_current_page_url();
     }
     if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) {
         $url = str_replace("https://", "http://", $url);
     }
     if (!defined('ESSB3_LIGHTMODE')) {
         $mycred_referral_activate = ESSBOptionValuesHelper::options_bool_value($this->options, 'mycred_referral_activate');
         if ($mycred_referral_activate && function_exists('mycred_render_affiliate_link')) {
             $url = mycred_render_affiliate_link(array('url' => $url));
         }
     }
     if (isset($post)) {
         $title = esc_attr(urlencode($post->post_title));
         $title_plain = $post->post_title;
         $image = ESSBCoreHelper::get_post_featured_image($post->ID);
         $description = $post->post_excerpt;
         if ($position == "heroshare") {
             if ($description == "") {
                 $working_post_content = $post->post_content;
                 $working_post_content = strip_tags($working_post_content);
                 $working_post_content = preg_replace('/\\s+/', ' ', $working_post_content);
                 $working_post_content = strip_shortcodes($working_post_content);
                 $working_post_content = trim($working_post_content);
                 $working_post_content = substr($working_post_content, 0, 400);
                 $description = $working_post_content;
             }
         }
     }
     $list_of_articles_mode = false;
     if (is_archive() || is_front_page() || is_search() || is_tag() || is_post_type_archive()) {
         if ($position == "sidebar" || $position == "flyin" || $position == "popup" || $position == "topbar" || $position == "bottombar") {
             if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_archive_pages')) {
                 $list_of_articles_mode = true;
                 $url = ESSBUrlHelper::get_current_page_url();
                 if (is_front_page()) {
                     $title = get_bloginfo('name');
                     $title_plain = $title;
                     $description = get_bloginfo('description');
                 } else {
                     $title = get_the_archive_title();
                     $title_plain = $title;
                     $description = get_the_archive_description();
                 }
             }
         }
     }
     // apply custom share options
     if ($this->general_options['customshare']) {
         if ($this->general_options['customshare_text'] != '') {
             $title = $this->general_options['customshare_text'];
             $title_plain = $title;
         }
         if ($this->general_options['customshare_url'] != '') {
             $url = $this->general_options['customshare_url'];
         }
         if ($this->general_options['customshare_image'] != '') {
             $image = $this->general_options['customshare_image'];
         }
         if ($this->general_options['customshare_description'] != '') {
             $description = $this->general_options['customshare_description'];
         }
     }
     $twitter_customtweet = $title;
     $post_pin_image = "";
     // apply post custom share options
     if (isset($post) && !$list_of_articles_mode) {
         $twitter_message_tags_to_hashtags = ESSBOptionValuesHelper::options_bool_value($this->options, 'twitter_message_tags_to_hashtags');
         if ($twitter_message_tags_to_hashtags) {
             $post_tags = wp_get_post_tags($post->ID);
             if ($post_tags) {
                 $generated_tags = array();
                 foreach ($post_tags as $tag) {
                     $current_tag = $tag->name;
                     $current_tag = str_replace(' ', '', $current_tag);
                     $generated_tags[] = $current_tag;
                 }
                 if (count($generated_tags) > 0) {
                     $twitter_hashtags = implode(',', $generated_tags);
                 }
             }
         }
         $post_essb_post_share_message = get_post_meta($post->ID, 'essb_post_share_message', true);
         $post_essb_post_share_url = get_post_meta($post->ID, 'essb_post_share_url', true);
         $post_essb_post_share_image = get_post_meta($post->ID, 'essb_post_share_image', true);
         $post_essb_post_share_text = get_post_meta($post->ID, 'essb_post_share_text', true);
         $post_pin_image = get_post_meta($post->ID, 'essb_post_pin_image', true);
         $post_essb_twitter_username = get_post_meta($post->ID, 'essb_post_twitter_username', true);
         $post_essb_twitter_hastags = get_post_meta($post->ID, 'essb_post_twitter_hashtags', true);
         $post_essb_twitter_tweet = get_post_meta($post->ID, 'essb_post_twitter_tweet', true);
         if ($post_essb_post_share_image != '') {
             $image = $post_essb_post_share_image;
         }
         if ($post_essb_post_share_message != '') {
             $description = $post_essb_post_share_message;
         }
         if ($post_essb_post_share_text != '') {
             $title = $post_essb_post_share_text;
             $title_plain = $post_essb_post_share_text;
         }
         if ($post_essb_post_share_url != '') {
             $url = $post_essb_post_share_url;
         }
         if ($post_essb_twitter_hastags != '') {
             $twitter_hashtags = $post_essb_twitter_hastags;
         }
         if ($post_essb_twitter_tweet != '') {
             $twitter_customtweet = $post_essb_twitter_tweet;
         }
         if ($post_essb_twitter_username != '') {
             $twitter_user = $post_essb_twitter_username;
         }
     }
     // inetegration with affiliate plugins is not availalbe as option in easy mode
     if (!defined('ESSB3_LIGHTMODE')) {
         $affwp_active = ESSBOptionValuesHelper::options_bool_value($this->options, 'affwp_active');
         if ($affwp_active) {
             $url = ESSBUrlHelper::generate_affiliatewp_referral_link($url);
         }
         $affs_active = ESSBOptionValuesHelper::options_bool_value($this->options, 'affs_active');
         if ($affs_active) {
             $url = do_shortcode('[affiliates_url]' . $url . '[/affiliates_url]');
         }
     }
     $title = str_replace("'", "\\'", $title);
     $description = str_replace("'", "\\'", $description);
     $twitter_customtweet = str_replace("'", "\\'", $twitter_customtweet);
     $title_plain = str_replace("'", "\\'", $title_plain);
     return array("url" => $url, "title" => $title, "image" => $image, "description" => $description, "twitter_user" => $twitter_user, "twitter_hashtags" => $twitter_hashtags, "twitter_tweet" => $twitter_customtweet, "post_id" => isset($post) ? $post->ID : 0, "user_image_url" => "", "title_plain" => $title_plain, 'short_url_whatsapp' => '', 'short_url_twitter' => '', 'short_url' => '', 'pinterest_image' => $post_pin_image);
 }
function essb_ctt_scripts()
{
    if (!ESSBCoreHelper::is_plugin_deactivated_on() && !ESSBCoreHelper::is_module_deactivate_on('ctt')) {
        //wp_register_style ( 'essb-cct-style', plugins_url ( 'assets/css/styles.css', __FILE__ ), false, ESSB3_VERSION, 'all' );
        //$resource_builder = ESSBResourceBuilder::get_instance();
        essb_resource_builder()->add_static_resource(plugins_url('assets/css/styles.css', __FILE__), 'essb-cct-style', 'css');
        //wp_enqueue_style ( 'essb-cct-style' );
    }
}
    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 
    }
 public function outputMeta()
 {
     global $post;
     if (ESSBCoreHelper::is_module_deactivate_on('sso')) {
         return "";
     }
     $cache_key = "";
     if (isset($post)) {
         $cache_key = "essb_ogtags_" . $post->ID;
         if (defined('ESSB_CACHE_ACTIVE')) {
             $cached_data = ESSBCache::get($cache_key);
             if ($cached_data != '') {
                 echo "\r\n";
                 echo $cached_data;
                 echo "\r\n";
                 return;
             }
         }
     }
     $this->loadPostSettings();
     // @since 3.3 front page optimization tags
     $this->loadFrontpageTags();
     if ($this->ogtags_active) {
         $this->buildFacebookMeta();
     }
     if ($this->twitter_cards_active) {
         $this->buildTwitterMeta();
     }
     if ($this->google_authorship || $this->google_markup) {
         $this->buildGoogleMeta();
     }
     $output_meta = "";
     echo "\r\n";
     foreach ($this->meta as $single) {
         $output_meta .= $single . "\r\n";
     }
     echo $output_meta;
     echo "\r\n";
     if (defined('ESSB_CACHE_ACTIVE')) {
         if ($cache_key != '') {
             ESSBCache::put($cache_key, $output_meta);
         }
     }
 }
Пример #15
0
 function get_native_button_settings($position = '', $only_share = false)
 {
     $are_active = true;
     if (!defined('ESSB3_NATIVE_ACTIVE')) {
         $are_active = false;
     } else {
         if (!ESSB3_NATIVE_ACTIVE) {
             $are_active = false;
         }
     }
     if (defined('ESSB3_NATIVE_DEACTIVE')) {
         $are_active = false;
     }
     if ($this->is_mobile()) {
         if (!ESSBOptionValuesHelper::options_bool_value($this->options, 'allow_native_mobile')) {
             $are_active = false;
         }
     }
     if (!empty($position)) {
         if (ESSBOptionValuesHelper::options_bool_value($this->options, $position . '_native_deactivate')) {
             $are_active = false;
         }
     }
     if ($only_share) {
         $are_active = false;
     }
     if (ESSBCoreHelper::is_module_deactivate_on('native')) {
         $are_active = false;
     }
     if (!$are_active) {
         return array("active" => false);
     }
     $native_options = ESSBNativeButtonsHelper::native_button_defaults();
     $native_options['active'] = $are_active;
     return $native_options;
 }