@@ -89,7 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function registerMetaBoxes( $postType ) |
| 91 | 91 | { |
| 92 | - if( $postType != Application::POST_TYPE )return; |
|
| 92 | + if( $postType != Application::POST_TYPE ) { |
|
| 93 | + return; |
|
| 94 | + } |
|
| 93 | 95 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 94 | 96 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 95 | 97 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -119,7 +121,9 @@ discard block |
||
| 119 | 121 | */ |
| 120 | 122 | public function renderAssignedToMetabox( WP_Post $post ) |
| 121 | 123 | { |
| 122 | - if( !$this->isReviewPostType( $post ))return; |
|
| 124 | + if( !$this->isReviewPostType( $post )) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 123 | 127 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
| 124 | 128 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 125 | 129 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -134,7 +138,9 @@ discard block |
||
| 134 | 138 | */ |
| 135 | 139 | public function renderDetailsMetaBox( WP_Post $post ) |
| 136 | 140 | { |
| 137 | - if( !$this->isReviewPostType( $post ))return; |
|
| 141 | + if( !$this->isReviewPostType( $post )) { |
|
| 142 | + return; |
|
| 143 | + } |
|
| 138 | 144 | $review = glsr( ReviewManager::class )->single( $post ); |
| 139 | 145 | glsr()->render( 'partials/editor/metabox-details', [ |
| 140 | 146 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -148,7 +154,9 @@ discard block |
||
| 148 | 154 | */ |
| 149 | 155 | public function renderPinnedInPublishMetaBox() |
| 150 | 156 | { |
| 151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 157 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 158 | + return; |
|
| 159 | + } |
|
| 152 | 160 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
| 153 | 161 | 'context' => [ |
| 154 | 162 | 'no' => __( 'No', 'site-reviews' ), |
@@ -164,7 +172,9 @@ discard block |
||
| 164 | 172 | */ |
| 165 | 173 | public function renderResponseMetaBox( WP_Post $post ) |
| 166 | 174 | { |
| 167 | - if( !$this->isReviewPostType( $post ))return; |
|
| 175 | + if( !$this->isReviewPostType( $post )) { |
|
| 176 | + return; |
|
| 177 | + } |
|
| 168 | 178 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 169 | 179 | glsr()->render( 'partials/editor/metabox-response', [ |
| 170 | 180 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -178,7 +188,9 @@ discard block |
||
| 178 | 188 | */ |
| 179 | 189 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 180 | 190 | { |
| 181 | - if( !$this->isReviewPostType( $post ))return; |
|
| 191 | + if( !$this->isReviewPostType( $post )) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 182 | 194 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 183 | 195 | 'post' => $post, |
| 184 | 196 | 'tax_name' => Application::TAXONOMY, |
@@ -216,7 +228,9 @@ discard block |
||
| 216 | 228 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
| 217 | 229 | { |
| 218 | 230 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
| 219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 231 | + if( !( $assignedPost instanceof WP_Post )) { |
|
| 232 | + return; |
|
| 233 | + } |
|
| 220 | 234 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
| 221 | 235 | 'context' => [ |
| 222 | 236 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -257,7 +271,9 @@ discard block |
||
| 257 | 271 | */ |
| 258 | 272 | protected function getReviewType( $review ) |
| 259 | 273 | { |
| 260 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
| 274 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
| 275 | + return; |
|
| 276 | + } |
|
| 261 | 277 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
| 262 | 278 | ? glsr()->reviewTypes[$review->review_type] |
| 263 | 279 | : __( 'Unknown', 'site-reviews' ); |
@@ -109,7 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function renderReviewEditor( WP_Post $post ) |
| 111 | 111 | { |
| 112 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 112 | + if( !$this->isReviewPostType( $post ) || $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->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 126 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
| 126 | 130 | glsr( Template::class )->render( 'partials/editor/notice', [ |
| 127 | 131 | 'context' => [ |
@@ -136,12 +140,16 @@ discard block |
||
| 136 | 140 | */ |
| 137 | 141 | public function renderTinymceButton() |
| 138 | 142 | { |
| 139 | - if( glsr_current_screen()->base != 'post' )return; |
|
| 143 | + if( glsr_current_screen()->base != 'post' ) { |
|
| 144 | + return; |
|
| 145 | + } |
|
| 140 | 146 | $shortcodes = []; |
| 141 | 147 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
| 142 | 148 | $shortcodes[$shortcode] = $values; |
| 143 | 149 | } |
| 144 | - if( empty( $shortcodes ))return; |
|
| 150 | + if( empty( $shortcodes )) { |
|
| 151 | + return; |
|
| 152 | + } |
|
| 145 | 153 | glsr()->render( 'partials/editor/tinymce', [ |
| 146 | 154 | 'shortcodes' => $shortcodes, |
| 147 | 155 | ]); |
@@ -35,7 +35,9 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( get_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, |
@@ -24,7 +24,9 @@ |
||
| 24 | 24 | glsr( Notification::class )->send( $review ); |
| 25 | 25 | do_action( 'site-reviews/local/review/submitted', null, $command ); // @compat |
| 26 | 26 | do_action( 'site-reviews/review/submitted', $review ); |
| 27 | - if( $command->ajax_request )return; |
|
| 27 | + if( $command->ajax_request ) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | wp_safe_redirect( $this->getReferer( $command )); |
| 29 | 31 | exit; |
| 30 | 32 | } |