Passed
Push — master ( 4a454f...b92003 )
by Paul
03:35
created
views/partials/translations/single.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 			<p>{{ data.s1 }}</p>
8 8
 		</div>
9 9
 		<p class="row-actions">
10
-			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
10
+			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
11 11
 		</p>
12 12
 	</td>
13 13
 	<td class="glsr-string-td2">
Please login to merge, or discard this patch.
views/partials/translations/plural.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 			<p>{{ data.p1 }}</p>
9 9
 		</div>
10 10
 		<p class="row-actions">
11
-			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
11
+			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
12 12
 		</p>
13 13
 	</td>
14 14
 	<td class="glsr-string-td2">
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	protected function filterAttributes( array $allowedAttributeKeys )
124 124
 	{
125
-		return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ));
125
+		return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) );
126 126
 	}
127 127
 
128 128
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES );
134 134
 		$wildcards = [];
135 135
 		foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) {
136
-			$newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) {
136
+			$newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) {
137 137
 				return glsr( Helper::class )->startsWith( $wildcard, $key );
138 138
 			}, ARRAY_FILTER_USE_KEY );
139 139
 			$wildcards = array_merge( $wildcards, $newWildcards );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	protected function getPermanentAttributes()
148 148
 	{
149 149
 		$permanentAttributes = [];
150
-		if( array_key_exists( 'value', $this->attributes )) {
150
+		if( array_key_exists( 'value', $this->attributes ) ) {
151 151
 			$permanentAttributes['value'] = $this->attributes['value'];
152 152
 		}
153 153
 		return $permanentAttributes;
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	protected function normalizeBooleanAttributes()
200 200
 	{
201 201
 		foreach( $this->attributes as $key => $value ) {
202
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
202
+			if( $this->isAttributeKeyNumeric( $key, $value ) ) {
203 203
 				$key = $value;
204 204
 				$value = true;
205 205
 			}
206
-			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue;
206
+			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue;
207 207
 			$this->attributes[$key] = wp_validate_boolean( $value );
208 208
 		}
209 209
 	}
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 	protected function normalizeDataAttributes()
215 215
 	{
216 216
 		foreach( $this->attributes as $key => $value ) {
217
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
217
+			if( $this->isAttributeKeyNumeric( $key, $value ) ) {
218 218
 				$key = $value;
219 219
 				$value = '';
220 220
 			}
221
-			if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue;
222
-			if( is_array( $value )) {
223
-				$value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE );
221
+			if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue;
222
+			if( is_array( $value ) ) {
223
+				$value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
224 224
 			}
225 225
 			$this->attributes[$key] = $value;
226 226
 		}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	protected function normalizeStringAttributes()
233 233
 	{
234 234
 		foreach( $this->attributes as $key => $value ) {
235
-			if( !is_string( $value ))continue;
235
+			if( !is_string( $value ) )continue;
236 236
 			$this->attributes[$key] = trim( $value );
237 237
 		}
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	{
246 246
 		if( $method != 'input' )return;
247 247
 		$attributes = wp_parse_args( $this->attributes, ['type' => ''] );
248
-		if( !in_array( $attributes['type'], static::INPUT_TYPES )) {
248
+		if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) {
249 249
 			$this->attributes['type'] = 'text';
250 250
 		}
251 251
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 		$permanentAttributes = $this->getPermanentAttributes();
260 260
 		foreach( $this->attributes as $key => $value ) {
261 261
 			if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) {
262
-				unset( $attributes[$key] );
262
+				unset($attributes[$key]);
263 263
 			}
264
-			if( glsr( Helper::class )->startsWith( 'data-', $key )) {
264
+			if( glsr( Helper::class )->startsWith( 'data-', $key ) ) {
265 265
 				$permanentAttributes[$key] = $value;
266
-				unset( $attributes[$key] );
266
+				unset($attributes[$key]);
267 267
 			}
268 268
 		}
269 269
 		$this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes );
Please login to merge, or discard this patch.
plugin/Modules/Upgrader/Upgrade_3_0_0.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	{
75 75
 		$this->newSettings = $this->getNewSettings();
76 76
 		$this->oldSettings = $this->getOldSettings();
77
-		if( empty( $this->oldSettings ))return;
77
+		if( empty($this->oldSettings) )return;
78 78
 		foreach( static::MAPPED_SETTINGS as $old => $new ) {
79
-			if( empty( $this->oldSettings[$old] ))continue;
79
+			if( empty($this->oldSettings[$old]) )continue;
80 80
 			$this->newSettings[$new] = $this->oldSettings[$old];
81 81
 		}
82 82
 		$this->migrateNotificationSettings();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->migrateRequiredSettings();
85 85
 		$oldSettings = glsr( Helper::class )->convertDotNotationArray( $this->oldSettings );
86 86
 		$newSettings = glsr( Helper::class )->convertDotNotationArray( $this->newSettings );
87
-		if( isset( $oldSettings['settings']['strings'] ) && is_array( $oldSettings['settings']['strings'] )) {
87
+		if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) {
88 88
 			$newSettings['settings']['strings'] = $oldSettings['settings']['strings'];
89 89
 		}
90 90
 		glsr( OptionManager::class )->set( $newSettings );
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	protected function getOldSettings()
118 118
 	{
119 119
 		$defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' );
120
-		$settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ));
121
-		if( !empty( $settings )) {
120
+		$settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ) );
121
+		if( !empty($settings) ) {
122 122
 			$settings = wp_parse_args( $settings, $defaults );
123 123
 		}
124 124
 		return $settings;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'],
152 152
 			'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'],
153 153
 		];
154
-		if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) {
154
+		if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) {
155 155
 			$this->newSettings['settings.submissions.recaptcha.integration'] = 'all';
156 156
 		}
157 157
 		if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) {
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/Modules/Style.php 1 patch
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.
plugin/Controllers/PublicController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 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/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function build( array $args = [] )
14 14
 	{
15
-		require_once( ABSPATH.'wp-admin/includes/template.php' );
15
+		require_once(ABSPATH.'wp-admin/includes/template.php');
16 16
 		ob_start();
17 17
 		wp_star_rating( $args );
18 18
 		$stars = ob_get_clean();
Please login to merge, or discard this patch.