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,32 @@
<?php
/**
* Activator for the cyrlitera
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
* @copyright (c) 09.03.2018, Webcraftic
* @see Wbcr_Factory480_Activator
* @version 1.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WGNZ_Activation extends Wbcr_Factory480_Activator {
/**
* Runs activation actions.
*/
public function activate() {
wbcr_gnz_deploy_mu_plugin();
}
/**
* Runs deactivation actions.
*/
public function deactivate() {
wbcr_gnz_remove_mu_plugin();
}
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* Save settings ajax action
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
* @copyright (c) 21.09.2019, Webcraftic
* @version 1.0
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Ajax action for save plugin settings.
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 2.0.0
*/
function wam_save_settings_action()
{
check_ajax_referer('wam_save_settigns');
if( !current_user_can('manage_options') ) {
wp_send_json_error([
'error_message_title' => __('Save settings failed!', 'gonzales'),
'error_message_content' => __('You don\'t have enough capability to edit this information.', 'gonzales')
]);
}
$save_message_title = __('Settings saved successfully!', 'clearfy');
$save_message_content = __('If you use test mode, do not forget to disable it. We also recommend that you flush the cache if you use caching plugins.', 'clearfy');
$scope = WGZ_Plugin::app()->request->post('scope', 'frontend');
$raw_updated_settings = WGZ_Plugin::app()->request->post('settings', [], true);
if( !empty($raw_updated_settings) ) {
if( 'networkadmin' === $scope ) {
$settings = WGZ_Plugin::app()->getNetworkOption('backend_assets_states', []);
} else if( 'admin' === $scope ) {
$settings = WGZ_Plugin::app()->getOption('backend_assets_states', []);
} else {
$settings = WGZ_Plugin::app()->getOption('assets_states', []);
}
if( !defined('WGZP_PLUGIN_ACTIVE') || (is_array($settings) && !isset($settings['save_mode'])) ) {
$settings['save_mode'] = false;
}
if( !empty($raw_updated_settings['plugins']) ) {
foreach((array)$raw_updated_settings['plugins'] as $plugin_name => $plugin_group) {
if( !empty($plugin_group['load_mode']) ) {
if( 'enable' == $plugin_group['load_mode'] ) {
$plugin_group['visability'] = "";
} else {
foreach(['js', 'css'] as $assets_type) {
if( !empty($plugin_group[$assets_type]) ) {
foreach($plugin_group[$assets_type] as $resource_handle => $resource_params) {
$plugin_group[$assets_type][$resource_handle]['visability'] = "";
}
}
}
}
}
$settings['plugins'][$plugin_name] = $plugin_group;
}
}
if( !empty($raw_updated_settings['theme']) ) {
$settings['theme'] = $raw_updated_settings['theme'];
}
if( !empty($raw_updated_settings['misc']) ) {
$settings['misc'] = $raw_updated_settings['misc'];
}
/**
* Filter run before save settings.
*
* @param array $settings
* @param array $raw_updated_settings
* @param string $scope
*/
$settings = apply_filters('wam/before_save_settings', $settings, $raw_updated_settings, $scope);
if( 'networkadmin' === $scope ) {
WGZ_Plugin::app()->updateNetworkOption('backend_assets_states', $settings);
} else if( 'admin' === $scope ) {
WGZ_Plugin::app()->updateOption('backend_assets_states', $settings);
} else {
WGZ_Plugin::app()->updateOption('assets_states', $settings);
}
// If mu plugin does not exist, install it.
wbcr_gnz_deploy_mu_plugin();
// Flush cache for all cache plugins
WBCR\Factory_Templates_134\Helpers::flushPageCache();
}
wp_send_json_success([
'save_massage_title' => $save_message_title,
'save_message_content' => $save_message_content
]);
}
add_action('wp_ajax_nopriv_wam-save-settings', 'wam_save_settings_action');
add_action('wp_ajax_wam-save-settings', 'wam_save_settings_action');

View File

