Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/3rd-party/themes/studiopress.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 +
3 + defined( 'ABSPATH' ) || exit;
4 +
5 + add_action( 'admin_init', 'rocket_clear_cache_after_studiopress_accelerator' );
6 + /**
7 + * Clear WP Rocket cache after purged the StudioPress Accelerator cache
8 + *
9 + * @since 2.5.5
10 + *
11 + * @return void
12 + */
13 + function rocket_clear_cache_after_studiopress_accelerator() {
14 + if ( ! current_user_can( 'rocket_manage_options' ) ) {
15 + return;
16 + }
17 +
18 + if ( isset( $GLOBALS['sp_accel_nginx_proxy_cache_purge'] ) && is_a( $GLOBALS['sp_accel_nginx_proxy_cache_purge'], 'SP_Accel_Nginx_Proxy_Cache_Purge' ) && isset( $_REQUEST['_wpnonce'] ) ) {
19 + $nonce = $_REQUEST['_wpnonce']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Recommended
20 + if ( wp_verify_nonce( $nonce, 'sp-accel-purge-url' ) && ! empty( $_REQUEST['cache-purge-url'] ) ) {
21 + $submitted_url = sanitize_text_field( wp_unslash( $_REQUEST['cache-purge-url'] ) );
22 +
23 + // Clear the URL.
24 + rocket_clean_files( [ $submitted_url ] );
25 + } elseif ( wp_verify_nonce( $nonce, 'sp-accel-purge-theme' ) ) {
26 + // Clear all caching files.
27 + rocket_clean_domain();
28 +
29 + // Preload cache.
30 + run_rocket_bot();
31 + run_rocket_sitemap_preload();
32 + }
33 + }
34 + }
35 +
36 + add_action( 'rocket_after_clean_domain', 'rocket_clean_studiopress_accelerator' );
37 + /**
38 + * Call the cache server to purge the cache with StudioPress Accelerator.
39 + *
40 + * @since 2.5.5
41 + *
42 + * @return void
43 + */
44 + function rocket_clean_studiopress_accelerator() {
45 + if ( isset( $GLOBALS['sp_accel_nginx_proxy_cache_purge'] ) && is_a( $GLOBALS['sp_accel_nginx_proxy_cache_purge'], 'SP_Accel_Nginx_Proxy_Cache_Purge' ) ) {
46 + $GLOBALS['sp_accel_nginx_proxy_cache_purge']->cache_flush_theme();
47 + }
48 + }
49 +