@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | natsort( $routines ); |
| 17 | 17 | array_walk( $routines, function( $routine ) { |
| 18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
| 19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
| 19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
| 20 | + return; |
|
| 21 | + } |
|
| 20 | 22 | call_user_func( [$this, $routine] ); |
| 21 | 23 | }); |
| 22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | protected function upgrade_3_0_0() |
| 40 | - {} |
|
| 42 | + { |
|
| 43 | +} |
|
| 41 | 44 | } |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function onCreateReview( $postData, $meta, $postId ) |
| 24 | 24 | { |
| 25 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 25 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 26 | 28 | $this->updateAssignedToPost( $review ); |
| 27 | 29 | } |
| 28 | 30 | |
@@ -32,7 +34,9 @@ discard block |
||
| 32 | 34 | */ |
| 33 | 35 | public function onDeleteReview( $postId ) |
| 34 | 36 | { |
| 35 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 37 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 38 | + return; |
|
| 39 | + } |
|
| 36 | 40 | $review->post_status = 'deleted'; // important to change the post_status here first! |
| 37 | 41 | $this->updateAssignedToPost( $review ); |
| 38 | 42 | } |
@@ -52,7 +56,9 @@ discard block |
||
| 52 | 56 | */ |
| 53 | 57 | public function saveAssignedToMetabox( $postId ) |
| 54 | 58 | { |
| 55 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
| 59 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) { |
|
| 60 | + return; |
|
| 61 | + } |
|
| 56 | 62 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
| 57 | 63 | $assignedTo || $assignedTo = ''; |
| 58 | 64 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -67,7 +73,9 @@ discard block |
||
| 67 | 73 | */ |
| 68 | 74 | public function saveResponseMetabox( $postId ) |
| 69 | 75 | { |
| 70 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
| 76 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 71 | 79 | $response = filter_input( INPUT_POST, 'response' ); |
| 72 | 80 | $response || $response = ''; |
| 73 | 81 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
@@ -120,9 +128,13 @@ discard block |
||
| 120 | 128 | */ |
| 121 | 129 | protected function updateAssignedToPost( WP_Post $review ) |
| 122 | 130 | { |
| 123 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
| 131 | + if( !( $postId = $this->getAssignedToPostId( $review->ID ))) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 124 | 134 | $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
| 125 | - if( empty( $reviewIds ))return; |
|
| 135 | + if( empty( $reviewIds )) { |
|
| 136 | + return; |
|
| 137 | + } |
|
| 126 | 138 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |
| 127 | 139 | $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
| 128 | 140 | if( empty( $updatedReviewIds )) { |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | protected $public; |
| 23 | 23 | protected $translator; |
| 24 | 24 | |
| 25 | - public function __construct( Application $app ) { |
|
| 25 | + public function __construct( Application $app ) |
|
| 26 | + { |
|
| 26 | 27 | $this->app = $app; |
| 27 | 28 | $this->admin = $app->make( AdminController::class ); |
| 28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | protected $router; |
| 26 | 26 | protected $settings; |
| 27 | 27 | |
| 28 | - public function __construct( Application $app ) { |
|
| 28 | + public function __construct( Application $app ) |
|
| 29 | + { |
|
| 29 | 30 | $this->app = $app; |
| 30 | 31 | $this->admin = $app->make( AdminController::class ); |
| 31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -171,8 +171,12 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function validateAkismet() |
| 173 | 173 | { |
| 174 | - if( !empty( $this->error ))return; |
|
| 175 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
| 174 | + if( !empty( $this->error )) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | + if( !glsr( Akismet::class )->isSpam( $this->request )) { |
|
| 178 | + return; |
|
| 179 | + } |
|
| 176 | 180 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
| 177 | 181 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
| 178 | 182 | } |
@@ -182,8 +186,12 @@ discard block |
||
| 182 | 186 | */ |
| 183 | 187 | protected function validateBlacklist() |
| 184 | 188 | { |
| 185 | - if( !empty( $this->error ))return; |
|
| 186 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
| 189 | + if( !empty( $this->error )) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 192 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) { |
|
| 193 | + return; |
|
| 194 | + } |
|
| 187 | 195 | $blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' ); |
| 188 | 196 | if( $blacklistAction == 'unapprove' ) { |
| 189 | 197 | $this->request['blacklisted'] = true; |
@@ -199,9 +207,13 @@ discard block |
||
| 199 | 207 | */ |
| 200 | 208 | protected function validateCustom() |
| 201 | 209 | { |
| 202 | - if( !empty( $this->error ))return; |
|
| 210 | + if( !empty( $this->error )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 203 | 213 | $validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request ); |
| 204 | - if( $validated === true )return; |
|
| 214 | + if( $validated === true ) { |
|
| 215 | + return; |
|
| 216 | + } |
|
| 205 | 217 | $this->setSessionValues( 'errors', [] ); |
| 206 | 218 | $this->setSessionValues( 'values', $this->request ); |
| 207 | 219 | $this->error = is_string( $validated ) |
@@ -214,8 +226,12 @@ discard block |
||
| 214 | 226 | */ |
| 215 | 227 | protected function validateHoneyPot() |
| 216 | 228 | { |
| 217 | - if( !empty( $this->error ))return; |
|
| 218 | - if( empty( $this->request['gotcha'] ))return; |
|
| 229 | + if( !empty( $this->error )) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 232 | + if( empty( $this->request['gotcha'] )) { |
|
| 233 | + return; |
|
| 234 | + } |
|
| 219 | 235 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
| 220 | 236 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
| 221 | 237 | } |
@@ -225,7 +241,9 @@ discard block |
||
| 225 | 241 | */ |
| 226 | 242 | protected function validateRecaptcha() |
| 227 | 243 | { |
| 228 | - if( !empty( $this->error ))return; |
|
| 244 | + if( !empty( $this->error )) { |
|
| 245 | + return; |
|
| 246 | + } |
|
| 229 | 247 | $isValid = $this->isRecaptchaResponseValid(); |
| 230 | 248 | if( is_null( $isValid )) { |
| 231 | 249 | $this->setSessionValues( 'recaptcha', true ); |
@@ -87,7 +87,9 @@ discard block |
||
| 87 | 87 | ]; |
| 88 | 88 | if( !isset( $properties[$property] ) |
| 89 | 89 | || empty( array_filter( [$value], $properties[$property] )) |
| 90 | - )return; |
|
| 90 | + ) { |
|
| 91 | + return; |
|
| 92 | + } |
|
| 91 | 93 | $this->$property = $value; |
| 92 | 94 | } |
| 93 | 95 | |
@@ -137,7 +139,9 @@ discard block |
||
| 137 | 139 | */ |
| 138 | 140 | protected function buildFieldDescription() |
| 139 | 141 | { |
| 140 | - if( empty( $this->args['description'] ))return; |
|
| 142 | + if( empty( $this->args['description'] )) { |
|
| 143 | + return; |
|
| 144 | + } |
|
| 141 | 145 | if( !empty( $this->globals['is_widget'] )) { |
| 142 | 146 | return $this->small( $this->args['description'] ); |
| 143 | 147 | } |
@@ -186,7 +190,9 @@ discard block |
||
| 186 | 190 | */ |
| 187 | 191 | protected function buildFormLabel() |
| 188 | 192 | { |
| 189 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 193 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
| 194 | + return; |
|
| 195 | + } |
|
| 190 | 196 | return $this->label([ |
| 191 | 197 | 'for' => $this->args['id'], |
| 192 | 198 | 'text' => $this->args['label'], |
@@ -3,7 +3,9 @@ |
||
| 3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
| 4 | 4 | |
| 5 | 5 | require_once __DIR__.'/site-reviews.php'; |
| 6 | -if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return; |
|
| 6 | +if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) { |
|
| 7 | + return; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
| 9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | protected function normalize( array $settings ) |
| 54 | 54 | { |
| 55 | 55 | array_walk( $settings, function( &$setting ) { |
| 56 | - if( isset( $setting['default'] ))return; |
|
| 56 | + if( isset( $setting['default'] )) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 57 | 59 | $setting['default'] = ''; |
| 58 | 60 | }); |
| 59 | 61 | return $settings; |
@@ -32,7 +32,9 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function build() |
| 34 | 34 | { |
| 35 | - if( !$this->field['is_valid'] )return; |
|
| 35 | + if( !$this->field['is_valid'] ) { |
|
| 36 | + return; |
|
| 37 | + } |
|
| 36 | 38 | if( $this->field['is_multi'] ) { |
| 37 | 39 | return $this->buildMultiField(); |
| 38 | 40 | } |
@@ -128,7 +130,9 @@ discard block |
||
| 128 | 130 | 'label', 'name', 'type', |
| 129 | 131 | ]; |
| 130 | 132 | foreach( $requiredValues as $value ) { |
| 131 | - if( isset( $this->field[$value] ))continue; |
|
| 133 | + if( isset( $this->field[$value] )) { |
|
| 134 | + continue; |
|
| 135 | + } |
|
| 132 | 136 | $missingValues[] = $value; |
| 133 | 137 | $isValid = $this->field['is_valid'] = false; |
| 134 | 138 | } |
@@ -145,11 +149,15 @@ discard block |
||
| 145 | 149 | */ |
| 146 | 150 | protected function normalize() |
| 147 | 151 | { |
| 148 | - if( !$this->isFieldValid() )return; |
|
| 152 | + if( !$this->isFieldValid() ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 149 | 155 | $field = $this->field; |
| 150 | 156 | foreach( $field as $key => $value ) { |
| 151 | 157 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 152 | - if( !method_exists( $this, $methodName ))continue; |
|
| 158 | + if( !method_exists( $this, $methodName )) { |
|
| 159 | + continue; |
|
| 160 | + } |
|
| 153 | 161 | $this->$methodName(); |
| 154 | 162 | } |
| 155 | 163 | $this->normalizeFieldId(); |
@@ -162,7 +170,9 @@ discard block |
||
| 162 | 170 | */ |
| 163 | 171 | protected function normalizeDependsOn() |
| 164 | 172 | { |
| 165 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 173 | + if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] )) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 166 | 176 | $path = key( $this->field['depends_on'] ); |
| 167 | 177 | $value = $this->field['depends_on'][$path]; |
| 168 | 178 | $this->field['depends_on'] = json_encode([ |
@@ -177,7 +187,9 @@ discard block |
||
| 177 | 187 | */ |
| 178 | 188 | protected function normalizeFieldId() |
| 179 | 189 | { |
| 180 | - if( isset( $this->field['id'] ))return; |
|
| 190 | + if( isset( $this->field['id'] )) { |
|
| 191 | + return; |
|
| 192 | + } |
|
| 181 | 193 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 182 | 194 | } |
| 183 | 195 | |
@@ -200,7 +212,9 @@ discard block |
||
| 200 | 212 | */ |
| 201 | 213 | protected function normalizeFieldValue() |
| 202 | 214 | { |
| 203 | - if( isset( $this->field['value'] ))return; |
|
| 215 | + if( isset( $this->field['value'] )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 204 | 218 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 205 | 219 | $this->field['path'], |
| 206 | 220 | $this->getFieldDefault() |