Passed
Push — master ( 914f5e...11621f )
by Paul
04:00
created
plugin/Shortcodes/TinymcePopupGenerator.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,9 +57,13 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty( $field )) {
61
+				return;
62
+			}
61 63
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
64
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
65
+				return;
66
+			}
63 67
 			return $this->$method( $field );
64 68
 		}, $fields );
65 69
 		return array_values( array_filter( $generatedFields ));
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 		if( !empty( $this->errors )) {
75 79
 			$errors = [];
76 80
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
81
+				if( false !== array_search( $name, array_column( $fields, 'name' ))) {
82
+					continue;
83
+				}
78 84
 				$errors[] = $this->errors[$name];
79 85
 			}
80 86
 			$this->errors = $errors;
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function normalizeContainer( array $field )
120 126
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
127
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
128
+			return;
129
+		}
122 130
 		$field['items'] = $this->generateFields( $field['items'] );
123 131
 		return $field;
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function normalizeField( array $field, array $defaults )
130 138
 	{
131
-		if( !$this->validate( $field ))return;
139
+		if( !$this->validate( $field )) {
140
+			return;
141
+		}
132 142
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 143
 			return $value !== '';
134 144
 		});
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 			'type' => '',
150 160
 			'value' => '',
151 161
 		]);
152
-		if( !is_array( $listbox ))return;
162
+		if( !is_array( $listbox )) {
163
+			return;
164
+		}
153 165
 		if( !array_key_exists( '', $listbox['options'] )) {
154 166
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 167
 		}
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	public function fields()
13 13
 	{
14 14
 		return [[
15
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
15
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
16 16
 			'minWidth' => 320,
17 17
 			'type' => 'container',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'name' => 'assigned_to',
29 29
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ),
30 30
 			'type' => 'textbox',
31
-		],[
31
+		], [
32 32
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
33 33
 			'name' => 'schema',
34 34
 			'options' => [
@@ -37,34 +37,34 @@  discard block
 block discarded – undo
37 37
 			],
38 38
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
39 39
 			'type' => 'listbox',
40
-		],[
40
+		], [
41 41
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
42 42
 			'name' => 'class',
43 43
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
44 44
 			'type' => 'textbox',
45
-		],[
45
+		], [
46 46
 			'columns' => 2,
47 47
 			'items' => [[
48 48
 				'type' => 'checkbox',
49 49
 				'name' => 'hide_bars',
50 50
 				'text' => esc_html__( 'Bars', 'site-reviews' ),
51 51
 				'tooltip' => __( 'Hide the percentage bars?', 'site-reviews' ),
52
-			],[
52
+			], [
53 53
 				'type' => 'checkbox',
54 54
 				'name' => 'hide_if_empty',
55 55
 				'text' => esc_html__( 'If Empty', 'site-reviews' ),
56 56
 				'tooltip' => __( 'Hide the summary if no reviews are found?', 'site-reviews' ),
57
-			],[
57
+			], [
58 58
 				'type' => 'checkbox',
59 59
 				'name' => 'hide_rating',
60 60
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
61 61
 				'tooltip' => __( 'Hide the rating?', 'site-reviews' ),
62
-			],[
62
+			], [
63 63
 				'type' => 'checkbox',
64 64
 				'name' => 'hide_stars',
65 65
 				'text' => esc_html__( 'Stars', 'site-reviews' ),
66 66
 				'tooltip' => __( 'Hide the stars?', 'site-reviews' ),
67
-			],[
67
+			], [
68 68
 				'type' => 'checkbox',
69 69
 				'name' => 'hide_summary',
70 70
 				'text' => esc_html__( 'Summary', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 2 patches
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -175,8 +175,12 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function validateAkismet()
177 177
 	{
178
-		if( !empty( $this->error ))return;
179
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
178
+		if( !empty( $this->error )) {
179
+			return;
180
+		}
181
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
182
+			return;
183
+		}
180 184
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
181 185
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
182 186
 	}
@@ -186,8 +190,12 @@  discard block
 block discarded – undo
186 190
 	 */
187 191
 	protected function validateBlacklist()
188 192
 	{
189
-		if( !empty( $this->error ))return;
190
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
193
+		if( !empty( $this->error )) {
194
+			return;
195
+		}
196
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
197
+			return;
198
+		}
191 199
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
192 200
 		if( $blacklistAction == 'reject' ) {
193 201
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -202,9 +210,13 @@  discard block
 block discarded – undo
202 210
 	 */
203 211
 	protected function validateCustom()
204 212
 	{
205
-		if( !empty( $this->error ))return;
213
+		if( !empty( $this->error )) {
214
+			return;
215
+		}
206 216
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
207
-		if( $validated === true )return;
217
+		if( $validated === true ) {
218
+			return;
219
+		}
208 220
 		$this->setSessionValues( 'errors', [] );
209 221
 		$this->setSessionValues( 'values', $this->request );
210 222
 		$this->error = is_string( $validated )
@@ -217,8 +229,12 @@  discard block
 block discarded – undo
217 229
 	 */
218 230
 	protected function validateHoneyPot()
219 231
 	{
220
-		if( !empty( $this->error ))return;
221
-		if( empty( $this->request['gotcha'] ))return;
232
+		if( !empty( $this->error )) {
233
+			return;
234
+		}
235
+		if( empty( $this->request['gotcha'] )) {
236
+			return;
237
+		}
222 238
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
223 239
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
224 240
 	}
@@ -228,9 +244,13 @@  discard block
 block discarded – undo
228 244
 	 */
229 245
 	protected function validateRecaptcha()
230 246
 	{
231
-		if( !empty( $this->error ))return;
247
+		if( !empty( $this->error )) {
248
+			return;
249
+		}
232 250
 		$status = $this->getRecaptchaStatus();
233
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
251
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] )) {
252
+			return;
253
+		}
234 254
 		if( $status == static::RECAPTCHA_EMPTY ) {
235 255
 			$this->setSessionValues( 'recaptcha', 'unset' );
236 256
 			$this->recaptchaIsUnset = true;
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->validateBlacklist();
68 68
 		$this->validateAkismet();
69 69
 		$this->validateRecaptcha();
70
-		if( !empty( $this->error )) {
70
+		if( !empty($this->error) ) {
71 71
 			$this->setSessionValues( 'message', $this->error );
72 72
 		}
73 73
 		return $this;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
92 92
 			return static::RECAPTCHA_DISABLED;
93 93
 		}
94
-		if( empty( $this->request['_recaptcha-token'] )) {
95
-			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ))
94
+		if( empty($this->request['_recaptcha-token']) ) {
95
+			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
96 96
 				? static::RECAPTCHA_EMPTY
97 97
 				: static::RECAPTCHA_FAILED;
98 98
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getRecaptchaTokenStatus()
106 106
 	{
107
-		$endpoint = add_query_arg([
107
+		$endpoint = add_query_arg( [
108 108
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
109 109
 			'response' => $this->request['_recaptcha-token'],
110 110
 			'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
111 111
 		], static::RECAPTCHA_ENDPOINT );
112
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
112
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
113 113
 			glsr_log()->error( $response->get_error_message() );
114 114
 			return static::RECAPTCHA_FAILED;
115 115
 		}
116
-		$response = json_decode( wp_remote_retrieve_body( $response ));
117
-		if( !empty( $response->success )) {
116
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
117
+		if( !empty($response->success) ) {
118 118
 			return boolval( $response->success )
119 119
 				? static::RECAPTCHA_VALID
120 120
 				: static::RECAPTCHA_INVALID;
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$rules = array_intersect_key(
134 134
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
135
-			array_flip( $this->getOption( 'settings.submissions.required', [] ))
135
+			array_flip( $this->getOption( 'settings.submissions.required', [] ) )
136 136
 		);
137
-		$excluded = isset( $request['excluded'] )
137
+		$excluded = isset($request['excluded'])
138 138
 			? explode( ',', $request['excluded'] )
139 139
 			: [];
140
-		return array_diff_key( $rules, array_flip( $excluded ));
140
+		return array_diff_key( $rules, array_flip( $excluded ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$rules = $this->getValidationRules( $request );
149 149
 		$errors = glsr( Validator::class )->validate( $request, $rules );
150
-		if( empty( $errors )) {
150
+		if( empty($errors) ) {
151 151
 			return true;
152 152
 		}
153 153
 		$this->setSessionValues( 'errors', $errors );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
165 165
 	{
166 166
 		glsr( Session::class )->set( $this->form_id.$type, $value );
167
-		if( !empty( $loggedMessage )) {
167
+		if( !empty($loggedMessage) ) {
168 168
 			glsr_log()->warning( $loggedMessage );
169 169
 			glsr_log()->warning( $this->request );
170 170
 		}
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function validateAkismet()
177 177
 	{
178
-		if( !empty( $this->error ))return;
179
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
178
+		if( !empty($this->error) )return;
179
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
180 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
181 181
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
182 182
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function validateBlacklist()
188 188
 	{
189
-		if( !empty( $this->error ))return;
190
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty($this->error) )return;
190
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
191 191
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
192 192
 		if( $blacklistAction == 'reject' ) {
193 193
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function validateCustom()
204 204
 	{
205
-		if( !empty( $this->error ))return;
205
+		if( !empty($this->error) )return;
206 206
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
207 207
 		if( $validated === true )return;
208 208
 		$this->setSessionValues( 'errors', [] );
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	protected function validateHoneyPot()
219 219
 	{
220
-		if( !empty( $this->error ))return;
221
-		if( empty( $this->request['gotcha'] ))return;
220
+		if( !empty($this->error) )return;
221
+		if( empty($this->request['gotcha']) )return;
222 222
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
223 223
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
224 224
 	}
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	protected function validateRecaptcha()
230 230
 	{
231
-		if( !empty( $this->error ))return;
231
+		if( !empty($this->error) )return;
232 232
 		$status = $this->getRecaptchaStatus();
233
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
233
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) )return;
234 234
 		if( $status == static::RECAPTCHA_EMPTY ) {
235 235
 			$this->setSessionValues( 'recaptcha', 'unset' );
236 236
 			$this->recaptchaIsUnset = true;
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	protected function validateRequest( array $request )
252 252
 	{
253
-		if( !$this->isRequestValid( $request )) {
253
+		if( !$this->isRequestValid( $request ) ) {
254 254
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
255 255
 			return $request;
256 256
 		}
257
-		if( empty( $request['title'] )) {
257
+		if( empty($request['title']) ) {
258 258
 			$request['title'] = __( 'No Title', 'site-reviews' );
259 259
 		}
260 260
 		return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request );
Please login to merge, or discard this patch.
plugin/Handlers/RegisterTinymcePopups.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
 	{
15 15
 		foreach( $command->popups as $slug => $label ) {
16 16
 			$buttonClass = glsr( Helper::class )->buildClassName( $slug.'-popup', 'Shortcodes' );
17
-			if( !class_exists( $buttonClass )) {
18
-				glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ));
17
+			if( !class_exists( $buttonClass ) ) {
18
+				glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) );
19 19
 				continue;
20 20
 			}
21 21
 			$shortcode = glsr( $buttonClass )->register( $slug, [
22 22
 				'label' => $label,
23 23
 				'title' => $label,
24
-			]);
24
+			] );
25 25
 			glsr()->mceShortcodes[$slug] = $shortcode->properties;
26 26
 		}
27 27
 	}
Please login to merge, or discard this patch.
plugin/Helper.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$className = $this->camelCase( $name );
18 18
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
19
-		return !empty( $path )
19
+		return !empty($path)
20 20
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
21 21
 			: $className;
22 22
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function buildMethodName( $name, $prefix = '' )
30 30
 	{
31
-		return lcfirst( $prefix.$this->buildClassName( $name ));
31
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function buildPropertyName( $name )
39 39
 	{
40
-		return lcfirst( $this->buildClassName( $name ));
40
+		return lcfirst( $this->buildClassName( $name ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function camelCase( $string )
48 48
 	{
49
-		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string )));
49
+		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
50 50
 		return str_replace( ' ', '', $string );
51 51
 	}
52 52
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function convertPathToId( $path, $prefix = '' )
80 80
 	{
81
-		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ));
81
+		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) );
82 82
 	}
83 83
 
84 84
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$levels = explode( '.', $path );
91 91
 		return array_reduce( $levels, function( $result, $value ) {
92
-			return $result.= '['.$value.']';
92
+			return $result .= '['.$value.']';
93 93
 		}, $prefix );
94 94
 	}
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function convertStringToArray( $string, $callback = null )
102 102
 	{
103
-		$array = array_map( 'trim', explode( ',', $string ));
103
+		$array = array_map( 'trim', explode( ',', $string ) );
104 104
 		return $callback
105 105
 			? array_filter( $array, $callback )
106 106
 			: array_filter( $array );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function dashCase( $string )
114 114
 	{
115
-		return str_replace( '_', '-', $this->snakeCase( $string ));
115
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function filterInput( $key, array $request = [] )
136 136
 	{
137
-		if( isset( $request[$key] )) {
137
+		if( isset($request[$key]) ) {
138 138
 			return $request[$key];
139 139
 		}
140 140
 		$variable = filter_input( INPUT_POST, $key );
141
-		if( is_null( $variable ) && isset( $_POST[$key] )) {
141
+		if( is_null( $variable ) && isset($_POST[$key]) ) {
142 142
 			$variable = $_POST[$key];
143 143
 		}
144 144
 		return $variable;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	public function filterInputArray( $key )
152 152
 	{
153 153
 		$variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
154
-		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) {
154
+		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) {
155 155
 			$variable = $_POST[$key];
156 156
 		}
157 157
 		return (array)$variable;
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		$result = [];
168 168
 		foreach( $array as $key => $value ) {
169 169
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
170
-			if( $this->isIndexedFlatArray( $value )) {
170
+			if( $this->isIndexedFlatArray( $value ) ) {
171 171
 				if( $flattenValue ) {
172 172
 					$value = '['.implode( ', ', $value ).']';
173 173
 				}
174 174
 			}
175
-			else if( is_array( $value )) {
176
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
175
+			else if( is_array( $value ) ) {
176
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
177 177
 				continue;
178 178
 			}
179 179
 			$result[$newKey] = $value;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 				Whip::IPV4 => $cloudflareIps['v4'],
193 193
 				Whip::IPV6 => $cloudflareIps['v6'],
194 194
 			],
195
-		]))->getValidIpAddress();
195
+		] ))->getValidIpAddress();
196 196
 	}
197 197
 
198 198
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		$keys = explode( '.', $path );
207 207
 		foreach( $keys as $key ) {
208
-			if( !isset( $values[$key] )) {
208
+			if( !isset($values[$key]) ) {
209 209
 				return $fallback;
210 210
 			}
211 211
 			$values = $values[$key];
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function isIndexedArray( $array )
221 221
 	{
222
-		if( !is_array( $array )) {
222
+		if( !is_array( $array ) ) {
223 223
 			return false;
224 224
 		}
225 225
 		$current = 0;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function isIndexedFlatArray( $array )
240 240
 	{
241
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
241
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
242 242
 			return false;
243 243
 		}
244 244
 		return $this->isIndexedArray( $array );
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function prefixString( $string, $prefix = '' )
253 253
 	{
254
-		return $prefix.str_replace( $prefix, '', trim( $string ));
254
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
255 255
 	}
256 256
 
257 257
 	/**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function removePrefix( $prefix, $text ) {
278 278
 		return 0 === strpos( $text, $prefix )
279
-			? substr( $text, strlen( $prefix ))
279
+			? substr( $text, strlen( $prefix ) )
280 280
 			: $text;
281 281
 	}
282 282
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function snakeCase( $string )
309 309
 	{
310
-		if( !ctype_lower( $string )) {
310
+		if( !ctype_lower( $string ) ) {
311 311
 			$string = preg_replace( '/\s+/u', '', $string );
312 312
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
313 313
 			$string = mb_strtolower( $string, 'UTF-8' );
@@ -322,6 +322,6 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function startsWith( $needle, $haystack )
324 324
 	{
325
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
325
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
326 326
 	}
327 327
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,7 +261,9 @@  discard block
 block discarded – undo
261 261
 	{
262 262
 		$result = [];
263 263
 		foreach( $array as $key => $value ) {
264
-			if( !$value )continue;
264
+			if( !$value ) {
265
+				continue;
266
+			}
265 267
 			$result[$key] = is_array( $value )
266 268
 				? $this->removeEmptyArrayValues( $value )
267 269
 				: $value;
@@ -274,7 +276,8 @@  discard block
 block discarded – undo
274 276
 	 * @param string $text
275 277
 	 * @return string
276 278
 	 */
277
-	public function removePrefix( $prefix, $text ) {
279
+	public function removePrefix( $prefix, $text )
280
+	{
278 281
 		return 0 === strpos( $text, $prefix )
279 282
 			? substr( $text, strlen( $prefix ))
280 283
 			: $text;
Please login to merge, or discard this patch.
plugin/Modules/Style.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 			'templates/form/submit-button',
51 51
 			'templates/reviews-form',
52 52
 		];
53
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
53
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
54 54
 			return $view;
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->path( $possibleView.'.php' )))continue;
58
+			if( !file_exists( glsr()->path( $possibleView.'.php' ) ) )continue;
59 59
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 60
 		}
61 61
 		return $view;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function modifyField( Builder $instance )
90 90
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
91
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return;
92 92
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 93
 	}
94 94
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function customize( Builder $instance )
107 107
 	{
108
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
108
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
109 109
 		$key = $instance->tag.'_'.$args['type'];
110
-		$classes = !isset( $this->fields[$key] )
110
+		$classes = !isset($this->fields[$key])
111 111
 			? $this->fields[$instance->tag]
112 112
 			: $this->fields[$key];
113 113
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$args = wp_parse_args( $instance->args, [
142 142
 			'is_public' => false,
143 143
 			'is_raw' => false,
144
-		]);
144
+		] );
145 145
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
146 146
 			return false;
147 147
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->path( $possibleView.'.php' )))continue;
58
+			if( !file_exists( glsr()->path( $possibleView.'.php' ))) {
59
+				continue;
60
+			}
59 61
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 62
 		}
61 63
 		return $view;
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function modifyField( Builder $instance )
90 92
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
93
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
94
+			return;
95
+		}
92 96
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 97
 	}
94 98
 
Please login to merge, or discard this patch.
plugin/Application.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 	public function catchFatalError()
61 61
 	{
62 62
 		$error = error_get_last();
63
-		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false )return;
63
+		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false ) {
64
+			return;
65
+		}
64 66
 		glsr_log()->error( $error['message'] );
65 67
 	}
66 68
 
@@ -204,7 +206,9 @@  discard block
 block discarded – undo
204 206
 	 */
205 207
 	public function scheduleCronJob()
206 208
 	{
207
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
209
+		if( wp_next_scheduled( static::CRON_EVENT )) {
210
+			return;
211
+		}
208 212
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
209 213
 	}
210 214
 
@@ -244,7 +248,9 @@  discard block
 block discarded – undo
244 248
 			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
245 249
 			|| $data['action'] != 'update'
246 250
 			|| $data['type'] != 'plugin'
247
-		)return;
251
+		) {
252
+			return;
253
+		}
248 254
 		$this->upgrade();
249 255
 	}
