/** * load * * Load global plugin settings for single call use * * @param array $options * @since 3.4.1 */ public static function load($options = array()) { self::$legacy_class = ESSBOptionValuesHelper::options_bool_value($options, 'legacy_class'); self::$counter_total_text = ESSBOptionValuesHelper::options_value($options, 'counter_total_text'); self::$button_counter_hidden_till = ESSBOptionValuesHelper::options_value($options, 'button_counter_hidden_till'); self::$mycred_group = ESSBOptionValuesHelper::options_value($options, 'mycred_group', 'mycred_default'); self::$mycred_points = ESSBOptionValuesHelper::options_value($options, 'mycred_points', '1'); self::$more_button_icon = ESSBOptionValuesHelper::options_value($options, 'more_button_icon'); self::$comments_address = ESSBOptionValuesHelper::options_value($options, 'comments_address'); self::$use_rel_me = ESSBOptionValuesHelper::options_bool_value($options, 'use_rel_me'); self::$essb_encode_text = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_text'); self::$essb_encode_url = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_url'); self::$essb_encode_text_plus = ESSBOptionValuesHelper::options_bool_value($options, 'essb_encode_text_plus'); self::$print_use_printfriendly = ESSBOptionValuesHelper::options_bool_value($options, 'print_use_printfriendly'); self::$pinterest_sniff_disable = ESSBOptionValuesHelper::options_bool_value($options, 'pinterest_sniff_disable'); self::$facebookadvanced = ESSBOptionValuesHelper::options_bool_value($options, 'facebookadvanced'); self::$facebookadvancedappid = ESSBOptionValuesHelper::options_value($options, 'facebookadvancedappid'); self::$activate_ga_campaign_tracking = ESSBOptionValuesHelper::options_value($options, 'activate_ga_campaign_tracking'); self::$twitter_message_optimize = ESSBOptionValuesHelper::options_bool_value($options, 'twitter_message_optimize'); self::$sidebar_pos = ESSBOptionValuesHelper::options_value($options, 'sidebar_pos'); self::$telegram_alternative = ESSBOptionValuesHelper::options_bool_value($options, 'telegram_alternative'); // @since 3.5 - runtime cache via WordPress functions self::$cache_runtime = ESSBOptionValuesHelper::options_bool_value($options, 'essb_cache_runtime'); $personalized_networks = ESSBOptionValuesHelper::get_active_social_networks_by_position('mobile'); $personalized_network_order = ESSBOptionValuesHelper::get_order_of_social_networks_by_position('mobile'); // added in @since 3.4.2 if (is_array($personalized_networks) && count($personalized_networks) > 0) { self::$mobile_networks = $personalized_networks; self::$mobile_networks_active = true; } if (is_array($personalized_network_order) && count($personalized_network_order) > 0) { self::$mobile_networks_order = $personalized_network_order; self::$mobile_networks_order_active = true; } }
private function loadDefaultFromOptions() { $this->default_image = ESSBOptionValuesHelper::options_value($this->options, 'sso_default_image'); if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_apply_the_content')) { $this->apply_the_content = true; } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'opengraph_tags')) { $this->ogtags_active = true; $this->fbadmins = isset($this->options['opengraph_tags_fbadmins']) ? $this->options['opengraph_tags_fbadmins'] : ''; $this->fbpage = isset($this->options['opengraph_tags_fbpage']) ? $this->options['opengraph_tags_fbpage'] : ''; $this->fbapp = isset($this->options['opengraph_tags_fbapp']) ? $this->options['opengraph_tags_fbapp'] : ''; $this->fb_author_profile = isset($this->options['opengraph_tags_fbauthor']) ? $this->options['opengraph_tags_fbauthor'] : ''; } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'twitter_card')) { $this->twitter_cards_active = true; $this->card_type = isset($this->options['twitter_card_type']) ? $this->options['twitter_card_type'] : ''; $this->twitter_user = isset($this->options['twitter_card_user']) ? $this->options['twitter_card_user'] : ''; } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_google_author')) { $this->google_authorship = true; $this->google_author = isset($this->options['ss_google_author_profile']) ? $this->options['ss_google_author_profile'] : ''; $this->google_publisher = isset($this->options['ss_google_author_publisher']) ? $this->options['ss_google_author_publisher'] : ''; } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'sso_google_markup')) { $this->google_markup = true; } if ($this->ogtags_active || $this->twitter_cards_active || $this->google_authorship || $this->google_markup) { $this->sso_active = true; } }
public static function draw_form_start($metabox_id) { global $essb_options; $admin_template = ESSBOptionValuesHelper::options_value($essb_options, 'admin_template'); if (!empty($admin_template)) { $admin_template = "essb-template-" . $admin_template; } echo '<div class="essb-options essb-metabox-options ' . $admin_template . '" id="' . $metabox_id . '">'; }
public function syncSharedCountData($post_id, $post_url) { global $essb_options; $apikey = ESSBOptionValuesHelper::options_value($essb_options, 'esml_sharedcount_api'); // reject if missing arguments if (!isset($post_id) || !isset($post_url)) { return; } // get social data from api.sharedcount.com $curl_handle = curl_init(); //if (ESSB_ESML_DEBUG) { // $post_url = 'http://www.google.com'; //} //curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($post_url)); curl_setopt($curl_handle, CURLOPT_URL, 'http://free.sharedcount.com/?url=' . rawurlencode($post_url) . '&apikey=' . $apikey); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); $json = curl_exec($curl_handle); curl_close($curl_handle); //print $json; // reject if no response if (!strlen($json)) { return; } // decode social data from JSON $shared_count_service_data = json_decode($json, true); // prepare stats array $stats = array(); // Stats we want to include in total $stats['facebook'] = $shared_count_service_data['Facebook']['total_count']; $stats['twitter'] = $shared_count_service_data['Twitter']; $stats['googleplus'] = $shared_count_service_data['GooglePlusOne']; $stats['linkedin'] = $shared_count_service_data['LinkedIn']; $stats['pinterest'] = $shared_count_service_data['Pinterest']; $stats['diggs'] = $shared_count_service_data['Diggs']; $stats['delicious'] = $shared_count_service_data['Delicious']; $stats['reddit'] = $shared_count_service_data['Reddit']; $stats['stumbleupon'] = $shared_count_service_data['StumbleUpon']; // Calculate total $stats['TOTAL'] = array_sum($stats); // Additional stats $stats['facebook_shares'] = $shared_count_service_data['Facebook']['share_count']; $stats['facebook_comments'] = $shared_count_service_data['Facebook']['comment_count']; $stats['facebook_likes'] = $shared_count_service_data['Facebook']['like_count']; // Calculate change since last update $delta = array(); $old_meta = get_post_custom($post_id); //foreach ($stats as $key => $value) if (is_int($value) && is_int($old_meta['esml_socialcount_'.$key][0])) $delta[$key] = $value - $old_meta['esml_socialcount_'.$key][0]; // update post with populated stats foreach ($stats as $key => $value) { if ($value) { update_post_meta($post_id, 'esml_socialcount_' . $key, $value); } } //$this->saveToDB($post_id, $delta); }
public static function is_activated() { global $essb_options; $purchase_code = ESSBOptionValuesHelper::options_value($essb_options, 'purchase_code'); if (!empty($purchase_code)) { return true; } else { return false; } }
private function __construct() { global $essb_options; $essb_cache_static = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_cache_static'); $essb_cache_static_js = ESSBOptionValuesHelper::options_bool_value($essb_options, 'essb_cache_static_js'); if ($essb_cache_static_js) { add_filter('print_scripts_array', array($this, 'init_essb_cache_static_js')); } if ($essb_cache_static) { add_filter('print_styles_array', array($this, 'init_essb_cache_static_css')); } }
function get_settings($option_name, $default_value = '', $boolean = false) { global $essb_options; $value = ESSBOptionValuesHelper::options_value($essb_options, $option_name); if (trim($value) == '') { $value = $default_value; } // @new image share support only top position @since version 3.2.6 if ($option_name == "sis_align_y") { $value = "top"; } return $value; }
public static function draw_form_start($custom = false, $group = '') { global $_REQUEST, $current_tab, $essb_options; $active_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : ''; $active_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : ''; $admin_template = ESSBOptionValuesHelper::options_value($essb_options, 'admin_template'); if (!empty($admin_template)) { $admin_template = "essb-template-" . $admin_template; } echo '<div id="essb-scroll-top"></div>'; echo '<form id="essb_options_form" enctype="multipart/form-data" method="post" action="">'; if ($custom && !empty($group)) { settings_fields($group); } else { settings_fields('essb_settings_group'); } echo '<input id="section" name="section" type="hidden" value="' . $active_section . '"/>'; echo '<input id="subsection" name="subsection" type="hidden" value="' . $active_subsection . '"/>'; echo '<input id="tab" name="tab" type="hidden" value="' . $current_tab . '"/>'; echo '<div class="essb-options ' . $admin_template . '" id="essb-options">'; }
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); }
function get_settings($option_name, $default_value = '', $boolean = false) { global $essb_options; $value = ESSBOptionValuesHelper::options_value($essb_options, $option_name); if (trim($value) == '') { $value = $default_value; } return $value; }
public function update_optons() { global $essb_navigation_tabs, $essb_sidebar_sections, $essb_section_options; $current_options = get_option(ESSB3_OPTIONS_NAME); if (!is_array($current_options)) { $current_options = array(); } $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; $user_options = isset($_REQUEST['essb_options']) ? $_REQUEST['essb_options'] : array(); $reset_settings = isset($_REQUEST['reset_settings']) ? $_REQUEST['reset_settings'] : ''; //print_r($user_options); if ($current_tab == '') { return; } if ($current_tab == 'advanced') { $this->temporary_activate_post_type_settings(); } if ($current_tab == "display") { $this->temporary_activate_positions_by_posttypes(); } $options = $essb_section_options[$current_tab]; foreach ($options as $section => $fields) { $section_options = $fields; foreach ($section_options as $option) { $type = $option['type']; $id = isset($option['id']) ? $option['id'] : ''; if ($id == '') { continue; } if (strpos($id, 'essb3fans_') !== false) { continue; } // custom ID parser for functions if ($id == 'essb3_options_template_select') { $id = 'style'; } if ($id == 'essb3_network_selection') { $type = "network_select"; } if ($id == "essb3_network_rename") { $type = "network_rename"; } if ($id == "essb3_post_type_select") { $id = "display_in_types"; } if ($id == "essb3_esml_post_type_select") { $id = "esml_monitor_types"; } if ($id == 'essb3_network_selection' && defined('ESSB3_LIGHTMODE')) { $twitteruser = isset($user_options['twitteruser']) ? $user_options['twitteruser'] : ''; $current_options['twitteruser'] = $twitteruser; $twitterhashtags = isset($user_options['twitterhashtags']) ? $user_options['twitterhashtags'] : ''; $current_options['twitterhashtags'] = $twitterhashtags; } // quick setup options if ($id == "quick_setup_recommended") { $current_options['twitter_shareshort'] = 'true'; $current_options['twitter_shareshort_service'] = 'wp'; $current_options['twitter_message_optimize'] = 'true'; $current_options['facebookadvanced'] = 'false'; $current_options['buffer_twitter_user'] = '******'; } if ($id == "quick_setup_static") { $current_options['use_minified_css'] = 'true'; $current_options['use_minified_js'] = 'true'; $current_options['load_js_async'] = 'true'; $current_options['load_css_footer'] = 'true'; } if ($id == 'quick_setup_easy') { update_option(ESSB3_EASYMODE_NAME, 'true'); } switch ($type) { case "network_rename": $option_value = isset($_REQUEST['essb_options_names']) ? $_REQUEST['essb_options_names'] : array(); foreach ($option_value as $key => $value) { $network_option_value = "user_network_name_" . $key; $current_options[$network_option_value] = $value; } break; case "network_select": $option_value = isset($user_options['networks']) ? $user_options['networks'] : array(); $current_options['networks'] = $option_value; $option_value = isset($user_options['networks_order']) ? $user_options['networks_order'] : array(); $current_options['networks_order'] = $option_value; break; case "checkbox_list_sortable": $option_value = isset($user_options[$id]) ? $user_options[$id] : ''; $current_options[$id] = $option_value; $option_value = isset($user_options[$id . '_order']) ? $user_options[$id . '_order'] : ''; $current_options[$id . '_order'] = $option_value; break; default: $option_value = isset($user_options[$id]) ? $user_options[$id] : ''; $current_options[$id] = $option_value; if ($id == "stats_active") { if ($option_value == "true") { ESSBSocialShareAnalyticsBackEnd::install(); } } break; } } } $current_options = $this->clean_blank_values($current_options); // initially reset plugin settings to default one if ($reset_settings == 'true') { $current_options = array(); $default_options = 'eyJidXR0b25fc3R5bGUiOiJidXR0b24iLCJzdHlsZSI6IjIyIiwiY3NzX2FuaW1hdGlvbnMiOiJubyIsImZ1bGx3aWR0aF9zaGFyZV9idXR0b25zX2NvbHVtbnMiOiIxIiwibmV0d29ya3MiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iXSwibmV0d29ya3Nfb3JkZXIiOlsiZmFjZWJvb2siLCJ0d2l0dGVyIiwiZ29vZ2xlIiwicGludGVyZXN0IiwibGlua2VkaW4iLCJkaWdnIiwiZGVsIiwic3R1bWJsZXVwb24iLCJ0dW1ibHIiLCJ2ayIsInByaW50IiwibWFpbCIsImZsYXR0ciIsInJlZGRpdCIsImJ1ZmZlciIsImxvdmUiLCJ3ZWlibyIsInBvY2tldCIsInhpbmciLCJvayIsIm13cCIsIm1vcmUiLCJ3aGF0c2FwcCIsIm1lbmVhbWUiLCJibG9nZ2VyIiwiYW1hem9uIiwieWFob29tYWlsIiwiZ21haWwiLCJhb2wiLCJuZXdzdmluZSIsImhhY2tlcm5ld3MiLCJldmVybm90ZSIsIm15c3BhY2UiLCJtYWlscnUiLCJ2aWFkZW8iLCJsaW5lIiwiZmxpcGJvYXJkIiwiY29tbWVudHMiLCJ5dW1tbHkiXSwibW9yZV9idXR0b25fZnVuYyI6IjEiLCJtb3JlX2J1dHRvbl9pY29uIjoicGx1cyIsInR3aXR0ZXJfc2hhcmVzaG9ydF9zZXJ2aWNlIjoid3A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LCJsaW5lfExpbmUiLCJmbGlwYm9hcmR8RmxpcGJvYXJkIiwiY29tbWVudHN8Q29tbWVudHMiLCJ5dW1tbHl8WXVtbWx5Il0sImNvbnRlbnRfcG9zaXRpb24iOiJjb250ZW50X2JvdHRvbSIsImVzc2JfY2FjaGVfbW9kZSI6ImZ1bGwiLCJ0dXJub2ZmX2Vzc2JfYWR2YW5jZWRfYm94IjoidHJ1ZSIsImVzc2JfYWNjZXNzIjoibWFuYWdlX29wdGlvbnMiLCJhcHBseV9jbGVhbl9idXR0b25zX21ldGhvZCI6ImRlZmF1bHQifQ=='; $options_base = ESSB_Manager::convert_ready_made_option($default_options); //print_r($options_base); if ($options_base) { $current_options = $options_base; } } update_option(ESSB3_OPTIONS_NAME, $current_options); $esml_active = ESSBOptionValuesHelper::options_bool_value($current_options, 'esml_active'); if (!$esml_active) { delete_option("esml_version"); $this->removeAllQueuedMetricsUpdates(); } }
public static function short_url($url, $provider, $post_id = '', $bitly_user = '', $bitly_api = '') { global $essb_options; $deactivate_cache = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_shorturl_cache'); $shorturl_googlapi = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_googlapi'); $short_url = ""; if ($provider == "ssu") { if (!defined('ESSB3_SSU_VERSION')) { $provider = "wp"; } } switch ($provider) { case "wp": $short_url = wp_get_shortlink(); break; case "goo.gl": $short_url = self::short_googl($url, $post_id, $deactivate_cache, $shorturl_googlapi); break; case "bit.ly": $short_url = self::short_bitly($url, $bitly_user, $bitly_api, $post_id, $deactivate_cache); break; case "ssu": $short_url = self::short_ssu($url, $post_id, $deactivate_cache); break; } return $short_url; }
public function load_social_api_code($network = '') { global $essb_options; if ($this->is_plugin_deactivated_on()) { return; } $facebook_lang = "en_US"; $user_defined_language_code = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_lang'); if (!empty($user_defined_language_code)) { $facebook_lang = $user_defined_language_code; } $facebook_appid = ""; $facebook_async = ESSBOptionValuesHelper::options_bool_value($essb_options, 'facebook_like_button_api_async') ? 'true' : 'false'; $vk_application = ESSBOptionValuesHelper::options_value($essb_options, 'vklikeappid'); if ($network == 'facebook') { echo $this->generate_facebook_api_code($facebook_lang, $facebook_appid, $facebook_async); } if ($network == 'google') { echo $this->generate_google_api_code(); } if ($network == 'vk') { echo $this->generate_vk_api_code($vk_application); } if ($network == "pinterest") { echo $this->generate_pinterst_code(); } if ($network == "twitter") { echo $this->generate_twitter_code(); } }
if (class_exists('ESSBDynamicCache')) { ESSBDynamicCache::flush(); } if (function_exists('purge_essb_cache_static_cache')) { purge_essb_cache_static_cache(); } printf('<div class="essb-information-box"><div class="icon"><i class="fa fa-info-circle"></i></div><div class="inner">%1$s</div></div>', __('Easy Social Share Buttons for WordPress Cache is purged!', ESSB3_TEXT_DOMAIN)); } if ($rebuild_resource == "true") { if (class_exists('ESSBPrecompiledResources')) { ESSBPrecompiledResources::flush(); } } if ($current_tab == "analytics") { $settings_url = esc_url_raw(get_admin_url() . 'admin.php?page=essb_options&tab=social§ion=sharing&subsection=sharing-6'); if (!ESSBOptionValuesHelper::is_active_module('ssanalytics')) { printf('<div class="essb-information-box"><div class="icon orange"><i class="fa fa-info-circle"></i></div><div class="inner">%1$s<a href="%2$s" class="button float_right">%3$s</a></div></div>', __('Statistics function in not activated!', ESSB3_TEXT_DOMAIN), $settings_url, __('Click here to go to settings and activte it', ESSB3_TEXT_DOMAIN)); } } ?> <div class="essb-title-panel"> <div class="essb-logo-container"> <div class="essb-logo essb-logo32"></div> </div> <?php $easy_mode_state = defined('ESSB3_LIGHTMODE') ? "deactivate" : "activate"; ?>
function essb3_esml_post_type_select() { global $essb_admin_options, $wp_post_types; $pts = get_post_types(array('show_ui' => true, '_builtin' => true)); $cpts = get_post_types(array('show_ui' => true, '_builtin' => false)); $current_posttypes = array(); if (is_array($essb_admin_options)) { $current_posttypes = ESSBOptionValuesHelper::options_value($essb_admin_options, 'esml_monitor_types', array()); } if (!is_array($current_posttypes)) { $current_posttypes = array(); } echo '<ul>'; foreach ($pts as $pt) { $selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : ''; printf('<li><input type="checkbox" name="essb_options[esml_monitor_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label); } foreach ($cpts as $pt) { $selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : ''; printf('<li><input type="checkbox" name="essb_options[esml_monitor_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label); } echo '</ul>'; }
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'); } } }
public static function twitter_message_optimization($tweet, $url, $user, $hashtags, $method = '1') { global $essb_options; $max_message_length = 140; $twitter_message_optimize_dots = ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_message_optimize_dots'); $current_message_length = ESSBButtonHelper::twitter_message_length($tweet, $url, $user, $hashtags); $result = array(); $result['tweet'] = $tweet; $result['hashtags'] = $hashtags; $result['user'] = $user; if ($current_message_length < $max_message_length) { return $result; } else { switch ($method) { case "1": $result['hashtags'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $result['user'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($twitter_message_optimize_dots) { $length -= 3; } $last_space = strrpos(substr($result['tweet'], 0, $length), '+'); $trimmed_text = substr($result['tweet'], 0, $last_space); if ($twitter_message_optimize_dots) { $trimmed_text .= '...'; } $result['tweet'] = $trimmed_text; } } break; case "2": $result['user'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $result['hashtags'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($twitter_message_optimize_dots) { $length -= 3; } $last_space = strrpos(substr($result['tweet'], 0, $length), '+'); $trimmed_text = substr($result['tweet'], 0, $last_space); if ($twitter_message_optimize_dots) { $trimmed_text .= '...'; } $result['tweet'] = $trimmed_text; } } break; case "3": $result['user'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($twitter_message_optimize_dots) { $length -= 3; } $last_space = strrpos(substr($result['tweet'], 0, $length), '+'); $trimmed_text = substr($result['tweet'], 0, $last_space); if ($twitter_message_optimize_dots) { $trimmed_text .= '...'; } $result['tweet'] = $trimmed_text; } break; case "4": $result['hashtags'] = ''; $current_message_length = ESSBButtonHelper::twitter_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($current_message_length > $max_message_length) { $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($twitter_message_optimize_dots) { $length -= 3; } $last_space = strrpos(substr($result['tweet'], 0, $length), '+'); $trimmed_text = substr($result['tweet'], 0, $last_space); if ($twitter_message_optimize_dots) { $trimmed_text .= '...'; } $result['tweet'] = $trimmed_text; } break; case "5": $length = ESSBButtonHelper::twitter_maximum_message_length($result['tweet'], $url, $result['user'], $result['hashtags']); if ($twitter_message_optimize_dots) { $length -= 3; } $last_space = strrpos(substr($result['tweet'], 0, $length), '+'); $trimmed_text = substr($result['tweet'], 0, $last_space); if ($twitter_message_optimize_dots) { $trimmed_text .= '...'; } $result['tweet'] = $trimmed_text; break; } return $result; } }
public static function js_build_generate_bottombar_reveal_code() { global $essb_options; $output = ''; $appear_pos = ESSBOptionValuesHelper::options_value($essb_options, 'bottombar_top_onscroll'); $bottombar_hide = ESSBOptionValuesHelper::options_value($essb_options, 'bottombar_hide'); if ($appear_pos != '' || $bottombar_hide != '') { $output .= ' jQuery(document).ready(function($){ $(window).scroll(essb_bottombar_onscroll); function essb_bottombar_onscroll() { var current_pos = $(window).scrollTop(); var height = $(document).height()-$(window).height(); var percentage = current_pos/height*100; var value_appear = "' . $appear_pos . '"; var value_disappear = "' . $bottombar_hide . '"; var element; if ($(".essb_bottombar").length) { element = $(".essb_bottombar"); } if (!element || typeof(element) == "undefined") { return; } value_appear = parseInt(value_appear); value_disappear = parseInt(value_disappear); if (value_appear > 0 ) { if (percentage >= value_appear && !element.hasClass("essb_active_bottombar")) { element.addClass("essb_active_bottombar"); return; } if (percentage < value_appear && element.hasClass("essb_active_bottombar")) { element.removeClass("essb_active_bottombar"); return; } } if (value_disappear > 0) { if (percentage >= value_disappear && !element.hasClass("hidden-float")) { element.addClass("hidden-float"); element.css( {"opacity": "0"}); return; } if (percentage < value_disappear && element.hasClass("hidden-float")) { element.removeClass("hidden-float"); element.css( {"opacity": "1"}); return; } } } }); '; } return $output; }
function essb_shortcode_share_popup($atts) { $shortcode_options = array(); if (is_array($atts)) { $flyin_title = ESSBOptionValuesHelper::options_value($atts, 'popup_title'); $flyin_message = ESSBOptionValuesHelper::options_value($atts, 'popup_message'); $flyin_percent = ESSBOptionValuesHelper::options_value($atts, 'popup_percent'); $flyin_end = ESSBOptionValuesHelper::options_value($atts, 'popup_end'); foreach ($atts as $key => $value) { if ($key != 'popup_title' && $key != 'popup_message' && $key != 'popup_percent' && $key != 'popup_end') { $shortcode_options[$key] = $value; } } $shortcode_options['extended_popup_title'] = $flyin_title; $shortcode_options['extended_popup_message'] = $flyin_message; $shortcode_options['extended_popup_percent'] = $flyin_percent; $shortcode_options['extended_popup_end'] = $flyin_end; } $shortcode_options['popup'] = "yes"; return $this->essb_shortcode_share($shortcode_options); }
function essb_register_settings_metabox_onoff() { global $post, $essb_options; if (isset($_GET['action'])) { $custom = get_post_custom($post->ID); $essb_off = isset($custom["essb_off"]) ? $custom["essb_off"][0] : "false"; $essb_pc_twitter = isset($custom["essb_pc_twitter"]) ? $custom["essb_pc_twitter"][0] : ""; $twitter_counters = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_counters'); ESSBMetaboxInterface::draw_form_start('essb_global_metabox'); ESSBMetaboxOptionsFramework::draw_section_start(); ESSBMetaboxOptionsFramework::draw_options_row_start(__('Turn off Easy Social Share Buttons', ESSB3_TEXT_DOMAIN), __('Turn off automatic button display for that post/page of social share buttons', ESSB3_TEXT_DOMAIN), '', '2', false); ESSBMetaboxOptionsFramework::draw_options_row_end(); ESSBMetaboxOptionsFramework::draw_options_row_start('', '', '', '2', false); ESSBMetaboxOptionsFramework::draw_switch_field('essb_off', 'essb_metabox', $essb_off, __('Yes', ESSB3_TEXT_DOMAIN), __('No', ESSB3_TEXT_DOMAIN)); ESSBMetaboxOptionsFramework::draw_options_row_end(); if ($twitter_counters == "self") { ESSBMetaboxOptionsFramework::draw_options_row_start(__('Twitter Internal Share Counter', ESSB3_TEXT_DOMAIN), __('Customize value of Twitter internal share counter', ESSB3_TEXT_DOMAIN), '', '2', false); ESSBMetaboxOptionsFramework::draw_options_row_end(); ESSBMetaboxOptionsFramework::draw_options_row_start('', '', '', '2', false); ESSBMetaboxOptionsFramework::draw_input_field('essb_pc_twitter', true, 'essb_metabox', $essb_pc_twitter); ESSBMetaboxOptionsFramework::draw_options_row_end(); } ESSBMetaboxOptionsFramework::draw_section_end(); ESSBMetaboxInterface::draw_form_end(); } }
public function register_css() { global $essb_options; $deactivate_fa = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_fa'); $this->resource_files[] = array("key" => "essb-native-privacy", "file" => ESSB3_PLUGIN_URL . '/assets/css/essb-native-privacy.min.css', "type" => "css"); if (!$deactivate_fa) { $this->resource_files[] = array("key" => "essb-fontawsome", "file" => ESSB3_PLUGIN_URL . '/assets/css/font-awesome.min.css', "type" => "css"); } $this->resource_files[] = array("key" => "essb-socialprivacy-script", "file" => ESSB3_PLUGIN_URL . '/assets/js/essb-social-privacy.min.js', "type" => "js"); }
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; } }
public static function is_module_deactivate_on($module = 'share') { global $essb_options; if (ESSBOptionValuesHelper::options_bool_value($essb_options, 'reset_postdata')) { wp_reset_postdata(); } //display_deactivate_on $is_deactivated = false; $exclude_from = ESSBOptionValuesHelper::options_value($essb_options, 'deactivate_on_' . $module); if (!empty($exclude_from)) { $excule_from = explode(',', $exclude_from); $excule_from = array_map('trim', $excule_from); if (in_array(get_the_ID(), $excule_from, false)) { $is_deactivated = true; } } return $is_deactivated; }
public function adminMenuSetup() { global $essb_options; // Add Social Metrics Tracker menu $visibility = ESSBOptionValuesHelper::options_value($essb_options, 'esml_access', 'manage_options'); add_menu_page('Easy Social Metrics Lite', 'Easy Social Metrics Lite', $visibility, 'easy-social-metrics-lite', array($this, 'render_view'), 'dashicons-chart-bar'); //new SocialMetricsTrackerWidget(); }
public static function get_alternate_permalink($url, $id) { global $essb_options; $new_url = $url; $recover_mode = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_mode'); $recover_protocol = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_protocol'); $recover_from_other_domain = ESSBOptionValuesHelper::options_bool_value($essb_options, 'counter_recover_domain'); // Setup the Default Permalink Structure if ($recover_mode == 'default') { $domain = get_site_url(); $new_url = $domain . '/?p=' . $id; } // Setup the "Day and name" Permalink Structure if ($recover_mode == 'dayname') { $domain = get_site_url(); $date = get_the_date('Y/m/d', $id); $slug = basename(get_permalink($id)); $new_url = $domain . '/' . $date . '/' . $slug . '/'; } // Setup the "Month and name" Permalink Structure if ($recover_mode == 'monthname') { $domain = get_site_url(); $date = get_the_date('Y/m', $id); $slug = basename(get_permalink($id)); $new_url = $domain . '/' . $date . '/' . $slug . '/'; } // Setup the "Numeric" Permalink Structure if ($recover_mode == 'numeric') { $domain = get_site_url(); $new_url = $domain . '/archives/' . $id . '/'; } // Setup the "Post name" Permalink Structure if ($recover_mode == 'postname') { $domain = get_site_url(); $post_data = get_post($id, ARRAY_A); $slug = $post_data['post_name']; $new_url = $domain . '/' . $slug . '/'; } if ($recover_mode == "domain" && !empty($recover_from_other_domain)) { $current_site_url = get_site_url(); $new_url = str_replace($current_site_url, $recover_from_other_domain, $url); } if ($recover_protocol == "http2https") { $new_url = str_replace('https://', 'http://', $new_url); } if ($recover_protocol == "https2http") { $new_url = str_replace('http://', 'https://', $new_url); } return $new_url; }
public static function facebook_button_code($settings = array(), $counters = false) { global $essb_options; $facebook_type = isset($settings['facebook_type']) ? $settings['facebook_type'] : 'like'; $facebook_url = isset($settings['facebook_url']) ? $settings['facebook_url'] : ''; $facebook_margin_top = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_margin_top'); $facebook_height = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_height'); $facebook_width = ESSBOptionValuesHelper::options_value($essb_options, 'facebook_like_button_width'); if (trim($facebook_width) != "") { $facebook_width = "width:" . $facebook_width . 'px;'; } $code = '<div style="' . self::facebook_button_css_fixer('display: inline-block; height: 24px; max-height: 24px; ' . $facebook_width . 'vertical-align: top;', $facebook_height, $facebook_margin_top) . '">'; if ($facebook_type == "like") { $code .= '<div class="fb-like" data-href="' . $facebook_url . '" data-layout="' . ($counters ? "button_count" : "button") . '" data-action="like" data-show-faces="false" data-share="false" data-width="292" style="vertical-align: top; zoom: 1;display: inline;"></div>'; } else { $code .= '<div class="fb-follow" data-href="' . $facebook_url . '" data-layout="' . ($counters ? "button_count" : "button") . '" data-show-faces="false"></div>'; } $code .= '</div>'; return $code; }
function essb_ctt_shortcode($atts) { global $essb_options; extract(shortcode_atts(array('tweet' => '', 'via' => 'yes', 'url' => 'yes', 'nofollow' => 'no', 'user' => '', 'hashtags' => '', 'usehashtags' => 'yes'), $atts)); $handle = $user; if (function_exists('mb_internal_encoding')) { $handle_length = 6 + mb_strlen($handle); } else { $handle_length = 6 + strlen($handle); } if (!empty($handle) && $via != 'no') { $handle_code = "&via=" . $handle . "&related=" . $handle; } else { $handle_code = ''; } if ($via != 'yes') { $handle = ''; $handle_code = ''; $handle_length = 0; } if ($usehashtags != 'no' && $hashtags != '') { $handle_code .= "&hashtags=" . $hashtags; if (function_exists('mb_internal_encoding')) { $handle_length = 6 + mb_strlen($hashtags); } else { $handle_length = 6 + strlen($hashtags); } } $text = $tweet; $post_url = get_permalink(); $short_url = ""; $twitter_shareshort = ESSBOptionValuesHelper::options_bool_value($essb_options, 'twitter_shareshort'); if ($twitter_shareshort) { $provider = ESSBOptionValuesHelper::options_value($essb_options, 'twitter_shareshort_service'); $shorturl_bitlyuser = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyuser'); $shorturl_bitlyapi = ESSBOptionValuesHelper::options_value($essb_options, 'shorturl_bitlyapi'); $short_url = ESSBUrlHelper::short_url($post_url, $provider, get_the_ID(), $shorturl_bitlyuser, $shorturl_bitlyapi); } if (filter_var($url, FILTER_VALIDATE_URL)) { $bcttURL = '&url=' . $url; } elseif ($url != 'no') { if ($short_url != '') { $bcttURL = '&url=' . $short_url . '&counturl=' . $post_url; } else { $bcttURL = '&url=' . $post_url; } } else { $bcttURL = ''; } $bcttBttn = __('Click to Tweet', ESSB3_TEXT_DOMAIN); $user_text = ESSBOptionValuesHelper::options_value($essb_options, 'translate_clicktotweet'); if ($user_text != '') { $bcttBttn = $user_text; } if ($url != 'no') { $short = essb_ctt_shorten($text, 117 - $handle_length); } else { $short = essb_ctt_shorten($text, 140 - $handle_length); } $link_short = $short; //$link_short = str_replace('#', '%23', $link_short); if ($nofollow != 'no') { $rel = "rel='nofollow'"; } else { $rel = ''; } if (!is_feed()) { return "<div class='essb-click-to-tweet' onclick=\"window.open('https://twitter.com/intent/tweet?text=" . urlencode($link_short) . $handle_code . $bcttURL . "', 'essb_share_window', 'height=300,width=500,resizable=1,scrollbars=yes');\">\n\t\t\t<span class='essb-click-to-tweet-quote'>\n\t\t\t" . $short . "\n\t\t\t</span>\n\t\t\t<span class='essb-click-to-tweet-button'>" . $bcttBttn . "<span class='essb-click-to-tweet-button-icon'></span>\n\t\t</div>"; } //else { // return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode ( $short ) . $handle_code . $bcttURL . "' target='_blank' class='essb-ctt-ctt-btn'" . $rel . ">" . $bcttBttn . "</a><br /><hr />"; //} }
public static function get_assets() { global $essb_options; $deactivate_fa = ESSBOptionValuesHelper::options_bool_value($essb_options, 'deactivate_fa'); self::$resouce_files[] = array("key" => "easy-social-share-buttons-nativeskinned", "file" => ESSB3_PLUGIN_URL . '/assets/css/essb-native-skinned.min.css', "type" => "css"); if (!$deactivate_fa) { self::$resouce_files[] = array("key" => "essb-fontawsome", "file" => ESSB3_PLUGIN_URL . '/assets/css/font-awesome.min.css', "type" => "css"); } return self::$resouce_files; }
/** * * * @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; }
public function popupWindowGenerate($html, $type = '', $force_width = '') { $popup_width = ESSBOptionValuesHelper::options_value($this->options, 'afterclose_popup_width', '400'); if (trim($popup_width) == '') { $popup_width = '400'; } if ($force_width != '') { $popup_width = $force_width; } if ($type != '') { $type = ' essbasc-popup-' . $type; } echo '<div class="essbasc-popup' . $type . '" data-popup-width="' . $popup_width . '">'; echo '<a href="#" class="essbasc-popup-close" onclick="essbasc_popup_close(); return false;"></a>'; echo '<div class="essbasc-popup-content">'; echo $html; echo '</div>'; echo '</div>'; echo '<div class="essbasc-popup-shadow" onclick="essbasc_popup_close();"></div>'; echo '<script type="text/javascript">'; echo 'var essbasc_cookie_live = ' . $this->single_display_cookie_length . ';'; echo '</script>'; }