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,30 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010103 extends Wbcr_Factory480_Update {
public function install() {
global $wpdb;
$request = $wpdb->get_results( "SELECT option_id, option_name, option_value FROM {$wpdb->prefix}options WHERE option_name LIKE 'wbcr-clearfy_%'" );
if ( ! empty( $request ) ) {
foreach ( $request as $option ) {
$option_new_name = str_replace( 'wbcr-clearfy', WCL_Plugin::app()->getPrefix(), $option->option_name );
if ( ! get_option( $option_new_name, false ) ) {
$wpdb->query( "UPDATE {$wpdb->prefix}options SET option_name='$option_new_name' WHERE option_id='{$option->option_id}'" );
} else {
delete_option( $option->option_name );
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCLUpdate010108 extends Wbcr_Factory480_Update {
public function install()
{
delete_option($this->plugin->getPluginName() . '_quick_modes');
delete_option($this->plugin->getPluginName() . '_disable_admin_notices');
}
}

View File

@@ -0,0 +1,19 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010200 extends Wbcr_Factory480_Update {
public function install() {
WCL_Plugin::app()->deleteOption( 'enable_wordpres_sanitize' );
WCL_Plugin::app()->deleteOption( 'remove_dns_prefetch' );
}
}

View File

@@ -0,0 +1,68 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCL_Update010300 extends Wbcr_Factory480_Update {
public function install() {
// Deactivate components for code minification, if alternative plugins are installed
// -------------
WCL_Plugin::app()->deactivateComponent( 'minify_and_combine' );
WCL_Plugin::app()->deactivateComponent( 'html_minify' );
$this->plugin->deleteOption( 'html_minify' );
$this->plugin->deleteOption( 'minify_javascript' );
$this->plugin->deleteOption( 'minify_html_comments' );
$this->plugin->deleteOption( 'minify_html_xhtml' );
$this->plugin->deleteOption( 'minify_html_relative' );
$this->plugin->deleteOption( 'minify_html_scheme' );
$this->plugin->deleteOption( 'minify_html_utf8' );
/**
* Migration for the component Hide login page
*/
$hide_wp_admin = $this->plugin->getPopulateOption( 'hide_wp_admin' );
$hide_login_path = $this->plugin->getPopulateOption( 'hide_login_path' );
$login_path = $this->plugin->getPopulateOption( 'login_path' );
$old_login_path = $this->plugin->getPopulateOption( 'old_login_path' );
$login_recovery_code = $this->plugin->getPopulateOption( 'login_recovery_code' );
if ( $hide_wp_admin ) {
update_option( 'wbcr_hlp_hide_wp_admin', $hide_wp_admin );
}
if ( $hide_login_path ) {
update_option( 'wbcr_hlp_hide_login_path', $hide_login_path );
}
if ( $login_path ) {
update_option( 'wbcr_hlp_login_path', $login_path );
}
if ( $old_login_path ) {
update_option( 'wbcr_hlp_old_login_path', $old_login_path );
}
if ( $login_recovery_code ) {
update_option( 'wbcr_hlp_login_recovery_code', $login_recovery_code );
}
$this->plugin->deleteOption( 'hide_wp_admin' );
$this->plugin->deleteOption( 'login_path' );
$this->plugin->deleteOption( 'hide_login_path' );
$this->plugin->deleteOption( 'old_login_path' );
$this->plugin->deleteOption( 'login_recovery_code' );
if ( $this->plugin->getPopulateOption( 'remove_style_version' ) ) {
$this->plugin->updatePopulateOption( 'disable_remove_style_version_for_auth_users', 1 );
}
if ( $this->plugin->getPopulateOption( 'set_last_modified_headers' ) ) {
$this->plugin->updatePopulateOption( 'disable_frontpage_last_modified_headers', 1 );
}
}
}

View File

@@ -0,0 +1,49 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010402 extends Wbcr_Factory480_Update {
public function install() {
/**
* Миграция для аддона Disable admin notices
*/
require_once( WCL_PLUGIN_DIR . '/components/disable-admin-notices/migrations/010007.php' );
$dan_updates = new WDNUpdate010007( $this->plugin );
$dan_updates->install();
/**
* Миграция для аддона Updates manager
*/
require_once( WCL_PLUGIN_DIR . '/components/updates-manager/migrations/010008.php' );
$wupm_updates = new WUPMUpdate010008( $this->plugin );
$wupm_updates->install();
/**
* Удаляем старый cron хук
*/
if ( wp_next_scheduled( 'wbcr_clr_license_autosync' ) ) {
wp_clear_scheduled_hook( 'wbcr_clr_license_autosync' );
}
/**
* Добавляем новый cron хук
*/
if ( ! wp_next_scheduled( 'wbcr_clearfy_license_autosync' ) ) {
wp_schedule_event( time(), 'twicedaily', 'wbcr_clearfy_license_autosync' );
}
if ( $this->plugin->getPopulateOption( 'remove_style_version' ) ) {
$this->plugin->updatePopulateOption( 'disable_remove_style_version_for_auth_users', 1 );
}
}
}

View File

@@ -0,0 +1,20 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010501 extends Wbcr_Factory480_Update {
public function install() {
require_once( WCL_PLUGIN_DIR . '/components/ga-cache/migrations/030002.php' );
$gac_updates = new WGACUpdate030002( $this->plugin );
$gac_updates->install();
}
}

View File

@@ -0,0 +1,24 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010504 extends Wbcr_Factory480_Update {
public function install() {
$deactivate_components = $this->plugin->getPopulateOption( 'deactive_preinstall_components', [] );
if ( empty( $deactivate_components ) || ! in_array( 'assets_manager', $deactivate_components ) ) {
require_once( WCL_PLUGIN_DIR . '/components/assets-manager/migrations/010108.php' );
$am_updates = new WGZUpdate010108( $this->plugin );
$am_updates->install();
}
}
}

View File

@@ -0,0 +1,389 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010505 extends Wbcr_Factory480_Update {
public function install() {
$this->update_premium();
$this->move_freemius_addons();
if ( is_multisite() && $this->plugin->isNetworkActive() ) {
global $wpdb;
$blogs = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
if ( ! empty( $blogs ) ) {
foreach ( $blogs as $id ) {
switch_to_blog( $id );
$this->assets_manager_migration();
restore_current_blog();
}
}
} else {
$this->assets_manager_migration();
}
/**
* Очищаем старые данных от плагина Hide my wp
*/
$this->clean_hide_my_wp_data();
WBCR\Factory_Templates_134\Helpers::flushPageCache();
}
/**
* Перенос данных из старого менеджера скриптов в новый
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function assets_manager_migration() {
if ( ! defined( 'WGZ_PLUGIN_DIR' ) ) {
define( 'WGZ_PLUGIN_DIR', WCL_PLUGIN_DIR . '/components/assets-manager' );
}
/**
* Миграция для аддона Updates manager
*/
require_once( WCL_PLUGIN_DIR . '/components/assets-manager/migrations/010108.php' );
$wupm_updates = new WGZUpdate010108( $this->plugin );
$wupm_updates->install();
}
/**
* Безопасно отключаем Hide my wp, так как он будет удален.
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function clean_hide_my_wp_data() {
$is_hide_my_wp_active = get_option( $this->plugin->getPrefix() . 'hide_my_wp_activate' );
if ( is_multisite() || ! $is_hide_my_wp_active ) {
return;
}
if ( $this->is_apache() ) {
$this->reset_hide_my_wp_settings();
require_once ABSPATH . 'wp-admin/includes/file.php';
require_once ABSPATH . 'wp-admin/includes/misc.php';
flush_rewrite_rules( true );
}
}
/**
* Миграция из старой модели лицензирования на новую модель
*
* Чтобы пользователи, у котороых установлен премиум плагина, ничего
* не заметили при обновлени плагина и не столкнулись с проблемами в
* использовании премиум версии Clearfy, нам нужно создать мягкую
* миграцию и обновление премиум версии.
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function update_premium() {
// Удаляем крон задачу из старой модели лицензирования
if ( ! wp_next_scheduled( 'wbcr_clearfy_license_autosync' ) ) {
wp_clear_scheduled_hook( 'wbcr_clearfy_license_autosync' );
}
# Вносим данные уже установленного премиум плагина в новую систему лицензирования.
# Запускаем принудильную проверку обновлений для премиум плагина.
# ------------------------------------------------------------------------
if ( $this->plugin->premium->is_activate() && ! $this->plugin->premium->is_install_package() ) {
# Выполняем синхронизацию лицензии и обновляем версию SDK Freemius для стабильной работы,
# если лицензия была активирован на SDK ниже 2.2.3, при скачивании премиум плагина
# сервис freemius будет возвращать ошибку 500.
$this->plugin->premium->sync();
require_once ABSPATH . '/wp-admin/includes/plugin.php';
$plugins = get_plugins( $plugin_folder = '' );
if ( ! empty( $plugins ) ) {
foreach ( (array) $plugins as $plugin_base => $plugin ) {
$basename_parts = explode( '/', $plugin_base );
if ( sizeof( $basename_parts ) == 2 && $basename_parts[0] == 'clearfy_package' ) {
$plugin_basename = $plugin_base;
$plugin_main_file = WP_PLUGIN_DIR . '/' . $plugin_base;
$default_headers = [
'Version' => 'Version',
'FrameworkVersion' => 'Framework Version'
];
$plugin_data = get_file_data( $plugin_main_file, $default_headers, 'plugin' );
try {
$this->plugin->premium->update_package_data( [
'basename' => $plugin_basename,
'version' => $plugin_data['Version'],
'framework_version' => isset( $plugin_data['FrameworkVersion'] ) ? $plugin_data['FrameworkVersion'] : null,
] );
} catch( Exception $e ) {
// nothing
}
$this->plugin->updatePopulateOption( "last_check_premium_update_time", 0 );
return;
}
}
}
}
}
/**
* Удаляем данные от старой системы лицензирования и загрузки пакетов с freemius
*
* Мы перешли на новую модель установки премиум аддонов, старая модель больше не
* нужна, просто удаляем ее.
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function move_freemius_addons() {
$freemius_activated_addons = WCL_Plugin::app()->getPopulateOption( 'freemius_activated_addons', [] );
if ( ! in_array( 'webcraftic-hide-my-wp', $freemius_activated_addons ) ) {
WCL_Plugin::app()->deactivateComponent( 'hide_my_wp' );
}
WCL_Plugin::app()->deletePopulateOption( 'freemius_addons' );
WCL_Plugin::app()->deletePopulateOption( 'freemius_addons_last_update' );
}
// For Clean Hide my wp settings
// ============================================================================================
public static function is_hide_mode_active() {
return WCL_Plugin::app()->getPopulateOption( 'hide_my_wp_activate', false );
}
/**
* Return if the server run Apache
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*
* @return bool
*/
private function is_apache() {
$is_apache = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false );
return $is_apache;
}
/**
* Get rules marker
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*
* @return string
*/
private function get_rules_marker() {
if ( is_multisite() ) {
return "Webcraftic Hide My Wp Site" . get_current_blog_id();
}
return "Webcraftic Hide My Wp";
}
/**
* Return the server home path
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @return bool|string
*/
private function get_home_path() {
$home = set_url_scheme( get_option( 'home' ), 'http' );
$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
if ( $pos !== false ) {
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
$home_path = trim( $home_path, '/\\' ) . DIRECTORY_SEPARATOR;;
} else {
$wp_path_rel_to_home = DIRECTORY_SEPARATOR . trim( $wp_path_rel_to_home, '/\\' ) . DIRECTORY_SEPARATOR;
$real_apth = realpath( ABSPATH ) . DIRECTORY_SEPARATOR;
$pos = strpos( $real_apth, $wp_path_rel_to_home );
$home_path = substr( $real_apth, 0, $pos );
$home_path = trim( $home_path, '/\\' ) . DIRECTORY_SEPARATOR;
}
} else {
$home_path = ABSPATH;
}
$home_path = trim( $home_path, '\\/ ' );
//not for windows
if ( DIRECTORY_SEPARATOR != '\\' ) {
$home_path = DIRECTORY_SEPARATOR . $home_path;
}
return $home_path;
}
/**
* Return whatever the htaccess config file is writable
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @return bool
*/
private function is_writable_htaccess_config_file() {
$home_path = $this->get_home_path();
$htaccess_file = $home_path . DIRECTORY_SEPARATOR . '.htaccess';
if ( ( ! file_exists( $htaccess_file ) && $this->is_permalink() ) || is_writable( $htaccess_file ) ) {
return true;
}
return false;
}
/**
* @param $filename
* @param $markers
*
* @return bool
*/
private function clean_rules_in_file( $filename, $markers ) {
if ( ! file_exists( $filename ) ) {
if ( ! is_writable( dirname( $filename ) ) ) {
return false;
}
if ( ! touch( $filename ) ) {
return false;
}
} else if ( ! is_writeable( $filename ) ) {
return false;
}
$start_marker = $markers['start'];
$end_marker = $markers['end'];
$fp = fopen( $filename, 'r+' );
if ( ! $fp ) {
return false;
}
// Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired.
flock( $fp, LOCK_EX );
$lines = [];
while( ! feof( $fp ) ) {
$lines[] = rtrim( fgets( $fp ), "\r\n" );
}
// Split out the existing file into the preceding lines, and those that appear after the marker
$pre_lines = $post_lines = $existing_lines = [];
$found_marker = $found_end_marker = false;
foreach ( $lines as $line ) {
if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
$found_marker = true;
continue;
} else if ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) {
$found_end_marker = true;
continue;
}
if ( ! $found_marker ) {
$pre_lines[] = $line;
} else if ( $found_marker && $found_end_marker ) {
$post_lines[] = $line;
} else {
$existing_lines[] = $line;
}
}
// Generate the new file data
if ( $found_marker && $found_end_marker ) {
$new_file_data = implode( "\n", array_merge( $pre_lines, $post_lines ) );
// Write to the start of the file, and truncate it to that length
fseek( $fp, 0 );
$bytes = fwrite( $fp, $new_file_data );
if ( $bytes ) {
ftruncate( $fp, ftell( $fp ) );
}
fflush( $fp );
flock( $fp, LOCK_UN );
fclose( $fp );
return (bool) $bytes;
}
return false;
}
/**
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function reset_hide_my_wp_settings() {
WCL_Plugin::app()->deletePopulateOption( 'hide_my_wp_activate' );
WCL_Plugin::app()->deletePopulateOption( 'replace_content_filters' );
WCL_Plugin::app()->deletePopulateOption( 'replace_content_patterns' );
WCL_Plugin::app()->deletePopulateOption( 'recovery_content_patterns' );
WCL_Plugin::app()->deletePopulateOption( 'recovery_content_filters' );
WCL_Plugin::app()->deletePopulateOption( 'nginx_rewrite_rules' );
WCL_Plugin::app()->deletePopulateOption( 'apache_rewrite_rules' );
WCL_Plugin::app()->deletePopulateOption( 'server_configuration_error' );
//check if .htaccess file exists and is writable
if ( $this->is_writable_htaccess_config_file() ) {
$home_path = $this->get_home_path();
$htaccess_file = $home_path . DIRECTORY_SEPARATOR . '.htaccess';
$markers = [
'start' => '# BEGIN ' . $this->get_rules_marker(),
'end' => '# END ' . $this->get_rules_marker()
];
$this->clean_rules_in_file( $htaccess_file, $markers );
}
}
/**
* Is permalink enabled?
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
* @return bool
* @global WP_Rewrite $wp_rewrite
*/
private function is_permalink() {
global $wp_rewrite;
if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
return false;
}
return true;
}
}

