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,83 @@
<?php
/**
* Default page
*
* @author Webcraftic <wordpress.webraftic@gmail.com>, Alexander Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 17.08.2019, Webcraftic
* @version 1.0
*/
class WCL_Page extends WBCR\Factory_Templates_134\Pages\PageBase {
/**
* Requests assets (js and css) for the page.
*
* @return void
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
*/
public function assets($scripts, $styles)
{
parent::assets($scripts, $styles);
$this->styles->add(WCL_PLUGIN_URL . '/admin/assets/css/components.css');
/**
* Подгружаем стили для вижета оптимизации изображений, если не установли плагин оптимизации изображений
*/
if( !defined('WIO_PLUGIN_ACTIVE') ) {
$this->styles->add(WCL_PLUGIN_URL . '/admin/assets/css/base-statistic.css');
}
$this->styles->add(WCL_PLUGIN_URL . '/admin/assets/css/general.css');
$this->scripts->add(WCL_PLUGIN_URL . '/admin/assets/js/general.js', [], 'wclearfy-general');
$params = array(
//'ajaxurl' => admin_url('admin-ajax.php'),
'flush_cache_url' => $this->getActionUrl('flush-cache-and-rules', array('_wpnonce' => wp_create_nonce('wbcr_factory_' . $this->getResultId() . '_flush_action'))),
'ajax_nonce' => wp_create_nonce('wbcr_clearfy_ajax_quick_start_nonce'),
'import_options_nonce' => wp_create_nonce('wbcr_clearfy_import_options'),
'i18n' => array(
'success_update_settings' => __('Settings successfully updated!', 'clearfy'),
'unknown_error' => __('During the setup, an unknown error occurred, please try again or contact the plugin support.', 'clearfy')
)
);
$this->scripts->localize('wbcr_clearfy_ajax', $params);
}
/**
* Действие выполняется для всех страниц Clearfy и его компонентах.
* Это простое предложение перейти на PRO версию.
*/
public function multisiteProAction()
{
if( is_multisite() && $this->plugin->isNetworkActive() ) {
$license_page_url = $this->getBaseUrl('clearfy_license');
$upgrade_url = $this->plugin->get_support()->get_pricing_url(true, 'multisite_save_settings');
$html = '<div class="wbcr-factory-templates-134-multisite-suggetion">';
$html .= '<div class="wbcr-factory-inner-contanier">';
$html .= '<h3>' . __('Upgrade to Clearfy Business', 'wbcr_factory_templates_134') . '</h3>';
$html .= '<p>' . __('Oops... Sorry for the inconvenience caused!', 'wbcr_factory_templates_134') . '</p>';
$html .= '<p>' . __('Complete multisite support is available in Clearfy Business and Clearfy Business Revolution packages only!', 'wbcr_factory_templates_134') . '</p>';
$html .= '<p>' . __('You can activate the plugin on each website and use it with zero limitations. But you cant save the plugins settings under the Super Administrator role!', 'wbcr_factory_templates_134') . '</p>';
$html .= '<p style="margin-top:20px">';
$html .= '<a href="' . $license_page_url . '" class="wbcr-factory-activate-premium" rel="noopener">' . __('Activate license ', 'wbcr_factory_templates_134') . '</a> ';
$html .= '<a href="' . $upgrade_url . '" class="wbcr-factory-purchase-premium" target="_blank" rel="noopener">' . __('Upgrade to Clearfy Business', 'wbcr_factory_templates_134') . '</a>';
$html .= '</p>';
$html .= '</div>';
$html .= '</div>';
$this->showPage($html);
return;
}
$this->redirectToAction('index');
}
}

View File

