@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'navigation' => $navigation, |
51 | 51 | ], |
52 | 52 | 'reviews' => $this->buildReviews(), |
53 | - ]); |
|
53 | + ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $generatedReview = []; |
75 | 75 | foreach( $review as $key => $value ) { |
76 | 76 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildReview' ); |
77 | - if( !method_exists( $this, $method ))continue; |
|
77 | + if( !method_exists( $this, $method ) )continue; |
|
78 | 78 | $generatedReview[$key] = $this->$method( $key, $value ); |
79 | 79 | } |
80 | 80 | return (object)$generatedReview; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function buildReviewAssignedTo( $key, $value ) |
89 | 89 | { |
90 | - if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return; |
|
91 | - $post = get_post( intval( $value )); |
|
92 | - if( !( $post instanceof WP_Post ))return; |
|
90 | + if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return; |
|
91 | + $post = get_post( intval( $value ) ); |
|
92 | + if( !($post instanceof WP_Post) )return; |
|
93 | 93 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
94 | 94 | 'href' => get_the_permalink( $post->ID ), |
95 | - ]); |
|
95 | + ] ); |
|
96 | 96 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
97 | 97 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
98 | 98 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function buildReviewAuthor( $key, $value ) |
106 | 106 | { |
107 | - if( $this->isHidden( $key ))return; |
|
107 | + if( $this->isHidden( $key ) )return; |
|
108 | 108 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
109 | 109 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
110 | 110 | : ''; |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function buildReviewAvatar( $key, $value ) |
120 | 120 | { |
121 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
121 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return; |
|
122 | 122 | $size = $this->getOption( 'settings.reviews.avatars.size', 36 ); |
123 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
123 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
124 | 124 | 'src' => $value, |
125 | 125 | 'height' => $size, |
126 | 126 | 'width' => $size, |
127 | - ])); |
|
127 | + ] ) ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | protected function buildReviewContent( $key, $value ) |
136 | 136 | { |
137 | 137 | $text = $this->normalizeText( $value ); |
138 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
138 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
139 | 139 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
140 | 140 | } |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function buildReviewDate( $key, $value ) |
148 | 148 | { |
149 | - if( $this->isHidden( $key ))return; |
|
149 | + if( $this->isHidden( $key ) )return; |
|
150 | 150 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
151 | 151 | if( $dateFormat == 'relative' ) { |
152 | 152 | $date = glsr( Date::class )->relative( $value ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $format = $dateFormat == 'custom' |
156 | 156 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
157 | 157 | : (string)get_option( 'date_format' ); |
158 | - $date = date_i18n( $format, strtotime( $value )); |
|
158 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
159 | 159 | } |
160 | 160 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
161 | 161 | } |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function buildReviewRating( $key, $value ) |
169 | 169 | { |
170 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
170 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
171 | 171 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
172 | 172 | 'rating' => $value, |
173 | - ]); |
|
173 | + ] ); |
|
174 | 174 | return $this->wrap( $key, $rating ); |
175 | 175 | } |
176 | 176 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function buildReviewResponse( $key, $value ) |
183 | 183 | { |
184 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
185 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
184 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
185 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
186 | 186 | $text = $this->normalizeText( $value ); |
187 | 187 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
188 | 188 | return $this->wrap( $key, |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | */ |
199 | 199 | protected function buildReviewTitle( $key, $value ) |
200 | 200 | { |
201 | - if( $this->isHidden( $key ))return; |
|
202 | - if( empty( $value )) { |
|
201 | + if( $this->isHidden( $key ) )return; |
|
202 | + if( empty($value) ) { |
|
203 | 203 | $value = __( 'No Title', 'site-reviews' ); |
204 | 204 | } |
205 | 205 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function generateSchema() |
212 | 212 | { |
213 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
214 | - glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args )); |
|
213 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
214 | + glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args ) ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | { |
235 | 235 | $limit = $this->getOption( 'settings.reviews.excerpt.length', 55 ); |
236 | 236 | if( str_word_count( $text, 0 ) > $limit ) { |
237 | - $words = array_keys( str_word_count( $text, 2 )); |
|
238 | - $excerpt = ltrim( substr( $text, 0, $words[$limit] )); |
|
239 | - $hiddenText = substr( $text, strlen( $excerpt )); |
|
237 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
238 | + $excerpt = ltrim( substr( $text, 0, $words[$limit] ) ); |
|
239 | + $hiddenText = substr( $text, strlen( $excerpt ) ); |
|
240 | 240 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
241 | 241 | 'class' => 'glsr-hidden glsr-hidden-text', |
242 | 242 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
243 | 243 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
244 | - ]); |
|
244 | + ] ); |
|
245 | 245 | $text = $excerpt.$showMore; |
246 | 246 | } |
247 | 247 | return nl2br( $text ); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | protected function getOption( $path, $fallback = '' ) |
256 | 256 | { |
257 | - if( array_key_exists( $path, $this->options )) { |
|
257 | + if( array_key_exists( $path, $this->options ) ) { |
|
258 | 258 | return $this->options[$path]; |
259 | 259 | } |
260 | 260 | return $fallback; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | protected function isHidden( $key, $path = '' ) |
269 | 269 | { |
270 | - $isOptionEnabled = !empty( $path ) |
|
270 | + $isOptionEnabled = !empty($path) |
|
271 | 271 | ? $this->isOptionEnabled( $path ) |
272 | 272 | : true; |
273 | 273 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | protected function isHiddenOrEmpty( $key, $value ) |
282 | 282 | { |
283 | - return $this->isHidden( $key ) || empty( $value ); |
|
283 | + return $this->isHidden( $key ) || empty($value); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | protected function normalizeText( $text ) |
300 | 300 | { |
301 | 301 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
302 | - $text = convert_smilies( wptexturize( strip_shortcodes( $text ))); |
|
302 | + $text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) ); |
|
303 | 303 | $text = str_replace( ']]>', ']]>', $text ); |
304 | 304 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
305 | 305 | return $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' ) |
@@ -316,6 +316,6 @@ discard block |
||
316 | 316 | { |
317 | 317 | return glsr( Builder::class )->div( $value, [ |
318 | 318 | 'class' => 'glsr-review-'.$key, |
319 | - ]); |
|
319 | + ] ); |
|
320 | 320 | } |
321 | 321 | } |
@@ -74,7 +74,9 @@ discard block |
||
74 | 74 | $generatedReview = []; |
75 | 75 | foreach( $review as $key => $value ) { |
76 | 76 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildReview' ); |
77 | - if( !method_exists( $this, $method ))continue; |
|
77 | + if( !method_exists( $this, $method )) { |
|
78 | + continue; |
|
79 | + } |
|
78 | 80 | $generatedReview[$key] = $this->$method( $key, $value ); |
79 | 81 | } |
80 | 82 | return (object)$generatedReview; |
@@ -87,9 +89,13 @@ discard block |
||
87 | 89 | */ |
88 | 90 | protected function buildReviewAssignedTo( $key, $value ) |
89 | 91 | { |
90 | - if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return; |
|
92 | + if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' )) { |
|
93 | + return; |
|
94 | + } |
|
91 | 95 | $post = get_post( intval( $value )); |
92 | - if( !( $post instanceof WP_Post ))return; |
|
96 | + if( !( $post instanceof WP_Post )) { |
|
97 | + return; |
|
98 | + } |
|
93 | 99 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
94 | 100 | 'href' => get_the_permalink( $post->ID ), |
95 | 101 | ]); |
@@ -104,7 +110,9 @@ discard block |
||
104 | 110 | */ |
105 | 111 | protected function buildReviewAuthor( $key, $value ) |
106 | 112 | { |
107 | - if( $this->isHidden( $key ))return; |
|
113 | + if( $this->isHidden( $key )) { |
|
114 | + return; |
|
115 | + } |
|
108 | 116 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
109 | 117 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
110 | 118 | : ''; |
@@ -118,7 +126,9 @@ discard block |
||
118 | 126 | */ |
119 | 127 | protected function buildReviewAvatar( $key, $value ) |
120 | 128 | { |
121 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
129 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' )) { |
|
130 | + return; |
|
131 | + } |
|
122 | 132 | $size = $this->getOption( 'settings.reviews.avatars.size', 36 ); |
123 | 133 | return $this->wrap( $key, glsr( Builder::class )->img([ |
124 | 134 | 'src' => $value, |
@@ -135,7 +145,9 @@ discard block |
||
135 | 145 | protected function buildReviewContent( $key, $value ) |
136 | 146 | { |
137 | 147 | $text = $this->normalizeText( $value ); |
138 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
148 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
149 | + return; |
|
150 | + } |
|
139 | 151 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
140 | 152 | } |
141 | 153 | |
@@ -146,7 +158,9 @@ discard block |
||
146 | 158 | */ |
147 | 159 | protected function buildReviewDate( $key, $value ) |
148 | 160 | { |
149 | - if( $this->isHidden( $key ))return; |
|
161 | + if( $this->isHidden( $key )) { |
|
162 | + return; |
|
163 | + } |
|
150 | 164 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
151 | 165 | if( $dateFormat == 'relative' ) { |
152 | 166 | $date = glsr( Date::class )->relative( $value ); |
@@ -167,7 +181,9 @@ discard block |
||
167 | 181 | */ |
168 | 182 | protected function buildReviewRating( $key, $value ) |
169 | 183 | { |
170 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
184 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
185 | + return; |
|
186 | + } |
|
171 | 187 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
172 | 188 | 'rating' => $value, |
173 | 189 | ]); |
@@ -181,7 +197,9 @@ discard block |
||
181 | 197 | */ |
182 | 198 | protected function buildReviewResponse( $key, $value ) |
183 | 199 | { |
184 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
200 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
201 | + return; |
|
202 | + } |
|
185 | 203 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
186 | 204 | $text = $this->normalizeText( $value ); |
187 | 205 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -198,7 +216,9 @@ discard block |
||
198 | 216 | */ |
199 | 217 | protected function buildReviewTitle( $key, $value ) |
200 | 218 | { |
201 | - if( $this->isHidden( $key ))return; |
|
219 | + if( $this->isHidden( $key )) { |
|
220 | + return; |
|
221 | + } |
|
202 | 222 | if( empty( $value )) { |
203 | 223 | $value = __( 'No Title', 'site-reviews' ); |
204 | 224 | } |
@@ -210,7 +230,9 @@ discard block |
||
210 | 230 | */ |
211 | 231 | protected function generateSchema() |
212 | 232 | { |
213 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
233 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
234 | + return; |
|
235 | + } |
|
214 | 236 | glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args )); |
215 | 237 | } |
216 | 238 |
@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | public function fields() |
14 | 14 | { |
15 | 15 | return [[ |
16 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
16 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
17 | 17 | 'minWidth' => 320, |
18 | 18 | 'type' => 'container', |
19 | - ],[ |
|
19 | + ], [ |
|
20 | 20 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
21 | 21 | 'name' => 'title', |
22 | 22 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
23 | 23 | 'type' => 'textbox', |
24 | - ],[ |
|
24 | + ], [ |
|
25 | 25 | 'label' => esc_html__( 'Count', 'site-reviews' ), |
26 | 26 | 'maxLength' => 5, |
27 | 27 | 'name' => 'count', |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | 'text' => '10', |
30 | 30 | 'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ), |
31 | 31 | 'type' => 'textbox', |
32 | - ],[ |
|
32 | + ], [ |
|
33 | 33 | 'label' => esc_html__( 'Rating', 'site-reviews' ), |
34 | 34 | 'name' => 'rating', |
35 | 35 | 'options' => [ |
36 | - '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )), |
|
37 | - '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )), |
|
38 | - '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )), |
|
39 | - '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )), |
|
40 | - '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )), |
|
36 | + '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ), |
|
37 | + '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ), |
|
38 | + '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ), |
|
39 | + '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ), |
|
40 | + '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ), |
|
41 | 41 | ], |
42 | 42 | 'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ), |
43 | 43 | 'type' => 'listbox', |
44 | - ],[ |
|
44 | + ], [ |
|
45 | 45 | 'label' => esc_html__( 'Pagination', 'site-reviews' ), |
46 | 46 | 'name' => 'pagination', |
47 | 47 | 'options' => [ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'name' => 'assigned_to', |
60 | 60 | 'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ), |
61 | 61 | 'type' => 'textbox', |
62 | - ],[ |
|
62 | + ], [ |
|
63 | 63 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
64 | 64 | 'name' => 'schema', |
65 | 65 | 'options' => [ |
@@ -68,49 +68,49 @@ discard block |
||
68 | 68 | ], |
69 | 69 | 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
70 | 70 | 'type' => 'listbox', |
71 | - ],[ |
|
71 | + ], [ |
|
72 | 72 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
73 | 73 | 'name' => 'class', |
74 | 74 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
75 | 75 | 'type' => 'textbox', |
76 | - ],[ |
|
76 | + ], [ |
|
77 | 77 | 'columns' => 2, |
78 | 78 | 'items' => [[ |
79 | 79 | 'name' => 'hide_assigned_to', |
80 | 80 | 'text' => esc_html__( 'Assigned To', 'site-reviews' ), |
81 | 81 | 'tooltip' => __( 'Hide the assigned to link?', 'site-reviews' ), |
82 | 82 | 'type' => 'checkbox', |
83 | - ],[ |
|
83 | + ], [ |
|
84 | 84 | 'name' => 'hide_author', |
85 | 85 | 'text' => esc_html__( 'Author', 'site-reviews' ), |
86 | 86 | 'tooltip' => __( 'Hide the review author?', 'site-reviews' ), |
87 | 87 | 'type' => 'checkbox', |
88 | - ],[ |
|
88 | + ], [ |
|
89 | 89 | 'name' => 'hide_avatar', |
90 | 90 | 'text' => esc_html__( 'Avatar', 'site-reviews' ), |
91 | 91 | 'tooltip' => __( 'Hide the reviewer avatar if shown?', 'site-reviews' ), |
92 | 92 | 'type' => 'checkbox', |
93 | - ],[ |
|
93 | + ], [ |
|
94 | 94 | 'name' => 'hide_content', |
95 | 95 | 'text' => esc_html__( 'Content', 'site-reviews' ), |
96 | 96 | 'tooltip' => __( 'Hide the review content?', 'site-reviews' ), |
97 | 97 | 'type' => 'checkbox', |
98 | - ],[ |
|
98 | + ], [ |
|
99 | 99 | 'name' => 'hide_date', |
100 | 100 | 'text' => esc_html__( 'Date', 'site-reviews' ), |
101 | 101 | 'tooltip' => __( 'Hide the review date?', 'site-reviews' ), |
102 | 102 | 'type' => 'checkbox', |
103 | - ],[ |
|
103 | + ], [ |
|
104 | 104 | 'name' => 'hide_rating', |
105 | 105 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
106 | 106 | 'tooltip' => __( 'Hide the review rating?', 'site-reviews' ), |
107 | 107 | 'type' => 'checkbox', |
108 | - ],[ |
|
108 | + ], [ |
|
109 | 109 | 'name' => 'hide_response', |
110 | 110 | 'text' => esc_html__( 'Response', 'site-reviews' ), |
111 | 111 | 'tooltip' => __( 'Hide the review response?', 'site-reviews' ), |
112 | 112 | 'type' => 'checkbox', |
113 | - ],[ |
|
113 | + ], [ |
|
114 | 114 | 'name' => 'hide_title', |
115 | 115 | 'text' => esc_html__( 'Title', 'site-reviews' ), |
116 | 116 | 'tooltip' => __( 'Hide the review title?', 'site-reviews' ), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
121 | 121 | 'spacing' => 5, |
122 | 122 | 'type' => 'container', |
123 | - ],[ |
|
123 | + ], [ |
|
124 | 124 | 'hidden' => true, |
125 | 125 | 'name' => 'id', |
126 | 126 | 'type' => 'textbox', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function getTerms() |
134 | 134 | { |
135 | 135 | $terms = glsr( Database::class )->getTerms(); |
136 | - if( empty( $terms )) { |
|
136 | + if( empty($terms) ) { |
|
137 | 137 | return []; |
138 | 138 | } |
139 | 139 | return [ |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function enqueueAssets() |
25 | 25 | { |
26 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
26 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
27 | 27 | wp_enqueue_style( |
28 | 28 | Application::ID, |
29 | 29 | $this->getStylesheet(), |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | glsr()->version |
32 | 32 | ); |
33 | 33 | } |
34 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
34 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
35 | 35 | $dependencies = apply_filters( 'site-reviews/enqueue/public/dependencies', [] ); |
36 | 36 | wp_enqueue_script( |
37 | 37 | Application::ID, |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | { |
51 | 51 | if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
52 | 52 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
53 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
53 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
54 | 54 | 'hl' => $language, |
55 | 55 | 'onload' => 'glsr_render_recaptcha', |
56 | 56 | 'render' => 'explicit', |
57 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
58 | - $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' )); |
|
57 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
58 | + $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ) ); |
|
59 | 59 | wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' ); |
60 | 60 | } |
61 | 61 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $variables = [ |
68 | 68 | 'action' => Application::PREFIX.'action', |
69 | 69 | 'ajaxnonce' => wp_create_nonce( Application::ID.'-ajax-nonce' ), |
70 | - 'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'], |
|
70 | + 'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'], |
|
71 | 71 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
72 | 72 | ]; |
73 | 73 | $variables = apply_filters( 'site-reviews/enqueue/public/localize', $variables ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function getStylesheet() |
81 | 81 | { |
82 | - $currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' )); |
|
82 | + $currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ) ); |
|
83 | 83 | return file_exists( glsr()->path.'assets/styles/themes/'.$currentTheme.'.css' ) |
84 | 84 | ? glsr()->url( 'assets/styles/themes/'.$currentTheme.'.css' ) |
85 | 85 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
@@ -48,7 +48,9 @@ |
||
48 | 48 | */ |
49 | 49 | public function enqueueRecaptchaScript() |
50 | 50 | { |
51 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
51 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
52 | + return; |
|
53 | + } |
|
52 | 54 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
53 | 55 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
54 | 56 | 'hl' => $language, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] ); |
66 | 66 | $dependencies = array_merge( $dependencies, [ |
67 | 67 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
68 | - ]); |
|
68 | + ] ); |
|
69 | 69 | return $dependencies; |
70 | 70 | } |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | protected function isCurrentScreen() |
76 | 76 | { |
77 | 77 | $screen = glsr_current_screen(); |
78 | - return $screen && ( $screen->post_type == Application::POST_TYPE |
|
78 | + return $screen && ($screen->post_type == Application::POST_TYPE |
|
79 | 79 | || $screen->base == 'post' |
80 | 80 | || $screen->id == 'dashboard' |
81 | 81 | || $screen->id == 'widgets' |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $variables = []; |
91 | 91 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
92 | - if( empty( $args['required'] ))continue; |
|
92 | + if( empty($args['required']) )continue; |
|
93 | 93 | $variables[$tag] = $args['required']; |
94 | 94 | } |
95 | 95 | return $variables; |