Passed
Push — master ( 914f5e...11621f )
by Paul
04:00
created
plugin/Modules/Html/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	{
29 29
 		$fields = [];
30 30
 		foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) {
31
-			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ));
31
+			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) );
32 32
 		}
33 33
 		return $fields;
34 34
 	}
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'setting' => 'Plugin Settings',
39 39
 			'reviews' => 'Review Counts',
40 40
 		];
41
-		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) {
41
+		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) {
42 42
 			$methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' );
43 43
 			if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
44 44
 				return $carry.$this->implode( strtoupper( $details[$key] ), $systemDetails );
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$plugins = get_plugins();
57 57
 		$activePlugins = (array)get_option( 'active_plugins', [] );
58
-		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ));
59
-		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
58
+		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
59
+		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
60 60
 	}
61 61
 
62 62
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	public function getInactivePluginDetails()
81 81
 	{
82 82
 		$activePlugins = (array)get_option( 'active_plugins', [] );
83
-		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins )));
83
+		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$plugins = array_merge(
92 92
 			get_mu_plugins(),
93
-			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
93
+			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) )
94 94
 		);
95
-		if( empty( $plugins ))return;
95
+		if( empty($plugins) )return;
96 96
 		return $this->normalizePluginList( $plugins );
97 97
 	}
98 98
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function getMultisitePluginDetails()
103 103
 	{
104
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
104
+		if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return;
105 105
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
106 106
 	}
107 107
 
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 			'Max Input Vars' => ini_get( 'max_input_vars' ),
128 128
 			'Memory Limit' => ini_get( 'memory_limit' ),
129 129
 			'Post Max Size' => ini_get( 'post_max_size' ),
130
-			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )),
131
-			'Session Name' => esc_html( ini_get( 'session.name' )),
132
-			'Session Save Path' => esc_html( ini_get( 'session.save_path' )),
133
-			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ),
134
-			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ),
130
+			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ),
131
+			'Session Name' => esc_html( ini_get( 'session.name' ) ),
132
+			'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ),
133
+			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ),
134
+			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ),
135 135
 			'Upload Max Filesize' => ini_get( 'upload_max_filesize' ),
136 136
 		];
137 137
 	}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 		ksort( $settings );
177 177
 		$details = [];
178 178
 		foreach( $settings as $key => $value ) {
179
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
180
-			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
179
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue;
180
+			$value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
181 181
 			$details[$key] = $value;
182 182
 		}
183 183
 		return $details;
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			'WPE_APIKEY' => 'WP Engine',
250 250
 		];
251 251
 		foreach( $checks as $key => $value ) {
252
-			if( !$this->isWebhostCheckValid( $key ))continue;
252
+			if( !$this->isWebhostCheckValid( $key ) )continue;
253 253
 			return $value;
254 254
 		}
255
-		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ));
255
+		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
256 256
 	}
257 257
 
258 258
 	/**
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 	{
274 274
 		$plugins = get_plugins();
275 275
 		$activePlugins = (array)get_option( 'active_plugins', [] );
276
-		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins )));
277
-		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
276
+		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
277
+		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
278 278
 		return $active + $inactive;
279 279
 	}
280 280
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	protected function implode( $title, array $details )
286 286
 	{
287 287
 		$strings = ['['.$title.']'];
288
-		$padding = max( array_map( 'strlen', array_keys( $details )) );
288
+		$padding = max( array_map( 'strlen', array_keys( $details ) ) );
289 289
 		$padding = max( [$padding, static::PAD] );
290 290
 		foreach( $details as $key => $value ) {
291 291
 			$strings[] = is_string( $key )
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 		$keys = [
329 329
 			'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret',
330 330
 		];
331
-		array_walk( $settings, function( &$value, $setting ) use( $keys ) {
331
+		array_walk( $settings, function( &$value, $setting ) use($keys) {
332 332
 			foreach( $keys as $key ) {
333
-				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue;
333
+				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue;
334 334
 				$value = str_repeat( '•', 13 );
335 335
 				return;
336 336
 			}
Please login to merge, or discard this patch.
site-reviews.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 $app = new GeminiLabs\SiteReviews\Application;
31 31
 $app->make( 'Provider' )->register( $app );
32
-register_activation_hook( __FILE__, array( $app, 'activate' ));
33
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
34
-register_shutdown_function( array( $app, 'catchFatalError' ));
32
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
33
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
34
+register_shutdown_function( array( $app, 'catchFatalError' ) );
35 35
 $app->init();
Please login to merge, or discard this patch.
plugin/Review.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __get( $key )
48 48
 	{
49
-		if( property_exists( $this, $key )) {
49
+		if( property_exists( $this, $key ) ) {
50 50
 			return $this->$key;
51 51
 		}
52
-		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom )) {
52
+		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom ) ) {
53 53
 			return $this->custom[$key];
54 54
 		}
55 55
 		return '';
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 			'review_type' => '',
78 78
 		];
79 79
 		$meta = array_filter(
80
-			array_map( 'array_shift', (array)get_post_meta( $post->ID )),
80
+			array_map( 'array_shift', (array)get_post_meta( $post->ID ) ),
81 81
 			'strlen'
82 82
 		);
83
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
83
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
84 84
 		$this->modified = $this->isModified( $properties );
85 85
 		array_walk( $properties, function( $value, $key ) {
86
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
86
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
87 87
 			$this->$key = maybe_unserialize( $value );
88 88
 		});
89 89
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	protected function setTermIds( WP_Post $post )
95 95
 	{
96 96
 		$this->term_ids = [];
97
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
97
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
98 98
 		foreach( $terms as $term ) {
99 99
 			$this->term_ids[] = $term->term_id;
100 100
 		}
Please login to merge, or discard this patch.
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.
helpers.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function glsr( $alias = null ) {
8 8
 	$app = \GeminiLabs\SiteReviews\Application::load();
9
-	return !empty( $alias )
9
+	return !empty($alias)
10 10
 		? $app->make( $alias )
11 11
 		: $app;
12 12
 }
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @return false|\GeminiLabs\SiteReviews\Review
16 16
  */
17 17
 function glsr_create_review( array $reviewValues = [] ) {
18
-	if( empty( $reviewValues )) {
18
+	if( empty($reviewValues) ) {
19 19
 		return false;
20 20
 	}
21 21
 	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview( $reviewValues );
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
  * @return \WP_Screen|object
27 27
  */
28 28
 function glsr_current_screen() {
29
-	if( function_exists( 'get_current_screen' )) {
29
+	if( function_exists( 'get_current_screen' ) ) {
30 30
 		$screen = get_current_screen();
31 31
 	}
32
-	return empty( $screen )
32
+	return empty($screen)
33 33
 		? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
34 34
 		: $screen;
35 35
 }
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
  */
93 93
 function glsr_log() {
94 94
 	$args = func_get_args();
95
-	$context = isset( $args[1] )
95
+	$context = isset($args[1])
96 96
 		? $args[1]
97 97
 		: [];
98 98
 	$console = glsr( 'Modules\Console' );
99
-	return !empty( $args )
99
+	return !empty($args)
100 100
 		? $console->log( 'debug', $args[0], $context )
101 101
 		: $console;
102 102
 }
Please login to merge, or discard this patch.