@@ -0,0 +1,211 @@
<?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;
}
if( defined('LOADING_ASSETS_MANAGER_AS_ADDON') ) {
/**
* Уведомление, которое сообщает о возможности импорта опций из плагина Assets manager в Clearfy
*
* @param array $notices
*/
/*add_filter( 'wbcr/factory/admin_notices', function ( $notices ) {
if ( is_multisite() && is_network_admin() ) {
$am_options = get_site_option( 'wbcr_gnz_assets_manager_options' );
} else {
$am_options = get_option( 'wbcr_gnz_assets_manager_options' );
}
if ( $am_options ) {
$notice_text = '<p><b>Clearfy:</b> ' . __( 'We detected that you used the Assets manager plugin. Do you want to import settings from this plugin to the Clearfy plugin?', 'gonzales' ) . '</p>';
$notice_text .= '<p><a href="' . admin_url( '?wbcr_assets_manager_transfer' ) . '" class="button button-default">' . __( 'Import options', 'gonzales' ) . '</a></p>';
$notices[] = [
'id' => 'gnz_plugin_import_options',
'type' => 'warning',
'dismissible' => true,
'dismiss_expires' => 0,
'text' => $notice_text
];
}
if ( isset( $_GET['wbcr_assets_manager_transfer_completed'] ) ) {
$notices[] = [
'id' => 'gnz_plugin_transfer_options_completed',
'type' => 'success',
'dismissible' => false,
'dismiss_expires' => 0,
'text' => '<p><b>Clearfy:</b> ' . __( 'Settings has been successfully imported!', 'gonzales' )
];
}
return $notices;
}, 10, 2 );*/
/**
* Импорт опций из плагина Assets manager в плагин Clearfy.
* При попытке использовать премиум версию, у многих пользователей уже настроен бесплатный плагин и
* на ручной перенос настроек уходит очень много времени. Этот кусок кода решает проблему переноса настроек между плагинами.
*/
/*add_action( 'admin_init', function () {
if ( isset( $_GET['wbcr_assets_manager_transfer'] ) ) {
global $wpdb;
if ( is_multisite() && is_network_admin() ) {
$am_options = get_site_option( 'wbcr_gnz_assets_manager_options' );
} else {
$am_options = get_option( 'wbcr_gnz_assets_manager_options' );
}
if ( ! $am_options || ! class_exists( 'WCL_Plugin' ) ) {
return;
}
$am_prefix = 'wbcr_gnz_';
if ( is_multisite() && is_network_admin() ) {
$request = $wpdb->get_results( "SELECT meta_key, meta_value
FROM {$wpdb->sitemeta}
WHERE option_name LIKE '{$am_prefix}_%'" );
} else {
$request = $wpdb->get_results( "SELECT option_name, option_value
FROM {$wpdb->options}
WHERE option_name LIKE '{$am_prefix}_%'" );
}
if ( $request ) {
foreach ( (array) $request as $option ) {
if ( is_multisite() && is_network_admin() ) {
$new_option_name = str_replace( $am_prefix, WCL_Plugin::app()->getPrefix(), $option->meta_key );
update_site_option( $new_option_name, $option->meta_value );
delete_site_option( $option->meta_key );
} else {
$new_option_name = str_replace( $am_prefix, WCL_Plugin::app()->getPrefix(), $option->option_name );
update_option( $new_option_name, $option->option_value );
delete_option( $option->option_name );
}
}
wp_redirect( admin_url( '?wbcr_assets_manager_transfer_completed' ) );
die();
}
}
} );*/
function wbcr_gnz_group_options($options)
{
$options[] = [
'name' => 'disable_assets_manager',
'title' => __('Disable assets manager', 'gonzales'),
'tags' => [],
'values' => []
];
$options[] = [
'name' => 'disable_assets_manager_panel',
'title' => __('Disable assets manager panel', 'gonzales'),
'tags' => []
];
$options[] = [
'name' => 'disable_assets_manager_on_front',
'title' => __('Disable assets manager on front', 'gonzales'),
'tags' => []
];
$options[] = [
'name' => 'disable_assets_manager_on_backend',
'title' => __('Disable assets manager on back-end', 'gonzales'),
'tags' => []
];
$options[] = [
'name' => 'manager_options',
'title' => __('Assets manager options', 'gonzales'),
'tags' => []
];
return $options;
}
add_filter("wbcr_clearfy_group_options", 'wbcr_gnz_group_options');
} else {
/**
* Удаляем лишние виджеты в левом сайдбаре
*
* @param array $widgets
* @param string $position
* @param Wbcr_Factory480_Plugin $plugin
*/
add_filter('wbcr/factory/pages/impressive/widgets', function ($widgets, $position, $plugin) {
if( $plugin->getPluginName() == WGZ_Plugin::app()->getPluginName() ) {
unset($widgets['business_suggetion']);
if( $position == 'right' ) {
unset($widgets['donate_widget']);
unset($widgets['rating_widget']);
unset($widgets['info_widget']);
}
}
return $widgets;
}, 20, 3);
/**
* Заменяем премиум возможности в бизнес виджете
*
* @param array $features
* @param string $page_id
* @param string $plugin
*/
add_filter('wbcr/clearfy/pages/suggetion_features', function ($features, $plugin_name, $page_id) {
if( !empty($plugin_name) && ($plugin_name == WGZ_Plugin::app()->getPluginName()) ) {
$upgrade_feature = [];
$upgrade_feature[] = __('Disable plugins (groups of scripts)', 'gonzales');
$upgrade_feature[] = __('Conditions by the link template', 'gonzales');
$upgrade_feature[] = __('Conditions by the regular expression', 'gonzales');
$upgrade_feature[] = __('Safe mode', 'gonzales');
$upgrade_feature[] = __('Statistics and optimization results', 'gonzales');
return $upgrade_feature;
}
return $features;
}, 20, 3);
function wbcr_gnz_set_plugin_meta($links, $file)
{
if( $file == WGZ_PLUGIN_BASE ) {
$url = WGZ_Plugin::app()->get_support()->get_tracking_page_url('assets-manager', 'plugin_row');
$links[] = '<a href="' . $url . '" style="color: #FF5722;font-weight: bold;" target="_blank">' . __('Get premium', 'gonzales') . '</a>';
}
return $links;
}
add_filter('plugin_row_meta', 'wbcr_gnz_set_plugin_meta', 10, 2);
function wbcr_gnz_rating_widget_url($page_url, $plugin_name)
{
if( !defined('LOADING_ASSETS_MANAGER_AS_ADDON') && ($plugin_name == WGZ_Plugin::app()->getPluginName()) ) {
return 'https://goo.gl/zyNV6z';
}
return $page_url;
}
add_filter('wbcr_factory_pages_480_imppage_rating_widget_url', 'wbcr_gnz_rating_widget_url', 10, 2);
}