250 256
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = 'static::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 	public function file( $view )
105 105
 	{
106 106
 		$file = '';
107
-		$view.= '.php';
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$file = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
110
-			if( !file_exists( $file )) {
107
+		$view .= '.php';
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$file = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110
+			if( !file_exists( $file ) ) {
111 111
 				$file = $this->path( $view );
112 112
 			}
113 113
 		}
114
-		if( !file_exists( $file )) {
114
+		if( !file_exists( $file ) ) {
115 115
 			$file = $this->path( 'views/'.$view );
116 116
 		}
117 117
 		return $file;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function getDefaults()
124 124
 	{
125
-		if( empty( $this->defaults )) {
125
+		if( empty($this->defaults) ) {
126 126
 			$this->defaults = $this->make( DefaultsManager::class )->get();
127 127
 			$this->upgrade();
128 128
 		}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	public function hasPermission()
136 136
 	{
137 137
 		$isAdmin = $this->isAdmin();
138
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->constant( 'CAPABILITY' )));
138
+		return !$isAdmin || ($isAdmin && current_user_can( $this->constant( 'CAPABILITY' ) ));
139 139
 	}
140 140
 
141 141
 	/**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		$types = apply_filters( 'site-reviews/addon/types', [] );
192 192
 		$this->reviewTypes = wp_parse_args( $types, [
193 193
 			'local' => __( 'Local', 'site-reviews' ),
194
-		]);
194
+		] );
195 195
 	}
196 196
 
197 197
 	/**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	{
203 203
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
204 204
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
205
-		if( !file_exists( $file )) {
205
+		if( !file_exists( $file ) ) {
206 206
 			glsr_log()->error( 'File not found: '.$file );
207 207
 			return;
208 208
 		}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function scheduleCronJob()
218 218
 	{
219
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
219
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
220 220
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
221 221
 	}
222 222
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	public function unscheduleCronJob()
236 236
 	{
237
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
237
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
238 238
 	}
239 239
 
240 240
 	/**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public function url( $path = '' )
268 268
 	{
269
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
269
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
270 270
 		return apply_filters( 'site-reviews/url', $url, $path );
271 271
 	}
272 272
 }
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true )) {
59
+			return;
60
+		}
59 61
 		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
60 62
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,MutationObserver',
61 63
 			'flags' => 'gated',
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
 		// wpforms-recaptcha
71 73
 		// google-recaptcha
72 74
 		// nf-google-recaptcha
73
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
75
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
76
+			return;
77
+		}
74 78
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75 79
 		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
76 80
 			'hl' => $language,
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 	public function inlineStyles()
85 89
 	{
86 90
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
91
+		if( !apply_filters( 'site-reviews/assets/css', true )) {
92
+			return;
93
+		}
88 94
 		if( !file_exists( $inlineStylesheetPath )) {
89 95
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 96
 			return;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function enqueueAssets()
29 29
 	{
30
-		if( apply_filters( 'site-reviews/assets/css', true )) {
30
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
31 31
 			wp_enqueue_style(
32 32
 				Application::ID,
33 33
 				$this->getStylesheet(),
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 				glsr()->version
36 36
 			);
37 37
 		}
38
-		if( apply_filters( 'site-reviews/assets/js', true )) {
38
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
39 39
 			$dependencies = apply_filters( 'site-reviews/assets/polyfill', true )
40 40
 				? [Application::ID.'/polyfill']
41 41
 				: [];
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
59
-		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return;
59
+		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [
60 60
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,MutationObserver',
61 61
 			'flags' => 'gated',
62
-		], 'https://cdn.polyfill.io/v2/polyfill.min.js' ));
62
+		], 'https://cdn.polyfill.io/v2/polyfill.min.js' ) );
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 		// nf-google-recaptcha
73 73
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
74 74
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
75
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
76 76
 			'hl' => $language,
77 77
 			'render' => 'explicit',
78
-		], 'https://www.google.com/recaptcha/api.js' ));
78
+		], 'https://www.google.com/recaptcha/api.js' ) );
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	public function inlineStyles()
85 85
 	{
86 86
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
88
-		if( !file_exists( $inlineStylesheetPath )) {
87
+		if( !apply_filters( 'site-reviews/assets/css', true ) )return;
88
+		if( !file_exists( $inlineStylesheetPath ) ) {
89 89
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 90
 			return;
91 91
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function getFixedSelectorsForPagination()
122 122
 	{
123
-		$selectors = ['#wpadminbar','.site-navigation-fixed'];
123
+		$selectors = ['#wpadminbar', '.site-navigation-fixed'];
124 124
 		return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors );
125 125
 	}
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	protected function getStylesheet()
131 131
 	{
132 132
 		$currentStyle = glsr( Style::class )->style;
133
-		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ))
133
+		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) )
134 134
 			? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' )
135 135
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
136 136
 	}
Please login to merge, or discard this patch.
plugin/Router.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request )) {
21
+			return;
22
+		}
21 23
 		check_admin_referer( $request['_action'] );
22 24
 		$this->routeRequest( 'admin', $request['_action'], $request );
23 25
 	}
@@ -39,10 +41,16 @@  discard block
 block discarded – undo
39 41
 	 */
40 42
 	public function routePublicPostRequest()
41 43
 	{
42
-		if( is_admin() )return;
44
+		if( is_admin() ) {
45
+			return;
46
+		}
43 47
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
48
+		if( !$this->isValidPostRequest( $request )) {
49
+			return;
50
+		}
51
+		if( !$this->isValidPublicNonce( $request )) {
52
+			return;
53
+		}
46 54
 		$this->routeRequest( 'public', $request['_action'], $request );
47 55
 	}
48 56
 
@@ -51,7 +59,9 @@  discard block
 block discarded – undo
51 59
 	 */
52 60
 	protected function checkAjaxNonce( array $request )
53 61
 	{
54
-		if( !is_user_logged_in() )return;
62
+		if( !is_user_logged_in() ) {
63
+			return;
64
+		}
55 65
 		if( !isset( $request['_nonce'] )) {
56 66
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 67
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request ) )return;
21 21
 		check_admin_referer( $request['_action'] );
22 22
 		$this->routeRequest( 'admin', $request['_action'], $request );
23 23
 	}
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		if( is_admin() )return;
43 43
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
44
+		if( !$this->isValidPostRequest( $request ) )return;
45
+		if( !$this->isValidPublicNonce( $request ) )return;
46 46
 		$this->routeRequest( 'public', $request['_action'], $request );
47 47
 	}
