@@ -166,7 +166,9 @@ |
||
166 | 166 | { |
167 | 167 | $result = []; |
168 | 168 | foreach( $array as $key => $value ) { |
169 | - if( !$value )continue; |
|
169 | + if( !$value ) { |
|
170 | + continue; |
|
171 | + } |
|
170 | 172 | $result[$key] = is_array( $value ) |
171 | 173 | ? $this->removeEmptyArrayValues( $value ) |
172 | 174 | : $value; |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | { |
92 | 92 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
93 | 93 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
94 | - if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return; |
|
94 | + if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) { |
|
95 | + return; |
|
96 | + } |
|
95 | 97 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
96 | 98 | } |
97 | 99 | |
@@ -127,7 +129,9 @@ discard block |
||
127 | 129 | */ |
128 | 130 | public function renderAssignedToMetabox( WP_Post $post ) |
129 | 131 | { |
130 | - if( !$this->isReviewPostType( $post ))return; |
|
132 | + if( !$this->isReviewPostType( $post )) { |
|
133 | + return; |
|
134 | + } |
|
131 | 135 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
132 | 136 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
133 | 137 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -142,7 +146,9 @@ discard block |
||
142 | 146 | */ |
143 | 147 | public function renderDetailsMetaBox( WP_Post $post ) |
144 | 148 | { |
145 | - if( !$this->isReviewPostType( $post ))return; |
|
149 | + if( !$this->isReviewPostType( $post )) { |
|
150 | + return; |
|
151 | + } |
|
146 | 152 | $review = glsr( ReviewManager::class )->single( $post ); |
147 | 153 | glsr()->render( 'partials/editor/metabox-details', [ |
148 | 154 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | */ |
157 | 163 | public function renderPinnedInPublishMetaBox() |
158 | 164 | { |
159 | - if( !$this->isReviewPostType( get_post() ))return; |
|
165 | + if( !$this->isReviewPostType( get_post() )) { |
|
166 | + return; |
|
167 | + } |
|
160 | 168 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
161 | 169 | 'context' => [ |
162 | 170 | 'no' => __( 'No', 'site-reviews' ), |
@@ -172,7 +180,9 @@ discard block |
||
172 | 180 | */ |
173 | 181 | public function renderResponseMetaBox( WP_Post $post ) |
174 | 182 | { |
175 | - if( !$this->isReviewPostType( $post ))return; |
|
183 | + if( !$this->isReviewPostType( $post )) { |
|
184 | + return; |
|
185 | + } |
|
176 | 186 | wp_nonce_field( 'response', '_nonce-response', false ); |
177 | 187 | glsr()->render( 'partials/editor/metabox-response', [ |
178 | 188 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -185,7 +195,9 @@ discard block |
||
185 | 195 | */ |
186 | 196 | public function renderReviewEditor( WP_Post $post ) |
187 | 197 | { |
188 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
198 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
199 | + return; |
|
200 | + } |
|
189 | 201 | glsr()->render( 'partials/editor/review', [ |
190 | 202 | 'post' => $post, |
191 | 203 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -199,7 +211,9 @@ discard block |
||
199 | 211 | public function renderReviewFields() |
200 | 212 | { |
201 | 213 | $screen = glsr_current_screen(); |
202 | - if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return; |
|
214 | + if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) { |
|
215 | + return; |
|
216 | + } |
|
203 | 217 | add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] ); |
204 | 218 | add_action( 'edit_form_top', [$this, 'renderReviewNotice'] ); |
205 | 219 | } |
@@ -210,7 +224,9 @@ discard block |
||
210 | 224 | */ |
211 | 225 | public function renderReviewNotice( WP_Post $post ) |
212 | 226 | { |
213 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
227 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
228 | + return; |
|
229 | + } |
|
214 | 230 | glsr( Notice::class )->addWarning( sprintf( |
215 | 231 | __( '%s reviews are read-only.', 'site-reviews' ), |
216 | 232 | glsr( Columns::class )->buildColumnReviewType( $post->ID ) |
@@ -229,7 +245,9 @@ discard block |
||
229 | 245 | */ |
230 | 246 | public function renderTaxonomyMetabox( WP_Post $post ) |
231 | 247 | { |
232 | - if( !$this->isReviewPostType( $post ))return; |
|
248 | + if( !$this->isReviewPostType( $post )) { |
|
249 | + return; |
|
250 | + } |
|
233 | 251 | glsr()->render( 'partials/editor/metabox-categories', [ |
234 | 252 | 'post' => $post, |
235 | 253 | 'tax_name' => Application::TAXONOMY, |
@@ -267,7 +285,9 @@ discard block |
||
267 | 285 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
268 | 286 | { |
269 | 287 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
270 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
288 | + if( !( $assignedPost instanceof WP_Post )) { |
|
289 | + return; |
|
290 | + } |
|
271 | 291 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
272 | 292 | 'context' => [ |
273 | 293 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -312,7 +332,9 @@ discard block |
||
312 | 332 | */ |
313 | 333 | protected function getReviewType( $review ) |
314 | 334 | { |
315 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
335 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
336 | + return; |
|
337 | + } |
|
316 | 338 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
317 | 339 | ? glsr()->reviewTypes[$review->review_type] |
318 | 340 | : __( 'Unknown', 'site-reviews' ); |