View File

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

View File

@@ -0,0 +1,22 @@
<?php
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Рекламная страница.
*
* Используется для рекламы плагина Clearfy. Пользователь может изучить все возможности плагина Clearfy
* и перейти на лендинг плагина, чтобы скачать и попробовать его.
*
* Может быть использована только, если этот плагин используется как отдельный плагин, а не как аддон
* для плагина Clearfy. Если плагин загружен, как аддон для Clearfy, эта страница не будет подключена.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
*
* @copyright (c) 2018 Webraftic Ltd
*/
class WGZ_MoreFeaturesPage extends \WBCR\Factory_Templates_134\Pages\MoreFeatures {
}

View File

@@ -0,0 +1,170 @@
<?php
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
/**
* Страница общих настроек для этого плагина.
*
* Может быть использована только, если этот плагин используется как отдельный плагин, а не как аддон
* дя плагина Clearfy. Если плагин загружен, как аддон для Clearfy, эта страница не будет подключена.
*
* Поддерживает режим работы с мультисаймами. Вы можете увидеть эту страницу в панели настройки сети.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
*
* @copyright (c) 2018 Webraftic Ltd
*/
class WGZ_AssetsManagerPage extends WBCR\Factory_Templates_134\Pages\PageBase {
/**
* 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 = "gonzales";
/**
* @var string
*/
public $page_menu_dashicon = 'dashicons-image-filter';
/**
* @var int
*/
public $page_menu_position = 95;
/**
* Доступена для мультисайтов
*
* @var bool
*/
public $available_for_multisite = true;
/**
* @param Wbcr_Factory480_Plugin $plugin
*/
public function __construct(Wbcr_Factory480_Plugin $plugin)
{
$this->menu_title = __('Assets manager', 'gonzales');
if( !defined('LOADING_ASSETS_MANAGER_AS_ADDON') ) {
$this->internal = false;
$this->menu_target = 'options-general.php';
$this->add_link_to_plugin_actions = true;
$this->show_search_options_form = false;
} else {
$this->page_parent_page = 'performance';
}
parent::__construct($plugin);
}
/**
* Метод позволяет менять заголовок меню, в зависимости от сборки плагина.
*
* @return string|void
*/
public function getMenuTitle()
{
return defined('LOADING_ASSETS_MANAGER_AS_ADDON') ? __('General', 'hide-login-page') : __('Assets manager', 'gonzales');
}
/**
* @return string|void *
*/
public function getPageTitle()
{
return defined('LOADING_ASSETS_MANAGER_AS_ADDON') ? __('Assets manager', 'gonzales') : __('General', 'hide-login-page');
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __('Disable unused scripts, styles, and fonts', 'gonzales') . '</strong><p>' . __('There is a button in the adminbar called "Script Manager". If you click on it you will see a list of loaded scripts, styles and fonts on the current page of your site. If you think that one of the assets is superfluous on this page, you can disable it individually, so that it does not create unnecessary queries when page loading. Use the script manager very carefull to non-corrupt your website. We recommend to test this function at a local server.', 'gonzales') . '</p></div>'
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_assets_manager',
'title' => __('Disable assets manager', 'gonzales'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Full disable of the module.', 'gonzales'),
'eventsOn' => [
'hide' => '#wbcr-gnz-asset-manager-extend-options'
],
'eventsOff' => [
'show' => '#wbcr-gnz-asset-manager-extend-options'
],
'default' => false
];
$options[] = [
'type' => 'div',
'id' => 'wbcr-gnz-asset-manager-extend-options',
'items' => [
[
'type' => 'separator',
'cssClass' => 'factory-separator-dashed'
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_assets_manager_panel',
'title' => __('Disable assets manager panel', 'gonzales'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'green'],
'hint' => __('By default in your admin bar there is a button for control the assets scripts and styles. With this option, you can turn off the script manager on front and back-end.', 'gonzales'),
'default' => false
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_assets_manager_on_front',
'title' => __('Disable assets manager on front', 'gonzales'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Disables assets manager initialization for frontend.', 'gonzales'),
'default' => false
],
[
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_assets_manager_on_backend',
'title' => __('Disable assets manager on back-end', 'gonzales'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __('Disables assets manager initialization for backend.', 'gonzales'),
'default' => true
]
]
];
$options[] = [
'type' => 'separator',
'cssClass' => 'factory-separator-dashed'
];
$formOptions = [];
$formOptions[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters('wbcr_gnz_assets_manager_options', $formOptions);
}
}

View File

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