/**
  * 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;
     }
 }
 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;
     }
 }
 public static function draw_form_start($metabox_id)
 {
     global $essb_options;
     $admin_template = ESSBOptionValuesHelper::options_value($essb_options, 'admin_template');
     if (!empty($admin_template)) {
         $admin_template = "essb-template-" . $admin_template;
     }
     echo '<div class="essb-options essb-metabox-options ' . $admin_template . '" id="' . $metabox_id . '">';
 }
Ejemplo n.º 4
0
 public function syncSharedCountData($post_id, $post_url)
 {
     global $essb_options;
     $apikey = ESSBOptionValuesHelper::options_value($essb_options, 'esml_sharedcount_api');
     // reject if missing arguments
     if (!isset($post_id) || !isset($post_url)) {
         return;
     }
     // get social data from api.sharedcount.com
     $curl_handle = curl_init();
     //if (ESSB_ESML_DEBUG) {
     //	$post_url = 'http://www.google.com';
     //}
     //curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($post_url));
     curl_setopt($curl_handle, CURLOPT_URL, 'http://free.sharedcount.com/?url=' . rawurlencode($post_url) . '&apikey=' . $apikey);
     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
     $json = curl_exec($curl_handle);
     curl_close($curl_handle);
     //print $json;
     // reject if no response
     if (!strlen($json)) {
         return;
     }
     // decode social data from JSON
     $shared_count_service_data = json_decode($json, true);
     // prepare stats array
     $stats = array();
     // Stats we want to include in total
     $stats['facebook'] = $shared_count_service_data['Facebook']['total_count'];
     $stats['twitter'] = $shared_count_service_data['Twitter'];
     $stats['googleplus'] = $shared_count_service_data['GooglePlusOne'];
     $stats['linkedin'] = $shared_count_service_data['LinkedIn'];
     $stats['pinterest'] = $shared_count_service_data['Pinterest'];
     $stats['diggs'] = $shared_count_service_data['Diggs'];
     $stats['delicious'] = $shared_count_service_data['Delicious'];
     $stats['reddit'] = $shared_count_service_data['Reddit'];
     $stats['stumbleupon'] = $shared_count_service_data['StumbleUpon'];
     // Calculate total
     $stats['TOTAL'] = array_sum($stats);
     // Additional stats
     $stats['facebook_shares'] = $shared_count_service_data['Facebook']['share_count'];
     $stats['facebook_comments'] = $shared_count_service_data['Facebook']['comment_count'];
     $stats['facebook_likes'] = $shared_count_service_data['Facebook']['like_count'];
     // Calculate change since last update
     $delta = array();
     $old_meta = get_post_custom($post_id);
     //foreach ($stats as $key => $value) if (is_int($value) && is_int($old_meta['esml_socialcount_'.$key][0])) $delta[$key] = $value - $old_meta['esml_socialcount_'.$key][0];
     // update post with populated stats
     foreach ($stats as $key => $value) {
         if ($value) {
             update_post_meta($post_id, 'esml_socialcount_' . $key, $value);
         }
     }
     //$this->saveToDB($post_id, $delta);
 }
 public static function is_activated()
 {
     global $essb_options;
     $purchase_code = ESSBOptionValuesHelper::options_value($essb_options, 'purchase_code');
     if (!empty($purchase_code)) {
         return true;
     } else {
         return false;
     }
 }
 function get_settings($option_name, $default_value = '', $boolean = false)
 {
     global $essb_options;
     $value = ESSBOptionValuesHelper::options_value($essb_options, $option_name);
     if (trim($value) == '') {
         $value = $default_value;
     }
     // @new image share support only top position @since version 3.2.6
     if ($option_name == "sis_align_y") {
         $value = "top";
     }
     return $value;
 }
 public static function draw_form_start($custom = false, $group = '')
 {
     global $_REQUEST, $current_tab, $essb_options;
     $active_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
     $active_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
     $admin_template = ESSBOptionValuesHelper::options_value($essb_options, 'admin_template');
     if (!empty($admin_template)) {
         $admin_template = "essb-template-" . $admin_template;
     }
     echo '<div id="essb-scroll-top"></div>';
     echo '<form id="essb_options_form" enctype="multipart/form-data" method="post" action="">';
     if ($custom && !empty($group)) {
         settings_fields($group);
     } else {
         settings_fields('essb_settings_group');
     }
     echo '<input id="section" name="section" type="hidden" value="' . $active_section . '"/>';
     echo '<input id="subsection" name="subsection" type="hidden" value="' . $active_subsection . '"/>';
     echo '<input id="tab" name="tab" type="hidden" value="' . $current_tab . '"/>';
     echo '<div class="essb-options ' . $admin_template . '" id="essb-options">';
 }
 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);
 }
Ejemplo n.º 9
0
 public function import_plugin_settings()
 {
     $previous_options = get_option('easy-social-share-buttons');
     if (!is_array($previous_options)) {
         return;
     }
     // basic change of settings;
     //activate_total_counter_text
     $activate_total_counter_text_value = ESSBOptionValuesHelper::options_value($previous_options, 'activate_total_counter_text_value');
     if (!empty($activate_total_counter_text_value)) {
         $previous_options['activate_total_counter_text'] = $activate_total_counter_text_value;
     }
     // button_style
     $hide_social_name = ESSBOptionValuesHelper::options_value($previous_options, 'hide_social_name');
     // 1
     $force_hide_social_name = ESSBOptionValuesHelper::options_value($previous_options, 'force_hide_social_name');
     // true
     $force_hide_icons = ESSBOptionValuesHelper::options_value($previous_options, 'force_hide_icons');
     // true
     $force_hide_total_count = ESSBOptionValuesHelper::options_value($previous_options, 'force_hide_total_count');
     // true
     $button_style = 'button';
     if ($hide_social_name == '1') {
         $button_style = 'icon_hover';
     }
     if ($force_hide_social_name == 'true') {
         $button_style = 'icon';
     }
     if ($force_hide_icons == 'true') {
         $button_style = 'button_name';
     }
     $previous_options['button_style'] = $button_style;
     if ($force_hide_total_count == 'true') {
         $previous_options['total_counter_pos'] = 'hidden';
     }
     $previous_options['button_position'] = array();
     // display position
     $display_where = ESSBOptionValuesHelper::options_value($previous_options, 'display_where');
     if ($display_where == "top" || $display_where == "bottom" || $display_where == "both" || $display_where == "float") {
         $previous_options['content_position'] = 'content_' . $display_where;
     } else {
         if ($display_where == 'likeshare') {
             $previous_options['content_position'] = 'content_nativeshare';
         } else {
             if ($display_where == 'sharelike') {
                 $previous_options['content_position'] = 'content_sharenative';
             } else {
                 if ($display_where == 'sidebar') {
                     $previous_options['button_position'][] = 'sidebar';
                 }
                 if ($display_where == 'popup') {
                     $previous_options['button_position'][] = 'popup';
                 }
                 if ($display_where == 'flyin') {
                     $previous_options['button_position'][] = 'flyin';
                 }
                 if ($display_where == 'postfloat') {
                     $previous_options['button_position'][] = 'postfloat';
                 }
             }
         }
     }
     // active networks
     $networks = ESSBOptionValuesHelper::options_value($previous_options, 'networks');
     // array
     $user_networks = array();
     if (is_array($networks)) {
         foreach ($networks as $k => $v) {
             $is_active = $v[0] == 1 ? true : false;
             $network_name = $v[1];
             if (empty($network_name)) {
                 $network_name = "-";
             }
             $network_option_value = "user_network_name_" . $k;
             if ($is_active) {
                 $user_networks[] = $k;
             }
             $previous_options[$network_option_value] = $network_name;
         }
     }
     $previous_options['networks'] = $user_networks;
     // for compatibility we activate native buttons
     $previous_options['native_active'] = true;
     $previous_options['fanscounter_active'] = true;
     update_option(ESSB3_OPTIONS_NAME, $previous_options);
     update_option('essb2_converted', 'true');
     $stats_active = ESSBOptionValuesHelper::options_value($previous_options, 'stats_active');
     if ($stats_active) {
         ESSBSocialShareAnalyticsBackEnd::install();
     }
 }
 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();
     }
 }
Ejemplo n.º 11
0
 public static function apply_position_network_names($position, $network_names)
 {
     global $essb_options, $essb_networks;
     foreach ($essb_networks as $key => $object) {
         $search_for = $position . "_" . $key . "_name";
         $user_network_name = ESSBOptionValuesHelper::options_value($essb_options, $search_for);
         if ($user_network_name != '') {
             $network_names[$key] = $user_network_name;
         }
     }
     return $network_names;
 }
 public function loadFrontpageTags()
 {
     if (is_front_page()) {
         $fp_title = ESSBOptionValuesHelper::options_value($this->options, 'sso_frontpage_title');
         $fp_description = ESSBOptionValuesHelper::options_value($this->options, 'sso_frontpage_description');
         $fp_image = ESSBOptionValuesHelper::options_value($this->options, 'sso_frontpage_image');
         $this->fb_description = $fp_description;
         $this->fb_title = $fp_title;
         $this->fb_image = $fp_image;
         $this->twitter_description = $fp_description;
         $this->twitter_title = $fp_title;
         $this->twitter_image = $fp_image;
         $this->google_description = $fp_description;
         $this->google_title = $fp_title;
         $this->google_image = $fp_image;
         $this->post_url = get_site_url();
     }
 }
Ejemplo n.º 13
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;
 }
 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;
     }
 }
 public static function facebook_button_code($settings = array(), $counters = false)
 {
     global $essb_options;
     $facebook_type = isset($settings['facebook_type']) ? $settings['facebook_type'] : 'like';
     $facebook_url = isset($settings['facebook_url']) ? $settings['facebook_url'] : '';
     $facebook_margin_top = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_margin_top');
     $facebook_height = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_height');
     $facebook_width = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_width');
     if (trim($facebook_width) != "") {
         $facebook_width = "width:" . $facebook_width . 'px;';
     }
     $code = '<div style="' . self::facebook_button_css_fixer('display: inline-block; height: 24px; max-height: 24px; ' . $facebook_width . 'vertical-align: top;', $facebook_height, $facebook_margin_top) . '">';
     if ($facebook_type == "like") {
         $code .= '<div class="fb-like" data-href="' . $facebook_url . '" data-layout="' . ($counters ? "button_count" : "button") . '" data-action="like" data-show-faces="false" data-share="false" data-width="292" style="vertical-align: top; zoom: 1;display: inline;"></div>';
     } else {
         $code .= '<div class="fb-follow" data-href="' . $facebook_url . '" data-layout="' . ($counters ? "button_count" : "button") . '" data-show-faces="false"></div>';
     }
     $code .= '</div>';
     return $code;
 }
 function get_settings($option_name, $default_value = '', $boolean = false)
 {
     global $essb_options;
     $value = ESSBOptionValuesHelper::options_value($essb_options, $option_name);
     if (trim($value) == '') {
         $value = $default_value;
     }
     return $value;
 }
 function __construct()
 {
     include_once ESSB3_PLUGIN_ROOT . 'lib/essb-core-includes.php';
     // begin plugin front end code execution
     $this->essb_resource_builder = ESSBResourceBuilder::get_instance();
     $this->essb = ESSBCore::get_instance();
     // loading social share optimization only when it is active
     if (defined('ESSB3_SSO_ACTIVE')) {
         ESSBSocialShareOptimization::get_instance();
     }
     if (defined('ESSB3_SSA_ACTIVE')) {
         $tracker = ESSBSocialShareAnalytics::get_instance();
         $this->essb_resource_builder->add_js($tracker->generate_tracker_code(), true, 'essb-stats-tracker');
     }
     if (defined('ESSB3_AFTERSHARE_ACTIVE')) {
         $essb_asc = ESSBAfterCloseShare3::get_instance();
         foreach ($essb_asc->resource_files as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         foreach ($essb_asc->js_code as $key => $code) {
             $this->essb_resource_builder->add_js($code, false, 'essbasc_custom' . $key);
         }
         foreach ($essb_asc->social_apis as $key => $code) {
             $this->essb_resource_builder->add_social_api($key);
         }
     }
     if (defined('ESSB3_LOVEYOU_ACTIVE')) {
         $essb_loveyou = ESSBNetworks_LoveThis::get_instance();
         $this->essb_resource_builder->add_js($essb_loveyou->generate_js_code(), true, 'essb-loveyou-code');
     }
     if (defined('ESSB3_IMAGESHARE_ACTIVE')) {
         ESSBSocialImageShare::get_instance();
         $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_imageshare_customizer(), 'essb-imageshare-customizer', 'footer');
     }
     if (defined('ESSB3_SOCIALPROFILES_ACTIVE')) {
         ESSBSocialProfiles::get_instance();
         $this->essb_resource_builder->add_static_resource(ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css', 'easy-social-share-buttons-profles', 'css');
     }
     if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
         ESSBSocialFansCounter::get_instance();
         $this->essb_resource_builder->add_css(ESSBResourceBuilderSnippets::css_build_fanscounter_customizer(), 'essb-fanscounter-customizer', 'footer');
     }
     if (defined('ESSB3_NATIVE_ACTIVE')) {
         // Social Privacy Buttons when active include resources
         $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance();
         ESSBNativeButtonsHelper::$essb_spb = $essb_spb;
         foreach ($essb_spb->resource_files as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) {
             $this->essb_resource_builder->add_static_resource($object["file"], $object["key"], $object["type"]);
         }
         $this->essb_resource_builder->add_css(ESSBSkinnedNativeButtons::generate_skinned_custom_css(), 'essb-skinned-native-buttons');
         // asign instance of native buttons privacy class to helper
         // register active social network apis
         foreach (ESSBNativeButtonsHelper::get_list_of_social_apis() as $key => $code) {
             $this->essb_resource_builder->add_social_api($key);
         }
     }
     if (is_admin()) {
         include_once ESSB3_PLUGIN_ROOT . 'lib/admin/essb-admin-includes.php';
         ESSBAdminControler::get_instance();
         $exist_user_purchase_code = ESSBOptionValuesHelper::options_value($essb_options, 'purchase_code');
         if (!empty($exist_user_purchase_code) || defined('ESSB3_THEME_INTEGRATED')) {
             include ESSB3_PLUGIN_ROOT . 'lib/external/autoupdate/plugin-update-checker.php';
             // @since 1.3.3
             // autoupdate
             // activating autoupdate option
             $essb_autoupdate = PucFactory::buildUpdateChecker('http://update.creoworx.com/essb3/', __FILE__, 'easy-social-share-buttons3');
             // @since 1.3.7.2 - update to avoid issues with other plugins that uses same
             // method
             function addSecretKeyESSB3($query)
             {
                 global $exist_user_purchase_code;
                 $query['license'] = $exist_user_purchase_code;
                 return $query;
             }
             $essb_autoupdate->addQueryArgFilter('addSecretKeyESSB3');
         }
     }
 }
 public 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('&', '&amp;', $share['full_url']);
                 $share['url'] = str_replace('&', '&amp;', $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('&', '&amp;', $share['twitter_tweet']);
                 $share['title'] = str_replace('&', '&amp;', $share['title']);
                 $share['description'] = str_replace('&', '&amp;', $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 . '&amp;display=popup&amp;name=' . $share['title'] . '&amp;link=' . $share['url'] . '&amp;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('&amp;related=%1$s&amp;via=%1$s', $share['twitter_user']) : "";
             $twitter_pass_hastags = $share['twitter_hashtags'] != '' ? sprintf('&amp;hashtags=%1$s', $share['twitter_hashtags']) : '';
             $url = sprintf('https://twitter.com/intent/tweet?text=%1$s&amp;url=%2$s&amp;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&amp;url=%2$s&amp;title=%3$s&amp;description=%4$s', $pin_image, $share['url'], $share['title'], $pinterest_description);
             break;
         case "pinterest_picker":
             $url = "#";
             $api_command = "essb_pinterest_picker(&#39;" . $salt . "&#39;); return false;";
             break;
         case "linkedin":
             $url = sprintf('http://www.linkedin.com/shareArticle?mini=true&amp;ro=true&amp;trk=EasySocialShareButtons&amp;title=%1$s&amp;url=%2$s', $share['title'], $share['url']);
             break;
         case "digg":
             $url = sprintf('http://digg.com/submit?phase=2%20&amp;url=%1$s&amp;title=%2$s', $share['url'], $share['title']);
             break;
         case "reddit":
             $url = sprintf('http://reddit.com/submit?url=%1$s&amp;title=%2$s', $share['url'], $share['title']);
             break;
         case "del":
             $url = sprintf('https://delicious.com/save?v=5&noui&jump=close&url=%1$s&amp;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(&#39;" . $salt . "&#39;); 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(&#39;" . $salt . "&#39;); 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&amp;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 . "(&#39;" . $salt . "&#39;); return false;";
             break;
         case "more":
             $url = "#";
             $api_command = "essb_toggle_more(&#39;" . $salt . "&#39;); return false;";
             break;
         case "less":
             $url = "#";
             $api_command = "essb_toggle_less(&#39;" . $salt . "&#39;); return false;";
             break;
         case "more_popup":
             $url = "#";
             $api_command = "essb_toggle_more_popup(&#39;" . $salt . "&#39;); 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&amp;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(&#39;%1$s&#39;,&#39;%2$s&#39;,&#39;%3$s&#39;); return false;', $url, $network, $salt);
         if ($network == "twitter") {
             $url = "#";
         }
     }
     if ($share['essb_encode_url']) {
         $url = str_replace('&', '&amp;', $url);
         //print $url;
     }
     return array("url" => $url, 'api_command' => $api_command);
 }
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;
$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;
}
 public function adminMenuSetup()
 {
     global $essb_options;
     // Add Social Metrics Tracker menu
     $visibility = ESSBOptionValuesHelper::options_value($essb_options, 'esml_access', 'manage_options');
     add_menu_page('Easy Social Metrics Lite', 'Easy Social Metrics Lite', $visibility, 'easy-social-metrics-lite', array($this, 'render_view'), 'dashicons-chart-bar');
     //new SocialMetricsTrackerWidget();
 }
function essb3_esml_post_type_select()
{
    global $essb_admin_options, $wp_post_types;
    $pts = get_post_types(array('show_ui' => true, '_builtin' => true));
    $cpts = get_post_types(array('show_ui' => true, '_builtin' => false));
    $current_posttypes = array();
    if (is_array($essb_admin_options)) {
        $current_posttypes = ESSBOptionValuesHelper::options_value($essb_admin_options, 'esml_monitor_types', array());
    }
    if (!is_array($current_posttypes)) {
        $current_posttypes = array();
    }
    echo '<ul>';
    foreach ($pts as $pt) {
        $selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : '';
        printf('<li><input type="checkbox" name="essb_options[esml_monitor_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label);
    }
    foreach ($cpts as $pt) {
        $selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : '';
        printf('<li><input type="checkbox" name="essb_options[esml_monitor_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label);
    }
    echo '</ul>';
}
 public function popupWindowGenerate($html, $type = '', $force_width = '')
 {
     $popup_width = ESSBOptionValuesHelper::options_value($this->options, 'afterclose_popup_width', '400');
     if (trim($popup_width) == '') {
         $popup_width = '400';
     }
     if ($force_width != '') {
         $popup_width = $force_width;
     }
     if ($type != '') {
         $type = ' essbasc-popup-' . $type;
     }
     echo '<div class="essbasc-popup' . $type . '" data-popup-width="' . $popup_width . '">';
     echo '<a href="#" class="essbasc-popup-close" onclick="essbasc_popup_close(); return false;"></a>';
     echo '<div class="essbasc-popup-content">';
     echo $html;
     echo '</div>';
     echo '</div>';
     echo '<div class="essbasc-popup-shadow" onclick="essbasc_popup_close();"></div>';
     echo '<script type="text/javascript">';
     echo 'var essbasc_cookie_live = ' . $this->single_display_cookie_length . ';';
     echo '</script>';
 }
Ejemplo n.º 23
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;
 }
$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');
    ESSBDynamicCache::activate($cache_mode);
}
if (ESSBOptionValuesHelper::is_active_module('precompiled')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-precompiled.php';
    ESSBPrecompiledResources::activate();
}
if (ESSBOptionValuesHelper::is_active_module('cachestatic')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-static-cache.php';
}
// dynamic resource builder
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-resource-builder.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-resource-builder-snippets.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/external/mobile-detect/mobile-detect.php';
// include social network related plugin classes
if (ESSBOptionValuesHelper::is_active_module('loveyou')) {
 public static function update_counters($post_id, $url, $full_url, $networks = array(), $recover_mode = false)
 {
     global $essb_options;
     $twitter_counter = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_counters');
     if ($twitter_counter == "") {
         $twitter_counter = "api";
     }
     $cached_counters = array();
     $cached_counters['total'] = 0;
     foreach ($networks as $k) {
         switch ($k) {
             case "facebook":
                 $cached_counters[$k] = ESSBCountersHelper::get_facebook_count($url);
                 break;
             case "twitter":
                 if ($twitter_counter == "api") {
                     $cached_counters[$k] = ESSBCountersHelper::get_tweets($full_url);
                 } else {
                     if ($twitter_counter == "newsc") {
                         $cached_counters[$k] = ESSBCountersHelper::get_tweets_newsc($full_url);
                     } else {
                         if ($twitter_counter == "self") {
                             if (!$recover_mode) {
                                 $cached_counters[$k] = ESSBCountersHelper::getSelfPostCount($post_id, $k);
                             } else {
                                 $cached_counters[$k] = 0;
                             }
                         }
                     }
                 }
                 break;
             case "linkedin":
                 $cached_counters[$k] = ESSBCountersHelper::get_linkedin($url);
                 break;
             case "pinterest":
                 $cached_counters[$k] = ESSBCountersHelper::get_pinterest($url);
                 break;
             case "google":
                 $cached_counters[$k] = ESSBCountersHelper::getGplusShares($url);
                 break;
             case "stumbleupon":
                 $cached_counters[$k] = ESSBCountersHelper::get_stumbleupon($url);
                 break;
             case "vk":
                 $cached_counters[$k] = ESSBCountersHelper::get_counter_number__vk($url);
                 break;
             case "reddit":
                 $cached_counters[$k] = ESSBCountersHelper::getRedditScore($url);
                 break;
             case "buffer":
                 $cached_counters[$k] = ESSBCountersHelper::get_buffer($url);
                 break;
             case "love":
                 if (!$recover_mode) {
                     $cached_counters[$k] = ESSBCountersHelper::getLoveCount($post_id);
                 } else {
                     $cached_counters[$k] = 0;
                 }
                 break;
             case "ok":
                 $cached_counters[$k] = ESSBCountersHelper::get_counter_number_odnoklassniki($url);
                 break;
             case "mwp":
                 $cached_counters[$k] = ESSBCountersHelper::getManagedWPUpVote($url);
                 break;
             case "xing":
                 $cached_counters[$k] = ESSBCountersHelper::getXingCount($url);
                 break;
             case "pocket":
                 $cached_counters[$k] = ESSBCountersHelper::getPocketCount($url);
                 break;
             case "comments":
                 if (!$recover_mode) {
                     $cached_counters[$k] = ESSBCountersHelper::get_comments_count($post_id);
                 } else {
                     $cached_counters[$k] = 0;
                 }
                 break;
             case "yummly":
                 $cached_counters[$k] = ESSBCountersHelper::get_yummly($url);
                 break;
             default:
                 if (!$recover_mode) {
                     $cached_counters[$k] = ESSBCountersHelper::getSelfPostCount($post_id, $k);
                 } else {
                     $cached_counters[$k] = 0;
                 }
                 break;
         }
         $cached_counters['total'] += intval($cached_counters[$k]);
     }
     if (!$recover_mode) {
         $time = floor(date('U') / 60 / 60);
         update_post_meta($post_id, 'essb_cache_timestamp', $time);
     }
     return $cached_counters;
 }
Ejemplo n.º 26
0
 function essb_shortcode_share_popup($atts)
 {
     $shortcode_options = array();
     if (is_array($atts)) {
         $flyin_title = ESSBOptionValuesHelper::options_value($atts, 'popup_title');
         $flyin_message = ESSBOptionValuesHelper::options_value($atts, 'popup_message');
         $flyin_percent = ESSBOptionValuesHelper::options_value($atts, 'popup_percent');
         $flyin_end = ESSBOptionValuesHelper::options_value($atts, 'popup_end');
         foreach ($atts as $key => $value) {
             if ($key != 'popup_title' && $key != 'popup_message' && $key != 'popup_percent' && $key != 'popup_end') {
                 $shortcode_options[$key] = $value;
             }
         }
         $shortcode_options['extended_popup_title'] = $flyin_title;
         $shortcode_options['extended_popup_message'] = $flyin_message;
         $shortcode_options['extended_popup_percent'] = $flyin_percent;
         $shortcode_options['extended_popup_end'] = $flyin_end;
     }
     $shortcode_options['popup'] = "yes";
     return $this->essb_shortcode_share($shortcode_options);
 }
Ejemplo n.º 27
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 />";
    //}
}
Ejemplo n.º 28
0
function essb_register_settings_metabox_onoff()
{
    global $post, $essb_options;
    if (isset($_GET['action'])) {
        $custom = get_post_custom($post->ID);
        $essb_off = isset($custom["essb_off"]) ? $custom["essb_off"][0] : "false";
        $essb_pc_twitter = isset($custom["essb_pc_twitter"]) ? $custom["essb_pc_twitter"][0] : "";
        $twitter_counters = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_counters');
        ESSBMetaboxInterface::draw_form_start('essb_global_metabox');
        ESSBMetaboxOptionsFramework::draw_section_start();
        ESSBMetaboxOptionsFramework::draw_options_row_start(__('Turn off Easy Social Share Buttons', ESSB3_TEXT_DOMAIN), __('Turn off automatic button display for that post/page of social share buttons', ESSB3_TEXT_DOMAIN), '', '2', false);
        ESSBMetaboxOptionsFramework::draw_options_row_end();
        ESSBMetaboxOptionsFramework::draw_options_row_start('', '', '', '2', false);
        ESSBMetaboxOptionsFramework::draw_switch_field('essb_off', 'essb_metabox', $essb_off, __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN));
        ESSBMetaboxOptionsFramework::draw_options_row_end();
        if ($twitter_counters == "self") {
            ESSBMetaboxOptionsFramework::draw_options_row_start(__('Twitter Internal Share Counter', ESSB3_TEXT_DOMAIN), __('Customize value of Twitter internal share counter', ESSB3_TEXT_DOMAIN), '', '2', false);
            ESSBMetaboxOptionsFramework::draw_options_row_end();
            ESSBMetaboxOptionsFramework::draw_options_row_start('', '', '', '2', false);
            ESSBMetaboxOptionsFramework::draw_input_field('essb_pc_twitter', true, 'essb_metabox', $essb_pc_twitter);
            ESSBMetaboxOptionsFramework::draw_options_row_end();
        }
        ESSBMetaboxOptionsFramework::draw_section_end();
        ESSBMetaboxInterface::draw_form_end();
    }
}
    public static function js_build_generate_bottombar_reveal_code()
    {
        global $essb_options;
        $output = '';
        $appear_pos = ESSBOptionValuesHelper::options_value($essb_options, 'bottombar_top_onscroll');
        $bottombar_hide = ESSBOptionValuesHelper::options_value($essb_options, 'bottombar_hide');
        if ($appear_pos != '' || $bottombar_hide != '') {
            $output .= '
			jQuery(document).ready(function($){
	
			$(window).scroll(essb_bottombar_onscroll);
	
			function essb_bottombar_onscroll() {
			var current_pos = $(window).scrollTop();
			var height = $(document).height()-$(window).height();
			var percentage = current_pos/height*100;
	
			var value_appear = "' . $appear_pos . '";
			var value_disappear = "' . $bottombar_hide . '";
			var element;
			if ($(".essb_bottombar").length) {
			element = $(".essb_bottombar");
		}
	
		if (!element || typeof(element) == "undefined") { return; }
	
	
		value_appear = parseInt(value_appear);
		value_disappear = parseInt(value_disappear);
		if (value_appear > 0 ) {
			if (percentage >= value_appear && !element.hasClass("essb_active_bottombar")) {
				element.addClass("essb_active_bottombar");
				return;
			}
			
			if (percentage < value_appear && element.hasClass("essb_active_bottombar")) {
	
				element.removeClass("essb_active_bottombar");
				return;
			}
		}
		if (value_disappear > 0) {
					if (percentage >= value_disappear && !element.hasClass("hidden-float")) {
						element.addClass("hidden-float");
						element.css( {"opacity": "0"});
						return;
					}
					if (percentage < value_disappear && element.hasClass("hidden-float")) {
						element.removeClass("hidden-float");
						element.css( {"opacity": "1"});
						return;
					}
				}
		}
		});
		';
        }
        return $output;
    }
 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;
 }