@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function renderAssignedToMetabox( WP_Post $post ) |
| 149 | 149 | { |
| 150 | - if( !$this->isReviewPostType( $post ))return; |
|
| 151 | - $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true )); |
|
| 150 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 151 | + $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ) ); |
|
| 152 | 152 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 153 | 153 | glsr()->render( 'edit/metabox-assigned-to', [ |
| 154 | 154 | 'id' => $assignedTo, |
| 155 | 155 | 'template' => $this->buildAssignedToTemplate( $assignedTo ), |
| 156 | - ]); |
|
| 156 | + ] ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function renderDetailsMetaBox( WP_Post $post ) |
| 164 | 164 | { |
| 165 | - if( !$this->isReviewPostType( $post ))return; |
|
| 165 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 166 | 166 | $review = glsr( Database::class )->getReview( $post ); |
| 167 | 167 | glsr()->render( 'edit/metabox-details', [ |
| 168 | 168 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
| 169 | 169 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
| 170 | - ]); |
|
| 170 | + ] ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function renderPinnedInPublishMetaBox() |
| 178 | 178 | { |
| 179 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 179 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
| 180 | 180 | glsr()->render( 'edit/pinned', [ |
| 181 | - 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
| 182 | - ]); |
|
| 181 | + 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
| 182 | + ] ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function renderResponseMetaBox( WP_Post $post ) |
| 190 | 190 | { |
| 191 | - if( !$this->isReviewPostType( $post ))return; |
|
| 191 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 192 | 192 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 193 | 193 | glsr()->render( 'edit/metabox-response', [ |
| 194 | 194 | 'response' => glsr( Database::class )->getReview( $post )->response, |
| 195 | - ]); |
|
| 195 | + ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 204 | 204 | { |
| 205 | - if( !$this->isReviewPostType( $post ))return; |
|
| 205 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 206 | 206 | glsr()->render( 'edit/metabox-categories', [ |
| 207 | 207 | 'post' => $post, |
| 208 | 208 | 'tax_name' => Application::TAXONOMY, |
| 209 | 209 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
| 210 | - ]); |
|
| 210 | + ] ); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function revertReview() |
| 219 | 219 | { |
| 220 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
| 220 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
| 221 | 221 | glsr( Database::class )->revertReview( $postId ); |
| 222 | 222 | $this->redirect( $postId, 52 ); |
| 223 | 223 | } |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | protected function buildAssignedToTemplate( $assignedTo ) |
| 241 | 241 | { |
| 242 | 242 | $assignedPost = get_post( $assignedTo ); |
| 243 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 243 | + if( !($assignedPost instanceof WP_Post) )return; |
|
| 244 | 244 | return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [ |
| 245 | 245 | 'context' => [ |
| 246 | 246 | 'url' => (string)get_permalink( $assignedPost ), |
| 247 | 247 | 'title' => get_the_title( $assignedPost ), |
| 248 | 248 | ], |
| 249 | - ]); |
|
| 249 | + ] ); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -267,13 +267,13 @@ discard block |
||
| 267 | 267 | 'class' => 'button button-large', |
| 268 | 268 | 'href' => $revertUrl, |
| 269 | 269 | 'id' => 'revert', |
| 270 | - ]); |
|
| 270 | + ] ); |
|
| 271 | 271 | } |
| 272 | 272 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
| 273 | 273 | 'class' => 'button button-large', |
| 274 | 274 | 'disabled' => true, |
| 275 | 275 | 'id' => 'revert', |
| 276 | - ]); |
|
| 276 | + ] ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | protected function getReviewType( $review ) |
| 284 | 284 | { |
| 285 | 285 | $reviewType = $review->review_type; |
| 286 | - if( !empty( $review->url )) { |
|
| 286 | + if( !empty($review->url) ) { |
|
| 287 | 287 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
| 288 | 288 | 'href' => $review->url, |
| 289 | 289 | 'target' => '_blank', |
| 290 | - ]); |
|
| 290 | + ] ); |
|
| 291 | 291 | } |
| 292 | 292 | return in_array( $reviewType, glsr()->reviewTypes ) |
| 293 | 293 | ? glsr()->reviewTypes[$reviewType] |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function normalizeDetailsMetaBox( $review ) |
| 311 | 311 | { |
| 312 | - $reviewer = empty( $review->user_id ) |
|
| 312 | + $reviewer = empty($review->user_id) |
|
| 313 | 313 | ? __( 'Unregistered user', 'site-reviews' ) |
| 314 | 314 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
| 315 | 315 | 'href' => get_author_posts_url( $review->user_id ), |
| 316 | - ]); |
|
| 317 | - $email = empty( $review->email ) |
|
| 316 | + ] ); |
|
| 317 | + $email = empty($review->email) |
|
| 318 | 318 | ? '—' |
| 319 | 319 | : glsr( Builder::class )->a( $review->email, [ |
| 320 | 320 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
| 321 | - ]); |
|
| 321 | + ] ); |
|
| 322 | 322 | $metabox = [ |
| 323 | 323 | __( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ), |
| 324 | 324 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $redirectUri = $hasReferer |
| 347 | 347 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
| 348 | 348 | : get_edit_post_link( $postId, false ); |
| 349 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
| 349 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
| 350 | 350 | exit; |
| 351 | 351 | } |
| 352 | 352 | } |
@@ -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( 'edit/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( 'edit/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( 'edit/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( 'edit/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( 'edit/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 ), |