@@ -116,7 +116,9 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function registerMetaBoxes( $postType ) |
| 118 | 118 | { |
| 119 | - if( $postType != Application::POST_TYPE )return; |
|
| 119 | + if( $postType != Application::POST_TYPE ) { |
|
| 120 | + return; |
|
| 121 | + } |
|
| 120 | 122 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 121 | 123 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 122 | 124 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -146,7 +148,9 @@ discard block |
||
| 146 | 148 | */ |
| 147 | 149 | public function renderAssignedToMetabox( WP_Post $post ) |
| 148 | 150 | { |
| 149 | - if( !$this->isReviewPostType( $post ))return; |
|
| 151 | + if( !$this->isReviewPostType( $post )) { |
|
| 152 | + return; |
|
| 153 | + } |
|
| 150 | 154 | $assignedTo = get_post_meta( $post->ID, 'assigned_to', true ); |
| 151 | 155 | $template = ''; |
| 152 | 156 | if( $assignedPost = get_post( $assignedTo )) { |
@@ -172,7 +176,9 @@ discard block |
||
| 172 | 176 | */ |
| 173 | 177 | public function renderDetailsMetaBox( WP_Post $post ) |
| 174 | 178 | { |
| 175 | - if( !$this->isReviewPostType( $post ))return; |
|
| 179 | + if( !$this->isReviewPostType( $post )) { |
|
| 180 | + return; |
|
| 181 | + } |
|
| 176 | 182 | $review = glsr( Database::class )->getReview( $post ); |
| 177 | 183 | glsr()->render( 'edit/metabox-details', [ |
| 178 | 184 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -186,7 +192,9 @@ discard block |
||
| 186 | 192 | */ |
| 187 | 193 | public function renderPinnedInPublishMetaBox() |
| 188 | 194 | { |
| 189 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 195 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 196 | + return; |
|
| 197 | + } |
|
| 190 | 198 | $pinned = get_post_meta( get_the_ID(), 'pinned', true ); |
| 191 | 199 | glsr()->render( 'edit/pinned', [ |
| 192 | 200 | 'pinned' => $pinned, |
@@ -199,7 +207,9 @@ discard block |
||
| 199 | 207 | */ |
| 200 | 208 | public function renderResponseMetaBox( WP_Post $post ) |
| 201 | 209 | { |
| 202 | - if( !$this->isReviewPostType( $post ))return; |
|
| 210 | + if( !$this->isReviewPostType( $post )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 203 | 213 | $review = glsr( Database::class )->getReview( $post ); |
| 204 | 214 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 205 | 215 | glsr()->render( 'edit/metabox-response', [ |
@@ -214,7 +224,9 @@ discard block |
||
| 214 | 224 | */ |
| 215 | 225 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 216 | 226 | { |
| 217 | - if( !$this->isReviewPostType( $post ))return; |
|
| 227 | + if( !$this->isReviewPostType( $post )) { |
|
| 228 | + return; |
|
| 229 | + } |
|
| 218 | 230 | glsr()->render( 'edit/metabox-categories', [ |
| 219 | 231 | 'post' => $post, |
| 220 | 232 | 'tax_name' => esc_attr( Application::TAXONOMY ), |
@@ -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 ); |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | 'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ), |
| 43 | 43 | ]; |
| 44 | 44 | foreach( $replacements as $search => $replacement ) { |
| 45 | - if( $translation != $search )continue; |
|
| 45 | + if( $translation != $search ) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | $translation = $replacement; |
| 47 | 49 | } |
| 48 | 50 | } |
@@ -55,7 +57,9 @@ discard block |
||
| 55 | 57 | public function filterUpdateMessages( array $messages ) |
| 56 | 58 | { |
| 57 | 59 | $post = get_post(); |
| 58 | - if( !( $post instanceof WP_Post ))return; |
|
| 60 | + if( !( $post instanceof WP_Post )) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 59 | 63 | $strings = $this->getReviewLabels(); |
| 60 | 64 | $restored = filter_input( INPUT_GET, 'revision' ); |
| 61 | 65 | if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) { |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function onCreateReview( $postData, $meta, $postId ) |
| 23 | 23 | { |
| 24 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 24 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 25 | + return; |
|
| 26 | + } |
|
| 25 | 27 | $this->updateAssignedToPost( $review ); |
| 26 | 28 | } |
| 27 | 29 | |
@@ -31,7 +33,9 @@ discard block |
||
| 31 | 33 | */ |
| 32 | 34 | public function onDeleteReview( $postId ) |
| 33 | 35 | { |
| 34 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
| 36 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
| 37 | + return; |
|
| 38 | + } |
|
| 35 | 39 | $review->post_status = 'deleted'; // important to change the post_status here first! |
| 36 | 40 | $this->updateAssignedToPost( $review ); |
| 37 | 41 | } |
@@ -51,7 +55,9 @@ discard block |
||
| 51 | 55 | */ |
| 52 | 56 | public function saveAssignedToMetabox( $postId ) |
| 53 | 57 | { |
| 54 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
| 58 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 55 | 61 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
| 56 | 62 | $assignedTo || $assignedTo = ''; |
| 57 | 63 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -66,7 +72,9 @@ discard block |
||
| 66 | 72 | */ |
| 67 | 73 | public function saveResponseMetabox( $postId ) |
| 68 | 74 | { |
| 69 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
| 75 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 70 | 78 | $response = filter_input( INPUT_POST, 'response' ); |
| 71 | 79 | $response || $response = ''; |
| 72 | 80 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
@@ -119,7 +127,9 @@ discard block |
||
| 119 | 127 | */ |
| 120 | 128 | protected function updateAssignedToPost( WP_Post $review ) |
| 121 | 129 | { |
| 122 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
| 130 | + if( !( $postId = $this->getAssignedToPostId( $review->ID ))) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 123 | 133 | $reviewIds = get_post_meta( $postId, static::META_REVIEW_ID ); |
| 124 | 134 | $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
| 125 | 135 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |