@@ -15,7 +15,9 @@ |
||
15 | 15 | */ |
16 | 16 | public function download( $filename, $content ) |
17 | 17 | { |
18 | - if( !current_user_can( glsr()->constant( 'CAPABILITY' )))return; |
|
18 | + if( !current_user_can( glsr()->constant( 'CAPABILITY' ))) { |
|
19 | + return; |
|
20 | + } |
|
19 | 21 | nocache_headers(); |
20 | 22 | header( 'Content-Type: text/plain' ); |
21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | global $menu, $typenow; |
24 | 24 | foreach( $menu as $key => $value ) { |
25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
26 | + continue; |
|
27 | + } |
|
26 | 28 | $postCount = wp_count_posts( Application::POST_TYPE ); |
27 | 29 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
28 | 30 | 'class' => 'pending-count', |
@@ -53,7 +55,9 @@ discard block |
||
53 | 55 | foreach( $pages as $slug => $title ) { |
54 | 56 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
55 | 57 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
56 | - if( !is_callable( $callback ))continue; |
|
58 | + if( !is_callable( $callback )) { |
|
59 | + continue; |
|
60 | + } |
|
57 | 61 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback ); |
58 | 62 | } |
59 | 63 | } |
@@ -33,7 +33,8 @@ |
||
33 | 33 | protected $settings; |
34 | 34 | protected $taxonomy; |
35 | 35 | |
36 | - public function __construct( Application $app ) { |
|
36 | + public function __construct( Application $app ) |
|
37 | + { |
|
37 | 38 | $this->app = $app; |
38 | 39 | $this->admin = $app->make( AdminController::class ); |
39 | 40 | $this->blocks = $app->make( BlocksController::class ); |
@@ -19,7 +19,9 @@ |
||
19 | 19 | */ |
20 | 20 | public function register( $block ) |
21 | 21 | { |
22 | - if( !function_exists( 'register_block_type' ))return; |
|
22 | + if( !function_exists( 'register_block_type' )) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | register_block_type( Application::ID.'/'.$block, [ |
24 | 26 | 'attributes' => $this->attributes(), |
25 | 27 | 'editor_script' => Application::ID.'/blocks', |
@@ -106,12 +106,16 @@ |
||
106 | 106 | */ |
107 | 107 | public function renderTinymceButton() |
108 | 108 | { |
109 | - if( glsr_current_screen()->base != 'post' )return; |
|
109 | + if( glsr_current_screen()->base != 'post' ) { |
|
110 | + return; |
|
111 | + } |
|
110 | 112 | $shortcodes = []; |
111 | 113 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
112 | 114 | $shortcodes[$shortcode] = $values; |
113 | 115 | } |
114 | - if( empty( $shortcodes ))return; |
|
116 | + if( empty( $shortcodes )) { |
|
117 | + return; |
|
118 | + } |
|
115 | 119 | glsr()->render( 'partials/editor/tinymce', [ |
116 | 120 | 'shortcodes' => $shortcodes, |
117 | 121 | ]); |
@@ -90,10 +90,14 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function registerMetaBoxes( $postType, $post ) |
92 | 92 | { |
93 | - if( $postType != Application::POST_TYPE )return; |
|
93 | + if( $postType != Application::POST_TYPE ) { |
|
94 | + return; |
|
95 | + } |
|
94 | 96 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
95 | 97 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
96 | - if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return; |
|
98 | + if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) { |
|
99 | + return; |
|
100 | + } |
|
97 | 101 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
98 | 102 | } |
99 | 103 | |
@@ -129,7 +133,9 @@ discard block |
||
129 | 133 | */ |
130 | 134 | public function renderAssignedToMetabox( WP_Post $post ) |
131 | 135 | { |
132 | - if( !$this->isReviewPostType( $post ))return; |
|
136 | + if( !$this->isReviewPostType( $post )) { |
|
137 | + return; |
|
138 | + } |
|
133 | 139 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
134 | 140 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
135 | 141 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -144,7 +150,9 @@ discard block |
||
144 | 150 | */ |
145 | 151 | public function renderDetailsMetaBox( WP_Post $post ) |
146 | 152 | { |
147 | - if( !$this->isReviewPostType( $post ))return; |
|
153 | + if( !$this->isReviewPostType( $post )) { |
|
154 | + return; |
|
155 | + } |
|
148 | 156 | $review = glsr( ReviewManager::class )->single( $post ); |
149 | 157 | glsr()->render( 'partials/editor/metabox-details', [ |
150 | 158 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -158,7 +166,9 @@ discard block |
||
158 | 166 | */ |
159 | 167 | public function renderPinnedInPublishMetaBox() |
160 | 168 | { |
161 | - if( !$this->isReviewPostType( get_post() ))return; |
|
169 | + if( !$this->isReviewPostType( get_post() )) { |
|
170 | + return; |
|
171 | + } |
|
162 | 172 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
163 | 173 | 'context' => [ |
164 | 174 | 'no' => __( 'No', 'site-reviews' ), |
@@ -174,7 +184,9 @@ discard block |
||
174 | 184 | */ |
175 | 185 | public function renderResponseMetaBox( WP_Post $post ) |
176 | 186 | { |
177 | - if( !$this->isReviewPostType( $post ))return; |
|
187 | + if( !$this->isReviewPostType( $post )) { |
|
188 | + return; |
|
189 | + } |
|
178 | 190 | wp_nonce_field( 'response', '_nonce-response', false ); |
179 | 191 | glsr()->render( 'partials/editor/metabox-response', [ |
180 | 192 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -187,7 +199,9 @@ discard block |
||
187 | 199 | */ |
188 | 200 | public function renderReviewEditor( WP_Post $post ) |
189 | 201 | { |
190 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
202 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
203 | + return; |
|
204 | + } |
|
191 | 205 | glsr()->render( 'partials/editor/review', [ |
192 | 206 | 'post' => $post, |
193 | 207 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -201,7 +215,9 @@ discard block |
||
201 | 215 | public function renderReviewFields() |
202 | 216 | { |
203 | 217 | $screen = glsr_current_screen(); |
204 | - if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return; |
|
218 | + if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) { |
|
219 | + return; |
|
220 | + } |
|
205 | 221 | add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] ); |
206 | 222 | add_action( 'edit_form_top', [$this, 'renderReviewNotice'] ); |
207 | 223 | } |
@@ -212,7 +228,9 @@ discard block |
||
212 | 228 | */ |
213 | 229 | public function renderReviewNotice( WP_Post $post ) |
214 | 230 | { |
215 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
231 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
232 | + return; |
|
233 | + } |
|
216 | 234 | glsr( Notice::class )->addWarning( sprintf( |
217 | 235 | __( '%s reviews are read-only.', 'site-reviews' ), |
218 | 236 | glsr( Columns::class )->buildColumnReviewType( $post->ID ) |
@@ -231,7 +249,9 @@ discard block |
||
231 | 249 | */ |
232 | 250 | public function renderTaxonomyMetabox( WP_Post $post ) |
233 | 251 | { |
234 | - if( !$this->isReviewPostType( $post ))return; |
|
252 | + if( !$this->isReviewPostType( $post )) { |
|
253 | + return; |
|
254 | + } |
|
235 | 255 | glsr()->render( 'partials/editor/metabox-categories', [ |
236 | 256 | 'post' => $post, |
237 | 257 | 'tax_name' => Application::TAXONOMY, |
@@ -269,7 +289,9 @@ discard block |
||
269 | 289 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
270 | 290 | { |
271 | 291 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
272 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
292 | + if( !( $assignedPost instanceof WP_Post )) { |
|
293 | + return; |
|
294 | + } |
|
273 | 295 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
274 | 296 | 'context' => [ |
275 | 297 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -314,7 +336,9 @@ discard block |
||
314 | 336 | */ |
315 | 337 | protected function getReviewType( $review ) |
316 | 338 | { |
317 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
339 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
340 | + return; |
|
341 | + } |
|
318 | 342 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
319 | 343 | ? glsr()->reviewTypes[$review->review_type] |
320 | 344 | : __( 'Unknown', 'site-reviews' ); |
@@ -35,7 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | public function renderTaxonomyFilter() |
37 | 37 | { |
38 | - if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return; |
|
38 | + if( !is_object_in_taxonomy( glsr_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, |
@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | $termId = intval( $termId ); |
116 | 116 | } |
117 | 117 | $term = term_exists( $termId, Application::TAXONOMY ); |
118 | - if( !isset( $term['term_id'] ))continue; |
|
118 | + if( !isset( $term['term_id'] )) { |
|
119 | + continue; |
|
120 | + } |
|
119 | 121 | $terms[] = intval( $term['term_id'] ); |
120 | 122 | } |
121 | 123 | return $terms; |
@@ -127,7 +129,9 @@ discard block |
||
127 | 129 | */ |
128 | 130 | public function revert( $postId ) |
129 | 131 | { |
130 | - if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return; |
|
132 | + if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) { |
|
133 | + return; |
|
134 | + } |
|
131 | 135 | delete_post_meta( $postId, '_edit_last' ); |
132 | 136 | $result = wp_update_post([ |
133 | 137 | 'ID' => $postId, |
@@ -145,7 +149,9 @@ discard block |
||
145 | 149 | */ |
146 | 150 | public function single( WP_Post $post ) |
147 | 151 | { |
148 | - if( $post->post_type != Application::POST_TYPE )return; |
|
152 | + if( $post->post_type != Application::POST_TYPE ) { |
|
153 | + return; |
|
154 | + } |
|
149 | 155 | $review = new Review( $post ); |
150 | 156 | return apply_filters( 'site-reviews/get/review', $review, $post ); |
151 | 157 | } |
@@ -170,7 +176,9 @@ discard block |
||
170 | 176 | protected function setTerms( $postId, $termIds ) |
171 | 177 | { |
172 | 178 | $terms = $this->normalizeTerms( $termIds ); |
173 | - if( empty( $terms ))return; |
|
179 | + if( empty( $terms )) { |
|
180 | + return; |
|
181 | + } |
|
174 | 182 | $result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY ); |
175 | 183 | if( is_wp_error( $result )) { |
176 | 184 | glsr_log()->error( $result->get_error_message() ); |