Passed
Push — master ( 66df2e...d26ef1 )
by Paul
03:43
created
plugin/Handlers/EnqueueAssets.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 		$this->dependencies = glsr( Html::class )->getDependencies();
22 22
 		$ajaxNonce = wp_create_nonce( Application::ID.'-ajax-nonce' );
23 23
 		$variables = [
24
-			'action'  => glsr()->prefix . '_action',
25
-			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' )),
24
+			'action'  => glsr()->prefix.'_action',
25
+			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' ) ),
26 26
 			'ajaxnonce' => $ajaxNonce,
27
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
27
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
28 28
 		];
29 29
 		$this->enqueue();
30
-		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ));
30
+		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ) );
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function enqueue()
37 37
 	{
38
-		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ));
38
+		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ) );
39 39
 		$stylesheet = file_exists( glsr()->path.'assets/css/'.$currentTheme.'.css' )
40 40
 			? glsr()->url.'assets/css/'.$currentTheme.'.css'
41 41
 			: glsr()->url.'assets/css/'.Application::ID.'.css';
42
-		if( apply_filters( 'site-reviews/assets/css', true )) {
42
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
43 43
 			wp_enqueue_style(
44 44
 				Application::ID,
45 45
 				$stylesheet,
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				glsr()->version
48 48
 			);
49 49
 		}
50
-		if( apply_filters( 'site-reviews/assets/js', true )) {
50
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
51 51
 			wp_enqueue_script(
52 52
 				Application::ID,
53 53
 				glsr()->url.'assets/js/'.Application::ID.'.js',
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function enqueueRecaptchaScript()
68 68
 	{
69
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
69
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
70 70
 			'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ),
71 71
 			'onload' => 'glsr_render_recaptcha',
72 72
 			'render' => 'explicit',
73
-		], 'https://www.google.com/recaptcha/api.js' ));
73
+		], 'https://www.google.com/recaptcha/api.js' ) );
74 74
 		$inlineScript = file_get_contents( glsr()->path.'js/recaptcha.js' );
75 75
 		wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' );
76 76
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,9 +57,13 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty( $field )) {
61
+				return;
62
+			}
61 63
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
64
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
65
+				return;
66
+			}
63 67
 			return $this->$method( $field );
64 68
 		}, $fields );
65 69
 		return array_values( array_filter( $generatedFields ));
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 		if( !empty( $this->errors )) {
75 79
 			$errors = [];
76 80
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
81
+				if( false !== array_search( $name, array_column( $fields, 'name' ))) {
82
+					continue;
83
+				}
78 84
 				$errors[] = $this->errors[$name];
79 85
 			}
80 86
 			$this->errors = $errors;
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function normalizeContainer( array $field )
120 126
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
127
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
128
+			return;
129
+		}
122 130
 		$field['items'] = $this->generateFields( $field['items'] );
123 131
 		return $field;
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function normalizeField( array $field, array $defaults )
130 138
 	{
131
-		if( !$this->validate( $field ))return;
139
+		if( !$this->validate( $field )) {
140
+			return;
141
+		}
132 142
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 143
 			return $value !== '';
134 144
 		});
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 			'type' => '',
150 160
 			'value' => '',
151 161
 		]);
152
-		if( !is_array( $listbox ))return;
162
+		if( !is_array( $listbox )) {
163
+			return;
164
+		}
153 165
 		if( !array_key_exists( '', $listbox['options'] )) {
154 166
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 167
 		}
Please login to merge, or discard this patch.
plugin/Modules/Date.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 		$diff = time() - strtotime( $date );
32 32
 		foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
33 33
 			if( $diff > $timePeriod[0] )continue;
34
-			$unit = intval( floor( $diff / $timePeriod[1] ));
34
+			$unit = intval( floor( $diff / $timePeriod[1] ) );
35 35
 			$relativeDates = [
36 36
 				_n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
37 37
 				_n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 	{
31 31
 		$diff = time() - strtotime( $date );
32 32
 		foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
33
-			if( $diff > $timePeriod[0] )continue;
33
+			if( $diff > $timePeriod[0] ) {
34
+				continue;
35
+			}
34 36
 			$unit = intval( floor( $diff / $timePeriod[1] ));
35 37
 			$relativeDates = [
36 38
 				_n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$translations = $this->getSettings();
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,10 +43,10 @@  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
 				$entries = $this->normalize(
49
-					Parser::parseFile( glsr()->path( 'languages/site-reviews.pot' ))->getEntries()
49
+					Parser::parseFile( glsr()->path( 'languages/site-reviews.pot' ) )->getEntries()
50 50
 				);
51 51
 			}
52 52
 			catch( Exception $e ) {
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
79 79
 	{
80
-		if( !is_array( $entries )) {
80
+		if( !is_array( $entries ) ) {
81 81
 			$entries = $this->results;
82 82
 		}
83
-		if( !is_array( $filterWith )) {
83
+		if( !is_array( $filterWith ) ) {
84 84
 			$filterWith = $this->getSettings();
85 85
 		}
86
-		$keys = array_flip( array_column( $filterWith, 'id' ));
86
+		$keys = array_flip( array_column( $filterWith, 'id' ) );
87 87
 		$this->results = $intersect
88 88
 			? array_intersect_key( $entries, $keys )
89 89
 			: array_diff_key( $entries, $keys );
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		return $this->translate( $translation, $domain, [
102 102
 			'single' => $text,
103
-		]);
103
+		] );
104 104
 	}
105 105
 
106 106
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		return $this->translate( $translation, $domain, [
116 116
 			'context' => $context,
117 117
 			'single' => $text,
118
-		]);
118
+		] );
119 119
 	}
120 120
 
121 121
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			'number' => $number,
133 133
 			'plural' => $plural,
134 134
 			'single' => $single,
135
-		]);
135
+		] );
136 136
 	}
137 137
 
138 138
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			'number' => $number,
152 152
 			'plural' => $plural,
153 153
 			'single' => $single,
154
-		]);
154
+		] );
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	public function render( $template, array $entry )
162 162
 	{
163 163
 		$data = array_combine(
164
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
164
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
165 165
 			$entry
166 166
 		);
167 167
 		ob_start();
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
199 199
 				's1' => $this->getEntryString( $entry, 'msgid' ),
200 200
 			];
201
-			$text = !empty( $data['p1'] )
201
+			$text = !empty($data['p1'])
202 202
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
203 203
 				: $data['s1'];
204 204
 			$rendered .= $this->render( 'result', [
205 205
 				'entry' => wp_json_encode( $data ),
206 206
 				'text' => wp_strip_all_tags( $text ),
207
-			]);
207
+			] );
208 208
 		}
209 209
 		if( $resetAfterRender ) {
210 210
 			$this->reset();
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 	public function search( $needle = '' )
238 238
 	{
239 239
 		$this->reset();
240
-		$needle = trim( strtolower( $needle ));
240
+		$needle = trim( strtolower( $needle ) );
241 241
 		foreach( $this->entries() as $key => $entry ) {
242
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
243
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
242
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
243
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
244 244
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
245
-				if( in_array( $needle, [$single, $plural] )) {
245
+				if( in_array( $needle, [$single, $plural] ) ) {
246 246
 					$this->results[$key] = $entry;
247 247
 				}
248 248
 			}
@@ -266,19 +266,19 @@  discard block
 block discarded – undo
266 266
 		$args = $this->normalizeTranslationArgs( $args );
267 267
 		extract( $args );
268 268
 		$strings = $this->getSettings();
269
-		$strings = array_filter( $strings, function( $string ) use( $single, $plural ) {
269
+		$strings = array_filter( $strings, function( $string ) use($single, $plural) {
270 270
 			return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' )
271 271
 				&& $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' );
272 272
 		});
273
-		if( empty( $strings )) {
273
+		if( empty($strings) ) {
274 274
 			return $original;
275 275
 		}
276 276
 		$string = current( $strings );
277 277
 		$translations = get_translations_for_domain( $domain );
278
-		if( !empty( $string['s2'] )) {
278
+		if( !empty($string['s2']) ) {
279 279
 			$single = $string['s2'];
280 280
 		}
281
-		if( !empty( $string['p2'] )) {
281
+		if( !empty($string['p2']) ) {
282 282
 			$plural = $string['p2'];
283 283
 		}
284 284
 		return $string['type'] == 'plural'
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	protected function getEntryString( array $entry, $key )
294 294
 	{
295
-		return isset( $entry[$key] )
296
-			? implode( '', (array) $entry[$key] )
295
+		return isset($entry[$key])
296
+			? implode( '', (array)$entry[$key] )
297 297
 			: '';
298 298
 	}
299 299
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 	protected function getSettings()
304 304
 	{
305 305
 		$settings = glsr( OptionManager::class )->get( 'settings' );
306
-		return isset( $settings['strings'] )
307
-			? $this->normalizeSettings( (array) $settings['strings'] )
306
+		return isset($settings['strings'])
307
+			? $this->normalizeSettings( (array)$settings['strings'] )
308 308
 			: [];
309 309
 	}
310 310
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		$keys = [
317 317
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
318 318
 		];
319
-		array_walk( $entries, function( &$entry ) use( $keys ) {
319
+		array_walk( $entries, function( &$entry ) use($keys) {
320 320
 			foreach( $keys as $key ) {
321 321
 				$entry = $this->normalizeEntryString( $entry, $key );
322 322
 			}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	protected function normalizeEntryString( array $entry, $key )
332 332
 	{
333
-		if( isset( $entry[$key] )) {
333
+		if( isset($entry[$key]) ) {
334 334
 			$entry[$key] = $this->getEntryString( $entry, $key );
335 335
 		}
336 336
 		return $entry;
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
345 345
 		$strings = array_filter( $strings, 'is_array' );
346 346
 		foreach( $strings as &$string ) {
347
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
347
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
348 348
 			$string = wp_parse_args( $string, $defaultString );
349 349
 		}
350 350
 		return array_filter( $strings, function( $string ) {
351
-			return !empty( $string['id'] );
351
+			return !empty($string['id']);
352 352
 		});
353 353
 	}
354 354
 
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function validateRequest( array $request )
57 57
 	{
58
-		if( !$this->isRequestValid( $request )) {
58
+		if( !$this->isRequestValid( $request ) ) {
59 59
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
60 60
 			return $request;
61 61
 		}
62
-		if( empty( $request['title'] )) {
62
+		if( empty($request['title']) ) {
63 63
 			$request['title'] = __( 'No Title', 'site-reviews' );
64 64
 		}
65 65
 		return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request );
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		$rules = array_intersect_key(
74 74
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES ),
75 75
 			array_flip( array_merge(
76
-				['rating','terms'],
76
+				['rating', 'terms'],
77 77
 				glsr( OptionManager::class )->get( 'settings.reviews-form.required', [] )
78
-			))
78
+			) )
79 79
 		);
80
-		$excluded = isset( $request['excluded'] )
80
+		$excluded = isset($request['excluded'])
81 81
 			? json_decode( $request['excluded'] )
82 82
 			: [];
83
-		return array_diff_key( $rules, array_flip( $excluded ));
83
+		return array_diff_key( $rules, array_flip( $excluded ) );
84 84
 	}
85 85
 
86 86
 	/**
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 			return true;
94 94
 		}
95 95
 		$recaptchaResponse = filter_input( INPUT_POST, 'g-recaptcha-response' );
96
-		if( empty( $recaptchaResponse )) {
96
+		if( empty($recaptchaResponse) ) {
97 97
 			return null; //if response is empty we need to return null
98 98
 		}
99 99
 		if( $integration == 'custom' ) {
100 100
 			return $this->isRecaptchaValid( $recaptchaResponse );
101 101
 		}
102 102
 		if( $integration == 'invisible-recaptcha' ) {
103
-			return boolval( apply_filters( 'google_invre_is_valid_request_filter', true ));
103
+			return boolval( apply_filters( 'google_invre_is_valid_request_filter', true ) );
104 104
 		}
105 105
 		return false;
106 106
 	}
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function isRecaptchaValid( $recaptchaResponse )
112 112
 	{
113
-		$endpoint = add_query_arg([
113
+		$endpoint = add_query_arg( [
114 114
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
115 115
 			'response' => $recaptchaResponse,
116 116
 			'secret' => glsr( OptionManager::class )->get( 'settings.reviews-form.recaptcha.secret' ),
117 117
 		], 'https://www.google.com/recaptcha/api/siteverify' );
118
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
118
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
119 119
 			glsr_log()->error( $response->get_error_message() );
120 120
 			return false;
121 121
 		}
122
-		$response = json_decode( wp_remote_retrieve_body( $response ));
123
-		if( !empty( $response->success )) {
122
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
123
+		if( !empty($response->success) ) {
124 124
 			return boolval( $response->success );
125 125
 		}
126 126
 		$errorCodes = [
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	{
144 144
 		$rules = $this->getValidationRules( $request );
145 145
 		$errors = glsr( Validator::class )->validate( $request, $rules );
146
-		if( empty( $errors )) {
146
+		if( empty($errors) ) {
147 147
 			return true;
148 148
 		}
149 149
 		$this->setSessionValues( 'errors', $errors );
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
161 161
 	{
162 162
 		glsr( Session::class )->set( $this->form_id.$type, $value );
163
-		if( !empty( $loggedMessage )) {
163
+		if( !empty($loggedMessage) ) {
164 164
 			glsr_log()->warning( $loggedMessage );
165 165
 			glsr_log()->warning( $this->request );
166 166
 		}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function validateAkismet()
173 173
 	{
174
-		if( !empty( $this->error ))return;
175
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
174
+		if( !empty($this->error) )return;
175
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
176 176
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
177 177
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
178 178
 	}
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	protected function validateBlacklist()
184 184
 	{
185
-		if( !empty( $this->error ))return;
186
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
185
+		if( !empty($this->error) )return;
186
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
187 187
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.action' );
188 188
 		if( $blacklistAction == 'unapprove' ) {
189 189
 			$this->request['blacklisted'] = true;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function validateCustom()
201 201
 	{
202
-		if( !empty( $this->error ))return;
202
+		if( !empty($this->error) )return;
203 203
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
204 204
 		if( $validated === true )return;
205 205
 		$this->setSessionValues( 'errors', [] );
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validateHoneyPot()
216 216
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
217
+		if( !empty($this->error) )return;
218
+		if( empty($this->request['gotcha']) )return;
219 219
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 220
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 221
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	protected function validateRecaptcha()
227 227
 	{
228
-		if( !empty( $this->error ))return;
228
+		if( !empty($this->error) )return;
229 229
 		$isValid = $this->isRecaptchaResponseValid();
230
-		if( is_null( $isValid )) {
230
+		if( is_null( $isValid ) ) {
231 231
 			$this->setSessionValues( 'recaptcha', true );
232 232
 			$this->recaptchaIsUnset = true;
233 233
 		}
Please login to merge, or discard this patch.
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -171,8 +171,12 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function validateAkismet()
173 173
 	{
174
-		if( !empty( $this->error ))return;
175
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
174
+		if( !empty( $this->error )) {
175
+			return;
176
+		}
177
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
178
+			return;
179
+		}
176 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
177 181
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
178 182
 	}
@@ -182,8 +186,12 @@  discard block
 block discarded – undo
182 186
 	 */
183 187
 	protected function validateBlacklist()
184 188
 	{
185
-		if( !empty( $this->error ))return;
186
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty( $this->error )) {
190
+			return;
191
+		}
192
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
193
+			return;
194
+		}
187 195
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.action' );
188 196
 		if( $blacklistAction == 'unapprove' ) {
189 197
 			$this->request['blacklisted'] = true;
@@ -199,9 +207,13 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	protected function validateCustom()
201 209
 	{
202
-		if( !empty( $this->error ))return;
210
+		if( !empty( $this->error )) {
211
+			return;
212
+		}
203 213
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
204
-		if( $validated === true )return;
214
+		if( $validated === true ) {
215
+			return;
216
+		}
205 217
 		$this->setSessionValues( 'errors', [] );
206 218
 		$this->setSessionValues( 'values', $this->request );
207 219
 		$this->error = is_string( $validated )
@@ -214,8 +226,12 @@  discard block
 block discarded – undo
214 226
 	 */
215 227
 	protected function validateHoneyPot()
216 228
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
229
+		if( !empty( $this->error )) {
230
+			return;
231
+		}
232
+		if( empty( $this->request['gotcha'] )) {
233
+			return;
234
+		}
219 235
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 236
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 237
 	}
@@ -225,7 +241,9 @@  discard block
 block discarded – undo
225 241
 	 */
226 242
 	protected function validateRecaptcha()
227 243
 	{
228
-		if( !empty( $this->error ))return;
244
+		if( !empty( $this->error )) {
245
+			return;
246
+		}
229 247
 		$isValid = $this->isRecaptchaResponseValid();
230 248
 		if( is_null( $isValid )) {
231 249
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.
plugin/Modules/ListTable/Columns.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	public function renderFilters( $postType )
16 16
 	{
17 17
 		if( $postType !== Application::POST_TYPE )return;
18
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
18
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
19 19
 			$status = 'publish';
20 20
 		}
21 21
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	protected function buildColumnAssignedTo( $postId )
46 46
 	{
47 47
 		$post = get_post( glsr( Database::class )->getReviewMeta( $postId )->assigned_to );
48
-		if( !( $post instanceof WP_Post ) || $post->post_status != 'publish' ) {
48
+		if( !($post instanceof WP_Post) || $post->post_status != 'publish' ) {
49 49
 			return '&mdash;';
50 50
 		}
51 51
 		return glsr( Builder::class )->a( get_the_title( $post->ID ), [
52 52
 			'href' => (string)get_the_permalink( $post->ID ),
53
-		]);
53
+		] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		return glsr( Html::class )->buildPartial( 'star-rating', [
72 72
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
83 83
 			? ' pinned'
84 84
 			: '';
85
-		return glsr( Builder::class )->i([
85
+		return glsr( Builder::class )->i( [
86 86
 			'class' => trim( 'dashicons dashicons-sticky '.$pinned ),
87 87
 			'data-id' => $postId,
88
-		]);
88
+		] );
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	protected function buildColumnType( $postId )
96 96
 	{
97 97
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
98
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
98
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
99 99
 			? glsr()->reviewTypes[$reviewMeta->review_type]
100 100
 			: $reviewMeta->review_type;
101 101
 	}
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function renderFilterRatings( $ratings )
108 108
 	{
109
-		if( empty( $ratings )
109
+		if( empty($ratings)
110 110
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
111 111
 		)return;
112
-		$ratings = array_flip( array_reverse( $ratings ));
112
+		$ratings = array_flip( array_reverse( $ratings ) );
113 113
 		array_walk( $ratings, function( &$value, $key ) {
114 114
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
115 115
 			$value = sprintf( $label, $key );
116 116
 		});
117 117
 		$ratings = [__( 'All ratings', 'site-reviews' )] + $ratings;
118
-		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ));
118
+		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ) );
119 119
 		glsr( Html::class )->renderPartial( 'filterby', [
120 120
 			'name' => 'rating',
121 121
 			'values' => $ratings,
122
-		]);
122
+		] );
123 123
 	}
124 124
 
125 125
 	/**
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		if( count( glsr()->reviewTypes ) < 2 )return;
132 132
 		$reviewTypes = ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes;
133
-		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
133
+		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ) );
134 134
 		glsr( Html::class )->renderPartial( 'filterby', [
135 135
 			'name' => 'review_type',
136 136
 			'options' => $reviewTypes,
137
-		]);
137
+		] );
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public function renderFilters( $postType )
16 16
 	{
17
-		if( $postType !== Application::POST_TYPE )return;
17
+		if( $postType !== Application::POST_TYPE ) {
18
+			return;
19
+		}
18 20
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
19 21
 			$status = 'publish';
20 22
 		}
@@ -31,7 +33,9 @@  discard block
 block discarded – undo
31 33
 	 */
32 34
 	public function renderValues( $column, $postId )
33 35
 	{
34
-		if( glsr_current_screen()->id != Application::POST_TYPE )return;
36
+		if( glsr_current_screen()->id != Application::POST_TYPE ) {
37
+			return;
38
+		}
35 39
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
36 40
 		echo method_exists( $this, $method )
37 41
 			? call_user_func( [$this, $method], $postId )
@@ -108,7 +112,9 @@  discard block
 block discarded – undo
108 112
 	{
109 113
 		if( empty( $ratings )
110 114
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
111
-		)return;
115
+		) {
116
+			return;
117
+		}
112 118
 		$ratings = array_flip( array_reverse( $ratings ));
113 119
 		array_walk( $ratings, function( &$value, $key ) {
114 120
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -128,7 +134,9 @@  discard block
 block discarded – undo
128 134
 	 */
129 135
 	protected function renderFilterTypes( $types )
130 136
 	{
131
-		if( count( glsr()->reviewTypes ) < 2 )return;
137
+		if( count( glsr()->reviewTypes ) < 2 ) {
138
+			return;
139
+		}
132 140
 		$reviewTypes = ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes;
133 141
 		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
134 142
 		glsr( Html::class )->renderPartial( 'filterby', [
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		natsort( $routines );
17 17
 		array_walk( $routines, function( $routine ) {
18 18
 			$version = str_replace( strtolower( __CLASS__ ).'_', '', $routine );
19
-			if( version_compare( glsr()->version, $version, '>=' ))return;
19
+			if( version_compare( glsr()->version, $version, '>=' ) )return;
20 20
 			call_user_func( [$this, $routine] );
21 21
 		});
22 22
 		$this->updateVersion();
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	public function updateVersion()
29 29
 	{
30 30
 		$currentVersion = glsr( OptionManager::class )->get( 'version' );
31
-		if( version_compare( $currentVersion, glsr()->version, '<' )) {
31
+		if( version_compare( $currentVersion, glsr()->version, '<' ) ) {
32 32
 			glsr( OptionManager::class )->set( 'version', glsr()->version );
33 33
 		}
34 34
 		if( $currentVersion != glsr()->version ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 		natsort( $routines );
17 17
 		array_walk( $routines, function( $routine ) {
18 18
 			$version = str_replace( strtolower( __CLASS__ ).'_', '', $routine );
19
-			if( version_compare( glsr()->version, $version, '>=' ))return;
19
+			if( version_compare( glsr()->version, $version, '>=' )) {
20
+				return;
21
+			}
20 22
 			call_user_func( [$this, $routine] );
21 23
 		});
22 24
 		$this->updateVersion();
@@ -37,5 +39,6 @@  discard block
 block discarded – undo
37 39
 	}
38 40
 
39 41
 	protected function upgrade_3_0_0()
40
-	{}
42
+	{
43
+}
41 44
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function approve()
23 23
 	{
24
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
25
-		wp_update_post([
24
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
25
+		wp_update_post( [
26 26
 			'ID' => $postId,
27 27
 			'post_status' => 'publish',
28
-		]);
28
+		] );
29 29
 		wp_safe_redirect( wp_get_referer() );
30 30
 		exit;
31 31
 	}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
58 58
 			$value = $columns[$key];
59 59
 		}
60
-		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
61
-			unset( $postTypeColumns['review_type'] );
60
+		if( count( glsr( Database::class )->getReviewsMeta( 'type' ) ) < 2 ) {
61
+			unset($postTypeColumns['review_type']);
62 62
 		}
63 63
 		return array_filter( $postTypeColumns, 'strlen' );
64 64
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
85 85
 			return $actions;
86 86
 		}
87
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
87
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
88 88
 		$rowActions = [
89 89
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
90 90
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key ),
98 98
 					$key.'-review_'.$post->ID
99 99
 				),
100
-			]);
100
+			] );
101 101
 		}
102 102
 		return $actions;
103 103
 	}
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	public function filterSortableColumns( array $columns )
110 110
 	{
111 111
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
112
-		unset( $postTypeColumns['cb'] );
112
+		unset($postTypeColumns['cb']);
113 113
 		foreach( $postTypeColumns as $key => $value ) {
114
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
114
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
115 115
 			$columns[$key] = $key;
116 116
 		}
117 117
 		return $columns;
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
131 131
 	{
132
-		if( $this->canModifyTranslation( $domain )) {
132
+		if( $this->canModifyTranslation( $domain ) ) {
133 133
 			$strings = [
134 134
 				'Published' => __( 'Approved', 'site-reviews' ),
135 135
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
136 136
 			];
137 137
 			foreach( $strings as $search => $replace ) {
138 138
 				if( strpos( $single, $search ) === false )continue;
139
-				$translation = $this->getTranslation([
139
+				$translation = $this->getTranslation( [
140 140
 					'number' => $number,
141 141
 					'plural' => str_replace( $search, $replace, $plural ),
142 142
 					'single' => str_replace( $search, $replace, $single ),
143
-				]);
143
+				] );
144 144
 			}
145 145
 		}
146 146
 		return $translation;
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function saveBulkEditFields( $postId )
188 188
 	{
189
-		if( !current_user_can( 'edit_posts' ))return;
189
+		if( !current_user_can( 'edit_posts' ) )return;
190 190
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
191
-		if( $assignedTo && get_post( $assignedTo )) {
191
+		if( $assignedTo && get_post( $assignedTo ) ) {
192 192
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
193 193
 		}
194 194
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function setQueryForColumn( WP_Query $query )
201 201
 	{
202
-		if( !$this->hasPermission( $query ))return;
202
+		if( !$this->hasPermission( $query ) )return;
203 203
 		$this->setMetaQuery( $query, [
204 204
 			'rating', 'review_type',
205
-		]);
205
+		] );
206 206
 		$this->setOrderby( $query );
207 207
 	}
208 208
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function unapprove()
214 214
 	{
215
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
216
-		wp_update_post([
215
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
216
+		wp_update_post( [
217 217
 			'ID' => $postId,
218 218
 			'post_status' => 'pending',
219
-		]);
219
+		] );
220 220
 		wp_safe_redirect( wp_get_referer() );
221 221
 		exit;
222 222
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			'single' => '',
246 246
 			'text' => '',
247 247
 		];
248
-		$args = (object) wp_parse_args( $args, $defaults );
248
+		$args = (object)wp_parse_args( $args, $defaults );
249 249
 		$translations = get_translations_for_domain( Application::ID );
250 250
 		return $args->text
251 251
 			? $translations->translate( $args->text )
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
271 271
 	{
272 272
 		foreach( $metaKeys as $key ) {
273
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
273
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
274 274
 			$metaQuery = (array)$query->get( 'meta_query' );
275 275
 			$metaQuery[] = [
276 276
 				'key' => $key,
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	{
288 288
 		$orderby = $query->get( 'orderby' );
289 289
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
290
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
291
-		if( in_array( $orderby, array_keys( $columns ))) {
290
+		unset($columns['cb'], $columns['title'], $columns['date']);
291
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
292 292
 			$query->set( 'meta_key', $orderby );
293 293
 			$query->set( 'orderby', 'meta_value' );
294 294
 		}
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty( $value )) {
58
+				continue;
59
+			}
58 60
 			$value = $columns[$key];
59 61
 		}
60 62
 		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
112 114
 		unset( $postTypeColumns['cb'] );
113 115
 		foreach( $postTypeColumns as $key => $value ) {
114
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
116
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
117
+				continue;
118
+			}
115 119
 			$columns[$key] = $key;
116 120
 		}
117 121
 		return $columns;
@@ -135,7 +139,9 @@  discard block
 block discarded – undo
135 139
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
136 140
 			];
137 141
 			foreach( $strings as $search => $replace ) {
138
-				if( strpos( $single, $search ) === false )continue;
142
+				if( strpos( $single, $search ) === false ) {
143
+					continue;
144
+				}
139 145
 				$translation = $this->getTranslation([
140 146
 					'number' => $number,
141 147
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -186,7 +192,9 @@  discard block
 block discarded – undo
186 192
 	 */
187 193
 	public function saveBulkEditFields( $postId )
188 194
 	{
189
-		if( !current_user_can( 'edit_posts' ))return;
195
+		if( !current_user_can( 'edit_posts' )) {
196
+			return;
197
+		}
190 198
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
191 199
 		if( $assignedTo && get_post( $assignedTo )) {
192 200
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	public function setQueryForColumn( WP_Query $query )
201 209
 	{
202
-		if( !$this->hasPermission( $query ))return;
210
+		if( !$this->hasPermission( $query )) {
211
+			return;
212
+		}
203 213
 		$this->setMetaQuery( $query, [
204 214
 			'rating', 'review_type',
205 215
 		]);
@@ -270,7 +280,9 @@  discard block
 block discarded – undo
270 280
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
271 281
 	{
272 282
 		foreach( $metaKeys as $key ) {
273
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
283
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
284
+				continue;
285
+			}
274 286
 			$metaQuery = (array)$query->get( 'meta_query' );
275 287
 			$metaQuery[] = [
276 288
 				'key' => $key,
Please login to merge, or discard this patch.