public function register_front_assets() { if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('fanscounter')) { return; } essb_resource_builder()->add_static_resource(ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/css/essb-followers-counter.min.css', 'essb-social-followers-counter', 'css'); }
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'); }
/** * * * @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; }
/** * draw_followers * * Display instance of generated followers counter * * @param $options array * @param $draw_title boolean * @since 3.4 */ public static function draw_followers($options, $draw_title = false) { $hide_title = isset($options['hide_title']) ? $options['hide_title'] : 0; if (intval($hide_title) == 1) { $draw_title = false; } $instance_title = isset($options['title']) ? $options['title'] : ''; $instance_new_window = isset($options['new_window']) ? $options['new_window'] : 0; $instance_nofollow = isset($options['nofollow']) ? $options['nofollow'] : 0; $instance_show_total = isset($options['show_total']) ? $options['show_total'] : 0; $instance_total_type = isset($options['total_type']) ? $options['total_type'] : 'button_single'; $instance_columns = isset($options['columns']) ? $options['columns'] : 3; $instance_template = isset($options['template']) ? $options['template'] : 'flat'; $instance_animation = isset($options['animation']) ? $options['animation'] : ''; $instance_bgcolor = isset($options['bgcolor']) ? $options['bgcolor'] : ''; $instance_nospace = isset($options['nospace']) ? $options['nospace'] : 0; // compatibility with previous template slugs if (!empty($instance_template)) { if ($instance_template == "lite") { $instance_template = "light"; } if ($instance_template == "grey-transparent") { $instance_template = "grey"; } if ($instance_template == "color-transparent") { $instance_template = "color"; } } $class_template = !empty($instance_template) ? " essbfc-template-" . $instance_template : ''; $class_animation = !empty($instance_animation) ? " essbfc-icon-" . $instance_animation : ''; $class_columns = !empty($instance_columns) ? " essbfc-col-" . $instance_columns : ''; $class_nospace = intval($instance_nospace) == 1 ? " essbfc-nospace" : ""; $style_bgcolor = !empty($instance_bgcolor) ? ' style="background-color:' . $instance_bgcolor . ';"' : ''; $link_nofollow = intval($instance_nofollow) == 1 ? ' rel="nofollow"' : ''; $link_newwindow = intval($instance_new_window) == 1 ? ' target="_blank"' : ''; // loading animations if (!empty($class_animation)) { essb_resource_builder()->add_static_footer_css(ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/css/hover.css', 'essb-social-followers-counter-animations', 'css'); } // followers main element printf('<div class="essbfc-container%1$s%2$s%3$s%5$s"%4$s>', '', $class_columns, $class_template, $style_bgcolor, $class_nospace); if ($draw_title && !empty($instance_title)) { printf('<h3>%1$s</h3>', $instance_title); } // get current state of followers counter $followers_count = essb_followers_counter()->get_followers(); $display_total = intval($instance_show_total) == 1 ? true : false; $total_followers = 0; if ($display_total) { foreach ($followers_count as $network => $count) { if (intval($count) > 0) { $total_followers += intval($count); } } } if ($display_total && $instance_total_type == "text_before") { printf('<div class="essbfc-totalastext">%1$s %2$s</div>', self::followers_number($total_followers), ESSBSocialFollowersCounterHelper::get_option('total_text')); } echo '<ul>'; foreach (essb_followers_counter()->active_social_networks() as $social) { $social_followers_text = ESSBSocialFollowersCounterHelper::get_option($social . '_text'); $social_followers_counter = isset($followers_count[$social]) ? $followers_count[$social] : 0; $social_display = $social; if ($social_display == "instgram") { $social_display = "instagram"; } printf('<li class="essbfc-%1$s">', $social_display); $follow_url = essb_followers_counter()->create_follow_address($social); if (!empty($follow_url)) { printf('<a href="%1$s"%2$s%3$s>', $follow_url, $link_newwindow, $link_nofollow); } echo '<div class="essbfc-network">'; printf('<i class="essbfc-icon essbfc-icon-%1$s%2$s"></i>', $social_display, $class_animation); printf('<span class="essbfc-followers-count">%1$s</span>', self::followers_number($social_followers_counter)); printf('<span class="essbfc-followers-text">%1$s</span>', $social_followers_text); echo '</div>'; if (!empty($follow_url)) { echo '</a>'; } echo '</li>'; } if ($display_total && $instance_total_type == "button_single") { $social = 'total'; printf('<li class="essbfc-%1$s">', $social); echo '<div class="essbfc-network">'; printf('<i class="essbfc-icon essbfc-icon-%1$s%2$s"></i>', $social, $class_animation); printf('<span class="essbfc-followers-count">%1$s</span>', self::followers_number($total_followers)); printf('<span class="essbfc-followers-text">%1$s</span>', ESSBSocialFollowersCounterHelper::get_option('total_text')); echo '</div>'; echo '</li>'; } echo '</ul>'; if ($display_total && $instance_total_type == "text_after") { printf('<div class="essbfc-totalastext">%1$s %2$s</div>', self::followers_number($total_followers), ESSBSocialFollowersCounterHelper::get_option('total_text')); } echo '</div>'; // followers: end }
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_ctt_scripts() { if (!ESSBCoreHelper::is_plugin_deactivated_on() && !ESSBCoreHelper::is_module_deactivate_on('ctt')) { //wp_register_style ( 'essb-cct-style', plugins_url ( 'assets/css/styles.css', __FILE__ ), false, ESSB3_VERSION, 'all' ); //$resource_builder = ESSBResourceBuilder::get_instance(); essb_resource_builder()->add_static_resource(plugins_url('assets/css/styles.css', __FILE__), 'essb-cct-style', 'css'); //wp_enqueue_style ( 'essb-cct-style' ); } }
public function widget($args, $instance) { global $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'; essb_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; } }