@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
92 | 92 | { |
93 | - if( empty( $this->email ))return; |
|
94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
93 | + if( empty($this->email) )return; |
|
94 | + if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return; |
|
95 | 95 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
96 | 96 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
97 | 97 | } |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | $allowed = [ |
105 | 105 | 'bcc', 'cc', 'from', 'reply-to', |
106 | 106 | ]; |
107 | - $headers = array_intersect_key( $this->email, array_flip( $allowed )); |
|
107 | + $headers = array_intersect_key( $this->email, array_flip( $allowed ) ); |
|
108 | 108 | $headers = array_filter( $headers ); |
109 | 109 | foreach( $headers as $key => $value ) { |
110 | - unset( $headers[$key] ); |
|
110 | + unset($headers[$key]); |
|
111 | 111 | $headers[] = $key.': '.$value; |
112 | 112 | } |
113 | 113 | $headers[] = 'Content-Type: text/html'; |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function buildHtmlMessage() |
121 | 121 | { |
122 | - $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' )); |
|
123 | - if( !empty( $template )) { |
|
122 | + $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) ); |
|
123 | + if( !empty($template) ) { |
|
124 | 124 | $message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'] ); |
125 | 125 | } |
126 | 126 | else if( $this->email['template'] ) { |
127 | 127 | $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [ |
128 | 128 | 'context' => $this->email['template-tags'], |
129 | - ]); |
|
129 | + ] ); |
|
130 | 130 | } |
131 | - if( !isset( $message )) { |
|
131 | + if( !isset($message) ) { |
|
132 | 132 | $message = $this->email['message']; |
133 | 133 | } |
134 | 134 | $message = $this->email['before'].$message.$this->email['after']; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $message = str_replace( ']]>', ']]>', $message ); |
140 | 140 | $message = glsr( Template::class )->build( 'partials/email/index', [ |
141 | 141 | 'context' => ['message' => $message], |
142 | - ]); |
|
142 | + ] ); |
|
143 | 143 | return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this ); |
144 | 144 | } |
145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | protected function normalize( array $email = [] ) |
150 | 150 | { |
151 | 151 | $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email ); |
152 | - if( empty( $email['reply-to'] )) { |
|
152 | + if( empty($email['reply-to']) ) { |
|
153 | 153 | $email['reply-to'] = $email['from']; |
154 | 154 | } |
155 | 155 | $this->email = apply_filters( 'site-reviews/email/compose', $email, $this ); |
@@ -10,13 +10,13 @@ |
||
10 | 10 | <p>{{ description }}</p> |
11 | 11 | </div> |
12 | 12 | <div class="glsr-addon-footer"> |
13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
17 | 17 | </span> |
18 | 18 | <?php else: ?> |
19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
21 | 21 | </a> |
22 | 22 | <?php endif; ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function __call( $method, array $arguments ) |
41 | 41 | { |
42 | - $value = isset( $arguments[0] ) |
|
42 | + $value = isset($arguments[0]) |
|
43 | 43 | ? $arguments[0] |
44 | 44 | : ''; |
45 | 45 | return $this->setProperty( $method, $value ); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * @param mixed $default |
97 | 97 | * @return mixed |
98 | 98 | */ |
99 | - public function getProperty( $property, $default = null) |
|
99 | + public function getProperty( $property, $default = null ) |
|
100 | 100 | { |
101 | - return isset( $this->properties[$property] ) |
|
101 | + return isset($this->properties[$property]) |
|
102 | 102 | ? $this->properties[$property] |
103 | 103 | : $default; |
104 | 104 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function offsetUnset( $offset ) |
168 | 168 | { |
169 | - unset( $this->properties[$offset] ); |
|
169 | + unset($this->properties[$offset]); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function getParents( $parents = null ) |
214 | 214 | { |
215 | - if( !isset( $parents )) { |
|
215 | + if( !isset($parents) ) { |
|
216 | 216 | $parents = $this->parents; |
217 | 217 | } |
218 | 218 | $newParents = $parents; |
219 | 219 | foreach( $parents as $parent ) { |
220 | 220 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
221 | - if( !class_exists( $parentClass ))continue; |
|
222 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
221 | + if( !class_exists( $parentClass ) )continue; |
|
222 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
223 | 223 | } |
224 | - return array_values( array_unique( $newParents )); |
|
224 | + return array_values( array_unique( $newParents ) ); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | $parents = $this->getParents(); |
233 | 233 | foreach( $parents as $parent ) { |
234 | 234 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
235 | - if( !class_exists( $parentClass ))continue; |
|
236 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
235 | + if( !class_exists( $parentClass ) )continue; |
|
236 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function serializeProperty( $property ) |
245 | 245 | { |
246 | - if( is_array( $property )) { |
|
246 | + if( is_array( $property ) ) { |
|
247 | 247 | return array_map( [$this, 'serializeProperty'], $property ); |
248 | 248 | } |
249 | 249 | if( $property instanceof Type ) { |
250 | 250 | $property = $property->toArray(); |
251 | - unset( $property['@context'] ); |
|
251 | + unset($property['@context']); |
|
252 | 252 | } |
253 | 253 | if( $property instanceof DateTimeInterface ) { |
254 | 254 | $property = $property->format( DateTime::ATOM ); |
255 | 255 | } |
256 | - if( is_object( $property )) { |
|
256 | + if( is_object( $property ) ) { |
|
257 | 257 | throw new InvalidProperty(); |
258 | 258 | } |
259 | 259 | return $property; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function approve() |
23 | 23 | { |
24 | - check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() )); |
|
25 | - wp_update_post([ |
|
24 | + check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) ); |
|
25 | + wp_update_post( [ |
|
26 | 26 | 'ID' => $postId, |
27 | 27 | 'post_status' => 'publish', |
28 | - ]); |
|
28 | + ] ); |
|
29 | 29 | wp_safe_redirect( wp_get_referer() ); |
30 | 30 | exit; |
31 | 31 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | { |
55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
57 | + if( !array_key_exists( $key, $columns ) || !empty($value) )continue; |
|
58 | 58 | $value = $columns[$key]; |
59 | 59 | } |
60 | - if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) { |
|
61 | - unset( $postTypeColumns['review_type'] ); |
|
60 | + if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) { |
|
61 | + unset($postTypeColumns['review_type']); |
|
62 | 62 | } |
63 | 63 | return array_filter( $postTypeColumns, 'strlen' ); |
64 | 64 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function filterPostStates( array $postStates, WP_Post $post ) { |
96 | 96 | if( $post->post_type == Application::POST_TYPE |
97 | - && array_key_exists( 'pending', $postStates )) { |
|
97 | + && array_key_exists( 'pending', $postStates ) ) { |
|
98 | 98 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
99 | 99 | } |
100 | 100 | return $postStates; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) { |
110 | 110 | return $actions; |
111 | 111 | } |
112 | - unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit |
|
112 | + unset($actions['inline hide-if-no-js']); //Remove Quick-edit |
|
113 | 113 | $rowActions = [ |
114 | 114 | 'approve' => esc_attr__( 'Approve', 'site-reviews' ), |
115 | 115 | 'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ), |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | admin_url( 'post.php?post='.$post->ID.'&action='.$key ), |
124 | 124 | $key.'-review_'.$post->ID |
125 | 125 | ), |
126 | - ]); |
|
126 | + ] ); |
|
127 | 127 | } |
128 | 128 | return $newActions + $actions; |
129 | 129 | } |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | public function filterSortableColumns( array $columns ) |
136 | 136 | { |
137 | 137 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
138 | - unset( $postTypeColumns['cb'] ); |
|
138 | + unset($postTypeColumns['cb']); |
|
139 | 139 | foreach( $postTypeColumns as $key => $value ) { |
140 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
140 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue; |
|
141 | 141 | $columns[$key] = $key; |
142 | 142 | } |
143 | 143 | return $columns; |
@@ -155,18 +155,18 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function filterStatusText( $translation, $single, $plural, $number, $domain ) |
157 | 157 | { |
158 | - if( $this->canModifyTranslation( $domain )) { |
|
158 | + if( $this->canModifyTranslation( $domain ) ) { |
|
159 | 159 | $strings = [ |
160 | 160 | 'Published' => __( 'Approved', 'site-reviews' ), |
161 | 161 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
162 | 162 | ]; |
163 | 163 | foreach( $strings as $search => $replace ) { |
164 | 164 | if( strpos( $single, $search ) === false )continue; |
165 | - $translation = $this->getTranslation([ |
|
165 | + $translation = $this->getTranslation( [ |
|
166 | 166 | 'number' => $number, |
167 | 167 | 'plural' => str_replace( $search, $replace, $plural ), |
168 | 168 | 'single' => str_replace( $search, $replace, $single ), |
169 | - ]); |
|
169 | + ] ); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | return $translation; |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function saveBulkEditFields( $postId ) |
215 | 215 | { |
216 | - if( !current_user_can( 'edit_posts' ))return; |
|
216 | + if( !current_user_can( 'edit_posts' ) )return; |
|
217 | 217 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
218 | - if( $assignedTo && get_post( $assignedTo )) { |
|
218 | + if( $assignedTo && get_post( $assignedTo ) ) { |
|
219 | 219 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
220 | 220 | } |
221 | 221 | } |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function setQueryForColumn( WP_Query $query ) |
228 | 228 | { |
229 | - if( !$this->hasPermission( $query ))return; |
|
229 | + if( !$this->hasPermission( $query ) )return; |
|
230 | 230 | $this->setMetaQuery( $query, [ |
231 | 231 | 'rating', 'review_type', |
232 | - ]); |
|
232 | + ] ); |
|
233 | 233 | $this->setOrderby( $query ); |
234 | 234 | } |
235 | 235 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function unapprove() |
241 | 241 | { |
242 | - check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() )); |
|
243 | - wp_update_post([ |
|
242 | + check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) ); |
|
243 | + wp_update_post( [ |
|
244 | 244 | 'ID' => $postId, |
245 | 245 | 'post_status' => 'pending', |
246 | - ]); |
|
246 | + ] ); |
|
247 | 247 | wp_safe_redirect( wp_get_referer() ); |
248 | 248 | exit; |
249 | 249 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | 'single' => '', |
274 | 274 | 'text' => '', |
275 | 275 | ]; |
276 | - $args = (object) wp_parse_args( $args, $defaults ); |
|
276 | + $args = (object)wp_parse_args( $args, $defaults ); |
|
277 | 277 | $translations = get_translations_for_domain( Application::ID ); |
278 | 278 | return $args->text |
279 | 279 | ? $translations->translate( $args->text ) |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
299 | 299 | { |
300 | 300 | foreach( $metaKeys as $key ) { |
301 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
301 | + if( !($value = filter_input( INPUT_GET, $key )) )continue; |
|
302 | 302 | $metaQuery = (array)$query->get( 'meta_query' ); |
303 | 303 | $metaQuery[] = [ |
304 | 304 | 'key' => $key, |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | { |
316 | 316 | $orderby = $query->get( 'orderby' ); |
317 | 317 | $columns = glsr()->postTypeColumns[Application::POST_TYPE]; |
318 | - unset( $columns['cb'], $columns['title'], $columns['date'] ); |
|
319 | - if( in_array( $orderby, array_keys( $columns ))) { |
|
318 | + unset($columns['cb'], $columns['title'], $columns['date']); |
|
319 | + if( in_array( $orderby, array_keys( $columns ) ) ) { |
|
320 | 320 | $query->set( 'meta_key', $orderby ); |
321 | 321 | $query->set( 'orderby', 'meta_value' ); |
322 | 322 | } |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function saveAssignedToMetabox( $postId ) |
15 | 15 | { |
16 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
17 | - $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
|
16 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return; |
|
17 | + $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) ); |
|
18 | 18 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
19 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
19 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
20 | 20 | glsr( CountsManager::class )->decreasePostCounts( $review ); |
21 | 21 | } |
22 | 22 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function saveResponseMetabox( $postId ) |
30 | 30 | { |
31 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
32 | - $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
|
31 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return; |
|
32 | + $response = strval( glsr( Helper::class )->filterInput( 'response' ) ); |
|
33 | 33 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
34 | 34 | 'a' => ['href' => [], 'title' => []], |
35 | 35 | 'em' => [], |
36 | 36 | 'strong' => [], |
37 | - ]))); |
|
37 | + ] ) ) ); |
|
38 | 38 | } |
39 | 39 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if( strpos( $message, '%s' ) === false ) { |
29 | 29 | return $message; |
30 | 30 | } |
31 | - return preg_replace_callback( '/(%s)/', function() use( &$parameters ) { |
|
31 | + return preg_replace_callback( '/(%s)/', function() use(&$parameters) { |
|
32 | 32 | foreach( $parameters as $key => $value ) { |
33 | 33 | return array_shift( $parameters ); |
34 | 34 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | public function validateRequired( $value ) |
114 | 114 | { |
115 | 115 | return is_null( $value ) |
116 | - || ( is_string( $value ) && trim( $value ) === '' ) |
|
117 | - || ( is_array( $value ) && count( $value ) < 1 ) |
|
116 | + || (is_string( $value ) && trim( $value ) === '') |
|
117 | + || (is_array( $value ) && count( $value ) < 1) |
|
118 | 118 | ? false |
119 | 119 | : true; |
120 | 120 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function all() |
30 | 30 | { |
31 | - if( empty( $this->options )) { |
|
31 | + if( empty($this->options) ) { |
|
32 | 32 | $this->reset(); |
33 | 33 | } |
34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $options = $this->all(); |
46 | 46 | $pointer = &$options; |
47 | 47 | foreach( $keys as $key ) { |
48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
49 | 49 | $pointer = &$pointer[$key]; |
50 | 50 | } |
51 | - unset( $pointer[$last] ); |
|
51 | + unset($pointer[$last]); |
|
52 | 52 | return $this->set( $options ); |
53 | 53 | } |
54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | glsr( DefaultsManager::class )->defaults() |
81 | 81 | ); |
82 | 82 | array_walk( $options, function( &$value ) { |
83 | - if( !is_string( $value ))return; |
|
84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
83 | + if( !is_string( $value ) )return; |
|
84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
85 | 85 | }); |
86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function isRecaptchaEnabled() |
93 | 93 | { |
94 | 94 | $integration = $this->get( 'settings.submissions.recaptcha.integration' ); |
95 | - return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() ); |
|
95 | + return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function reset() |
102 | 102 | { |
103 | 103 | $options = get_option( static::databaseKey(), [] ); |
104 | - if( !is_array( $options ) || empty( $options )) { |
|
104 | + if( !is_array( $options ) || empty($options) ) { |
|
105 | 105 | delete_option( static::databaseKey() ); |
106 | 106 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
107 | 107 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function set( $pathOrOptions, $value = '' ) |
117 | 117 | { |
118 | - if( is_string( $pathOrOptions )) { |
|
118 | + if( is_string( $pathOrOptions ) ) { |
|
119 | 119 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
120 | 120 | } |
121 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
121 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
122 | 122 | $this->reset(); |
123 | 123 | } |
124 | 124 | return $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 | } |