@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __construct() |
34 | 34 | { |
35 | 35 | $types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] ); |
36 | - $this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0; |
|
36 | + $this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0; |
|
37 | 37 | $this->slack = in_array( 'slack', $types ); |
38 | 38 | $this->types = $types; |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function send( Review $review ) |
45 | 45 | { |
46 | - if( empty( $this->types ))return; |
|
46 | + if( empty($this->types) )return; |
|
47 | 47 | $this->review = $review; |
48 | 48 | $args = [ |
49 | 49 | 'link' => $this->getLink(), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function buildEmail( array $args ) |
60 | 60 | { |
61 | - return glsr( Email::class )->compose([ |
|
61 | + return glsr( Email::class )->compose( [ |
|
62 | 62 | 'to' => $this->getEmailAddresses(), |
63 | 63 | 'subject' => $args['title'], |
64 | 64 | 'template' => 'email-notification', |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'review_rating' => $this->review->rating, |
72 | 72 | 'review_title' => $this->review->title, |
73 | 73 | ], |
74 | - ]); |
|
74 | + ] ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'button_url' => $args['link'], |
84 | 84 | 'fallback' => $this->buildEmail( $args )->read( 'plaintext' ), |
85 | 85 | 'pretext' => $args['title'], |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | protected function getEmailAddresses() |
93 | 93 | { |
94 | 94 | $emails = []; |
95 | - if( in_array( 'admin', $this->types )) { |
|
95 | + if( in_array( 'admin', $this->types ) ) { |
|
96 | 96 | $emails[] = get_option( 'admin_email' ); |
97 | 97 | } |
98 | - if( in_array( 'author', $this->types )) { |
|
99 | - $assignedPost = get_post( intval( $this->review->assigned_to )); |
|
98 | + if( in_array( 'author', $this->types ) ) { |
|
99 | + $assignedPost = get_post( intval( $this->review->assigned_to ) ); |
|
100 | 100 | if( $assignedPost instanceof WP_Post ) { |
101 | 101 | $this->email = true; |
102 | - $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author )); |
|
102 | + $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) ); |
|
103 | 103 | } |
104 | 104 | } |
105 | - if( in_array( 'custom', $this->types )) { |
|
105 | + if( in_array( 'custom', $this->types ) ) { |
|
106 | 106 | $customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' ); |
107 | 107 | $customEmails = str_replace( [' ', ',', ';'], ',', $customEmails ); |
108 | 108 | $customEmails = explode( ',', $customEmails ); |
109 | 109 | $emails = array_merge( $emails, $customEmails ); |
110 | 110 | } |
111 | - $emails = array_filter( array_keys( array_flip( $emails ))); |
|
111 | + $emails = array_filter( array_keys( array_flip( $emails ) ) ); |
|
112 | 112 | return apply_filters( 'site-reviews/notification/emails', $emails, $this->review ); |
113 | 113 | } |
114 | 114 | |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function getTitle() |
127 | 127 | { |
128 | - $assignedTitle = get_the_title( intval( $this->review->assigned_to )); |
|
128 | + $assignedTitle = get_the_title( intval( $this->review->assigned_to ) ); |
|
129 | 129 | $title = _nx( |
130 | 130 | 'New %s-star review', |
131 | 131 | 'New %s-star review of: %s', |
132 | - intval( empty( $assignedTitle )), |
|
132 | + intval( empty($assignedTitle) ), |
|
133 | 133 | 'This string differs depending on whether or not the review has been assigned to a post.', |
134 | 134 | 'site-reviews' |
135 | 135 | ); |
136 | 136 | $title = sprintf( '[%s] %s', |
137 | - wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ), |
|
137 | + wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ), |
|
138 | 138 | sprintf( $title, $this->review->rating, $assignedTitle ) |
139 | 139 | ); |
140 | 140 | return apply_filters( 'site-reviews/notification/title', $title, $this->review ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $email = $this->buildEmail( $args ); |
149 | 149 | if( !$this->email )return; |
150 | - if( empty( $email->to )) { |
|
150 | + if( empty($email->to) ) { |
|
151 | 151 | glsr_log()->error( 'Email notification was not sent: missing email address' ); |
152 | 152 | return; |
153 | 153 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if( !$this->slack )return; |
165 | 165 | $notification = $this->buildSlackNotification( $args ); |
166 | 166 | $result = $notification->send(); |
167 | - if( is_wp_error( $result )) { |
|
167 | + if( is_wp_error( $result ) ) { |
|
168 | 168 | $notification->review = null; |
169 | 169 | glsr_log()->error( $result->get_error_message() )->debug( $notification ); |
170 | 170 | } |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function send( Review $review ) |
45 | 45 | { |
46 | - if( empty( $this->types ))return; |
|
46 | + if( empty( $this->types )) { |
|
47 | + return; |
|
48 | + } |
|
47 | 49 | $this->review = $review; |
48 | 50 | $args = [ |
49 | 51 | 'link' => $this->getLink(), |
@@ -146,7 +148,9 @@ discard block |
||
146 | 148 | protected function sendToEmail( array $args ) |
147 | 149 | { |
148 | 150 | $email = $this->buildEmail( $args ); |
149 | - if( !$this->email )return; |
|
151 | + if( !$this->email ) { |
|
152 | + return; |
|
153 | + } |
|
150 | 154 | if( empty( $email->to )) { |
151 | 155 | glsr_log()->error( 'Email notification was not sent: missing email address' ); |
152 | 156 | return; |
@@ -161,7 +165,9 @@ discard block |
||
161 | 165 | */ |
162 | 166 | protected function sendToSlack( array $args ) |
163 | 167 | { |
164 | - if( !$this->slack )return; |
|
168 | + if( !$this->slack ) { |
|
169 | + return; |
|
170 | + } |
|
165 | 171 | $notification = $this->buildSlackNotification( $args ); |
166 | 172 | $result = $notification->send(); |
167 | 173 | if( is_wp_error( $result )) { |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function isBlacklisted( array $review ) |
13 | 13 | { |
14 | - $target = implode( "\n", array_filter([ |
|
14 | + $target = implode( "\n", array_filter( [ |
|
15 | 15 | $review['name'], |
16 | 16 | $review['content'], |
17 | 17 | $review['email'], |
18 | 18 | $review['ip_address'], |
19 | 19 | $review['title'], |
20 | - ])); |
|
20 | + ] ) ); |
|
21 | 21 | return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted', |
22 | 22 | $this->check( $target ), |
23 | 23 | $review |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function check( $target ) |
32 | 32 | { |
33 | - $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' )); |
|
34 | - if( empty( $blacklist )) { |
|
33 | + $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) ); |
|
34 | + if( empty($blacklist) ) { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | $lines = explode( "\n", $blacklist ); |
38 | 38 | foreach( (array)$lines as $line ) { |
39 | 39 | $line = trim( $line ); |
40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
41 | - $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
|
42 | - if( preg_match( $pattern, $target )) { |
|
40 | + if( empty($line) || 256 < strlen( $line ) )continue; |
|
41 | + $pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) ); |
|
42 | + if( preg_match( $pattern, $target ) ) { |
|
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | } |
@@ -37,7 +37,9 @@ |
||
37 | 37 | $lines = explode( "\n", $blacklist ); |
38 | 38 | foreach( (array)$lines as $line ) { |
39 | 39 | $line = trim( $line ); |
40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
40 | + if( empty( $line ) || 256 < strlen( $line )) { |
|
41 | + continue; |
|
42 | + } |
|
41 | 43 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
42 | 44 | if( preg_match( $pattern, $target )) { |
43 | 45 | return true; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __get( $key ) |
21 | 21 | { |
22 | - if( array_key_exists( $key, $this->values )) { |
|
22 | + if( array_key_exists( $key, $this->values ) ) { |
|
23 | 23 | return $this->values[$key]; |
24 | 24 | } |
25 | 25 | return ''; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'navigation' => $navigation, |
57 | 57 | ], |
58 | 58 | 'reviews' => $this->buildReviews(), |
59 | - ]); |
|
59 | + ] ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $reviewValues = []; |
83 | 83 | foreach( $review as $key => $value ) { |
84 | 84 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
85 | - if( !method_exists( $this, $method ))continue; |
|
85 | + if( !method_exists( $this, $method ) )continue; |
|
86 | 86 | $reviewValues[$key] = $this->$method( $key, $value ); |
87 | 87 | } |
88 | 88 | $reviewValues = apply_filters( 'site-reviews/review/build/after', (array)$reviewValues ); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function buildOptionAssignedTo( $key, $value ) |
98 | 98 | { |
99 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
100 | - $post = get_post( intval( $value )); |
|
101 | - if( !( $post instanceof WP_Post ))return; |
|
99 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return; |
|
100 | + $post = get_post( intval( $value ) ); |
|
101 | + if( !($post instanceof WP_Post) )return; |
|
102 | 102 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
103 | 103 | 'href' => get_the_permalink( $post->ID ), |
104 | - ]); |
|
104 | + ] ); |
|
105 | 105 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
106 | 106 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
107 | 107 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function buildOptionAuthor( $key, $value ) |
115 | 115 | { |
116 | - if( $this->isHidden( $key ))return; |
|
116 | + if( $this->isHidden( $key ) )return; |
|
117 | 117 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars' ) |
118 | 118 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
119 | 119 | : ''; |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function buildOptionAvatar( $key, $value ) |
129 | 129 | { |
130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
130 | + if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return; |
|
131 | 131 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
132 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
132 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
133 | 133 | 'src' => $this->generateAvatar( $value ), |
134 | 134 | 'height' => $size, |
135 | 135 | 'width' => $size, |
136 | - ])); |
|
136 | + ] ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function buildOptionContent( $key, $value ) |
145 | 145 | { |
146 | 146 | $text = $this->normalizeText( $value ); |
147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
147 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
148 | 148 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
149 | 149 | } |
150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function buildOptionDate( $key, $value ) |
157 | 157 | { |
158 | - if( $this->isHidden( $key ))return; |
|
158 | + if( $this->isHidden( $key ) )return; |
|
159 | 159 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
160 | 160 | if( $dateFormat == 'relative' ) { |
161 | 161 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $format = $dateFormat == 'custom' |
165 | 165 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
166 | 166 | : (string)get_option( 'date_format' ); |
167 | - $date = date_i18n( $format, strtotime( $value )); |
|
167 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
168 | 168 | } |
169 | 169 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
170 | 170 | } |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function buildOptionRating( $key, $value ) |
178 | 178 | { |
179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
179 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
180 | 180 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
181 | 181 | 'rating' => $value, |
182 | - ]); |
|
182 | + ] ); |
|
183 | 183 | return $this->wrap( $key, $rating ); |
184 | 184 | } |
185 | 185 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected function buildOptionResponse( $key, $value ) |
192 | 192 | { |
193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
194 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
193 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
194 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
195 | 195 | $text = $this->normalizeText( $value ); |
196 | 196 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
197 | 197 | return $this->wrap( $key, |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function buildOptionTitle( $key, $value ) |
209 | 209 | { |
210 | - if( $this->isHidden( $key ))return; |
|
211 | - if( empty( $value )) { |
|
210 | + if( $this->isHidden( $key ) )return; |
|
211 | + if( empty($value) ) { |
|
212 | 212 | $value = __( 'No Title', 'site-reviews' ); |
213 | 213 | } |
214 | 214 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | return $avatarUrl; |
226 | 226 | } |
227 | 227 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
228 | - if( empty( $authorIdOrEmail )) { |
|
228 | + if( empty($authorIdOrEmail) ) { |
|
229 | 229 | $authorIdOrEmail = $review->email; |
230 | 230 | } |
231 | - if( $newAvatar = get_avatar_url( $authorIdOrEmail )) { |
|
231 | + if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) { |
|
232 | 232 | return $newAvatar; |
233 | 233 | } |
234 | 234 | return $avatarUrl; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | protected function generateSchema() |
241 | 241 | { |
242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
242 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
243 | 243 | glsr( Schema::class )->store( |
244 | 244 | glsr( Schema::class )->build( $this->args ) |
245 | 245 | ); |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | */ |
263 | 263 | protected function getExcerpt( $text ) |
264 | 264 | { |
265 | - $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 )); |
|
265 | + $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) ); |
|
266 | 266 | $split = extension_loaded( 'intl' ) |
267 | 267 | ? $this->getExcerptIntlSplit( $text, $limit ) |
268 | 268 | : $this->getExcerptSplit( $text, $limit ); |
269 | 269 | $hiddenText = substr( $text, $split ); |
270 | - if( !empty( $hiddenText )) { |
|
270 | + if( !empty($hiddenText) ) { |
|
271 | 271 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
272 | 272 | 'class' => 'glsr-hidden glsr-hidden-text', |
273 | 273 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
274 | 274 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
275 | - ]); |
|
276 | - $text = ltrim( substr( $text, 0, $split )).$showMore; |
|
275 | + ] ); |
|
276 | + $text = ltrim( substr( $text, 0, $split ) ).$showMore; |
|
277 | 277 | } |
278 | 278 | return nl2br( $text ); |
279 | 279 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $words = IntlRuleBasedBreakIterator::createWordInstance( '' ); |
289 | 289 | $words->setText( $text ); |
290 | 290 | $count = 0; |
291 | - foreach( $words as $offset ){ |
|
291 | + foreach( $words as $offset ) { |
|
292 | 292 | if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
293 | 293 | $count++; |
294 | 294 | if( $count != $limit )continue; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | protected function getExcerptSplit( $text, $limit ) |
306 | 306 | { |
307 | 307 | if( str_word_count( $text, 0 ) > $limit ) { |
308 | - $words = array_keys( str_word_count( $text, 2 )); |
|
308 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
309 | 309 | return $words[$limit]; |
310 | 310 | } |
311 | 311 | return strlen( $text ); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | protected function getOption( $path, $fallback = '' ) |
320 | 320 | { |
321 | - if( array_key_exists( $path, $this->options )) { |
|
321 | + if( array_key_exists( $path, $this->options ) ) { |
|
322 | 322 | return $this->options[$path]; |
323 | 323 | } |
324 | 324 | return $fallback; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | protected function isHidden( $key, $path = '' ) |
333 | 333 | { |
334 | - $isOptionEnabled = !empty( $path ) |
|
334 | + $isOptionEnabled = !empty($path) |
|
335 | 335 | ? $this->isOptionEnabled( $path ) |
336 | 336 | : true; |
337 | 337 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | protected function isHiddenOrEmpty( $key, $value ) |
346 | 346 | { |
347 | - return $this->isHidden( $key ) || empty( $value ); |
|
347 | + return $this->isHidden( $key ) || empty($value); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | protected function normalizeText( $text ) |
364 | 364 | { |
365 | 365 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
366 | - $text = convert_smilies( strip_shortcodes( $text )); |
|
366 | + $text = convert_smilies( strip_shortcodes( $text ) ); |
|
367 | 367 | $text = str_replace( ']]>', ']]>', $text ); |
368 | 368 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
369 | - if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) { |
|
369 | + if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) { |
|
370 | 370 | $text = $this->getExcerpt( $text ); |
371 | 371 | } |
372 | 372 | return wptexturize( $text ); |
@@ -381,6 +381,6 @@ discard block |
||
381 | 381 | { |
382 | 382 | return glsr( Builder::class )->div( $value, [ |
383 | 383 | 'class' => 'glsr-review-'.$key, |
384 | - ]); |
|
384 | + ] ); |
|
385 | 385 | } |
386 | 386 | } |
@@ -82,7 +82,9 @@ discard block |
||
82 | 82 | $reviewValues = []; |
83 | 83 | foreach( $review as $key => $value ) { |
84 | 84 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
85 | - if( !method_exists( $this, $method ))continue; |
|
85 | + if( !method_exists( $this, $method )) { |
|
86 | + continue; |
|
87 | + } |
|
86 | 88 | $reviewValues[$key] = $this->$method( $key, $value ); |
87 | 89 | } |
88 | 90 | $reviewValues = apply_filters( 'site-reviews/review/build/after', (array)$reviewValues ); |
@@ -96,9 +98,13 @@ discard block |
||
96 | 98 | */ |
97 | 99 | protected function buildOptionAssignedTo( $key, $value ) |
98 | 100 | { |
99 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
101 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
102 | + return; |
|
103 | + } |
|
100 | 104 | $post = get_post( intval( $value )); |
101 | - if( !( $post instanceof WP_Post ))return; |
|
105 | + if( !( $post instanceof WP_Post )) { |
|
106 | + return; |
|
107 | + } |
|
102 | 108 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
103 | 109 | 'href' => get_the_permalink( $post->ID ), |
104 | 110 | ]); |
@@ -113,7 +119,9 @@ discard block |
||
113 | 119 | */ |
114 | 120 | protected function buildOptionAuthor( $key, $value ) |
115 | 121 | { |
116 | - if( $this->isHidden( $key ))return; |
|
122 | + if( $this->isHidden( $key )) { |
|
123 | + return; |
|
124 | + } |
|
117 | 125 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars' ) |
118 | 126 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
119 | 127 | : ''; |
@@ -127,7 +135,9 @@ discard block |
||
127 | 135 | */ |
128 | 136 | protected function buildOptionAvatar( $key, $value ) |
129 | 137 | { |
130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
138 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
139 | + return; |
|
140 | + } |
|
131 | 141 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
132 | 142 | return $this->wrap( $key, glsr( Builder::class )->img([ |
133 | 143 | 'src' => $this->generateAvatar( $value ), |
@@ -144,7 +154,9 @@ discard block |
||
144 | 154 | protected function buildOptionContent( $key, $value ) |
145 | 155 | { |
146 | 156 | $text = $this->normalizeText( $value ); |
147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
157 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
158 | + return; |
|
159 | + } |
|
148 | 160 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
149 | 161 | } |
150 | 162 | |
@@ -155,7 +167,9 @@ discard block |
||
155 | 167 | */ |
156 | 168 | protected function buildOptionDate( $key, $value ) |
157 | 169 | { |
158 | - if( $this->isHidden( $key ))return; |
|
170 | + if( $this->isHidden( $key )) { |
|
171 | + return; |
|
172 | + } |
|
159 | 173 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
160 | 174 | if( $dateFormat == 'relative' ) { |
161 | 175 | $date = glsr( Date::class )->relative( $value ); |
@@ -176,7 +190,9 @@ discard block |
||
176 | 190 | */ |
177 | 191 | protected function buildOptionRating( $key, $value ) |
178 | 192 | { |
179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
193 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
194 | + return; |
|
195 | + } |
|
180 | 196 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
181 | 197 | 'rating' => $value, |
182 | 198 | ]); |
@@ -190,7 +206,9 @@ discard block |
||
190 | 206 | */ |
191 | 207 | protected function buildOptionResponse( $key, $value ) |
192 | 208 | { |
193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
209 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
210 | + return; |
|
211 | + } |
|
194 | 212 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
195 | 213 | $text = $this->normalizeText( $value ); |
196 | 214 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -207,7 +225,9 @@ discard block |
||
207 | 225 | */ |
208 | 226 | protected function buildOptionTitle( $key, $value ) |
209 | 227 | { |
210 | - if( $this->isHidden( $key ))return; |
|
228 | + if( $this->isHidden( $key )) { |
|
229 | + return; |
|
230 | + } |
|
211 | 231 | if( empty( $value )) { |
212 | 232 | $value = __( 'No Title', 'site-reviews' ); |
213 | 233 | } |
@@ -239,7 +259,9 @@ discard block |
||
239 | 259 | */ |
240 | 260 | protected function generateSchema() |
241 | 261 | { |
242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
262 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
263 | + return; |
|
264 | + } |
|
243 | 265 | glsr( Schema::class )->store( |
244 | 266 | glsr( Schema::class )->build( $this->args ) |
245 | 267 | ); |
@@ -289,9 +311,13 @@ discard block |
||
289 | 311 | $words->setText( $text ); |
290 | 312 | $count = 0; |
291 | 313 | foreach( $words as $offset ){ |
292 | - if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
|
314 | + if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) { |
|
315 | + continue; |
|
316 | + } |
|
293 | 317 | $count++; |
294 | - if( $count != $limit )continue; |
|
318 | + if( $count != $limit ) { |
|
319 | + continue; |
|
320 | + } |
|
295 | 321 | return $offset; |
296 | 322 | } |
297 | 323 | return strlen( $text ); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | 'avatar' => '', |
18 | 18 | 'content' => '', |
19 | 19 | 'custom' => '', |
20 | - 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )), |
|
20 | + 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ), |
|
21 | 21 | 'email' => '', |
22 | 22 | 'ip_address' => '', |
23 | 23 | 'pinned' => false, |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | 'review_type' => '', |
64 | 64 | ]; |
65 | 65 | $meta = array_filter( |
66 | - array_map( 'array_shift', (array)get_post_meta( $post->ID )), |
|
66 | + array_map( 'array_shift', (array)get_post_meta( $post->ID ) ), |
|
67 | 67 | 'strlen' |
68 | 68 | ); |
69 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
69 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
70 | 70 | $this->modified = $this->isModified( $properties ); |
71 | 71 | array_walk( $properties, function( $value, $key ) { |
72 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
72 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
73 | 73 | $this->$key = maybe_unserialize( $value ); |
74 | 74 | }); |
75 | 75 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | protected function setTermIds( WP_Post $post ) |
81 | 81 | { |
82 | 82 | $this->term_ids = []; |
83 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
83 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
84 | 84 | foreach( $terms as $term ) { |
85 | 85 | $this->term_ids[] = $term->term_id; |
86 | 86 | } |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
70 | 70 | $this->modified = $this->isModified( $properties ); |
71 | 71 | array_walk( $properties, function( $value, $key ) { |
72 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
72 | + if( !property_exists( $this, $key ) || isset( $this->$key )) { |
|
73 | + return; |
|
74 | + } |
|
73 | 75 | $this->$key = maybe_unserialize( $value ); |
74 | 76 | }); |
75 | 77 | } |
@@ -80,7 +82,9 @@ discard block |
||
80 | 82 | protected function setTermIds( WP_Post $post ) |
81 | 83 | { |
82 | 84 | $this->term_ids = []; |
83 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
85 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) { |
|
86 | + return; |
|
87 | + } |
|
84 | 88 | foreach( $terms as $term ) { |
85 | 89 | $this->term_ids[] = $term->term_id; |
86 | 90 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name ) )return; |
|
17 | 17 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 18 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 19 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -13,7 +13,9 @@ |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name )) { |
|
17 | + return; |
|
18 | + } |
|
17 | 19 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 20 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 21 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function get() |
110 | 110 | { |
111 | - return empty( $this->log ) |
|
111 | + return empty($this->log) |
|
112 | 112 | ? __( 'Console is empty', 'site-reviews' ) |
113 | 113 | : $this->log; |
114 | 114 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | public function humanSize( $valueIfEmpty = null ) |
121 | 121 | { |
122 | 122 | $bytes = $this->size(); |
123 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
123 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
124 | 124 | return $valueIfEmpty; |
125 | 125 | } |
126 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
127 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
126 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
127 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | public function log( $level, $message, array $context = [] ) |
148 | 148 | { |
149 | 149 | $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
150 | - if( in_array( $level, $constants, true )) { |
|
150 | + if( in_array( $level, $constants, true ) ) { |
|
151 | 151 | $entry = $this->buildLogEntry( $level, $message, $context ); |
152 | - file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX ); |
|
152 | + file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX ); |
|
153 | 153 | $this->reset(); |
154 | 154 | } |
155 | 155 | return $this; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | protected function interpolate( $message, $context = [] ) |
224 | 224 | { |
225 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
225 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
226 | 226 | return print_r( $message, true ); |
227 | 227 | } |
228 | 228 | $replace = []; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | if( $value instanceof DateTime ) { |
251 | 251 | $value = $value->format( 'Y-m-d H:i:s' ); |
252 | 252 | } |
253 | - else if( $this->isObjectOrArray( $value )) { |
|
253 | + else if( $this->isObjectOrArray( $value ) ) { |
|
254 | 254 | $value = json_encode( $value ); |
255 | 255 | } |
256 | 256 | return (string)$value; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->clear(); |
266 | 266 | file_put_contents( |
267 | 267 | $this->file, |
268 | - $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' )) |
|
268 | + $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) ) |
|
269 | 269 | ); |
270 | 270 | } |
271 | 271 | } |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function renderAssignedToMetabox( WP_Post $post ) |
121 | 121 | { |
122 | - if( !$this->isReviewPostType( $post ))return; |
|
122 | + if( !$this->isReviewPostType( $post ) )return; |
|
123 | 123 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
124 | 124 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
125 | 125 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
126 | 126 | 'id' => $assignedTo, |
127 | 127 | 'template' => $this->buildAssignedToTemplate( $assignedTo, $post ), |
128 | - ]); |
|
128 | + ] ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function renderDetailsMetaBox( WP_Post $post ) |
136 | 136 | { |
137 | - if( !$this->isReviewPostType( $post ))return; |
|
137 | + if( !$this->isReviewPostType( $post ) )return; |
|
138 | 138 | $review = glsr( ReviewManager::class )->single( $post ); |
139 | 139 | glsr()->render( 'partials/editor/metabox-details', [ |
140 | 140 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
141 | 141 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
142 | - ]); |
|
142 | + ] ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function renderPinnedInPublishMetaBox() |
150 | 150 | { |
151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
151 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
152 | 152 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
153 | 153 | 'context' => [ |
154 | 154 | 'no' => __( 'No', 'site-reviews' ), |
155 | 155 | 'yes' => __( 'Yes', 'site-reviews' ), |
156 | 156 | ], |
157 | - 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
158 | - ]); |
|
157 | + 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
158 | + ] ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function renderResponseMetaBox( WP_Post $post ) |
166 | 166 | { |
167 | - if( !$this->isReviewPostType( $post ))return; |
|
167 | + if( !$this->isReviewPostType( $post ) )return; |
|
168 | 168 | wp_nonce_field( 'response', '_nonce-response', false ); |
169 | 169 | glsr()->render( 'partials/editor/metabox-response', [ |
170 | 170 | 'response' => get_post_meta( $post->ID, 'response', true ), |
171 | - ]); |
|
171 | + ] ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function renderTaxonomyMetabox( WP_Post $post ) |
180 | 180 | { |
181 | - if( !$this->isReviewPostType( $post ))return; |
|
181 | + if( !$this->isReviewPostType( $post ) )return; |
|
182 | 182 | glsr()->render( 'partials/editor/metabox-categories', [ |
183 | 183 | 'post' => $post, |
184 | 184 | 'tax_name' => Application::TAXONOMY, |
185 | 185 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
186 | - ]); |
|
186 | + ] ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function revertReview() |
195 | 195 | { |
196 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
196 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
197 | 197 | glsr( ReviewManager::class )->revert( $postId ); |
198 | 198 | $this->redirect( $postId, 52 ); |
199 | 199 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
217 | 217 | { |
218 | 218 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
219 | + if( !($assignedPost instanceof WP_Post) )return; |
|
220 | 220 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
221 | 221 | 'context' => [ |
222 | 222 | 'data.url' => (string)get_permalink( $assignedPost ), |
223 | 223 | 'data.title' => get_the_title( $assignedPost ), |
224 | 224 | ], |
225 | - ]); |
|
225 | + ] ); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | 'class' => 'button button-large', |
243 | 243 | 'href' => $revertUrl, |
244 | 244 | 'id' => 'revert', |
245 | - ]); |
|
245 | + ] ); |
|
246 | 246 | } |
247 | 247 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
248 | 248 | 'class' => 'button button-large', |
249 | 249 | 'disabled' => true, |
250 | 250 | 'id' => 'revert', |
251 | - ]); |
|
251 | + ] ); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
262 | 262 | ? glsr()->reviewTypes[$review->review_type] |
263 | 263 | : __( 'Unknown', 'site-reviews' ); |
264 | - if( !empty( $review->url )) { |
|
264 | + if( !empty($review->url) ) { |
|
265 | 265 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
266 | 266 | 'href' => $review->url, |
267 | 267 | 'target' => '_blank', |
268 | - ]); |
|
268 | + ] ); |
|
269 | 269 | } |
270 | 270 | return $reviewType; |
271 | 271 | } |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | */ |
285 | 285 | protected function normalizeDetailsMetaBox( Review $review ) |
286 | 286 | { |
287 | - $user = empty( $review->user_id ) |
|
287 | + $user = empty($review->user_id) |
|
288 | 288 | ? __( 'Unregistered user', 'site-reviews' ) |
289 | 289 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
290 | 290 | 'href' => get_author_posts_url( $review->user_id ), |
291 | - ]); |
|
292 | - $email = empty( $review->email ) |
|
291 | + ] ); |
|
292 | + $email = empty($review->email) |
|
293 | 293 | ? '—' |
294 | 294 | : glsr( Builder::class )->a( $review->email, [ |
295 | 295 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
296 | - ]); |
|
296 | + ] ); |
|
297 | 297 | $metabox = [ |
298 | 298 | __( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ), |
299 | 299 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | __( 'IP Address', 'site-reviews' ) => $review->ip_address, |
305 | 305 | __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ), |
306 | 306 | ]; |
307 | - return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review )); |
|
307 | + return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $redirectUri = $hasReferer |
322 | 322 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
323 | 323 | : get_edit_post_link( $postId ); |
324 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
324 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
325 | 325 | exit; |
326 | 326 | } |
327 | 327 | } |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function registerMetaBoxes( $postType ) |
91 | 91 | { |
92 | - if( $postType != Application::POST_TYPE )return; |
|
92 | + if( $postType != Application::POST_TYPE ) { |
|
93 | + return; |
|
94 | + } |
|
93 | 95 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
94 | 96 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
95 | 97 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -119,7 +121,9 @@ discard block |
||
119 | 121 | */ |
120 | 122 | public function renderAssignedToMetabox( WP_Post $post ) |
121 | 123 | { |
122 | - if( !$this->isReviewPostType( $post ))return; |
|
124 | + if( !$this->isReviewPostType( $post )) { |
|
125 | + return; |
|
126 | + } |
|
123 | 127 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
124 | 128 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
125 | 129 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -134,7 +138,9 @@ discard block |
||
134 | 138 | */ |
135 | 139 | public function renderDetailsMetaBox( WP_Post $post ) |
136 | 140 | { |
137 | - if( !$this->isReviewPostType( $post ))return; |
|
141 | + if( !$this->isReviewPostType( $post )) { |
|
142 | + return; |
|
143 | + } |
|
138 | 144 | $review = glsr( ReviewManager::class )->single( $post ); |
139 | 145 | glsr()->render( 'partials/editor/metabox-details', [ |
140 | 146 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -148,7 +154,9 @@ discard block |
||
148 | 154 | */ |
149 | 155 | public function renderPinnedInPublishMetaBox() |
150 | 156 | { |
151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
157 | + if( !$this->isReviewPostType( get_post() )) { |
|
158 | + return; |
|
159 | + } |
|
152 | 160 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
153 | 161 | 'context' => [ |
154 | 162 | 'no' => __( 'No', 'site-reviews' ), |
@@ -164,7 +172,9 @@ discard block |
||
164 | 172 | */ |
165 | 173 | public function renderResponseMetaBox( WP_Post $post ) |
166 | 174 | { |
167 | - if( !$this->isReviewPostType( $post ))return; |
|
175 | + if( !$this->isReviewPostType( $post )) { |
|
176 | + return; |
|
177 | + } |
|
168 | 178 | wp_nonce_field( 'response', '_nonce-response', false ); |
169 | 179 | glsr()->render( 'partials/editor/metabox-response', [ |
170 | 180 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -178,7 +188,9 @@ discard block |
||
178 | 188 | */ |
179 | 189 | public function renderTaxonomyMetabox( WP_Post $post ) |
180 | 190 | { |
181 | - if( !$this->isReviewPostType( $post ))return; |
|
191 | + if( !$this->isReviewPostType( $post )) { |
|
192 | + return; |
|
193 | + } |
|
182 | 194 | glsr()->render( 'partials/editor/metabox-categories', [ |
183 | 195 | 'post' => $post, |
184 | 196 | 'tax_name' => Application::TAXONOMY, |
@@ -216,7 +228,9 @@ discard block |
||
216 | 228 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
217 | 229 | { |
218 | 230 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
231 | + if( !( $assignedPost instanceof WP_Post )) { |
|
232 | + return; |
|
233 | + } |
|
220 | 234 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
221 | 235 | 'context' => [ |
222 | 236 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -257,7 +271,9 @@ discard block |
||
257 | 271 | */ |
258 | 272 | protected function getReviewType( $review ) |
259 | 273 | { |
260 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
274 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
275 | + return; |
|
276 | + } |
|
261 | 277 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
262 | 278 | ? glsr()->reviewTypes[$review->review_type] |
263 | 279 | : __( 'Unknown', 'site-reviews' ); |