first commit

This commit is contained in:
User A0264400
2026-04-01 23:20:16 +03:00
commit a766acdc90
23071 changed files with 4933189 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
/**
* Activator for the cyrlitera
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
* @copyright (c) 09.03.2018, Webcraftic
* @see Wbcr_Factory480_Activator
* @version 1.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCACHE_Activation extends Wbcr_Factory480_Activator {
/**
* Runs activation actions.
*
* @since 1.0.0
*/
public function activate()
{
require_once WCACHE_PLUGIN_DIR . '/includes/cache.php';
try {
WCL_Cache::activate();
} catch( Exception $e ) {
//nothing
}
}
public function deactivate()
{
require_once WCACHE_PLUGIN_DIR . '/includes/cache.php';
try {
WCL_Cache::deactivate();
} catch( Exception $e ) {
//nothing
}
}
}

View File

@@ -0,0 +1,238 @@
<?php
/**
* Clearfy quick start options
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 03.06.2020, Webcraftic
* @version 1.0
*/
add_filter('wbcr/clearfy/adminbar_menu_items', function ($menu_items) {
$nonce = wp_create_nonce('wclearfy_cache_delete');
$menu_items['clearfy-clear-all-cache'] = [
'id' => 'clearfy-clear-all-cache',
'title' => '<span class="dashicons dashicons-update"></span> ' . __('Clear all cache', 'clearfy'),
'href' => esc_url(add_query_arg([
'wclearfy_cache_delete' => '1',
'_wpnonce' => $nonce
]))
];
return $menu_items;
});
add_filter("wbcr_clearfy_group_options", function ($options) {
$options[] = [
'name' => 'enable_cache',
'title' => __('Enable cache', 'clearfy'),
'tags' => ['optimize_performance']
];
$options[] = [
'name' => 'dont_cache_for_logged_in_users',
'title' => __('Don\'t cache for logged-in users', 'clearfy'),
'tags' => ['optimize_performance']
];
$options[] = [
'name' => 'cache_reject_uri',
'title' => __('Never Cache URL(s)', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'preload_cache',
'title' => __('Preload cache', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'clear_cache_for_newpost',
'title' => __('Clear cache for new post', 'clearfy'),
'tags' => ['optimize_performance']
];
$options[] = [
'name' => 'exclude_files',
'title' => __('Filenames that can be cached', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'exclude_pages',
'title' => __('Rejected User Agents', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'gzip',
'title' => __('Gzip', 'clearfy'),
'tags' => ['optimize_performance']
];
$options[] = [
'name' => 'browser_caching',
'title' => __('Browser Caching', 'clearfy'),
'tags' => ['optimize_performance']
];
$options[] = [
'name' => 'cache_mobile',
'title' => __('Mobile', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'cache_mobile_theme',
'title' => __('Create cache for mobile theme', 'clearfy'),
'tags' => []
];
$options[] = [
'name' => 'widget_cache',
'title' => __('Widget Cache', 'clearfy'),
'tags' => ['optimize_performance']
];
return $options;
});
add_action('wclearfy/setup_wizard/speed_optimize_step/continue_step', function () {
require_once WCACHE_PLUGIN_DIR . '/includes/helpers.php';
try {
\WCL_Cache_Helpers::modifyHtaccess();
} catch( \Exception $e ) {
}
});
add_filter('wclearfy/setup_wizard/speed_optimize_step/form_options', function ($options) {
array_unshift($options, [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'enable_cache',
'title' => __('Enable cache', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('This option enable cache to generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.', 'clearfy'),
'default' => true
], [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'gzip',
'title' => __('Gzip', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Reduce the size of page decrease the page load time a lot. You can reduce the size of page with GZIP compression feature.
If the size of requested files are big, loading takes time so in this case there is needed to reduce the size of files. Gzip Compression feature compresses the pages and resources before sending so the transfer time is reduced.', 'clearfy'),
'default' => false
], [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'browser_caching',
'title' => __('Browser Caching', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Reduce the load times of pages by storing commonly used files from your website on your visitors browser.
A browser loads the css, js, images resources to display the web page to the visitors. This process is always performed.
If the commonly used files are cached by browser, the visitors browsers do not have to load them evert time so the load times of pages are reduced.', 'clearfy'),
'default' => false
]);
return $options;
});
add_action('wclearfy/cache/settings_page/after_form_save', function () {
if( WCL_Cache_Helpers::is_nginx() && WCL_Plugin::app()->getPopulateOption('enable_cache') ) {
wp_redirect(WCL_Plugin::app()->getPluginPageUrl('clearfy_cache_nginx_rules'));
exit;
}
}, 10);
add_action('wbcr/factory/pages/impressive/print_all_notices', function ($plugin, $page) {
if( "clearfy_cache" === $page->id ) {
if( WCL_Cache_Helpers::is_nginx() && WCL_Plugin::app()->getPopulateOption('enable_cache') ) {
$button = '<br><a class="btn btn-default" href="' . WCL_Plugin::app()->getPluginPageUrl('clearfy_cache_nginx_rules') . '">NGINX configuration</a>';
$page->printWarningNotice("<p>" . __("Clearfy will work out of the box on NGINX servers. But if you want to get the best performance results, place the NGINX rules we generated in your server config. It enables NGINX to directly serve previously cached files without calling WordPress or any PHP. It also adds headers to cached CSS, JS, and images via browser cache.", 'wbcr_factory_pages_480') . "</p>" . $button);
}
}
}, 10, 2);
add_filter('wclearfy/cache/htaccess_rules', function ($htaccess) {
$gzip = WCL_Plugin::app()->getPopulateOption('gzip');
if( $gzip ) {
$data = "# BEGIN GzipWClearfyCache" . "\n" . "<IfModule mod_deflate.c>" . "\n" . "AddType x-font/woff .woff" . "\n" . "AddType x-font/ttf .ttf" . "\n" . "AddOutputFilterByType DEFLATE image/svg+xml" . "\n" . "AddOutputFilterByType DEFLATE text/plain" . "\n" . "AddOutputFilterByType DEFLATE text/html" . "\n" . "AddOutputFilterByType DEFLATE text/xml" . "\n" . "AddOutputFilterByType DEFLATE text/css" . "\n" . "AddOutputFilterByType DEFLATE text/javascript" . "\n" . "AddOutputFilterByType DEFLATE application/xml" . "\n" . "AddOutputFilterByType DEFLATE application/xhtml+xml" . "\n" . "AddOutputFilterByType DEFLATE application/rss+xml" . "\n" . "AddOutputFilterByType DEFLATE application/javascript" . "\n" . "AddOutputFilterByType DEFLATE application/x-javascript" . "\n" . "AddOutputFilterByType DEFLATE application/x-font-ttf" . "\n" . "AddOutputFilterByType DEFLATE x-font/ttf" . "\n" . "AddOutputFilterByType DEFLATE application/vnd.ms-fontobject" . "\n" . "AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf" . "\n" . "</IfModule>" . "\n";
if( defined("WCLEARFY_GZIP_FOR_COMBINED_FILES") && WCLEARFY_GZIP_FOR_COMBINED_FILES ) {
$data = $data . "\n" . '<FilesMatch "\d+index\.(css|js)(\.gz)?$">' . "\n" . "# to zip the combined css and js files" . "\n\n" . "RewriteEngine On" . "\n" . "RewriteCond %{HTTP:Accept-encoding} gzip" . "\n" . "RewriteCond %{REQUEST_FILENAME}\.gz -s" . "\n" . "RewriteRule ^(.*)\.(css|js) $1\.$2\.gz [QSA]" . "\n\n" . "# to revent double gzip and give the correct mime-type" . "\n\n" . "RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=FORCE_GZIP]" . "\n" . "RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=FORCE_GZIP]" . "\n" . "Header set Content-Encoding gzip env=FORCE_GZIP" . "\n" . "</FilesMatch>" . "\n";
}
$data = $data . "# END GzipWClearfyCache" . "\n";
$htaccess = preg_replace("/\s*\#\s?BEGIN\s?GzipWClearfyCache.*?#\s?END\s?GzipWClearfyCache\s*/s", "", $htaccess);
return $data . $htaccess;
} else {
//delete gzip rules
$htaccess = preg_replace("/\s*\#\s?BEGIN\s?GzipWClearfyCache.*?#\s?END\s?GzipWClearfyCache\s*/s", "", $htaccess);
return $htaccess;
}
});
add_filter('wclearfy/cache/htaccess_rules', function ($htaccess) {
$browser_caching = WCL_Plugin::app()->getPopulateOption('browser_caching');
if( $browser_caching ) {
$data = "
# BEGIN LBCWClearfyCache
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault 'access plus 1 month'
ExpiresByType text/cache-manifest 'access plus 0 seconds'
ExpiresByType text/html 'access plus 0 seconds'
ExpiresByType text/xml 'access plus 0 seconds'
ExpiresByType application/xml 'access plus 0 seconds'
ExpiresByType application/json 'access plus 0 seconds'
ExpiresByType application/rss+xml 'access plus 1 hour'
ExpiresByType application/atom+xml 'access plus 1 hour'
ExpiresByType image/x-icon 'access plus 1 week'
ExpiresByType image/gif 'access plus 4 months'
ExpiresByType image/png 'access plus 4 months'
ExpiresByType image/jpeg 'access plus 4 months'
ExpiresByType image/webp 'access plus 4 months'
ExpiresByType video/ogg 'access plus 4 months'
ExpiresByType audio/ogg 'access plus 4 months'
ExpiresByType video/mp4 'access plus 4 months'
ExpiresByType video/webm 'access plus 4 months'
ExpiresByType text/x-component 'access plus 1 month'
ExpiresByType font/ttf 'access plus 4 months'
ExpiresByType font/otf 'access plus 4 months'
ExpiresByType font/woff 'access plus 4 months'
ExpiresByType font/woff2 'access plus 4 months'
ExpiresByType image/svg+xml 'access plus 1 month'
ExpiresByType application/vnd.ms-fontobject 'access plus 1 month'
ExpiresByType text/css 'access plus 1 year'
ExpiresByType application/javascript 'access plus 1 year'
</IfModule>
# END LBCWClearfyCache";
if( !preg_match("/BEGIN\s*LBCWClearfyCache/", $htaccess) ) {
return $data . $htaccess;
} else {
return $htaccess;
}
} else {
//delete levere browser caching
$htaccess = preg_replace("/#\s?BEGIN\s?LBCWClearfyCache.*?#\s?END\s?LBCWClearfyCache/s", "", $htaccess);
return $htaccess;
}
});
//add_action('wfactory/activated_' . WCL_Plugin::app()->getPluginName() . '_component', function ($component_name) {
//todo: Проверить совместимость с плагинами, включить или отключить компонент в зависимсти от результатов
//});

View File

@@ -0,0 +1,2 @@
<?php
// Silence is golden.

View File

@@ -0,0 +1,221 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'WBCR\Factory_Templates_134\Pages\PageBase' ) ) {
return;
}
class WCL_CacheProNginxRulesPage extends WBCR\Factory_Templates_134\Pages\PageBase {
/**
* The id of the page in the admin menu.
*
* Mainly used to navigate between pages.
*
* @see FactoryPages480_AdminPage
*
* @since 1.0.0
* @var string
*/
public $id = "clearfy_cache_nginx_rules";
/**
* @var string
*/
public $page_parent_page = "none";
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-clock';
/**
* @var bool
*/
//public $internal = false;
/**
* @var string
*/
public $type = 'page';
public $available_for_multisite = true;
/**
* Show on the page a search form for search options of plugin?
*
* @since 2.2.0 - Added
* @var bool - true show, false hide
*/
public $show_search_options_form = false;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Nginx Rules', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
public function getPageTitle()
{
return __('Nginx Rules', 'clearfy');
}
public function showPageContent()
{
?>
<div class="form-group">
<h2><?php
_e('Nginx Configuration Rules', 'clearfy') ?></h2>
<p>
<?php
_e('It enables NGINX to directly serve previously cached files without calling WordPress or any PHP. It also adds headers to cached CSS, JS, and images via browser cache.', 'clearfy') ?>
</p>
<p>
<?php
_e('Unfortunately, our plugin does not have the ability to automatically configure the nginx server. You have to copy the rules below and paste into your server config file.', 'clearfy') ?>
</p>
<p>
<?php
_e('Copy and paste the following code snippet in the server { } block of “default” file (or whatever the file is being used) located in /etc/nginx/sites-enabled/. Make sure to remove the existing location / { } block before using the one in the following code snippet.', 'clearfy') ?>
</p>
<div class="control-group">
<textarea row="50" cols="100" style="height: 500px;">
<?php
echo $this->generate_base_nginx_rules();
echo $this->generate_browser_cache_rules();
echo $this->generate_gzip_rules();
?>
</textarea>
</div>
</div>
<?php
}
protected function generate_base_nginx_rules()
{
$rules = "
#####
#CLEARFY CACHE RULES
#
set \$clearfy_bypass 1; # Should NGINX bypass WordPress and call cache file directly ?
set \$condition '';
# Do not bypass if it's a POST request
if (\$request_method = POST) {
set \$clearfy_bypass 0;
set \$clearfy_reason \"POST request\";
set \$condition \"null\";
}
# Do not bypass if arguments are found (e.g. ?page=2)
if (\$is_args) {
set \$clearfy_bypass 0;
set \$clerfy_reason \"Arguments found\";
set \$condition \"null\";
}
# Do not bypass if the site is in maintenance mode
if (-f \"\$document_root/.maintenance\") {
set \$clearfy_bypass 0;
set \$clearfy_reason \"Maintenance mode\";
set \$condition \"null\";
}
# Do not bypass if one of those cookie if found
# wordpress_logged_in_[hash] : When a user is logged in, this cookie is created (we'd rather let WP-Rocket handle that)
# wp-postpass_[hash] : When a protected post requires a password, this cookie is created.
if (\$http_cookie ~* \"(wordpress_logged_in_|wp\-postpass_|woocommerce_items_in_cart|woocommerce_cart_hash|wptouch_switch_toogle|comment_author_|comment_author_email_)\") {
set \$clearfy_bypass 0;
set \$clearfy_reason \"Cookie\";
set \$condition \"null\";
}
set \$fullurl '/wp-content/cache/all\${condition}';
#CACHE ENDING
location / {
set \$serve_url \$fullurl\${uri}index.html;
add_header X-Clearfy-Cache-Location \$serve_URL;
try_files \$serve_url \$uri \$uri/ /index.php\$is_args\$args;
}
# Debug header (when file is not cached)
add_header X-Clearfy-Nginx-Serving-Static \$clearfy_is_bypassed;
add_header X-Clearfy-Nginx-Reason \$clearfy_reason;
add_header X-Clearfy-Nginx-File \$clearfy_file;
";
return $rules;
}
private function generate_gzip_rules()
{
$rules = '
#####
# BROWSER CSS CACHE
#
location ~ /wp-content/cache/all/.*html$ {
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types image/svg+xml text/plain text/html text/xml text/css text/javascript application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript application/x-font-ttf application/vnd.ms-fontobject font/opentype font/ttf font/eot font/otf;
}
';
return $rules;
}
private function generate_browser_cache_rules()
{
$rules = '
#####
# BROWSER CSS CACHE
#
location ~* \.css$ {
etag on;
gzip_vary on;
expires 30d;
}';
$rules .= '
####
# BROWSER JS CACHE
#
location ~* \.js$ {
etag on;
gzip_vary on;
expires 30d;
}';
$rules .= '
####
# BROWSER MEDIA CACHE
#
location ~* \.(ico|gif|jpe?g|png|svg|eot|otf|woff|woff2|ttf|ogg)$ {
etag on;
expires 30d;
}';
return $rules;
}
}

View File

@@ -0,0 +1,328 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCACHE_CachePage extends WBCR\Factory_Templates_134\Pages\PageBase {
/**
* @see {@inheritDoc}
*
* @var string
*/
public $id = "clearfy_cache";
/**
* @var string
*/
public $page_parent_page = 'performance';
/**
* @see {@inheritDoc}
*
* @var string
*/
public $page_menu_dashicon = 'dashicons-performance';
/**
* @see {@inheritDoc}
*
* @var int
*/
public $page_menu_position = 20;
/**
* @see {@inheritDoc}
*
* @var bool
*/
//public $available_for_multisite = true;
protected $errors = [
98 => "<label>.htaccess was not found</label> <a target='_blank' href='http://www.wpfastestcache.com/warnings/htaccess-was-not-found/'>Read More</a>",
99 => "define('WP_CACHE', true); is needed to be added into wp-config.php",
100 => "You have to set <strong><u><a href=" . "'/wp-admin/options-permalink.php'>permalinks</a></u></strong>",
101 => "Fast Velocity Minify needs to be deactivated",
102 => 'Far Future Expiration Plugin needs to be deactivated',
103 => "SG Optimizer needs to be deactived",
104 => "AdRotate needs to be deactived",
105 => "MobilePress needs to be deactived",
106 => "Speed Booster Pack needs to be deactived",
107 => "WP Performance Score Booster needs to be deactivated<br>This plugin has aldready Gzip, Leverage Browser Caching features",
109 => "Check and Enable GZIP compression needs to be deactivated<br>This plugin has aldready Gzip feature",
110 => "GZippy needs to be deactivated<br>This plugin has aldready Gzip feature",
111 => "GZip Ninja Speed Compression needs to be deactivated<br>This plugin has aldready Gzip feature",
112 => "WordPress Gzip Compression needs to be deactivated<br>This plugin has aldready Gzip feature",
113 => "GZIP Output needs to be deactivated<br>This plugin has aldready Gzip feature",
114 => "Head Cleaner needs to be deactivated",
115 => "Far Future Expiration Plugin needs to be deactivated",
];
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Cache', 'clearfy');
$this->page_menu_short_description = __('Cache pages', 'clearfy');
if( $plugin->premium->is_activate() && $plugin->premium->is_install_package() ) {
$this->available_for_multisite = true;
}
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* We register notifications for some actions
*
* @param $notices
* @param \Wbcr_Factory480_Plugin $plugin
*
* @return array
* @see libs\factory\pages\themplates\FactoryPages480_ImpressiveThemplate
*/
public function getActionNotices($notices)
{
$notices[] = [
'conditions' => [
'wclearfy-cache-cleared' => 1
],
'type' => 'success',
'message' => 'Cache has been cleared!'
];
foreach($this->errors as $key => $error_message) {
$notices[] = [
'conditions' => [
'wclearfy-cache-error' => $key
],
'type' => 'danger',
'message' => $error_message
];
}
return $notices;
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Cache settings</strong>', 'clearfy') . '<p>' . __('A very fast caching engine for WordPress that produces static html files. You can configure caching in this section.', 'clearfy') . '</p></div>'
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'enable_cache',
'title' => __('Enable cache', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('This option enable cache to generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'dont_cache_for_logged_in_users',
'title' => __('Don\'t cache for logged-in users', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Don\'t show the cached version for logged-in users', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'gzip',
'title' => __('Gzip', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Reduce the size of page decrease the page load time a lot. You can reduce the size of page with GZIP compression feature.
If the size of requested files are big, loading takes time so in this case there is needed to reduce the size of files. Gzip Compression feature compresses the pages and resources before sending so the transfer time is reduced.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'browser_caching',
'title' => __('Browser Caching', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Reduce the load times of pages by storing commonly used files from your website on your visitors browser.
A browser loads the css, js, images resources to display the web page to the visitors. This process is always performed.
If the commonly used files are cached by browser, the visitors browsers do not have to load them evert time so the load times of pages are reduced.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'textarea',
'name' => 'cache_reject_uri',
'title' => __('Never Cache URL(s)', 'clearfy'),
//'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Specify URLs of pages or posts that should never be cached (one per line). The domain part of the URL will be stripped automatically.
Use (.*) wildcards to address multiple URLs under a given path.', 'clearfy'),
];
$options[] = [
'type' => 'textarea',
'name' => 'cache_reject_user_agents',
'title' => __('Rejected User Agents', 'clearfy'),
'default' => "facebookexternalhit\nTwitterbot\nLinkedInBot\nWhatsApp\nMediatoolkitbot",
//'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Strings in the HTTP User Agent header that prevent WP-Cache from caching bot, spiders, and crawlers requests. Note that super cached files are still sent to these agents if they already exists.', 'clearfy'),
];
$options[] = [
'type' => 'textarea',
'name' => 'cache_reject_cookies',
'title' => __('Rejected Cookies', 'clearfy'),
//'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Do not cache pages when these cookies are set. Add the cookie names here, one per line. Matches on fragments, so "test" will match "WordPress_test_cookie". (Simple caching only)', 'clearfy'),
];
$options[] = [
'type' => 'more-link',
'name' => 'cache-group',
'title' => __('Advanced options', 'clearfy'),
'count' => 8,
'items' => [
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'cache_mobile',
'title' => __('Mobile', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __("Don't show the cached version for desktop to mobile devices", 'clearfy'),
'default' => false
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'cache_mobile_theme',
'title' => __('Create cache for mobile theme', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('If you use a mobile theme, you should enable both “Mobile” and “Create cache for mobile theme” options. If you use a responsive theme, no need to use the mobile cache feature. You should disable “Mobile” and “Create cache for mobile theme” options.', 'clearfy'),
'default' => false,
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'widget_cache',
'title' => __('Widget Cache', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('You can reduce the number of sql queries with this feature.
When “Cache System” is enabled, the page is saved as a static html file, thus PHP and MySQL does not work for the page which has been cached. MySQL and PHP work to generate the html of the other pages which have not been cached yet.
Every time before the cache is created, the same widgets are generated again and again. This feature avoids generating the widgets again and again to reduce the sql queries.', 'clearfy'),
'default' => true,
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'preload_cache',
'title' => __('Preload cache', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('The preload feature stars to work after delete cache.
When the Preload feature calls the urls, the cache of urls are created automatically. When all the pages are cached, the preload stops working. When the cache is clear, it starts working again.
The Preload runs every 5 minutes. If you want set a specific interval. Note: The preload feature works with the WP_CRON system.', 'clearfy'),
'default' => false
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'clear_cache_for_newpost',
'title' => __('Clear cache for new post', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Clear cache files when a post or page is published', 'clearfy'),
'default' => true
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'clear_cache_for_updated_post',
'title' => __('Clear cache for updated Post', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Clear cache files when a post or page is updated', 'clearfy'),
'default' => true
],
[
'type' => 'textarea',
'name' => 'exclude_files',
'title' => __('Filenames that can be cached', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Add here those filenames that can be cached, even if they match one of the rejected substring specified above.', 'clearfy'),
'default' => 'wp-comments-popup.php
wp-links-opml.php
wp-locations.php
'
],
[
'type' => 'textarea',
'name' => 'exclude_pages',
'title' => __('Rejected User Agents', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Strings in the HTTP User Agent header that prevent WP-Cache from caching bot, spiders, and crawlers requests. Note that super cached files are still sent to these agents if they already exists.', 'clearfy'),
'default' => 'bot
ia_archive
slurp
crawl
spider
Yandex
'
]
]
];
$form_options = [];
$form_options[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters('wclearfy_cache_form_options', $form_options, $this);
}
public function afterFormSave()
{
try {
do_action("wclearfy/cache/settings_page/after_form_save");
WCL_Cache_Helpers::modifyHtaccess();
} catch( Exception $e ) {
if( !empty($e->getCode()) && isset($this->errors[$e->getCode()]) ) {
$this->redirectToAction('index', ['wclearfy-cache-error' => $e->getCode()]);
}
}
}
}