@@ -0,0 +1,195 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_AdvancedPage extends WCL_Page {
/**
* 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 = "advanced";
public $page_menu_dashicon = 'dashicons-list-view';
public $page_menu_position = 1;
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Advanced', 'clearfy');
$this->page_menu_short_description = __('Useful tweaks', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = array();
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Other', 'clearfy') . '</strong>' . '<p>' . __('In this group of settings, you can manage the adminbar.', 'clearfy') . '</p>' . '</div>'
);
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_feed',
'title' => __('Disable RSS feeds', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('By default, WordPress generates all types of different RSS feeds for your site. While RSS feeds can be useful if you are running a blog, businesses might not always utilize these. Not every site out there has a blog.', 'clearfy') . '<br><b>Clearfy: </b>' . sprintf(__('Removes a link to the RSS-feed from the %s section, closes and puts the redirect from all RSS-feeds.', 'clearfy'), '&lt;head&gt;'),
'default' => false,
'eventsOn' => [
'show' => '.factory-control-disabled_feed_behaviour'
],
'eventsOff' => [
'hide' => '.factory-control-disabled_feed_behaviour'
]
];
$options[] = [
'type' => 'dropdown',
'way' => 'buttons',
'name' => 'disabled_feed_behaviour',
'data' => [
['redirect_301', __('Redirect 301', 'clearfy')],
['redirect_404', __('Page 404', 'clearfy')],
],
'title' => __('Redirect feed requests', 'clearfy'),
'hint' => __('Forward all requests to page 404 or to the main page through 301 redirects.', 'clearfy'),
//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => 'redirect_301'
];
//============================================================
// ADMINBAR MANAGER COMPONENT
//============================================================
if( $this->plugin->isActivateComponent('adminbar_manager') ) {
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Admin bar', 'clearfy') . '</strong>' . '<p>' . __('In this group of settings, you can manage the adminbar.', 'clearfy') . '</p>' . '</div>'
);
$options[] = array(
'type' => 'dropdown',
'name' => 'disable_admin_bar',
'way' => 'buttons',
'title' => __('Disable admin top bar', 'clearfy'),
'data' => array(
array('enable', __('Default enable', 'clearfy')),
array('for_all_users', __('For all users', 'clearfy')),
array(
'for_all_users_except_administrator',
__('For all users except administrator', 'clearfy')
)
),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('In some cases, you need to disable the floating top admin panel. You can disable this panel.', 'clearfy') . '<br><b>Clearfy</b>: ' . __('Disable admin top bar.', 'clearfy'),
'default' => 'enable',
);
}
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Classic editor and Gutenberg', 'clearfy') . '</strong>' . '<p>' . __('In this group of options, you can manage revisions and post autosave.', 'clearfy') . '</p>' . '</div>'
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'revisions_disable',
'title' => __('Disable revision', 'clearfy'),
'default' => false,
'eventsOn' => [
'hide' => '.factory-control-revision_limit'
],
'eventsOff' => [
'show' => '.factory-control-revision_limit'
],
];
$options[] = [
'type' => 'dropdown',
'name' => 'revision_limit',
'title' => __('Limit Post Revisions', 'clearfy'),
'data' => [
['default', __('Wordpress default', 'clearfy')],
['15', '15 ' . __('revisions', 'clearfy')],
['20', '20 ' . __('revisions', 'clearfy')],
['25', '25 ' . __('revisions', 'clearfy')],
['30', '30 ' . __('revisions', 'clearfy')],
['35', '35 ' . __('revisions', 'clearfy')],
['40', '40 ' . __('revisions', 'clearfy')],
['45', '45 ' . __('revisions', 'clearfy')],
['50', '50 ' . __('revisions', 'clearfy')],
['55', '55 ' . __('revisions', 'clearfy')],
['60', '60 ' . __('revisions', 'clearfy')]
],
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('WordPress automatically saves revisions when you are working on posts and pages. These can begin to add up pretty quick. By default, there is no limit in place. We have seen posts with over 1,000 revisions. Multiply this by 50 pages and suddenly you have over 50,000 revisions sitting in your database. The problem with this is that you will most likely never use them and they can start slowing down your database as well as using disk space.
So we recommend either disabling or limiting your revisions. ', 'clearfy'),
'default' => 'default'
];
if( version_compare(get_bloginfo('version'), '5.0', '>=') ) {
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'gutenberg_autosave_control',
'title' => __('Gutenberg autosave control', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('By activating this option autosave feature in the Gutenberg editor will be disabled. Alternatively it also provides options in the editor to select a longer autosave interval time than the default 10 seconds.', 'clearfy'),
'default' => false
];
} else {
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_post_autosave',
'title' => __('Disable autosave', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('WordPress by default automatically saves a draft every 60 seconds (1 minute). There are reasons why you might want to change this.', 'clearfy') . '<br><b>Clearfy</b>: ' . __('Disables automatic saving of drafts.', 'clearfy'),
'default' => false
];
}
$formOptions = array();
$formOptions[] = array(
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
);
return apply_filters('wbcr_clr_additionally_form_options', $formOptions, $this);
}
}

View File

@@ -0,0 +1,237 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_ClearfySettingsPage extends WCL_Page {
/**
* The id of the page in the admin menu.
*
* Mainly used to navigate between pages.
*
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
* @var string
*/
public $id = "clearfy_settings";
/**
* @var string
*/
public $page_parent_page = 'none';
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-list-view';
/**
* @var bool
*/
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Clearfy Settings', 'clearfy');
$this->page_menu_short_description = __('Useful tweaks', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Advanced settings', 'clearfy') . '</strong>' . '<p>' . __('This group of settings allows you to configure the work of the Clearfy plugin.', 'clearfy') . '</p>' . '</div>'
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_clearfy_extra_menu',
'title' => __('Disable menu in adminbar', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'red'],
'hint' => __('This setting allows you to disable the additional menu of the Clearfy plugin, in the admin bar. This menu is required to work with the Minify and Combine and Assets Manager components.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'complete_uninstall',
'title' => __('Complete Uninstall', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __("When the plugin is deleted from the Plugins menu, also delete all plugin settings.", 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Import/Export', 'clearfy') . '</strong>' . '<p>' . __('This group of settings allows you to configure the work of the Clearfy plugin.', 'clearfy') . '</p>' . '</div>'
];
$options[] = [
'type' => 'html',
'html' => [$this, 'export']
];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Support', 'clearfy') . '</strong>' . '<p>' . __('This group of settings allows you to configure the work of the Clearfy plugin.', 'clearfy') . '</p>' . '</div>'
];
$options[] = [
'type' => 'html',
'html' => [$this, 'supports']
];
$formOptions = [];
$formOptions[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters('wbcr/clearfy/settings_form_options', $formOptions, $this);
}
public function export()
{
?>
<div class="wbcr-clearfy-export-import">
<p>
<label for="wbcr-clearfy-import-export">
<strong><?php _e('Import/Export settings', 'clearfy') ?></strong>
</label>
<textarea id="wbcr-clearfy-import-export"><?= WCL_Helper::getExportOptions(); ?></textarea>
<button class="button wbcr-clearfy-import-options-button"><?php _e('Import options', 'clearfy') ?></button>
</p>
</div>
<?php
}
public function supports()
{
?>
<div class="wbcr-clearfy-troubleshooting">
<p><?php _e('If you faced with any issues, please follow the steps below to get quickly quality support:', 'clearfy') ?></p>
<ol>
<li>
<p><?php _e('Generate a debug report which will contains inforamtion about your configuratin and installed plugins', 'clearfy') ?></p>
<p>
<a href="<?php echo wp_nonce_url($this->getActionUrl('gererate_report'), 'gererate_report'); ?>" class="button"><?php _e('Generate Debug Report', 'clearfy') ?></a>
</p>
</li>
<li>
<p><?php printf(__('Create a new ticket in our <a href="%s" target="_blank">support forum</a>, include the debug report into the message body.', 'clearfy'), "https://forum.webcraftic.com"); ?></p>
</li>
</ol>
<p style="margin-bottom: 0px;"><?php _e('We guarantee to respond you within 7 business day.', 'clearfy') ?></p>
</div>
<?php
}
/**
* Collects error and system error data
*
* @return string
*/
public function getDebugReport()
{
$run_time = number_format(microtime(true), 3);
$pps = number_format(1 / floatval($run_time), 0);
$memory_avail = ini_get('memory_limit');
$memory_used = number_format(memory_get_usage(true) / (1024 * 1024), 2);
$memory_peak = number_format(memory_get_peak_usage(true) / (1024 * 1024), 2);
$debug = '';
if( PHP_SAPI == 'cli' ) {
// if run for command line, display some info
$debug = PHP_EOL . "======================================================================================" . PHP_EOL . " Config: php " . phpversion() . " " . php_sapi_name() . " / zend engine " . zend_version() . PHP_EOL . " Load: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)" . " | Time: {$run_time}s | {$pps} req/sec" . PHP_EOL . " | Server Timezone: " . date_default_timezone_get() . " | Agent: CLI" . PHP_EOL . "======================================================================================" . PHP_EOL;
} else {
// if not run from command line, only display if debug is enabled
$debug = "" //<hr />"
. "<div style=\"text-align: left;\">" . "<hr />" . " Config: " . "<br />" . " &nbsp;&nbsp; | php " . phpversion() . " " . php_sapi_name() . " / zend engine " . zend_version() . "<br />" . " &nbsp;&nbsp; | Server Timezone: " . date_default_timezone_get() . "<br />" . " Load: " . "<br />" . " &nbsp;&nbsp; | Memory: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)" . "<br />" . " &nbsp;&nbsp; | Time: {$run_time}s &nbsp;&nbsp; | {$pps} req/sec" . "<br />" . "Url: " . "<br />" . " &nbsp;&nbsp; |" . "<br />" . " &nbsp;&nbsp; | Agent: " . (@$_SERVER["HTTP_USER_AGENT"]) . "<br />" . "Version Control: " . "<br />" . " &nbsp;&nbsp; </div>" . "<br />";
}
$debug .= "Plugins<br>";
$debug .= "=====================<br>";
$plugins = get_plugins();
require_once ABSPATH . '/wp-admin/includes/plugin.php';
foreach($plugins as $path => $plugin) {
if( is_plugin_active($path) ) {
$debug .= $plugin['Name'] . '<br>';
}
}
return $debug;
}
/**
* Generates a report about the system and plug-in error
*
* @return string
*/
public function gererateReportAction()
{
if( !(isset( $_GET[ '_wpnonce' ] ) && wp_verify_nonce( $_GET[ '_wpnonce' ], 'gererate_report' ))
|| !WCL_Plugin::app()->currentUserCan() ) {
wp_die(__('You do not have sufficient permissions to perform this action!', 'clearfy'));
}
require_once(WCL_PLUGIN_DIR . '/includes/classes/class.zip-archive.php');
$reposts_dir = WCL_PLUGIN_DIR . '/reports';
$reports_temp = $reposts_dir . '/temp';
if( !file_exists($reposts_dir) ) {
mkdir($reposts_dir, 0777, true);
}
if( !file_exists($reports_temp) ) {
mkdir($reports_temp, 0777, true);
}
$file = fopen($reports_temp . '/site-info.html', 'w+');
fputs($file, $this->getDebugReport());
fclose($file);
$download_file_name = 'webcraftic-clearfy-report-' . date('Y.m.d-H.i.s') . '.zip';
$download_file_path = WCL_PLUGIN_DIR . '/reports/' . $download_file_name;
Wbcr_ExtendedZip::zipTree(WCL_PLUGIN_DIR . '/reports/temp', $download_file_path, ZipArchive::CREATE);
array_map('unlink', glob(WCL_PLUGIN_DIR . "/reports/temp/*"));
wp_redirect(WCL_PLUGIN_URL . '/reports/' . $download_file_name);
exit;
}
}

View File

@@ -0,0 +1,206 @@
<?php
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Страница лицензирования плагина.
*
* Поддерживает режим работы с мультисаймами. Вы можете увидеть эту страницу в панели настройки сети.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
*
* @copyright (c) 2018 Webraftic Ltd
*/
class WCL_ComponentsLicensePage extends WCL_Page {
/**
* {@inheritdoc}
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @var string
*/
public $id = 'clearfy_components_license';
/**
* {@inheritdoc}
*
* @var string
*/
public $type = 'page';
/**
* {@inheritdoc}
*
* @var string
*/
public $plan_name;
/**
* {@inheritdoc}
*/
public $menu_title;
/**
* {@inheritdoc}
*/
public $page_menu_short_description;
/**
* {@inheritdoc}
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @var string
*/
public $page_parent_page;
/**
* @var int
*/
public $page_menu_position = 0;
/**
* {@inheritdoc}
*
* @var bool
*/
public $show_right_sidebar_in_options = false;
/**
* WCL_LicensePage constructor.
*
* @param \Wbcr_Factory480_Plugin $plugin
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*
*/
public function __construct(Wbcr_Factory480_Plugin $plugin)
{
$this->menu_title = __('License', 'robin-image-optimizer');
$this->page_menu_short_description = __('Product activation', 'robin-image-optimizer');
$this->plan_name = __('Clearfy Business', 'robin-image-optimizer');
parent::__construct($plugin);
}
/**
* Requests assets (js and css) for the page.
*
* @return void
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
*/
/*public function assets($scripts, $styles)
{
parent::assets($scripts, $styles);
$this->styles->add(WCL_PLUGIN_URL . '/admin/assets/css/components.css');
/**
* @param Wbcr_Factory480_StyleList $styles
* @param Wbcr_Factory480_ScriptList $scripts
*
* @since 1.4.0
*
*/
/*do_action('wbcr/clearfy/components/page_assets', $scripts, $styles);
}*/
/**
* This method simply show contents of the component page.
*
* @throws Exception
*/
public function showPageContent()
{
/**
* @since 1.4.0
*
*/
$components = apply_filters('wbcr/clearfy/license/list_components', []);
?>
<div class="wbcr-factory-page-group-header"><?php _e('<strong>Products activation</strong>.', 'clearfy') ?>
<p>
<?php _e('These are components of the plugin bundle. When you activate the plugin, all the components turned on by default. If you dont need some function, you can easily turn it off on this page.', 'clearfy') ?>
</p>
</div>
<div class="wbcr-clearfy-components">
<?php
/**
* @param array $components
*
* @since 1.6.2
*/
do_action('wbcr/clearfy/license/custom_plugins_card', $components);
?>
<?php foreach((array)$components as $component): ?>
<div class="plugin-card">
<div class="plugin-card-top">
<div class="name column-name">
<h3>
<a href="<?php echo esc_url($component['url']) ?>"
class="thickbox open-plugin-details-modal">
You use <?php echo esc_html($component['title']) ?>
<img src="<?php echo esc_attr($component['icon']) ?>" class="plugin-icon"
alt="<?php echo esc_attr($component['title']) ?>">
</a>
</h3>
</div>
<div class="desc column-description">
<?php if( 'premium' === $component['build'] ): ?>
<ul>
<?php if( !empty($component['key']) ): ?>
<li>
<strong><?php _e('License key', 'clearfy') ?>:
</strong> <?php echo esc_html($component['key']) ?>
</li>
<?php endif; ?>
<?php if( !empty($component['plan']) ): ?>
<li>
<strong><?php _e('Plan', 'clearfy') ?>:</strong>
<?php echo esc_html($component['plan']) ?>
</li>
<?php endif; ?>
<?php if( !empty($component['subscription']) ): ?>
<li>
<strong><?php _e('Type', 'clearfy') ?>:</strong>
<?php echo esc_html($component['subscription']) ?>
</li>
<?php endif; ?>
<?php if( !empty($component['plan']) ): ?>
<li>
<strong><?php _e('Expired', 'clearfy') ?>:
</strong> <?php echo esc_html($component['expiration_days']) ?> <?php _e('days remained', 'clearfy') ?>
</li>
<?php endif; ?>
</ul>
<?php else: ?>
<p><?php echo esc_html($component['description']); ?></p>
<?php endif; ?>
</div>
</div>
<div class="plugin-card-bottom">
<a href="<?php echo $this->getBaseUrl($component['license_page_id']); ?>"
class="button">
<?php if( 'premium' === $component['build'] ): ?>
<?php _e('License details') ?>
<?php else: ?>
<?php _e('Activate Premium License') ?>
<?php endif; ?>
</a>
</div>
</div>
<?php endforeach; ?>
<div class="clearfix"></div>
</div>
<?php
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,119 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_TitanSecurityPage extends WCL_Page {
/**
* The id of the page in the admin menu.
*
* Mainly used to navigate between pages.
*
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
* @var string
*/
public $id = "clearfy_titan";
public $page_parent_page = "defence";
/**
* @var string
*/
//public $page_parent_page = 'defence';
/**
* Тип страницы
* options - предназначена для создании страниц с набором опций и настроек.
* page - произвольный контент, любой html код
*
* @var string
*/
public $type = 'page';
/**
* Позиция закладки в меню плагина.
* 0 - в самом конце, 100 - в самом начале
*
* @var int
*/
//public $page_menu_position = 20;
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-shield-alt';
/**
* @var bool
*/
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Malware Scanner, Firewall', 'clearfy');
$this->page_menu_short_description = __('Firewall and Anti-virus', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Содержание страницы
*/
public function showPageContent()
{
require_once WCL_PLUGIN_DIR . '/admin/includes/classes/class.install-plugins-button.php';
$install_button = $this->plugin->get_install_component_button('creativemotion', 'anti-spam/anti-spam.php');
$install_button->add_class('wbcr-factory-purchase-premium');
?>
<script>
jQuery(document).ready(function($) {
$.wfactory_480.hooks.add('core/components/updated', function(button, component_name) {
if( component_name.plugin_action === 'install' ) {
button.removeClass('wbcr-factory-purchase-premium');
button.addClass('wbcr-factory-activate-premium');
}
if( component_name.plugin_action === 'activate' ) {
button.remove();
window.location.href = '<?= admin_url('admin.php?page=dashboard-titan_security'); ?>';
}
});
});
</script>
<div class="wbcr-factory-templates-134-multisite-suggetion">
<div class="wbcr-factory-inner-contanier">
<h3>
<a href="https://wordpress.org/plugins/anti-spam" target="_blank"><?php _e('Install Firewall and Malware scanner (Titan sucurity) component', 'clearfy') ?></a>
</h3>
<p><?php _e('Titan includes anti-spam, firewall, malware scanner, site accessibility checking, security and threats audits for WordPress websites. Our security functions provide Titan with the latest firewall rules, malware signatures, and database of malicious IP addresses all you need to ensure the security of your website.', 'clearfy') ?></p>
<p>
<?php _e('Titan is a comprehensive WordPress security solution, completed by a set of additional features as add-ons, which was placed into a simple and intuitive interface.', 'clearfy') ?>
<a href="https://wordpress.org/plugins/anti-spam" target="_blank"><?php _e('Read more', 'clearfy'); ?></a>
</p>
<p style="color:#ff4d00"><?php _e('Installing the component will not take you long, just click the install button, then activate.', 'clearfy') ?></p>
<p style="margin-top:20px">
<?php $install_button->render_link(); ?>
</p>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,156 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCL_DefencePage extends WCL_Page {
/**
* 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 = "defence";
public $page_menu_dashicon = 'dashicons-shield-alt';
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct( WCL_Plugin $plugin ) {
$this->menu_title = __( 'Defence', 'clearfy' );
$this->page_menu_short_description = __( 'Protective hacks, privacy', 'clearfy' );
parent::__construct( $plugin );
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getPageOptions() {
$options = array();
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __( '<strong>Base settings</strong>.', 'clearfy' ) . '<p>' . __( 'Basic recommended security settings.', 'clearfy' ) . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'protect_author_get',
'title' => __( 'Hide author login', 'clearfy' ),
'layout' => array( 'hint-type' => 'icon' ),
'hint' => __( 'An attacker can find out the author\'s login, using a similar request to get your site. mysite.com/?author=1', 'clearfy' ) . '<br><b>Clearfy: </b>' . __( 'Sets the redirect to exclude the possibility of obtaining a login.', 'clearfy' ),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'change_login_errors',
'title' => __( 'Hide errors when logging into the site', 'clearfy' ),
'layout' => array( 'hint-type' => 'icon' ),
'hint' => __( 'WP by default shows whether you entered a wrong login or incorrect password, which allows attackers to understand if there is a certain user on the site, and then start searching through the passwords.', 'clearfy' ) . '<br><b>Clearfy: </b>' . __( 'Changes in the text of the error so that attackers could not find the login.', 'clearfy' ),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_x_pingback',
'title' => __( 'Disable XML-RPC', 'clearfy' ),
'layout' => array( 'hint-type' => 'icon', 'hint-icon-color' => 'grey' ),
'hint' => __( 'A pingback is basically an automated comment that gets created when another blog links to you. A self-pingback is created when you link to an article within your own blog. Pingbacks are essentially nothing more than spam and simply waste resources.', 'clearfy' ) . '<br><b>Clearfy: </b>' . __( 'Removes the server responses a reference to the xmlrpc file.', 'clearfy' ),
'default' => false,
'eventsOn' => array(
'show' => '#wbcr-clearfy-xml-rpc-danger-message'
),
'eventsOff' => array(
'hide' => '#wbcr-clearfy-xml-rpc-danger-message'
)
);
$options[] = array(
'type' => 'html',
'html' => array( $this, 'xmlRpcDangerMessage' )
);
//block_xml_rpc
//disable_xml_rpc_auth
//remove_xml_rpc_tag
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __( '<strong>Hide WordPress versions</strong>', 'clearfy' ) . '<p>' . __( 'WordPress itself and many plugins shows their version at the public areas of your site. An attacker received this information may be aware of the vulnerabilities found in the version of the WordPress core or plugins.', 'clearfy' ) . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_html_comments',
'title' => __( 'Remove html comments', 'clearfy' ),
'layout' => array( 'hint-type' => 'icon', 'hint-icon-color' => 'grey' ),
'hint' => __( 'This function will remove all html comments in the source code, except for special and hidden comments. This is necessary to hide the version of installed plugins.', 'clearfy' ) . '<br><br><b>Clearfy: </b>' . __( 'Remove html comments in source code.', 'clearfy' ),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_meta_generator',
'title' => __( 'Remove meta generator', 'clearfy' ) . ' <span class="wbcr-clearfy-recomended-text">(' . __( 'Recommended', 'clearfy' ) . ')</span>',
'layout' => array( 'hint-type' => 'icon' ),
'hint' => __( 'Allows attacker to learn the version of WP installed on the site. This meta tag has no useful function.', 'clearfy' ) . '<br><b>Clearfy: </b>' . sprintf( __( 'Removes the meta tag from the %s section', 'clearfy' ), '&lt;head&gt;' ),
'default' => false
);
$form_options = array();
$form_options[] = array(
'type' => 'form-group',
'items' => apply_filters( 'wbcr_clearfy_defence_form_options', $options, $this ),
//'cssClass' => 'postbox'
);
return wbcr_factory_480_apply_filters_deprecated( 'wbcr_clr_defence_form_options', array(
$form_options,
$this
), '1.3.1', 'wbcr_clearfy_defence_form_options' );
}
/**
* Adds an html warning notification html markup.
*/
public function xmlRpcDangerMessage() {
?>
<div class="form-group">
<label class="col-sm-4 control-label"></label>
<div class="control-group col-sm-8">
<div id="wbcr-clearfy-xml-rpc-danger-message" class="wbcr-clearfy-danger-message">
<?php _e( '<b>Use this option carefully!</b><br> Plugins like jetpack may have problems using this option.', 'clearfy' ) ?>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_HideLoginPage extends WCL_Page {
/**
* 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 = "clrf_hide_login";
/**
* @var string
*/
public $page_parent_page = 'defence';
/**
* Тип страницы
* options - предназначена для создании страниц с набором опций и настроек.
* page - произвольный контент, любой html код
*
* @var string
*/
public $type = 'page';
/**
* Позиция закладки в меню плагина.
* 0 - в самом конце, 100 - в самом начале
*
* @var int
*/
public $page_menu_position = 30;
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-images-alt2';
/**
* @var bool
*/
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Hide login page', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Содержание страницы
*/
public function showPageContent()
{
require_once WCL_PLUGIN_DIR . '/admin/includes/classes/class.install-plugins-button.php';
$install_button = $this->plugin->get_install_component_button('wordpress', 'hide-login-page/hide-login-page.php');
$install_button->add_class('wbcr-factory-purchase-premium');
?>
<script>
jQuery(document).ready(function($) {
$.wfactory_480.hooks.add('core/components/updated', function(button, component_name) {
if( component_name.plugin_action === 'install' ) {
button.removeClass('wbcr-factory-purchase-premium');
button.addClass('wbcr-factory-activate-premium');
}
if( component_name.plugin_action === 'activate' ) {
button.remove();
window.location.href = '<?= $this->getBaseUrl('hlp_hide_login'); ?>';
}
});
});
</script>
<div class="wbcr-factory-templates-134-multisite-suggetion">
<div class="wbcr-factory-inner-contanier">
<h3><?php _e('Install Hide login page component', 'clearfy') ?></h3>
<p><?php _e('To start protect login page, you need to install the additional component Hide login page!', 'clearfy') ?></p>
<p><?php _e('Installing the component will not take you long, just click the install button, then activate.', 'clearfy') ?></p>
<p style="margin-top:20px">
<?php $install_button->render_link(); ?>
</p>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,107 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCL_ImageOptimizationPage extends WCL_Page {
/**
* The id of the page in the admin menu.
*
* Mainly used to navigate between pages.
*
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
* @var string
*/
public $id = "clearfy_rio";
/**
* @var string
*/
public $page_parent_page = 'performance';
/**
* Тип страницы
* options - предназначена для создании страниц с набором опций и настроек.
* page - произвольный контент, любой html код
*
* @var string
*/
public $type = 'page';
/**
* Позиция закладки в меню плагина.
* 0 - в самом конце, 100 - в самом начале
*
* @var int
*/
public $page_menu_position = 30;
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-images-alt2';
/**
* @var bool
*/
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct( WCL_Plugin $plugin ) {
$this->menu_title = __( 'Image optimization', 'clearfy' );
$this->page_menu_short_description = __( 'Compress bulk of images', 'clearfy' );
parent::__construct( $plugin );
$this->plugin = $plugin;
}
/**
* Содержание страницы
*/
public function showPageContent() {
require_once WCL_PLUGIN_DIR . '/admin/includes/classes/class.install-plugins-button.php';
$install_button = $this->plugin->get_install_component_button( 'wordpress', 'robin-image-optimizer/robin-image-optimizer.php' );
$install_button->add_class( 'wbcr-factory-purchase-premium' );
?>
<script>
jQuery(document).ready(function($) {
$.wfactory_480.hooks.add('core/components/updated', function(button, component_name) {
if( component_name.plugin_action === 'install' ) {
button.removeClass('wbcr-factory-purchase-premium');
button.addClass('wbcr-factory-activate-premium');
}
if( component_name.plugin_action === 'activate' ) {
button.remove();
window.location.href = '<?= $this->getBaseUrl( 'rio_general' ); ?>';
}
});
});
</script>
<div class="wbcr-factory-templates-134-multisite-suggetion">
<div class="wbcr-factory-inner-contanier">
<h3><?php _e( 'Install Robin Image Optimizer component', 'clearfy' ) ?></h3>
<p><?php _e( 'To start optimizing images, you need to install the additional component Robin image optimizer!', 'clearfy' ) ?></p>
<p><?php _e( 'Installing the component will not take you long, just click the install button, then activate.', 'clearfy' ) ?></p>
<p style="margin-top:20px">
<?php $install_button->render_link(); ?>
</p>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,103 @@
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Страница лицензирования плагина.
*
* Поддерживает режим работы с мультисаймами. Вы можете увидеть эту страницу в панели настройки сети.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
*
* @copyright (c) 2018 Webraftic Ltd
*/
class WCL_LicensePage extends WBCR\Factory_Templates_134\Pages\License {
/**
* {@inheritdoc}
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @var string
*/
public $id = 'clearfy_license';
/**
* {@inheritdoc}
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @var string
*/
public $page_parent_page;
/**
* WCL_LicensePage constructor.
*
* @param \Wbcr_Factory480_Plugin $plugin
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*
*/
public function __construct( Wbcr_Factory480_Plugin $plugin ) {
$this->menu_title = __( 'License', 'robin-image-optimizer' );
$this->page_menu_short_description = __( 'Product activation', 'robin-image-optimizer' );
$this->plan_name = __( 'Clearfy Business', 'robin-image-optimizer' );
if ( defined( 'WIO_PLUGIN_ACTIVE' ) && ! wrio_is_clearfy_license_activate() ) {
$this->page_parent_page = 'none';
}
parent::__construct( $plugin );
/**
* Adds a new plugin card to license components page
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.2
*/
add_filter( 'wbcr/clearfy/license/list_components', function ( $components ) {
$title = 'Free';
$icon = 'clearfy-premium-icon-256x256--lock.png';
if ( $this->is_premium ) {
$title = 'Premium';
$icon = 'clearfy-premium-icon-256x256--default.png';
}
$components[] = [
'name' => 'clearfy',
'title' => sprintf( __( 'Clearfy [%s]', 'clearfy' ), $title ),
'type' => 'internal',
'build' => $this->is_premium ? 'premium' : 'free',
'key' => $this->get_hidden_license_key(),
'plan' => $this->get_plan(),
'expiration_days' => $this->get_expiration_days(),
'quota' => $this->is_premium ? $this->premium_license->get_count_active_sites() . ' ' . __( 'of', 'clearfy' ) . ' ' . $this->premium_license->get_sites_quota() : null,
'subscription' => $this->is_premium && $this->premium_has_subscription ? sprintf( __( 'Automatic renewal, every %s', '' ), esc_attr( $this->get_billing_cycle_readable() ) ) : null,
'url' => 'https://clearfy.pro/',
'icon' => WCL_PLUGIN_URL . '/admin/assets/img/' . $icon,
'description' => __( 'Public License is a GPLv3 compatible license allowing you to change and use this version of the plugin for free. Please keep in mind this license covers only free edition of the plugin. Premium versions are distributed with other type of a license.', 'clearfy' ),
'license_page_id' => 'clearfy_license'
];
return $components;
} );
}
/**
* {@inheritdoc}
*
* @return string
* @since 1.6.0
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*/
public function get_plan_description() {
$description = '<p style="font-size: 16px;">' . __( '<b>Clearfy Business</b> is a paid package of components for the popular free WordPress plugin named Clearfy. You get access to all paid components at one price.', 'clearfy' ) . '</p>';
$description .= '<p style="font-size: 16px;">' . __( 'Paid license guarantees that you can download and update existing and future paid components of the plugin.', 'clearfy' ) . '</p>';
return $description;
}
}

View File

@@ -0,0 +1,156 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_PerformanceGooglePage extends WCL_Page {
/**
* 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 = "performance_google";
/**
* @var string
*/
public $page_parent_page = 'performance';
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-performance';
/**
* @var int
*/
public $page_menu_position = 20;
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Google services', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
public function afterFormSave()
{
$ga_cache = $this->getPopulateOption('ga_cache');
$ga_caos_remove_wp_cron = $this->getPopulateOption('ga_caos_remove_wp_cron');
if( $ga_cache ) {
if( !$ga_caos_remove_wp_cron ) {
if( !wp_next_scheduled('wbcr_clearfy_update_local_ga') ) {
wp_schedule_event(time(), 'daily', 'wbcr_clearfy_update_local_ga');
}
return;
}
}
if( (!$ga_cache || $ga_caos_remove_wp_cron) && wp_next_scheduled('wbcr_clearfy_update_local_ga') ) {
wp_clear_scheduled_hook('wbcr_clearfy_update_local_ga');
}
}
/**
* Permalinks options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getPageOptions()
{
$options = array();
/*$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Fonts and Maps</strong>.', 'clearfy') . '<p>' . __('Google Fonts and Maps strongly affect your website loading speed. Use settings below to disable or optimize Google fonts and Maps.', 'clearfy') . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'lazy_load_google_fonts',
'title' => __('Google Fonts asynchronous', 'clearfy'),
'layout' => array('hint-type' => 'icon'),
'hint' => __('By default, WordPress loads Google fonts synchronously, that is, your page will not be fully loaded until Google Fonts are loaded. This algorithm slows down the loading of your page and leads to errors when checking the site in Google Page Speed. Using this option, your Google Fonts will be loaded after your page is fully loaded. This method has a negative — you and visitors of your site will see how the font changes while loading a page, from the system to the downloadable one.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_google_fonts',
'title' => __('Disable Google Fonts', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('This function stops loading of Open Sans and other fonts used by WordPress and bundled themes (Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen, Twenty Seventeen) from Google Fonts.
Reasons for not using Google Fonts might be privacy and security, local development or production, blocking of Googles servers, characters not supported by font, performance.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_google_maps',
'title' => __('Disable Google maps', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('This function stops loading of Google Maps used by some themes or plugins.
Reasons for not using Google Maps might be privacy and security, local development or production, blocking of Googles servers, performance, not necessary, etc.', 'clearfy'),
'default' => false,
'eventsOn' => array(
'show' => '.factory-control-exclude_from_disable_google_maps,.factory-control-remove_iframe_google_maps'
),
'eventsOff' => array(
'hide' => '.factory-control-exclude_from_disable_google_maps,.factory-control-remove_iframe_google_maps'
)
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_iframe_google_maps',
'title' => __('Remove iframe Google maps', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('By default, the "Disable Google Maps" option removes maps inserted with the SCRIPT tag from the page source code. However, you can also cut out all maps inserted via the iframe by enabling this option.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'textbox',
'way' => 'buttons',
'name' => 'exclude_from_disable_google_maps',
'title' => __('Exclude pages from Disable Google Maps filter', 'clearfy'),
'hint' => __('Posts or Pages IDs separated by a ,', 'clearfy')
);*/
$form_options = array();
$form_options[] = array(
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
);
return apply_filters('wbcr_clr_google_performance_form_options', $form_options, $this);
}
}

View File

@@ -0,0 +1,477 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_PerformancePage extends WCL_Page {
/**
* @see {@inheritDoc}
*
* @var string
*/
public $id = "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;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Performance', 'clearfy');
$this->page_menu_short_description = __('Optimization js, css, fonts', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
public function afterFormSave()
{
if( $this->getPopulateOption('disable_gravatars') ) {
update_option('show_avatars', false);
} else {
update_option('show_avatars', true);
}
}
public function warningNotice()
{
parent::warningNotice();
if( !$this->plugin->getPopulateOption('revisions_disable') && $this->is_post_revision_constant() ) {
$this->printWarningNotice(__('Warning! In the wp-config.php file, a constant WP_POST_REVISIONS is found, it determines the number of revisions. Delete it so you can change this value through the admin panel.', 'clearfy'));
}
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Clear the unnecessary scripts</strong>', 'clearfy') . '<p>' . __('This set of settings will help you remove unnecessary links and code from the head section, as well as reduce your website\'s pages weight.', 'clearfy') . '</p></div>'
];
/*$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_json_rest_api',
'title' => __('Remove REST API Links', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'red'],
'hint' => __('The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects. However, a lot of sites dont use this, and therefore in most cases, it is just unnecessary code.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes REST API link tag from the front end and the REST API header link from page requests.', 'clearfy'),
'default' => false,
'eventsOn' => [
'show' => '#wbcr-clearfy-rest-api-danger-message'
],
'eventsOff' => [
'hide' => '#wbcr-clearfy-rest-api-danger-message'
]
];
$options[] = [
'type' => 'html',
'html' => [$this, 'restApiDangerMessage']
];*/
$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' => false
];
/*$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_jquery_migrate',
'title' => __('Remove jQuery Migrate', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'red'],
'hint' => __('They started adding jQuery migrate in WordPress 3.6. Most up-to-date frontend code and plugins dont require jquery-migrate.min.js. In most cases, this simply adds unnecessary load to your site. You can see this running if you launch Chrome Devtools console.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes jQuery Migrate JavaScript file (jquery-migrate.min.js).', 'clearfy') . '<br>--<br><span class="wbcr-factory-light-orange-color">' . __('Warning! If there is a broke on your site, disable this option!', 'clearfy') . '</span>',
'default' => false
];*/
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_embeds',
'title' => __('Disable Embeds', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Embeds were released with WordPress 4.4. This is basically the magic that auto converts your YouTube videos, Tweets, and URLs into pretty previews while you are editing. However, this actually loads a JavaScript file (wp-embed.min.js) on every page of your website. If you dont care about the auto converting preview (which we dont), you can disable this across your site.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes WordPress Embed JavaScript file (wp-embed.min.js)', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_bloat',
'title' => __('Remove bloat in head', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('Remove RSD Link, XFN (XHTML Friends Network) Profile Link, wlwmanifest Link, Shortlink, Remove links to previous, next post, .recentcomments styles', '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' => false
];
/*$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_dns_prefetch',
'title' => __('Remove dns-prefetch', 'clearfy'),
'layout' => array('hint-type' => 'icon'),
'hint' => sprintf(__('Since version 4.6.1 in WordPress there are new links in the section %s this type of: ', 'clearfy'), 'head') . ' <code>link rel="dns-prefetch" href="//s.w.org"</code><br><br><b>Clearfy: </b>' . sprintf(__('Removes dns-prefetch links from the %s section', 'clearfy'), 'head'),
'default' => false
);*/
/*$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' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_xfn_link',
'title' => __('Removing XFN (XHTML Friends Network) Profile Link', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('The profile attribute specifies the metadata profile address. Usually, the browser recognizes the value of this attribute and executes some conventions related to the specified profile. Loading the document itself at the specified address does not really happen, moreover, it may not exist at all.
In particular, the profile is used for the XFN microformat (XHTML Friends Network) - a way of representing relationships between people using links and rel attributes with different values. WordPress also actively uses profile in its templates.
', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Remove link tag', 'clearfy') . '<br><code>link rel="profile" href="http://gmpg.org/xfn/11"</code>',
'default' => false
];
$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' => false
];
$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' => false
];
$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' => false
];
$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' => false
];*/
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_gravatars',
'title' => __('Disable gravatars', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('This function that prevents the users gravatar being automatically obtained from gravatar.com based on their registered email. This would be useful for sites where users require an extra layer of privacy, or if you just want to prevent potentially silly or embarrasing avatar accidents.
If youre using Identicons or any other generated default avatar, the user should keep a consistent avatar unless they change their registered email.
', 'clearfy'),
'default' => false
];
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Fonts and Maps</strong>.', 'clearfy') . '<p>' . __('Google Fonts and Maps strongly affect your website loading speed. Use settings below to disable or optimize Google fonts and Maps.', 'clearfy') . '</p></div>'
);
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'lazy_load_font_awesome',
'title' => __('Font Awesome asynchronous', 'clearfy'),
'layout' => ['hint-type' => 'icon'],
'hint' => __('By default, WordPress loads Font Awesome icons synchronously, that is, your page will not be fully loaded until Font Awesome icons are loaded. This algorithm slows down the loading of your page and leads to errors when checking the site in Google Page Speed. Using this option, your Font Awesome icons will be loaded after your page is fully loaded. This method has a negative — you and visitors of your site will see changes while loading a page, from the placeholders to icons.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_dashicons',
'title' => __('Disable Dashicons', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Dashicons is the official icon font of the WordPress admin as of 3.8. Some of you have requested that we add a feature to remove Dashicons. Some themes and developers utilize this (dashicons.min.css) on the front-end of their sites.', 'clearfy'),
'default' => false
];
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'lazy_load_google_fonts',
'title' => __('Google Fonts asynchronous', 'clearfy'),
'layout' => array('hint-type' => 'icon'),
'hint' => __('By default, WordPress loads Google fonts synchronously, that is, your page will not be fully loaded until Google Fonts are loaded. This algorithm slows down the loading of your page and leads to errors when checking the site in Google Page Speed. Using this option, your Google Fonts will be loaded after your page is fully loaded. This method has a negative — you and visitors of your site will see how the font changes while loading a page, from the system to the downloadable one.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_google_fonts',
'title' => __('Disable Google Fonts', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('This function stops loading of Open Sans and other fonts used by WordPress and bundled themes (Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen, Twenty Seventeen) from Google Fonts.
Reasons for not using Google Fonts might be privacy and security, local development or production, blocking of Googles servers, characters not supported by font, performance.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_google_maps',
'title' => __('Disable Google maps', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('This function stops loading of Google Maps used by some themes or plugins.
Reasons for not using Google Maps might be privacy and security, local development or production, blocking of Googles servers, performance, not necessary, etc.', 'clearfy'),
'default' => false,
'eventsOn' => array(
'show' => '.factory-control-exclude_from_disable_google_maps,.factory-control-remove_iframe_google_maps'
),
'eventsOff' => array(
'hide' => '.factory-control-exclude_from_disable_google_maps,.factory-control-remove_iframe_google_maps'
)
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_iframe_google_maps',
'title' => __('Remove iframe Google maps', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('By default, the "Disable Google Maps" option removes maps inserted with the SCRIPT tag from the page source code. However, you can also cut out all maps inserted via the iframe by enabling this option.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'textbox',
'way' => 'buttons',
'name' => 'exclude_from_disable_google_maps',
'title' => __('Exclude pages from Disable Google Maps filter', 'clearfy'),
'hint' => __('Posts or Pages IDs separated by a ,', 'clearfy')
);
/*$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Remove query strings from static resources', 'clearfy') . '</strong>' . '<p>' . __('This funcitons will remove query strings from static resources like CSS & JS files inside the HTML <head> element to improve your speed scores in services like Pingdom, GTmetrix, PageSpeed and YSlow. <b style="color:#ff5722">Important:</b> This does not work for authorized users. To avoid problems after plugins update!', 'clearfy') . '</p>' . '</div>'
];*/
/*$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_js_version',
'title' => __('Remove Version from Script', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => ['hint-type' => 'icon'],
'hint' => __('To make it more difficult for others to hack your website you can remove the WordPress version number from your site, your css and js. Without that number it\'s not possible to see if you run not the current version to exploit bugs from the older versions. <br><br>
Additionally it can improve the loading speed of your site, because without query strings in the URL the css and js files can be cached.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes wordpress version number from scripts (not logged in user only).', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_style_version',
'title' => __('Remove Version from Stylesheet', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => ['hint-type' => 'icon'],
'hint' => __('To make it more difficult for others to hack your website you can remove the WordPress version number from your site, your css and js. Without that number it\'s not possible to see if you run not the current version to exploit bugs from the older versions. <br><br>
Additionally it can improve the loading speed of your site, because without query strings in the URL the css and js files can be cached.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes the wordpress version number from stylesheets (not logged in user only).', 'clearfy'),
'default' => false
/*'eventsOn' => array(
'show' => '.factory-control-disable_remove_style_version_for_auth_users'
),
'eventsOff' => array(
'hide' => '.factory-control-disable_remove_style_version_for_auth_users'
)
];*/
/*$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_remove_style_version_for_auth_users',
'title' => __( 'Disable remove versions for auth users', 'clearfy' ) . ' <span class="wbcr-clearfy-recomended-text">(' . __( 'Recommended', 'clearfy' ) . ')</span>',
'layout' => array( 'hint-type' => 'icon' ),
'default' => false
);*/
/*$options[] = [
'type' => 'textarea',
'name' => 'remove_version_exclude',
'height' => '120',
'title' => __('Exclude stylesheet/script file names', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Enter Stylesheet/Script file names to exclude from version removal (each exclude file starts with a new line)', 'clearfy') . '<br><br><b>' . __('Example', 'clearfy') . ':</b>' . ' http://testwp.dev/wp-includes/js/jquery/jquery.js',
];*/
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Heartbeat', 'clearfy') . '</strong>' . '<p>' . __('The WordPress Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the web-browser. While this is great and all it can also cause high CPU usage and crazy amounts of PHP calls. For example, if you leave your dashboard open it will keep sending POST requests to this file on a regular interval, every 15 seconds. Here is an example below of it happening.', 'clearfy') . '</p>' . '</div>'
];
$options[] = [
'type' => 'dropdown',
'name' => 'disable_heartbeat',
'way' => 'buttons',
'title' => __('Disable Heartbeat', 'clearfy'),
'data' => [
['default', __('Default', 'clearfy')],
['everywhere', __('Everywhere', 'clearfy')],
['on_dashboard_page', __('In admin panel', 'clearfy')],
['allow_only_on_post_edit_pages', __('Only allow when editing Posts/Pages', 'clearfy')]
],
//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
//'hint' => __('You can disable all plugin updates or choose manual or automatic update mode.', 'clearfy'),
'events' => [
'default' => [
'show' => '.factory-control-heartbeat_frequency'
],
'on_dashboard_page' => [
'show' => '.factory-control-heartbeat_frequency'
],
'allow_only_on_post_edit_pages' => [
'show' => '.factory-control-heartbeat_frequency'
],
'everywhere' => [
'hide' => '.factory-control-heartbeat_frequency'
]
],
'default' => 'default',
];
$options[] = [
'type' => 'dropdown',
'name' => 'heartbeat_frequency',
'title' => __('Heartbeat frequency', 'clearfy'),
'data' => [
['default', __('Wordpress default', 'clearfy')],
['20', '20 ' . __('seconds', 'clearfy')],
['25', '25 ' . __('seconds', 'clearfy')],
['30', '30 ' . __('seconds', 'clearfy')],
['35', '35 ' . __('seconds', 'clearfy')],
['40', '40 ' . __('seconds', 'clearfy')],
['45', '45 ' . __('seconds', 'clearfy')],
['50', '50 ' . __('seconds', 'clearfy')],
['55', '55 ' . __('seconds', 'clearfy')],
['60', '60 ' . __('seconds', 'clearfy')],
['80', '80 ' . __('seconds', 'clearfy')],
['120', '120 ' . __('seconds', 'clearfy')],
['150', '150 ' . __('seconds', 'clearfy')],
['200', '200 ' . __('seconds', 'clearfy')],
['250', '250 ' . __('seconds', 'clearfy')],
['300', '300 ' . __('seconds', 'clearfy')],
['400', '400 ' . __('seconds', 'clearfy')],
['500', '500 ' . __('seconds', 'clearfy')]
],
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Select the heartbeat frequency wordpress. We recommend you 60 seconds, default is 20 seconds.', 'clearfy'),
'default' => 'default'
];
$form_options = [];
$form_options[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters('wbcr_clr_code_clean_form_options', $form_options, $this);
}
/**
* Adds an html warning notification html markup.
*/
public function restApiDangerMessage()
{
?>
<div class="form-group">
<label class="col-sm-4 control-label"></label>
<div class="control-group col-sm-8">
<div id="wbcr-clearfy-rest-api-danger-message" class="wbcr-clearfy-danger-message">
<?php _e('<b>Use this option carefully!</b><br> Plugins like Contact form 7, Anycomments may have problems using this option.', 'clearfy') ?>
</div>
</div>
</div>
<?php
}
/**
* Check if WP_POST_REVISIONS is installed in wp-config file
*
* @return bool
*/
protected function is_post_revision_constant()
{
$config_path = ABSPATH . '/wp-config.php';
if( file_exists($config_path) ) {
$file = fopen($config_path, 'r');
$content = fread($file, filesize($config_path));
fclose($file);
if( !empty($content) && preg_match('/define(.+?)WP_POST_REVISIONS/', $content) ) {
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,249 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_QuickStartPage extends WCL_Page {
/**
* 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 = "quick_start";
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-clock';
/**
* @var int
*/
public $page_menu_position = 100;
/**
* @var bool
*/
public $internal = false;
/**
* @var string
*/
public $menu_target = 'options-general.php';
/**
* @var string
*/
public $type = 'page';
/**
* @var bool
*/
public $add_link_to_plugin_actions = true;
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 = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Clearfy', 'clearfy');
$this->page_menu_short_description = __('One-click settings', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
public function getPageTitle()
{
return __('Quick start', 'clearfy');
}
/**
* Requests assets (js and css) for the page.
*
* @return void
* @since 1.0.0
* @see FactoryPages480_AdminPage
*
*/
public function assets($scripts, $styles)
{
parent::assets($scripts, $styles);
/**
* Подгружаем стили для вижета оптимизации изображений, если не установли плагин оптимизации изображений
*/
if( !defined('WIO_PLUGIN_ACTIVE') ) {
$styles->add(WCL_PLUGIN_URL . '/admin/assets/css/base-statistic.css');
}
//$this->scripts->add(WCL_PLUGIN_URL . '/admin/assets/js/general.js');
$params = array(
//'ajaxurl' => admin_url('admin-ajax.php'),
'flush_cache_url' => $this->getActionUrl('flush-cache-and-rules', array('_wpnonce' => wp_create_nonce('wbcr_factory_' . $this->getResultId() . '_flush_action'))),
'ajax_nonce' => wp_create_nonce('wbcr_clearfy_ajax_quick_start_nonce'),
'i18n' => array(
'success_update_settings' => __('Settings successfully updated!', 'clearfy'),
'unknown_error' => __('During the setup, an unknown error occurred, please try again or contact the plugin support.', 'clearfy')
)
);
$this->scripts->localize('wbcr_clearfy_ajax', $params);
}
/**
* Shows the description above the options.
*
* @return void
* @since 1.0.0
*/
public function _showHeader()
{
?>
<div class="wbcr-clearfy-header">
<?php _e('On this page you can quickly configure the plug-in without going into details.', 'clearfy') ?>
</div>
<?php
}
public function showPageContent()
{
$allow_mods = apply_filters('wbcr_clearfy_allow_quick_mods', array(
'clear_code' => array('title' => __('One click code clearing', 'clearfy'), 'icon' => 'dashicons-yes'),
'defence' => array('title' => __('One click security', 'clearfy'), 'icon' => 'dashicons-shield'),
'seo_optimize' => array(
'title' => __('One click seo optimization', 'clearfy'),
'icon' => 'dashicons-star-empty'
),
'remove_default_widgets' => array(
'title' => __('One click remove default Widgets', 'clearfy'),
'icon' => 'dashicons-networking'
),
));
if( !$this->plugin->isActivateComponent('widget_tools') ) {
unset($allow_mods['remove_default_widgets']);
}
$allow_mods['reset'] = array(
'title' => __('Reset all settings', 'clearfy'),
'icon' => 'dashicons-backup',
'args' => array('flush_redirect' => 1)
);
?>
<div class="wbcr-clearfy-confirm-popup">
<h3><?php _e('Are you sure you want to enable the this options?', 'clearfy') ?></h3>
<div class="wbcr-clearfy-reset-warning-message">
<?php _e('After confirmation, all the settings of the plug-in will return to the default state. Make backup settings by copying data from the export field.', 'clearfy') ?>
</div>
<ul class="wbcr-clearfy-list-options"></ul>
<div class="wbcr-clearfy-popup-buttons">
<button class="wbcr-clearfy-popup-button-ok"><?php _e('Confirm', 'clearfy') ?></button>
<button class="wbcr-clearfy-popup-button-cancel"><?php _e('Cancel', 'clearfy') ?></button>
</div>
</div>
<div class="wbcr-content-section">
<div class="wbcr-factory-page-group-header" style="margin:0"><?php _e('<strong>Quick start</strong>.', 'clearfy') ?>
<p><?php _e('These are quick optimization options for your website. You can activate the groups of necessary settings in one click. With the fast optimization mode, we are enable the only safe settings that do not break your website. That is why we recommend you to look at each setting of the plugin individually. The settings with grey and red question mark will not be active, until you do it yourself.', 'clearfy') ?></p>
</div>
<?php do_action('wbcr_clearfy_quick_boards'); ?>
<div id="wbcr-clearfy-quick-mode-board">
<h4 style="margin-top:10px;"><?php _e('Select what you need to do', 'clearfy') ?></h4>
<p style="color:#9e9e9e"><?php _e('After selecting any optimization case, the plugin will automatically enable the necessary settings in safe mode and one click.', 'clearfy') ?></p>
<ul>
<?php foreach($allow_mods as $mode_name => $mode): ?>
<?php
$mode_title = $mode;
$mode_icon = '';
$mode_args = '';
if( is_array($mode) ) {
$mode_title = isset($mode['title']) ? $mode['title'] : '';
$mode_icon = isset($mode['icon']) ? $mode['icon'] : '';
$mode_args = isset($mode['args']) && is_array($mode['args']) ? WCL_Helper::getEscapeJson($mode['args']) : '';
}
?>
<li>
<?php
$group = WCL_Group::getInstance($mode_name);
$filter_mode_options = array();
foreach($group->getOptions() as $option) {
$filter_mode_options[$option->getName()] = $option->getTitle();
}
$print_group_options = WCL_Helper::getEscapeJson($filter_mode_options);
?>
<?php if( $mode_name == 'reset' ): ?>
<h4><?php _e('Reset settings', 'clearfy') ?></h4>
<p style="color:#9e9e9e"><?php _e('After confirmation, all the settings of the plug-in will return to the default state. Make backup settings by copying data from the export field.', 'clearfy') ?></p>
<?php endif; ?>
<div class="wbcr-clearfy-switch wbcr-clearfy-switch-mode-<?= $mode_name ?>" data-mode="<?= $mode_name ?>" data-mode-args="<?= $mode_args ?>" data-mode-options="<?= $print_group_options ?>">
<?php if( !empty($mode_icon) ): ?>
<i class="dashicons <?= $mode_icon; ?>"></i>
<?php endif; ?>
<span><?= $mode_title ?></span>
<div class="wbcr-clearfy-switch-confirmation">
<button class="wbcr-clearfy-button-activate-mode">
<?php if( $mode_name == 'reset' ): ?>
<?php _e('Reset', 'clearfy'); ?>
<?php else: ?>
<?php _e('Do It!', 'clearfy'); ?>
<?php endif; ?>
</button>
</div>
</li>
<?php endforeach; ?>
<li>
<div class="wbcr-clearfy-switch">
<i class="dashicons dashicons-admin-settings"></i>
<span><?php _e('Configuration wizard', 'clearfy'); ?></span>
<div class="wbcr-clearfy-switch-confirmation">
<a href="<?php echo WCL_Plugin::app()->getPluginPageUrl('setup'); ?>" class="btn wbcr-clearfy-button-activate-wizard"><?php _e('Start', 'clearfy'); ?></a>
</div>
</div>
</li>
</ul>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,157 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_DoublePagesPage extends WCL_Page {
/**
* 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 = "double_pages";
public $page_parent_page = 'seo';
public $page_menu_dashicon = 'dashicons-admin-page';
public $page_menu_position = 16;
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Duplicate pages', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getPageOptions()
{
$options = array();
/*$options[] = array(
'type' => 'html',
'html' => array($this, '_showHeader')
);*/
/*$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_date',
'title' => __('Disable search', 'clearfy'),
'layout' => array('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' => false
);*/
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Delete duplicate pages.</strong>.', 'clearfy') . '<p>' . __('Search engines perceive these pages as website separate pages, therefore their content ceases to be unique because of duplication. In addition, page reference weight is reduced if it has a duplicate. A small number of duplicated pages will not be a serious problem, but if there are more than 50 percents of them - you urgently need to correct the situation.', 'clearfy') . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_date',
'title' => __('Remove archives date', 'clearfy'),
'layout' => array('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' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_author',
'title' => __('Remove author archives ', 'clearfy'),
'layout' => array('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' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'redirect_archives_tag',
'title' => __('Remove archives tag', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('If you use tags only for the block Similar records, or do not use them at all - it will be more correct to close them to avoid duplicates.', 'clearfy') . '<br><b>Clearfy: </b>' . __('Removes all pages with the tag archives and puts a redirect.', 'clearfy'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'attachment_pages_redirect',
'title' => __('Remove attachment pages', 'clearfy'),
'layout' => array('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' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_single_pagination_duplicate',
'title' => __('Remove post pagination', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => sprintf(__('In WordPress, any post can be divided into parts (pages), each part will have its own address. But this functionality is rarely used, but it can create trouble for you. For example, you can add a number to the address of any entry of your blog, %s - the post itself will open, which will be a duplicate. You can substitute any number.', 'clearfy'), '/privet-mir/1/') . '<br><b>Clearfy: </b>' . sprintf(__('Removes the pagination from the post and puts a redirect. Example: %s', 'clearfy'), '/post-name/number'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_replytocom',
'title' => __('Remove ?replytocom', 'clearfy'),
'layout' => array('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' => false
);
/*$options[] = array(
'type' => 'separator',
'cssClass' => 'factory-separator-dashed'
);
$options[] = array(
'type' => 'html',
'html' => array($this, '_showFormButton')
);*/
$form_options = array();
$form_options[] = array(
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
);
return apply_filters('wbcr_clr_double_form_options', $form_options, $this);
}
}

View File

@@ -0,0 +1,245 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_SeoPage extends WCL_Page {
/**
* 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 = "seo";
public $page_menu_dashicon = 'dashicons-star-filled';
public $page_menu_position = 16;
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('SEO', 'clearfy');
$this->page_menu_short_description = __('Additional small fixes SEO', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Conflict notites
*/
public function warningNotice()
{
$notices = apply_filters('wbcr_clr_seo_page_warnings', array());
if( !empty($notices) ) {
foreach($notices as $message) {
$this->printWarningNotice($message);
}
}
}
/**
* Permalinks options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getPageOptions()
{
$options = array();
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Basic SEO optimization settings</strong>.', 'clearfy') . '<p>' . __('Recommended settings that can complement your SEO plugin.', 'clearfy') . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'content_image_auto_alt',
'title' => __('Automatically set the alt attribute', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => array('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' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'right_robots_txt',
'title' => __('Create right robots.txt', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('After installation, WP does not contain a robots.txt file and create it manually. We re-read about 30 different articles, instructions from Yandex and Google to create the perfect robots.txt', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Automatically creates the perfect robots.txt file', 'clearfy'),
'default' => false,
'eventsOn' => array(
'show' => '.factory-control-robots_txt_text'
),
'eventsOff' => array(
'hide' => '.factory-control-robots_txt_text'
)
);
$options[] = array(
'type' => 'textarea',
'name' => 'robots_txt_text',
'title' => __('You can edit the robots.txt file in the box below:', 'clearfy'),
'default' => WCL_Helper::getRightRobotTxt(),
'height' => '300'
);
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Server headers and response', 'clearfy') . '</strong>' . '<p>' . __('WordPress does not know how to give the Last Modified header in the server\'s responses. You can do this using the settings below.', 'clearfy') . '</p>' . '</div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'set_last_modified_headers',
'title' => __('Automatically insert the Last Modified header', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'default' => false,
'eventsOn' => array(
'show' => '.factory-control-last_modified_exclude, .factory-control-disable_frontpage_last_modified_headers'
),
'eventsOff' => array(
'hide' => '.factory-control-last_modified_exclude, .factory-control-disable_frontpage_last_modified_headers'
)
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_frontpage_last_modified_headers',
'title' => __('Disable Last Modified header on front page', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'default' => true,
);
$options[] = array(
'type' => 'textarea',
'name' => 'last_modified_exclude',
'height' => '120',
'title' => __('Exclude pages:', 'clearfy'),
'layout' => array('hint-type' => 'icon'),
'hint' => sprintf(__('You can specify a page mask, for example: %s or %s. All pages that contain the string will be excluded. Each exclude must begin with a new line.', 'clearfy'), '/s=', '/manager/'),
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'if_modified_since_headers',
'title' => __('Return an If-Modified-Since responce', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'default' => false
);
if( $this->plugin->isActivateComponent('yoast_seo') ) {
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('For the Yoast SEO plugin', 'clearfy') . '</strong>' . '<p>' . __('These settings will help you eliminate some problems associated with the popular Yoast SEO plugin', 'clearfy') . '</p>' . '</div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_last_item_breadcrumb_yoast',
'title' => __('Remove duplicate names in breadcrumbs WP SEO by Yoast', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => array('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' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_image_from_xml_sitemap',
'title' => sprintf(__('Remove the tag %s from XML site map', 'clearfy'), 'image:image') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => array('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' => false,
'eventsOn' => array()
);
/*$options[] = array(
'type' => 'html',
'id' => 'wbcr-clearfy-image-xml-sitemap-warning',
'cssClass' => 'factory-hints',
'html' => array($this, 'sfsdfsdf')
);*/
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_json_ld_search',
'title' => __('Disable JSON-LD sitelinks searchbox', 'clearfy') . '</span>',
'layout' => array('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[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_json_ld_output',
'title' => __('Disable Yoast Structured Data', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text"></span>',
'layout' => array('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[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_canonical_pagination',
'title' => sprintf(__('Canonical on pagination pages', 'clearfy'), 'head'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'hint' => __('Its a well-known fact, that the Yoast SEO plugin outputs canonical links on pagination pages, such as /page/2/, /page/3/ and so on. While various search engines treat canonical links differently, it is always better to replace them with the link leading to the main pagination page.
If enabled, this feature changes the canonical link to the main page or category link.
When you deactivate some components, permanent links may work incorrectly. If this happens, please, update the structure of the permanent links, so you could complete the deactivation.
', 'clearfy'),
'default' => false
);*/
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'yoast_remove_head_comment',
'title' => sprintf(__('Remove comment from %s section', 'clearfy'), 'head') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
'layout' => array('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' => false
);
}
$form_options = array();
$form_options[] = array(
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
);
return apply_filters('wbcr_clr_seo_form_options', $form_options, $this);
}
}

View File

@@ -0,0 +1,196 @@
<?php
/**
* The page Settings.
*
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCL_WidgetsPage extends WCL_Page {
/**
* 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 = "widgets";
public $page_parent_page = "advanced";
public $page_menu_dashicon = 'dashicons-networking';
public $available_for_multisite = true;
/**
* @param WCL_Plugin $plugin
*/
public function __construct(WCL_Plugin $plugin)
{
$this->menu_title = __('Widgets', 'clearfy');
$this->page_menu_short_description = __('Disable unused widgets', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = array();
$options[] = array(
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Disable unused widgets</strong>.', 'clearfy') . '<p>' . __('Some widgets, such as the Calendar or Tag Cloud, create an extra query to the database, even if they are not displayed on the website. Of course, a couple of hits to the database will not do much harm to the whole site. However, if the resource contains a huge amount of content, and the speed of its work above all else, disabling unused functionality is the first step to optimizing and accelerating it.', 'clearfy') . '</p></div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_page',
'title' => __('Remove the "Pages" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_calendar',
'title' => __('Remove calendar widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_tag_cloud',
'title' => __('Remove the "Cloud of tags" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_archives',
'title' => __('Remove the "Archives" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_links',
'title' => __('Remove the "Links" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_meta',
'title' => __('Remove the "Meta" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_search',
'title' => __('Remove the "Search" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_text',
'title' => __('Remove the "Text" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_categories',
'title' => __('Remove the "Categories" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_recent_posts',
'title' => __('Remove the "Recent Posts" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_recent_comments',
'title' => __('Remove the "Recent Comments" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_rss',
'title' => __('Remove the "RSS" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_menu',
'title' => __('Remove the "Menu" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'remove_unneeded_widget_twenty_eleven_ephemera',
'title' => __('Remove the "Twenty Eleven Ephemera" widget', 'clearfy'),
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
'default' => false
);
$form_options = array();
$form_options[] = array(
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
);
return apply_filters('wbcr_clr_widgets_form_options', $form_options, $this);
}
}

View File

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

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();
}
}