function __construct() { // initialize options $essb_options = EasySocialShareButtons_Options::get_instance(); $this->options = $essb_options->options; $this->active = ESSBOptionsHelper::optionsBoolValue($this->options, 'native_privacy_active'); if (ESSB_DEMO_MODE) { $is_active_option = isset($_REQUEST['native-privacy']) ? $_REQUEST['native-privacy'] : ''; if ($is_active_option == 'true') { $this->active = true; } } if ($this->active) { $this->get_state(); add_action('wp_enqueue_scripts', array($this, 'registerCSS'), 10); } }
function __construct() { $essb_options = EasySocialShareButtons_Options::get_instance(); $this->options = $essb_options->options; $is_active = ESSBOptionsHelper::optionsBoolValue($this->options, 'afterclose_active'); $is_active_option = ""; if (ESSB_DEMO_MODE) { $is_active_option = isset($_REQUEST['aftershare']) ? $_REQUEST['aftershare'] : ''; if ($is_active_option != '') { $is_active = true; } } if ($is_active) { $this->load_js_async = ESSBOptionsHelper::optionsBoolValue($this->options, 'load_js_async'); $this->load($is_active_option); } }
if (isset($welcome_option)) { if ($welcome_option == "true") { $welcome_active = false; } } if ($current_tab == "wizard") { include ESSB_PLUGIN_ROOT . '/lib/admin/pages/essb-settings-wizard2.php'; } if ($current_tab == "wizard2") { include ESSB_PLUGIN_ROOT . '/lib/admin/pages/essb-settings-wizard.php'; } // check for cache activated $current_options = get_option(EasySocialShareButtons::$plugin_settings_name); $general_cache_active = ESSBOptionsHelper::optionsBoolValue($current_options, 'essb_cache'); $general_cache_active_static = ESSBOptionsHelper::optionsBoolValue($current_options, 'essb_cache_static'); $general_cache_active_static_js = ESSBOptionsHelper::optionsBoolValue($current_options, 'essb_cache_static_js'); $general_cache_mode = ESSBOptionsHelper::optionsValue($current_options, 'essb_cache_mode'); $display_cache_mode = ""; if ($general_cache_active) { if ($general_cache_mode == "full") { $display_cache_mode = "Cache button render and dynamic resources"; } else { $display_cache_mode = "Cache only dynamic resources"; } } if ($general_cache_active_static || $general_cache_active_static_js) { if ($display_cache_mode != '') { $display_cache_mode .= ", "; } $display_cache_mode .= "Combine into sigle file all plugin static CSS files"; }
public function register_admin_assets($hook) { wp_register_style('essb-admin', ESSB_PLUGIN_URL . '/assets/css/essb-admin.css', array(), $this->version); wp_enqueue_style('essb-admin'); wp_enqueue_script('essb-admin', ESSB_PLUGIN_URL . '/assets/js/essb-admin.js', array('jquery'), $this->version, true); $deactivate_fa = ESSBOptionsHelper::optionsBoolValue($this->options, 'deactivate_fa'); if (!$deactivate_fa) { wp_register_style('essb-fontawsome', ESSB_PLUGIN_URL . '/assets/css/font-awesome.min.css', array(), $this->version); wp_enqueue_style('essb-fontawsome'); } wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); wp_enqueue_style('essb-morris-styles', ESSB_PLUGIN_URL . '/assets/css/morris.min.css', array(), $this->version); wp_enqueue_script('essb-morris', ESSB_PLUGIN_URL . '/assets/js/morris.min.js', array('jquery'), $this->version); wp_enqueue_script('essb-raphael', ESSB_PLUGIN_URL . '/assets/js/raphael-min.js', array('jquery'), $this->version); wp_enqueue_style('essb-wizard-styles', ESSB_PLUGIN_URL . '/assets/css/essb-jquery.steps.css', array(), $this->version); wp_enqueue_script('essb-wizard', ESSB_PLUGIN_URL . '/assets/js/jquery.steps.js', array('jquery'), $this->version); //if ($hook == "toplevel_page_essb_settings") { // wp_enqueue_script( 'ace_code_highlighter_js', ESSB_PLUGIN_URL . '/assets/js/ace/ace.js', '', '1.0.0', true ); // wp_enqueue_script( 'ace_mode_js', ESSB_PLUGIN_URL . '/assets/js/ace/mode-css.js', array( 'ace_code_highlighter_js' ), '1.0.0', true ); // wp_enqueue_script( 'custom_css_js', ESSB_PLUGIN_URL . '/assets/js/worker-css.js', array( 'jquery', 'ace_code_highlighter_js' ), '1.0.0', true ); //} }
$current_options['afterclose_like_fb_like_url'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_fb_like_url'); $current_options['afterclose_like_fb_follow_url'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_fb_follow_url'); $current_options['afterclose_like_google_url'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_google_url'); $current_options['afterclose_like_google_follow_url'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_google_follow_url'); $current_options['afterclose_like_twitter_profile'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_twitter_profile'); $current_options['afterclose_like_pin_follow_url'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_pin_follow_url'); $current_options['afterclose_like_youtube_channel'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_youtube_channel'); $current_options['afterclose_like_linkedin_company'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_linkedin_company'); $current_options['afterclose_message_text'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_message_text'); $current_options['afterclose_code_text'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_code_text'); $current_options['afterclose_popup_width'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_popup_width'); $current_options['essb_cache_static_js'] = ESSBOptionsHelper::optionsBoolValueAsText($options, 'essb_cache_static_js'); $current_options['afterclose_like_cols'] = ESSBOptionsHelper::optionsValue($options, 'afterclose_like_cols'); $current_options['deactivate_fa'] = ESSBOptionsHelper::optionsBoolValueAsText($options, 'deactivate_fa'); $current_options['whatsapp_shareshort'] = ESSBOptionsHelper::optionsBoolValueAsText($options, 'whatsapp_shareshort'); $current_options['whatsapp_shareshort_service'] = ESSBOptionsHelper::optionsBoolValue($options, 'whatsapp_shareshort_service'); $current_options['fixed_width_align'] = ESSBOptionsHelper::optionsValue($options, 'fixed_width_align'); //essb_cache_static_js $current_options['advanced_share'] = $as; update_option(EasySocialShareButtons::$plugin_settings_name, $current_options); $msg = __("Settings are saved", ESSB_TEXT_DOMAIN); ESSBCache::flush(); if ($current_options['stats_active'] == 'true') { EasySocialShareButtons_Stats_Admin::install(); } // update social fans counter if (isset($essb_fans)) { $essb_fans->options['social'] = $_POST['social']; $essb_fans->options['sort'] = $_POST['sort']; $essb_fans->options['cache'] = (int) $_POST['cache']; // $essb_fans->options['data'] = '';
function print_share_links($content) { global $post; $start = microtime(true); $execution_trance = ""; $options = $this->options; if (isset($options['display_in_types'])) { // write buttons only if administrator checked this type $is_all_lists = in_array('all_lists', $options['display_in_types']); $singular_options = $options['display_in_types']; $float_onsingle_only = ESSBOptionsHelper::optionsBoolValue($options, 'float_onsingle_only'); $is_set_list = count($singular_options) > 0 ? true : false; unset($singular_options['all_lists']); $is_lists_authorized = (is_archive() || is_front_page() || is_search() || is_tag() || is_post_type_archive() || is_home()) && $is_all_lists ? true : false; $is_singular = is_singular($singular_options); if ($is_singular && !$is_set_list) { $is_singular = false; } // since 1.3.9.9 deactivate on home page $deactivate_homepage = isset($options['deactivate_homepage']) ? $options['deactivate_homepage'] : 'false'; if ($deactivate_homepage == 'true') { if (is_home() || is_front_page()) { $is_lists_authorized = false; $is_singular = true; } } $serialized_test = serialize($singular_options); $excule_from = isset($options['display_exclude_from']) ? $options['display_exclude_from'] : ''; // @since 1.3.8.2 if ($excule_from != '') { $excule_from = explode(',', $excule_from); $excule_from = array_map('trim', $excule_from); if (in_array($post->ID, $excule_from, false)) { $is_singular = false; $is_lists_authorized = false; } } // AI1EC fix of exporet $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $exist_ai1ec_export = strpos($request_uri, 'ai1ec_exporter_controller'); if ($exist_ai1ec_export !== false) { $is_singular = false; $is_lists_authorized = false; } $exist_tribe_cal = strpos($request_uri, 'ical='); if ($exist_tribe_cal !== false) { $is_singular = false; $is_lists_authorized = false; } //$content .= " is_singular = ".$is_singular. " | is_list = ".$is_lists_authorized . ' | types = '.$serialized_test . ' | '.$post->post_type. ' | '.$_SERVER['REQUEST_URI']; if ($is_singular || $is_lists_authorized) { $pt_settings = array(); // @ since 1.3.9.6 - correct state before additioanl display method generation $this->set_options_by_bp_activate_state(); if ($this->options_by_pt_active) { $pt_settings = EasySocialShareButtons_Advanced_Display::get_options_by_pt(); } if ($this->options_by_pt_active && isset($post)) { $pt_counters = isset($pt_settings['counters']) ? $pt_settings['counters'] : ''; if ($pt_counters != '') { $options['show_counter'] = intval($pt_counters); } } $post_counters = get_post_meta($post->ID, 'essb_counter', true); if ($post_counters != '') { $options['show_counter'] = $post_counters; } $need_counters = $options['show_counter'] ? 1 : 0; $postfloat_percent = isset($options['postfloat_percent']) ? $options['postfloat_percent'] : ''; $this->print_links_position = "top"; $display_where = isset($options['display_where']) ? $options['display_where'] : ''; if ($this->options_by_pt_active && isset($post)) { $pt_position = isset($pt_settings['position']) ? $pt_settings['position'] : ''; if ($pt_position != '') { $display_where = $pt_position; } } $post_position = get_post_meta($post->ID, 'essb_position', true); if ($post_position != '') { $display_where = $post_position; } // @since 1.3.8.2 - mobile display render in alternative way if ($this->isMobile()) { $display_position_mobile = isset($options['display_position_mobile']) ? $options['display_position_mobile'] : ''; if ($display_position_mobile != '') { $display_where = $display_position_mobile; } } //$debug_lab = microtime(true); //$execution_trance .= ' break1 '. ($debug_lab - $start) . ' | '; // @custom home position if (is_home() || is_front_page()) { $display_position_home = ESSBOptionsHelper::optionsValue($options, 'display_position_home'); if ($display_position_home != '') { $display_where = $display_position_home; } } // @since 1.3.1 sidebar is moved to bottom render to avoid pop in excerpts $this->print_links_position = "top"; $sidebar_draw_in_footer = isset($options['sidebar_draw_in_footer']) ? $options['sidebar_draw_in_footer'] : 'false'; $sidebar_draw_in_footer = 'true'; if ($sidebar_draw_in_footer == 'true' && $display_where == 'sidebar') { $display_where = 'moved-footer'; } if ($display_where == 'float' && $float_onsingle_only) { if (is_archive() || is_front_page() || is_search() || is_tag() || is_post_type_archive() || is_home()) { $display_where = "top"; } } $cache_key_post = ""; if (isset($post)) { $cache_key_post = "essb_post_" . $post->ID; } if ($display_where != 'moved-footer') { if (defined('ESSB_CACHE_ACTIVE')) { $cache_key = $cache_key_post . '_' . $display_where; $cached_data = ESSBCache::get($cache_key); if ($cached_data == '') { $cached_data = $this->generate_share_snippet(array(), $need_counters); ESSBCache::put($cache_key, $cached_data); } $links = $cached_data; } else { $links = $this->generate_share_snippet(array(), $need_counters); } } if ('sidebar' == $display_where) { $content = '<div class="essb_sidebar_start_scroll"></div>' . $content; } if ('top' == $display_where || 'both' == $display_where || 'float' == $display_where || 'likeshare' == $display_where || 'sharelike' == $display_where) { $content = $links . $content; } if ('bottom' == $display_where || 'both' == $display_where || 'popup' == $display_where || 'likeshare' == $display_where || 'sharelike' == $display_where || 'sidebar' == $display_where || 'postfloat' == $display_where || 'flyin' == $display_where) { $this->print_links_position = "bottom"; if ('both' == $display_where || 'likeshare' == $display_where || 'sharelike' == $display_where) { if (defined('ESSB_CACHE_ACTIVE')) { $cache_key = $cache_key_post . '_' . $display_where . '_' . $this->print_links_position; $cached_data = ESSBCache::get($cache_key); if ($cached_data == '') { $cached_data = $this->generate_share_snippet(array(), $need_counters); ESSBCache::put($cache_key, $cached_data); } $links = $cached_data; } else { $links = $this->generate_share_snippet(array(), $need_counters); } } $content = $content . $links; } if ('inline' == $display_where) { $content = str_replace('<!--easy-share-->', $links, $content); } if ('postfloat' == $display_where && $postfloat_percent != '') { $this->essb_js_builder->include_postfloat_scroll_script($postfloat_percent); } //$debug_lab = microtime(true); //$execution_trance .= ' break2 '. ($debug_lab - $start) . ' | '; // @since 1.3.9.1 if ('sidebar' == $display_where) { $content .= '<div class="essb_sidebar_break_scroll"></div>'; } // @since 1.3.5 $another_display_sidebar = isset($options['another_display_sidebar']) ? $options['another_display_sidebar'] : 'false'; $another_display_sidebar_counter = isset($options['another_display_sidebar_counter']) ? $options['another_display_sidebar_counter'] : 'false'; $another_display_popup = isset($options['another_display_popup']) ? $options['another_display_popup'] : 'false'; $another_display_flyin = isset($options['another_display_flyin']) ? $options['another_display_flyin'] : 'false'; $another_display_postfloat = isset($options['another_display_postfloat']) ? $options['another_display_postfloat'] : 'false'; $another_display_postfloat_counter = isset($options['another_display_postfloat_counter']) ? $options['another_display_postfloat_counter'] : 'false'; // @since 1.3.9.5 post type options if ($this->options_by_pt_active && isset($post)) { $pt_another_display_sidebar = isset($pt_settings['another_display_sidebar']) ? $pt_settings['another_display_sidebar'] : ''; if ($pt_another_display_sidebar != '') { $another_display_sidebar = intval($pt_another_display_sidebar) == 1 ? 'true' : 'false'; } $pt_another_display_popup = isset($pt_settings['another_display_popup']) ? $pt_settings['another_display_popup'] : ''; if ($pt_another_display_popup != '') { $aanother_display_popup = intval($pt_another_display_popup) == 1 ? 'true' : 'false'; } $pt_another_display_postfloat = isset($pt_settings['another_display_postfloat']) ? $pt_settings['another_display_postfloat'] : ''; if ($pt_another_display_postfloat != '') { $another_display_postfloat = intval($pt_another_display_postfloat) == 1 ? 'true' : 'false'; } } //print ' $another_display_sidebar_counter = '.$another_display_sidebar_counter; //$debug_lab = microtime(true); //$execution_trance .= ' break3 '. ($debug_lab - $start) . ' | '; $post_another_display_sidebar = get_post_meta($post->ID, 'essb_another_display_sidebar', true); $post_another_display_popup = get_post_meta($post->ID, 'essb_another_display_popup', true); $post_another_display_postfloat = get_post_meta($post->ID, 'essb_another_display_postfloat', true); //print "!$post_another_display_postfloat = " . $post_another_display_postfloat; $another_display_deactivate_mobile = isset($options['another_display_deactivate_mobile']) ? $options['another_display_deactivate_mobile'] : 'false'; $post_another_display_flyin = get_post_meta($post->ID, 'essb_another_display_flyin', true); if ($post_another_display_sidebar != '') { if ($post_another_display_sidebar == "yes") { $another_display_sidebar = "true"; } else { $another_display_sidebar = "false"; } } if ($post_another_display_popup != '') { if ($post_another_display_popup == "yes") { $another_display_popup = "true"; } else { $another_display_popup = "false"; } } if ($post_another_display_flyin != '') { if ($post_another_display_flyin == "yes") { $another_display_flyin = "true"; } else { $another_display_flyin = "false"; } } if ($post_another_display_postfloat != '') { if ($post_another_display_postfloat == "yes") { $another_display_postfloat = "true"; } else { $another_display_postfloat = "false"; } } if ($sidebar_draw_in_footer == "true") { $another_display_sidebar = "false"; } // /$debug_lab = microtime(true); //$execution_trance .= ' break4 '. ($debug_lab - $start) . ' | '; if ($this->isMobile() && $another_display_deactivate_mobile == "true") { $another_display_popup = "false"; $another_display_sidebar = "false"; // fixed 1.3.9.9 $another_display_postfloat = "false"; $another_display_flyin = "false"; } if ($another_display_sidebar == "true") { $content = $content . $this->render_sidebar_code($another_display_sidebar_counter); } //$debug_lab = microtime(true); //$execution_trance .= ' break5 '. ($debug_lab - $start) . ' | '; if ($another_display_popup == "true") { $popup_content_code = ""; if (defined('ESSB_CACHE_ACTIVE')) { $cache_key = $cache_key_post . '_another_popup'; $cached_data = ESSBCache::get($cache_key); if ($cached_data == '') { $cached_data = $this->render_popup_code(); ESSBCache::put($cache_key, $cached_data); } $popup_content_code = $cached_data; } else { $popup_content_code = $this->render_popup_code(); } $content = $content . $popup_content_code; } if ($another_display_flyin == "true") { $flyin_content_code = ""; if (defined('ESSB_CACHE_ACTIVE')) { $cache_key = $cache_key_post . '_another_flyin'; $cached_data = ESSBCache::get($cache_key); if ($cached_data == '') { $cached_data = $this->render_flyin_code(); ESSBCache::put($cache_key, $cached_data); } else { $this->register_flyin_assets(); } $flyin_content_code = $cached_data; } else { $flyin_content_code = $this->render_flyin_code(); } $content = $content . $flyin_content_code; } //$debug_lab = microtime(true); //$execution_trance .= ' break6 '. ($debug_lab - $start) . ' | '; if ($another_display_postfloat == "true") { $post_float_content_code = ""; if (defined('ESSB_CACHE_ACTIVE')) { $cache_key = $cache_key_post . '_another_postfloat'; $cached_data = ESSBCache::get($cache_key); if ($cached_data == '') { $cached_data = $this->render_postfloat_code($another_display_postfloat_counter); ESSBCache::put($cache_key, $cached_data); } $post_float_content_code = $cached_data; } else { $post_float_content_code = $this->render_postfloat_code($another_display_postfloat_counter); } if ($postfloat_percent != '') { $this->essb_js_builder->include_postfloat_scroll_script($postfloat_percent); } //print "activate display as post float"; $content = $content . $post_float_content_code; } $end = microtime(true); if ($this->mycred_active) { //$content .= '<div >'.do_shortcode('[mycred_link href="http://google.com" amount="1"][/mycred_link]').'</div>'; } return $content; //return "Execution: ".($end-$start). ' secs |'. $execution_trance.$content; } else { return $content; } } else { return $content; } }