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,133 @@
<?php
/**
* Admin boot
*
* @author Webcraftic <wordpress.webraftic@gmail.com>
* @copyright Webcraftic 25.05.2017
* @version 1.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Печатает ошибки совместимости с похожими плагинами
*/
add_action('wbcr/factory/admin_notices', function ($notices, $plugin_name) {
if( $plugin_name != WHTM_Plugin::app()->getPluginName() ) {
return $notices;
}
if( is_plugin_active('autoptimize/autoptimize.php') ) {
$notice_text = __('Clearfy: Html minify component is not compatible with the Autoptimize plugin, please do not use them together to avoid conflicts. Please disable the Html minify component', 'html-minify');
if( class_exists('WCL_Plugin') ) {
$component_button = WCL_Plugin::app()->getInstallComponentsButton('internal', 'html_minify');
$notice_text .= ' ' . $component_button->getLink();
}
$notices[] = [
'id' => 'mac_plugin_compatibility',
'type' => 'error',
'classes' => ['wbcr-hide-after-action'],
'dismissible' => false,
'dismiss_expires' => 0,
'text' => '<p>' . $notice_text . '</p>'
];
}
return $notices;
}, 10, 2);
add_filter("wbcr_clearfy_group_options", function ($options) {
$options[] = [
'name' => 'html_optimize',
'title' => __('Optimize HTML Code?', 'html-minify'),
'tags' => ['optimize_performance', 'optimize_html', 'optimize_code', 'hide_my_wp'],
'values' => []
];
$options[] = [
'name' => 'html_keepcomments',
'title' => __('Keep HTML comments?', 'html-minify'),
'tags' => [],
'values' => []
];
return $options;
});
/**
* Adds a new mode to the Quick Setup page
*
* @param array $mods
*
* @return mixed
*/
add_filter("wbcr_clearfy_allow_quick_mods", function ($mods) {
if( !defined('WMAC_PLUGIN_ACTIVE') ) {
$title = __('One click optimize html code', 'html-minify');
} else {
$title = __('One click optimize html code and scripts', 'html-minify');
}
$mod['optimize_code'] = [
'title' => $title,
'icon' => 'dashicons-performance'
];
return $mod + $mods;
});
function wbcr_htm_settings_form_options()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __('Minify Html code', 'html-minify') . '</strong><p>' . __('Ever look at the HTML markup of your website and notice how sloppy and amateurish it looks? The Minify HTML options cleans up sloppy looking markup and minifies, which also speeds up download.', 'html-minify') . '</p></div>'
];
// Переключатель
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'html_optimize',
'title' => __('Optimize HTML Code?', 'html-minify'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('Minify html code.', 'html-minify'),
'default' => false,
];
// Переключатель
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'html_keepcomments',
'title' => __('Keep HTML comments?', 'html-minify'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Enable this if you want HTML comments to remain in the page.', 'html-minify'),
'default' => false
];
return $options;
}
add_filter('wbcr_clr_code_clean_form_options', function ($form) {
if( empty($form) ) {
return $form;
}
$options = wbcr_htm_settings_form_options();
foreach(array_reverse($options) as $option) {
array_unshift($form[0]['items'], $option);
}
return $form;
});

View File

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

View File

@@ -0,0 +1,99 @@
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The page Settings.
*
* @since 1.0.0
*/
class WHTM_SettingsPage extends WBCR\Factory_Templates_134\Pages\PageBase {
/**
* {@inheritDoc}
*
* @var string
*/
public $id = "html_minify";
/**
* {@inheritDoc}
*
* @var string
*/
public $page_menu_dashicon = 'dashicons-testimonial';
/**
* {@inheritDoc}
*
* @var string
*/
public $page_parent_page = "performance";
/**
* {@inheritDoc}
*
* @var bool
*/
public $available_for_multisite = true;
/**
* {@inheritDoc}
*
* @since 1.1.0
* @var bool
*/
public $show_right_sidebar_in_options = true;
/**
* WHTM_SettingsPage constructor.
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
*
* @param \Wbcr_Factory480_Plugin $plugin
*/
public function __construct( Wbcr_Factory480_Plugin $plugin ) {
// Заголовок страницы
$this->menu_title = __( 'HTML Minify', 'html-minify' );
if ( ! defined( 'LOADING_HTML_MINIFY_AS_ADDON' ) ) {
$this->internal = false;
$this->menu_target = 'options-general.php';
$this->add_link_to_plugin_actions = true;
$this->page_parent_page = null;
}
parent::__construct( $plugin );
}
/**
* {@inheritDoc}
*
* @var string
*/
public function getMenuTitle() {
return defined( 'LOADING_HTML_MINIFY_AS_ADDON' ) ? __( 'HTML Minify', 'html-minify' ) : __( 'General', 'html-minify' );
}
/**
* {@inheritDoc}
*
* @since 1.0.0
* @return mixed[]
*/
public function getPageOptions() {
$options = wbcr_htm_settings_form_options();
$formOptions = [];
$formOptions[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters( 'wbcr_htm_settings_form_options', $formOptions );
}
}

View File

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