public static function activate()
 {
     $upload_dir = wp_upload_dir();
     $base_path = $upload_dir['basedir'] . '/essb_compiled/';
     $base_url = $upload_dir['baseurl'] . '/essb_compiled/';
     if (is_ssl()) {
         $base_url = str_replace('http://', 'https://', $base_url);
     }
     if (!is_dir($base_path)) {
         if (!mkdir($base_path, 0777)) {
             return false;
         }
     }
     self::$cacheFolder = $base_path;
     self::$cacheURL = $base_url;
     define('ESSB3_PRECOMPILED_RESOURCE', true);
     self::$isActive = true;
     return true;
 }
}
if ($backup == 'true') {
    printf('<div class="essb-information-box"><div class="icon"><i class="fa fa-gear"></i></div><div class="inner">%1$s</div></div>', __('Backup of your current settings is generated. Copy generated configuration string and save it on your computer. You can use it to restore settings or transfer them to other site.', ESSB3_TEXT_DOMAIN));
}
if ($purge_cache == 'true') {
    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&section=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>
Exemplo n.º 3
0
 public function handle_save_settings()
 {
     if (@$_POST && isset($_POST['option_page'])) {
         $changed = false;
         if ('essb_settings_group' == $this->getval($_POST, 'option_page')) {
             $this->update_optons();
             $this->update_fanscounter_options();
             $this->restore_settings();
             $this->apply_readymade();
             //$this->apply_import();
             $changed = true;
             if (class_exists('ESSBDynamicCache')) {
                 ESSBDynamicCache::flush();
             }
             if (class_exists('ESSBPrecompiledResources')) {
                 ESSBPrecompiledResources::flush();
             }
             if (function_exists('purge_essb_cache_static_cache')) {
                 purge_essb_cache_static_cache();
             }
         }
         if ($changed) {
             if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
                 if (class_exists('ESSBSocialFollowersCounter')) {
                     essb_followers_counter()->settle_immediate_update();
                     $current_options = get_option(ESSB3_OPTIONS_NAME);
                     $fanscounter_clear_on_save = ESSBOptionValuesHelper::options_bool_value($current_options, 'fanscounter_clear_on_save');
                     if ($fanscounter_clear_on_save) {
                         essb_followers_counter()->clear_stored_values();
                         //print "clear active";
                     }
                 }
             }
             $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
             $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
             //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
             $goback = esc_url_raw(add_query_arg(array('settings-updated' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
             //$goback = str_replace('#038;', '', $goback);
             wp_redirect($goback);
             die;
         }
     }
     if (@$_REQUEST && isset($_REQUEST['import2x'])) {
         $this->apply_import();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('import2x');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
     if (@$_REQUEST && isset($_REQUEST['ready_style'])) {
         $this->apply_readymade();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('ready_style');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
 }
 /**
  * generate_custom_js
  * 
  * Generate custom javascript code in head of page that will not be cached
  */
 function generte_custom_js_precompiled()
 {
     if ($this->is_plugin_deactivated_on()) {
         return;
     }
     // -- loading non cachble and noasync code first
     if (count($this->js_social_apis) > 0) {
         if (!ESSBCoreHelper::is_module_deactivate_on('native')) {
             foreach ($this->js_social_apis as $network => $loaded) {
                 $this->load_social_api_code($network);
             }
         }
     }
     if (count($this->js_static_noasync_footer)) {
         foreach ($this->js_static_noasync_footer as $key => $file) {
             $this->manual_script_load($key, $file);
         }
     }
     // loading in precompiled cache mode
     $cache_key = "essb-precompiled";
     $cached_data = ESSBPrecompiledResources::get_resource($cache_key, 'js');
     if ($cached_data != '') {
         echo "<script type='text/javascript' src='" . $cached_data . "' async></script>";
         return;
     }
     $static_content = array();
     $scripts = array();
     $current_site_url = get_site_url();
     $scripts[] = implode(" ", $this->js_code);
     if (count($this->js_static) > 0) {
         foreach ($this->js_static as $key => $file) {
             $relative_path = ESSBPrecompiledResources::get_asset_relative_path($current_site_url, $file);
             $code = file_get_contents(ABSPATH . $relative_path);
             $scripts[] = $code;
             $static_content[$key] = $file;
         }
     }
     if (count($this->js_static_footer)) {
         foreach ($this->js_static_footer as $key => $file) {
             $relative_path = ESSBPrecompiledResources::get_asset_relative_path($current_site_url, $file);
             $code = file_get_contents(ABSPATH . $relative_path);
             $scripts[] = $code;
             $static_content[$key] = $file;
         }
     }
     $toc = array();
     foreach ($static_content as $handle => $item_content) {
         $toc[] = sprintf(' - %s', $handle . '-' . $item_content);
     }
     $scripts[] = sprintf("\n\n\n/* TOC:\n%s\n*/", implode("\n", $toc));
     ESSBPrecompiledResources::put_resource($cache_key, implode(' ', $scripts), 'js');
     $cached_data = ESSBPrecompiledResources::get_resource($cache_key, 'js');
     if ($cached_data != '') {
         echo "<script type='text/javascript' src='" . $cached_data . "' async></script>";
     }
 }
    function ESSBAdminMenuInit3()
    {
        global $essb_adminmenu;
        if (is_admin_bar_showing()) {
            $essb_adminmenu = new ESSBAdminBarMenu3();
        }
    }
}
if (ESSBOptionValuesHelper::is_active_module('cachedynamic')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-dynamic-cache.php';
    $cache_mode = ESSBOptionValuesHelper::options_value($essb_options, 'essb_cache_mode');
    ESSBDynamicCache::activate($cache_mode);
}
if (ESSBOptionValuesHelper::is_active_module('precompiled')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-precompiled.php';
    ESSBPrecompiledResources::activate();
}
if (ESSBOptionValuesHelper::is_active_module('cachestatic')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/core/cache/essb-static-cache.php';
}
// dynamic resource builder
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-resource-builder.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/core/essb-resource-builder-snippets.php';
include_once ESSB3_PLUGIN_ROOT . 'lib/external/mobile-detect/mobile-detect.php';
// include social network related plugin classes
if (ESSBOptionValuesHelper::is_active_module('loveyou')) {
    include_once ESSB3_PLUGIN_ROOT . 'lib/networks/essb-loveyou.php';
    define('ESSB3_LOVEYOU_ACTIVE', true);
}
if (!defined('ESSB3_LIGHTMODE')) {
    if (ESSBOptionValuesHelper::is_active_module('native')) {