This commit is contained in:
2026-10-12 20:35:25 -06:00
parent bef9999f6a
commit 225515570a
963 changed files with 273176 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
<?php
defined( 'ABSPATH' ) || exit;
add_action( 'update_option_secupress_users-login_settings', 'rocket_after_update_single_options', 10, 2 );
/**
* Add SecuPress move login pages to cache exclusion
*
* @since 2.9
* @author Remy Perona
*
* @param array $urls URLs to exclude from cache.
* @param bool $show_safe_content show sensitive uris.
* @return array Updated URLs to exclude
*/
function rocket_exclude_secupress_move_login( $urls, $show_safe_content = true ) {
if ( ! $show_safe_content ) {
return $urls;
}
if ( ! function_exists( 'secupress_move_login_get_slugs' ) ) {
return $urls;
}
$bases = secupress_get_rewrite_bases();
$slugs = secupress_move_login_get_slugs();
foreach ( $slugs as $slug ) {
$urls[] = $bases['base'] . ltrim( $bases['site_from'], '/' ) . $slug . '/?';
}
return $urls;
}
add_filter( 'rocket_cache_reject_uri', 'rocket_exclude_secupress_move_login', 2, 2 );
/**
* Add SecuPress move login pages to cache exclusion when activating the plugin
*
* @since 2.9
* @author Remy Perona
*/
function rocket_maybe_activate_secupress() {
if ( function_exists( 'secupress_move_login_get_slugs' ) ) {
rocket_activate_secupress();
}
}
add_action( 'secupress.plugins.activation', 'rocket_maybe_activate_secupress', 10001 );
/**
* Add SecuPress move login pages to cache exclusion when activating the move login module
*
* @since 2.9
* @author Remy Perona
*/
function rocket_activate_secupress() {
add_filter( 'rocket_cache_reject_uri', 'rocket_exclude_secupress_move_login', 2, 2 );
// Update the WP Rocket rules on the .htaccess.
flush_rocket_htaccess();
// Regenerate the config file.
rocket_generate_config_file();
}
add_action( 'secupress.plugin.move_login.activate', 'rocket_activate_secupress' );
/**
* Remove SecuPress move login pages from cache exclusion when deactivating the plugin
*
* @since 2.9
* @author Remy Perona
*/
function rocket_maybe_deactivate_secupress() {
if ( function_exists( 'secupress_move_login_get_slugs' ) ) {
rocket_deactivate_secupress();
}
}
add_action( 'secupress.deactivation', 'rocket_maybe_deactivate_secupress', 10001 );
/**
* Remove SecuPress move login pages from cache exclusion when deactivating the move login module
*
* @since 2.9
* @author Remy Perona
*/
function rocket_deactivate_secupress() {
remove_filter( 'rocket_cache_reject_uri', 'rocket_exclude_secupress_move_login' );
// Update the WP Rocket rules on the .htaccess.
flush_rocket_htaccess();
// Regenerate the config file.
rocket_generate_config_file();
}
add_action( 'secupress.plugin.move_login.deactivate', 'rocket_deactivate_secupress' );
+86
View File
@@ -0,0 +1,86 @@
<?php
defined( 'ABSPATH' ) || exit;
if ( defined( 'SFML_VERSION' ) ) :
add_filter( 'rocket_cache_reject_uri', 'rocket_add_sfml_exclude_pages', 2, 2 );
add_action( 'update_option_sfml', 'rocket_after_update_single_options', 10, 2 );
endif;
/**
* Exclude SF Move Login custom urls from caching
*
* @since 2.9.3 Moved to 3rd party file and improved
* @since 2.6
*
* @param array $urls An array of URLs to exclude from cache.
* @param bool $show_safe_content show sensitive uris.
* @return array Updated array of URLs
*/
function rocket_add_sfml_exclude_pages( $urls, $show_safe_content = true ) {
if ( ! $show_safe_content ) {
return $urls;
}
if ( ! function_exists( 'sfml_get_slugs' ) ) {
if ( file_exists( SFML_PLUGIN_DIR . 'inc/utilities.php' ) ) {
include SFML_PLUGIN_DIR . 'inc/utilities.php';
} else {
return $urls;
}
}
if ( ! class_exists( 'SFML_Options' ) && ! defined( 'SFML_NOOP_VERSION' ) ) {
if ( file_exists( SFML_PLUGIN_DIR . 'inc/class-sfml-options.php' ) ) {
include SFML_PLUGIN_DIR . 'inc/class-sfml-options.php';
} else {
return $urls;
}
}
$sfml_slugs = sfml_get_slugs();
$sfml_slugs = array_map( 'home_url', $sfml_slugs );
$sfml_slugs = array_map( 'trailingslashit', $sfml_slugs );
$sfml_slugs = array_map( 'rocket_clean_exclude_file', $sfml_slugs );
foreach ( $sfml_slugs as $key => $slug ) {
$sfml_slugs[ $key ] = $slug . '?';
}
return array_merge( $urls, $sfml_slugs );
}
/**
* Add SFML custom urls to caching exclusion when activating the plugin
*
* @since 2.9.3
*/
function rocket_activate_sfml() {
if ( defined( 'SFML_VERSION' ) ) {
add_filter( 'rocket_cache_reject_uri', 'rocket_add_sfml_exclude_pages', 2, 2 );
// Update the WP Rocket rules on the .htaccess.
flush_rocket_htaccess();
// Regenerate the config file.
rocket_generate_config_file();
}
}
add_action( 'activate_sf-move-login/sf-move-login.php', 'rocket_activate_sfml', 11 );
/**
* Remove SFML custom urls from caching exclusion when deactivating the plugin
*
* @since 2.9.3
*/
function rocket_deactivate_sfml() {
if ( defined( 'SFML_VERSION' ) ) {
remove_filter( 'rocket_cache_reject_uri', 'rocket_add_sfml_exclude_pages' );
// Update the WP Rocket rules on the .htaccess.
flush_rocket_htaccess();
// Regenerate the config file.
rocket_generate_config_file();
}
}
add_action( 'deactivate_sf-move-login/sf-move-login.php', 'rocket_deactivate_sfml', 11 );
+67
View File
@@ -0,0 +1,67 @@
<?php
defined( 'ABSPATH' ) || exit;
if ( class_exists( 'WPS_Hide_Login' ) || defined( 'WPS_HIDE_LOGIN_VERSION' ) ) :
add_action( 'update_option_whl_page', 'rocket_after_update_single_options', 10, 2 );
add_filter( 'rocket_cache_reject_uri', 'rocket_exlude_wps_hide_login_page', 2, 2 );
endif;
/**
* Exclude WPS Hide Login custom url from caching
*
* @since 3.1 Switch implementation depending on the WPS Hide Login version
* @since 2.11.7 Login url is retrieved using new_login_url() method of WPS_Hide_Login() class.
* @since 2.11 Moved to 3rd party file
* @since 2.6
*
* @param array $urls An array of URLs to exclude from cache.
* @param bool $show_safe_content show sensitive uris.
* @return array Updated array of URLs
*/
function rocket_exlude_wps_hide_login_page( $urls, $show_safe_content = true ) {
if ( ! $show_safe_content ) {
return $urls;
}
if ( class_exists( 'WPS_Hide_Login' ) ) {
$wps_hide_login = new WPS_Hide_Login();
$urls[] = rocket_clean_exclude_file( $wps_hide_login->new_login_url() );
} elseif ( class_exists( '\WPS\WPS_Hide_Login\Plugin' ) ) {
$urls[] = rocket_clean_exclude_file( \WPS\WPS_Hide_Login\Plugin::get_instance()->new_login_url() );
}
return $urls;
}
/**
* Add WPS Hide Login custom url to caching exclusion when activating the plugin
*
* @since 2.11
*/
function rocket_activate_wps_hide_login() {
add_filter( 'rocket_cache_reject_uri', 'rocket_exlude_wps_hide_login_page', 2, 2 );
// Update .htaccess file rules.
flush_rocket_htaccess();
// Update config file.
rocket_generate_config_file();
}
add_action( 'activate_wps-hide-login/wps-hide-login.php', 'rocket_activate_wps_hide_login', 11 );
/**
* Remove WPS Hide Login custom url from caching exclusion when deactivating the plugin
*
* @since 2.11
*/
function rocket_deactivate_wps_hide_login() {
remove_filter( 'rocket_cache_reject_uri', 'rocket_exlude_wps_hide_login_page' );
// Update .htaccess file rules.
flush_rocket_htaccess();
// Update config file.
rocket_generate_config_file();
}
add_action( 'deactivate_wps-hide-login/wps-hide-login.php', 'rocket_deactivate_wps_hide_login', 11 );