8989 && ( ! isset ( $ _GET ['lang ' ] ) )
9090 && ( ! isset ( $ _GET ['s ' ] ) )
9191 && ( ! isset ( $ _GET ['age-verified ' ] ) )
92+ && ( ! isset ( $ _GET ['ao_noptimize ' ] ) )
9293 && ( ! isset ( $ rocket_cache_query_strings ) || ! array_intersect ( array_keys ( $ _GET ), $ rocket_cache_query_strings ) )
9394) {
9495 rocket_define_donotminify_constants ( true );
156157 $ user_key = explode ( '| ' , $ _COOKIE [ 'wordpress_logged_in_ ' . $ rocket_cookie_hash ] );
157158 $ user_key = reset ( ( $ user_key ) );
158159 $ user_key = $ user_key . '- ' . $ rocket_secret_cache_key ;
159-
160+
160161 // Get cache folder of host name
161- $ request_uri_path = $ rocket_cache_path . $ host . '- ' . $ user_key . rtrim ( $ request_uri , '/ ' );
162+ $ request_uri_path = $ rocket_cache_path . $ host . '- ' . $ user_key . rtrim ( $ request_uri , '/ ' );
162163 }
163164}
164165else {
170171// Rename the caching filename for mobile
171172if ( isset ( $ rocket_cache_mobile , $ rocket_do_caching_mobile_files ) && class_exists ( 'Rocket_Mobile_Detect ' ) ) {
172173 $ detect = new Rocket_Mobile_Detect ();
173-
174+
174175 if ( $ detect ->isMobile () && ! $ detect ->isTablet () ) {
175176 $ filename .= '-mobile ' ;
176177 }
177178
178179 if ( strpos ( $ _SERVER ['SERVER_SOFTWARE ' ], 'nginx ' ) !== false ) {
179180 // Create a hidden empty file for mobile detection on NGINX with the Rocket NGINX configuration
180181 $ nginx_mobile_detect_file = $ request_uri_path . '/.mobile-active ' ;
181-
182+
182183 if ( ! file_exists ( $ nginx_mobile_detect_file ) ) {
183184 touch ( $ nginx_mobile_detect_file );
184185 }
191192}
192193
193194// Rename the caching filename depending to dynamic cookies
194- if ( ! empty ( $ rocket_cache_dynamic_cookies ) ) {
195+ if ( ! empty ( $ rocket_cache_dynamic_cookies ) ) {
195196 foreach ( $ rocket_cache_dynamic_cookies as $ cookie_name ) {
196197 if ( ! empty ( $ _COOKIE [ $ cookie_name ] ) ) {
197198 $ cache_key = $ _COOKIE [ $ cookie_name ];
@@ -225,7 +226,7 @@ function do_rocket_callback( $buffer ) {
225226 * @param bool true will force caching search results
226227 */
227228 $ rocket_cache_search = apply_filters ( 'rocket_cache_search ' , false );
228-
229+
229230 /**
230231 * Allow to override the DONOTCACHEPAGE behavior.
231232 * To warn conflict with some plugins like Thrive Leads.
@@ -235,7 +236,7 @@ function do_rocket_callback( $buffer ) {
235236 * @param bool true will force the override
236237 */
237238 $ rocket_override_donotcachepage = apply_filters ( 'rocket_override_donotcachepage ' , false );
238-
239+
239240 if ( strlen ( $ buffer ) > 255
240241 && ( function_exists ( 'is_404 ' ) && ! is_404 () ) // Don't cache 404
241242 && ( function_exists ( 'is_search ' ) && ! is_search () || $ rocket_cache_search ) // Don't cache search results
@@ -246,7 +247,7 @@ function do_rocket_callback( $buffer ) {
246247
247248 $ footprint = '' ;
248249 $ is_html = false ;
249-
250+
250251 if ( preg_match ( '/(<\/html>)/i ' , $ buffer ) ) {
251252 // This hook is used for:
252253 // - Add width and height attributes on images
@@ -256,10 +257,10 @@ function do_rocket_callback( $buffer ) {
256257 // - CDN
257258 // - LazyLoad
258259 $ buffer = apply_filters ( 'rocket_buffer ' , $ buffer );
259-
260+
260261 $ is_html = true ;
261262 }
262-
263+
263264 /**
264265 * Allow to the generate the caching file
265266 *
@@ -270,11 +271,11 @@ function do_rocket_callback( $buffer ) {
270271 if ( apply_filters ( 'do_rocket_generate_caching_files ' , true ) ) {
271272 // Create cache folders of the request uri
272273 rocket_mkdir_p ( $ request_uri_path );
273-
274+
274275 if ( $ is_html ) {
275276 $ footprint = get_rocket_footprint ();
276277 }
277-
278+
278279 // Save the cache file
279280 rocket_put_content ( $ rocket_cache_filepath , $ buffer . $ footprint );
280281
@@ -291,7 +292,7 @@ function do_rocket_callback( $buffer ) {
291292 if ( $ is_html ) {
292293 $ footprint = get_rocket_footprint (false );
293294 }
294-
295+
295296 $ buffer = $ buffer . $ footprint ;
296297 }
297298
@@ -304,7 +305,7 @@ function do_rocket_callback( $buffer ) {
304305 * @since 2.0
305306 */
306307function rocket_serve_cache_file ( $ rocket_cache_filepath ) {
307-
308+
308309 // Check if cache file exist
309310 if ( file_exists ( $ rocket_cache_filepath ) && is_readable ( $ rocket_cache_filepath ) ) {
310311
@@ -322,7 +323,7 @@ function rocket_serve_cache_file( $rocket_cache_filepath ) {
322323 header ( $ _SERVER ['SERVER_PROTOCOL ' ] . ' 304 Not Modified ' , true , 304 );
323324 exit ;
324325 }
325-
326+
326327 // Serve the cache if file isn't store in the client browser cache
327328 readfile ( $ rocket_cache_filepath );
328329 exit ;
@@ -361,7 +362,7 @@ function rocket_define_donotminify_constants( $value ) {
361362 if ( ! defined ( 'DONOTMINIFYCSS ' ) ) {
362363 define ( 'DONOTMINIFYCSS ' , (bool ) $ value );
363364 }
364-
365+
365366 if ( ! defined ( 'DONOTMINIFYJS ' ) ) {
366367 define ( 'DONOTMINIFYJS ' , (bool ) $ value );
367368 }
0 commit comments