Passed
Push — master ( a42385...9b46a7 )
by Paul
04:14
created
plugin/Modules/Html/Settings.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	protected function getFieldDefault( array $field )
31 31
 	{
32
-		return isset( $field['default'] )
32
+		return isset($field['default'])
33 33
 			? $field['default']
34 34
 			: '';
35 35
 	}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	protected function getSettingFields( $path )
41 41
 	{
42 42
 		$settings = glsr( DefaultsManager::class )->settings();
43
-		return array_filter( $settings, function( $key ) use( $path ) {
43
+		return array_filter( $settings, function( $key ) use($path) {
44 44
 			return glsr( Helper::class )->startsWith( $path, $key );
45 45
 		}, ARRAY_FILTER_USE_KEY );
46 46
 	}
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 			$field = wp_parse_args( $field, [
56 56
 				'is_setting' => true,
57 57
 				'name' => $name,
58
-			]);
59
-			$rows.= new Field( $this->normalize( $field ));
58
+			] );
59
+			$rows .= new Field( $this->normalize( $field ) );
60 60
 		}
61 61
 		return $rows;
62 62
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	protected function getTemplateData( $id )
69 69
 	{
70
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
70
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
71 71
 		return [
72 72
 			'context' => [
73 73
 				'rows' => $this->getSettingRows( $fields ),
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	protected function getTemplateDataForAddons( $id )
83 83
 	{
84
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
84
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
85 85
 		$settings = glsr( Helper::class )->convertDotNotationArray( $fields );
86 86
 		$settingKeys = array_keys( $settings['settings']['addons'] );
87 87
 		$results = [];
88 88
 		foreach( $settingKeys as $key ) {
89
-			$addonFields = array_filter( $fields, function( $path ) use( $key ) {
89
+			$addonFields = array_filter( $fields, function( $path ) use($key) {
90 90
 				return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path );
91 91
 			}, ARRAY_FILTER_USE_KEY );
92 92
 			$results[$key] = $this->getSettingRows( $addonFields );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	protected function getTemplateDataForTranslations()
103 103
 	{
104 104
 		$translations = glsr( Translation::class )->renderAll();
105
-		$class = empty( $translations )
105
+		$class = empty($translations)
106 106
 			? 'glsr-hidden'
107 107
 			: '';
108 108
 		return [
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 			$path,
126 126
 			glsr( Helper::class )->getPathValue( $path, glsr()->defaults )
127 127
 		);
128
-		if( is_array( $expectedValue )) {
128
+		if( is_array( $expectedValue ) ) {
129 129
 			return is_array( $optionValue )
130
-				? count( array_intersect( $optionValue, $expectedValue )) === 0
130
+				? count( array_intersect( $optionValue, $expectedValue ) ) === 0
131 131
 				: !in_array( $optionValue, $expectedValue );
132 132
 		}
133 133
 		return $optionValue != $expectedValue;
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function normalizeDependsOn( array $field )
151 151
 	{
152
-		if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) {
152
+		if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) {
153 153
 			$path = key( $field['depends_on'] );
154 154
 			$expectedValue = $field['depends_on'][$path];
155 155
 			$fieldName = glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() );
156
-			if( is_array( $expectedValue )) {
157
-				$fieldName.= '[]';
156
+			if( is_array( $expectedValue ) ) {
157
+				$fieldName .= '[]';
158 158
 			}
159
-			$field['data-depends'] = json_encode([
159
+			$field['data-depends'] = json_encode( [
160 160
 				'name' => $fieldName,
161 161
 				'value' => $expectedValue,
162
-			], JSON_HEX_APOS|JSON_HEX_QUOT );
162
+			], JSON_HEX_APOS | JSON_HEX_QUOT );
163 163
 			$field['is_hidden'] = $this->isFieldHidden( $path, $expectedValue );
164 164
 		}
165 165
 		return $field;
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	protected function normalizeLabelAndLegend( array $field )
172 172
 	{
173
-		if( !empty( $field['label'] )) {
173
+		if( !empty($field['label']) ) {
174 174
 			$field['legend'] = $field['label'];
175
-			unset( $field['label'] );
175
+			unset($field['label']);
176 176
 		}
177 177
 		else {
178 178
 			$field['is_valid'] = false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function normalizeValue( array $field )
188 188
 	{
189
-		if( !isset( $field['value'] )) {
189
+		if( !isset($field['value']) ) {
190 190
 			$field['value'] = glsr( OptionManager::class )->get(
191 191
 				$field['name'],
192 192
 				$this->getFieldDefault( $field )
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 2 patches
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.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -203,7 +203,9 @@  discard block
 block discarded – undo
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 )) {
207
+				continue;
208
+			}
207 209
 			$this->attributes[$key] = wp_validate_boolean( $value );
208 210
 		}
209 211
 	}
@@ -218,7 +220,9 @@  discard block
 block discarded – undo
218 220
 				$key = $value;
219 221
 				$value = '';
220 222
 			}
221
-			if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue;
223
+			if( !glsr( Helper::class )->startsWith( 'data-', $key )) {
224
+				continue;
225
+			}
222 226
 			if( is_array( $value )) {
223 227
 				$value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE );
224 228
 			}
@@ -232,7 +236,9 @@  discard block
 block discarded – undo
232 236
 	protected function normalizeStringAttributes()
233 237
 	{
234 238
 		foreach( $this->attributes as $key => $value ) {
235
-			if( !is_string( $value ))continue;
239
+			if( !is_string( $value )) {
240
+				continue;
241
+			}
236 242
 			$this->attributes[$key] = trim( $value );
237 243
 		}
238 244
 	}
@@ -243,7 +249,9 @@  discard block
 block discarded – undo
243 249
 	 */
244 250
 	protected function normalizeInputType( $method )
245 251
 	{
246
-		if( $method != 'input' )return;
252
+		if( $method != 'input' ) {
253
+			return;
254
+		}
247 255
 		$attributes = wp_parse_args( $this->attributes, ['type' => ''] );
248 256
 		if( !in_array( $attributes['type'], static::INPUT_TYPES )) {
249 257
 			$this->attributes['type'] = 'text';
Please login to merge, or discard this patch.
plugin/Modules/Translation.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$translations = $this->translations();
32 32
 		$entries = $this->filter( $translations, $this->entries() )->results();
33
-		array_walk( $translations, function( &$entry ) use( $entries ) {
33
+		array_walk( $translations, function( &$entry ) use($entries) {
34 34
 			$entry['desc'] = array_key_exists( $entry['id'], $entries )
35 35
 				? $this->getEntryString( $entries[$entry['id']], 'msgctxt' )
36 36
 				: '';
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function entries()
45 45
 	{
46
-		if( !isset( $this->entries )) {
46
+		if( !isset($this->entries) ) {
47 47
 			try {
48 48
 				$potFile = glsr()->path( glsr()->languages.'/'.Application::ID.'.pot' );
49 49
 				$entries = $this->normalize( Parser::parseFile( $potFile )->getEntries() );
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
78 78
 	{
79
-		if( !is_array( $entries )) {
79
+		if( !is_array( $entries ) ) {
80 80
 			$entries = $this->results;
81 81
 		}
82
-		if( !is_array( $filterWith )) {
82
+		if( !is_array( $filterWith ) ) {
83 83
 			$filterWith = $this->translations();
84 84
 		}
85
-		$keys = array_flip( array_column( $filterWith, 'id' ));
85
+		$keys = array_flip( array_column( $filterWith, 'id' ) );
86 86
 		$this->results = $intersect
87 87
 			? array_intersect_key( $entries, $keys )
88 88
 			: array_diff_key( $entries, $keys );
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	public function render( $template, array $entry )
97 97
 	{
98 98
 		$data = array_combine(
99
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
99
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
100 100
 			$entry
101 101
 		);
102 102
 		$data['data.class'] = $data['data.error'] = '';
103
-		if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' )) === false ) {
103
+		if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' ) ) === false ) {
104 104
 			$data['data.class'] = 'is-invalid';
105 105
 			$data['data.error'] = __( 'This custom translation is no longer valid as the original text has been changed or removed.', 'site-reviews' );
106 106
 		}
107 107
 		return glsr( Template::class )->build( 'partials/translations/'.$template, [
108 108
 			'context' => $data,
109
-		]);
109
+		] );
110 110
 	}
111 111
 
112 112
 	/**
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
139 139
 				's1' => $this->getEntryString( $entry, 'msgid' ),
140 140
 			];
141
-			$text = !empty( $data['p1'] )
141
+			$text = !empty($data['p1'])
142 142
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
143 143
 				: $data['s1'];
144 144
 			$rendered .= $this->render( 'result', [
145
-				'entry' => json_encode( $data, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ),
145
+				'entry' => json_encode( $data, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ),
146 146
 				'text' => wp_strip_all_tags( $text ),
147
-			]);
147
+			] );
148 148
 		}
149 149
 		if( $resetAfterRender ) {
150 150
 			$this->reset();
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	public function search( $needle = '' )
178 178
 	{
179 179
 		$this->reset();
180
-		$needle = trim( strtolower( $needle ));
180
+		$needle = trim( strtolower( $needle ) );
181 181
 		foreach( $this->entries() as $key => $entry ) {
182
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
183
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
182
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
183
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
184 184
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
185
-				if( in_array( $needle, [$single, $plural] )) {
185
+				if( in_array( $needle, [$single, $plural] ) ) {
186 186
 					$this->results[$key] = $entry;
187 187
 				}
188 188
 			}
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 	public function translations()
201 201
 	{
202 202
 		static $translations;
203
-		if( empty( $translations )) {
203
+		if( empty($translations) ) {
204 204
 			$settings = glsr( OptionManager::class )->get( 'settings' );
205
-			$translations = isset( $settings['strings'] )
206
-				? $this->normalizeSettings( (array) $settings['strings'] )
205
+			$translations = isset($settings['strings'])
206
+				? $this->normalizeSettings( (array)$settings['strings'] )
207 207
 				: [];
208 208
 		}
209 209
 		return $translations;
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	protected function getEntryString( array $entry, $key )
217 217
 	{
218
-		return isset( $entry[$key] )
219
-			? implode( '', (array) $entry[$key] )
218
+		return isset($entry[$key])
219
+			? implode( '', (array)$entry[$key] )
220 220
 			: '';
221 221
 	}
222 222
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		$keys = [
229 229
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
230 230
 		];
231
-		array_walk( $entries, function( &$entry ) use( $keys ) {
231
+		array_walk( $entries, function( &$entry ) use($keys) {
232 232
 			foreach( $keys as $key ) {
233 233
 				$entry = $this->normalizeEntryString( $entry, $key );
234 234
 			}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function normalizeEntryString( array $entry, $key )
244 244
 	{
245
-		if( isset( $entry[$key] )) {
245
+		if( isset($entry[$key]) ) {
246 246
 			$entry[$key] = $this->getEntryString( $entry, $key );
247 247
 		}
248 248
 		return $entry;
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
257 257
 		$strings = array_filter( $strings, 'is_array' );
258 258
 		foreach( $strings as &$string ) {
259
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
259
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
260 260
 			$string = wp_parse_args( $string, $defaultString );
261 261
 		}
262 262
 		return array_filter( $strings, function( $string ) {
263
-			return !empty( $string['id'] );
263
+			return !empty($string['id']);
264 264
 		});
265 265
 	}
266 266
 }
Please login to merge, or discard this patch.
plugin/Modules/Upgrader/Upgrade_3_0_0.php 2 patches
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.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,9 +74,13 @@  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 )) {
78
+			return;
79
+		}
78 80
 		foreach( static::MAPPED_SETTINGS as $old => $new ) {
79
-			if( empty( $this->oldSettings[$old] ))continue;
81
+			if( empty( $this->oldSettings[$old] )) {
82
+				continue;
83
+			}
80 84
 			$this->newSettings[$new] = $this->oldSettings[$old];
81 85
 		}
82 86
 		$this->migrateNotificationSettings();
@@ -136,7 +140,9 @@  discard block
 block discarded – undo
136 140
 		];
137 141
 		$this->newSettings['settings.general.notifications'] = [];
138 142
 		foreach( $notifications as $old => $new ) {
139
-			if( $this->oldSettings['settings.general.notification'] != $old )continue;
143
+			if( $this->oldSettings['settings.general.notification'] != $old ) {
144
+				continue;
145
+			}
140 146
 			$this->newSettings['settings.general.notifications'][] = $new;
141 147
 		}
142 148
 	}
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function routerChangeStatus( array $request )
24 24
 	{
25
-		wp_send_json_success( $this->execute( new ChangeStatus( $request )));
25
+		wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	public function routerClearConsole()
32 32
 	{
33 33
 		glsr( AdminController::class )->routerClearConsole();
34
-		wp_send_json_success([
34
+		wp_send_json_success( [
35 35
 			'console' => glsr( Console::class )->get(),
36 36
 			'notices' => glsr( Notice::class )->get(),
37
-		]);
37
+		] );
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	public function routerCountReviews()
44 44
 	{
45 45
 		glsr( AdminController::class )->routerCountReviews();
46
-		wp_send_json_success([
46
+		wp_send_json_success( [
47 47
 			'notices' => glsr( Notice::class )->get(),
48
-		]);
48
+		] );
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$shortcode = $request['shortcode'];
57 57
 		$response = false;
58
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
58
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
59 59
 			$data = glsr()->mceShortcodes[$shortcode];
60
-			if( !empty( $data['errors'] )) {
60
+			if( !empty($data['errors']) ) {
61 61
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
62 62
 			}
63 63
 			$response = [
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	public function routerFetchConsole()
78 78
 	{
79 79
 		glsr( AdminController::class )->routerFetchConsole();
80
-		wp_send_json_success([
80
+		wp_send_json_success( [
81 81
 			'console' => glsr( Console::class )->get(),
82 82
 			'notices' => glsr( Notice::class )->get(),
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public function routerSearchPosts( array $request )
90 90
 	{
91 91
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
92
-		wp_send_json_success([
92
+		wp_send_json_success( [
93 93
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
94 94
 			'items' => $results,
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function routerSearchTranslations( array $request )
102 102
 	{
103
-		if( empty( $request['exclude'] )) {
103
+		if( empty($request['exclude']) ) {
104 104
 			$request['exclude'] = [];
105 105
 		}
106 106
 		$results = glsr( Translation::class )
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 			->exclude()
109 109
 			->exclude( $request['exclude'] )
110 110
 			->renderResults();
111
-		wp_send_json_success([
111
+		wp_send_json_success( [
112 112
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
113 113
 			'items' => $results,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 			'errors' => glsr( Session::class )->get( $request['form_id'].'errors', false, true ),
125 125
 			'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ),
126 126
 			'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ),
127
-			'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ))),
127
+			'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ) ) ),
128 128
 		];
129
-		if( !wp_validate_boolean( $data['errors'] )) {
129
+		if( !wp_validate_boolean( $data['errors'] ) ) {
130 130
 			glsr( Session::class )->clear();
131 131
 			wp_send_json_success( $data );
132 132
 		}
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function routerTogglePinned( array $request )
140 140
 	{
141
-		$isPinned = $this->execute( new TogglePinned( $request ));
142
-		wp_send_json_success([
141
+		$isPinned = $this->execute( new TogglePinned( $request ) );
142
+		wp_send_json_success( [
143 143
 			'notices' => glsr( Notice::class )->get(),
144 144
 			'pinned' => $isPinned,
145
-		]);
145
+		] );
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.