@@ -8,7 +8,10 @@ |
||
| 8 | 8 | <textarea readonly><?= esc_attr( $post->post_content ); ?></textarea> |
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | -<?php if( empty( $response ))return; ?> |
|
| 11 | +<?php if( empty( $response )) { |
|
| 12 | + return; |
|
| 13 | +} |
|
| 14 | +?> |
|
| 12 | 15 | |
| 13 | 16 | <div class="postbox glsr-response-postbox"> |
| 14 | 17 | <button type="button" class="handlediv" aria-expanded="true"> |
@@ -13,7 +13,9 @@ |
||
| 13 | 13 | public function getPost( $postId ) |
| 14 | 14 | { |
| 15 | 15 | $postId = trim( $postId ); |
| 16 | - if( empty( $postId ) || !is_numeric( $postId ))return; |
|
| 16 | + if( empty( $postId ) || !is_numeric( $postId )) { |
|
| 17 | + return; |
|
| 18 | + } |
|
| 17 | 19 | if( $this->isEnabled() ) { |
| 18 | 20 | $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() )); |
| 19 | 21 | } |
@@ -85,7 +85,9 @@ discard block |
||
| 85 | 85 | $renderedFields = []; |
| 86 | 86 | foreach( (array)$review as $key => $value ) { |
| 87 | 87 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
| 88 | - if( !method_exists( $this, $method ))continue; |
|
| 88 | + if( !method_exists( $this, $method )) { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 89 | 91 | $renderedFields[$key] = $this->$method( $key, $value ); |
| 90 | 92 | } |
| 91 | 93 | $this->wrap( $renderedFields, $review ); |
@@ -100,9 +102,13 @@ discard block |
||
| 100 | 102 | */ |
| 101 | 103 | protected function buildOptionAssignedTo( $key, $value ) |
| 102 | 104 | { |
| 103 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 105 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
| 106 | + return; |
|
| 107 | + } |
|
| 104 | 108 | $post = glsr( Polylang::class )->getPost( $value ); |
| 105 | - if( !( $post instanceof WP_Post ))return; |
|
| 109 | + if( !( $post instanceof WP_Post )) { |
|
| 110 | + return; |
|
| 111 | + } |
|
| 106 | 112 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 107 | 113 | 'href' => get_the_permalink( $post->ID ), |
| 108 | 114 | ]); |
@@ -117,7 +123,9 @@ discard block |
||
| 117 | 123 | */ |
| 118 | 124 | protected function buildOptionAuthor( $key, $value ) |
| 119 | 125 | { |
| 120 | - if( $this->isHidden( $key ))return; |
|
| 126 | + if( $this->isHidden( $key )) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 121 | 129 | return '<span>'.$value.'</span>'; |
| 122 | 130 | } |
| 123 | 131 | |
@@ -128,7 +136,9 @@ discard block |
||
| 128 | 136 | */ |
| 129 | 137 | protected function buildOptionAvatar( $key, $value ) |
| 130 | 138 | { |
| 131 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 139 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 132 | 142 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 133 | 143 | return glsr( Builder::class )->img([ |
| 134 | 144 | 'height' => $size, |
@@ -146,7 +156,9 @@ discard block |
||
| 146 | 156 | protected function buildOptionContent( $key, $value ) |
| 147 | 157 | { |
| 148 | 158 | $text = $this->normalizeText( $value ); |
| 149 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 159 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
| 160 | + return; |
|
| 161 | + } |
|
| 150 | 162 | return '<p>'.$text.'</p>'; |
| 151 | 163 | } |
| 152 | 164 | |
@@ -157,7 +169,9 @@ discard block |
||
| 157 | 169 | */ |
| 158 | 170 | protected function buildOptionDate( $key, $value ) |
| 159 | 171 | { |
| 160 | - if( $this->isHidden( $key ))return; |
|
| 172 | + if( $this->isHidden( $key )) { |
|
| 173 | + return; |
|
| 174 | + } |
|
| 161 | 175 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 162 | 176 | if( $dateFormat == 'relative' ) { |
| 163 | 177 | $date = glsr( Date::class )->relative( $value ); |
@@ -178,7 +192,9 @@ discard block |
||
| 178 | 192 | */ |
| 179 | 193 | protected function buildOptionRating( $key, $value ) |
| 180 | 194 | { |
| 181 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 195 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 196 | + return; |
|
| 197 | + } |
|
| 182 | 198 | return glsr( Partial::class )->build( 'star-rating', [ |
| 183 | 199 | 'rating' => $value, |
| 184 | 200 | ]); |
@@ -191,7 +207,9 @@ discard block |
||
| 191 | 207 | */ |
| 192 | 208 | protected function buildOptionResponse( $key, $value ) |
| 193 | 209 | { |
| 194 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 210 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 195 | 213 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
| 196 | 214 | $text = $this->normalizeText( $value ); |
| 197 | 215 | $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 ); |
@@ -380,7 +406,9 @@ discard block |
||
| 380 | 406 | $renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review ); |
| 381 | 407 | array_walk( $renderedFields, function( &$value, $key ) use( $review ) { |
| 382 | 408 | $value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review ); |
| 383 | - if( empty( $value ))return; |
|
| 409 | + if( empty( $value )) { |
|
| 410 | + return; |
|
| 411 | + } |
|
| 384 | 412 | $value = glsr( Builder::class )->div( $value, [ |
| 385 | 413 | 'class' => 'glsr-review-'.$key, |
| 386 | 414 | ]); |
@@ -15,7 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( glsr()->constant( 'CAPABILITY' )))return; |
|
| 18 | + if( !current_user_can( glsr()->constant( 'CAPABILITY' ))) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | nocache_headers(); |
| 20 | 22 | header( 'Content-Type: text/plain' ); |
| 21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 29 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 30 | 'class' => 'pending-count', |
@@ -53,7 +55,9 @@ discard block |
||
| 53 | 55 | foreach( $pages as $slug => $title ) { |
| 54 | 56 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 57 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 58 | + if( !is_callable( $callback )) { |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 57 | 61 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback ); |
| 58 | 62 | } |
| 59 | 63 | } |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | protected $settings; |
| 34 | 34 | protected $taxonomy; |
| 35 | 35 | |
| 36 | - public function __construct( Application $app ) { |
|
| 36 | + public function __construct( Application $app ) |
|
| 37 | + { |
|
| 37 | 38 | $this->app = $app; |
| 38 | 39 | $this->admin = $app->make( AdminController::class ); |
| 39 | 40 | $this->blocks = $app->make( BlocksController::class ); |
@@ -19,7 +19,9 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function register( $block ) |
| 21 | 21 | { |
| 22 | - if( !function_exists( 'register_block_type' ))return; |
|
| 22 | + if( !function_exists( 'register_block_type' )) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 23 | 25 | register_block_type( Application::ID.'/'.$block, [ |
| 24 | 26 | 'attributes' => $this->attributes(), |
| 25 | 27 | 'editor_script' => Application::ID.'/blocks', |
@@ -90,10 +90,14 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function registerMetaBoxes( $postType, $post ) |
| 92 | 92 | { |
| 93 | - if( $postType != Application::POST_TYPE )return; |
|
| 93 | + if( $postType != Application::POST_TYPE ) { |
|
| 94 | + return; |
|
| 95 | + } |
|
| 94 | 96 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 95 | 97 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 96 | - if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return; |
|
| 98 | + if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) { |
|
| 99 | + return; |
|
| 100 | + } |
|
| 97 | 101 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
| 98 | 102 | } |
| 99 | 103 | |
@@ -129,7 +133,9 @@ discard block |
||
| 129 | 133 | */ |
| 130 | 134 | public function renderAssignedToMetabox( WP_Post $post ) |
| 131 | 135 | { |
| 132 | - if( !$this->isReviewPostType( $post ))return; |
|
| 136 | + if( !$this->isReviewPostType( $post )) { |
|
| 137 | + return; |
|
| 138 | + } |
|
| 133 | 139 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
| 134 | 140 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 135 | 141 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -144,7 +150,9 @@ discard block |
||
| 144 | 150 | */ |
| 145 | 151 | public function renderDetailsMetaBox( WP_Post $post ) |
| 146 | 152 | { |
| 147 | - if( !$this->isReviewPostType( $post ))return; |
|
| 153 | + if( !$this->isReviewPostType( $post )) { |
|
| 154 | + return; |
|
| 155 | + } |
|
| 148 | 156 | $review = glsr( ReviewManager::class )->single( $post ); |
| 149 | 157 | glsr()->render( 'partials/editor/metabox-details', [ |
| 150 | 158 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -158,7 +166,9 @@ discard block |
||
| 158 | 166 | */ |
| 159 | 167 | public function renderPinnedInPublishMetaBox() |
| 160 | 168 | { |
| 161 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 169 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 162 | 172 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
| 163 | 173 | 'context' => [ |
| 164 | 174 | 'no' => __( 'No', 'site-reviews' ), |
@@ -174,7 +184,9 @@ discard block |
||
| 174 | 184 | */ |
| 175 | 185 | public function renderResponseMetaBox( WP_Post $post ) |
| 176 | 186 | { |
| 177 | - if( !$this->isReviewPostType( $post ))return; |
|
| 187 | + if( !$this->isReviewPostType( $post )) { |
|
| 188 | + return; |
|
| 189 | + } |
|
| 178 | 190 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 179 | 191 | glsr()->render( 'partials/editor/metabox-response', [ |
| 180 | 192 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -187,7 +199,9 @@ discard block |
||
| 187 | 199 | */ |
| 188 | 200 | public function renderReviewEditor( WP_Post $post ) |
| 189 | 201 | { |
| 190 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 202 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
| 203 | + return; |
|
| 204 | + } |
|
| 191 | 205 | glsr()->render( 'partials/editor/review', [ |
| 192 | 206 | 'post' => $post, |
| 193 | 207 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -201,7 +215,9 @@ discard block |
||
| 201 | 215 | public function renderReviewFields() |
| 202 | 216 | { |
| 203 | 217 | $screen = glsr_current_screen(); |
| 204 | - if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return; |
|
| 218 | + if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) { |
|
| 219 | + return; |
|
| 220 | + } |
|
| 205 | 221 | add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] ); |
| 206 | 222 | add_action( 'edit_form_top', [$this, 'renderReviewNotice'] ); |
| 207 | 223 | } |
@@ -212,7 +228,9 @@ discard block |
||
| 212 | 228 | */ |
| 213 | 229 | public function renderReviewNotice( WP_Post $post ) |
| 214 | 230 | { |
| 215 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 231 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
| 232 | + return; |
|
| 233 | + } |
|
| 216 | 234 | glsr( Notice::class )->addWarning( sprintf( |
| 217 | 235 | __( '%s reviews are read-only.', 'site-reviews' ), |
| 218 | 236 | glsr( Columns::class )->buildColumnReviewType( $post->ID ) |
@@ -231,7 +249,9 @@ discard block |
||
| 231 | 249 | */ |
| 232 | 250 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 233 | 251 | { |
| 234 | - if( !$this->isReviewPostType( $post ))return; |
|
| 252 | + if( !$this->isReviewPostType( $post )) { |
|
| 253 | + return; |
|
| 254 | + } |
|
| 235 | 255 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 236 | 256 | 'post' => $post, |
| 237 | 257 | 'tax_name' => Application::TAXONOMY, |
@@ -269,7 +289,9 @@ discard block |
||
| 269 | 289 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
| 270 | 290 | { |
| 271 | 291 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
| 272 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 292 | + if( !( $assignedPost instanceof WP_Post )) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 273 | 295 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
| 274 | 296 | 'context' => [ |
| 275 | 297 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -314,7 +336,9 @@ discard block |
||
| 314 | 336 | */ |
| 315 | 337 | protected function getReviewType( $review ) |
| 316 | 338 | { |
| 317 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
| 339 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
| 340 | + return; |
|
| 341 | + } |
|
| 318 | 342 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
| 319 | 343 | ? glsr()->reviewTypes[$review->review_type] |
| 320 | 344 | : __( 'Unknown', 'site-reviews' ); |
@@ -35,7 +35,9 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY )) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 39 | 41 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
| 40 | 42 | 'class' => 'screen-reader-text', |
| 41 | 43 | 'for' => Application::TAXONOMY, |