@@ -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 | /** |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | $variables = apply_filters( 'site-reviews/enqueue/public/localize', $variables ); |
95 | 95 | $script = ['window.hasOwnProperty("GLSR")||(window.GLSR={})']; |
96 | 96 | foreach( $variables as $key => $value ) { |
97 | - $script[] = sprintf( 'GLSR.%s = %s', $key, wp_json_encode( $value )); |
|
97 | + $script[] = sprintf( 'GLSR.%s = %s', $key, wp_json_encode( $value ) ); |
|
98 | 98 | } |
99 | - wp_add_inline_script( Application::ID, implode( ';', $script )); |
|
99 | + wp_add_inline_script( Application::ID, implode( ';', $script ) ); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | public function inlineStyles() |
106 | 106 | { |
107 | 107 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
108 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
109 | - if( !file_exists( $inlineStylesheetPath )) { |
|
108 | + if( !apply_filters( 'site-reviews/assets/css', true ) )return; |
|
109 | + if( !file_exists( $inlineStylesheetPath ) ) { |
|
110 | 110 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
111 | 111 | return; |
112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function getFixedSelectorsForPagination() |
126 | 126 | { |
127 | - $selectors = ['#wpadminbar','.site-navigation-fixed']; |
|
127 | + $selectors = ['#wpadminbar', '.site-navigation-fixed']; |
|
128 | 128 | return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors ); |
129 | 129 | } |
130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | protected function getStylesheet() |
135 | 135 | { |
136 | 136 | $currentStyle = glsr( Style::class )->style; |
137 | - return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' )) |
|
137 | + return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) ) |
|
138 | 138 | ? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' ) |
139 | 139 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
140 | 140 | } |