@@ -96,7 +96,9 @@ discard block |
||
96 | 96 | { |
97 | 97 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
98 | 98 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
99 | - if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return; |
|
99 | + if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
101 | 103 | } |
102 | 104 | |
@@ -133,7 +135,9 @@ discard block |
||
133 | 135 | */ |
134 | 136 | public function renderAssignedToMetabox( $post ) |
135 | 137 | { |
136 | - if( !$this->isReviewPostType( $post ))return; |
|
138 | + if( !$this->isReviewPostType( $post )) { |
|
139 | + return; |
|
140 | + } |
|
137 | 141 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
138 | 142 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
139 | 143 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -149,7 +153,9 @@ discard block |
||
149 | 153 | */ |
150 | 154 | public function renderDetailsMetaBox( $post ) |
151 | 155 | { |
152 | - if( !$this->isReviewPostType( $post ))return; |
|
156 | + if( !$this->isReviewPostType( $post )) { |
|
157 | + return; |
|
158 | + } |
|
153 | 159 | $review = glsr( ReviewManager::class )->single( $post ); |
154 | 160 | glsr()->render( 'partials/editor/metabox-details', [ |
155 | 161 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -163,7 +169,9 @@ discard block |
||
163 | 169 | */ |
164 | 170 | public function renderPinnedInPublishMetaBox() |
165 | 171 | { |
166 | - if( !$this->isReviewPostType( get_post() ))return; |
|
172 | + if( !$this->isReviewPostType( get_post() )) { |
|
173 | + return; |
|
174 | + } |
|
167 | 175 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
168 | 176 | 'context' => [ |
169 | 177 | 'no' => __( 'No', 'site-reviews' ), |
@@ -180,7 +188,9 @@ discard block |
||
180 | 188 | */ |
181 | 189 | public function renderResponseMetaBox( $post ) |
182 | 190 | { |
183 | - if( !$this->isReviewPostType( $post ))return; |
|
191 | + if( !$this->isReviewPostType( $post )) { |
|
192 | + return; |
|
193 | + } |
|
184 | 194 | wp_nonce_field( 'response', '_nonce-response', false ); |
185 | 195 | glsr()->render( 'partials/editor/metabox-response', [ |
186 | 196 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -194,7 +204,9 @@ discard block |
||
194 | 204 | */ |
195 | 205 | public function renderReviewEditor( $post ) |
196 | 206 | { |
197 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
207 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
208 | + return; |
|
209 | + } |
|
198 | 210 | glsr()->render( 'partials/editor/review', [ |
199 | 211 | 'post' => $post, |
200 | 212 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -208,7 +220,9 @@ discard block |
||
208 | 220 | public function renderReviewFields() |
209 | 221 | { |
210 | 222 | $screen = glsr_current_screen(); |
211 | - if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return; |
|
223 | + if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) { |
|
224 | + return; |
|
225 | + } |
|
212 | 226 | add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] ); |
213 | 227 | add_action( 'edit_form_top', [$this, 'renderReviewNotice'] ); |
214 | 228 | } |
@@ -220,7 +234,9 @@ discard block |
||
220 | 234 | */ |
221 | 235 | public function renderReviewNotice( $post ) |
222 | 236 | { |
223 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
237 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
238 | + return; |
|
239 | + } |
|
224 | 240 | glsr( Notice::class )->addWarning( sprintf( |
225 | 241 | __( '%s reviews are read-only.', 'site-reviews' ), |
226 | 242 | glsr( Columns::class )->buildColumnReviewType( $post->ID ) |
@@ -240,7 +256,9 @@ discard block |
||
240 | 256 | */ |
241 | 257 | public function renderTaxonomyMetabox( $post ) |
242 | 258 | { |
243 | - if( !$this->isReviewPostType( $post ))return; |
|
259 | + if( !$this->isReviewPostType( $post )) { |
|
260 | + return; |
|
261 | + } |
|
244 | 262 | glsr()->render( 'partials/editor/metabox-categories', [ |
245 | 263 | 'post' => $post, |
246 | 264 | 'tax_name' => Application::TAXONOMY, |
@@ -255,7 +273,9 @@ discard block |
||
255 | 273 | */ |
256 | 274 | public function revertReview() |
257 | 275 | { |
258 | - if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return; |
|
276 | + if( filter_input( INPUT_GET, 'plugin' ) != Application::ID ) { |
|
277 | + return; |
|
278 | + } |
|
259 | 279 | check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
260 | 280 | glsr( ReviewManager::class )->revert( $postId ); |
261 | 281 | $this->redirect( $postId, 52 ); |
@@ -279,7 +299,9 @@ discard block |
||
279 | 299 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
280 | 300 | { |
281 | 301 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
282 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
302 | + if( !( $assignedPost instanceof WP_Post )) { |
|
303 | + return; |
|
304 | + } |
|
283 | 305 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
284 | 306 | 'context' => [ |
285 | 307 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -325,7 +347,9 @@ discard block |
||
325 | 347 | */ |
326 | 348 | protected function getReviewType( $review ) |
327 | 349 | { |
328 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
350 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
351 | + return; |
|
352 | + } |
|
329 | 353 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
330 | 354 | ? glsr()->reviewTypes[$review->review_type] |
331 | 355 | : __( 'Unknown', 'site-reviews' ); |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | $views = $this->generatePossibleViews( $view ); |
57 | 57 | foreach( $views as $possibleView ) { |
58 | - if( !file_exists( glsr()->file( $possibleView )))continue; |
|
58 | + if( !file_exists( glsr()->file( $possibleView ))) { |
|
59 | + continue; |
|
60 | + } |
|
59 | 61 | return glsr( Helper::class )->removePrefix( 'views/', $possibleView ); |
60 | 62 | } |
61 | 63 | return $view; |
@@ -88,7 +90,9 @@ discard block |
||
88 | 90 | */ |
89 | 91 | public function modifyField( Builder $instance ) |
90 | 92 | { |
91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
93 | + if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) { |
|
94 | + return; |
|
95 | + } |
|
92 | 96 | call_user_func_array( [$this, 'customize'], [$instance] ); |
93 | 97 | } |
94 | 98 | |
@@ -105,7 +109,9 @@ discard block |
||
105 | 109 | */ |
106 | 110 | protected function customize( Builder $instance ) |
107 | 111 | { |
108 | - if( !array_key_exists( $instance->tag, $this->fields ))return; |
|
112 | + if( !array_key_exists( $instance->tag, $this->fields )) { |
|
113 | + return; |
|
114 | + } |
|
109 | 115 | $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
110 | 116 | $key = $instance->tag.'_'.$args['type']; |
111 | 117 | $classes = glsr_get( $this->fields, $key, glsr_get( $this->fields, $instance->tag )); |