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,50 @@
<?php
/**
* This file groups the settings for quick setup
*
* @author Webcraftic <wordpress.webraftic@gmail.com>
* @copyright (c) 16.09.2017, Webcraftic
* @version 1.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once WCL_PLUGIN_DIR . '/admin/includes/classes/class.install-plugins-button.php';
class WCL_DeletePluginsButton extends WCL_InstallPluginsButton {
/**
* @throws Exception
*/
protected function build_wordpress() {
parent::build_wordpress();
$this->action = 'delete';
$this->addData( 'plugin-action', $this->action );
$this->removeClass( 'button-primary' );
}
protected function build_internal() {
// nothing
}
/**
* @param bool $echo
*
* @return string|void
*/
public function getButton() {
$button = '<a href="#" class="' . implode( ' ', $this->get_classes() ) . '" ' . implode( ' ', $this->get_data() ) . '><span class="dashicons dashicons-trash"></span></a>';
if ( $this->type == 'internal' || ! $this->isPluginInstall() || $this->isPluginActivate() ) {
$button = '';
}
return $button;
}
}

View File

@@ -0,0 +1,252 @@
<?php
/**
* Class WCL_Farewell handles notices that are displayed to user about Clearfy transition.
*
* @since 2.3.4
* @author Webcraftic
* @package Clearfy
* @license GPL-2.0+
* @copyright Copyright (c) 2025, Webcraftic
*/
class WCL_Farewell {
/**
* Meta key where the option (of the time the Farewell notice was dismissed) is saved.
*
* @since 2.3.4
*
* @var string
*/
const SLUG_DISMISS_TIME = 'clearfy_farewell_dismissed';
/**
* Super Page Cache plugin page URL.
*
* @since 2.3.4
*
* @var string
*/
const URL_SUPER_PAGE_CACHE = 'https://wordpress.org/plugins/wp-cloudflare-page-cache/';
/**
* WCL_Farewell constructor.
*
* @since 2.3.4
*/
public function __construct() {
add_action( 'admin_head', [ $this, 'process_notices' ] );
}
/**
* Decide whether to display notices or not.
*
* @since 2.3.4
*/
public function process_notices() {
/**
* Current screen object.
*
* @var WP_Screen $screen
*/
$screen = get_current_screen();
if ( ! empty( $screen->base ) && ($screen->base === 'dashboard' || $screen->base === 'settings_page_quick_start-wbcr_clearfy' ) ) {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
if ( isset( $_GET['try_super_page_cache'] ) ) {
$farewell = empty( $_GET['try_super_page_cache'] ) ? time() : 0;
update_user_meta( get_current_user_id(), 'clearfy_farewell_dismissed', $farewell );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
$farewell = get_user_meta( get_current_user_id(), 'clearfy_farewell_dismissed', true );
if ( empty( $farewell ) ) {
$this->display_detailed_notice();
}
}
if ( $this->is_grace_period_ended() ) {
$this->display_short_notice();
}
}
/**
* Compare dates since detailed notice dismissal date and now.
*
* @since 2.3.4
*
* @return bool
*/
protected function is_grace_period_ended() {
$dismissed = (int) get_user_meta( get_current_user_id(), 'clearfy_farewell_dismissed', true );
if(empty($dismissed)) {
return false;
}
return (time() - $dismissed) > MONTH_IN_SECONDS;
}
/**
* Dismissable big (Gutenberg-like) dashboard-only notice about Clearfy transition.
*
* @since 2.3.4
*/
public function display_detailed_notice() {
// Only people appropriate people should see it.
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
?>
<div id="try-super-page-cache-panel" class="try-super-page-cache-panel">
<?php wp_nonce_field( 'try-super-page-cache-panel-nonce', 'trysuperpagecachepanelnonce', false ); ?>
<a
class="try-super-page-cache-panel-close" href="<?php echo esc_url( admin_url( '?try_super_page_cache=0' ) ); ?>"
aria-label="<?php esc_attr_e( 'Dismiss the Try Super Page Cache panel', 'clearfy' ); ?>">
<?php esc_html_e( 'Dismiss', 'clearfy' ); ?>
</a>
<div class="try-super-page-cache-panel-content">
<h2><?php esc_html_e( 'A More Powerful Caching Solution is Here!', 'clearfy' ); ?></h2>
<p class="about-description">
<?php esc_html_e( 'Clearfy has been acquired and is now part of Super Page Cache. We recommend switching to Super Page Cache for superior caching performance and modern features.', 'clearfy' ); ?>
</p>
<hr/>
<div class="try-super-page-cache-panel-column-container">
<div class="try-super-page-cache-panel-column try-super-page-cache-panel-image-column">
<picture>
<source srcset="about:blank" media="(max-width: 1024px)">
<img
src="<?php echo esc_url( WCL_PLUGIN_URL . '/admin/assets/img/super-page-cache-screenshot.png' ); ?>"
alt="<?php esc_attr_e( 'Screenshot from the Super Page Cache interface', 'clearfy' ); ?>"/>
</picture>
</div>
<div class="try-super-page-cache-panel-column plugin-card-super-page-cache">
<div>
<h3><?php esc_html_e( 'Switch to Super Page Cache today.', 'clearfy' ); ?></h3>
<p>
<?php esc_html_e( 'Super Page Cache delivers full-page disk caching with seamless Cloudflare CDN integration for dramatically faster load times. Featuring automatic cache purging, advanced lazy loading, and defer/delay JavaScript capabilities to eliminate render-blocking scripts and improve Core Web Vitals scores.', 'clearfy' ); ?>
</p>
<p>
<?php esc_html_e( 'Trusted by over 50,000 WordPress sites with 430+ five-star reviews. Works perfectly with WooCommerce, popular hosting providers, and major themes. Experience lightning-fast performance with setup that takes just minutes.', 'clearfy' ); ?>
</p>
</div>
<div class="try-super-page-cache-action">
<p>
<a
class="button button-primary button-hero thickbox open-plugin-details-modal"
href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=plugin-information&plugin=wp-cloudflare-page-cache&TB_iframe=true&width=600&height=550' ) ); ?>">
<?php esc_html_e( 'View Super Page Cache', 'clearfy' ); ?>
</a>
</p>
<p>
<a href="<?php echo esc_url( self::URL_SUPER_PAGE_CACHE ); ?>" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Learn more about Super Page Cache', 'clearfy' ); ?>
</a>
</p>
</div>
</div>
<div class="try-super-page-cache-panel-column plugin-card-classic-editor">
<div>
<h3><?php esc_html_e( 'We\'re retiring Clearfy.', 'clearfy' ); ?></h3>
<p>
<?php esc_html_e( 'We\'re retiring the Clearfy plugin in favor of the more powerful Super Page Cache plugin. This means that there will be no new feature updates. We will continue to maintain the Clearfy plugin for any major security issues for the next 6 months.', 'clearfy' ); ?>
</p>
<p>
<?php esc_html_e( 'We strongly recommend switching to Super Page Cache. It focuses exclusively on what it does best - making your WordPress site incredibly fast through advanced caching techniques with active development and regular updates.', 'clearfy' ); ?>
</p>
<?php
$is_premium = WCL_Plugin::app()->is_premium();
$show_premium_transfer = $is_premium && ( time() < strtotime( '2025-12-01 00:00:00' ) );
?>
<?php if ( $show_premium_transfer ) : ?>
<p style="background: #e7f7e7; padding: 12px; border-left: 3px solid #00a32a; margin-top: 15px;">
<strong><?php esc_html_e( '✓ Premium License Transfer:', 'clearfy' ); ?></strong>
<?php esc_html_e( 'We will transfer your existing Clearfy premium license to Super Page Cache during the next few days and will reach out to you via email once this is complete. If you want to speed up this process, please', 'clearfy' ); ?>
<a href="<?php echo esc_url( 'https://themeisle.com/contact/' ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'contact us', 'clearfy' ); ?></a>.
</p>
<?php elseif ( ! $is_premium ) : ?>
<p style="background: #f0f6fc; padding: 12px; border-left: 3px solid #2271b1; margin-top: 15px;">
<strong><?php esc_html_e( '🎁 Special Migration Offer:', 'clearfy' ); ?></strong>
<?php esc_html_e( 'Get 90% off Super Page Cache Pro Personal plan for the first year! Use code', 'clearfy' ); ?>
<code style="background: #fff; padding: 2px 6px; font-weight: bold;">MIGRATEFROMCLRF90</code>
<?php esc_html_e( 'at checkout. Valid for 2 weeks only.', 'clearfy' ); ?>
</p>
<?php endif; ?>
</div>
<div class="try-super-page-cache-action">
<p>
<a
class="button button-secondary button-hero"
href="<?php echo esc_url( 'https://rviv.ly/rd7CAW' ); ?>" target="_blank"
rel="noopener noreferrer">
<?php esc_html_e( 'Get 90% Off Pro', 'clearfy' ); ?>
</a>
</p>
</div>
</div>
</div>
</div>
</div>
<script>
jQuery( document ).ready( function() {
if( jQuery('#WBCR').length>0){
jQuery( '#try-super-page-cache-panel' ).insertBefore( '#WBCR' ).show();
}else{
jQuery( '#try-super-page-cache-panel' ).insertAfter( '#wpbody-content .wrap h1' ).show();
}
} );
</script>
<?php
}
/**
* Non-dismissable notice displayed to a user after detailed notice dismiss.
*
* @since 2.3.4
* @noinspection HtmlUnknownTarget
*/
public function display_short_notice() {
echo '<div class="notice notice-error"><p>';
printf(
wp_kses(
'<strong>Important:</strong> Clearfy is being retired and will no longer receive updates or support. For a faster, more reliable website experience, we recommend <a href="%1$s" class="thickbox open-plugin-details-modal">switching to Super Page Cache</a> - the modern caching solution built to deliver top performance.',
[
'br' => [],
'strong' => [],
'a' => [
'href' => [],
'target' => [],
'class' => [],
'rel' => [],
],
]
),
esc_url( admin_url( 'plugin-install.php?tab=plugin-information&plugin=wp-cloudflare-page-cache&TB_iframe=true&width=600&height=550' ) )
);
echo '</p></div>';
}
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* This file groups the settings for quick setup
* @author Webcraftic <wordpress.webraftic@gmail.com>
* @copyright (c) 16.09.2017, Webcraftic
* @version 1.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_Group {
private $group_name;
/**
* @param string $group_name
* @throws Exception
*/
public function __construct($group_name)
{
if( empty($group_name) || !is_string($group_name) ) {
throw new Exception('Empty group_name attribute.');
}
$this->group_name = $group_name;
}
/**
* @param string $group_name
* @return WCL_Group
*/
public static function getInstance($group_name)
{
return new WCL_Group($group_name);
}
/**
* @return string
*/
public function getName()
{
return $this->group_name;
}
/**
* @return WCL_Option[]
*/
public function getOptions()
{
$options = WCL_Option::getAllOptions();
$filter = array();
foreach($options as $option) {
if( $option->hasGroup($this->group_name) ) {
$filter[] = $option;
}
}
return $filter;
}
}

View File

@@ -0,0 +1,370 @@
<?php
/**
* This file groups the settings for quick setup
*
* @author Webcraftic <wordpress.webraftic@gmail.com>
* @copyright (c) 16.09.2017, Webcraftic
* @version 1.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_InstallPluginsButton {
protected $type;
protected $plugin_slug;
protected $classes = [
'button',
'wbcr-clr-proccess-button',
'wbcr-clr-update-component-button'
];
protected $data = [];
protected $base_path;
protected $action;
protected $url;
/**
* @param string $group_name
*
* @throws Exception
*/
public function __construct($type, $plugin_slug)
{
if( empty($type) || !is_string($plugin_slug) ) {
throw new Exception('Empty type or plugin_slug attribute.');
}
$this->type = $type;
$this->plugin_slug = $plugin_slug;
if( $this->type == 'wordpress' || $this->type == 'creativemotion' ) {
if( strpos(rtrim(trim($this->plugin_slug)), '/') !== false ) {
$this->base_path = $this->plugin_slug;
$base_path_parts = explode('/', $this->base_path);
if( sizeof($base_path_parts) === 2 ) {
$this->plugin_slug = $base_path_parts[0];
}
} else {
$this->base_path = $this->get_plugin_base_path_by_slug($this->plugin_slug);
}
$this->build_wordpress();
} else if( $this->type == 'internal' ) {
$this->build_internal();
} else {
throw new Exception('Invalid button type.');
}
// Set default data
$this->addData('storage', $this->type);
$this->addData('i18n', WCL_Helper::getEscapeJson($this->get_i18n()));
$this->addData('wpnonce', wp_create_nonce('updates'));
}
/**
* @return bool
*/
public function isPluginActivate()
{
if( ($this->type == 'wordpress' || $this->type == 'creativemotion') && $this->isPluginInstall() ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
return is_plugin_active($this->base_path);
} else if( $this->type == 'internal' ) {
$preinsatall_components = WCL_Plugin::app()->getPopulateOption('deactive_preinstall_components', []);
return !in_array($this->plugin_slug, $preinsatall_components);
}
return false;
}
/**
* @return bool
*/
public function isPluginInstall()
{
if( $this->type == 'wordpress' || $this->type == 'creativemotion' ) {
if( empty($this->base_path) ) {
return false;
}
// Check if the function get_plugins() is registered. It is necessary for the front-end
// usually get_plugins() only works in the admin panel.
if( !function_exists('get_plugins') ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
if( isset($plugins[$this->base_path]) ) {
return true;
}
} else if( $this->type == 'internal' ) {
return true;
}
return false;
}
/**
* @param $class
*
* @throws Exception
*/
public function addClass($class)
{
if( !is_string($class) ) {
throw new Exception('Attribute class must be a string.');
}
$this->classes[] = $class;
}
/**
* @param $class
*
* @return bool
* @throws Exception
*/
public function removeClass($class)
{
if( !is_string($class) ) {
throw new Exception('Attribute class must be a string.');
}
$key = array_search($class, $this->classes);
if( isset($this->classes[$key]) ) {
unset($this->classes[$key]);
return true;
}
return false;
}
/**
* @param $name
* @param $value
*
* @throws Exception
*/
public function addData($name, $value)
{
if( !is_string($name) || !is_string($value) ) {
throw new Exception('Attributes name and value must be a string.');
}
$this->data[$name] = $value;
}
/**
* @param $name
*
* @return bool
* @throws Exception
*/
public function removeData($name)
{
if( !is_string($name) ) {
throw new Exception('Attribute name must be a string.');
}
if( isset($this->data[$name]) ) {
unset($this->data[$name]);
return true;
}
return false;
}
/**
* Print an install button
*
* @throws \Exception
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
public function renderButton()
{
echo $this->getButton();
}
/**
* @return string
*/
public function getButton()
{
$i18n = $this->get_i18n();
$button = '<a href="#" class="' . implode(' ', $this->get_classes()) . '" ' . implode(' ', $this->get_data()) . '>' . $i18n[$this->action] . '</a>';
return $button;
}
/**
* @return string
* @throws Exception
*/
public function getLink()
{
$this->removeClass('button');
$this->removeClass('button-default');
$this->removeClass('button-primary');
//$this->addClass('link');
$this->addClass('button-link');
return $this->getButton();
}
/**
* Print an install a link
*
* @throws \Exception
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
public function renderLink()
{
echo $this->getLink();
}
/**
* @return array
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
protected function get_data()
{
$data_to_print = [];
foreach((array)$this->data as $key => $value) {
$data_to_print[$key] = 'data-' . esc_attr($key) . '="' . esc_attr($value) . '"';
}
return $data_to_print;
}
/**
* @return array
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
protected function get_classes()
{
return array_map('esc_attr', $this->classes);
}
/**
* @throws \Exception
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
protected function build_wordpress()
{
if( ('wordpress' === $this->type || 'creativemotion' === $this->type) && !empty($this->base_path) ) {
$this->action = 'install';
if( $this->isPluginInstall() ) {
$this->action = 'deactivate';
if( !$this->isPluginActivate() ) {
$this->action = 'activate';
}
}
$this->addData('plugin-action', $this->action);
$this->addData('slug', $this->plugin_slug);
$this->addData('plugin', $this->base_path);
if( $this->action == 'activate' ) {
$this->addClass('button-primary');
} else {
$this->addClass('button-default');
}
}
}
/**
* Configurate button of internal components
*
* @throws \Exception
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
protected function build_internal()
{
if( $this->type != 'internal' ) {
return;
}
$this->action = 'activate';
if( $this->isPluginActivate() ) {
$this->action = 'deactivate';
}
$this->addData('plugin-action', $this->action);
$this->addData('plugin', $this->plugin_slug);
if( $this->action == 'activate' ) {
$this->addClass('button-primary');
} else {
$this->addClass('button-default');
}
}
/**
* Internalization for action buttons
*
* @return array
* @since 1.5.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
protected function get_i18n()
{
return [
'activate' => __('Activate', 'clearfy'),
'install' => __('Install', 'clearfy'),
'deactivate' => __('Deactivate', 'clearfy'),
'delete' => __('Delete', 'clearfy'),
'loading' => __('Please wait...', 'clearfy'),
'preparation' => __('Preparation...', 'clearfy'),
'read' => __('Read more', 'clearfy')
];
}
/**
* Allows you to get the base path to the plugin in the directory wp-content/plugins/
*
* @param $slug - slug for example "clearfy", "hide-login-page"
*
* @return int|null|string - "clearfy/clearfy.php"
*/
protected function get_plugin_base_path_by_slug($slug)
{
// Check if the function get_plugins() is registered. It is necessary for the front-end
// usually get_plugins() only works in the admin panel.
if( !function_exists('get_plugins') ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
foreach($plugins as $base_path => $plugin) {
if( strpos($base_path, rtrim(trim($slug))) !== false ) {
return $base_path;
}
}
return null;
}
}

View File

@@ -0,0 +1,107 @@
<?php
/**
* This file groups the settings for quick setup
* @author Webcraftic <wordpress.webraftic@gmail.com>
* @copyright (c) 16.09.2017, Webcraftic
* @version 1.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCL_Option {
private $name;
private $title;
private $value;
private $values;
private $tags;
/**
* @param array $option_data
*
* @throws Exception
*/
public function __construct( array $option_data ) {
if ( empty( $option_data ) ) {
throw new Exception( 'Empty group_name attribute.' );
}
foreach ( $option_data as $key => $value ) {
$this->$key = $value;
}
}
/**
* @return mixed
*/
public function getName() {
return $this->name;
}
/**
* @return mixed
*/
public function getTitle() {
return $this->title;
}
/**
* @param null $group_name
*
* @return array
*/
public function getValue( $group_name = null ) {
if (
! empty( $group_name )
&& is_array( $this->values )
&& isset( $this->values[ $group_name ] )
) {
return $this->values[ $group_name ];
}
return ! empty( $this->values )
? $this->values
: [];
}
/**
* @return mixed
*/
public function getTags() {
return $this->tags;
}
/**
* @param $group_name
*
* @return bool
*/
public function hasGroup( $group_name ) {
if ( ! empty( $this->tags ) && in_array( $group_name, $this->tags ) ) {
return true;
}
return false;
}
/**
* @return WCL_Option[]
*/
public static function getAllOptions() {
$all_options = require( WCL_PLUGIN_DIR . '/admin/includes/options.php' );
$result = [];
if ( ! empty( $all_options ) ) {
foreach ( $all_options as $option_data ) {
$result[] = new WCL_Option( $option_data );
}
}
return $result;
}
}