@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * @see https://wordpress.org/plugins/wp-super-cache/ |
21 | 21 | */ |
22 | 22 | add_action( 'site-reviews/review/created', function( $review, $request ) { |
23 | - if( !function_exists( 'wp_cache_post_change' ))return; |
|
23 | + if( !function_exists( 'wp_cache_post_change' ) )return; |
|
24 | 24 | wp_cache_post_change( $request->post_id ); |
25 | - if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return; |
|
25 | + if( empty($review->assigned_to) || $review->assigned_to == $request->post_id )return; |
|
26 | 26 | wp_cache_post_change( $review->assigned_to ); |
27 | 27 | }, 10, 2 ); |
28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
35 | 35 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
36 | - return array_keys( array_flip( $scriptHandles )); |
|
36 | + return array_keys( array_flip( $scriptHandles ) ); |
|
37 | 37 | }); |
38 | 38 | |
39 | 39 | /** |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @see https://searchandfilter.com/ |
44 | 44 | */ |
45 | 45 | add_filter( 'sf_edit_query_args', function( $query ) { |
46 | - if( !empty( $query['meta_key'] ) && $query['meta_key'] == '_glsr_ranking' ) { |
|
47 | - unset( $query['meta_key'] ); |
|
46 | + if( !empty($query['meta_key']) && $query['meta_key'] == '_glsr_ranking' ) { |
|
47 | + unset($query['meta_key']); |
|
48 | 48 | $query['meta_query'] = [ |
49 | 49 | 'relation' => 'OR', |
50 | 50 | ['key' => '_glsr_ranking', 'compare' => 'NOT EXISTS'], // this comes first! |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function enqueueAssets() |
29 | 29 | { |
30 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
30 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
31 | 31 | wp_enqueue_style( |
32 | 32 | Application::ID, |
33 | 33 | $this->getStylesheet(), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | glsr()->version |
36 | 36 | ); |
37 | 37 | } |
38 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
38 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
39 | 39 | $dependencies = apply_filters( 'site-reviews/assets/polyfill', true ) |
40 | 40 | ? [Application::ID.'/polyfill'] |
41 | 41 | : []; |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function enqueuePolyfillService() |
57 | 57 | { |
58 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
59 | - wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([ |
|
58 | + if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return; |
|
59 | + wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [ |
|
60 | 60 | 'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,MutationObserver', |
61 | 61 | 'flags' => 'gated', |
62 | - ], 'https://cdn.polyfill.io/v2/polyfill.min.js' )); |
|
62 | + ], 'https://cdn.polyfill.io/v2/polyfill.min.js' ) ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | // nf-google-recaptcha |
73 | 73 | if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
74 | 74 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
75 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
75 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
76 | 76 | 'hl' => $language, |
77 | 77 | 'render' => 'explicit', |
78 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
78 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | public function inlineStyles() |
102 | 102 | { |
103 | 103 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
104 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
105 | - if( !file_exists( $inlineStylesheetPath )) { |
|
104 | + if( !apply_filters( 'site-reviews/assets/css', true ) )return; |
|
105 | + if( !file_exists( $inlineStylesheetPath ) ) { |
|
106 | 106 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
107 | 107 | return; |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $script = 'window.hasOwnProperty("GLSR")||(window.GLSR={});'; |
124 | 124 | foreach( $variables as $key => $value ) { |
125 | - $script.= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE )); |
|
125 | + $script .= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); |
|
126 | 126 | } |
127 | 127 | $pattern = '/\"([^ \-\"]+)\"(:[{\[\"])/'; // removes unnecessary quotes surrounding object keys |
128 | 128 | $optimizedScript = preg_replace( $pattern, '$1$2', $script ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFixedSelectorsForPagination() |
136 | 136 | { |
137 | - $selectors = ['#wpadminbar','.site-navigation-fixed']; |
|
137 | + $selectors = ['#wpadminbar', '.site-navigation-fixed']; |
|
138 | 138 | return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors ); |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function getStylesheet() |
145 | 145 | { |
146 | 146 | $currentStyle = glsr( Style::class )->style; |
147 | - return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' )) |
|
147 | + return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) ) |
|
148 | 148 | ? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' ) |
149 | 149 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
150 | 150 | } |