@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php defined( 'WPINC' ) || die; |
2 | 2 | |
3 | -include trailingslashit(__DIR__).'header.php'; |
|
4 | -include trailingslashit(__DIR__).'body.php'; |
|
5 | -include trailingslashit(__DIR__).'footer.php'; |
|
3 | +include trailingslashit( __DIR__ ).'header.php'; |
|
4 | +include trailingslashit( __DIR__ ).'body.php'; |
|
5 | +include trailingslashit( __DIR__ ).'footer.php'; |
@@ -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; |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | public function defaults() |
14 | 14 | { |
15 | 15 | $settings = $this->settings(); |
16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
17 | 17 | return wp_parse_args( $defaults, [ |
18 | 18 | 'version' => '', |
19 | 19 | 'version_upgraded_from' => '', |
20 | - ]); |
|
20 | + ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function settings() |
48 | 48 | { |
49 | - $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' )); |
|
49 | + $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) ); |
|
50 | 50 | return $this->normalize( $settings ); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | protected function normalize( array $settings ) |
57 | 57 | { |
58 | 58 | array_walk( $settings, function( &$setting ) { |
59 | - if( isset( $setting['default'] ))return; |
|
59 | + if( isset($setting['default']) )return; |
|
60 | 60 | $setting['default'] = ''; |
61 | 61 | }); |
62 | 62 | 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 ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function all() |
30 | 30 | { |
31 | - if( empty( $this->options )) { |
|
31 | + if( empty($this->options) ) { |
|
32 | 32 | $this->reset(); |
33 | 33 | } |
34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $options = $this->all(); |
46 | 46 | $pointer = &$options; |
47 | 47 | foreach( $keys as $key ) { |
48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
49 | 49 | $pointer = &$pointer[$key]; |
50 | 50 | } |
51 | - unset( $pointer[$last] ); |
|
51 | + unset($pointer[$last]); |
|
52 | 52 | return $this->set( $options ); |
53 | 53 | } |
54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | glsr( DefaultsManager::class )->defaults() |
81 | 81 | ); |
82 | 82 | array_walk( $options, function( &$value ) { |
83 | - if( !is_string( $value ))return; |
|
84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
83 | + if( !is_string( $value ) )return; |
|
84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
85 | 85 | }); |
86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function isRecaptchaEnabled() |
93 | 93 | { |
94 | 94 | $integration = $this->get( 'settings.submissions.recaptcha.integration' ); |
95 | - return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() ); |
|
95 | + return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function reset() |
102 | 102 | { |
103 | 103 | $options = get_option( static::databaseKey(), [] ); |
104 | - if( !is_array( $options ) || empty( $options )) { |
|
104 | + if( !is_array( $options ) || empty($options) ) { |
|
105 | 105 | delete_option( static::databaseKey() ); |
106 | 106 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
107 | 107 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function set( $pathOrOptions, $value = '' ) |
117 | 117 | { |
118 | - if( is_string( $pathOrOptions )) { |
|
118 | + if( is_string( $pathOrOptions ) ) { |
|
119 | 119 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
120 | 120 | } |
121 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
121 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
122 | 122 | $this->reset(); |
123 | 123 | } |
124 | 124 | return $result; |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - $postId = wp_update_post([ |
|
15 | + $postId = wp_update_post( [ |
|
16 | 16 | 'ID' => $command->id, |
17 | 17 | 'post_status' => $command->status, |
18 | - ]); |
|
19 | - if( is_wp_error( $postId )) { |
|
18 | + ] ); |
|
19 | + if( is_wp_error( $postId ) ) { |
|
20 | 20 | glsr_log()->error( $postId->get_error_message() ); |
21 | 21 | return []; |
22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
38 | 38 | 'class' => 'row-title', |
39 | 39 | 'href' => get_edit_post_link( $postId ), |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | protected function getPostState( $postId ) |
48 | 48 | { |
49 | 49 | ob_start(); |
50 | - _post_states( get_post( $postId )); |
|
50 | + _post_states( get_post( $postId ) ); |
|
51 | 51 | return ob_get_clean(); |
52 | 52 | } |
53 | 53 | } |
@@ -51,9 +51,9 @@ |
||
51 | 51 | protected function normalize( array $data ) |
52 | 52 | { |
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | - $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
|
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] ) )continue; |
|
57 | 57 | $data[$key] = []; |
58 | 58 | } |
59 | 59 | return $data; |
@@ -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; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | $this->builder->args = wp_parse_args( $this->builder->args, [ |
15 | 15 | 'name' => $this->builder->args['text'], |
16 | - ]); |
|
16 | + ] ); |
|
17 | 17 | $this->builder->tag = 'input'; |
18 | 18 | $this->mergeFieldArgs(); |
19 | 19 | return $this->builder->getOpeningTag(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | glsr()->version, |
45 | 45 | true |
46 | 46 | ); |
47 | - if( !empty( $this->pointers )) { |
|
47 | + if( !empty($this->pointers) ) { |
|
48 | 48 | wp_enqueue_style( 'wp-pointer' ); |
49 | 49 | wp_enqueue_script( 'wp-pointer' ); |
50 | 50 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] ); |
85 | 85 | $dependencies = array_merge( $dependencies, [ |
86 | 86 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | return $dependencies; |
89 | 89 | } |
90 | 90 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $generatedPointers = []; |
115 | 115 | foreach( $pointers as $pointer ) { |
116 | 116 | if( $pointer['screen'] != glsr_current_screen()->id )continue; |
117 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
117 | + if( in_array( $pointer['id'], $dismissedPointers ) )continue; |
|
118 | 118 | $generatedPointers[] = $this->generatePointer( $pointer ); |
119 | 119 | } |
120 | 120 | $this->pointers = $generatedPointers; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | protected function isCurrentScreen() |
127 | 127 | { |
128 | 128 | $screen = glsr_current_screen(); |
129 | - return $screen && ( $screen->post_type == Application::POST_TYPE |
|
129 | + return $screen && ($screen->post_type == Application::POST_TYPE |
|
130 | 130 | || $screen->base == 'post' |
131 | 131 | || $screen->id == 'dashboard' |
132 | 132 | || $screen->id == 'widgets' |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $variables = []; |
142 | 142 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
143 | - if( empty( $args['required'] ))continue; |
|
143 | + if( empty($args['required']) )continue; |
|
144 | 144 | $variables[$tag] = $args['required']; |
145 | 145 | } |
146 | 146 | return $variables; |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | [], |
37 | 37 | glsr()->version |
38 | 38 | ); |
39 | - if( !$this->isCurrentScreen() )return; |
|
39 | + if( !$this->isCurrentScreen() ) { |
|
40 | + return; |
|
41 | + } |
|
40 | 42 | wp_enqueue_script( |
41 | 43 | Application::ID, |
42 | 44 | glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
@@ -113,8 +115,12 @@ discard block |
||
113 | 115 | $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
114 | 116 | $generatedPointers = []; |
115 | 117 | foreach( $pointers as $pointer ) { |
116 | - if( $pointer['screen'] != glsr_current_screen()->id )continue; |
|
117 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
118 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
119 | + continue; |
|
120 | + } |
|
121 | + if( in_array( $pointer['id'], $dismissedPointers )) { |
|
122 | + continue; |
|
123 | + } |
|
118 | 124 | $generatedPointers[] = $this->generatePointer( $pointer ); |
119 | 125 | } |
120 | 126 | $this->pointers = $generatedPointers; |
@@ -140,7 +146,9 @@ discard block |
||
140 | 146 | { |
141 | 147 | $variables = []; |
142 | 148 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
143 | - if( empty( $args['required'] ))continue; |
|
149 | + if( empty( $args['required'] )) { |
|
150 | + continue; |
|
151 | + } |
|
144 | 152 | $variables[$tag] = $args['required']; |
145 | 153 | } |
146 | 154 | return $variables; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | defined( 'WPINC' ) || die; |
4 | 4 | |
5 | -require_once( ABSPATH.WPINC.'/class-phpass.php' ); |
|
5 | +require_once(ABSPATH.WPINC.'/class-phpass.php'); |
|
6 | 6 | |
7 | 7 | spl_autoload_register( function( $className ) { |
8 | 8 | $namespaces = [ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | foreach( $namespaces as $prefix => $baseDir ) { |
17 | 17 | $len = strlen( $prefix ); |
18 | 18 | if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
19 | - $file = $baseDir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
|
20 | - if( !file_exists( $file ))continue; |
|
19 | + $file = $baseDir.str_replace( '\\', '/', substr( $className, $len ) ).'.php'; |
|
20 | + if( !file_exists( $file ) )continue; |
|
21 | 21 | require $file; |
22 | 22 | break; |
23 | 23 | } |
@@ -15,9 +15,13 @@ |
||
15 | 15 | ]; |
16 | 16 | foreach( $namespaces as $prefix => $baseDir ) { |
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 = $baseDir.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 | } |
@@ -50,7 +50,9 @@ |
||
50 | 50 | public function routerSubmitReview( array $request ) |
51 | 51 | { |
52 | 52 | $validated = glsr( ValidateReview::class )->validate( $request ); |
53 | - if( !empty( $validated->error ) || $validated->recaptchaIsUnset )return; |
|
53 | + if( !empty( $validated->error ) || $validated->recaptchaIsUnset ) { |
|
54 | + return; |
|
55 | + } |
|
54 | 56 | $this->execute( new CreateReview( $validated->request )); |
55 | 57 | } |
56 | 58 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | public function filterEnqueuedScripts( $tag, $handle ) |
33 | 33 | { |
34 | 34 | $scripts = [Application::ID.'/google-recaptcha']; |
35 | - if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) { |
|
35 | + if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) { |
|
36 | 36 | $tag = str_replace( ' src=', ' async src=', $tag ); |
37 | 37 | } |
38 | - if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) { |
|
38 | + if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) { |
|
39 | 39 | $tag = str_replace( ' src=', ' defer src=', $tag ); |
40 | 40 | } |
41 | 41 | return $tag; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function filterFieldOrder( array $config ) |
50 | 50 | { |
51 | - $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config )); |
|
51 | + $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) ); |
|
52 | 52 | return array_intersect_key( array_merge( array_flip( $order ), $config ), $config ); |
53 | 53 | } |
54 | 54 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function routerSubmitReview( array $request ) |
97 | 97 | { |
98 | 98 | $validated = glsr( ValidateReview::class )->validate( $request ); |
99 | - if( !empty( $validated->error ) || $validated->recaptchaIsUnset )return; |
|
100 | - $this->execute( new CreateReview( $validated->request )); |
|
99 | + if( !empty($validated->error) || $validated->recaptchaIsUnset )return; |
|
100 | + $this->execute( new CreateReview( $validated->request ) ); |
|
101 | 101 | } |
102 | 102 | } |