48 48
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	protected function checkAjaxNonce( array $request )
53 53
 	{
54 54
 		if( !is_user_logged_in() )return;
55
-		if( !isset( $request['_nonce'] )) {
55
+		if( !isset($request['_nonce']) ) {
56 56
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 57
 		}
58
-		if( !wp_verify_nonce( $request['_nonce'], $request['_action'] )) {
58
+		if( !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) {
59 59
 			$this->sendAjaxError( 'request failed the nonce check', $request, 403 );
60 60
 		}
61 61
 	}
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function checkAjaxRequest( array $request )
67 67
 	{
68
-		if( !isset( $request['_action'] )) {
68
+		if( !isset($request['_action']) ) {
69 69
 			$this->sendAjaxError( 'request must include an action', $request );
70 70
 		}
71
-		if( empty( $request['_ajax_request'] )) {
71
+		if( empty($request['_ajax_request']) ) {
72 72
 			$this->sendAjaxError( 'request is invalid', $request );
73 73
 		}
74 74
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function isValidPostRequest( array $request = [] )
97 97
 	{
98
-		return !empty( $request['_action'] ) && empty( $request['_ajax_request'] );
98
+		return !empty($request['_action']) && empty($request['_ajax_request']);
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function isValidPublicNonce( array $request )
105 105
 	{
106
-		if( is_user_logged_in() && !wp_verify_nonce( $request['_nonce'], $request['_action'] )) {
106
+		if( is_user_logged_in() && !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) {
107 107
 			glsr_log()->error( 'nonce check failed for public request' )->debug( $request );
108 108
 			return false;
109 109
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	protected function routeRequest( $type, $action, array $request = [] )
119 119
 	{
120 120
 		$actionHook = 'site-reviews/route/'.$type.'/request';
121
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
121
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
122 122
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
123 123
 		$request = apply_filters( 'site-reviews/route/request', $request, $action, $type );
124 124
 		do_action( $actionHook, $action, $request );
125
-		if( is_callable( [$controller, $method] )) {
125
+		if( is_callable( [$controller, $method] ) ) {
126 126
 			call_user_func( [$controller, $method], $request );
127 127
 			return;
128 128
 		}
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	{
141 141
 		glsr_log()->error( $error )->debug( $request );
142 142
 		glsr( Notice::class )->addError( __( 'There was an error (try refreshing the page).', 'site-reviews' ).' <code>'.$error.'</code>' );
143
-		wp_send_json_error([
143
+		wp_send_json_error( [
144 144
 			'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ),
145 145
 			'notices' => glsr( Notice::class )->get(),
146 146
 			'error' => $error,
147
-		]);
147
+		] );
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.