@@ -15,9 +15,13 @@ |
||
15 | 15 | ]; |
16 | 16 | foreach( $namespaces as $prefix => $base_dir ) { |
17 | 17 | $len = strlen( $prefix ); |
18 | - if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
|
18 | + if( strncmp( $prefix, $className, $len ) !== 0 ) { |
|
19 | + continue; |
|
20 | + } |
|
19 | 21 | $file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
20 | - if( !file_exists( $file ))continue; |
|
22 | + if( !file_exists( $file )) { |
|
23 | + continue; |
|
24 | + } |
|
21 | 25 | require $file; |
22 | 26 | break; |
23 | 27 | } |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if( !class_exists( 'GL_Plugin_Check_v1' )) { |
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return; |
|
24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ))) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | |
26 | 28 | require_once __DIR__.'/autoload.php'; |
27 | 29 | require_once __DIR__.'/helpers.php'; |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | [], |
28 | 28 | glsr()->version |
29 | 29 | ); |
30 | - if( !$this->isCurrentScreen() )return; |
|
30 | + if( !$this->isCurrentScreen() ) { |
|
31 | + return; |
|
32 | + } |
|
31 | 33 | wp_enqueue_script( |
32 | 34 | Application::ID, |
33 | 35 | glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | { |
87 | 89 | $variables = []; |
88 | 90 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
89 | - if( empty( $args['required'] ))continue; |
|
91 | + if( empty( $args['required'] )) { |
|
92 | + continue; |
|
93 | + } |
|
90 | 94 | $variables[$tag] = $args['required']; |
91 | 95 | } |
92 | 96 | return $variables; |
@@ -11,7 +11,9 @@ |
||
11 | 11 | */ |
12 | 12 | public function handle( Command $command ) |
13 | 13 | { |
14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ))) { |
|
15 | + return; |
|
16 | + } |
|
15 | 17 | register_post_type( $command->postType, $command->args ); |
16 | 18 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
17 | 19 | $command->postType => $command->columns, |
@@ -57,7 +57,9 @@ |
||
57 | 57 | global $wp_query; |
58 | 58 | if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ) |
59 | 59 | || apply_filters( 'site-reviews/disable/filter/category', false ) |
60 | - )return; |
|
60 | + ) { |
|
61 | + return; |
|
62 | + } |
|
61 | 63 | printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' )); |
62 | 64 | $selected = isset( $wp_query->query[Application::TAXONOMY] ) |
63 | 65 | ? $wp_query->query[Application::TAXONOMY] |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | wp_localize_script( Application::ID, 'site_reviews_pointers', [ |
18 | 18 | 'pointers' => $pointers, |
19 | 19 | ]); |
20 | - if( empty( $pointers ))return; |
|
20 | + if( empty( $pointers )) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | wp_enqueue_style( 'wp-pointer' ); |
22 | 24 | wp_enqueue_script( 'wp-pointer' ); |
23 | 25 | } |
@@ -31,8 +33,12 @@ discard block |
||
31 | 33 | $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
32 | 34 | $generatedPointers = []; |
33 | 35 | foreach( $pointers as $pointer ) { |
34 | - if( $pointer['screen'] != glsr_current_screen()->id )continue; |
|
35 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
36 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
37 | + continue; |
|
38 | + } |
|
39 | + if( in_array( $pointer['id'], $dismissedPointers )) { |
|
40 | + continue; |
|
41 | + } |
|
36 | 42 | $generatedPointers[] = $this->generatePointer( $pointer ); |
37 | 43 | } |
38 | 44 | return $generatedPointers; |
@@ -19,7 +19,9 @@ |
||
19 | 19 | */ |
20 | 20 | public function registerPostType() |
21 | 21 | { |
22 | - if( !glsr()->hasPermission() )return; |
|
22 | + if( !glsr()->hasPermission() ) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | $command = new RegisterPostType([ |
24 | 26 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
25 | 27 | 'columns' => [ |
@@ -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 ) { |
@@ -111,7 +113,9 @@ discard block |
||
111 | 113 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
112 | 114 | unset( $postTypeColumns['cb'] ); |
113 | 115 | foreach( $postTypeColumns as $key => $value ) { |
114 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
116 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) { |
|
117 | + continue; |
|
118 | + } |
|
115 | 119 | $columns[$key] = $key; |
116 | 120 | } |
117 | 121 | return $columns; |
@@ -135,7 +139,9 @@ discard block |
||
135 | 139 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
136 | 140 | ]; |
137 | 141 | foreach( $strings as $search => $replace ) { |
138 | - if( strpos( $single, $search ) === false )continue; |
|
142 | + if( strpos( $single, $search ) === false ) { |
|
143 | + continue; |
|
144 | + } |
|
139 | 145 | $translation = $this->getTranslation([ |
140 | 146 | 'number' => $number, |
141 | 147 | 'plural' => str_replace( $search, $replace, $plural ), |
@@ -166,7 +172,9 @@ discard block |
||
166 | 172 | */ |
167 | 173 | public function renderColumnFilters( $post_type ) |
168 | 174 | { |
169 | - if( $post_type !== Application::POST_TYPE )return; |
|
175 | + if( $post_type !== Application::POST_TYPE ) { |
|
176 | + return; |
|
177 | + } |
|
170 | 178 | if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
171 | 179 | $status = 'publish'; |
172 | 180 | } |
@@ -183,7 +191,9 @@ discard block |
||
183 | 191 | */ |
184 | 192 | public function renderColumnValues( $column, $postId ) |
185 | 193 | { |
186 | - if( glsr_current_screen()->id != Application::POST_TYPE )return; |
|
194 | + if( glsr_current_screen()->id != Application::POST_TYPE ) { |
|
195 | + return; |
|
196 | + } |
|
187 | 197 | global $wp_version; |
188 | 198 | $method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' ); |
189 | 199 | echo method_exists( $this, $method ) |
@@ -198,7 +208,9 @@ discard block |
||
198 | 208 | */ |
199 | 209 | public function saveBulkEditFields( $postId ) |
200 | 210 | { |
201 | - if( !current_user_can( 'edit_posts' ))return; |
|
211 | + if( !current_user_can( 'edit_posts' )) { |
|
212 | + return; |
|
213 | + } |
|
202 | 214 | if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo )) { |
203 | 215 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
204 | 216 | } |
@@ -210,7 +222,9 @@ discard block |
||
210 | 222 | */ |
211 | 223 | public function setQueryForColumn( WP_Query $query ) |
212 | 224 | { |
213 | - if( !$this->hasPermission( $query ))return; |
|
225 | + if( !$this->hasPermission( $query )) { |
|
226 | + return; |
|
227 | + } |
|
214 | 228 | $this->setMetaQuery( $query, [ |
215 | 229 | 'rating', 'review_type', |
216 | 230 | ]); |
@@ -345,7 +359,9 @@ discard block |
||
345 | 359 | { |
346 | 360 | if( empty( $ratings ) |
347 | 361 | || apply_filters( 'site-reviews/disable/filter/ratings', false ) |
348 | - )return; |
|
362 | + ) { |
|
363 | + return; |
|
364 | + } |
|
349 | 365 | $ratings = array_flip( array_reverse( $ratings )); |
350 | 366 | array_walk( $ratings, function( &$value, $key ) { |
351 | 367 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
@@ -368,7 +384,9 @@ discard block |
||
368 | 384 | if( count( $types ) < 1 |
369 | 385 | || ( count( $types ) == 1 && $types[0] == 'local' ) |
370 | 386 | || apply_filters( 'site-reviews/disable/filter/types', false ) |
371 | - )return; |
|
387 | + ) { |
|
388 | + return; |
|
389 | + } |
|
372 | 390 | $reviewTypes = [__( 'All types', 'site-reviews' )]; |
373 | 391 | foreach( $types as $type ) { |
374 | 392 | $reviewTypes[$type] = glsr( Strings::class )->review_types( $type, ucfirst( $type )); |
@@ -386,7 +404,9 @@ discard block |
||
386 | 404 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
387 | 405 | { |
388 | 406 | foreach( $metaKeys as $key ) { |
389 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
407 | + if( !( $value = filter_input( INPUT_GET, $key ))) { |
|
408 | + continue; |
|
409 | + } |
|
390 | 410 | $metaQuery = (array)$query->get( 'meta_query' ); |
391 | 411 | $metaQuery[] = [ |
392 | 412 | 'key' => $key, |
@@ -109,7 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewEditable( $post ) )return; |
|
112 | + if( !$this->isReviewEditable( $post ) ) { |
|
113 | + return; |
|
114 | + } |
|
113 | 115 | glsr()->render( 'editor/review', [ |
114 | 116 | 'post' => $post, |
115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
121 | 123 | */ |
122 | 124 | public function renderReviewNotice( WP_Post $post ) |
123 | 125 | { |
124 | - if( !$this->isReviewEditable( $post ) )return; |
|
126 | + if( !$this->isReviewEditable( $post ) ) { |
|
127 | + return; |
|
128 | + } |
|
125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
126 | 130 | glsr()->render( 'editor/notice' ); |
127 | 131 | } |
@@ -132,13 +136,19 @@ discard block |
||
132 | 136 | */ |
133 | 137 | public function renderTinymceButton() |
134 | 138 | { |
135 | - if( glsr_current_screen()->base != 'post' )return; |
|
139 | + if( glsr_current_screen()->base != 'post' ) { |
|
140 | + return; |
|
141 | + } |
|
136 | 142 | $shortcodes = []; |
137 | 143 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
138 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
144 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
145 | + continue; |
|
146 | + } |
|
139 | 147 | $shortcodes[$shortcode] = $values; |
140 | 148 | } |
141 | - if( empty( $shortcodes ))return; |
|
149 | + if( empty( $shortcodes )) { |
|
150 | + return; |
|
151 | + } |
|
142 | 152 | glsr()->render( 'editor/tinymce', [ |
143 | 153 | 'shortcodes' => $shortcodes, |
144 | 154 | ]); |