@@ -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 | } |
@@ -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' ); |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | 'after_widget' => '</div>', |
23 | 23 | 'before_title' => '<h3 class="glsr-shortcode-title">', |
24 | 24 | 'after_title' => '</h3>', |
25 | - ]); |
|
25 | + ] ); |
|
26 | 26 | $instance = $this->normalize( $instance ); |
27 | 27 | $partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance ); |
28 | - if( !empty( $instance['title'] )) { |
|
28 | + if( !empty($instance['title']) ) { |
|
29 | 29 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; |
30 | 30 | } |
31 | 31 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function normalize( $args ) |
70 | 70 | { |
71 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
|
71 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); |
|
72 | 72 | array_walk( $args, function( &$value, $key ) { |
73 | 73 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
74 | - if( !method_exists( $this, $methodName ))return; |
|
74 | + if( !method_exists( $this, $methodName ) )return; |
|
75 | 75 | $value = $this->$methodName( $value ); |
76 | 76 | }); |
77 | 77 | return $this->sanitize( $args ); |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function normalizeHide( $hide ) |
105 | 105 | { |
106 | - if( is_string( $hide )) { |
|
106 | + if( is_string( $hide ) ) { |
|
107 | 107 | $hide = explode( ',', $hide ); |
108 | 108 | } |
109 | 109 | $hiddenKeys = defined( 'static::HIDDEN_KEYS' ) |
110 | 110 | ? static::HIDDEN_KEYS |
111 | 111 | : []; |
112 | - return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) { |
|
112 | + return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) { |
|
113 | 113 | return in_array( $value, $hiddenKeys ); |
114 | 114 | }); |
115 | 115 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | __( 'Terrible', 'site-reviews' ), |
138 | 138 | ]; |
139 | 139 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
140 | - $labels = array_map( 'trim', explode( ',', $labels )); |
|
140 | + $labels = array_map( 'trim', explode( ',', $labels ) ); |
|
141 | 141 | foreach( $defaults as $i => $label ) { |
142 | - if( empty( $labels[$i] ))continue; |
|
142 | + if( empty($labels[$i]) )continue; |
|
143 | 143 | $defaults[$i] = $labels[$i]; |
144 | 144 | } |
145 | 145 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -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 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'stars' => $this->buildStars(), |
47 | 47 | 'text' => $this->buildText(), |
48 | 48 | ], |
49 | - ]); |
|
49 | + ] ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function buildPercentage() |
56 | 56 | { |
57 | - if( $this->isHidden( 'bars' ))return; |
|
57 | + if( $this->isHidden( 'bars' ) )return; |
|
58 | 58 | $range = range( Rating::MAX_RATING, 1 ); |
59 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews )); |
|
60 | - $bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) { |
|
59 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ) ); |
|
60 | + $bars = array_reduce( $range, function( $carry, $level ) use($percentages) { |
|
61 | 61 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
62 | 62 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
63 | 63 | $percent = $this->buildPercentagePercent( $percentages[$level] ); |
64 | 64 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
65 | 65 | 'class' => 'glsr-bar', |
66 | - ]); |
|
66 | + ] ); |
|
67 | 67 | }); |
68 | 68 | return $this->wrap( 'percentage', $bars ); |
69 | 69 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function buildPercentageBackground( $percent ) |
76 | 76 | { |
77 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
77 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
78 | 78 | 'class' => 'glsr-bar-background-percent', |
79 | 79 | 'style' => 'width:'.$percent, |
80 | - ]); |
|
80 | + ] ); |
|
81 | 81 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
82 | 82 | } |
83 | 83 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function buildRating() |
106 | 106 | { |
107 | - if( $this->isHidden( 'rating' ))return; |
|
107 | + if( $this->isHidden( 'rating' ) )return; |
|
108 | 108 | return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' ); |
109 | 109 | } |
110 | 110 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function buildStars() |
115 | 115 | { |
116 | - if( $this->isHidden( 'stars' ))return; |
|
116 | + if( $this->isHidden( 'stars' ) )return; |
|
117 | 117 | $stars = glsr( Partial::class )->build( 'star-rating', [ |
118 | 118 | 'rating' => $this->rating, |
119 | - ]); |
|
119 | + ] ); |
|
120 | 120 | return $this->wrap( 'stars', $stars ); |
121 | 121 | } |
122 | 122 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function buildText() |
127 | 127 | { |
128 | - if( $this->isHidden( 'summary' ))return; |
|
128 | + if( $this->isHidden( 'summary' ) )return; |
|
129 | 129 | $count = count( $this->reviews ); |
130 | - if( empty( $this->args['text'] )) { |
|
130 | + if( empty($this->args['text']) ) { |
|
131 | 131 | $this->args['text'] = _nx( |
132 | 132 | '{rating} out of {max} stars (based on %d review)', |
133 | 133 | '{rating} out of {max} stars (based on %d reviews)', |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | 'site-reviews' |
137 | 137 | ); |
138 | 138 | } |
139 | - $summary = str_replace( ['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
140 | - $summary = str_replace( ['%s','%d'], $count, $summary ); |
|
139 | + $summary = str_replace( ['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] ); |
|
140 | + $summary = str_replace( ['%s', '%d'], $count, $summary ); |
|
141 | 141 | return $this->wrap( 'text', '<span>'.$summary.'</span>' ); |
142 | 142 | } |
143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function generateSchema() |
148 | 148 | { |
149 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
149 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
150 | 150 | glsr( Schema::class )->store( |
151 | 151 | glsr( Schema::class )->buildSummary( $this->args ) |
152 | 152 | ); |
@@ -179,6 +179,6 @@ discard block |
||
179 | 179 | { |
180 | 180 | return glsr( Builder::class )->div( $value, [ |
181 | 181 | 'class' => 'glsr-summary-'.$key, |
182 | - ]); |
|
182 | + ] ); |
|
183 | 183 | } |
184 | 184 | } |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | { |
22 | 22 | global $menu, $typenow; |
23 | 23 | foreach( $menu as $key => $value ) { |
24 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
24 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | 25 | $postCount = wp_count_posts( Application::POST_TYPE ); |
26 | 26 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
27 | 27 | 'class' => 'pending-count', |
28 | - ]); |
|
28 | + ] ); |
|
29 | 29 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
30 | 30 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
31 | - ]); |
|
31 | + ] ); |
|
32 | 32 | $menu[$key][0] .= ' '.$awaitingModeration; |
33 | 33 | if( $typenow === Application::POST_TYPE ) { |
34 | - $menu[$key][4].= ' current'; |
|
34 | + $menu[$key][4] .= ' current'; |
|
35 | 35 | } |
36 | 36 | break; |
37 | 37 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), |
49 | 49 | 'addons' => __( 'Add-Ons', 'site-reviews' ), |
50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
51 | - ]); |
|
51 | + ] ); |
|
52 | 52 | foreach( $pages as $slug => $title ) { |
53 | 53 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
54 | 54 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
55 | - if( !is_callable( $callback ))continue; |
|
55 | + if( !is_callable( $callback ) )continue; |
|
56 | 56 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
57 | 57 | } |
58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $this->renderPage( 'addons', [ |
68 | 68 | 'template' => glsr( Template::class ), |
69 | - ]); |
|
69 | + ] ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
83 | 83 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
84 | 84 | 'functions' => __( 'Functions', 'site-reviews' ), |
85 | - ]); |
|
85 | + ] ); |
|
86 | 86 | $this->renderPage( 'documentation', [ |
87 | 87 | 'tabs' => $tabs, |
88 | - ]); |
|
88 | + ] ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | 'schema' => __( 'Schema', 'site-reviews' ), |
103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), |
104 | 104 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
105 | - ]); |
|
106 | - if( !apply_filters( 'site-reviews/addon/licenses', false )) { |
|
107 | - unset( $tabs['licenses'] ); |
|
105 | + ] ); |
|
106 | + if( !apply_filters( 'site-reviews/addon/licenses', false ) ) { |
|
107 | + unset($tabs['licenses']); |
|
108 | 108 | } |
109 | 109 | $this->renderPage( 'settings', [ |
110 | 110 | 'html' => glsr( Html::class ), |
111 | 111 | 'tabs' => $tabs, |
112 | - ]); |
|
112 | + ] ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
124 | 124 | 'logging' => __( 'Logging', 'site-reviews' ), |
125 | 125 | 'system-info' => __( 'System Info', 'site-reviews' ), |
126 | - ]); |
|
126 | + ] ); |
|
127 | 127 | $this->renderPage( 'tools', [ |
128 | 128 | 'data' => [ |
129 | 129 | 'context' => [ |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ], |
135 | 135 | 'html' => glsr( Html::class ), |
136 | 136 | 'tabs' => $tabs, |
137 | - ]); |
|
137 | + ] ); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'submit_button' => $this->buildSubmitButton(), |
31 | 31 | ], |
32 | 32 | 'fields' => $this->getFields(), |
33 | - ]); |
|
33 | + ] ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | return glsr( Builder::class )->button( '<span></span>'.__( 'Submit your review', 'site-reviews' ), [ |
50 | 50 | 'type' => 'submit', |
51 | - ]); |
|
51 | + ] ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -82,25 +82,25 @@ discard block |
||
82 | 82 | $fields = [[ |
83 | 83 | 'name' => 'assign_to', |
84 | 84 | 'value' => $this->args['assign_to'], |
85 | - ],[ |
|
85 | + ], [ |
|
86 | 86 | 'name' => 'category', |
87 | 87 | 'value' => $this->args['category'], |
88 | - ],[ |
|
88 | + ], [ |
|
89 | 89 | 'name' => 'excluded', |
90 | 90 | 'value' => $this->args['excluded'], |
91 | - ],[ |
|
91 | + ], [ |
|
92 | 92 | 'name' => 'id', |
93 | 93 | 'value' => $this->args['id'], |
94 | - ],[ |
|
94 | + ], [ |
|
95 | 95 | 'name' => '_wp_http_referer', |
96 | 96 | 'value' => wp_get_referer(), |
97 | - ],[ |
|
97 | + ], [ |
|
98 | 98 | 'name' => '_wpnonce', |
99 | 99 | 'value' => wp_create_nonce( 'post-review' ), |
100 | 100 | ]]; |
101 | 101 | return array_values( array_map( function( $field ) { |
102 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
103 | - }, $fields )); |
|
102 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
103 | + }, $fields ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function getHoneypotField() |
110 | 110 | { |
111 | - return new Field([ |
|
111 | + return new Field( [ |
|
112 | 112 | 'name' => 'gotcha', |
113 | 113 | 'type' => 'honeypot', |
114 | - ]); |
|
114 | + ] ); |
|
115 | 115 | } |
116 | 116 | } |
@@ -27,13 +27,13 @@ |
||
27 | 27 | public function getFields( $id ) |
28 | 28 | { |
29 | 29 | $fields = []; |
30 | - $configPath = glsr()->path( 'config/'.$id.'.php' );; |
|
30 | + $configPath = glsr()->path( 'config/'.$id.'.php' ); ; |
|
31 | 31 | $values = file_exists( $configPath ) |
32 | 32 | ? include $configPath |
33 | 33 | : []; |
34 | 34 | $values = apply_filters( 'site-reviews/form/fields', $values ); |
35 | 35 | foreach( $values as $name => $field ) { |
36 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
36 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
37 | 37 | } |
38 | 38 | return $fields; |
39 | 39 | } |