@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function build( array $args = [] ) |
13 | 13 | { |
14 | - require_once( ABSPATH.'wp-admin/includes/template.php' ); |
|
14 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
15 | 15 | ob_start(); |
16 | 16 | wp_star_rating( $args ); |
17 | 17 | return ob_get_clean(); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function renderAssignedToMetabox( WP_Post $post ) |
150 | 150 | { |
151 | - if( !$this->isReviewPostType( $post ))return; |
|
151 | + if( !$this->isReviewPostType( $post ) )return; |
|
152 | 152 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
153 | 153 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
154 | 154 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
155 | 155 | 'id' => $assignedTo, |
156 | 156 | 'template' => $this->buildAssignedToTemplate( $assignedTo, $post ), |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function renderDetailsMetaBox( WP_Post $post ) |
165 | 165 | { |
166 | - if( !$this->isReviewPostType( $post ))return; |
|
166 | + if( !$this->isReviewPostType( $post ) )return; |
|
167 | 167 | $review = glsr( Database::class )->getReview( $post ); |
168 | 168 | glsr()->render( 'partials/editor/metabox-details', [ |
169 | 169 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
170 | 170 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
171 | - ]); |
|
171 | + ] ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function renderPinnedInPublishMetaBox() |
179 | 179 | { |
180 | - if( !$this->isReviewPostType( get_post() ))return; |
|
180 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
181 | 181 | glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [ |
182 | 182 | 'context' => [ |
183 | 183 | 'no' => __( 'No', 'site-reviews' ), |
184 | 184 | 'yes' => __( 'Yes', 'site-reviews' ), |
185 | 185 | ], |
186 | - 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
187 | - ]); |
|
186 | + 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
187 | + ] ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function renderResponseMetaBox( WP_Post $post ) |
195 | 195 | { |
196 | - if( !$this->isReviewPostType( $post ))return; |
|
196 | + if( !$this->isReviewPostType( $post ) )return; |
|
197 | 197 | wp_nonce_field( 'response', '_nonce-response', false ); |
198 | 198 | glsr()->render( 'partials/editor/metabox-response', [ |
199 | 199 | 'response' => glsr( Database::class )->getReview( $post )->response, |
200 | - ]); |
|
200 | + ] ); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function renderTaxonomyMetabox( WP_Post $post ) |
209 | 209 | { |
210 | - if( !$this->isReviewPostType( $post ))return; |
|
210 | + if( !$this->isReviewPostType( $post ) )return; |
|
211 | 211 | glsr()->render( 'partials/editor/metabox-categories', [ |
212 | 212 | 'post' => $post, |
213 | 213 | 'tax_name' => Application::TAXONOMY, |
214 | 214 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
215 | - ]); |
|
215 | + ] ); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function revertReview() |
224 | 224 | { |
225 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
225 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
226 | 226 | glsr( Database::class )->revertReview( $postId ); |
227 | 227 | $this->redirect( $postId, 52 ); |
228 | 228 | } |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
246 | 246 | { |
247 | 247 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post, $assignedTo ); |
248 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
248 | + if( !($assignedPost instanceof WP_Post) )return; |
|
249 | 249 | return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [ |
250 | 250 | 'context' => [ |
251 | 251 | 'data.url' => (string)get_permalink( $assignedPost ), |
252 | 252 | 'data.title' => get_the_title( $assignedPost ), |
253 | 253 | ], |
254 | - ]); |
|
254 | + ] ); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | 'class' => 'button button-large', |
273 | 273 | 'href' => $revertUrl, |
274 | 274 | 'id' => 'revert', |
275 | - ]); |
|
275 | + ] ); |
|
276 | 276 | } |
277 | 277 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
278 | 278 | 'class' => 'button button-large', |
279 | 279 | 'disabled' => true, |
280 | 280 | 'id' => 'revert', |
281 | - ]); |
|
281 | + ] ); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
292 | 292 | ? glsr()->reviewTypes[$review->review_type] |
293 | 293 | : __( 'Unknown', 'site-reviews' ); |
294 | - if( !empty( $review->url )) { |
|
294 | + if( !empty($review->url) ) { |
|
295 | 295 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
296 | 296 | 'href' => $review->url, |
297 | 297 | 'target' => '_blank', |
298 | - ]); |
|
298 | + ] ); |
|
299 | 299 | } |
300 | 300 | return $reviewType; |
301 | 301 | } |
@@ -315,16 +315,16 @@ discard block |
||
315 | 315 | */ |
316 | 316 | protected function normalizeDetailsMetaBox( $review ) |
317 | 317 | { |
318 | - $reviewer = empty( $review->user_id ) |
|
318 | + $reviewer = empty($review->user_id) |
|
319 | 319 | ? __( 'Unregistered user', 'site-reviews' ) |
320 | 320 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
321 | 321 | 'href' => get_author_posts_url( $review->user_id ), |
322 | - ]); |
|
323 | - $email = empty( $review->email ) |
|
322 | + ] ); |
|
323 | + $email = empty($review->email) |
|
324 | 324 | ? '—' |
325 | 325 | : glsr( Builder::class )->a( $review->email, [ |
326 | 326 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
327 | - ]); |
|
327 | + ] ); |
|
328 | 328 | $metabox = [ |
329 | 329 | __( 'Rating', 'site-reviews' ) => glsr( Html::class )->buildPartial( 'star-rating', ['rating' => $review->rating] ), |
330 | 330 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | __( 'IP Address', 'site-reviews' ) => $review->ip_address, |
336 | 336 | __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ), |
337 | 337 | ]; |
338 | - return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review )); |
|
338 | + return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) ); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $redirectUri = $hasReferer |
353 | 353 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
354 | 354 | : get_edit_post_link( $postId ); |
355 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
355 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
356 | 356 | exit; |
357 | 357 | } |
358 | 358 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | $this->args = $this->normalize( $args ); |
22 | 22 | if( $this->args['total'] < 2 )return; |
23 | 23 | $links = $this->buildLinksForDeprecatedThemes(); |
24 | - if( empty( $links )) { |
|
24 | + if( empty($links) ) { |
|
25 | 25 | $links = $this->buildLinks(); |
26 | 26 | } |
27 | 27 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
28 | - if( empty( $links ))return; |
|
28 | + if( empty($links) )return; |
|
29 | 29 | return $this->buildTemplate( $links ); |
30 | 30 | } |
31 | 31 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | 'total' => $this->args['total'], |
45 | 45 | ]; |
46 | 46 | if( is_front_page() ) { |
47 | - unset( $paginateArgs['format'] ); |
|
47 | + unset($paginateArgs['format']); |
|
48 | 48 | } |
49 | 49 | return paginate_links( $paginateArgs ); |
50 | 50 | } |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | protected function buildLinksForDeprecatedThemes() |
56 | 56 | { |
57 | 57 | $theme = wp_get_theme()->get( 'TextDomain' ); |
58 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
58 | + if( !in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen'] ) )return; |
|
59 | 59 | $links = ''; |
60 | 60 | if( $this->args['paged'] > 1 ) { |
61 | - $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
61 | + $links .= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
62 | 62 | $this->buildUrlForDeprecatedThemes(-1), |
63 | 63 | __( 'Previous', 'site-reviews' ) |
64 | 64 | ); |
65 | 65 | } |
66 | 66 | if( $this->args['paged'] < $this->args['total'] ) { |
67 | - $links.= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
68 | - $this->buildUrlForDeprecatedThemes(1), |
|
67 | + $links .= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
68 | + $this->buildUrlForDeprecatedThemes( 1 ), |
|
69 | 69 | __( 'Next', 'site-reviews' ) |
70 | 70 | ); |
71 | 71 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $class = 'glsr-navigation navigation pagination'; |
83 | 83 | $screenReaderTemplate = '<h2 class="screen-reader-text">%2$s</h2>'; |
84 | 84 | $innerTemplate = $screenReaderTemplate.'<div class="nav-links">%3$s</div>'; |
85 | - if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] )) { |
|
85 | + if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] ) ) { |
|
86 | 86 | $innerTemplate = '%3$s'; |
87 | 87 | } |
88 | 88 | else if( $theme == 'twentyfourteen' ) { |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | return wp_parse_args( $args, [ |
116 | 116 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
117 | 117 | 'total' => 1, |
118 | - ]); |
|
118 | + ] ); |
|
119 | 119 | } |
120 | 120 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function __call( $method, $args ) |
65 | 65 | { |
66 | - $instance = new static( $this->globals ); |
|
66 | + $instance = new static($this->globals); |
|
67 | 67 | $instance->setTagFromMethod( $method ); |
68 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
68 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
69 | 69 | $tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
70 | 70 | $generatedTag = in_array( $instance->tag, $tags ) |
71 | 71 | ? $instance->buildTag() |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'render' => 'is_bool', |
90 | 90 | 'tag' => 'is_string', |
91 | 91 | ]; |
92 | - if( !isset( $properties[$property] ) |
|
93 | - || empty( array_filter( [$value], $properties[$property] )) |
|
92 | + if( !isset($properties[$property]) |
|
93 | + || empty(array_filter( [$value], $properties[$property] )) |
|
94 | 94 | )return; |
95 | 95 | $this->$property = $value; |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getOpeningTag() |
110 | 110 | { |
111 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
111 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
112 | 112 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | protected function buildCustomField() |
119 | 119 | { |
120 | 120 | $className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' ); |
121 | - if( !class_exists( $className )) { |
|
121 | + if( !class_exists( $className ) ) { |
|
122 | 122 | glsr_log()->error( 'Field missing: '.$className ); |
123 | 123 | return; |
124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function buildDefaultTag( $text = '' ) |
132 | 132 | { |
133 | - if( empty( $text )) { |
|
133 | + if( empty($text) ) { |
|
134 | 134 | $text = $this->args['text']; |
135 | 135 | } |
136 | 136 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function buildFieldDescription() |
143 | 143 | { |
144 | - if( empty( $this->args['description'] ))return; |
|
145 | - if( !empty( $this->globals['is_widget'] )) { |
|
144 | + if( empty($this->args['description']) )return; |
|
145 | + if( !empty($this->globals['is_widget']) ) { |
|
146 | 146 | return $this->small( $this->args['description'] ); |
147 | 147 | } |
148 | 148 | return $this->p( $this->args['description'], ['class' => 'description'] ); |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function buildFormInput() |
155 | 155 | { |
156 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
156 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
157 | 157 | return $this->buildFormLabel().$this->getOpeningTag(); |
158 | 158 | } |
159 | - return empty( $this->args['options'] ) |
|
159 | + return empty($this->args['options']) |
|
160 | 160 | ? $this->buildFormInputChoice() |
161 | 161 | : $this->buildFormInputMultiChoice(); |
162 | 162 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | protected function buildFormInputMultiChoice() |
176 | 176 | { |
177 | 177 | if( $this->args['type'] == 'checkbox' ) { |
178 | - $this->args['name'].= '[]'; |
|
178 | + $this->args['name'] .= '[]'; |
|
179 | 179 | } |
180 | 180 | $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
181 | 181 | return $carry.$this->li( $this->{$this->args['type']}([ |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | 'name' => $this->args['name'], |
184 | 184 | 'text' => $this->args['options'][$key], |
185 | 185 | 'value' => $key, |
186 | - ])); |
|
186 | + ]) ); |
|
187 | 187 | }); |
188 | 188 | return $this->ul( $options, [ |
189 | 189 | 'class' => $this->args['class'], |
190 | 190 | 'id' => $this->args['id'], |
191 | - ]); |
|
191 | + ] ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function buildFormLabel() |
198 | 198 | { |
199 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
200 | - return $this->label([ |
|
199 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
200 | + return $this->label( [ |
|
201 | 201 | 'for' => $this->args['id'], |
202 | 202 | 'text' => $this->args['label'], |
203 | - ]); |
|
203 | + ] ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | protected function buildFormSelectOptions() |
218 | 218 | { |
219 | 219 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
220 | - return $carry.$this->option([ |
|
220 | + return $carry.$this->option( [ |
|
221 | 221 | 'selected' => $this->args['value'] == $key, |
222 | 222 | 'text' => $this->args['options'][$key], |
223 | 223 | 'value' => $key, |
224 | - ]); |
|
224 | + ] ); |
|
225 | 225 | }); |
226 | 226 | } |
227 | 227 | |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function buildTag() |
240 | 240 | { |
241 | - if( in_array( $this->tag, static::TAGS_SINGLE )) { |
|
241 | + if( in_array( $this->tag, static::TAGS_SINGLE ) ) { |
|
242 | 242 | return $this->getOpeningTag(); |
243 | 243 | } |
244 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
244 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
245 | 245 | return $this->buildDefaultTag(); |
246 | 246 | } |
247 | 247 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | */ |
254 | 254 | protected function normalize( ...$params ) |
255 | 255 | { |
256 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
256 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
257 | 257 | $this->setNameOrTextAttributeForTag( $params[0] ); |
258 | 258 | } |
259 | - if( is_array( $params[0] )) { |
|
259 | + if( is_array( $params[0] ) ) { |
|
260 | 260 | $this->args += $params[0]; |
261 | 261 | } |
262 | - else if( is_array( $params[1] )) { |
|
262 | + else if( is_array( $params[1] ) ) { |
|
263 | 263 | $this->args += $params[1]; |
264 | 264 | } |
265 | 265 | $this->args = glsr( BuilderDefaults::class )->merge( $this->args ); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | protected function setTagFromMethod( $method ) |
285 | 285 | { |
286 | 286 | $this->tag = strtolower( $method ); |
287 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
287 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
288 | 288 | $this->args['type'] = $this->tag; |
289 | 289 | $this->tag = 'input'; |
290 | 290 | } |
@@ -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' ); |
@@ -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; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->reviews = glsr( Database::class )->getReviews( $args )->results; |
37 | - if( empty( $this->reviews ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( empty($this->reviews) && $this->isHidden( 'if_empty' ) )return; |
|
38 | 38 | $this->rating = glsr( Rating::class )->getAverage( $this->reviews ); |
39 | 39 | $this->generateSchema(); |
40 | 40 | glsr_debug( $args ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'stars' => $this->buildStars(), |
48 | 48 | 'text' => $this->buildText(), |
49 | 49 | ], |
50 | - ]); |
|
50 | + ] ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function buildPercentage() |
57 | 57 | { |
58 | - if( $this->isHidden( 'bars' ))return; |
|
58 | + if( $this->isHidden( 'bars' ) )return; |
|
59 | 59 | $range = range( Rating::MAX_RATING, 1 ); |
60 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews )); |
|
61 | - $bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) { |
|
60 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ) ); |
|
61 | + $bars = array_reduce( $range, function( $carry, $level ) use($percentages) { |
|
62 | 62 | $label = $this->buildPercentageLabel( $level ); |
63 | 63 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
64 | 64 | $percent = $this->buildPercentagePercent( $percentages[$level] ); |
65 | 65 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
66 | 66 | 'class' => 'glsr-bar', |
67 | - ]); |
|
67 | + ] ); |
|
68 | 68 | }); |
69 | 69 | return $this->wrap( 'percentage', $bars ); |
70 | 70 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function buildPercentageBackground( $percent ) |
77 | 77 | { |
78 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
78 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
79 | 79 | 'class' => 'glsr-bar-background-percent', |
80 | 80 | 'style' => 'width:'.$percent, |
81 | - ]); |
|
81 | + ] ); |
|
82 | 82 | return glsr( Builder::class )->span( $backgroundPercent, [ |
83 | 83 | 'class' => 'glsr-bar-background', |
84 | - ]); |
|
84 | + ] ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | return glsr( Builder::class )->span( $this->args['labels'][$level], [ |
94 | 94 | 'class' => 'glsr-bar-label', |
95 | - ]); |
|
95 | + ] ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | return glsr( Builder::class )->span( $percent, [ |
105 | 105 | 'class' => 'glsr-bar-percent', |
106 | - ]); |
|
106 | + ] ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | protected function buildRating() |
113 | 113 | { |
114 | - if( $this->isHidden( 'rating' ))return; |
|
114 | + if( $this->isHidden( 'rating' ) )return; |
|
115 | 115 | return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' ); |
116 | 116 | } |
117 | 117 | |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function buildStars() |
122 | 122 | { |
123 | - if( $this->isHidden( 'stars' ))return; |
|
123 | + if( $this->isHidden( 'stars' ) )return; |
|
124 | 124 | $stars = glsr( Partial::class )->build( 'star-rating', [ |
125 | 125 | 'number' => count( $this->reviews ), |
126 | 126 | 'rating' => $this->rating, |
127 | - ]); |
|
127 | + ] ); |
|
128 | 128 | return $this->wrap( 'stars', $stars ); |
129 | 129 | } |
130 | 130 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function buildText() |
135 | 135 | { |
136 | - if( $this->isHidden( 'summary' ))return; |
|
136 | + if( $this->isHidden( 'summary' ) )return; |
|
137 | 137 | $count = count( $this->reviews ); |
138 | - if( empty( $this->args['text'] )) { |
|
138 | + if( empty($this->args['text']) ) { |
|
139 | 139 | $this->args['text'] = _nx( |
140 | 140 | '{rating} out of {max} stars (based on %d review)', |
141 | 141 | '{rating} out of {max} stars (based on %d reviews)', |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | 'site-reviews' |
145 | 145 | ); |
146 | 146 | } |
147 | - $summary = str_replace( ['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
148 | - $summary = str_replace( ['%s','%d'], $count, $summary ); |
|
147 | + $summary = str_replace( ['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
148 | + $summary = str_replace( ['%s', '%d'], $count, $summary ); |
|
149 | 149 | return $this->wrap( 'text', '<span>'.$summary.'</span>' ); |
150 | 150 | } |
151 | 151 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function generateSchema() |
156 | 156 | { |
157 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
158 | - glsr( Schema::class )->store( glsr( Schema::class )->buildSummary( $this->args )); |
|
157 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
158 | + glsr( Schema::class )->store( glsr( Schema::class )->buildSummary( $this->args ) ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -185,6 +185,6 @@ discard block |
||
185 | 185 | { |
186 | 186 | return glsr( Builder::class )->div( $value, [ |
187 | 187 | 'class' => 'glsr-summary-'.$key, |
188 | - ]); |
|
188 | + ] ); |
|
189 | 189 | } |
190 | 190 | } |
@@ -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, 'buildOption' ); |
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 buildOptionAssignedTo( $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 buildOptionAuthor( $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 buildOptionAvatar( $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 buildOptionContent( $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 buildOptionDate( $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 buildOptionRating( $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 buildOptionResponse( $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 buildOptionTitle( $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 | } |