public function register_front_assets() { if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('fanscounter')) { return; } essb_resource_builder()->add_static_resource(ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/css/essb-followers-counter.min.css', 'essb-social-followers-counter', 'css'); }
public function register_front_assets() { if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('fanscounter')) { return; } wp_enqueue_script('jquery'); wp_register_style('essb-social-fanscounter', ESSB3_PLUGIN_URL . '/lib/modules/social-fans-counter/assets/css/essb-social-fanscounter.css', false, ESSB3_VERSION); //wp_enqueue_script( 'essb-social-fanscounter-script' , ESSB3_PLUGIN_URL . '/lib/modules/social-fans-counter/assets/js/essb-social-fanscounter.js' , false , ESSB3_VERSION ); wp_enqueue_style('essb-social-fanscounter'); //wp_enqueue_script( 'essb-social-fanscounter-script' ); wp_localize_script('essb-social-fanscounter-script', 'essb3fanscounter_object', array('ajaxurl' => admin_url('admin-ajax.php'))); }
function include_social_image_share() { global $essb_options; if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) { return; } $mobile_detect = new ESSB_Mobile_Detect(); if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) { return false; } $current_post_address = ESSBUrlHelper::get_current_page_url(); $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes'); $calling = 'jQuery(document).ready(function(){jQuery("' . $this->get_settings('sis_selector', 'img') . '").essbis({selector:"' . $this->get_settings('sis_selector', 'img') . '",dontshow:"' . $this->get_settings('sis_dontshow') . '",minWidth:' . $this->get_settings('sis_minWidth', '100') . ',minHeight:' . $this->get_settings('sis_minHeight', '100') . ',align:{x:"' . $this->get_settings('sis_align_x', 'left') . '",y:"' . $this->get_settings('sis_align_y', 'top') . '"},offset:{x:' . $this->get_settings('sis_offset_x', '0') . ',y:' . $this->get_settings('sis_offset_y', '0') . '},orientation:"' . $this->get_settings('sis_orientation') . '",style:"' . $this->get_settings('sis_style') . '",sharer:"' . ($this->get_settings('sis_sharer') == 'true' ? $current_post_address : '') . '",is_mobile:' . ($mobile_detect->isMobile() ? 'true' : 'false') . ',always_show:' . $this->get_settings('sis_always_show', 'false') . ',pinterest_alt:' . $this->get_settings('sis_pinterest_alt', 'false') . ',primary_menu: [ ' . $this->get_primary_menu() . '],avoid_class: "' . $this->get_settings('sis_dontaddclass') . '"});});'; essb_resource_builder()->add_js($calling, true, 'essb-onmedia-code'); }
function display_profiles() { global $essb_options, $essb_available_social_profiles; if (ESSBCoreHelper::is_module_deactivate_on('profiles')) { return ""; } $profiles_display_position = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_display_position'); $profiles_button_type = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_type'); $profiles_button_size = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_size'); $profiles_nospace = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_nospace'); $profiles_button_fill = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_button_fill'); $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order'); // @new version 3.0.4 $profiles_allowtext = ESSBOptionValuesHelper::options_bool_value($essb_options, 'profiles_allowtext'); $profiles_width = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_width'); if (!is_array($profiles_order)) { $profiles_order = array(); foreach ($essb_available_social_profiles as $network => $text) { $profiles_order[] = $network; } } $profiles = array(); foreach ($profiles_order as $network) { $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_' . $network); if (!empty($value_address)) { $profiles[$network] = $value_address; } } $profiles_texts = array(); if ($profiles_allowtext) { foreach ($profiles_order as $network) { $value_address = ESSBOptionValuesHelper::options_value($essb_options, 'profile_text_' . $network); if (!empty($value_address)) { $profiles_texts[$network] = $value_address; } } } echo $this->generate_social_profile_icons($profiles, $profiles_button_type, $profiles_button_size, $profiles_button_fill, $profiles_nospace, $profiles_display_position, $profiles_allowtext, $profiles_texts, $profiles_width); }
public static function get_list_of_social_apis() { global $essb_options; $social_apis = array(); if (!defined('ESSB3_NATIVE_ACTIVE')) { return $social_apis; } if (ESSBCoreHelper::is_module_deactivate_on('native')) { return $social_apis; } if (ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button') && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebook_like_button_api')) { if (self::$essb_spb->is_active('facebook')) { $social_apis['facebook'] = "facebook"; } } if (ESSBOptionValuesHelper::options_value($essb_options, 'googleplus') || ESSBOptionValuesHelper::options_bool_value($essb_options, 'youtubesub')) { if (self::$essb_spb->is_active('google') || self::$essb_spb->is_active('youtube')) { $social_apis['google'] = "google"; } } if (ESSBOptionValuesHelper::options_value($essb_options, 'vklike')) { if (self::$essb_spb->is_active('vk')) { $social_apis['vk'] = "vk"; } } if (ESSBOptionValuesHelper::options_value($essb_options, 'twitterfollow')) { if (self::$essb_spb->is_active('twitter')) { $social_apis['twitter'] = "twitter"; } } if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'pinterestfollow')) { if (self::$essb_spb->is_active('pinterest')) { $social_apis['pinterest'] = "pinterest"; } } return $social_apis; }
function essb_ctt_scripts() { if (!ESSBCoreHelper::is_plugin_deactivated_on() && !ESSBCoreHelper::is_module_deactivate_on('ctt')) { wp_register_style('essb-cct-style', plugins_url('assets/css/styles.css', __FILE__), false, ESSB3_VERSION, 'all'); wp_enqueue_style('essb-cct-style'); } }
function generate_custom_footer_js() { global $post; if ($this->is_plugin_deactivated_on()) { return; } $cache_slug = "essb-js-footer"; if (count($this->js_social_apis) > 0) { if (!ESSBCoreHelper::is_module_deactivate_on('native')) { foreach ($this->js_social_apis as $network => $loaded) { $this->load_social_api_code($network); } } } // load of static scripts async or deferred if (count($this->js_static) > 0) { if ($this->js_defer || $this->js_async) { $js_code_patterns = array(); $load_mode = $this->js_async ? "po.async=true;" : "po.defer=true;"; foreach ($this->js_static as $key => $file) { $js_code_patterns[] = sprintf(' (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s; po.src = \'%1$s\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })();', $file, $load_mode); } printf('<script type="text/javascript">%1$s</script>', implode(" ", $js_code_patterns)); } else { if ($this->js_delayed) { // delayed script loading $js_code_patterns = array(); $load_mode = "po.async=true;"; foreach ($this->js_static as $key => $file) { $js_code_patterns[] = sprintf(' (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s; po.src = \'%1$s\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })();', $file, $load_mode); } printf('<script type="text/javascript">jQuery( document ).ready(function() { setTimeout(function() { %1$s }, 2000); });</script>', implode(" ", $js_code_patterns)); } } } if (count($this->js_static_footer)) { if ($this->js_defer || $this->js_async) { $js_code_patterns = array(); $load_mode = $this->js_async ? "po.async=true;" : "po.defer=true;"; foreach ($this->js_static_footer as $key => $file) { $js_code_patterns[] = sprintf(' (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s; po.src = \'%1$s\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })();', $file, $load_mode); } printf('<script type="text/javascript">%1$s</script>', implode(" ", $js_code_patterns)); } else { if ($this->js_delayed) { // delayed script loading $js_code_patterns = array(); $load_mode = "po.async=true;"; foreach ($this->js_static_footer as $key => $file) { $js_code_patterns[] = sprintf(' (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; %2$s; po.src = \'%1$s\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })();', $file, $load_mode); } printf('<script type="text/javascript">jQuery( document ).ready(function() { setTimeout(function() { %1$s }, 2000); });</script>', implode(" ", $js_code_patterns)); } else { foreach ($this->js_static_footer as $key => $file) { //wp_enqueue_script ( $key, $file, array ( 'jquery' ), $this->resource_version, false ); $this->manual_script_load($key, $file); } } } } if (count($this->js_static_noasync_footer)) { foreach ($this->js_static_noasync_footer as $key => $file) { //wp_enqueue_script ( $key, $file, array ( 'jquery' ), $this->resource_version, true ); $this->manual_script_load($key, $file); } } if (count($this->js_code_noncachable)) { // load non cachable javascript code echo implode(" ", $this->js_code_noncachable); } // dynamic footer javascript that can be cached $cache_slug = "essb-js-footer"; if (isset($post)) { if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) { $cache_key = $cache_slug . $post->ID; $cached_data = ESSBDynamicCache::get_resource($cache_key, 'js'); if ($cached_data != '') { echo "<script type='text/javascript' src='" . $cached_data . "' defer></script>"; return; } } } //$js_code = implode(" ", $this->js_code); $js_code = ''; foreach ($this->js_code as $single) { $js_code .= $single; } if (isset($post)) { if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) { $cache_key = $cache_slug . $post->ID; ESSBDynamicCache::put_resource($cache_key, $js_code, 'js'); $cached_data = ESSBDynamicCache::get_resource($cache_key, 'js'); if ($cached_data != '') { echo "<script type='text/javascript' src='" . $cached_data . "' defer></script>"; return; } } } echo '<script type="text/javascript">'; echo $js_code; echo '</script>'; }
public function widget($args, $instance) { global $essb_available_social_profiles, $essb_options; if (ESSBCoreHelper::is_module_deactivate_on('profiles')) { return ""; } extract($args); $before_widget = $args['before_widget']; $before_title = $args['before_title']; $after_title = $args['after_title']; $after_widget = $args['after_widget']; $show_title = $instance['show_title']; $title = $instance['title']; $sc_button_type = isset($instance['type']) ? $instance['type'] : 'square'; $sc_button_size = isset($instance['size']) ? $instance['size'] : 'small'; $sc_button_fill = isset($instance['style']) ? $instance['style'] : 'fill'; $sc_nospace = $instance['nospace']; if (!empty($sc_nospace) && $sc_nospace != '0') { $sc_nospace = "true"; } else { $sc_nospace = "false"; } $sc_nospace = ESSBOptionValuesHelper::unified_true($sc_nospace); $sc_allowtext = isset($instance['allowtext']) ? $instance['allowtext'] : '0'; if (!empty($sc_allowtext) && $sc_allowtext != '0') { $sc_allowtext = "true"; } else { $sc_allowtext = "false"; } $sc_allowtext = ESSBOptionValuesHelper::unified_true($sc_allowtext); $sc_width = isset($instance['width']) ? $instance['width'] : ''; $profile_networks = array(); $profile_networks = ESSBOptionValuesHelper::advanced_array_to_simple_array($essb_available_social_profiles); $profiles_order = ESSBOptionValuesHelper::options_value($essb_options, 'profiles_order'); if (is_array($profiles_order)) { $profile_networks = $profiles_order; } $sc_network_address = array(); foreach ($profile_networks as $network) { $value = $instance['profile_' . $network]; if (!empty($value)) { $sc_network_address[$network] = $value; } } $sc_network_texts = array(); foreach ($profile_networks as $network) { $value = $instance['profile_text_' . $network]; if (!empty($value)) { $sc_network_texts[$network] = $value; } } if (!empty($show_title)) { echo $before_widget . $before_title . $title . $after_title; } // if module is not activated include the code if (!defined('ESSB3_SOCIALPROFILES_ACTIVE')) { include_once ESSB3_PLUGIN_ROOT . 'lib/modules/social-profiles/essb-social-profiles.php'; define('ESSB3_SOCIALPROFILES_ACTIVE', 'true'); $resource_builder = ESSBResourceBuilder::get_instance(); $template_url = ESSB3_PLUGIN_URL . '/assets/css/essb-profiles.css'; $resource_builder->add_static_footer_css($template_url, 'easy-social-share-buttons-profiles'); } echo ESSBSocialProfiles::generate_social_profile_icons($sc_network_address, $sc_button_type, $sc_button_size, $sc_button_fill, $sc_nospace, '', $sc_allowtext, $sc_network_texts, $sc_width); if (!empty($show_title)) { echo $after_widget; } }
/** * get_native_button_settings * * Generate native button visual & share settings * * @param string $position * @param bool $only_share * @return array */ function get_native_button_settings($position = '', $only_share = false) { global $essb_options; $are_active = true; if ($only_share) { $are_active = false; return array("active" => false); } if (!defined('ESSB3_NATIVE_ACTIVE')) { $are_active = false; } else { if (!ESSB3_NATIVE_ACTIVE) { $are_active = false; } } if (defined('ESSB3_NATIVE_DEACTIVE')) { $are_active = false; } if (essb_is_mobile()) { if (!ESSBOptionValuesHelper::options_bool_value($this->options, 'allow_native_mobile')) { $are_active = false; } } if (!empty($position)) { if (ESSBOptionValuesHelper::options_bool_value($this->options, $position . '_native_deactivate')) { $are_active = false; } } if (ESSBCoreHelper::is_module_deactivate_on('native')) { $are_active = false; } if (!$are_active) { return array("active" => false); } $native_options = ESSBNativeButtonsHelper::native_button_defaults(); $native_options['active'] = $are_active; $native_options['message_like_buttons'] = ""; $deactivate_message_for_location = ESSBOptionValuesHelper::options_bool_value($essb_options, $position . '_text_deactivate'); if (!$deactivate_message_for_location) { $native_options['message_like_buttons'] = $this->button_style['message_like_buttons']; } return $native_options; }
function essb_ctt_scripts() { if (!ESSBCoreHelper::is_plugin_deactivated_on() && !ESSBCoreHelper::is_module_deactivate_on('ctt')) { //wp_register_style ( 'essb-cct-style', plugins_url ( 'assets/css/styles.css', __FILE__ ), false, ESSB3_VERSION, 'all' ); //$resource_builder = ESSBResourceBuilder::get_instance(); essb_resource_builder()->add_static_resource(plugins_url('assets/css/styles.css', __FILE__), 'essb-cct-style', 'css'); //wp_enqueue_style ( 'essb-cct-style' ); } }
function include_social_image_share() { global $essb_options; if (ESSBCoreHelper::is_plugin_deactivated_on() || ESSBCoreHelper::is_module_deactivate_on('sis')) { return; } $mobile_detect = new ESSB_Mobile_Detect(); if ($mobile_detect->isMobile() && !ESSBOptionValuesHelper::options_bool_value($essb_options, 'sis_on_mobile')) { return false; } $current_post_address = ESSBUrlHelper::get_current_page_url(); $current_post_address = ESSBUrlHelper::attach_tracking_code($current_post_address, 'essb-image-share=yes'); ?> <script> <?php echo $calling = $this->get_settings('sis_always_show') === 'true' ? 'jQuery(window).load(function(){' : 'jQuery(document).ready(function(){'; ?> jQuery('<?php echo $this->get_settings('sis_selector', 'img'); ?> ').socialImageShare({ selector: "<?php echo $this->get_settings('sis_selector', 'img'); ?> ", dontshow: "<?php echo $this->get_settings('sis_dontshow'); ?> ", title: "<?php echo $this->get_settings('sis_title'); ?> ", summary: "<?php echo $this->get_settings('sis_summary'); ?> ", minWidth: <?php echo $this->get_settings('sis_minWidth', '100'); ?> , minHeight: <?php echo $this->get_settings('sis_minHeight', '100'); ?> , fb_app: "<?php echo $this->get_settings('sis_fb_app'); ?> ", scroll: <?php echo $this->get_settings('sis_scroll', 'false', true); ?> , align: { x: "<?php echo $this->get_settings('sis_align_x', 'left'); ?> ", y: "<?php echo $this->get_settings('sis_align_y', 'top'); ?> " }, offset: { x: <?php echo $this->get_settings('sis_offset_x', '0'); ?> , y: <?php echo $this->get_settings('sis_offset_y', '0'); ?> }, orientation: "<?php echo $this->get_settings('sis_orientation'); ?> ", style: '<?php echo $this->get_settings('sis_style'); ?> ', sharer: "<?php echo $sharer = $this->get_settings('sis_sharer') == 'true' ? $current_post_address : ''; ?> ", is_mobile: <?php echo $is_mobile = $mobile_detect->isMobile() ? 'true' : 'false'; ?> , always_show: <?php echo $this->get_settings('sis_always_show', 'false'); ?> , pinterest_alt: <?php echo $this->get_settings('sis_pinterest_alt', 'false'); ?> , primary_menu: [ <?php echo $this->get_primary_menu(); ?> ], }); }); </script> <?php }
public function outputMeta() { global $post; if (ESSBCoreHelper::is_module_deactivate_on('sso')) { return ""; } $cache_key = ""; if (isset($post)) { $cache_key = "essb_ogtags_" . $post->ID; if (defined('ESSB_CACHE_ACTIVE')) { $cached_data = ESSBCache::get($cache_key); if ($cached_data != '') { echo "\r\n"; echo $cached_data; echo "\r\n"; return; } } } $this->loadPostSettings(); // @since 3.3 front page optimization tags $this->loadFrontpageTags(); if ($this->ogtags_active) { $this->buildFacebookMeta(); } if ($this->twitter_cards_active) { $this->buildTwitterMeta(); } if ($this->google_authorship || $this->google_markup) { $this->buildGoogleMeta(); } $output_meta = ""; echo "\r\n"; foreach ($this->meta as $single) { $output_meta .= $single . "\r\n"; } echo $output_meta; echo "\r\n"; if (defined('ESSB_CACHE_ACTIVE')) { if ($cache_key != '') { ESSBCache::put($cache_key, $output_meta); } } }