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'); } } }
function generate_custom_css_precompiled() { if ($this->is_plugin_deactivated_on()) { return; } $cache_key = "essb-precompiled"; $cached_data = ESSBPrecompiledResources::get_resource($cache_key, 'css'); if ($cached_data != '') { echo "<link rel='stylesheet' id='essb-compiled-css' href='" . $cached_data . "' type='text/css' media='all' />"; return; } // generation of all styles $this->add_css(ESSBResourceBuilderSnippets::css_build_customizer(), 'essb-customcss-header'); $this->add_css(ESSBResourceBuilderSnippets::css_build_footer_css(), 'essb-footer-css', 'footer'); $static_content = array(); $styles = array(); if (count($this->css_head) > 0) { $css_code = implode(" ", $this->css_head); $css_code = trim(preg_replace('/\\s+/', ' ', $css_code)); $styles[] = $css_code; } if (count($this->css_footer) > 0) { $css_code = implode(" ", $this->css_footer); $css_code = trim(preg_replace('/\\s+/', ' ', $css_code)); $styles[] = $css_code; } // parsing inlinde enqueue styles $current_site_url = get_site_url(); foreach ($this->precompiled_css_queue as $key => $file) { $relative_path = ESSBPrecompiledResources::get_asset_relative_path($current_site_url, $file); $css_code = file_get_contents(ABSPATH . $relative_path); $css_code = trim(preg_replace('/\\s+/', ' ', $css_code)); if ($key == "essb-social-image-share") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/lib/modules/social-image-share/assets/', $css_code); } if ($key == "easy-social-share-buttons-profiles") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/assets/', $css_code); } if ($key == "essb-social-followers-counter") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/', $css_code); } $styles[] = $css_code; $static_content[$key] = $file; } foreach ($this->css_static_footer as $key => $file) { $relative_path = ESSBPrecompiledResources::get_asset_relative_path($current_site_url, $file); $css_code = file_get_contents(ABSPATH . $relative_path); $css_code = trim(preg_replace('/\\s+/', ' ', $css_code)); if ($key == "essb-social-image-share") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/lib/modules/social-image-share/assets/', $css_code); } if ($key == "easy-social-share-buttons-profiles") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/assets/', $css_code); } if ($key == "essb-social-followers-counter") { $css_code = str_replace('../', ESSB3_PLUGIN_URL . '/lib/modules/social-followers-counter/assets/', $css_code); } $styles[] = $css_code; $static_content[$key] = $file; } $toc = array(); foreach ($static_content as $handle => $item_content) { $toc[] = sprintf(' - %s', $handle . '-' . $item_content); } $styles[] = sprintf("\n\n\n/* TOC:\n%s\n*/", implode("\n", $toc)); ESSBPrecompiledResources::put_resource($cache_key, implode(' ', $styles), 'css'); $cached_data = ESSBPrecompiledResources::get_resource($cache_key, 'css'); if ($cached_data != '') { echo "<link rel='stylesheet' id='essb-compiled-css' href='" . $cached_data . "' type='text/css' media='all' />"; return; } }
public static function snippet_start() { self::$snippet_builder = ''; }
function generate_custom_footer_css() { global $post; if ($this->is_plugin_deactivated_on()) { return; } $this->add_css(ESSBResourceBuilderSnippets::css_build_footer_css(), 'essb-footer-css', 'footer'); if (count($this->css_static_footer) > 0) { foreach ($this->css_static_footer as $key => $file) { printf('<link rel="stylesheet" id="%1$s" href="%2$s" type="text/css" media="all" />', $key, $file); } } $cache_slug = "essb-css-footer"; if (isset($post)) { if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) { $cache_key = $cache_slug . $post->ID; $cached_data = ESSBDynamicCache::get_resource($cache_key, 'css'); if ($cached_data != '') { echo "<link rel='stylesheet' id='essb-cache-css-footer' href='" . $cached_data . "' type='text/css' media='all' />"; return; } } } if (count($this->css_footer) > 0) { $css_code = implode(" ", $this->css_footer); $css_code = trim(preg_replace('/\\s+/', ' ', $css_code)); if (isset($post)) { if (defined('ESSB3_CACHE_ACTIVE_RESOURCE')) { $cache_key = $cache_slug . $post->ID; ESSBDynamicCache::put_resource($cache_key, $css_code, 'css'); $cached_data = ESSBDynamicCache::get_resource($cache_key, 'css'); if ($cached_data != '') { echo "<link rel='stylesheet' id='essb-cache-css-footer' href='" . $cached_data . "' type='text/css' media='all' />"; return; } } } echo '<style type="text/css">'; echo $css_code; echo '</style>'; } }
public static function snippet_start() { self::$snippet = array(); }
function essb_shortcode_share($atts) { global $essb_networks; $shortcode_extended_options = array(); $shortcode_custom_display_texts = array(); $exist_personalization = false; foreach ($essb_networks as $key => $data) { $text_key = sprintf('%1$s_text', $key); $value = isset($atts[$text_key]) ? $atts[$text_key] : ''; if (!empty($value)) { $shortcode_custom_display_texts[$key] = $value; $exist_personalization = true; } } // add other names from default settings that are not modified if ($exist_personalization) { foreach ($essb_networks as $key => $object) { $search_for = "user_network_name_" . $key; $user_network_name = ESSBOptionValuesHelper::options_value($this->options, $search_for, $object['name']); if (!isset($shortcode_custom_display_texts[$key])) { $shortcode_custom_display_texts[$key] = $user_network_name; } } } // parsing extended shortcode options if (is_array($atts)) { foreach ($atts as $key => $value) { if (strpos($key, "extended_") !== false) { $key = str_replace("extended_", "", $key); $shortcode_extended_options[$key] = $value; } } } $shortcode_automatic_parse_args = array('counters' => 'number', 'current' => 'number', 'text' => 'text', 'title' => 'text', 'url' => 'text', 'native' => 'bool', 'sidebar' => 'bool', 'popup' => 'bool', 'flyin' => 'bool', 'popafter' => 'text', 'message' => 'bool', 'description' => 'text', 'image' => 'text', 'fblike' => 'text', 'plusone' => 'text', 'style' => 'text', 'hide_names' => 'text', 'hide_icons' => 'text', 'counters_pos' => 'text', 'counter_pos' => 'text', 'sidebar_pos' => 'text', 'nostats' => 'bool', 'hide_total' => 'bool', 'total_counter_pos' => 'text', 'fullwidth' => 'bool', 'fullwidth_fix' => 'text', 'fullwidth_first' => 'text', 'fullwidth_second' => 'text', 'fixedwidth' => 'bool', 'fixedwidth_px' => 'text', 'fixedwidth_align' => 'text', 'float' => 'bool', 'postfloat' => 'bool', 'morebutton' => 'text', 'morebutton_icon' => 'text', 'forceurl' => 'bool', 'videoshare' => 'bool', 'template' => 'text', 'query' => 'bool', 'column' => 'bool', 'columns' => 'text', 'topbar' => 'bool', 'bottombar' => 'bool', 'twitter_user' => 'text', 'twitter_hashtags' => 'text', 'twitter_tweet' => 'text', 'nospace' => 'bool', 'post_float' => 'text', 'fullwidth_align' => 'text', 'mobilebar' => 'bool', 'mobilebuttons' => 'bool', 'mobilepoint' => 'bool', 'heroshare' => 'bool', 'animation' => 'string', 'postviews' => 'string'); $shortcode_options = array('buttons' => '', 'counters' => 0, 'current' => 1, 'text' => '', 'url' => '', 'native' => 'no', 'sidebar' => 'no', 'popup' => 'no', 'flyin' => 'no', 'hide_names' => '', 'popafter' => '', 'message' => 'no', 'description' => '', 'image' => '', 'fblike' => '', 'plusone' => '', 'style' => '', 'counters_pos' => '', 'counter_pos' => '', 'sidebar_pos' => '', 'nostats' => 'no', 'hide_total' => 'no', 'total_counter_pos' => '', 'fullwidth' => 'no', 'fullwidth_fix' => '', 'fullwidth_align' => '', 'fullwidth_first' => '', 'fullwidth_second' => '', 'fixedwidth' => 'no', 'fixedwidth_px' => '', 'fixedwidth_align' => '', 'float' => 'no', 'postfloat' => 'no', 'morebutton' => '', 'forceurl' => 'no', 'videoshare' => 'no', 'template' => '', 'hide_mobile' => 'no', 'only_mobile' => 'no', 'query' => 'no', 'column' => 'no', 'columns' => '5', 'morebutton_icon' => '', 'topbar' => 'no', 'bottombar' => 'no', 'twitter_user' => '', 'twitter_hashtags' => '', 'twitter_tweet' => '', 'nospace' => 'false', 'post_float' => '', 'hide_icons' => '', 'mobilebar' => 'no', 'mobilebuttons' => 'no', 'mobilepoint' => 'no', 'heroshare' => 'no', 'animation' => '', 'postviews' => ''); $atts = shortcode_atts($shortcode_options, $atts); $hide_mobile = isset($atts['hide_mobile']) ? $atts['hide_mobile'] : ''; $hide_mobile = ESSBOptionValuesHelper::unified_true($hide_mobile); $only_mobile = isset($atts['only_mobile']) ? $atts['only_mobile'] : ''; $only_mobile = ESSBOptionValuesHelper::unified_true($only_mobile); if ($hide_mobile && essb_is_mobile()) { return ""; } if ($only_mobile && !essb_is_mobile()) { return ""; } // initialize list of availalbe networks if ($atts['buttons'] == '') { $networks = $this->network_options['networks']; } else { $networks = preg_split('#[\\s+,\\s+]#', $atts['buttons']); } $shortcode_parameters = array(); $shortcode_parameters['networks'] = $networks; $shortcode_parameters['customize_texts'] = $exist_personalization; $shortcode_parameters['network_texts'] = $shortcode_custom_display_texts; foreach ($shortcode_automatic_parse_args as $key => $type) { $value = isset($atts[$key]) ? $atts[$key] : ''; if ($type == "number") { $value = intval($value); } if ($type == "bool") { $value = ESSBOptionValuesHelper::unified_true($value); } // @since 3.0.3 - fixed the default button style when used with shortcode if ($key == "style") { if (empty($value)) { $value = $this->design_options['button_style']; } } $shortcode_parameters[$key] = $value; } if (!empty($shortcode_parameters['post_float'])) { $shortcode_parameters['postfloat'] = ESSBOptionValuesHelper::unified_true($shortcode_parameters['post_float']); } if (!empty($shortcode_parameters['animation'])) { if ($shortcode_parameters['animation'] != 'no') { if (!isset($this->activated_resources['animations'])) { $animate_url = ESSB3_PLUGIN_URL . '/assets/css/essb-animations.min.css'; essb_resource_builder()->add_static_resource_footer($animate_url, 'easy-social-share-buttons-animations', 'css'); } } } // @since 3.0 query handling parameters is set as default in shortcode if ($shortcode_parameters['query']) { $query_url = isset($_REQUEST['url']) ? $_REQUEST['url'] : ''; if (!empty($query_url)) { $shortcode_parameters['url'] = $query_url; $url = $query_url; } $query_text = isset($_REQUEST['post_title']) ? $_REQUEST['post_title'] : ''; if (!empty($query_text)) { $shortcode_parameters['text'] = $query_text; $shortcode_parameters['title'] = $query_text; $text = $query_text; } } if ($shortcode_parameters['counters_pos'] == "" && $shortcode_parameters['counter_pos'] != '') { $shortcode_parameters['counters_pos'] = $shortcode_parameters['counter_pos']; } if ($shortcode_parameters['text'] != '' && $shortcode_parameters['title'] == '') { $shortcode_parameters['title'] = $shortcode_parameters['text']; } if (!empty($shortcode_parameters['hide_names'])) { if ($shortcode_parameters['hide_names'] == "yes") { $shortcode_parameters['style'] = "icon_hover"; } if ($shortcode_parameters['hide_names'] == "no") { $shortcode_parameters['style'] = "button"; } if ($shortcode_parameters['hide_names'] == "force") { $shortcode_parameters['style'] = "icon"; } } if (!empty($shortcode_parameters['hide_icons'])) { if ($shortcode_parameters['hide_icons'] == "yes") { $shortcode_parameters['style'] = "button_name"; } } // shortcode extended options foreach ($shortcode_extended_options as $key => $value) { $shortcode_parameters[$key] = $value; } if ($shortcode_parameters['sidebar']) { if ($shortcode_parameters['sidebar_pos'] == "bottom") { $shortcode_parameters['sidebar'] = false; $shortcode_parameters['bottombar'] = true; } if ($shortcode_parameters['sidebar_pos'] == "top") { $shortcode_parameters['sidebar'] = false; $shortcode_parameters['topbar'] = true; } } $use_minifed_css = $this->general_options['use_minified_css'] ? ".min" : ""; $use_minifed_js = $this->general_options['use_minified_js'] ? ".min" : ""; // load mail resource on access if (in_array('mail', $networks)) { if (!isset($this->activated_resources['mail'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-mailform' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-mailform', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-mailform.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-mailform', 'js', true); $this->activated_resources['mail'] = 'true'; } } if (in_array('print', $networks)) { if (!isset($this->activated_resources['print'])) { if (!ESSBOptionValuesHelper::options_bool_value($this->options, 'print_use_printfriendly')) { essb_resource_builder()->add_js(ESSBResourceBuilderSnippets::js_build_window_print_code(), true, 'essb-printing-code'); $this->activated_resources['print'] = 'true'; } } } if ($shortcode_parameters['counters'] == 1) { if (!isset($this->activated_resources['counters'])) { if (!defined('ESSB3_COUNTER_LOADED') && !defined('ESSB3_CACHED_COUNTERS')) { $script_url = ESSB3_PLUGIN_URL . '/assets/js/easy-social-share-buttons' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'easy-social-share-buttons', 'js'); $this->activated_resources['counters'] = 'true'; define('ESSB3_COUNTER_LOADED', true); } } } $display_as_key = "shortcode"; if ($shortcode_parameters['sidebar']) { $display_as_key = "sidebar"; /*if (!isset($this->activated_resources['sidebar'])) { $style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-sidebar'.$use_minifed_css.'.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-sidebar', 'css'); $this->activated_resources['sidebar'] = 'true'; }*/ if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $this->activated_resources['display_positions_style'] = 'true'; } } if ($shortcode_parameters['popup']) { $display_as_key = "popup"; if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $this->activated_resources['display_positions_style'] = 'true'; } if (!isset($this->activated_resources['popup'])) { //$style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-popup'.$use_minifed_css.'.css'; //essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-popup', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-popup' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-popup', 'js', true); $this->activated_resources['popup'] = 'true'; } } if ($shortcode_parameters['heroshare']) { $display_as_key = "heroshare"; if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $this->activated_resources['display_positions_style'] = 'true'; } if (!isset($this->activated_resources['heroshare'])) { //$style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-heroshare'.$use_minifed_css.'.css'; //essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-heroshare', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-heroshare' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-heroshare', 'js', true); $this->activated_resources['heroshare'] = 'true'; } } if ($shortcode_parameters['flyin']) { $display_as_key = "flyin"; if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $this->activated_resources['display_positions_style'] = 'true'; } if (!isset($this->activated_resources['display_positions_style'])) { //$style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-display-methods'.$use_minifed_css.'.css'; //essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-flyin' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-flyin', 'js'); $this->activated_resources['flyin'] = 'true'; } } if ($shortcode_parameters['postfloat']) { $display_as_key = "postfloat"; if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); $this->activated_resources['display_positions_style'] = 'true'; } if (!isset($this->activated_resources['display_positions_script'])) { $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-display-methods' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-display-methods', 'js'); $this->activated_resources['display_positions_script'] = 'true'; //$style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-sidebar'.$use_minifed_css.'.css'; //essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-sidebar', 'css'); } } if ($shortcode_parameters['float']) { $display_as_key = "float"; /*if (!isset($this->activated_resources['float'])) { $script_url = ESSB3_PLUGIN_URL .'/assets/js/essb-float'.$use_minifed_js.'.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-float', 'js'); $this->activated_resources['float'] = 'true'; }*/ if (!isset($this->activated_resources['display_positions_script'])) { $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-display-methods' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-display-methods', 'js'); $this->activated_resources['display_positions_script'] = 'true'; } } if ($shortcode_parameters['topbar']) { $display_as_key = "topbar"; /*if (!isset($this->activated_resources['topbottombar'])) { $style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-topbottom-bar'.$use_minifed_css.'.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-topbottom-bar', 'css'); $this->activated_resources['topbottombar'] = 'true'; }*/ if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); } } if ($shortcode_parameters['bottombar']) { $display_as_key = "bottombar"; /*if (!isset($this->activated_resources['topbottombar'])) { $style_url = ESSB3_PLUGIN_URL .'/assets/css/essb-topbottom-bar'.$use_minifed_css.'.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-topbottom-bar', 'css'); $this->activated_resources['topbottombar'] = 'true'; }*/ if (!isset($this->activated_resources['display_positions_style'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-display-methods' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-display-methods', 'css'); } } if ($shortcode_parameters['mobilebar'] || $shortcode_parameters['mobilebuttons'] || $shortcode_parameters['mobilepoint']) { if (!essb_is_mobile()) { return ""; } } // @since version 3.0.4 if ($shortcode_parameters['mobilebar']) { $display_as_key = "sharebar"; if (!isset($this->activated_resources['mobile'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-mobile' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-mobile', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-mobile' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-mobile', 'js'); $this->activated_resources['mobile'] = 'true'; } } if ($shortcode_parameters['mobilebuttons']) { $display_as_key = "sharebottom"; if (!isset($this->activated_resources['mobile'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-mobile' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-mobile', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-mobile' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-mobile', 'js'); $this->activated_resources['mobile'] = 'true'; } } if ($shortcode_parameters['mobilepoint']) { $display_as_key = "sharepoint"; if (!isset($this->activated_resources['mobile'])) { $style_url = ESSB3_PLUGIN_URL . '/assets/css/essb-mobile' . $use_minifed_css . '.css'; essb_resource_builder()->add_static_resource_footer($style_url, 'easy-social-share-buttons-mobile', 'css'); $script_url = ESSB3_PLUGIN_URL . '/assets/js/essb-mobile' . $use_minifed_js . '.js'; essb_resource_builder()->add_static_resource_footer($script_url, 'essb-mobile', 'js'); $this->activated_resources['mobile'] = 'true'; } } $special_shortcode_options = array(); //print_r($shortcode_parameters); if (!$shortcode_parameters['native']) { $special_shortcode_options['only_share'] = true; } if ($display_as_key == "sidebar") { return $this->display_sidebar(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "popup") { return $this->display_popup(true, $shortcode_parameters['popafter'], $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "heroshare") { return $this->display_heroshare(true, $shortcode_parameters['heroafter'], $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "flyin") { return $this->display_flyin(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "postfloat") { return $this->shortcode_display_postfloat($shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "topbar") { return $this->display_topbar(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "bottombar") { return $this->display_bottombar(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "sharebar") { return $this->display_sharebar(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "sharebottom") { return $this->display_sharebottom(true, $shortcode_parameters, $special_shortcode_options); } else { if ($display_as_key == "sharepoint") { return $this->display_sharepoint(true, $shortcode_parameters, $special_shortcode_options); } else { return $this->generate_share_buttons($display_as_key, 'share', $special_shortcode_options, true, $shortcode_parameters); } } } } } } } } } } }
/** * 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(); } }