PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.2.1
ShopBuilder – WooCommerce Builder For Elementor v2.2.1
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Controllers/CacheController.php +17 -38 3.4.22.2.1 View file →
@@ -9,9 +9,8 @@
9 9
10 10 namespace RadiusTheme\SB\Controllers;
11 11
12 12 use RadiusTheme\SB\Helpers\Cache;
13 -use RadiusTheme\SB\Helpers\Fns;
14 13 use RadiusTheme\SB\Traits\SingletonTrait;
15 14
16 15 // Do not allow directly accessing this file.
17 16 if ( ! defined( 'ABSPATH' ) ) {
@@ -57,44 +56,31 @@
57 56 $wp_admin_bar->add_node(
58 57 [
59 58 'id' => 'clear_all_cache',
60 59 'parent' => 'shop_builder', // Set the parent to the top-level item ID.
61 - 'title' => esc_html__( 'Purge All Cache', 'shopbuilder' ),
62 - 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'all', add_query_arg( [] ) ), rtsb()->nonceText ),
60 + 'title' => 'Clear All Cache',
61 + 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'all', add_query_arg( null, null ) ), rtsb()->nonceText ),
63 62 ]
64 63 );
65 -
66 - if ( Fns::is_optimization_enabled() ) {
67 - $wp_admin_bar->add_node(
68 - [
69 - 'id' => 'clear_asset_cache',
70 - 'parent' => 'shop_builder',
71 - 'title' => esc_html__( 'Purge Asset Cache', 'shopbuilder' ),
72 - 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'asset', add_query_arg( [] ) ), rtsb()->nonceText ),
73 - ]
74 - );
75 - }
76 -
77 64 $wp_admin_bar->add_node(
78 65 [
79 66 'id' => 'clear_object_cache',
80 - 'parent' => 'shop_builder',
81 - 'title' => esc_html__( 'Purge Object Cache', 'shopbuilder' ),
82 - 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'data', add_query_arg( [] ) ), rtsb()->nonceText ),
67 + 'parent' => 'shop_builder', // Set the parent to the top-level item ID.
68 + 'title' => 'Clear Object Cache',
69 + 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'data', add_query_arg( null, null ) ), rtsb()->nonceText ),
83 70 ]
84 71 );
85 72 $wp_admin_bar->add_node(
86 73 [
87 74 'id' => 'clear_template_cache',
88 - 'parent' => 'shop_builder',
89 - 'title' => esc_html__( 'Purge Template Cache', 'shopbuilder' ),
90 - 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'template', add_query_arg( [] ) ), rtsb()->nonceText ),
75 + 'parent' => 'shop_builder', // Set the parent to the top-level item ID.
76 + 'title' => 'Clear Template Cache',
77 + 'href' => wp_nonce_url( add_query_arg( 'rtsb_clear_cache', 'template', add_query_arg( null, null ) ), rtsb()->nonceText ),
91 78 ]
92 79 );
93 80 }
94 81
95 -
96 - /**
82 + /***
97 83 *
98 84 * @return mixed
99 85 */
100 86 public function admin_bar_menu_action() {
@@ -103,14 +89,12 @@
103 89 }
104 90 if ( ! current_user_can( 'manage_options' ) ) {
105 91 return;
106 92 }
107 -
108 93 $clear_cache = sanitize_text_field( wp_unslash( $_GET['rtsb_clear_cache'] ?? '' ) );
109 94 if ( empty( $clear_cache ) ) {
110 95 return;
111 96 }
112 -
113 97 switch ( $clear_cache ) {
114 98 case 'all':
115 99 Cache::clear_all_cache();
116 100 break;
@@ -119,24 +103,19 @@
119 103 break;
120 104 case 'template':
121 105 Cache::clear_template_cache();
122 106 break;
123 - case 'asset':
124 - Cache::clear_asset_cache();
125 - break;
126 107 }
127 108 // Set the notice flag.
128 109 set_transient( 'rtsb_cache_cleared_notice', true, 30 );
129 - $referrer = wp_get_referer(); // Get the referrer URL.
130 - if ( $referrer ) {
131 - // Rebuild the URL with the original path and query string.
132 - $redirect_url = $referrer;
133 - // Redirect to the referrer URL with its query string intact.
134 - wp_safe_redirect( $redirect_url );
135 - exit;
136 - }
137 - // Fallback: if referrer is not available, redirect to home_url().
138 - wp_safe_redirect( home_url() );
110 +
111 + $ref_pram = wp_parse_url( wp_get_referer() );
112 + $path = $ref_pram['path'] ?? '/';
113 + parse_str( ( $ref_pram['query'] ?? '' ), $query_array );
114 + $the_query_arg = add_query_arg( $query_array, home_url( $path ) );
115 + $params[] = '_wpnonce';
116 + $redirect_url = urldecode( remove_query_arg( $params, $the_query_arg ) );
117 + wp_safe_redirect( $redirect_url );
139 118 exit;
140 119 }
141 120
142 121 /**