function include_social_image_share() { global $essb_options; if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) { return; } $mobile_detect = new ESSB_Mobile_Detect(); if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) { return false; } $current_post_address = ESSBUrlHelper::get_current_page_url(); $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes'); $calling = 'jQuery(document).ready(function(){jQuery("' . $this->get_settings('sis_selector', 'img') . '").essbis({selector:"' . $this->get_settings('sis_selector', 'img') . '",dontshow:"' . $this->get_settings('sis_dontshow') . '",minWidth:' . $this->get_settings('sis_minWidth', '100') . ',minHeight:' . $this->get_settings('sis_minHeight', '100') . ',align:{x:"' . $this->get_settings('sis_align_x', 'left') . '",y:"' . $this->get_settings('sis_align_y', 'top') . '"},offset:{x:' . $this->get_settings('sis_offset_x', '0') . ',y:' . $this->get_settings('sis_offset_y', '0') . '},orientation:"' . $this->get_settings('sis_orientation') . '",style:"' . $this->get_settings('sis_style') . '",sharer:"' . ($this->get_settings('sis_sharer') == 'true' ? $current_post_address : '') . '",is_mobile:' . ($mobile_detect->isMobile() ? 'true' : 'false') . ',always_show:' . $this->get_settings('sis_always_show', 'false') . ',pinterest_alt:' . $this->get_settings('sis_pinterest_alt', 'false') . ',primary_menu: [ ' . $this->get_primary_menu() . '],avoid_class: "' . $this->get_settings('sis_dontaddclass') . '"});});'; essb_resource_builder()->add_js($calling, true, 'essb-onmedia-code'); }
function include_social_image_share() { global $essb_options; if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) { return; } $mobile_detect = new ESSB_Mobile_Detect(); if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) { return false; } $current_post_address = ESSBUrlHelper::get_current_page_url(); $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes'); ?> <script> <?php echo $calling = $this->get_settings('sis_always_show') === 'true' ? 'jQuery(window).load(function(){' : 'jQuery(document).ready(function(){'; ?> jQuery('<?php echo $this->get_settings('sis_selector', 'img'); ?> ').socialImageShare({ selector: "<?php echo $this->get_settings('sis_selector', 'img'); ?> ", dontshow: "<?php echo $this->get_settings('sis_dontshow'); ?> ", title: "<?php echo $this->get_settings('sis_title'); ?> ", summary: "<?php echo $this->get_settings('sis_summary'); ?> ", minWidth: <?php echo $this->get_settings('sis_minWidth', '100'); ?> , minHeight: <?php echo $this->get_settings('sis_minHeight', '100'); ?> , fb_app: "<?php echo $this->get_settings('sis_fb_app'); ?> ", scroll: <?php echo $this->get_settings('sis_scroll', 'false', true); ?> , align: { x: "<?php echo $this->get_settings('sis_align_x', 'left'); ?> ", y: "<?php echo $this->get_settings('sis_align_y', 'top'); ?> " }, offset: { x: <?php echo $this->get_settings('sis_offset_x', '0'); ?> , y: <?php echo $this->get_settings('sis_offset_y', '0'); ?> }, orientation: "<?php echo $this->get_settings('sis_orientation'); ?> ", style: '<?php echo $this->get_settings('sis_style'); ?> ', sharer: "<?php echo $sharer = $this->get_settings('sis_sharer') == 'true' ? $current_post_address : ''; ?> ", is_mobile: <?php echo $is_mobile = $mobile_detect->isMobile() ? 'true' : 'false'; ?> , always_show: <?php echo $this->get_settings('sis_always_show', 'false'); ?> , pinterest_alt: <?php echo $this->get_settings('sis_pinterest_alt', 'false'); ?> , primary_menu: [ <?php echo $this->get_primary_menu(); ?> ], }); }); </script> <?php }
function essb_shortcode_total_shares($atts) { global $post; $atts = shortcode_atts(array('message' => '', 'align' => '', 'url' => '', 'share_text' => '', 'fullnumber' => 'no', 'networks' => '', 'inline' => 'no'), $atts); $align = isset($atts['align']) ? $atts['align'] : ''; $message = isset($atts['message']) ? $atts['message'] : ''; $url = isset($atts['url']) ? $atts['url'] : ''; $share_text = isset($atts['share_text']) ? $atts['share_text'] : ''; $fullnumber = isset($atts['fullnumber']) ? $atts['fullnumber'] : 'no'; $networks = isset($atts['networks']) ? $atts['networks'] : 'no'; $inline = isset($atts['inline']) ? $atts['inline'] : 'no'; $data_full_number = "false"; if ($fullnumber == 'yes') { $data_full_number = "true"; } // init global options $options = $this->options; if ($networks != '') { $buttons = $networks; } else { $buttons = implode(',', $this->network_options['networks']); } $css_class_align = ""; $data_url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw'); if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) { $data_url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw'); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) { $data_url = ESSBUrlHelper::get_current_page_url(); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) { $data_url = str_replace("https://", "http://", $data_url); } if ($url != '') { $data_url = $url; } $data_post_id = ""; if (isset($post)) { $data_post_id = $post->ID; } if ($align == "right" || $align == "center") { $css_class_align = $align; } $total_counter_hidden = $this->general_options['total_counter_hidden_till']; // @since 3.3 support for cached counters $cached_counters = array(); $cached_counters_active = false; $cached_total_counter = ''; if (defined('ESSB3_CACHED_COUNTERS')) { $share_options = array('url' => $data_url, 'full_url' => $data_url); $cached_counter_networks = ESSBCachedCounters::prepare_list_of_networks_with_counter(explode(',', $buttons), explode(',', $buttons)); $cached_counters = ESSBCachedCounters::get_counters($data_post_id, $share_options, $cached_counter_networks); $cached_counters_active = true; } else { $use_minifed_js = $this->general_options['use_minified_js'] ? ".min" : ""; $script_url = ESSB3_PLUGIN_URL . '/assets/js/easy-social-share-buttons-total' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'easy-social-share-buttons-total', 'js'); } $css_hide_total_counter = ""; if ($total_counter_hidden != '') { $css_hide_total_counter = ' style="display: none !important;" data-essb-hide-till="' . $total_counter_hidden . '"'; } if ($cached_counters_active) { $cached_total_counter = isset($cached_counters['total']) ? $cached_counters['total'] : '0'; if ($total_counter_hidden != '') { if (intval($cached_total_counter) > intval($total_counter_hidden)) { $css_hide_total_counter = ""; } } $cached_total_counter = ESSBButtonHelper::kilomega($cached_total_counter); } $output = ""; $tag = $inline == 'yes' ? 'span' : 'div'; $output .= '<' . $tag . ' class="essb-total ' . $css_class_align . '" data-network-list="' . $buttons . '" data-url="' . $data_url . '" data-full-number="' . $data_full_number . '" data-post="' . $data_post_id . '" ' . $css_hide_total_counter . '>'; if ($message != '') { $output .= '<' . $tag . ' class="essb-message essb-block">' . $message . '</' . $tag . '>'; } $output .= '<' . $tag . ' class="essb-total-value essb-block">' . $cached_total_counter . '</' . $tag . '>'; if ($share_text != '') { $output .= '<' . $tag . ' class="essb-total-text essb-block">' . $share_text . '</' . $tag . '>'; } $output .= '</' . $tag . '>'; return $output; }
function essb_shortcode_total_shares($atts) { global $post; $atts = shortcode_atts(array('message' => '', 'align' => '', 'url' => '', 'share_text' => '', 'fullnumber' => 'no', 'networks' => ''), $atts); $align = isset($atts['align']) ? $atts['align'] : ''; $message = isset($atts['message']) ? $atts['message'] : ''; $url = isset($atts['url']) ? $atts['url'] : ''; $share_text = isset($atts['share_text']) ? $atts['share_text'] : ''; $fullnumber = isset($atts['fullnumber']) ? $atts['fullnumber'] : 'no'; $networks = isset($atts['networks']) ? $atts['networks'] : 'no'; $data_full_number = "false"; if ($fullnumber == 'yes') { $data_full_number = "true"; } // init global options $options = $this->options; if ($networks != '') { $buttons = $networks; } else { $buttons = implode(',', $this->network_options['networks']); } $css_class_align = ""; $data_url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw'); if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) { $data_url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw'); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) { $data_url = ESSBUrlHelper::get_current_page_url(); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) { $data_url = str_replace("https://", "http://", $data_url); } if ($url != '') { $data_url = $url; } $data_post_id = ""; if (isset($post)) { $data_post_id = $post->ID; } if ($align == "right" || $align == "center") { $css_class_align = $align; } $total_counter_hidden = $this->general_options['total_counter_hidden_till']; $use_minifed_js = $this->general_options['use_minified_js'] ? ".min" : ""; $script_url = ESSB3_PLUGIN_URL . '/assets/js/easy-social-share-buttons-total' . $use_minifed_js . '.js'; $this->resource_builder->add_static_resource_footer($script_url, 'easy-social-share-buttons-total', 'js'); $css_hide_total_counter = ""; if ($total_counter_hidden != '') { $css_hide_total_counter = ' style="display: none !important;" data-essb-hide-till="' . $total_counter_hidden . '"'; } $output = ""; $output .= '<div class="essb-total ' . $css_class_align . '" data-network-list="' . $buttons . '" data-url="' . $data_url . '" data-full-number="' . $data_full_number . '" data-post="' . $data_post_id . '" ' . $css_hide_total_counter . '>'; if ($message != '') { $output .= '<div class="essb-message essb-block">' . $message . '</div>'; } $output .= '<div class="essb-total-value essb-block">0</div>'; if ($share_text != '') { $output .= '<div class="essb-total-text essb-block">' . $share_text . '</div>'; } $output .= '</div>'; return $output; }