public static function draw_share_buttons($share = array(), $style = array(), $networks = array(), $networks_order = array(), $network_names = array(), $position = '', $salt = '', $like_or_share = 'share', $native_buttons = '') { global $essb_networks, $essb_options; $content = ""; $leading_width_mode_fullwidth = false; $button_width_full_first = ESSBOptionValuesHelper::options_value($style, 'button_width_full_first'); $button_width_full_second = ESSBOptionValuesHelper::options_value($style, 'button_width_full_second'); if (!empty($button_width_full_first) || !empty($button_width_full_second)) { $leading_width_mode_fullwidth = true; } $sigle_counter_hidden_till = ESSBGlobalSettings::$button_counter_hidden_till; //ESSBOptionValuesHelper::options_value($essb_options, 'button_counter_hidden_till'); $mycred_group = ESSBGlobalSettings::$mycred_group; //ESSBOptionValuesHelper::options_value($essb_options, 'mycred_group', 'mycred_default'); $mycred_points = ESSBGlobalSettings::$mycred_points; //ESSBOptionValuesHelper::options_value($essb_options, 'mycred_points', '1'); $more_button_icon = ESSBGlobalSettings::$more_button_icon; //ESSBOptionValuesHelper::options_value($essb_options, 'more_button_icon'); $comments_address = ESSBGlobalSettings::$comments_address; //ESSBOptionValuesHelper::options_value($essb_options, 'comments_address'); if ($comments_address == '') { $comments_address = '#comments'; } $button_follow_state = "nofollow"; //if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'use_rel_me')) { if (ESSBGlobalSettings::$use_rel_me) { $button_follow_state = "me"; } if (isset($style['more_button_icon'])) { $more_button_icon = $style['more_button_icon']; } // since @3.2.4 // encoding of url parts $share['essb_encode_text'] = ESSBGlobalSettings::$essb_encode_text; //ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_encode_text'); $share['essb_encode_url'] = ESSBGlobalSettings::$essb_encode_url; //ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_encode_url'); $share['essb_encode_text_plus'] = ESSBGlobalSettings::$essb_encode_text_plus; //ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_encode_text_plus'); $cached_counters = array(); $cached_counters_active = false; if (defined('ESSB3_CACHED_COUNTERS') && $style['show_counter']) { $cached_counter_networks = ESSBCachedCounters::prepare_list_of_networks_with_counter($networks_order, $networks); $cached_counters = ESSBCachedCounters::get_counters($share['post_id'], $share, $cached_counter_networks); $cached_counters_active = true; } // beginning of share buttons snippet $content .= ESSBButtonHelper::draw_buttons_start($style, $position, $salt, $like_or_share, $share, $cached_counters); $is_active_more_button = false; $is_active_fullwidth = false; if ($style['button_width'] == 'full') { $is_active_fullwidth = true; } $count_displayed = 0; foreach ($networks_order as $single) { // generate single network button if (in_array($single, $networks)) { if ($single == "no") { continue; } $count_displayed++; $url = ''; $api_command = ''; $link_target = "_blank"; $single_share_address = $single; $icon = $single; $cached_code_left = ""; $cached_code_right = ""; $cached_code_insidebefore = ""; $cached_code_insideafter = ""; $cached_code_before = ""; if ($cached_counters_active) { if (isset($cached_counters[$single])) { $single_counter = isset($cached_counters[$single]) ? $cached_counters[$single] : '0'; if ($style['counter_pos'] == "left" || $style['counter_pos'] == "" || $style['counter_pos'] == "leftm" || $style['counter_pos'] == "topm" || $style['counter_pos'] == "top") { $cached_code_left = ESSBButtonHelper::draw_share_counter_code('', $single_counter, $sigle_counter_hidden_till); } if ($style['counter_pos'] == "right" || $style['counter_pos'] == "rightm") { $cached_code_right = ESSBButtonHelper::draw_share_counter_code('_right', $single_counter, $sigle_counter_hidden_till); } if ($style['counter_pos'] == "insidename" || $style['counter_pos'] == "inside" || $style['counter_pos'] == "bottom") { $cached_code_insideafter = ESSBButtonHelper::draw_share_counter_code('_' . $style['counter_pos'], $single_counter, $sigle_counter_hidden_till); } if ($style['counter_pos'] == "insidebeforename") { $cached_code_insidebefore = ESSBButtonHelper::draw_share_counter_code('_' . $style['counter_pos'], $single_counter, $sigle_counter_hidden_till); } if ($style['counter_pos'] == "hidden") { $cached_code_right = ESSBButtonHelper::draw_share_counter_code('_' . $style['counter_pos'], $single_counter, $sigle_counter_hidden_till); } if ($style['counter_pos'] == "topn") { $cached_code_before = ESSBButtonHelper::draw_share_counter_code('_' . $style['counter_pos'], $single_counter, $sigle_counter_hidden_till); } } } // specail network code //if ($single == "print" && ESSBOptionValuesHelper::options_bool_value($essb_options, 'print_use_printfriendly')) { if ($single == "print" && ESSBGlobalSettings::$print_use_printfriendly) { $single_share_address = "print_friendly"; } if ($single == "mail" && $style['mail_function'] == "form") { $single_share_address = "mail_form"; } //if ($single == "pinterest" && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'pinterest_sniff_disable')) { if ($single == "pinterest" && !ESSBGlobalSettings::$pinterest_sniff_disable) { $single_share_address = "pinterest_picker"; } if (!$style['is_mobile']) { //if ($single == "facebook" && ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebookadvanced')) { if ($single == "facebook" && ESSBGlobalSettings::$facebookadvanced) { $fbappid = ESSBGlobalSettings::$facebookadvancedappid; //ESSBOptionValuesHelper::options_value($essb_options, 'facebookadvancedappid'); if ($fbappid != '') { $single_share_address = "facebook_advanced"; } } } if ($single == "more" && $style['more_button_func'] != "1") { $single_share_address = "more_popup"; } if ($single == "more" && $more_button_icon == "dots") { $icon = "more_dots"; } if ($is_active_fullwidth && $count_displayed == 1 && $leading_width_mode_fullwidth) { $icon .= ' essb_item_fw_first'; } if ($is_active_fullwidth && $count_displayed == 2 && $leading_width_mode_fullwidth) { $icon .= ' essb_item_fw_second'; } // get single social network commands $share_details = ESSBButtonHelper::get_share_address($single_share_address, $share, $salt); $url = $share_details['url']; $api_command = $share_details['api_command']; if ($single == "sidebar-close") { $api_command = ""; } if ($single == "comments") { $api_command = ""; $url = $comments_address; $link_target = "_self"; } if ($single_share_address == "mail" || $single_share_address == "line" || $single_share_address == "whatsapp") { $link_target = "_self"; } $hover_text = ESSBOptionValuesHelper::options_value($essb_options, 'hovertext_' . $single); $name = isset($network_names[$single]) ? $network_names[$single] : ''; $noname_class = ""; if ($style['button_style'] == "icon" || $name == "-" || $single == "more") { $noname_class = " essb_noname"; } if ($style['counter_pos'] == "insidehover" && $style['counters']) { $noname_class .= " essb_hideonhover"; } // clean network names when depends on button style or seleceted network if ($style['button_style'] == "icon" || ($style['counter_pos'] == "inside" || $style['counter_pos'] == "bottom") && $style['show_counter'] || $name == "-" || $single == "more") { $name = ""; } $mycred_token = ""; if (defined('ESSB3_MYCRED_ACTIVE')) { $mycred_token = ESSBMyCredIntegration::generate_mycred_datatoken($mycred_group, $mycred_points); } $more_after_class = $is_active_more_button ? " essb_after_more" : ""; if ($single == "sidebar-close") { $more_after_class = ""; } $content .= sprintf('<li class="essb_item essb_link_%8$s nolightbox%2$s"> %12$s<a href="%3$s" title="%4$s" onclick="%5$s" target="%10$s" rel="%11$s" %7$s>%13$s<span class="essb_icon"></span><span class="essb_network_name%9$s">%14$s%6$s%15$s</span></a>%16$s</li>', $single, $more_after_class, $url, $hover_text, $api_command, $name, $mycred_token, $icon, $noname_class, $link_target, $button_follow_state, $cached_code_left, $cached_code_before, $cached_code_insidebefore, $cached_code_insideafter, $cached_code_right); // at the end toggle more button state if ($single == "more") { $is_active_more_button = true; } } } // adding less button when + function of more button is active if ($is_active_more_button && $style['more_button_func'] == "1") { $share_details = ESSBButtonHelper::get_share_address("less", $share, $salt); $url = $share_details['url']; $api_command = $share_details['api_command']; $content .= sprintf('<li class="essb_item essb_link_%1$s nolightbox%2$s"> <a href="%3$s" title="%4$s" onclick="%5$s" target="_blank" rel="nofollow"><span class="essb_icon"></span><span class="essb_network_name">%6$s</span></a></li>', "less", $more_after_class, $url, "", $api_command, ""); } if (is_array($native_buttons)) { if ($native_buttons['active']) { if ($native_buttons['sameline']) { $content .= ESSBNativeButtonsHelper::draw_native_buttons($native_buttons, $native_buttons['order'], $native_buttons['counters'], $native_buttons['sameline'], $native_buttons['skinned']); } } } // end of share buttons snippet $content .= ESSBButtonHelper::draw_buttons_end($style, $position, $salt, $like_or_share, $native_buttons, $cached_counters, $share); return $content; }
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'); } } }
/** * * * @param unknown_type $post * @param unknown_type $global_button_positions * @return multitype:multitype:string boolean multitype:string unknown multitype:string Ambigous <string, boolean> multitype:string multitype:unknown */ public static function get($post, $global_button_positions) { global $essb_options; $essb_post_button_style = get_post_meta($post->ID, 'essb_post_button_style', true); $essb_post_template = get_post_meta($post->ID, 'essb_post_template', true); $essb_post_counters = get_post_meta($post->ID, 'essb_post_counters', true); $essb_post_counter_pos = get_post_meta($post->ID, 'essb_post_counter_pos', true); $essb_post_total_counter_pos = get_post_meta($post->ID, 'essb_post_total_counter_pos', true); $essb_post_animations = get_post_meta($post->ID, 'essb_post_animations', true); $essb_post_optionsbp = get_post_meta($post->ID, 'essb_post_optionsbp', true); $essb_post_content_position = get_post_meta($post->ID, 'essb_post_content_position', true); $essb_post_button_position = array(); foreach (essb_available_button_positions() as $position => $name) { $position_value = get_post_meta($post->ID, 'essb_post_button_position_' . $position, true); if ($position_value != '') { $essb_post_button_position[$position] = $position_value; } } $essb_post_native = get_post_meta($post->ID, 'essb_post_native', true); $essb_post_native_skin = get_post_meta($post->ID, 'essb_post_native_skin', true); // generate array with post modifiers $output_modifier = array(); if (!empty($essb_post_button_style)) { $output_modifier[] = array("type" => "design_options", "param" => "button_style", "value" => $essb_post_button_style); } if (!empty($essb_post_counters)) { $output_modifier[] = array("type" => "button_style", "param" => "show_counter", "value" => ESSBOptionValuesHelper::unified_true($essb_post_counters)); } if (!empty($essb_post_counter_pos)) { $output_modifier[] = array("type" => "button_style", "param" => "counter_pos", "value" => $essb_post_counter_pos); } if (!empty($essb_post_total_counter_pos)) { $output_modifier[] = array("type" => "button_style", "param" => "total_counter_pos", "value" => $essb_post_total_counter_pos); } // native activate or deactivate based on post settings if (!empty($essb_post_native)) { $essb_options['native_active'] = ESSBOptionValuesHelper::unified_true($essb_post_native); if ($essb_options['native_active']) { // manually activate and deactivate native buttons if (!defined('ESSB3_NATIVE_ACTIVE')) { //$resource_builder = ESSBResourceBuilder::get_instance(); include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-skinned-native-button.php'; include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-social-privacy.php'; include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-native-buttons-helper.php'; define('ESSB3_NATIVE_ACTIVE', true); $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance(); ESSBNativeButtonsHelper::$essb_spb = $essb_spb; foreach ($essb_spb->resource_files as $key => $object) { essb_resource_builder()->add_static_resource($object["file"], $object["key"], $object["type"]); } foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) { essb_resource_builder()->add_static_resource($object["file"], $object["key"], $object["type"]); } 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) { essb_resource_builder()->add_social_api($key); } } } else { define('ESSB3_NATIVE_DEACTIVE', true); } } // end native buttons loader if (!empty($essb_post_native_skin)) { $essb_options['skin_native'] = ESSBOptionValuesHelper::unified_true($essb_post_native_skin); } // change active button positions $modified_global_button_position = false; $new_button_positions_set = array(); foreach ($essb_post_button_position as $position => $active) { if (ESSBOptionValuesHelper::unified_true($active)) { $new_button_positions_set[] = $position; $modified_global_button_position = true; } } foreach ($global_button_positions as $settings_position) { if (!isset($essb_post_button_position[$settings_position])) { $new_button_positions_set[] = $settings_position; } } if ($modified_global_button_position) { $output_modifier[] = array("type" => "general_options", "param" => "button_position", "value" => $new_button_positions_set); $output_modifier[] = array("type" => "global", "param" => "modified_locations", "value" => true); } if (!empty($essb_post_template)) { $output_modifier[] = array("type" => "global", "param" => "post_template", "value" => $essb_post_template); } if (!empty($essb_post_animations)) { $output_modifier[] = array("type" => "global", "param" => "post_animations", "value" => $essb_post_animations); } if (!empty($essb_post_content_position)) { $output_modifier[] = array("type" => "general_options", "param" => "content_position", "value" => $essb_post_content_position); } return $output_modifier; }
function essb_shortcode_native($atts) { global $post; $atts = shortcode_atts(array('facebook' => 'false', 'facebook_url' => '', 'facebook_width' => '', 'facebook_skinned_text' => '', 'facebook_skinned_width' => '', 'facebook_follow' => 'false', 'facebook_follow_url' => '', 'facebook_follow_width' => '', 'facebook_follow_skinned_text' => '', 'facebook_follow_skinned_width' => '', 'twitter_follow' => 'false', 'twitter_follow_user' => '', 'twitter_follow_skinned_text' => '', 'twitter_follow_skinned_width' => '', 'twitter_tweet' => 'false', 'twitter_tweet_message' => '', 'twitter_tweet_skinned_text' => '', 'twitter_tweet_skinned_width' => '', 'google' => 'false', 'google_url' => '', 'google_skinned_text' => '', 'google_skinned_width' => '', 'google_follow' => 'false', 'google_follow_url' => '', 'google_follow_skinned_text' => '', 'google_follow_skinned_width' => '', 'vk' => 'false', 'vk_skinned_text' => '', 'vk_skinned_width' => '', 'youtube' => 'false', 'youtube_chanel' => '', 'youtube_skinned_text' => '', 'youtube_skinned_width' => '', 'linkedin' => 'false', 'linkedin_company' => '', 'linkedin_skinned_text' => '', 'linkedin_skinned_width' => '', 'pinterest_pin' => 'false', 'pinterest_pin_skinned_text' => '', 'pinterest_pin_skinned_width' => '', 'pinterest_follow' => 'false', 'pinterest_follow_display' => '', 'pinterest_follow_url' => '', 'pinterest_follow_skinned_text' => '', 'pinterest_follow_skinned_width' => '', 'skinned' => 'false', 'skin' => 'flat', 'message' => '', 'align' => '', 'counters' => 'false', 'hide_mobile' => 'false', 'order' => ''), $atts); $hide_mobile = isset($atts['hide_mobile']) ? $atts['hide_mobile'] : ''; $hide_mobile_state = ESSBOptionValuesHelper::unified_true($hide_mobile); if ($hide_mobile_state && essb_is_mobile()) { return ""; } $order = isset($atts['order']) ? $atts['order'] : ''; // @ since 2.0 order of buttons if ($order == '') { $order = 'facebook,facebook_follow,twitter_follow,twitter_tweet,google,google_follow,vk,youtube,linkedin,pinterest_pin,pinterest_follow'; } $align = isset($atts['align']) ? $atts['align'] : ''; $facebook = isset($atts['facebook']) ? $atts['facebook'] : ''; $facebook_url = isset($atts['facebook_url']) ? $atts['facebook_url'] : ''; $facebook_width = isset($atts['facebook_width']) ? $atts['facebook_width'] : ''; $facebook_skinned_text = isset($atts['facebook_skinned_text']) ? $atts['facebook_skinned_text'] : ''; $facebook_skinned_width = isset($atts['facebook_skinned_width']) ? $atts['facebook_skinned_width'] : ''; $facebook_follow = isset($atts['facebook_follow']) ? $atts['facebook_follow'] : ''; $facebook_follow_url = isset($atts['facebook_follow_url']) ? $atts['facebook_follow_url'] : ''; $facebook_follow_width = isset($atts['facebook_follow_width']) ? $atts['facebook_follow_width'] : ''; $facebook_follow_skinned_text = isset($atts['facebook_follow_skinned_text']) ? $atts['facebook_follow_skinned_text'] : ''; $facebook_follow_skinned_width = isset($atts['facebook_follow_skinned_width']) ? $atts['facebook_follow_skinned_width'] : ''; $twitter_follow = isset($atts['twitter_follow']) ? $atts['twitter_follow'] : ''; $twitter_follow_user = isset($atts['twitter_follow_user']) ? $atts['twitter_follow_user'] : ''; $twitter_follow_skinned_text = isset($atts['twitter_follow_skinned_text']) ? $atts['twitter_follow_skinned_text'] : ''; $twitter_follow_skinned_width = isset($atts['twitter_follow_skinned_width']) ? $atts['twitter_follow_skinned_width'] : ''; $twitter_tweet = isset($atts['twitter_tweet']) ? $atts['twitter_tweet'] : ''; $twitter_tweet_message = isset($atts['twitter_tweet_message']) ? $atts['twitter_tweet_message'] : ''; $twitter_tweet_skinned_text = isset($atts['twitter_tweet_skinned_text']) ? $atts['twitter_tweet_skinned_text'] : ''; $twitter_tweet_skinned_width = isset($atts['twitter_tweet_skinned_width']) ? $atts['twitter_tweet_skinned_width'] : ''; $google = isset($atts['google']) ? $atts['google'] : ''; $google_url = isset($atts['google_url']) ? $atts['google_url'] : ''; $google_skinned_text = isset($atts['google_skinned_text']) ? $atts['google_skinned_text'] : ''; $google_skinned_width = isset($atts['google_skinned_width']) ? $atts['google_skinned_width'] : ''; $google_follow = isset($atts['google_follow']) ? $atts['google_follow'] : ''; $google_follow_url = isset($atts['google_follow_url']) ? $atts['google_follow_url'] : ''; $google_follow_skinned_text = isset($atts['google_follow_skinned_text']) ? $atts['google_follow_skinned_text'] : ''; $google_follow_skinned_width = isset($atts['google_follow_skinned_width']) ? $atts['google_follow_skinned_width'] : ''; $vk = isset($atts['vk']) ? $atts['vk'] : ''; $vk_skinned_text = isset($atts['vk_skinned_text']) ? $atts['vk_skinned_text'] : ''; $vk_skinned_width = isset($atts['vk_skinned_width']) ? $atts['vk_skinned_width'] : ''; $youtube = isset($atts['youtube']) ? $atts['youtube'] : ''; $youtube_chanel = isset($atts['youtube_chanel']) ? $atts['youtube_chanel'] : ''; $youtube_skinned_text = isset($atts['youtube_skinned_text']) ? $atts['youtube_skinned_text'] : ''; $youtube_skinned_width = isset($atts['youtube_skinned_width']) ? $atts['youtube_skinned_width'] : ''; $linkedin = isset($atts['linkedin']) ? $atts['linkedin'] : ''; $linkedin_comapny = isset($atts['linkedin_company']) ? $atts['linkedin_company'] : ''; $linkedin_skinned_text = isset($atts['linkedin_skinned_text']) ? $atts['linkedin_skinned_text'] : ''; $linkedin_skinned_width = isset($atts['linkedin_skinned_width']) ? $atts['linkedin_skinned_width'] : ''; $pinterest_pin = isset($atts['pinterest_pin']) ? $atts['pinterest_pin'] : ''; $pinterest_pin_skinned_text = isset($atts['pinterest_pin_skinned_text']) ? $atts['pinterest_pin_skinned_text'] : ''; $pinterest_pin_skinned_width = isset($atts['pinterest_pin_skinned_width']) ? $atts['pinterest_pin_skinned_width'] : ''; $pinterest_follow = isset($atts['pinterest_follow']) ? $atts['pinterest_follow'] : ''; $pinterest_follow_display = isset($atts['pinterest_follow_display']) ? $atts['pinterest_follow_display'] : ''; $pinterest_follow_url = isset($atts['pinterest_follow_url']) ? $atts['pinterest_follow_url'] : ''; $pinterest_follow_skinned_text = isset($atts['pinterest_follow_skinned_text']) ? $atts['pinterest_follow_skinned_text'] : ''; $pinterest_follow_skinned_width = isset($atts['pinterest_follow_skinned_width']) ? $atts['pinterest_follow_skinned_width'] : ''; $skinned = isset($atts['skinned']) ? $atts['skinned'] : 'false'; $skin = isset($atts['skin']) ? $atts['skin'] : ''; $message = isset($atts['message']) ? $atts['message'] : ''; $counters = isset($atts['counters']) ? $atts['counters'] : 'false'; // init global options $options = $this->options; $native_lang = isset($options['native_social_language']) ? $options['native_social_language'] : "en"; $css_class_align = ""; $css_class_noskin = $skinned != 'true' ? ' essb-noskin' : ''; // register like buttons CSS essb_resource_builder()->add_static_resource_footer(ESSB3_PLUGIN_URL . '/assets/css/essb-social-like-buttons.css', 'essb-social-like-shortcode-css', 'css'); if (!defined('ESSB3_NATIVE_ACTIVE')) { include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-skinned-native-button.php'; include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-social-privacy.php'; include_once ESSB3_PLUGIN_ROOT . 'lib/core/native-buttons/essb-native-buttons-helper.php'; define('ESSB3_NATIVE_ACTIVE', true); $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance(); ESSBNativeButtonsHelper::$essb_spb = $essb_spb; foreach ($essb_spb->resource_files as $key => $object) { essb_resource_builder()->add_static_resource_footer($object["file"], $object["key"], $object["type"]); } foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) { essb_resource_builder()->add_static_resource_footer($object["file"], $object["key"], $object["type"]); } essb_resource_builder()->add_css(ESSBSkinnedNativeButtons::generate_skinned_custom_css(), 'essb-skinned-native-buttons', 'footer'); // asign instance of native buttons privacy class to helper // register active social network apis foreach (ESSBNativeButtonsHelper::get_list_of_social_apis() as $key => $code) { essb_resource_builder()->add_social_api($key); } } $counters_bool = ESSBOptionValuesHelper::unified_true($counters); $skinned_buttons = ESSBOptionValuesHelper::unified_true($skinned); $text = esc_attr(urlencode($post->post_title)); $url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw'); if ($align == "right" || $align == "center") { $css_class_align = $align; } $output = ""; $output .= '<div class="essb-like ' . $css_class_align . '">'; if ($message != '') { $output .= '<div class="essb-message">' . $message . '</div>'; } $networks = preg_split('#[\\s+,\\s+]#', $order); $required_apis = array(); foreach ($networks as $network) { if ($network == "facebook") { if (ESSBOptionValuesHelper::unified_true($facebook)) { if ($facebook_url == "") { $facebook_url = $url; } $native_button_options = array(); $native_button_options['facebook_type'] = 'like'; $native_button_options['facebook_url'] = $facebook_url; $native_button_options['facebook_width'] = $facebook_skinned_width; $native_button_options['facebook_text'] = $facebook_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-facebook essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('facebook', $native_button_options, $counters_bool, $skinned_buttons); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('facebook')) { $required_apis['facebook'] = 'facebook'; } } } if ($network == "facebook_follow") { if (ESSBOptionValuesHelper::unified_true($facebook_follow)) { $native_button_options = array(); $native_button_options['facebook_type'] = 'follow'; $native_button_options['facebook_url'] = $facebook_follow_url; $native_button_options['facebook_width'] = $facebook_follow_skinned_width; $native_button_options['facebook_text'] = $facebook_follow_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-facebook essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('facebook', $native_button_options, $counters_bool, $skinned_buttons); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('facebook')) { $required_apis['facebook'] = 'facebook'; } } } if ($network == "twitter_tweet") { if (ESSBOptionValuesHelper::unified_true($twitter_tweet)) { $native_button_options = array(); $native_button_options['twitter_type'] = 'tweet'; $native_button_options['twitter_user'] = $twitter_follow_user; $native_button_options['twitter_tweet'] = $twitter_tweet_message; $native_button_options['url'] = $url; $native_button_options['twitter_width'] = $twitter_tweet_skinned_width; $native_button_options['twitter_text'] = $twitter_tweet_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-twitter essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('twitter', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_twitter_tweet_button ( $twitter_follow_user, $counters, $native_lang, $twitter_tweet_message, $twitter_tweet_skinned_text, $twitter_tweet_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('twitter')) { $required_apis['twitter'] = 'twitter'; } } } if ($network == "twitter_follow") { if (ESSBOptionValuesHelper::unified_true($twitter_follow)) { $native_button_options = array(); $native_button_options['twitter_type'] = 'follow'; $native_button_options['twitter_user'] = $twitter_follow_user; $native_button_options['twitter_tweet'] = $twitter_tweet_message; $native_button_options['url'] = $url; $native_button_options['twitter_width'] = $twitter_follow_skinned_width; $native_button_options['twitter_text'] = $twitter_follow_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-twitter-follow essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('twitter', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_twitter_follow_button ( $twitter_follow_user, $counters, $native_lang, $twitter_follow_skinned_text, $twitter_follow_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('twitter')) { $required_apis['twitter'] = 'twitter'; } } } if ($network == "google") { if (ESSBOptionValuesHelper::unified_true($google)) { if ($google_url == "") { $google_url = $url; } $native_button_options = array(); $native_button_options['google_type'] = 'plus'; $native_button_options['google_url'] = $google_url; $native_button_options['google_width'] = $google_skinned_width; $native_button_options['google_text'] = $google_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-google essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('google', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_plusone_button ( $google_url, $counters, $native_lang, $google_skinned_text, $google_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('google')) { $required_apis['google'] = 'google'; } } } if ($network == "google_follow") { if (ESSBOptionValuesHelper::unified_true($google_follow)) { $native_button_options = array(); $native_button_options['google_type'] = 'follow'; $native_button_options['google_url'] = $google_follow_url; $native_button_options['google_width'] = $google_follow_skinned_width; $native_button_options['google_text'] = $google_follow_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-google essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('google', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_plusfollow_button ( $google_follow_url, $counters, $native_lang, $google_follow_skinned_text, $google_follow_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('google')) { $required_apis['google'] = 'google'; } } } if ($network == "vk") { if (ESSBOptionValuesHelper::unified_true($vk)) { $native_button_options = array(); $native_button_options['vk_width'] = $google_follow_skinned_width; $native_button_options['vk_text'] = $google_follow_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-vk essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('vk', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_vklike_button ( $url, $counters, $vk_skinned_text, $vk_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('vk')) { $required_apis['vk'] = 'vk'; } } } if ($network == "youtube") { if (ESSBOptionValuesHelper::unified_true($youtube)) { $native_button_options = array(); $native_button_options['youtube_channel'] = $youtube_chanel; $native_button_options['youtube_width'] = $youtube_skinned_width; $native_button_options['youtube_text'] = $youtube_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-youtube essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('youtube', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_youtube_button ( $youtube_chanel, $counters, $youtube_skinned_text, $youtube_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('google')) { $required_apis['google'] = 'google'; } } } if ($network == "pinterest_pin") { if (ESSBOptionValuesHelper::unified_true($pinterest_pin)) { $native_button_options = array(); $native_button_options['pinterest_type'] = 'pin'; $native_button_options['pinterest_url'] = $pinterest_follow_url; $native_button_options['pinterest_text'] = $pinterest_follow_display; $native_button_options['pinterest_width'] = $pinterest_pin_skinned_width; $native_button_options['pinterest_text'] = $pinterest_pin_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-pin essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('pinterest', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_pinterest_follow ( $pinterest_follow_display, $pinterest_follow_url, 'pin', $pinterest_pin_skinned_text, $pinterest_pin_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('pinterest')) { $required_apis['pinterest'] = 'pinterest'; } } } if ($network == "pinterest_follow") { if (ESSBOptionValuesHelper::unified_true($pinterest_follow)) { $native_button_options = array(); $native_button_options['pinterest_type'] = 'follow'; $native_button_options['pinterest_url'] = $pinterest_follow_url; $native_button_options['pinterest_display'] = $pinterest_follow_display; $native_button_options['pinterest_width'] = $pinterest_follow_skinned_width; $native_button_options['pinterest_text'] = $pinterest_follow_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-pin-follow essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('pinterest', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_pinterest_follow ( $pinterest_follow_display, $pinterest_follow_url, 'follow', $pinterest_follow_skinned_text, $pinterest_follow_skinned_width ); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('pinterest')) { $required_apis['pinterest'] = 'pinterest'; } } } if ($network == "linkedin") { if (ESSBOptionValuesHelper::unified_true($linkedin)) { $native_button_options = array(); $native_button_options['linkedin_company'] = $linkedin_comapny; $native_button_options['linkedin_width'] = $linkedin_skinned_width; $native_button_options['linkedin_text'] = $linkedin_skinned_text; $native_button_options['skin'] = $skin; $output .= '<div class="essb-like-linkedin essb-block' . $css_class_noskin . '">'; $output .= ESSBNativeButtonsHelper::draw_single_native_button('linkedin', $native_button_options, $counters_bool, $skinned_buttons); //$output .= $this->print_linkedin_button($linkedin_comapny, $counters, $linkedin_skinned_text, $linkedin_skinned_width); $output .= '</div>'; if (ESSBNativeButtonsHelper::is_active_network('linkedin')) { $required_apis['linkedin'] = 'linkedin'; } } } } foreach ($required_apis as $key => $code) { essb_resource_builder()->add_social_api($key); } $output .= '</div>'; return $output; }
public static function draw_share_buttons($share = array(), $style = array(), $networks = array(), $networks_order = array(), $network_names = array(), $position = '', $salt = '', $like_or_share = 'share', $native_buttons = '') { global $essb_networks, $essb_options; $content = ""; $mycred_group = ESSBOptionValuesHelper::options_value($essb_options, 'mycred_group', 'mycred_default'); $mycred_points = ESSBOptionValuesHelper::options_value($essb_options, 'mycred_points', '1'); $more_button_icon = ESSBOptionValuesHelper::options_value($essb_options, 'more_button_icon'); $comments_address = ESSBOptionValuesHelper::options_value($essb_options, 'comments_address'); if ($comments_address == '') { $comments_address = '#comments'; } $button_follow_state = "nofollow"; if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'use_rel_me')) { $button_follow_state = "me"; } if (isset($style['more_button_icon'])) { $more_button_icon = $style['more_button_icon']; } // since @3.2.4 // encoding of url parts $share['essb_encode_text'] = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_encode_text'); $share['essb_encode_url'] = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_encode_url'); // beginning of share buttons snippet $content .= ESSBButtonHelper::draw_buttons_start($style, $position, $salt, $like_or_share, $share); $is_active_more_button = false; foreach ($networks_order as $single) { // generate single network button if (in_array($single, $networks)) { if ($single == "no") { continue; } $url = ''; $api_command = ''; $link_target = "_blank"; $single_share_address = $single; $icon = $single; // specail network code if ($single == "print" && ESSBOptionValuesHelper::options_bool_value($essb_options, 'print_use_printfriendly')) { $single_share_address = "print_friendly"; } if ($single == "mail" && $style['mail_function'] == "form") { $single_share_address = "mail_form"; } if ($single == "pinterest" && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'pinterest_sniff_disable')) { $single_share_address = "pinterest_picker"; } if (!$style['is_mobile']) { if ($single == "facebook" && ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebookadvanced')) { $fbappid = ESSBOptionValuesHelper::options_value($essb_options, 'facebookadvancedappid'); if ($fbappid != '') { $single_share_address = "facebook_advanced"; } } } if ($single == "more" && $style['more_button_func'] != "1") { $single_share_address = "more_popup"; } if ($single == "more" && $more_button_icon == "dots") { $icon = "more_dots"; } // get single social network commands $share_details = ESSBButtonHelper::get_share_address($single_share_address, $share, $salt); $url = $share_details['url']; $api_command = $share_details['api_command']; if ($single == "sidebar-close") { $api_command = ""; } if ($single == "comments") { $api_command = ""; $url = $comments_address; $link_target = "_self"; } if ($single_share_address == "mail") { $link_target = "_self"; } $hover_text = ESSBOptionValuesHelper::options_value($essb_options, 'hovertext_' . $single); $name = isset($network_names[$single]) ? $network_names[$single] : ''; $noname_class = ""; if ($style['button_style'] == "icon" || $name == "-" || $single == "more") { $noname_class = " essb_noname"; } if ($style['counter_pos'] == "insidehover" && $style['counters']) { $noname_class .= " essb_hideonhover"; } // clean network names when depends on button style or seleceted network if ($style['button_style'] == "icon" || ($style['counter_pos'] == "inside" || $style['counter_pos'] == "bottom") && $style['show_counter'] || $name == "-" || $single == "more") { $name = ""; } $mycred_token = ""; if (defined('ESSB3_MYCRED_ACTIVE')) { $mycred_token = ESSBMyCredIntegration::generate_mycred_datatoken($mycred_group, $mycred_points); } $more_after_class = $is_active_more_button ? " essb_after_more" : ""; if ($single == "sidebar-close") { $more_after_class = ""; } $content .= sprintf('<li class="essb_item essb_link_%8$s nolightbox%2$s"> <a href="%3$s" title="%4$s" onclick="%5$s" target="%10$s" rel="%11$s" %7$s><span class="essb_icon"></span><span class="essb_network_name%9$s">%6$s</span></a></li>', $single, $more_after_class, $url, $hover_text, $api_command, $name, $mycred_token, $icon, $noname_class, $link_target, $button_follow_state); // at the end toggle more button state if ($single == "more") { $is_active_more_button = true; } } } // adding less button when + function of more button is active if ($is_active_more_button && $style['more_button_func'] == "1") { $share_details = ESSBButtonHelper::get_share_address("less", $share, $salt); $url = $share_details['url']; $api_command = $share_details['api_command']; $content .= sprintf('<li class="essb_item essb_link_%1$s nolightbox%2$s"> <a href="%3$s" title="%4$s" onclick="%5$s" target="_blank" rel="nofollow"><span class="essb_icon"></span><span class="essb_network_name">%6$s</span></a></li>', "less", $more_after_class, $url, "", $api_command, ""); } if (is_array($native_buttons)) { if ($native_buttons['active']) { if ($native_buttons['sameline']) { $content .= ESSBNativeButtonsHelper::draw_native_buttons($native_buttons, $native_buttons['order'], $native_buttons['counters'], $native_buttons['sameline'], $native_buttons['skinned']); } } } // end of share buttons snippet $content .= ESSBButtonHelper::draw_buttons_end($style, $position, $salt, $like_or_share, $native_buttons); return $content; }
/** * Initialize plugin load */ public function init() { // activate plugin and resource builder $this->resourceBuilder(); $this->essb(); // Social Share Optimization if (defined('ESSB3_SSO_ACTIVE')) { $this->factoryActivate('sso', 'ESSBSocialShareOptimization'); } // Social Share Analytics if (defined('ESSB3_SSA_ACTIVE')) { $tracker = ESSBSocialShareAnalytics::get_instance(); $this->resourceBuilder()->add_js($this->socialShareAnalytics()->generate_tracker_code(), true, 'essb-stats-tracker'); } // After Share Actions if (defined('ESSB3_AFTERSHARE_ACTIVE')) { foreach ($this->afterShareActions()->resource_files as $key => $object) { $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]); } foreach ($this->afterShareActions()->js_code as $key => $code) { $this->resourceBuilder()->add_js($code, false, 'essbasc_custom' . $key); } foreach ($this->afterShareActions()->social_apis as $key => $code) { $this->resourceBuilder()->add_social_api($key); } } // Love this button if (defined('ESSB3_LOVEYOU_ACTIVE')) { $this->resourceBuilder()->add_js($this->loveThisButton()->generate_js_code(), true, 'essb-loveyou-code'); } // On Media Sharing if (defined('ESSB3_IMAGESHARE_ACTIVE')) { $this->factoryActivate('essbis', 'ESSBSocialImageShare'); $this->resourceBuilder()->add_css(ESSBResourceBuilderSnippets::css_build_imageshare_customizer(), 'essb-imageshare-customizer', 'footer'); } // Social Profiles if (!defined('ESSB3_LIGHTMODE')) { if (defined('ESSB3_SOCIALPROFILES_ACTIVE')) { $this->factoryActivate('essbsp', 'ESSBSocialProfiles'); $this->resourceBuilder()->add_static_resource(ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css', 'easy-social-share-buttons-profles', 'css'); } } // Followers Counter if (defined('ESSB3_SOCIALFANS_ACTIVE')) { $this->factoryActivate('essbfc', 'ESSBSocialFollowersCounter'); $this->resourceBuilder()->add_css(ESSBResourceBuilderSnippets::css_build_followerscounter_customizer(), 'essb-followerscounter-customizer', 'footer'); } if (!defined('ESSB3_LIGHTMODE')) { if (defined('ESSB3_NATIVE_ACTIVE')) { // Social Privacy Buttons when active include resources $essb_spb = ESSBSocialPrivacyNativeButtons::get_instance(); ESSBNativeButtonsHelper::$essb_spb = $essb_spb; foreach ($this->privacyNativeButtons()->resource_files as $key => $object) { $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]); } foreach (ESSBSkinnedNativeButtons::get_assets() as $key => $object) { $this->resourceBuilder()->add_static_resource($object["file"], $object["key"], $object["type"]); } $this->resourceBuilder()->add_css(ESSBSkinnedNativeButtons::generate_skinned_custom_css(), 'essb-skinned-native-buttons'); // asign instance of native buttons privacy class to helper // register active social network apis foreach (ESSBNativeButtonsHelper::get_list_of_social_apis() as $key => $code) { $this->resourceBuilder()->add_social_api($key); } } } if (is_admin()) { $this->asAdmin(); } }