@@ -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 ); |
@@ -63,7 +63,9 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] )); |
| 65 | 65 | foreach( $data as $key => $value ) { |
| 66 | - if( is_array( $value ))continue; |
|
| 66 | + if( is_array( $value )) { |
|
| 67 | + continue; |
|
| 68 | + } |
|
| 67 | 69 | $data[$key] = []; |
| 68 | 70 | } |
| 69 | 71 | $data['template'] = $this; |
@@ -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'], |
@@ -109,7 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function renderReviewEditor( WP_Post $post ) |
| 111 | 111 | { |
| 112 | - if( !$this->isReviewEditable( $post ) )return; |
|
| 112 | + if( !$this->isReviewEditable( $post ) ) { |
|
| 113 | + return; |
|
| 114 | + } |
|
| 113 | 115 | glsr()->render( 'partials/editor/review', [ |
| 114 | 116 | 'post' => $post, |
| 115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
| 121 | 123 | */ |
| 122 | 124 | public function renderReviewNotice( WP_Post $post ) |
| 123 | 125 | { |
| 124 | - if( !$this->isReviewEditable( $post ) )return; |
|
| 126 | + if( !$this->isReviewEditable( $post ) ) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
| 126 | 130 | glsr()->render( 'partials/editor/notice' ); |
| 127 | 131 | } |
@@ -132,13 +136,19 @@ discard block |
||
| 132 | 136 | */ |
| 133 | 137 | public function renderTinymceButton() |
| 134 | 138 | { |
| 135 | - if( glsr_current_screen()->base != 'post' )return; |
|
| 139 | + if( glsr_current_screen()->base != 'post' ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 136 | 142 | $shortcodes = []; |
| 137 | 143 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
| 138 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
| 144 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
| 145 | + continue; |
|
| 146 | + } |
|
| 139 | 147 | $shortcodes[$shortcode] = $values; |
| 140 | 148 | } |
| 141 | - if( empty( $shortcodes ))return; |
|
| 149 | + if( empty( $shortcodes )) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 142 | 152 | glsr()->render( 'partials/editor/tinymce', [ |
| 143 | 153 | 'shortcodes' => $shortcodes, |
| 144 | 154 | ]); |
@@ -117,7 +117,9 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function registerMetaBoxes( $postType ) |
| 119 | 119 | { |
| 120 | - if( $postType != Application::POST_TYPE )return; |
|
| 120 | + if( $postType != Application::POST_TYPE ) { |
|
| 121 | + return; |
|
| 122 | + } |
|
| 121 | 123 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 122 | 124 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 123 | 125 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -147,7 +149,9 @@ discard block |
||
| 147 | 149 | */ |
| 148 | 150 | public function renderAssignedToMetabox( WP_Post $post ) |
| 149 | 151 | { |
| 150 | - if( !$this->isReviewPostType( $post ))return; |
|
| 152 | + if( !$this->isReviewPostType( $post )) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 151 | 155 | $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true )); |
| 152 | 156 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 153 | 157 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -162,7 +166,9 @@ discard block |
||
| 162 | 166 | */ |
| 163 | 167 | public function renderDetailsMetaBox( WP_Post $post ) |
| 164 | 168 | { |
| 165 | - if( !$this->isReviewPostType( $post ))return; |
|
| 169 | + if( !$this->isReviewPostType( $post )) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 166 | 172 | $review = glsr( Database::class )->getReview( $post ); |
| 167 | 173 | glsr()->render( 'partials/editor/metabox-details', [ |
| 168 | 174 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -176,7 +182,9 @@ discard block |
||
| 176 | 182 | */ |
| 177 | 183 | public function renderPinnedInPublishMetaBox() |
| 178 | 184 | { |
| 179 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 185 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 186 | + return; |
|
| 187 | + } |
|
| 180 | 188 | glsr()->render( 'partials/editor/pinned', [ |
| 181 | 189 | 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
| 182 | 190 | ]); |
@@ -188,7 +196,9 @@ discard block |
||
| 188 | 196 | */ |
| 189 | 197 | public function renderResponseMetaBox( WP_Post $post ) |
| 190 | 198 | { |
| 191 | - if( !$this->isReviewPostType( $post ))return; |
|
| 199 | + if( !$this->isReviewPostType( $post )) { |
|
| 200 | + return; |
|
| 201 | + } |
|
| 192 | 202 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 193 | 203 | glsr()->render( 'partials/editor/metabox-response', [ |
| 194 | 204 | 'response' => glsr( Database::class )->getReview( $post )->response, |
@@ -202,7 +212,9 @@ discard block |
||
| 202 | 212 | */ |
| 203 | 213 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 204 | 214 | { |
| 205 | - if( !$this->isReviewPostType( $post ))return; |
|
| 215 | + if( !$this->isReviewPostType( $post )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 206 | 218 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 207 | 219 | 'post' => $post, |
| 208 | 220 | 'tax_name' => Application::TAXONOMY, |
@@ -240,7 +252,9 @@ discard block |
||
| 240 | 252 | protected function buildAssignedToTemplate( $assignedTo ) |
| 241 | 253 | { |
| 242 | 254 | $assignedPost = get_post( $assignedTo ); |
| 243 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 255 | + if( !( $assignedPost instanceof WP_Post )) { |
|
| 256 | + return; |
|
| 257 | + } |
|
| 244 | 258 | return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [ |
| 245 | 259 | 'context' => [ |
| 246 | 260 | 'url' => (string)get_permalink( $assignedPost ), |
@@ -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; |