$is_active_subscribe, 'design2' => $is_active_subscribe2, 'design3' => $is_active_subscribe3, 'design4' => $is_active_subscribe4, 'design5' => $is_active_subscribe5, 'design6' => $is_active_subscribe6, 'design7' => $is_active_subscribe7, 'design8' => $is_active_subscribe8, 'design9' => $is_active_subscribe9))); } $global_user_defined_css = essb_option_value('customizer_css'); if ($global_user_defined_css != '') { $global_user_defined_css = stripslashes ( $global_user_defined_css ); $snippet .= $global_user_defined_css; } return $buffer.$snippet; } function essb_css_build_footer_css($buffer) { $global_user_defined_css = essb_option_value('customizer_css_footer'); if ($global_user_defined_css != '') { $global_user_defined_css = stripslashes ( $global_user_defined_css ); } return $buffer.$global_user_defined_css; } function essb_js_build_admin_ajax_access_code($buffer) { $code_options = array(); $code_options['ajax_url'] = admin_url ('admin-ajax.php'); $code_options['essb3_nonce'] = wp_create_nonce('essb3_ajax_nonce'); $code_options['essb3_plugin_url'] = ESSB3_PLUGIN_URL; // @since 5.0 - values are added only when real time share counters are used if (essb_option_value('counter_mode') == '') { $code_options['essb3_facebook_total'] = essb_option_bool_value('facebooktotal'); $code_options['essb3_admin_ajax'] = essb_option_bool_value('force_counters_admin'); $code_options['essb3_internal_counter'] = essb_option_bool_value('active_internal_counters'); $code_options['essb3_counter_button_min'] = intval(essb_option_value('button_counter_hidden_till')); $code_options['essb3_counter_total_min'] = intval(essb_option_value('total_counter_hidden_till')); $code_options['essb3_no_counter_mailprint'] = essb_option_bool_value('deactive_internal_counters_mail'); $code_options['essb3_single_ajax'] = essb_option_bool_value('force_counters_admin_single'); $code_options['ajax_type'] = essb_option_value('force_counters_admin_type'); $code_options['twitter_counter'] = essb_option_value('twitter_counters'); $code_options['google_counter'] = essb_option_value('google_counter_type'); } $code_options['essb3_stats'] = essb_option_bool_value('stats_active'); $code_options['essb3_ga'] = essb_option_bool_value('activate_ga_tracking'); $code_options['essb3_ga_mode'] = essb_option_value('ga_tracking_mode'); $code_options['blog_url'] = get_site_url().'/'; $code_options['essb3_postfloat_stay'] = essb_option_bool_value('postfloat_always_visible'); $code_options['post_id'] = get_the_ID(); if (essb_option_bool_value('activate_ga_layers')) { $code_options['essb3_ga'] = true; $code_options['essb3_ga_mode'] = 'layers'; } if (essb_option_bool_value('deactivate_postcount')) { $code_options['stop_postcount'] = true; } $postfloat_top = essb_option_value('postfloat_top'); if (!empty($postfloat_top)) { $code_options['postfloat_top'] = $postfloat_top; } $hide_float_from_top = essb_option_value('float_top_disappear'); if (!empty($hide_float_from_top)) { $code_options['hide_float'] = $hide_float_from_top; } $top_pos = essb_option_value('float_top'); $float_top_loggedin = essb_option_value('float_top_loggedin'); if (is_user_logged_in() && $float_top_loggedin != '') { $top_pos = $float_top_loggedin; } if (!empty($top_pos)) { $code_options['float_top'] = $top_pos; } // sidebar reveal code $appear_pos = essb_option_value('sidebar_leftright_percent'); $disappear_pos = essb_option_value('sidebar_leftright_percent_hide'); $appear_unit = essb_option_value('sidebar_appear_unit'); if ($appear_pos != '') { $code_options['sidebar_appear_pos'] = $appear_pos; $code_options['sidebar_appear_unit'] = $appear_unit; } if ($disappear_pos != '') { $code_options['sidebar_disappear_pos'] = $disappear_pos; } $bottombar_appear_pos = essb_option_value('bottombar_top_onscroll'); $bottombar_hide = essb_option_value('bottombar_hide'); if ($bottombar_appear_pos != '') { $code_options['bottombar_appear'] = $bottombar_appear_pos; } if ($bottombar_hide != '') { $code_options['bottombar_disappear'] = $bottombar_hide; } $topbar_appear_pos = essb_option_value('topbar_top_onscroll'); $topbar_hide = essb_option_value('topbar_hide'); if ($topbar_appear_pos != '') { $code_options['topbar_appear'] = $topbar_appear_pos; } if ($topbar_hide != '') { $code_options['topbar_disappear'] = $topbar_hide; } $postfloat_percent = essb_option_value('postfloat_percent'); if ($postfloat_percent != '') { $code_options['postfloat_percent'] = $postfloat_percent; } $subscribe_terms_error = essb_option_value('subscribe_terms_error'); if ($subscribe_terms_error != '') { $code_options['subscribe_terms_error'] = stripslashes($subscribe_terms_error); } // since 5.6 - require name field if (essb_option_bool_value('subscribe_require_name')) { $code_options['subscribe_validate_name'] = true; if (essb_option_value('subscribe_require_name_error') != '') { $code_options['subscribe_validate_name_error'] = essb_option_value('subscribe_require_name_error'); } } // since 5.2 - client side counter update if (essb_option_bool_value('cache_counter_facebook_async') || essb_option_bool_value('cache_counter_pinterest_async')) { if (essb_option_bool_value('cache_counter_facebook_async')) { $code_options['facebook_client'] = true; } if (essb_option_bool_value('cache_counter_pinterest_async')) { $code_options['pinterest_client'] = true; } $code_options['facebook_post_url'] = get_permalink(get_the_ID()); // service change in version 5.6 to capture custom share URL inside options if (essb_option_bool_value('customshare')) { if (essb_option_value('customshare_url') != '') { $code_options['facebook_post_url'] = essb_option_value('customshare_url'); } } if (defined('ESSB3_SHARED_COUNTER_RECOVERY')) { $code_options['facebook_post_recovery_url'] = essb_recovery_get_alt_permalink(get_permalink(get_the_ID()), get_the_ID()); if (essb_option_bool_value('customshare')) { if (essb_option_value('customshare_url') != '') { $code_options['facebook_post_recovery_url'] = essb_recovery_get_alt_permalink(essb_option_value('customshare_url'), get_the_ID()); } } } } if (has_filter('essb_extend_ajax_options')) { $code_options = apply_filters('essb_extend_ajax_options', $code_options); } $output = 'var essb_settings = '.json_encode($code_options).';'; if (defined('ESSB3_CACHED_COUNTERS')) { if (ESSBGlobalSettings::$cached_counters_cache_mode) { $update_url = essb_get_current_page_url(); if (defined('ESSB_FORCE_SSL')) { $update_url = str_replace('http://', 'https://', $update_url); } else { // second level of protection against non https connection calls when http is detected instead of https $current_page_url = get_permalink(); if (strpos($current_page_url, 'https://') !== false && strpos($update_url, 'https://') === false) { $update_url = str_replace('http://', 'https://', $update_url); } } $output .= 'var essb_buttons_exist = !!document.getElementsByClassName("essb_links"); if(essb_buttons_exist == true) { document.addEventListener("DOMContentLoaded", function(event) { var ESSB_CACHE_URL = "'.$update_url.'"; if(ESSB_CACHE_URL.indexOf("?") > -1) { ESSB_CACHE_URL += "&essb_counter_cache=rebuild"; } else { ESSB_CACHE_URL += "?essb_counter_cache=rebuild"; }; var xhr = new XMLHttpRequest(); xhr.open("GET",ESSB_CACHE_URL,true); xhr.send(); });}'; } } return $buffer.$output; } function essb_hex2rgba($color, $opacity = false) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)) return $default; //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if($opacity){ if(abs($opacity) > 1) $opacity = 1.0; $output = 'rgba('.implode(',',$rgb).','.$opacity.')'; } else { $output = 'rgb('.implode(',',$rgb).')'; } //Return rgb(a) color string return $output; }