@@ -25,7 +25,8 @@ |
||
25 | 25 | protected $router; |
26 | 26 | // protected $settings; |
27 | 27 | |
28 | - public function __construct( Application $app ) { |
|
28 | + public function __construct( Application $app ) |
|
29 | + { |
|
29 | 30 | $this->app = $app; |
30 | 31 | $this->admin = $app->make( AdminController::class ); |
31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | 'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ), |
43 | 43 | ]; |
44 | 44 | foreach( $replacements as $search => $replacement ) { |
45 | - if( $translation != $search )continue; |
|
45 | + if( $translation != $search ) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | $translation = $replacement; |
47 | 49 | } |
48 | 50 | } |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | public function filterUpdateMessages( array $messages ) |
56 | 58 | { |
57 | 59 | $post = get_post(); |
58 | - if( !( $post instanceof WP_Post ))return; |
|
60 | + if( !( $post instanceof WP_Post )) { |
|
61 | + return; |
|
62 | + } |
|
59 | 63 | $strings = $this->getReviewLabels(); |
60 | 64 | $restored = filter_input( INPUT_GET, 'revision' ); |
61 | 65 | if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) { |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function onCreateReview( $postData, $meta, $postId ) |
24 | 24 | { |
25 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
25 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | $this->updateAssignedToPost( $review ); |
27 | 29 | } |
28 | 30 | |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | */ |
33 | 35 | public function onDeleteReview( $postId ) |
34 | 36 | { |
35 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
37 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
38 | + return; |
|
39 | + } |
|
36 | 40 | $review->post_status = 'deleted'; // important to change the post_status here first! |
37 | 41 | $this->updateAssignedToPost( $review ); |
38 | 42 | } |
@@ -52,7 +56,9 @@ discard block |
||
52 | 56 | */ |
53 | 57 | public function saveAssignedToMetabox( $postId ) |
54 | 58 | { |
55 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
59 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) { |
|
60 | + return; |
|
61 | + } |
|
56 | 62 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
57 | 63 | $assignedTo || $assignedTo = ''; |
58 | 64 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -67,7 +73,9 @@ discard block |
||
67 | 73 | */ |
68 | 74 | public function saveResponseMetabox( $postId ) |
69 | 75 | { |
70 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
76 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) { |
|
77 | + return; |
|
78 | + } |
|
71 | 79 | $response = filter_input( INPUT_POST, 'response' ); |
72 | 80 | $response || $response = ''; |
73 | 81 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
@@ -120,9 +128,13 @@ discard block |
||
120 | 128 | */ |
121 | 129 | protected function updateAssignedToPost( WP_Post $review ) |
122 | 130 | { |
123 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
131 | + if( !( $postId = $this->getAssignedToPostId( $review->ID ))) { |
|
132 | + return; |
|
133 | + } |
|
124 | 134 | $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
125 | - if( empty( $reviewIds ))return; |
|
135 | + if( empty( $reviewIds )) { |
|
136 | + return; |
|
137 | + } |
|
126 | 138 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |
127 | 139 | $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
128 | 140 | if( empty( $updatedReviewIds )) { |
@@ -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 ), |