@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getDefaults() |
68 | 68 | { |
69 | - if( empty( $this->defaults )) { |
|
69 | + if( empty($this->defaults) ) { |
|
70 | 70 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
71 | 71 | $this->upgrade(); |
72 | 72 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function hasPermission() |
80 | 80 | { |
81 | 81 | $isAdmin = $this->isAdmin(); |
82 | - return !$isAdmin || ( $isAdmin && current_user_can( static::CAPABILITY )); |
|
82 | + return !$isAdmin || ($isAdmin && current_user_can( static::CAPABILITY )); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
135 | 135 | $this->reviewTypes = wp_parse_args( $types, [ |
136 | 136 | 'local' => __( 'Local', 'site-reviews' ), |
137 | - ]); |
|
137 | + ] ); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | public function render( $view, array $data = [] ) |
145 | 145 | { |
146 | 146 | $file = ''; |
147 | - if( glsr( Helper::class )->startsWith( $view, 'templates/' )) { |
|
147 | + if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) { |
|
148 | 148 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; |
149 | 149 | $file = get_stylesheet_directory().'/'.$file; |
150 | 150 | } |
151 | - if( !file_exists( $file )) { |
|
151 | + if( !file_exists( $file ) ) { |
|
152 | 152 | $file = $this->path( 'views/'.$view.'.php' ); |
153 | 153 | } |
154 | 154 | $file = apply_filters( 'site-reviews/views/file', $file, $view, $data ); |
155 | - if( !file_exists( $file )) { |
|
155 | + if( !file_exists( $file ) ) { |
|
156 | 156 | glsr_log()->error( 'File not found: '.$file ); |
157 | 157 | return; |
158 | 158 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function scheduleCronJob() |
168 | 168 | { |
169 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
169 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
170 | 170 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
171 | 171 | } |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function unscheduleCronJob() |
177 | 177 | { |
178 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
178 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -207,6 +207,6 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function url( $path = '' ) |
209 | 209 | { |
210 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
210 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
211 | 211 | } |
212 | 212 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | <p>{{ description }}</p> |
11 | 11 | </div> |
12 | 12 | <div class="glsr-addon-footer"> |
13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
17 | 17 | </span> |
18 | 18 | <?php else: ?> |
19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
21 | 21 | </a> |
22 | 22 | <?php endif; ?> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | <form method="post"> |
39 | 39 | <div class="tablenav bottom"> |
40 | 40 | <div class="actions"> |
41 | - <?php if( count( $sites ) > 1) : ?> |
|
41 | + <?php if( count( $sites ) > 1 ) : ?> |
|
42 | 42 | <label for="bulk-action-selector-bottom" class="screen-reader-text">Select a site to sync</label> |
43 | 43 | <select name="{{ id }}[site]"> |
44 | 44 | <option>- <?= __( 'Select a Site', 'site-reviews' ); ?> -</option> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | 'title' => 'Tripadvisor Reviews', |
14 | 14 | ], |
15 | 15 | 'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php', |
16 | - ]); |
|
16 | + ] ); |
|
17 | 17 | $template->render( 'partials/addons/addon', [ |
18 | 18 | 'context' => [ |
19 | 19 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | 'title' => 'Yelp Reviews', |
23 | 23 | ], |
24 | 24 | 'plugin' => 'site-reviews-yelp/site-reviews-yelp.php', |
25 | - ]); |
|
25 | + ] ); |
|
26 | 26 | ?> |
27 | 27 | </div> |
28 | 28 | </div> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'results' => $this->buildResults(), |
61 | 61 | 'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(), |
62 | 62 | ], |
63 | - ]); |
|
63 | + ] ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $integration = glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ); |
72 | 72 | $recaptchaMethod = glsr( Helper::class )->buildMethodName( $integration, 'getRecaptcha' ); |
73 | - if( method_exists( $this, $recaptchaMethod )) { |
|
73 | + if( method_exists( $this, $recaptchaMethod ) ) { |
|
74 | 74 | return $this->$recaptchaMethod(); |
75 | 75 | } |
76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return glsr( Partial::class )->build( 'form-results', [ |
84 | 84 | 'errors' => $this->errors, |
85 | 85 | 'message' => $this->message, |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'context' => [ |
96 | 96 | 'text' => __( 'Submit your review', 'site-reviews' ), |
97 | 97 | ], |
98 | - ]); |
|
98 | + ] ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $fields = array_merge( |
116 | 116 | $this->getHiddenFields(), |
117 | 117 | [$this->getHoneypotField()], |
118 | - $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' )) |
|
118 | + $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) ) |
|
119 | 119 | ); |
120 | 120 | return $fields; |
121 | 121 | } |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | $fields = [[ |
129 | 129 | 'name' => 'action', |
130 | 130 | 'value' => 'submit-review', |
131 | - ],[ |
|
131 | + ], [ |
|
132 | 132 | 'name' => 'assign_to', |
133 | 133 | 'value' => $this->args['assign_to'], |
134 | - ],[ |
|
134 | + ], [ |
|
135 | 135 | 'name' => 'category', |
136 | 136 | 'value' => $this->args['category'], |
137 | - ],[ |
|
137 | + ], [ |
|
138 | 138 | 'name' => 'excluded', |
139 | 139 | 'value' => $this->args['excluded'], // @todo should default to "[]" |
140 | - ],[ |
|
140 | + ], [ |
|
141 | 141 | 'name' => 'form_id', |
142 | 142 | 'value' => $this->args['id'], |
143 | - ],[ |
|
143 | + ], [ |
|
144 | 144 | 'name' => 'nonce', |
145 | 145 | 'value' => wp_create_nonce( 'submit-review' ), |
146 | - ],[ |
|
146 | + ], [ |
|
147 | 147 | 'name' => 'referer', |
148 | - 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )), |
|
148 | + 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ), |
|
149 | 149 | ]]; |
150 | 150 | return array_map( function( $field ) { |
151 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
151 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
152 | 152 | }, $fields ); |
153 | 153 | } |
154 | 154 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function getHoneypotField() |
159 | 159 | { |
160 | - return new Field([ |
|
160 | + return new Field( [ |
|
161 | 161 | 'name' => 'gotcha', |
162 | 162 | 'type' => 'honeypot', |
163 | - ]); |
|
163 | + ] ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getRecaptchaCustom() |
170 | 170 | { |
171 | - return glsr( Builder::class )->div([ |
|
171 | + return glsr( Builder::class )->div( [ |
|
172 | 172 | 'class' => 'glsr-recaptcha-holder', |
173 | - 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' )), |
|
174 | - 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )), |
|
173 | + 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ) ), |
|
174 | + 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ), |
|
175 | 175 | 'data-size' => 'invisible', |
176 | - ]); |
|
176 | + ] ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $html = ob_get_clean(); |
187 | 187 | return glsr( Builder::class )->div( $html, [ |
188 | 188 | 'class' => 'glsr-recaptcha-holder', |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function normalizeFieldErrors( Field &$field ) |
196 | 196 | { |
197 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
197 | + if( !array_key_exists( $field->field['path'], $this->errors ) )return; |
|
198 | 198 | $field->field['errors'] = $this->errors[$field->field['path']]; |
199 | 199 | } |
200 | 200 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | protected function normalizeFieldRequired( Field &$field ) |
205 | 205 | { |
206 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
206 | + if( !in_array( $field->field['path'], $this->required ) )return; |
|
207 | 207 | $field->field['required'] = true; |
208 | 208 | } |
209 | 209 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function normalizeFieldValue( Field &$field ) |
227 | 227 | { |
228 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
229 | - if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
|
228 | + if( !array_key_exists( $field->field['path'], $this->values ) )return; |
|
229 | + if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) { |
|
230 | 230 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
231 | 231 | } |
232 | 232 | else { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __get( $key ) |
21 | 21 | { |
22 | - if( array_key_exists( $key, $this->values )) { |
|
22 | + if( array_key_exists( $key, $this->values ) ) { |
|
23 | 23 | return $this->values[$key]; |
24 | 24 | } |
25 | 25 | return ''; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -27,6 +27,6 @@ discard block |
||
27 | 27 | |
28 | 28 | $app = new GeminiLabs\SiteReviews\Application; |
29 | 29 | $app->make( 'Provider' )->register( $app ); |
30 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
31 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
30 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
31 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
32 | 32 | $app->init(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'is_valid' => true, |
27 | 27 | 'is_widget' => false, |
28 | 28 | 'path' => '', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | $this->normalize(); |
31 | 31 | } |
32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | if( !$this->field['is_valid'] )return; |
47 | 47 | if( $this->field['is_raw'] ) { |
48 | - return glsr( Builder::class )->{$this->field['type']}( $this->field ); |
|
48 | + return glsr( Builder::class )->{$this->field['type']}($this->field); |
|
49 | 49 | } |
50 | 50 | if( !$this->field['is_setting'] ) { |
51 | 51 | return $this->buildField(); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | 'context' => [ |
74 | 74 | 'class' => $this->getFieldClass(), |
75 | 75 | 'errors' => $this->getFieldErrors(), |
76 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
76 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
77 | 77 | ], |
78 | - ]); |
|
78 | + ] ); |
|
79 | 79 | return apply_filters( 'site-reviews/rendered/field', $field, $this->field['type'], $this->field ); |
80 | 80 | } |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | return glsr( Template::class )->build( 'partials/form/table-row', [ |
88 | 88 | 'context' => [ |
89 | 89 | 'class' => $this->getFieldClass(), |
90 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
90 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
91 | 91 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
92 | 92 | ], |
93 | - ]); |
|
93 | + ] ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | protected function buildSettingMultiField() |
100 | 100 | { |
101 | 101 | $dependsOn = $this->getFieldDependsOn(); |
102 | - unset( $this->field['data-depends'] ); |
|
102 | + unset($this->field['data-depends']); |
|
103 | 103 | return glsr( Template::class )->build( 'partials/form/table-row-multiple', [ |
104 | 104 | 'context' => [ |
105 | 105 | 'class' => $this->getFieldClass(), |
106 | 106 | 'depends_on' => $dependsOn, |
107 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
107 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
108 | 108 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
109 | 109 | 'legend' => $this->field['legend'], |
110 | 110 | ], |
111 | - ]); |
|
111 | + ] ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | protected function getFieldClass() |
118 | 118 | { |
119 | 119 | $classes = []; |
120 | - if( !empty( $this->field['errors'] )) { |
|
120 | + if( !empty($this->field['errors']) ) { |
|
121 | 121 | $classes[] = 'glsr-has-error'; |
122 | 122 | } |
123 | 123 | if( $this->field['is_hidden'] ) { |
124 | 124 | $classes[] = 'hidden'; |
125 | 125 | } |
126 | - if( !empty( $this->field['required'] )) { |
|
126 | + if( !empty($this->field['required']) ) { |
|
127 | 127 | $classes[] = 'glsr-required'; |
128 | 128 | } |
129 | 129 | return implode( ' ', $classes ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFieldDependsOn() |
136 | 136 | { |
137 | - return !empty( $this->field['data-depends'] ) |
|
137 | + return !empty($this->field['data-depends']) |
|
138 | 138 | ? $this->field['data-depends'] |
139 | 139 | : ''; |
140 | 140 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function getFieldErrors() |
146 | 146 | { |
147 | - if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return; |
|
147 | + if( empty($this->field['errors']) || !is_array( $this->field['errors'] ) )return; |
|
148 | 148 | $errors = array_reduce( $this->field['errors'], function( $carry, $error ) { |
149 | 149 | return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] ); |
150 | 150 | }); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'context' => [ |
153 | 153 | 'errors' => $errors, |
154 | 154 | ], |
155 | - ]); |
|
155 | + ] ); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'name', 'type', |
176 | 176 | ]; |
177 | 177 | foreach( $requiredValues as $value ) { |
178 | - if( isset( $this->field[$value] ))continue; |
|
178 | + if( isset($this->field[$value]) )continue; |
|
179 | 179 | $missingValues[] = $value; |
180 | 180 | $this->field['is_valid'] = false; |
181 | 181 | } |
182 | - if( !empty( $missingValues )) { |
|
182 | + if( !empty($missingValues) ) { |
|
183 | 183 | glsr_log() |
184 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
184 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
185 | 185 | ->info( $this->field ); |
186 | 186 | } |
187 | 187 | return $this->field['is_valid']; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if( !$this->isFieldValid() )return; |
196 | 196 | $this->field['path'] = $this->field['name']; |
197 | 197 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
198 | - if( class_exists( $className )) { |
|
198 | + if( class_exists( $className ) ) { |
|
199 | 199 | $this->field = array_merge( |
200 | 200 | wp_parse_args( $this->field, $className::defaults() ), |
201 | 201 | $className::required() |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function normalizeFieldId() |
212 | 212 | { |
213 | - if( isset( $this->field['id'] ) || $this->field['is_raw'] )return; |
|
213 | + if( isset($this->field['id']) || $this->field['is_raw'] )return; |
|
214 | 214 | $this->field['id'] = glsr( Helper::class )->convertPathToId( |
215 | 215 | $this->field['path'], |
216 | 216 | $this->getFieldPrefix() |