@@ -118,7 +118,9 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function registerMetaBoxes( $postType ) |
120 | 120 | { |
121 | - if( $postType != Application::POST_TYPE )return; |
|
121 | + if( $postType != Application::POST_TYPE ) { |
|
122 | + return; |
|
123 | + } |
|
122 | 124 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
123 | 125 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
124 | 126 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -148,7 +150,9 @@ discard block |
||
148 | 150 | */ |
149 | 151 | public function renderAssignedToMetabox( WP_Post $post ) |
150 | 152 | { |
151 | - if( !$this->isReviewPostType( $post ))return; |
|
153 | + if( !$this->isReviewPostType( $post )) { |
|
154 | + return; |
|
155 | + } |
|
152 | 156 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
153 | 157 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
154 | 158 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -163,7 +167,9 @@ discard block |
||
163 | 167 | */ |
164 | 168 | public function renderDetailsMetaBox( WP_Post $post ) |
165 | 169 | { |
166 | - if( !$this->isReviewPostType( $post ))return; |
|
170 | + if( !$this->isReviewPostType( $post )) { |
|
171 | + return; |
|
172 | + } |
|
167 | 173 | $review = glsr( Database::class )->getReview( $post ); |
168 | 174 | glsr()->render( 'partials/editor/metabox-details', [ |
169 | 175 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -177,7 +183,9 @@ discard block |
||
177 | 183 | */ |
178 | 184 | public function renderPinnedInPublishMetaBox() |
179 | 185 | { |
180 | - if( !$this->isReviewPostType( get_post() ))return; |
|
186 | + if( !$this->isReviewPostType( get_post() )) { |
|
187 | + return; |
|
188 | + } |
|
181 | 189 | glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [ |
182 | 190 | 'context' => [ |
183 | 191 | 'no' => __( 'No', 'site-reviews' ), |
@@ -193,7 +201,9 @@ discard block |
||
193 | 201 | */ |
194 | 202 | public function renderResponseMetaBox( WP_Post $post ) |
195 | 203 | { |
196 | - if( !$this->isReviewPostType( $post ))return; |
|
204 | + if( !$this->isReviewPostType( $post )) { |
|
205 | + return; |
|
206 | + } |
|
197 | 207 | wp_nonce_field( 'response', '_nonce-response', false ); |
198 | 208 | glsr()->render( 'partials/editor/metabox-response', [ |
199 | 209 | 'response' => glsr( Database::class )->getReview( $post )->response, |
@@ -207,7 +217,9 @@ discard block |
||
207 | 217 | */ |
208 | 218 | public function renderTaxonomyMetabox( WP_Post $post ) |
209 | 219 | { |
210 | - if( !$this->isReviewPostType( $post ))return; |
|
220 | + if( !$this->isReviewPostType( $post )) { |
|
221 | + return; |
|
222 | + } |
|
211 | 223 | glsr()->render( 'partials/editor/metabox-categories', [ |
212 | 224 | 'post' => $post, |
213 | 225 | 'tax_name' => Application::TAXONOMY, |
@@ -245,7 +257,9 @@ discard block |
||
245 | 257 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
246 | 258 | { |
247 | 259 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post, $assignedTo ); |
248 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
260 | + if( !( $assignedPost instanceof WP_Post )) { |
|
261 | + return; |
|
262 | + } |
|
249 | 263 | return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [ |
250 | 264 | 'context' => [ |
251 | 265 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -287,7 +301,9 @@ discard block |
||
287 | 301 | */ |
288 | 302 | protected function getReviewType( $review ) |
289 | 303 | { |
290 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
304 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
305 | + return; |
|
306 | + } |
|
291 | 307 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
292 | 308 | ? glsr()->reviewTypes[$review->review_type] |
293 | 309 | : __( 'Unknown', 'site-reviews' ); |
@@ -74,7 +74,9 @@ discard block |
||
74 | 74 | $generatedReview = []; |
75 | 75 | foreach( $review as $key => $value ) { |
76 | 76 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildReview' ); |
77 | - if( !method_exists( $this, $method ))continue; |
|
77 | + if( !method_exists( $this, $method )) { |
|
78 | + continue; |
|
79 | + } |
|
78 | 80 | $generatedReview[$key] = $this->$method( $key, $value ); |
79 | 81 | } |
80 | 82 | return (object)$generatedReview; |
@@ -89,9 +91,13 @@ discard block |
||
89 | 91 | { |
90 | 92 | if( !$this->isOptionEnabled( 'settings.reviews.assigned_links.enabled' ) |
91 | 93 | || empty( $value ) |
92 | - )return; |
|
94 | + ) { |
|
95 | + return; |
|
96 | + } |
|
93 | 97 | $post = get_post( intval( $value )); |
94 | - if( !( $post instanceof WP_Post ))return; |
|
98 | + if( !( $post instanceof WP_Post )) { |
|
99 | + return; |
|
100 | + } |
|
95 | 101 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
96 | 102 | 'href' => get_the_permalink( $post->ID ), |
97 | 103 | ]); |
@@ -106,7 +112,9 @@ discard block |
||
106 | 112 | */ |
107 | 113 | protected function buildReviewAuthor( $key, $value ) |
108 | 114 | { |
109 | - if( $this->isHidden( $key ))return; |
|
115 | + if( $this->isHidden( $key )) { |
|
116 | + return; |
|
117 | + } |
|
110 | 118 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
111 | 119 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
112 | 120 | : ''; |
@@ -120,7 +128,9 @@ discard block |
||
120 | 128 | */ |
121 | 129 | protected function buildReviewAvatar( $key, $value ) |
122 | 130 | { |
123 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
131 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' )) { |
|
132 | + return; |
|
133 | + } |
|
124 | 134 | return $this->wrap( $key, '<img src="'.$value.'" width="36">'); |
125 | 135 | } |
126 | 136 | |
@@ -132,7 +142,9 @@ discard block |
||
132 | 142 | protected function buildReviewContent( $key, $value ) |
133 | 143 | { |
134 | 144 | $text = $this->normalizeText( $value ); |
135 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
145 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
146 | + return; |
|
147 | + } |
|
136 | 148 | return $this->wrap( $key, $text ); |
137 | 149 | } |
138 | 150 | |
@@ -143,7 +155,9 @@ discard block |
||
143 | 155 | */ |
144 | 156 | protected function buildReviewDate( $key, $value ) |
145 | 157 | { |
146 | - if( $this->isHidden( $key ))return; |
|
158 | + if( $this->isHidden( $key )) { |
|
159 | + return; |
|
160 | + } |
|
147 | 161 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
148 | 162 | if( $dateFormat == 'relative' ) { |
149 | 163 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +178,9 @@ discard block |
||
164 | 178 | */ |
165 | 179 | protected function buildReviewRating( $key, $value ) |
166 | 180 | { |
167 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
181 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
182 | + return; |
|
183 | + } |
|
168 | 184 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
169 | 185 | 'rating' => $value, |
170 | 186 | ]); |
@@ -178,7 +194,9 @@ discard block |
||
178 | 194 | */ |
179 | 195 | protected function buildReviewResponse( $key, $value ) |
180 | 196 | { |
181 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
197 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
198 | + return; |
|
199 | + } |
|
182 | 200 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
183 | 201 | $text = $this->normalizeText( $value ); |
184 | 202 | return $this->wrap( $key, '<p><strong>'.$title.'</strong></p>'.$text ); |
@@ -191,7 +209,9 @@ discard block |
||
191 | 209 | */ |
192 | 210 | protected function buildReviewTitle( $key, $value ) |
193 | 211 | { |
194 | - if( $this->isHidden( $key ))return; |
|
212 | + if( $this->isHidden( $key )) { |
|
213 | + return; |
|
214 | + } |
|
195 | 215 | if( empty( $value )) { |
196 | 216 | $value = __( 'No Title', 'site-reviews' ); |
197 | 217 | } |
@@ -203,7 +223,9 @@ discard block |
||
203 | 223 | */ |
204 | 224 | protected function generateSchema() |
205 | 225 | { |
206 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
226 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
227 | + return; |
|
228 | + } |
|
207 | 229 | glsr( Schema::class )->store( glsr( Schema::class )->build( $this->args )); |
208 | 230 | } |
209 | 231 |
@@ -19,13 +19,17 @@ discard block |
||
19 | 19 | public function build( array $args = [] ) |
20 | 20 | { |
21 | 21 | $this->args = $this->normalize( $args ); |
22 | - if( $this->args['total'] < 2 )return; |
|
22 | + if( $this->args['total'] < 2 ) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | $links = $this->buildLinksForDeprecatedThemes(); |
24 | 26 | if( empty( $links )) { |
25 | 27 | $links = $this->buildLinks(); |
26 | 28 | } |
27 | 29 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
28 | - if( empty( $links ))return; |
|
30 | + if( empty( $links )) { |
|
31 | + return; |
|
32 | + } |
|
29 | 33 | return $this->buildTemplate( $links ); |
30 | 34 | } |
31 | 35 | |
@@ -55,7 +59,9 @@ discard block |
||
55 | 59 | protected function buildLinksForDeprecatedThemes() |
56 | 60 | { |
57 | 61 | $theme = wp_get_theme()->get( 'TextDomain' ); |
58 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
62 | + if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] )) { |
|
63 | + return; |
|
64 | + } |
|
59 | 65 | $links = ''; |
60 | 66 | if( $this->args['paged'] > 1 ) { |
61 | 67 | $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |