Passed
Push — hotfix/fix-counts ( 0ee906...e9420b )
by Paul
03:57
created
plugin/Modules/Html/Settings.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function getSettingFields( $path )
45 45
 	{
46
-		return array_filter( $this->settings, function( $key ) use( $path ) {
46
+		return array_filter( $this->settings, function( $key ) use($path) {
47 47
 			return glsr( Helper::class )->startsWith( $path, $key );
48 48
 		}, ARRAY_FILTER_USE_KEY );
49 49
 	}
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 			$field = wp_parse_args( $field, [
59 59
 				'is_setting' => true,
60 60
 				'name' => $name,
61
-			]);
62
-			$rows.= new Field( $this->normalize( $field ));
61
+			] );
62
+			$rows .= new Field( $this->normalize( $field ) );
63 63
 		}
64 64
 		return $rows;
65 65
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function getTemplateData( $id )
72 72
 	{
73
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
73
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
74 74
 		return [
75 75
 			'context' => [
76 76
 				'rows' => $this->getSettingRows( $fields ),
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	protected function getTemplateDataForAddons( $id )
86 86
 	{
87
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
87
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
88 88
 		$settings = glsr( Helper::class )->convertDotNotationArray( $fields );
89 89
 		$settingKeys = array_keys( $settings['settings']['addons'] );
90 90
 		$results = [];
91 91
 		foreach( $settingKeys as $key ) {
92
-			$addonFields = array_filter( $fields, function( $path ) use( $key ) {
92
+			$addonFields = array_filter( $fields, function( $path ) use($key) {
93 93
 				return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path );
94 94
 			}, ARRAY_FILTER_USE_KEY );
95 95
 			$results[$key] = $this->getSettingRows( $addonFields );
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function getTemplateDataForLicenses( $id )
108 108
 	{
109
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
109
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
110 110
 		ksort( $fields );
111 111
 		return [
112 112
 			'context' => [
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	protected function getTemplateDataForTranslations()
122 122
 	{
123 123
 		$translations = glsr( Translation::class )->renderAll();
124
-		$class = empty( $translations )
124
+		$class = empty($translations)
125 125
 			? 'glsr-hidden'
126 126
 			: '';
127 127
 		return [
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 			$path,
145 145
 			glsr( Helper::class )->dataGet( glsr()->defaults, $path )
146 146
 		);
147
-		if( is_array( $expectedValue )) {
147
+		if( is_array( $expectedValue ) ) {
148 148
 			return is_array( $optionValue )
149
-				? count( array_intersect( $optionValue, $expectedValue )) === 0
149
+				? count( array_intersect( $optionValue, $expectedValue ) ) === 0
150 150
 				: !in_array( $optionValue, $expectedValue );
151 151
 		}
152 152
 		return $optionValue != $expectedValue;
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	protected function isMultiDependency( $path )
159 159
 	{
160
-		if( isset( $this->settings[$path] )) {
160
+		if( isset($this->settings[$path]) ) {
161 161
 			$field = $this->settings[$path];
162
-			return ( $field['type'] == 'checkbox' && !empty( $field['options'] ))
163
-				|| !empty( $field['multiple'] );
162
+			return ($field['type'] == 'checkbox' && !empty($field['options']))
163
+				|| !empty($field['multiple']);
164 164
 		}
165 165
 		return false;
166 166
 	}
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	protected function normalizeDependsOn( array $field )
183 183
 	{
184
-		if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) {
184
+		if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) {
185 185
 			$path = key( $field['depends_on'] );
186 186
 			$expectedValue = $field['depends_on'][$path];
187 187
 			$fieldName = glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() );
188
-			if( $this->isMultiDependency( $path )) {
189
-				$fieldName.= '[]';
188
+			if( $this->isMultiDependency( $path ) ) {
189
+				$fieldName .= '[]';
190 190
 			}
191
-			$field['data-depends'] = json_encode([
191
+			$field['data-depends'] = json_encode( [
192 192
 				'name' => $fieldName,
193 193
 				'value' => $expectedValue,
194
-			], JSON_HEX_APOS|JSON_HEX_QUOT );
194
+			], JSON_HEX_APOS | JSON_HEX_QUOT );
195 195
 			$field['is_hidden'] = $this->isFieldHidden( $path, $expectedValue );
196 196
 		}
197 197
 		return $field;
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function normalizeLabelAndLegend( array $field )
204 204
 	{
205
-		if( !empty( $field['label'] )) {
205
+		if( !empty($field['label']) ) {
206 206
 			$field['legend'] = $field['label'];
207
-			unset( $field['label'] );
207
+			unset($field['label']);
208 208
 		}
209 209
 		else {
210 210
 			$field['is_valid'] = false;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	protected function normalizeValue( array $field )
220 220
 	{
221
-		if( !isset( $field['value'] )) {
221
+		if( !isset($field['value']) ) {
222 222
 			$field['value'] = glsr( OptionManager::class )->get(
223 223
 				$field['name'],
224 224
 				$this->getFieldDefault( $field )
Please login to merge, or discard this patch.
plugin/Modules/Console.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,9 @@  discard block
 block discarded – undo
185 185
 		$once = glsr( Helper::class )->consolidateArray( $once );
186 186
 		$levels = $this->getLevels();
187 187
 		foreach( $once as $entry ) {
188
-			if( !in_array( glsr_get( $entry, 'level' ), $levels ))continue;
188
+			if( !in_array( glsr_get( $entry, 'level' ), $levels )) {
189
+				continue;
190
+			}
189 191
 			$level = glsr_get( $entry, 'level' );
190 192
 			$message = glsr_get( $entry, 'message' );
191 193
 			$backtraceLine = glsr_get( $entry, 'backtrace' );
@@ -218,7 +220,9 @@  discard block
 block discarded – undo
218 220
 			return glsr_get( $entry, 'level' ) == $level
219 221
 				&& glsr_get( $entry, 'handle' ) == $handle;
220 222
 		});
221
-		if( !empty( $filtered ))return;
223
+		if( !empty( $filtered )) {
224
+			return;
225
+		}
222 226
 		$once[] = [
223 227
 			'backtrace' => $this->getBacktraceLineFromData( $data ),
224 228
 			'handle' => $handle,
@@ -411,7 +415,9 @@  discard block
 block discarded – undo
411 415
 	 */
412 416
 	protected function reset()
413 417
 	{
414
-		if( $this->size() <= pow( 1024, 2 ) / 8 )return;
418
+		if( $this->size() <= pow( 1024, 2 ) / 8 ) {
419
+			return;
420
+		}
415 421
 		$this->clear();
416 422
 		file_put_contents(
417 423
 			$this->file,
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 
11 11
 class Console
12 12
 {
13
-	const DEBUG_0 = 'debug';         // Detailed debug information
14
-	const INFO_1 = 'info';           // Interesting events
15
-	const NOTICE_2 = 'notice';       // Normal but significant events
16
-	const WARNING_3 = 'warning';     // Exceptional occurrences that are not errors
17
-	const ERROR_4 = 'error';         // Runtime errors that do not require immediate action
18
-	const CRITICAL_5 = 'critical';   // Critical conditions
19
-	const ALERT_6 = 'alert';         // Action must be taken immediately
13
+	const DEBUG_0 = 'debug'; // Detailed debug information
14
+	const INFO_1 = 'info'; // Interesting events
15
+	const NOTICE_2 = 'notice'; // Normal but significant events
16
+	const WARNING_3 = 'warning'; // Exceptional occurrences that are not errors
17
+	const ERROR_4 = 'error'; // Runtime errors that do not require immediate action
18
+	const CRITICAL_5 = 'critical'; // Critical conditions
19
+	const ALERT_6 = 'alert'; // Action must be taken immediately
20 20
 	const EMERGENCY_7 = 'emergency'; // System is unusable
21 21
 
22 22
 	protected $file;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get()
113 113
 	{
114
-		return empty( $this->log )
114
+		return empty($this->log)
115 115
 			? __( 'Console is empty', 'site-reviews' )
116 116
 			: $this->log;
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getLevel()
123 123
 	{
124
-		return intval( apply_filters( 'site-reviews/console/level', 2 ));
124
+		return intval( apply_filters( 'site-reviews/console/level', 2 ) );
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function getLevels()
131 131
 	{
132
-		return array_values(( new ReflectionClass( __CLASS__ ))->getConstants() );
132
+		return array_values( (new ReflectionClass( __CLASS__ ))->getConstants() );
133 133
 	}
134 134
 
135 135
 	/**
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	public function humanSize( $valueIfEmpty = null )
149 149
 	{
150 150
 		$bytes = $this->size();
151
-		if( empty( $bytes ) && is_string( $valueIfEmpty )) {
151
+		if( empty($bytes) && is_string( $valueIfEmpty ) ) {
152 152
 			return $valueIfEmpty;
153 153
 		}
154
-		$exponent = floor( log( max( $bytes, 1 ), 1024 ));
155
-		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent];
154
+		$exponent = floor( log( max( $bytes, 1 ), 1024 ) );
155
+		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent];
156 156
 	}
157 157
 
158 158
 	/**
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function log( $level, $message, $context = [], $backtraceLine = '' )
178 178
 	{
179
-		if( empty( $backtraceLine )) {
179
+		if( empty($backtraceLine) ) {
180 180
 			$backtraceLine = $this->getBacktraceLine();
181 181
 		}
182
-		if( $this->canLogEntry( $level, $backtraceLine )) {
182
+		if( $this->canLogEntry( $level, $backtraceLine ) ) {
183 183
 			$context = glsr( Helper::class )->consolidateArray( $context );
184 184
 			$backtraceLine = $this->normalizeBacktraceLine( $backtraceLine );
185 185
 			$message = $this->interpolate( $message, $context );
186 186
 			$entry = $this->buildLogEntry( $level, $message, $backtraceLine );
187
-			file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND|LOCK_EX );
187
+			file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND | LOCK_EX );
188 188
 			apply_filters( 'console', $message, $level, $backtraceLine ); // Show in Blackbar plugin if installed
189 189
 			$this->reset();
190 190
 		}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		$once = glsr( Helper::class )->consolidateArray( $once );
201 201
 		$levels = $this->getLevels();
202 202
 		foreach( $once as $entry ) {
203
-			if( !in_array( glsr_get( $entry, 'level' ), $levels ))continue;
203
+			if( !in_array( glsr_get( $entry, 'level' ), $levels ) )continue;
204 204
 			$level = glsr_get( $entry, 'level' );
205 205
 			$message = glsr_get( $entry, 'message' );
206 206
 			$backtraceLine = glsr_get( $entry, 'backtrace' );
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 	{
230 230
 		$once = glsr( Session::class )->get( $this->onceSessionKey, [] );
231 231
 		$once = glsr( Helper::class )->consolidateArray( $once );
232
-		$filtered = array_filter( $once, function( $entry ) use( $level, $handle ) {
232
+		$filtered = array_filter( $once, function( $entry ) use($level, $handle) {
233 233
 			return glsr_get( $entry, 'level' ) == $level
234 234
 				&& glsr_get( $entry, 'handle' ) == $handle;
235 235
 		});
236
-		if( !empty( $filtered ))return;
236
+		if( !empty($filtered) )return;
237 237
 		$once[] = [
238 238
 			'backtrace' => $this->getBacktraceLineFromData( $data ),
239 239
 			'handle' => $handle,
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	protected function getBacktraceLine()
315 315
 	{
316 316
 		$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 );
317
-		$search = array_search( 'log', glsr_array_column( $backtrace, 'function' ));
317
+		$search = array_search( 'log', glsr_array_column( $backtrace, 'function' ) );
318 318
 		if( $search !== false ) {
319
-			$index = glsr_get( $backtrace, ( $search + 2 ).'.function' ) == '{closure}'
319
+			$index = glsr_get( $backtrace, ($search + 2).'.function' ) == '{closure}'
320 320
 				? $search + 4
321 321
 				: $search + 1;
322 322
 			return $this->buildBacktraceLine( $backtrace, $index );
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	protected function interpolate( $message, $context = [] )
357 357
 	{
358
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
358
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
359 359
 			return print_r( $message, true );
360 360
 		}
361 361
 		$replace = [];
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 			glsr()->path( 'plugin/' ),
385 385
 			glsr()->path( 'plugin/', false ),
386 386
 			trailingslashit( glsr()->path() ),
387
-			trailingslashit( glsr()->path( '', false )),
387
+			trailingslashit( glsr()->path( '', false ) ),
388 388
 			WP_CONTENT_DIR,
389 389
 			ABSPATH
390 390
 		];
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 		if( $value instanceof DateTime ) {
413 413
 			$value = $value->format( 'Y-m-d H:i:s' );
414 414
 		}
415
-		else if( $this->isObjectOrArray( $value )) {
415
+		else if( $this->isObjectOrArray( $value ) ) {
416 416
 			$value = json_encode( $value );
417 417
 		}
418 418
 		return (string)$value;
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
 			$potFile = glsr()->path( glsr()->languages.'/'.Application::ID.'.pot' );
48 48
 			$entries = $this->extractEntriesFromPotFile( $potFile );
49 49
 			$entries = apply_filters( 'site-reviews/translation/entries', $entries );
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
90 90
 	{
91
-		if( !is_array( $entries )) {
91
+		if( !is_array( $entries ) ) {
92 92
 			$entries = $this->results;
93 93
 		}
94
-		if( !is_array( $filterWith )) {
94
+		if( !is_array( $filterWith ) ) {
95 95
 			$filterWith = $this->translations();
96 96
 		}
97
-		$keys = array_flip( glsr_array_column( $filterWith, 'id' ));
97
+		$keys = array_flip( glsr_array_column( $filterWith, 'id' ) );
98 98
 		$this->results = $intersect
99 99
 			? array_intersect_key( $entries, $keys )
100 100
 			: array_diff_key( $entries, $keys );
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 	public function render( $template, array $entry )
109 109
 	{
110 110
 		$data = array_combine(
111
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
111
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
112 112
 			$entry
113 113
 		);
114 114
 		$data['data.class'] = $data['data.error'] = '';
115
-		if( array_search( $entry['s1'], glsr_array_column( $this->entries(), 'msgid' )) === false ) {
115
+		if( array_search( $entry['s1'], glsr_array_column( $this->entries(), 'msgid' ) ) === false ) {
116 116
 			$data['data.class'] = 'is-invalid';
117 117
 			$data['data.error'] = __( 'This custom translation is no longer valid as the original text has been changed or removed.', 'site-reviews' );
118 118
 		}
119 119
 		return glsr( Template::class )->build( 'partials/translations/'.$template, [
120 120
 			'context' => $data,
121
-		]);
121
+		] );
122 122
 	}
123 123
 
124 124
 	/**
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
151 151
 				's1' => $this->getEntryString( $entry, 'msgid' ),
152 152
 			];
153
-			$text = !empty( $data['p1'] )
153
+			$text = !empty($data['p1'])
154 154
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
155 155
 				: $data['s1'];
156 156
 			$rendered .= $this->render( 'result', [
157
-				'entry' => json_encode( $data, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ),
157
+				'entry' => json_encode( $data, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ),
158 158
 				'text' => wp_strip_all_tags( $text ),
159
-			]);
159
+			] );
160 160
 		}
161 161
 		if( $resetAfterRender ) {
162 162
 			$this->reset();
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 	public function search( $needle = '' )
190 190
 	{
191 191
 		$this->reset();
192
-		$needle = trim( strtolower( $needle ));
192
+		$needle = trim( strtolower( $needle ) );
193 193
 		foreach( $this->entries() as $key => $entry ) {
194
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
195
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
194
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
195
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
196 196
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
197
-				if( in_array( $needle, [$single, $plural] )) {
197
+				if( in_array( $needle, [$single, $plural] ) ) {
198 198
 					$this->results[$key] = $entry;
199 199
 				}
200 200
 			}
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	public function translations()
213 213
 	{
214 214
 		static $translations;
215
-		if( empty( $translations )) {
215
+		if( empty($translations) ) {
216 216
 			$settings = glsr( OptionManager::class )->get( 'settings' );
217
-			$translations = isset( $settings['strings'] )
218
-				? $this->normalizeSettings( (array) $settings['strings'] )
217
+			$translations = isset($settings['strings'])
218
+				? $this->normalizeSettings( (array)$settings['strings'] )
219 219
 				: [];
220 220
 		}
221 221
 		return $translations;
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	protected function getEntryString( array $entry, $key )
229 229
 	{
230
-		return isset( $entry[$key] )
231
-			? implode( '', (array) $entry[$key] )
230
+		return isset($entry[$key])
231
+			? implode( '', (array)$entry[$key] )
232 232
 			: '';
233 233
 	}
234 234
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		$keys = [
241 241
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
242 242
 		];
243
-		array_walk( $entries, function( &$entry ) use( $keys ) {
243
+		array_walk( $entries, function( &$entry ) use($keys) {
244 244
 			foreach( $keys as $key ) {
245 245
 				try {
246 246
 					$entry = $this->normalizeEntryString( $entry, $key );
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	protected function normalizeEntryString( array $entry, $key )
262 262
 	{
263
-		if( isset( $entry[$key] )) {
263
+		if( isset($entry[$key]) ) {
264 264
 			$entry[$key] = $this->getEntryString( $entry, $key );
265 265
 		}
266 266
 		return $entry;
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
275 275
 		$strings = array_filter( $strings, 'is_array' );
276 276
 		foreach( $strings as &$string ) {
277
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
277
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
278 278
 			$string = wp_parse_args( $string, $defaultString );
279 279
 		}
280 280
 		return array_filter( $strings, function( $string ) {
281
-			return !empty( $string['id'] );
281
+			return !empty($string['id']);
282 282
 		});
283 283
 	}
284 284
 }
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	public function callbackRegisterSettings( $input )
19 19
 	{
20
-		if( !is_array( $input )) {
20
+		if( !is_array( $input ) ) {
21 21
 			$input = ['settings' => []];
22 22
 		}
23 23
 		if( key( $input ) == 'settings' ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$options = $this->sanitizeSubmissions( $input, $options );
27 27
 			$options = $this->sanitizeTranslations( $input, $options );
28 28
 			if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
29
-				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
29
+				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
30 30
 			}
31 31
 			return $options;
32 32
 		}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
43 43
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
44
-		]);
44
+		] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	protected function sanitizeSubmissions( array $input, array $options )
67 67
 	{
68 68
 		$inputForm = $input['settings']['submissions'];
69
-		$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
69
+		$options['settings']['submissions']['required'] = isset($inputForm['required'])
70 70
 			? $inputForm['required']
71 71
 			: [];
72 72
 		return $options;
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	protected function sanitizeTranslations( array $input, array $options )
79 79
 	{
80
-		if( isset( $input['settings']['strings'] )) {
81
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
80
+		if( isset($input['settings']['strings']) ) {
81
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
82 82
 			$allowedTags = [
83 83
 				'a' => ['class' => [], 'href' => [], 'target' => []],
84 84
 				'span' => ['class' => []],
85 85
 			];
86
-			array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) {
87
-				if( isset( $string['s2'] )) {
86
+			array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) {
87
+				if( isset($string['s2']) ) {
88 88
 					$string['s2'] = wp_kses( $string['s2'], $allowedTags );
89 89
 				}
90
-				if( isset( $string['p2'] )) {
90
+				if( isset($string['p2']) ) {
91 91
 					$string['p2'] = wp_kses( $string['p2'], $allowedTags );
92 92
 				}
93 93
 			});
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	protected function isPolylangActiveAndSupported()
102 102
 	{
103 103
 		if( !glsr( Polylang::class )->isActive() ) {
104
-			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ));
104
+			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
105 105
 			return false;
106 106
 		}
107 107
 		else if( !glsr( Polylang::class )->isSupported() ) {
108
-			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ));
108
+			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
109 109
 			return false;
110 110
 		}
111 111
 		return true;
Please login to merge, or discard this patch.
deprecated.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 // Database/ReviewManager.php
6 6
 add_action( 'site-reviews/review/created', function( $review ) {
7
-	if( has_action( 'site-reviews/local/review/create' )) {
7
+	if( has_action( 'site-reviews/local/review/create' ) ) {
8 8
 		glsr()->deprecated[] = 'The "site-reviews/local/review/create" hook has been deprecated. Please use the "site-reviews/review/created" hook instead.';
9 9
 		do_action( 'site-reviews/local/review/create', (array)get_post( $review->ID ), (array)$review, $review->ID );
10 10
 	}
@@ -12,18 +12,18 @@  discard block
 block discarded – undo
12 12
 
13 13
 // Handlers/CreateReview.php
14 14
 add_action( 'site-reviews/review/submitted', function( $review ) {
15
-	if( has_action( 'site-reviews/local/review/submitted' )) {
15
+	if( has_action( 'site-reviews/local/review/submitted' ) ) {
16 16
 		glsr()->deprecated[] = 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.';
17 17
 		do_action( 'site-reviews/local/review/submitted', null, $review );
18 18
 	}
19
-	if( has_filter( 'site-reviews/local/review/submitted/message' )) {
19
+	if( has_filter( 'site-reviews/local/review/submitted/message' ) ) {
20 20
 		glsr()->deprecated[] = 'The "site-reviews/local/review/submitted/message" hook has been deprecated.';
21 21
 	}
22 22
 }, 9 );
23 23
 
24 24
 // Database/ReviewManager.php
25 25
 add_filter( 'site-reviews/create/review-values', function( $values, $command ) {
26
-	if( has_filter( 'site-reviews/local/review' )) {
26
+	if( has_filter( 'site-reviews/local/review' ) ) {
27 27
 		glsr()->deprecated[] = 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.';
28 28
 		return apply_filters( 'site-reviews/local/review', $values, $command );
29 29
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 // Handlers/EnqueuePublicAssets.php
34 34
 add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) {
35
-	if( has_filter( 'site-reviews/enqueue/localize' )) {
35
+	if( has_filter( 'site-reviews/enqueue/localize' ) ) {
36 36
 		glsr()->deprecated[] = 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.';
37 37
 		return apply_filters( 'site-reviews/enqueue/localize', $variables );
38 38
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Modules/Rating.php
43 43
 add_filter( 'site-reviews/rating/average', function( $average ) {
44
-	if( has_filter( 'site-reviews/average/rating' )) {
44
+	if( has_filter( 'site-reviews/average/rating' ) ) {
45 45
 		glsr()->deprecated[] = 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.';
46 46
 	}
47 47
 	return $average;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 // Modules/Rating.php
51 51
 add_filter( 'site-reviews/rating/ranking', function( $ranking ) {
52
-	if( has_filter( 'site-reviews/bayesian/ranking' )) {
52
+	if( has_filter( 'site-reviews/bayesian/ranking' ) ) {
53 53
 		glsr()->deprecated[] = 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.';
54 54
 	}
55 55
 	return $ranking;
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 // Modules/Html/Partials/SiteReviews.php
59 59
 add_filter( 'site-reviews/review/build/after', function( $renderedFields ) {
60
-	if( has_filter( 'site-reviews/reviews/review/text' )) {
60
+	if( has_filter( 'site-reviews/reviews/review/text' ) ) {
61 61
 		glsr()->deprecated[] = 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.';
62 62
 	}
63
-	if( has_filter( 'site-reviews/reviews/review/title' )) {
63
+	if( has_filter( 'site-reviews/reviews/review/title' ) ) {
64 64
 		glsr()->deprecated[] = 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.';
65 65
 	}
66 66
 	return $renderedFields;
@@ -68,26 +68,26 @@  discard block
 block discarded – undo
68 68
 
69 69
 // Modules/Html/Partials/SiteReviews.php
70 70
 add_filter( 'site-reviews/review/build/before', function( $review ) {
71
-	if( has_filter( 'site-reviews/rendered/review' )) {
71
+	if( has_filter( 'site-reviews/rendered/review' ) ) {
72 72
 		glsr()->deprecated[] = 'The "site-reviews/rendered/review" hook has been deprecated. Please either use a custom "review.php" template (refer to the documentation), or use the "site-reviews/review/build/after" hook instead.';
73 73
 	}
74
-	if( has_filter( 'site-reviews/rendered/review/meta/order' )) {
74
+	if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) {
75 75
 		glsr()->deprecated[] = 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).';
76 76
 	}
77
-	if( has_filter( 'site-reviews/rendered/review/order' )) {
77
+	if( has_filter( 'site-reviews/rendered/review/order' ) ) {
78 78
 		glsr()->deprecated[] = 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).';
79 79
 	}
80
-	if( has_filter( 'site-reviews/rendered/review-form/login-register' )) {
80
+	if( has_filter( 'site-reviews/rendered/review-form/login-register' ) ) {
81 81
 		glsr()->deprecated[] = 'The "site-reviews/rendered/review-form/login-register" hook has been deprecated. Please use a custom "login-register.php" template instead (refer to the documentation).';
82 82
 	}
83
-	if( has_filter( 'site-reviews/reviews/navigation_links' )) {
83
+	if( has_filter( 'site-reviews/reviews/navigation_links' ) ) {
84 84
 		glsr()->deprecated[] = 'The "site-reviews/reviews/navigation_links" hook has been deprecated. Please use a custom "pagination.php" template instead (refer to the documentation).';
85 85
 	}
86 86
 	return $review;
87 87
 }, 9 );
88 88
 
89 89
 add_filter( 'site-reviews/validate/custom', function( $result, $request ) {
90
-	if( has_filter( 'site-reviews/validate/review/submission' )) {
90
+	if( has_filter( 'site-reviews/validate/review/submission' ) ) {
91 91
 		glsr_log()->warning( 'The "site-reviews/validate/review/submission" hook has been deprecated. Please use the "site-reviews/validate/custom" hook instead.' );
92 92
 		return apply_filters( 'site-reviews/validate/review/submission', $result, $request );
93 93
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 }, 9, 2 );
96 96
 
97 97
 add_filter( 'site-reviews/views/file', function( $file, $view, $data ) {
98
-	if( has_filter( 'site-reviews/addon/views/file' )) {
98
+	if( has_filter( 'site-reviews/addon/views/file' ) ) {
99 99
 		glsr()->deprecated[] = 'The "site-reviews/addon/views/file" hook has been deprecated. Please use the "site-reviews/views/file" hook instead.';
100 100
 		$file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data );
101 101
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 }, 9, 3 );
104 104
 
105 105
 add_action( 'wp_footer', function() {
106
-	$notices = array_keys( array_flip( glsr()->deprecated ));
106
+	$notices = array_keys( array_flip( glsr()->deprecated ) );
107 107
 	natsort( $notices );
108 108
 	foreach( $notices as $notice ) {
109 109
 		glsr_log()->warning( $notice );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$this->args = $args;
36 36
 		$this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args );
37
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
37
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) )return;
38 38
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
39 39
 		$this->generateSchema();
40 40
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				'stars' => $this->buildStars(),
48 48
 				'text' => $this->buildText(),
49 49
 			],
50
-		]);
50
+		] );
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	protected function buildPercentage()
57 57
 	{
58
-		if( $this->isHidden( 'bars' ))return;
59
-		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
60
-		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) {
58
+		if( $this->isHidden( 'bars' ) )return;
59
+		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) );
60
+		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use($percentages) {
61 61
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
62 62
 			$background = $this->buildPercentageBackground( $percentages[$level] );
63 63
 			$count = apply_filters( 'site-reviews/summary/counts',
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			$percent = $this->buildPercentageCount( $count );
68 68
 			return $carry.glsr( Builder::class )->div( $label.$background.$percent, [
69 69
 				'class' => 'glsr-bar',
70
-			]);
70
+			] );
71 71
 		});
72 72
 		return $this->wrap( 'percentage', $bars );
73 73
 	}
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	protected function buildPercentageBackground( $percent )
80 80
 	{
81
-		$backgroundPercent = glsr( Builder::class )->span([
81
+		$backgroundPercent = glsr( Builder::class )->span( [
82 82
 			'class' => 'glsr-bar-background-percent',
83 83
 			'style' => 'width:'.$percent,
84
-		]);
84
+		] );
85 85
 		return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>';
86 86
 	}
87 87
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function buildRating()
110 110
 	{
111
-		if( $this->isHidden( 'rating' ))return;
111
+		if( $this->isHidden( 'rating' ) )return;
112 112
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
113 113
 	}
114 114
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function buildStars()
119 119
 	{
120
-		if( $this->isHidden( 'stars' ))return;
120
+		if( $this->isHidden( 'stars' ) )return;
121 121
 		$stars = glsr_star_rating( $this->averageRating );
122 122
 		return $this->wrap( 'stars', $stars );
123 123
 	}
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function buildText()
129 129
 	{
130
-		if( $this->isHidden( 'summary' ))return;
131
-		$count = intval( array_sum( $this->ratingCounts ));
132
-		if( empty( $this->args['text'] )) {
130
+		if( $this->isHidden( 'summary' ) )return;
131
+		$count = intval( array_sum( $this->ratingCounts ) );
132
+		if( empty($this->args['text']) ) {
133 133
 			// @todo document this change
134 134
 			 $this->args['text'] = _nx(
135 135
 				'{rating} out of {max} stars (based on {num} review)',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			);
141 141
 		}
142 142
 		$summary = str_replace(
143
-			['{rating}','{max}', '{num}'],
143
+			['{rating}', '{max}', '{num}'],
144 144
 			[$this->averageRating, Rating::MAX_RATING, $count],
145 145
 			$this->args['text']
146 146
 		);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	protected function generateSchema()
154 154
 	{
155
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
155
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
156 156
 		glsr( Schema::class )->store(
157 157
 			glsr( Schema::class )->buildSummary( $this->args )
158 158
 		);
@@ -184,6 +184,6 @@  discard block
 block discarded – undo
184 184
 	{
185 185
 		return glsr( Builder::class )->div( $value, [
186 186
 			'class' => 'glsr-summary-'.$key,
187
-		]);
187
+		] );
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$this->args = $args;
36 36
 		$this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args );
37
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
37
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) {
38
+			return;
39
+		}
38 40
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
39 41
 		$this->generateSchema();
40 42
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 	 */
56 58
 	protected function buildPercentage()
57 59
 	{
58
-		if( $this->isHidden( 'bars' ))return;
60
+		if( $this->isHidden( 'bars' )) {
61
+			return;
62
+		}
59 63
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
60 64
 		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) {
61 65
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
@@ -108,7 +112,9 @@  discard block
 block discarded – undo
108 112
 	 */
109 113
 	protected function buildRating()
110 114
 	{
111
-		if( $this->isHidden( 'rating' ))return;
115
+		if( $this->isHidden( 'rating' )) {
116
+			return;
117
+		}
112 118
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
113 119
 	}
114 120
 
@@ -117,7 +123,9 @@  discard block
 block discarded – undo
117 123
 	 */
118 124
 	protected function buildStars()
119 125
 	{
120
-		if( $this->isHidden( 'stars' ))return;
126
+		if( $this->isHidden( 'stars' )) {
127
+			return;
128
+		}
121 129
 		$stars = glsr_star_rating( $this->averageRating );
122 130
 		return $this->wrap( 'stars', $stars );
123 131
 	}
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 	 */
128 136
 	protected function buildText()
129 137
 	{
130
-		if( $this->isHidden( 'summary' ))return;
138
+		if( $this->isHidden( 'summary' )) {
139
+			return;
140
+		}
131 141
 		$count = intval( array_sum( $this->ratingCounts ));
132 142
 		if( empty( $this->args['text'] )) {
133 143
 			// @todo document this change
@@ -152,7 +162,9 @@  discard block
 block discarded – undo
152 162
 	 */
153 163
 	protected function generateSchema()
154 164
 	{
155
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
165
+		if( !wp_validate_boolean( $this->args['schema'] )) {
166
+			return;
167
+		}
156 168
 		glsr( Schema::class )->store(
157 169
 			glsr( Schema::class )->buildSummary( $this->args )
158 170
 		);
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function saveAssignedToMetabox( $postId )
14 14
 	{
15
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
16
-		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
15
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return;
16
+		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) );
17 17
 		update_post_meta( $postId, 'assigned_to', $assignedTo );
18 18
 	}
19 19
 
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function saveResponseMetabox( $postId )
25 25
 	{
26
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
27
-		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
26
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return;
27
+		$response = strval( glsr( Helper::class )->filterInput( 'response' ) );
28 28
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
29 29
 			'a' => ['href' => [], 'title' => []],
30 30
 			'em' => [],
31 31
 			'strong' => [],
32
-		])));
32
+		] ) ) );
33 33
 	}
34 34
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function saveAssignedToMetabox( $postId )
14 14
 	{
15
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
15
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
16
+			return;
17
+		}
16 18
 		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
17 19
 		update_post_meta( $postId, 'assigned_to', $assignedTo );
18 20
 	}
@@ -23,7 +25,9 @@  discard block
 block discarded – undo
23 25
 	 */
24 26
 	public function saveResponseMetabox( $postId )
25 27
 	{
26
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
28
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
29
+			return;
30
+		}
27 31
 		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
28 32
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
29 33
 			'a' => ['href' => [], 'title' => []],
Please login to merge, or discard this patch.
plugin/Database/SqlQueries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function deleteAllSessions( $sessionCookiePrefix )
23 23
 	{
24
-		return $this->db->query("
24
+		return $this->db->query( "
25 25
 			DELETE
26 26
 			FROM {$this->db->options}
27 27
 			WHERE option_name LIKE '{$sessionCookiePrefix}_%'
28
-		");
28
+		" );
29 29
 	}
30 30
 
31 31
 	/**
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function deleteExpiredSessions( $expiredSessions )
36 36
 	{
37
-		return $this->db->query("
37
+		return $this->db->query( "
38 38
 			DELETE
39 39
 			FROM {$this->db->options}
40 40
 			WHERE option_name IN ('{$expiredSessions}')
41
-		");
41
+		" );
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function getExpiredSessions( $sessionCookiePrefix, $limit )
50 50
 	{
51
-		return $this->db->get_results("
51
+		return $this->db->get_results( "
52 52
 			SELECT option_name AS name, option_value AS expiration
53 53
 			FROM {$this->db->options}
54 54
 			WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%'
55 55
 			ORDER BY option_value ASC
56 56
 			LIMIT 0, {$limit}
57
-		");
57
+		" );
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function getPostIdFromReviewId( $metaReviewId )
65 65
 	{
66
-		$postId = $this->db->get_var("
66
+		$postId = $this->db->get_var( "
67 67
 			SELECT p.ID
68 68
 			FROM {$this->db->posts} AS p
69 69
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
70 70
 			WHERE p.post_type = '{Application::POST_TYPE}'
71 71
 			AND m.meta_key = 'review_id'
72 72
 			AND m.meta_value = '{$metaReviewId}'
73
-		");
73
+		" );
74 74
 		return intval( $postId );
75 75
 	}
76 76
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function getReviewCounts( array $args, $lastPostId = 0, $limit = 500 )
83 83
 	{
84
-		return $this->db->get_results("
84
+		return $this->db->get_results( "
85 85
 			SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type
86 86
 			FROM {$this->db->posts} AS p
87 87
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function getReviewCountsFor( $metaKey )
106 106
 	{
107
-		return (array) $this->db->get_results("
107
+		return (array)$this->db->get_results( "
108 108
 			SELECT m.meta_value AS name, COUNT(*) num_posts
109 109
 			FROM {$this->db->posts} AS p
110 110
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
111 111
 			WHERE p.post_type = '{Application::POST_TYPE}'
112 112
 			AND m.meta_key = '{$metaKey}'
113 113
 			GROUP BY name
114
-		");
114
+		" );
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getReviewIdsByType( $reviewType )
122 122
 	{
123
-		$query = $this->db->get_col("
123
+		$query = $this->db->get_col( "
124 124
 			SELECT m1.meta_value AS review_id
125 125
 			FROM {$this->db->posts} AS p
126 126
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			AND m1.meta_key = 'review_id'
130 130
 			AND m2.meta_key = 'review_type'
131 131
 			AND m2.meta_value = '{$reviewType}'
132
-		");
133
-		return array_keys( array_flip( $query ));
132
+		" );
133
+		return array_keys( array_flip( $query ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 )
142 142
 	{
143 143
 		sort( $postIds );
144
-		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds )), $limit );
144
+		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit );
145 145
 		$postIds = implode( ',', $postIds );
146
-		return $this->db->get_results("
146
+		return $this->db->get_results( "
147 147
 			SELECT p.ID, m.meta_value AS rating
148 148
 			FROM {$this->db->posts} AS p
149 149
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$queryBuilder = glsr( QueryBuilder::class );
168 168
 		$key = $queryBuilder->buildSqlOr( $key, "m.meta_key = '%s'" );
169 169
 		$status = $queryBuilder->buildSqlOr( $status, "p.post_status = '%s'" );
170
-		return $this->db->get_col("
170
+		return $this->db->get_col( "
171 171
 			SELECT DISTINCT m.meta_value
172 172
 			FROM {$this->db->postmeta} m
173 173
 			LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			AND ({$key})
176 176
 			AND ({$status})
177 177
 			ORDER BY m.meta_value
178
-		");
178
+		" );
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getAndForCounts( array $args, $and = '' )
186 186
 	{
187
-		if( !empty( $args['post_id'] )) {
188
-			$and.= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}";
187
+		if( !empty($args['post_id']) ) {
188
+			$and .= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}";
189 189
 		}
190
-		if( !empty( $args['term_taxonomy_id'] )) {
191
-			$and.= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}";
190
+		if( !empty($args['term_taxonomy_id']) ) {
191
+			$and .= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}";
192 192
 		}
193 193
 		return $and;
194 194
 	}
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function getInnerJoinForCounts( array $args, $innerJoin = '' )
201 201
 	{
202
-		if( !empty( $args['post_id'] )) {
203
-			$innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id";
202
+		if( !empty($args['post_id']) ) {
203
+			$innerJoin .= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id";
204 204
 		}
205
-		if( !empty( $args['term_taxonomy_id'] )) {
206
-			$innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id";
205
+		if( !empty($args['term_taxonomy_id']) ) {
206
+			$innerJoin .= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id";
207 207
 		}
208 208
 		return $innerJoin;
209 209
 	}
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
26 26
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 27
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 28
 				'class' => 'pending-count',
29
-			]);
29
+			] );
30 30
 			$awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
31 31
 				'class' => 'awaiting-mod count-'.$postCount->pending,
32
-			]);
32
+			] );
33 33
 			$menu[$key][0] .= ' '.$awaitingModeration;
34 34
 			if( $typenow === Application::POST_TYPE ) {
35
-				$menu[$key][4].= ' current';
35
+				$menu[$key][4] .= ' current';
36 36
 			}
37 37
 			break;
38 38
 		}
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 			'tools' => __( 'Tools', 'site-reviews' ),
50 50
 			'addons' => __( 'Add-ons', 'site-reviews' ),
51 51
 			'documentation' => __( 'Documentation', 'site-reviews' ),
52
-		]);
52
+		] );
53 53
 		foreach( $pages as $slug => $title ) {
54 54
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 55
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
56
+			if( !is_callable( $callback ) )continue;
57 57
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$this->renderPage( 'addons', [
69 69
 			'template' => glsr( Template::class ),
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 			'hooks' => __( 'Hooks', 'site-reviews' ),
85 85
 			'functions' => __( 'Functions', 'site-reviews' ),
86 86
 			'addons' => __( 'Addons', 'site-reviews' ),
87
-		]);
87
+		] );
88 88
 		$addons = apply_filters( 'site-reviews/addon/documentation', [] );
89 89
 		ksort( $addons );
90
-		if( empty( $addons )) {
91
-			unset( $tabs['addons'] );
90
+		if( empty($addons) ) {
91
+			unset($tabs['addons']);
92 92
 		}
93 93
 		$this->renderPage( 'documentation', [
94 94
 			'addons' => $addons,
95 95
 			'tabs' => $tabs,
96
-		]);
96
+		] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 			'translations' => __( 'Translations', 'site-reviews' ),
112 112
 			'addons' => __( 'Addons', 'site-reviews' ),
113 113
 			'licenses' => __( 'Licenses', 'site-reviews' ),
114
-		]);
115
-		if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' ))) {
116
-			unset( $tabs['addons'] );
114
+		] );
115
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' )) ) {
116
+			unset($tabs['addons']);
117 117
 		}
118
-		if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' ))) {
119
-			unset( $tabs['licenses'] );
118
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' )) ) {
119
+			unset($tabs['licenses']);
120 120
 		}
121 121
 		$this->renderPage( 'settings', [
122 122
 			'notices' => $this->getNotices(),
123 123
 			'settings' => glsr( Settings::class ),
124 124
 			'tabs' => $tabs,
125
-		]);
125
+		] );
126 126
 	}
127 127
 
128 128
 	/**
@@ -137,24 +137,24 @@  discard block
 block discarded – undo
137 137
 			'sync' => __( 'Sync Reviews', 'site-reviews' ),
138 138
 			'console' => __( 'Console', 'site-reviews' ),
139 139
 			'system-info' => __( 'System Info', 'site-reviews' ),
140
-		]);
141
-		if( !apply_filters( 'site-reviews/addon/sync/enable', false )) {
142
-			unset( $tabs['sync'] );
140
+		] );
141
+		if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
142
+			unset($tabs['sync']);
143 143
 		}
144 144
 		$this->renderPage( 'tools', [
145 145
 			'data' => [
146 146
 				'context' => [
147 147
 					'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ),
148
-					'console' => strval( glsr( Console::class )),
148
+					'console' => strval( glsr( Console::class ) ),
149 149
 					'id' => Application::ID,
150
-					'system' => strval( glsr( System::class )),
150
+					'system' => strval( glsr( System::class ) ),
151 151
 				],
152 152
 				'services' => apply_filters( 'site-reviews/addon/sync/services', [] ),
153 153
 			],
154 154
 			'notices' => $this->getNotices(),
155 155
 			'tabs' => $tabs,
156 156
 			'template' => glsr( Template::class ),
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	{
176 176
 		return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
177 177
 			'id' => 'glsr-notices',
178
-		]);
178
+		] );
179 179
 	}
180 180
 
181 181
 	/**
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) {
26
+				continue;
27
+			}
26 28
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 29
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 30
 				'class' => 'pending-count',
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 		foreach( $pages as $slug => $title ) {
54 56
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 57
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
58
+			if( !is_callable( $callback )) {
59
+				continue;
60
+			}
57 61
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
58 62
 		}
59 63
 	}
Please login to merge, or discard this patch.