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,88 @@
<?php
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Class WCL_Setup
*
* Handles the initialization and execution of the setup wizard.
* This class extends the Setup page template to provide a multi-step setup
* experience, including various configuration options and enhancements
* for the plugin.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class WCL_Setup extends WBCR\Factory_Templates_134\Pages\Setup {
/**
* Constructor method for initializing the setup wizard.
*
* @param \Wbcr_Factory480_Plugin $plugin An instance of the plugin class that provides necessary plugin functionality and settings.
*
* @return void
* @throws Exception
*/
public function __construct(\Wbcr_Factory480_Plugin $plugin)
{
// Call parent constructor.
parent::__construct($plugin);
// Path to the directory containing step classes.
$path = WCL_PLUGIN_DIR . '/admin/pages/setup/steps';
// Registering the steps of the setup wizard.
# Step 1: Default step
$this->register_step($path . '/class-step-default.php', '\WBCR\Clearfy\Pages\Step_Default');
# Step 2: Google Page Speed (Before)
$this->register_step($path . '/class-step-google-page-speed-before.php', '\WBCR\Clearfy\Pages\Step_Google_Page_Speed_Before');
# Step 3: Plugins step
$this->register_step($path . '/class-step-plugins.php', '\WBCR\Clearfy\Pages\Step_Plugins');
# Step 4: Speed Optimization Settings
$this->register_step($path . '/class-step-setting-speed-optimize.php', '\WBCR\Clearfy\Pages\Step_Setting_Speed_Optimize');
# Step 5: SEO Optimization Settings
$this->register_step($path . '/class-step-setting-seo-optimize.php', '\WBCR\Clearfy\Pages\Step_Setting_Seo');
# Step 6: Image Optimization
$this->register_step($path . '/class-step-optimize-images.php', '\WBCR\Clearfy\Pages\Step_Optimize_Images');
# Step 7: Google Page Speed (After)
$this->register_step($path . '/class-step-google-page-speed-after.php', '\WBCR\Clearfy\Pages\Step_Google_Page_Speed_After');
# Step 8: Congratulations step
$this->register_step($path . '/class-step-congratulation.php', '\WBCR\Clearfy\Pages\Step_Congratulation');
}
/**
* Enqueues required assets (js and css) for the setup wizard.
*
* This loads additional scripts and styles specific to the setup wizard page.
*
* @param object $scripts The object to enqueue scripts.
* @param object $styles The object to enqueue styles.
*
* @return void
* @since 1.0.0
* @see FactoryPages480_AdminPage
*/
public function assets($scripts, $styles)
{
// Call parent method to enqueue default assets.
parent::assets($scripts, $styles);
// Add custom JavaScript files.
$this->scripts->add(WCL_PLUGIN_URL . '/admin/assets/js/circular-progress.js');
$this->scripts->add(WCL_PLUGIN_URL . '/admin/assets/js/setup.js');
// Add custom CSS files.
$this->styles->add(WCL_PLUGIN_URL . '/admin/assets/css/setup/page-setup.css');
}
}

View File

