@@ -3,7 +3,9 @@ |
||
3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
4 | 4 | |
5 | 5 | require_once __DIR__.'/site-reviews.php'; |
6 | -if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return; |
|
6 | +if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) { |
|
7 | + return; |
|
8 | +} |
|
7 | 9 | |
8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -53,7 +53,9 @@ |
||
53 | 53 | protected function normalize( array $settings ) |
54 | 54 | { |
55 | 55 | array_walk( $settings, function( &$setting ) { |
56 | - if( isset( $setting['default'] ))return; |
|
56 | + if( isset( $setting['default'] )) { |
|
57 | + return; |
|
58 | + } |
|
57 | 59 | $setting['default'] = ''; |
58 | 60 | }); |
59 | 61 | return $settings; |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | $options = $this->all(); |
43 | 43 | $pointer = &$options; |
44 | 44 | foreach( $keys as $key ) { |
45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | $pointer = &$pointer[$key]; |
47 | 49 | } |
48 | 50 | unset( $pointer[$last] ); |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | glsr( DefaultsManager::class )->defaults() |
78 | 80 | ); |
79 | 81 | array_walk( $options, function( &$value ) { |
80 | - if( !is_string( $value ))return; |
|
82 | + if( !is_string( $value )) { |
|
83 | + return; |
|
84 | + } |
|
81 | 85 | $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
82 | 86 | }); |
83 | 87 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
@@ -53,7 +53,9 @@ |
||
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | 54 | $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] )) { |
|
57 | + continue; |
|
58 | + } |
|
57 | 59 | $data[$key] = []; |
58 | 60 | } |
59 | 61 | return $data; |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | { |
55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
57 | + if( !array_key_exists( $key, $columns ) || !empty( $value )) { |
|
58 | + continue; |
|
59 | + } |
|
58 | 60 | $value = $columns[$key]; |
59 | 61 | } |
60 | 62 | if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) { |
@@ -92,7 +94,8 @@ discard block |
||
92 | 94 | * @return array |
93 | 95 | * @filter display_post_states |
94 | 96 | */ |
95 | - public function filterPostStates( array $postStates, WP_Post $post ) { |
|
97 | + public function filterPostStates( array $postStates, WP_Post $post ) |
|
98 | + { |
|
96 | 99 | if( $post->post_type == Application::POST_TYPE |
97 | 100 | && array_key_exists( 'pending', $postStates )) { |
98 | 101 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
@@ -137,7 +140,9 @@ discard block |
||
137 | 140 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
138 | 141 | unset( $postTypeColumns['cb'] ); |
139 | 142 | foreach( $postTypeColumns as $key => $value ) { |
140 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
143 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) { |
|
144 | + continue; |
|
145 | + } |
|
141 | 146 | $columns[$key] = $key; |
142 | 147 | } |
143 | 148 | return $columns; |
@@ -161,7 +166,9 @@ discard block |
||
161 | 166 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
162 | 167 | ]; |
163 | 168 | foreach( $strings as $search => $replace ) { |
164 | - if( strpos( $single, $search ) === false )continue; |
|
169 | + if( strpos( $single, $search ) === false ) { |
|
170 | + continue; |
|
171 | + } |
|
165 | 172 | $translation = $this->getTranslation([ |
166 | 173 | 'number' => $number, |
167 | 174 | 'plural' => str_replace( $search, $replace, $plural ), |
@@ -213,7 +220,9 @@ discard block |
||
213 | 220 | */ |
214 | 221 | public function saveBulkEditFields( $postId ) |
215 | 222 | { |
216 | - if( !current_user_can( 'edit_posts' ))return; |
|
223 | + if( !current_user_can( 'edit_posts' )) { |
|
224 | + return; |
|
225 | + } |
|
217 | 226 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
218 | 227 | if( $assignedTo && get_post( $assignedTo )) { |
219 | 228 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -226,7 +235,9 @@ discard block |
||
226 | 235 | */ |
227 | 236 | public function setQueryForColumn( WP_Query $query ) |
228 | 237 | { |
229 | - if( !$this->hasPermission( $query ))return; |
|
238 | + if( !$this->hasPermission( $query )) { |
|
239 | + return; |
|
240 | + } |
|
230 | 241 | $this->setMetaQuery( $query, [ |
231 | 242 | 'rating', 'review_type', |
232 | 243 | ]); |
@@ -297,7 +308,9 @@ discard block |
||
297 | 308 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
298 | 309 | { |
299 | 310 | foreach( $metaKeys as $key ) { |
300 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
311 | + if( !( $value = filter_input( INPUT_GET, $key ))) { |
|
312 | + continue; |
|
313 | + } |
|
301 | 314 | $metaQuery = (array)$query->get( 'meta_query' ); |
302 | 315 | $metaQuery[] = [ |
303 | 316 | 'key' => $key, |
@@ -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' ); |
@@ -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>', |
@@ -48,7 +48,9 @@ |
||
48 | 48 | */ |
49 | 49 | public function enqueueRecaptchaScript() |
50 | 50 | { |
51 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
51 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
52 | + return; |
|
53 | + } |
|
52 | 54 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
53 | 55 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
54 | 56 | 'hl' => $language, |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->reviews = glsr( Database::class )->getReviews( $args )->results; |
37 | - if( empty( $this->reviews ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( empty( $this->reviews ) && $this->isHidden( 'if_empty' )) { |
|
38 | + return; |
|
39 | + } |
|
38 | 40 | $this->rating = glsr( Rating::class )->getAverage( $this->reviews ); |
39 | 41 | $this->generateSchema(); |
40 | 42 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -54,7 +56,9 @@ discard block |
||
54 | 56 | */ |
55 | 57 | protected function buildPercentage() |
56 | 58 | { |
57 | - if( $this->isHidden( 'bars' ))return; |
|
59 | + if( $this->isHidden( 'bars' )) { |
|
60 | + return; |
|
61 | + } |
|
58 | 62 | $range = range( Rating::MAX_RATING, 1 ); |
59 | 63 | $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews )); |
60 | 64 | $bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) { |
@@ -104,7 +108,9 @@ discard block |
||
104 | 108 | */ |
105 | 109 | protected function buildRating() |
106 | 110 | { |
107 | - if( $this->isHidden( 'rating' ))return; |
|
111 | + if( $this->isHidden( 'rating' )) { |
|
112 | + return; |
|
113 | + } |
|
108 | 114 | return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' ); |
109 | 115 | } |
110 | 116 | |
@@ -113,7 +119,9 @@ discard block |
||
113 | 119 | */ |
114 | 120 | protected function buildStars() |
115 | 121 | { |
116 | - if( $this->isHidden( 'stars' ))return; |
|
122 | + if( $this->isHidden( 'stars' )) { |
|
123 | + return; |
|
124 | + } |
|
117 | 125 | $stars = glsr( Partial::class )->build( 'star-rating', [ |
118 | 126 | 'rating' => $this->rating, |
119 | 127 | ]); |
@@ -125,7 +133,9 @@ discard block |
||
125 | 133 | */ |
126 | 134 | protected function buildText() |
127 | 135 | { |
128 | - if( $this->isHidden( 'summary' ))return; |
|
136 | + if( $this->isHidden( 'summary' )) { |
|
137 | + return; |
|
138 | + } |
|
129 | 139 | $count = count( $this->reviews ); |
130 | 140 | if( empty( $this->args['text'] )) { |
131 | 141 | $this->args['text'] = _nx( |
@@ -146,7 +156,9 @@ discard block |
||
146 | 156 | */ |
147 | 157 | protected function generateSchema() |
148 | 158 | { |
149 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
159 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
160 | + return; |
|
161 | + } |
|
150 | 162 | glsr( Schema::class )->store( |
151 | 163 | glsr( Schema::class )->buildSummary( $this->args ) |
152 | 164 | ); |