View File

@@ -0,0 +1,18 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010601 extends Wbcr_Factory480_Update {
public function install() {
$this->plugin->updatePopulateOption( "last_check_premium_update_time", 0 );
}
}

View File

@@ -0,0 +1,38 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WCLUpdate010604 extends Wbcr_Factory480_Update {
public function install() {
$this->assets_manager_migration();
}
/**
* Перенос данных из старого менеджера скриптов в новый
*
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
* @since 1.6.0
*/
private function assets_manager_migration() {
if ( ! defined( 'WGZ_PLUGIN_DIR' ) ) {
define( 'WGZ_PLUGIN_DIR', WCL_PLUGIN_DIR . '/components/assets-manager' );
}
/**
* Миграция для аддона Assets manager
*/
require_once( WCL_PLUGIN_DIR . '/components/assets-manager/migrations/020005.php' );
$wupm_updates = new WGZUpdate020005( $this->plugin );
$wupm_updates->install();
}
}

View File

@@ -0,0 +1,19 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCLUpdate010800 extends Wbcr_Factory480_Update {
public function install()
{
$this->plugin->deactivate_component('cache');
}
}

View File

@@ -0,0 +1,20 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCLUpdate010900 extends Wbcr_Factory480_Update {
public function install()
{
//$this->plugin->updatePopulateOption('start_second_google_page_speed_audit', 1);
//wp_schedule_event(time(), 'daily', 'wclearfy/google_page_speed_audit');
}
}

View File

@@ -0,0 +1,21 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
// Exit if accessed directly
if( !defined('ABSPATH') ) {
exit;
}
class WCLUpdate010903 extends Wbcr_Factory480_Update {
public function install()
{
if( wp_next_scheduled('wclearfy/google_page_speed_audit') ) {
wp_clear_scheduled_hook('wclearfy/google_page_speed_audit');
}
}
}

View File

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