@@ -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 )) { |
@@ -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; |
@@ -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 ); |
@@ -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 | } |