@@ -0,0 +1,200 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* The Step_Congratulation class represents the final step in the plugin's setup wizard.
* It provides a congratulatory message to the user after completing the setup process
* and offers information about upgrading to the Pro version for additional features.
*
* This class extends the Step_Custom class to utilize predefined methods for rendering
* the setup wizard's steps and managing navigation between steps.
*
* Properties:
* - $prev_id (protected): The identifier of the previous step in the setup wizard.
* - $id (protected): The identifier of the current step in the setup wizard.
*
* Methods:
* - get_title(): Returns the title of the step as displayed in the setup wizard.
* - html(): Outputs HTML content for displaying the congratulatory message, feature comparison
* table, and a link to upgrade to the Pro version.
* - continue_step(bool $skip = false): Handles navigation to the next step or a fallback
* redirect to the "Quick Start" page if no next step is defined.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
* /
*/
class Step_Congratulation extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $prev_id = 'step6';
protected $id = 'step7';
//protected $next_id = 'step2';
/**
* Retrieves the title text.
*
* @return string The localized title string.
*/
public function get_title(): string
{
return __("Finish", "clearfy");
}
/**
* Renders the HTML content for the plugin setup wizard completion message and Pro version features comparison table.
*
* This method generates a message indicating the completion of the plugin setup process, provides a detailed comparison of Free and Pro features,
* and includes a call-to-action button for upgrading to the Pro version.
*
* @return void Outputs the generated HTML directly to the page.
* @throws \Exception
*/
public function html(): void
{
$pricing_page_url = $this->plugin->get_support()->get_pricing_url(true, 'setup_wizard');
?>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php echo __("Congratulations, the plugin configuration is complete!", "clearfy"); ?></h3>
<p style="text-align: left;">
<?php _e('You have successfully completed the basic plugin setup! You can go to the general plugin settings to enable other options that we did not offer you.', 'clearfy'); ?>
</p>
<hr>
<div>
<p style="text-align: left;">
<?php _e("However, you can still improve your site's Google Page Speed score by simply purchasing the Pro version of our plugin.", "clearfy") ?>
</p>
<table style="width: 100%">
<thead>
<tr>
<th></th>
<th>Free</th>
<th>PRO</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://wordpress.org/plugins/cyrlitera/" target="_blank">
Transliteration of links and file names</a></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Optimize Yoast Seo</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Post tools</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Admin bar managers</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td><a href="https://wordpress.org/plugins/disable-admin-notices/" target="_blank">Disable admin
notices</a></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Disable widgets</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>
<a href="https://wordpress.org/plugins/comments-plus/" target="_blank">Disable comments</a>
</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td><a href="https://wordpress.org/plugins/gonzales/" target="_blank">Assets Manager</a></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Minify and combine (JS, CSS)</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Html minify</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td><a href="https://robinoptimizer.com/" target="_blank">Image optimizer</a></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Hide login page</td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td><a href="https://clearfy.pro/hide-my-wp/" target="_blank">Hide My Wp PRO</a></td>
<td class="wclearfy-setup__color--red"><span class="dashicons dashicons-minus"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td><a href="https://clearfy.pro/assets-manager/" target="_blank">Assets Manager PRO</a></td>
<td class="wclearfy-setup__color--red"><span class="dashicons dashicons-minus"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Multisite control</td>
<td class="wclearfy-setup__color--red"><span class="dashicons dashicons-minus"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>Update manager PRO</td>
<td class="wclearfy-setup__color--red"><span class="dashicons dashicons-minus"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
<tr>
<td>SEO friendly images PRO</td>
<td class="wclearfy-setup__color--red"><span class="dashicons dashicons-minus"></span></td>
<td class="wclearfy-setup__color--green"><span class="dashicons dashicons-yes"></span></td>
</tr>
</tbody>
</table>
<p>
<a href="<?php echo esc_url($pricing_page_url); ?>" class="wclearfy-setup__install-component-button"
target="_blank"><?php _e('Go Pro', 'clearfy') ?></a>
</p>
</div>
</div>
<?php $this->render_button(); ?>
<?php
}
/**
* Handles the continuation to the next step in a multi-step process.
*
* This method determines the next step in the process and redirects the user to the appropriate URL.
* If there are no further steps available, it redirects to a default Quick Start page.
*
* @param bool $skip Indicates whether the current step should be skipped. Defaults to false.
* @return void Redirects the user to the URL of the next step or the Quick Start page.
* @throws \Exception
*/
protected function continue_step($skip = false): void
{
$next_id = $this->get_next_id();
if (!$next_id) {
wp_safe_redirect($this->plugin->getPluginPageUrl('quick_start'));
die();
}
wp_safe_redirect($this->page->getActionUrl($next_id));
die();
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Represents the default onboarding step in the Clearfy setup wizard.
*
* This class defines the basic attributes and methods used for displaying the
* initial step of the setup wizard, including the title and HTML content.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Default extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $id = 'step0';
protected $next_id = 'step1';
/**
* Retrieves the title text.
*
* @return string The translated title text.
*/
public function get_title(): string
{
return __("Welcome", 'clearfy');
}
/**
* Renders the HTML structure for the setup wizard onboarding interface.
*
* @return void
* @throws \Exception
*/
public function html(): void
{
?>
<div class="w-factory-templates-134-setup__inner-wrap">
<div class="w-factory-templates-134-setup-step__new_onboarding-wrapper">
<p class="w-factory-templates-134-setup-step__new_onboarding-welcome">Welcome to</p>
<h1 class="w-factory-templates-134-logo">
<img src="<?php echo WCL_PLUGIN_URL ?>/admin/assets/img/clearfylogo-768x300.png" alt="Clearfy">
</h1>
<p><?php _e('Optimize your site even faster using the setup wizard!', 'clearfy') ?></p>
</div>
</div>
<?php $this->render_button(true, false, __('Yes, I want to try the wizard'), 'center'); ?>
<?php
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Class Step_Google_Page_Speed_After
*
* This class represents a step in the Clearfy plugin setup process that evaluates
* a website's performance using Google Page Speed Insights. It provides a visual
* representation of the site's performance for desktop and mobile and displays
* key metrics such as First Contentful Paint, Speed Index, and Time to Interactive.
*
* Inherits methods and properties from the Step_Custom class within the
* WBCR\Factory_Templates_134 namespace.
*
* Properties:
* - $prev_id: Identifier for the previous step in the setup process.
* - $id: Identifier for the current step in the setup process.
* - $next_id: Identifier for the next step in the setup process.
*
* Methods:
* - get_title(): Returns the title of the current step as a string.
* - html(): Outputs the HTML and JavaScript for rendering the Google Page Speed
* Insights report and embeds the Clearfy plugin optimization information.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Google_Page_Speed_After extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $prev_id = 'step5';
protected $id = 'step6';
protected $next_id = 'step7';
/**
* Retrieves the title.
*
* @return string The title of the site.
*/
public function get_title(): string
{
return __("Site test #2", 'clearfy');
}
/**
* Outputs the HTML content for displaying Google Page Speed statistics and analyses.
*
* The method integrates with the Google PageSpeed Insights API to analyze a website and display
* the results, including scores for desktop and mobile versions, and key performance metrics such
* as Speed Index and Time to Interactive. It also provides a link to view the complete results
* on the official Google PageSpeed Insights platform.
*
* Additionally, this method manages the rendering of UI components for displaying scores,
* statistics, and preloader icons.
*
* @return void
*/
public function html(): void
{
?>
<script>
jQuery(document).ready(function ($) {
wclearfy_fetch_google_pagespeed_audit("<?php echo wp_create_nonce('fetch_google_page_speed_audit') ?>", true);
});
</script>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php _e('Google Page Speed', 'clearfy'); ?></h3>
<p style="text-align: left;">
<?php _e('We analyzed your site on the Google Page Speed service. You can see the test results below. Our plugin is to improve the score of your site on Google Page Speed. Memorize the results to make a comparison after optimization by the Clearfy plugin.', 'clearfy'); ?>
</p>
<div class="wclearfy-gogle-page-speed-audit__errors">
<?php _e('Memorize the results to make a comparison after optimization by the Clearfy plugin.', 'clearfy'); ?>
</div>
<div class="wclearfy-gogle-page-speed-audit__preloader"></div>
<div class="wclearfy-gogle-page-speed-audit" style="display: none;">
<div class="wclearfy-score">
<!-- Desktop -->
<div class="wclearfy-desktop-score">
<h3><?php _e('Desktop score', 'clearfy'); ?></h3>
<div class="wclearfy-desktop-score__circle-wrap">
<div id="wclearfy-desktop-score__circle" class="wclearfy-score-circle"></div>
</div>
</div>
<!-- Mobile -->
<div class="wclearfy-mobile-score">
<h3><?php _e('Mobile score', 'clearfy'); ?></h3>
<div class="wclearfy-mobile-score__circle-wrap">
<div id="wclearfy-mobile-score__circle" class="wclearfy-score-circle"></div>
</div>
</div>
</div>
<!-- Statistics -->
<div class="wclearfy-statistic">
<div class="wclearfy-statistic__line">
<span><?php _e('First Contentful Paint', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-first-contentful-paint">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-first-contentful-paint">??&nbsp;s</span>
</div>
</div>
<div class="wclearfy-statistic__line">
<span><?php _e('Speed Index', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-speed-index">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-speed-index">??&nbsp;s</span>
</div>
</div>
<div class="wclearfy-statistic__line">
<span><?php _e('Time to Interactive', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-interactive">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-interactive">??&nbsp;s</span>
</div>
</div>
<?php
$site_url = get_home_url();
$google_page_speed_call = "https://developers.google.com/speed/pagespeed/insights/?url=" . esc_url($site_url);
?>
<div style="margin-top: 5px;font-size:12px;">
<a href="<?php echo esc_url($google_page_speed_call); ?>" target="_blank"
style="outline: 0;text-decoration: none;"><?php _e('View complete results', 'clearfy'); ?></a> <?php _e('on Google PageSpeed Insights.', 'clearfy'); ?>
</div>
</div>
</div>
</div>
<?php $this->render_button(); ?>
<?php
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Class Step_Google_Page_Speed_Before
*
* Represents a step in the process dedicated to analyzing and displaying
* Google Page Speed results before optimizations.
*
* This class extends the Step_Custom page template and provides functionality
* to fetch and display Google Page Speed Insights results for the website.
* It renders a page with pre-analysis statistics for desktop and mobile scores,
* along with detailed timing metrics such as First Contentful Paint, Speed Index,
* and Time to Interactive. The data is retrieved via an AJAX request.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Google_Page_Speed_Before extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $prev_id = 'step0';
protected $id = 'step1';
protected $next_id = 'step2';
/**
* Retrieves the title of the site.
*
* @return string The translated site title.
*/
public function get_title(): string
{
return __("Site test #1", 'clearfy');
}
/**
* Outputs the HTML and JavaScript for the Google Page Speed results interface.
* This method includes a script to initiate fetching of Google Page Speed audits and displays desktop and mobile score results.
* It also provides statistical insights and a link to view detailed results on Google PageSpeed Insights.
*
* @return void
* @throws \Exception
*/
public function html(): void
{
?>
<script>
jQuery(document).ready(function ($) {
wclearfy_fetch_google_pagespeed_audit("<?php echo wp_create_nonce('fetch_google_page_speed_audit') ?>");
});
</script>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php _e('Google Page Speed', 'clearfy') ?></h3>
<p style="text-align: left;">
<?php _e('We analyzed your site on the Google Page Speed service. You can see the test results below. Our plugin
is to improve the score of your site on Google Page Speed. Memorize the results to make a comparison after
optimization by the Clearfy plugin.', 'clearfy') ?>
</p>
<div class="wclearfy-gogle-page-speed-audit__errors"><?php _e('Memorize the results to make a comparison after
optimization by the Clearfy plugin.', 'clearfy') ?>
</div>
<div class="wclearfy-gogle-page-speed-audit__preloader"></div>
<div class="wclearfy-gogle-page-speed-audit" style="display: none;">
<div class="wclearfy-score">
<!-- Desktop -->
<div class="wclearfy-desktop-score">
<h3><?php _e('Desktop score', 'clearfy'); ?></h3>
<div class="wclearfy-desktop-score__circle-wrap">
<div id="wclearfy-desktop-score__circle" class="wclearfy-score-circle"></div>
</div>
</div>
<!-- Mobile -->
<div class="wclearfy-mobile-score">
<h3><?php _e('Mobile score', 'clearfy'); ?></h3>
<div class="wclearfy-mobile-score__circle-wrap">
<div id="wclearfy-mobile-score__circle" class="wclearfy-score-circle"></div>
</div>
</div>
</div>
<!-- Statistics -->
<div class="wclearfy-statistic">
<div class="wclearfy-statistic__line">
<span><?php _e('First Contentful Paint', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-first-contentful-paint">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-first-contentful-paint">??&nbsp;s</span>
</div>
</div>
<div class="wclearfy-statistic__line">
<span><?php _e('Speed Index', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-speed-index">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-speed-index">??&nbsp;s</span>
</div>
</div>
<div class="wclearfy-statistic__line">
<span><?php _e('Time to Interactive', 'clearfy'); ?></span>
<div class="wclearfy-statistic__results">
<span id="wclearfy-statistic__desktop-interactive">??&nbsp;s</span>&nbsp;/&nbsp;<span
id="wclearfy-statistic__mobile-interactive">??&nbsp;s</span>
</div>
</div>
<?php
$site_url = get_home_url();
$google_page_speed_call = "https://developers.google.com/speed/pagespeed/insights/?url=" . esc_url($site_url);
?>
<div style="margin-top: 5px;font-size:12px;">
<a href="<?php echo esc_url($google_page_speed_call); ?>" target="_blank"
style="outline: 0;text-decoration: none;"><?php _e('View complete results', 'clearfy'); ?></a> <?php _e('on Google PageSpeed Insights.', 'clearfy'); ?>
</div>
</div>
</div>
</div>
<?php $this->render_button(); ?>
<?php
}
}

View File

@@ -0,0 +1,219 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Class Step_Optimize_Images
*
* Represents a step for optimizing images in a setup process. This class extends the base step functionality
* to include specific operations related to optimizing images within the context of a plugin.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Optimize_Images extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $prev_id = 'step4';
protected $id = 'step5';
protected $next_id = 'step6';
/**
* Class constructor.
*
* @param \WBCR\Factory_Templates_134\Pages\Setup $page An instance of the Setup page to initialize the constructor.
* @return void
*/
public function __construct(\WBCR\Factory_Templates_134\Pages\Setup $page)
{
parent::__construct($page);
}
/**
* Retrieves the title of the current context.
*
* @return string The title "Optimize images".
*/
public function get_title(): string
{
return __("Optimize images", 'clearfy');
}
/**
* {@inheritdoc}
*/
public function assets($scripts, $styles): void
{
parent::assets($scripts, $styles);
$styles->add(WCL_PLUGIN_URL . '/admin/assets/css/setup/step-optimize-images.css');
if (defined('WRIO_PLUGIN_ACTIVE')) {
$scripts->add(WRIO_PLUGIN_URL . '/admin/assets/js/Chart.min.js', ['jquery'], 'wrio-charts');
$scripts->add(WRIO_PLUGIN_URL . '/admin/assets/js/statistic.js', ['jquery', 'wrio-charts']);
}
}
/**
* Renders the HTML for the image optimization page in the plugin interface.
*
* This method checks if the plugin is active and, if so, displays the optimization statistics
* and related user interface elements. It provides data about unoptimized, optimized, and error statistics.
* If the plugin is not active, it renders alternate HTML content.
*
* @return void
*/
public function html(): void
{
if (!defined('WRIO_PLUGIN_ACTIVE')) {
$this->alternate_html();
return;
}
$is_premium = wrio_is_license_activate();
$statistics = \WRIO_Image_Statistic::get_instance();
$data = [
'is_premium' => $is_premium,
'scope' => 'media-library',
'stats' => $statistics->get()
];
?>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php _e("Optimize images", "clearfy") ?></h3>
<p style="text-align: left;">
<?php _e("We found unoptimized images in your media library. You can run background image optimization with the Robin image optimizer component of the Clearfy plugin. Background optimization is a long process, your images will be optimized after some time, so you won't be able to immediately see the improvement in Google Page Speed, but when the images are fully optimized you will see a score increase in Google Page Speed.", "clearfy"); ?>
</p>
<div class="wio-columns wio-page-statistic">
<div>
<div class="wio-chart-container wio-overview-chart-container">
<canvas id="wio-main-chart" width="180" height="180"
data-unoptimized="<?php echo esc_attr($data['stats']['unoptimized']); ?>"
data-optimized="<?php echo esc_attr($data['stats']['optimized']); ?>"
data-errors="<?php echo esc_attr($data['stats']['error']); ?>"
style="display: block;">
</canvas>
<div id="wio-overview-chart-percent"
class="wio-chart-percent"><?php echo esc_attr($data['stats']['optimized_percent']); ?>
<span>%</span>
</div>
<p class="wio-global-optim-phrase wio-clear">
<?php _e('You optimized', 'robin-image-optimizer'); ?>
<span class="wio-total-percent">
<?php echo esc_attr($data['stats']['optimized_percent']); ?>%
</span>
<?php _e("of your website's images", 'robin-image-optimizer'); ?>
</p>
</div>
<div style="margin-left:200px;">
<div id="wio-overview-chart-legend">
<ul class="wio-doughnut-legend">
<li>
<span style="background-color:#d6d6d6"></span>
<?php _e('Unoptimized', 'robin-image-optimizer'); ?>-
<span class="wio-num" id="wio-unoptimized-num">
<?php echo esc_attr($data['stats']['unoptimized']); ?>
</span>
</li>
<li>
<span style="background-color:#8bc34a"></span>
<?php _e('Optimized', 'robin-image-optimizer'); ?>-
<span class="wio-num" id="wio-optimized-num">
<?php echo esc_attr($data['stats']['optimized']); ?>
</span>
</li>
<li>
<span style="background-color:#f1b1b6"></span>
<?php _e('Error', 'robin-image-optimizer'); ?>-
<span class="wio-num" id="wio-error-num">
<?php echo esc_attr($data['stats']['error']); ?>
</span>
</li>
</ul>
</div>
<h3 class="screen-reader-text"><?php _e('Statistics', 'robin-image-optimizer'); ?></h3>
<div class="wio-bars" style="width: 90%">
<p><?php _e('Original size', 'robin-image-optimizer'); ?></p>
<div class="wio-bar-negative base-transparent wio-right-outside-number">
<div id="wio-original-bar" class="wio-progress" style="width: 100%">
<span class="wio-barnb" id="wio-original-size">
<?php echo esc_attr(wrio_convert_bytes($data['stats']['original_size'])); ?>
</span>
</div>
</div>
<p><?php _e('Optimized size', 'robin-image-optimizer'); ?></p>
<div class="wio-bar-primary base-transparent wio-right-outside-number">
<div id="wio-optimized-bar" class="wio-progress"
style="width: <?php echo ($data['stats']['percent_line']) ? esc_attr($data['stats']['percent_line']) : 100; ?>%">
<span class="wio-barnb" id="wio-optimized-size">
<?php echo esc_attr(wrio_convert_bytes($data['stats']['optimized_size'])); ?>
</span>
</div>
</div>
</div>
<div class="wio-number-you-optimized">
<p>
<span id="wio-total-optimized-attachments-pct" class="wio-number">
<?php echo esc_attr($data['stats']['save_size_percent']); ?>%
</span>
<span class="wio-text">
<?php _e("that's the size you saved <br>by using Image Optimizer", 'robin-image-optimizer'); ?>
</span>
</p>
</div>
</div>
</div>
</div>
</div>
<?php $this->render_button(true, true, __('Shedule optimization and Continue', 'clearfy')); ?>
<?php
}
/**
* Executes the continuation of the current step, optionally skipping certain processes.
*
* @param bool $skip Indicates whether to skip the current step logic. Default is false.
* @return void
*/
protected function continue_step($skip = false): void
{
if (defined('WRIO_PLUGIN_ACTIVE')) {
\WRIO_Plugin::app()->updatePopulateOption('cron_running', 'media-library');
\WRIO_Cron::start();
}
parent::continue_step($skip);
}
/**
* Outputs the HTML content for the alternate setup interface related to image optimization.
*
* This method generates a section prompting the user to install or activate the "Robin Image Optimizer" plugin.
* Includes an installation button and renders additional necessary controls for setup completion.
*
* @return void
* @throws \Exception
*/
private function alternate_html(): void
{
$install_robin_plugin_btn = $this->plugin->get_install_component_button('wordpress', 'robin-image-optimizer/robin-image-optimizer.php');
$install_robin_plugin_btn->add_class('wclearfy-setup__install-component-button');
?>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php _e("Optimize images", "clearfy") ?></h3>
<p style="text-align: left;">
<?php _e("Robin Image optimizer plugin isn't installed or activated, you need to install or activate it to optimize your images.", "clearfy"); ?>
</p>
<p style="text-align: center"><?php $install_robin_plugin_btn->render_button(); ?></p>
</div>
<?php $this->render_button(false, true); ?>
<?php
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Step_Plugins Class
*
* Represents a step in the setup process for suggesting and installing additional plugins
* and components to optimize a WordPress site.
*
* This class extends the Step_Custom class from the Factory Templates framework and
* is primarily used to present a user interface for recommending specific plugins to
* enhance site performance. It displays plugins along with their respective optimization
* scores and optional PRO scores, and provides buttons for installation.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Plugins extends \WBCR\Factory_Templates_134\Pages\Step_Custom
{
protected $prev_id = 'step1';
protected $id = 'step2';
protected $next_id = 'step3';
/**
* Retrieves the title for the setup plugins section.
*
* @return string The localized title text.
*/
public function get_title(): string
{
return __("Setup Plugins", "clearfy");
}
/**
* Renders the HTML content for displaying and installing recommended plugins and components.
*
* This method displays a structured interface that lists plugins and components
* along with their associated benefits. It provides installation buttons to include
* these plugins and components for optimizing the site.
*
* @return void
* @throws \Exception
*/
public function html(): void
{
$install_robin_plugin_btn = $this->plugin->get_install_component_button('wordpress', 'robin-image-optimizer/robin-image-optimizer.php');
$install_wp_super_cache_btn = $this->plugin->get_install_component_button('wordpress', 'wp-super-cache/wp-cache.php');
$install_assets_manager_component_btn = $this->plugin->get_install_component_button('internal', 'assets_manager');
$install_minify_and_combine_component_btn = $this->plugin->get_install_component_button('internal', 'minify_and_combine');
?>
<div class="w-factory-templates-134-setup__inner-wrap">
<h3><?php _e('Installing plugins', 'clearfy') ?></h3>
<p style="text-align: left;"><?php _e('We analyzed your site and decided that in order to get the maximum result in
optimizing your site, you will need to install additional plugins.', 'clearfy') ?></p>
<table class="form-table">
<thead>
<tr>
<th><?php _e('Plugin', 'clearfy') ?></th>
<th style="width:50px"><?php _e('Score', 'clearfy') ?></th>
<th style="width:200px"><?php _e('Score with PRO', 'clearfy') ?></th>
<th></th>
</tr>
</thead>
<tr>
<td>Robin image optimizer</td>
<td style="color:grey">+10</td>
<td style="color:green">+15</td>
<td>
<?php $install_robin_plugin_btn->render_link(); ?>
</td>
</tr>
<tr>
<td>Assets manager component</td>
<td style="color:grey">+5</td>
<td style="color:green">+10</td>
<td><?php $install_assets_manager_component_btn->render_link(); ?></td>
</tr>
<!--<tr>
<td>WP Super Cache</td>
<td style="color:grey">+8</td>
<td></td>
<td><?php /*$install_wp_super_cache_btn->renderLink(); */ ?></td>
</tr>-->
<tr>
<td>Minify and Combine component</td>
<td style="color:grey">+10</td>
<td style="color:green">+15</td>
<td><?php $install_minify_and_combine_component_btn->render_link(); ?></td>
</tr>
</table>
</div>
<?php $this->render_button(); ?>
<?php
}
}

View File

@@ -0,0 +1,186 @@
<?php
namespace WBCR\Clearfy\Pages;
/**
* Class Step_Setting_Seo
*
* Represents a page step within the "Clearfy" plugin meant for configuring SEO-related settings.
* Extends the Step_Form class provided by WBCR Factory Templates framework.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Setting_Seo extends \WBCR\Factory_Templates_134\Pages\Step_Form
{
protected $prev_id = 'step3';
protected $id = 'step4';
protected $next_id = 'step5';
/**
* Retrieves the title for the "Optimize SEO" feature.
*
* @return string The translated title for the "Optimize SEO" feature.
*/
public function get_title(): string
{
return __("Optimize SEO", "clearfy");
}
/**
* Retrieves the description for the settings form.
*
* @return string The translated description recommending settings to complement the SEO plugin.
*/
public function get_form_description(): string
{
return __('Recommended settings that can complement your SEO plugin.', 'clearfy');
}
/**
* Retrieves the configuration options for the form used in the system.
* These options define the properties of form controls, including type, layout, default values, and hints.
* The options also include conditional events based on plugin components, such as Yoast SEO.
*
* @return array An array of form configuration options. Each option is an associative array containing keys like type, way, name, title,
* layout, hint, default values, and conditional events related to plugin activation.
*/
public function get_form_options(): array
{
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'content_image_auto_alt',
'title' => __('Automatically set the alt attribute', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('The alt attribute is mandatory, so most SEO experts say. If you missed or did not fill it at all, it will be automatically assigned and will be equal to the title of the article.', 'clearfy') . '<br><br><b>Clearfy: </b>' . sprintf(__('Replaces the %s, on attribute with an article name %s', 'clearfy'), '<code>img scr="" alt=""</code>', '<code>img scr="" alt="Hello world"</code>'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'set_last_modified_headers',
'title' => __('Automatically insert the Last Modified header', 'clearfy'),
'default' => false,
'layout' => ['hint-type' => 'icon'],
'hint' => __('Automatically insert the Last Modified header', 'clearfy') . '<br><b>Clearfy: </b>' . __('Removes attachment pages and puts a redirect.', 'clearfy'),
'eventsOn' => [
'show' => '.factory-control-disable_frontpage_last_modified_headers'
],
'eventsOff' => [
'hide' => '.factory-control-disable_frontpage_last_modified_headers'
]
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'if_modified_since_headers',
'title' => __('Return an If-Modified-Since responce', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('Return an If-Modified-Since responce.', 'clearfy') . '<br><b>Clearfy: </b>' . __('Removes attachment pages and puts a redirect.', 'clearfy'),
'default' => false
];
if ($this->plugin->isActivateComponent('yoast_seo')) {
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_last_item_breadcrumb_yoast',
'title' => __('Remove duplicate names in breadcrumbs WP SEO by Yoast', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('The last element in the breadcrumbs in the Yoast SEO plugin duplicates the title of the article. Some SEO-specialists consider this duplication to be superfluous.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes duplication of the name in the breadcrumbs of the WP SEO plugin from Yoast.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_image_from_xml_sitemap',
'title' => sprintf(__('Remove the tag %s from XML site map', 'clearfy'), 'image:image'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Yandex.Webmaster swears on a standard XML card from the plugin Yoast, tk. it has a specific tag', 'clearfy') . 'image:image<br><br><b>Clearfy: </b>' . sprintf(__('Remove the tag %s from XML site map of the plugin Yoast SEO.', 'clearfy'), 'image:image') . '<br>--<br><span class="wbcr-factory-light-orange-color">' . __('Attention! After activation, turn off the site map and enable it back to regenerate it.', 'clearfy') . '</span>' . '<br><span class="wbcr-factory-light-orange-color">' . __('In older versions of Yoast SEO may not work - update the plugin Yoast', 'clearfy') . '</span>',
'default' => true,
'eventsOn' => []
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_json_ld_search',
'title' => __('Disable JSON-LD sitelinks searchbox', 'clearfy') . '</span>',
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('If youre not familiar with Search Action its the mark-up that helps search engines add a shiny Sitelinks Search Box below your search engine results. For the majority of webmasters the extra search box is an absolutely fantastic feature but for many its not required or wanted, especially if a site only has a few pages or if the site uses a customised search platform that only searches blog posts and not pages.', 'clearfy') . ' <br><b>Clearfy: </b>' . __('Disable JSON-LD sitelinks searchbox using WordPress in plugin Yoast SEO.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_json_ld_output',
'title' => __('Disable Yoast Structured Data', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text"></span>',
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Prevents output of the script tag of type application/ld+json containing
schema.org data from the popular Yoast SEO and Yoast SEO Premium plugins.
There is currently no UI to do so.', 'clearfy') . ' <br><b>Clearfy: </b>' . __('Disable Structured Data in plugin Yoast SEO.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_head_comment',
'title' => sprintf(__('Remove comment from %s section', 'clearfy'), 'head'),
'layout' => ['hint-type' => 'icon'],
'hint' => sprintf(__('The Yoast SEO plugin displays a comment of the form %s in %s section', 'clearfy'), '!-- This site is optimized with the Yoast SEO plugin v3.1.1 - https://yoast.com/wordpress/plugins/seo/ --', 'head') . '<br><br><b>Clearfy: </b>' . sprintf(__('Removes the Yoast SEO plugin comment of their section %s', 'clearfy'), 'head'),
'default' => true
];
}
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_date',
'title' => __('Remove archives date', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => sprintf(__('Many duplicates in date archives. Imagine, in addition, that your article will be displayed in the main and in the category, you will still receive at least 3 duplicates: in archives by year, month and date, for example %s.', 'clearfy'), '/2016/2016/02 / /2016/02/15') . '<br><b>Clearfy: </b>' . __('Removes all pages with the date archives and puts a redirect.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_author',
'title' => __('Remove author archives ', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => sprintf(__('If the site is only filled by you - a mandatory item. Allows you to get rid of duplicates on user archives, for example %s.', 'clearfy'), '/author/admin/') . '<br><b>Clearfy: </b>' . __('Removes all pages with the author archives and puts a redirect.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'attachment_pages_redirect',
'title' => __('Remove attachment pages', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('Every of the pictures has its own page on the site. Such pages are successfully indexed and create duplicates. The site can have thousands of same-type attachment pages.', 'clearfy') . '<br><b>Clearfy: </b>' . __('Removes attachment pages and puts a redirect.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_replytocom',
'title' => __('Remove ?replytocom', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => sprintf(__('WordPress adds %s to the link "Reply" in the comments, if you use hierarchical comments.', 'clearfy'), '?replytocom') . '<br><b>Clearfy: </b>' . __('?relpytocom remove and and puts a redirect.', 'clearfy'),
'default' => true
];
return $options;
}
}

View File

@@ -0,0 +1,319 @@
<?php
namespace WBCR\Clearfy\Pages;
use JetBrains\PhpStorm\NoReturn;
/**
* Provides optimization settings for improving the speed of a WordPress site.
*
* This class extends the functionality of the Step_Form class to create a step-by-step
* interface for configuring speed optimization options, including JavaScript, CSS, and other optimizations.
*
* Class Step_Setting_Speed_Optimize
* Extends \WBCR\Factory_Templates_134\Pages\Step_Form
*
* Properties:
* - $prev_id: Represents the identifier for the previous step in the form navigation.
* - $id: The unique identifier for the current step.
* - $next_id: Represents the identifier for the next step in the form navigation.
*
* Methods:
* - get_title(): Returns the title of the current step.
* - get_form_description(): Returns the description of the form for the current step, explaining
* the benefits of caching to improve performance.
* - get_form_options(): Returns an array of configurable options related to speed optimization,
* which include enabling caching, optimizing JavaScript and CSS code, disabling unnecessary
* functionalities like emojis or RSD links. Options may also include corresponding event triggers
* to dynamically show/hide related fields or warnings.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com> <Telegram:@alex_kovalevv>
* @copyright (c) 23.07.2020, Webcraftic
* @version 1.0
*/
class Step_Setting_Speed_Optimize extends \WBCR\Factory_Templates_134\Pages\Step_Form
{
protected $prev_id = 'step2';
protected $id = 'step3';
protected $next_id = 'step4';
/**
* Retrieves the title text.
*
* @return string The translated title string.
*/
public function get_title(): string
{
return __("Optimize speed", "clearfy");
}
/**
* Retrieves the description of the form.
*
* @return string The translated description of the form.
*/
public function get_form_description(): string
{
return __('Caching allows your WordPress site to skip a lot of steps. Instead of going through the whole page generation process every time, your caching plugin makes a copy of the page
after the first load, and then serves that cached version to every subsequent user.', 'clearfy');
}
/**
* Retrieves a list of form options for configuring plugin settings.
*
* @return array An array of form configuration options, including types, names, titles, layouts, hints, default values,
* and event handlers for JavaScript and CSS optimization, as well as options for removing unnecessary
* WordPress features (e.g., emojis, RSD link, wlwmanifest link, shortlink).
*/
public function get_form_options(): array
{
/*$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'enable_cache_plugin',
'title' => __('Enable Caching', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => ['hint-type' => 'icon'],
'hint' => __('Enable simple caching. If you require expert caching, go to the advanced settings of the wp super cache plugin.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_caching_for_logged_visitors',
'title' => __('Disable caching for logged in visitors', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => ['hint-type' => 'icon'],
'hint' => __('Caching won\'t work for authenticated users.', 'clearfy'),
'default' => true
];*/
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'js_optimize',
'title' => __('Optimize JavaScript Code?', 'minify-and-combine'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
//'hint' => __('Optimize JavaScript Code.', 'minify-and-combine'),
'default' => true,
'eventsOn' => [
'show' => '#wbcr-mac-optimize-js-fields,#wbcr-mac-optimization-danger-message-1'
],
'eventsOff' => [
'hide' => '#wbcr-mac-optimize-js-fields,#wbcr-mac-optimization-danger-message-1'
]
];
/*$options[] = array(
'type' => 'html',
'html' => array( $this, 'optimizationDangerMessage1' )
);*/
$js_options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'js_aggregate',
'title' => __('Aggregate JS-files?', 'minify-and-combine'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'minify-and-combine'),
'default' => false,
'eventsOn' => [
'show' => '#wbcr-mac-optimization-danger-message-2'
],
'eventsOff' => [
'hide' => '#wbcr-mac-optimization-danger-message-2'
]
];
$js_options[] = [
'type' => 'html',
'html' => [$this, 'optimizationDangerMessage2']
];
$options[] = [
'type' => 'div',
'id' => 'wbcr-mac-optimize-js-fields',
'items' => $js_options
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'css_optimize',
'title' => __('Optimize CSS Code?', 'minify-and-combine'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('If your scripts break because of a JS-error, you might want to try this.', 'minify-and-combine'),
'default' => true,
'eventsOn' => [
'show' => '#wbcr-clr-optimize-css-fields'
],
'eventsOff' => [
'hide' => '#wbcr-clr-optimize-css-fields'
]
];
$css_options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'css_aggregate',
'title' => __('Aggregate CSS-files?', 'minify-and-combine'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.', 'minify-and-combine'),
'default' => false,
'eventsOn' => [
'show' => '#wbcr-mac-optimization-danger-message-4'
],
'eventsOff' => [
'hide' => '#wbcr-mac-optimization-danger-message-4'
]
];
$css_options[] = [
'type' => 'html',
'html' => [$this, 'optimizationDangerMessage4']
];
$options[] = [
'type' => 'div',
'id' => 'wbcr-clr-optimize-css-fields',
'items' => $css_options
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_emoji',
'title' => __('Disable Emojis', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('Emojis are fun and all, but if you are arent using them they actually load a JavaScript file (wp-emoji-release.min.js) on every page of your website. For a lot of businesses, this is not needed and simply adds load time to your site. So we recommend disabling this.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes WordPress Emojis JavaScript file (wp-emoji-release.min.js).', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_rsd_link',
'title' => __('Remove RSD Link', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('The above link is used by blog clients. If you edit your site from your browser then you dont need this. It is also used by some 3rd party applications that utilize XML-RPC requests. In most cases, this is just unnecessary code.', 'clearfy') . '<br><code>link rel="EditURI" type="application/rsd+xml" title="RSD"</code><br><br><b>Clearfy: </b>' . __('Remove RSD (Real Simple Discovery) link tag.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_wlw_link',
'title' => __('Remove wlwmanifest Link', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => '<code>link rel="wlwmanifest" type="application/wlwmanifest+xml"</code><br>' . __('This link is actually used by Windows Live Writer. If you dont know use Windows Live Writer, which we are guessing you dont, this is just unnecessary code.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Remove wlwmanifest (Windows Live Writer) link tag.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_shortlink_link',
'title' => __('Remove Shortlink', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => sprintf(__('By default, the following tag shows up in every WordPress install. %s This is used for a shortlink to your pages and posts. However, if you are already using pretty permalinks, such as domain.com/post, then there is no reason to keep this, it is just unnecessary code.', 'clearfy'), '<br><code>link rel="shortlink" href="https://domain.com?p=712"</code><br>') . '<br><br><b>Clearfy: </b>' . __('Remove Shortlink link tag.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_adjacent_posts_link',
'title' => __('Remove links to previous, next post', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('If you use Wordpress as a CMS, then you can delete these links, they can only come in handy for a blog.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Remove the previous and next post links within the wp_head of your wordpress theme.', 'clearfy'),
'default' => true
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_recent_comments_style',
'title' => __('Remove .recentcomments styles', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('WP by default for the widget "recent comments" prescribes in the code styles that are almost impossible to change, because to them apply! important.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes .recentcomments styles from head section.', 'clearfy'),
'default' => true
];
return apply_filters('wclearfy/setup_wizard/speed_optimize_step/form_options', $options);
}
/**
* Displays a warning message indicating potential risks associated with activating a specific optimization setting.
*
* @param int $selector_id The unique identifier for the warning message container. Defaults to 1.
*
* @return void Outputs the HTML structure of the warning message directly to the page.
*/
public function optimizationDangerMessage($selector_id = 1): void
{
?>
<div class="form-group">
<label class="col-sm-4 control-label"></label>
<div class="control-group col-sm-8">
<div id="wbcr-mac-optimization-danger-message-<?= $selector_id ?>" class="wbcr-clearfy-danger-message">
<?php _e('<b>This could break things!</b><br>If you notice any errors on your website after having activated this setting, just deactivate it again, and your site will be back to normal.', 'clearfy') ?>
</div>
</div>
</div>
<?php
}
/**
* Triggers a specific optimization danger message corresponding to level 1.
*
* @return void
*/
public function optimizationDangerMessage1(): void
{
$this->optimizationDangerMessage(1);
}
/**
* Triggers a specific optimization danger message corresponding to level 2.
*
* @return void
*/
public function optimizationDangerMessage2(): void
{
$this->optimizationDangerMessage(2);
}
/**
* Triggers a specific optimization danger message corresponding to level 3.
*
* @return void
*/
public function optimizationDangerMessage3(): void
{
$this->optimizationDangerMessage(3);
}
/**
* Triggers a specific optimization danger message corresponding to level 4.
*
* @return void
*/
public function optimizationDangerMessage4(): void
{
$this->optimizationDangerMessage(4);
}
/**
* Executes the continuation of the current setup wizard step, with an optional skip parameter.
*
* @param bool $skip Determines if the step should be skipped. Default is false.
* @return void
*/
protected function continue_step($skip = false): void
{
do_action('wclearfy/setup_wizard/speed_optimize_step/continue_step');
parent::continue_step();
}
}