Test Failed
Push — hotfix/fix-counts ( 216f0e...509562 )
by Paul
05:23
created
plugin/Modules/Validator/ValidateReview.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->validateBlacklist();
68 68
 		$this->validateAkismet();
69 69
 		$this->validateRecaptcha();
70
-		if( !empty( $this->error )) {
70
+		if( !empty($this->error) ) {
71 71
 			$this->setSessionValues( 'message', $this->error );
72 72
 		}
73 73
 		return $this;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
92 92
 			return static::RECAPTCHA_DISABLED;
93 93
 		}
94
-		if( empty( $this->request['_recaptcha-token'] )) {
95
-			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ))
94
+		if( empty($this->request['_recaptcha-token']) ) {
95
+			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
96 96
 				? static::RECAPTCHA_EMPTY
97 97
 				: static::RECAPTCHA_FAILED;
98 98
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getRecaptchaTokenStatus()
106 106
 	{
107
-		$endpoint = add_query_arg([
107
+		$endpoint = add_query_arg( [
108 108
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
109 109
 			'response' => $this->request['_recaptcha-token'],
110 110
 			'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
111 111
 		], static::RECAPTCHA_ENDPOINT );
112
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
112
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
113 113
 			glsr_log()->error( $response->get_error_message() );
114 114
 			return static::RECAPTCHA_FAILED;
115 115
 		}
116
-		$response = json_decode( wp_remote_retrieve_body( $response ));
117
-		if( !empty( $response->success )) {
116
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
117
+		if( !empty($response->success) ) {
118 118
 			return boolval( $response->success )
119 119
 				? static::RECAPTCHA_VALID
120 120
 				: static::RECAPTCHA_INVALID;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$rules = array_intersect_key(
134 134
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
135
-			array_flip( $this->getOption( 'settings.submissions.required', [] ))
135
+			array_flip( $this->getOption( 'settings.submissions.required', [] ) )
136 136
 		);
137
-		$excluded = explode( ',', glsr_get( $request, 'excluded' ));
138
-		return array_diff_key( $rules, array_flip( $excluded ));
137
+		$excluded = explode( ',', glsr_get( $request, 'excluded' ) );
138
+		return array_diff_key( $rules, array_flip( $excluded ) );
139 139
 	}
140 140
 
141 141
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	{
146 146
 		$rules = $this->getValidationRules( $request );
147 147
 		$errors = glsr( Validator::class )->validate( $request, $rules );
148
-		if( empty( $errors )) {
148
+		if( empty($errors) ) {
149 149
 			return true;
150 150
 		}
151 151
 		$this->setSessionValues( 'errors', $errors );
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
163 163
 	{
164 164
 		glsr( Session::class )->set( $this->form_id.$type, $value );
165
-		if( !empty( $loggedMessage )) {
165
+		if( !empty($loggedMessage) ) {
166 166
 			glsr_log()->warning( $loggedMessage )->debug( $this->request );
167 167
 		}
168 168
 	}
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	protected function validateAkismet()
174 174
 	{
175
-		if( !empty( $this->error ))return;
176
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
175
+		if( !empty($this->error) )return;
176
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
177 177
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission (consider adding the IP address to the blacklist):' );
178 178
 		$this->error = __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' );
179 179
 	}
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function validateBlacklist()
185 185
 	{
186
-		if( !empty( $this->error ))return;
187
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
186
+		if( !empty($this->error) )return;
187
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
188 188
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
189 189
 		if( $blacklistAction == 'reject' ) {
190 190
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -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/custom', 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
 		$status = $this->getRecaptchaStatus();
230
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
230
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) )return;
231 231
 		if( $status == static::RECAPTCHA_EMPTY ) {
232 232
 			$this->setSessionValues( 'recaptcha', 'unset' );
233 233
 			$this->recaptchaIsUnset = true;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function validateRequest( array $request )
249 249
 	{
250
-		if( !$this->isRequestValid( $request )) {
250
+		if( !$this->isRequestValid( $request ) ) {
251 251
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
252 252
 			return $request;
253 253
 		}
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/Handlers/CreateReview.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 		$review = glsr( ReviewManager::class )->create( $command );
18 18
 		if( !$review ) {
19 19
 			glsr( Session::class )->set( $command->form_id.'errors', [] );
20
-			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ));
20
+			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) );
21 21
 			return;
22 22
 		}
23
-		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
23
+		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) );
24 24
 		glsr( Notification::class )->send( $review );
25 25
 		if( $command->ajax_request )return;
26
-		wp_safe_redirect( $this->getReferer( $command ));
26
+		wp_safe_redirect( $this->getReferer( $command ) );
27 27
 		exit;
28 28
 	}
29 29
 
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	protected function getReferer( Command $command )
34 34
 	{
35
-		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
35
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
36 36
 		$referer = apply_filters( 'site-reviews/review/redirect', $referer, $command );
37
-		if( empty( $referer )) {
37
+		if( empty($referer) ) {
38 38
 			$referer = $command->referer;
39 39
 		}
40
-		if( empty( $referer )) {
40
+		if( empty($referer) ) {
41 41
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->debug( $command );
42 42
 			$referer = home_url();
43 43
 		}
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.
plugin/Container.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function load()
39 39
 	{
40
-		if( empty( static::$instance )) {
40
+		if( empty(static::$instance) ) {
41 41
 			static::$instance = new static;
42 42
 		}
43 43
 		return static::$instance;
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __get( $property )
51 51
 	{
52
-		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES )) {
52
+		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) {
53 53
 			return $this->$property;
54 54
 		}
55
-		$constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ));
56
-		if( defined( $constant )) {
55
+		$constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ) );
56
+		if( defined( $constant ) ) {
57 57
 			return constant( $constant );
58 58
 		}
59 59
 		return glsr_get( $this->storage, $property, null );
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function __set( $property, $value )
68 68
 	{
69
-		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) {
69
+		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) {
70 70
 			$this->storage[$property] = $value;
71 71
 		}
72
-		else if( !isset( $this->$property )) {
72
+		else if( !isset($this->$property) ) {
73 73
 			$this->$property = $value;
74 74
 		}
75 75
 		else {
76
-			throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ));
76
+			throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) );
77 77
 		}
78 78
 	}
79 79
 
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function make( $abstract )
97 97
 	{
98
-		if( !isset( $this->services[$abstract] )) {
98
+		if( !isset($this->services[$abstract]) ) {
99 99
 			$abstract = $this->addNamespace( $abstract );
100 100
 		}
101
-		if( isset( $this->services[$abstract] )) {
101
+		if( isset($this->services[$abstract]) ) {
102 102
 			$abstract = $this->services[$abstract];
103 103
 		}
104
-		if( is_callable( $abstract )) {
104
+		if( is_callable( $abstract ) ) {
105 105
 			return call_user_func_array( $abstract, [$this] );
106 106
 		}
107
-		if( is_object( $abstract )) {
107
+		if( is_object( $abstract ) ) {
108 108
 			return $abstract;
109 109
 		}
110 110
 		return $this->resolve( $abstract );
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function singleton( $alias, $binding )
120 120
 	{
121
-		$this->bind( $alias, $this->make( $binding ));
121
+		$this->bind( $alias, $this->make( $binding ) );
122 122
 	}
123 123
 
124 124
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function addNamespace( $abstract )
130 130
 	{
131
-		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) {
131
+		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) {
132 132
 			$abstract = __NAMESPACE__.'\\'.$abstract;
133 133
 		}
134 134
 		return $abstract;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			throw new Exception( 'Target ['.$concrete.'] is not instantiable.' );
151 151
 		}
152 152
 		$constructor = $reflector->getConstructor();
153
-		if( empty( $constructor )) {
153
+		if( empty($constructor) ) {
154 154
 			return new $concrete;
155 155
 		}
156 156
 		return $reflector->newInstanceArgs(
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	public function getAssignedToPost( $postId, $assignedTo = '' )
22 22
 	{
23
-		if( empty( $assignedTo )) {
23
+		if( empty($assignedTo) ) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty($assignedTo) )return;
27 27
 		$assignedPost = get_post( $assignedTo );
28 28
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 29
 			return $assignedPost;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function getReviewsMeta( $key, $status = 'publish' )
65 65
 	{
66
-		if( $status == 'all' || empty( $status )) {
66
+		if( $status == 'all' || empty($status) ) {
67 67
 			$status = get_post_stati( ['exclude_from_search' => false] );
68 68
 		}
69 69
 		return glsr( SqlQueries::class )->getReviewsMeta( $key, $status );
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$termIds = [];
79 79
 		foreach( $values as $value ) {
80 80
 			$term = get_term_by( $field, $value, Application::TAXONOMY );
81
-			if( !isset( $term->term_id ))continue;
81
+			if( !isset($term->term_id) )continue;
82 82
 			$termIds[] = $term->term_id;
83 83
 		}
84 84
 		return $termIds;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 			'fields' => 'id=>name',
95 95
 			'hide_empty' => false,
96 96
 			'taxonomy' => Application::TAXONOMY,
97
-		]);
97
+		] );
98 98
 		$terms = get_terms( $args );
99
-		if( is_wp_error( $terms )) {
99
+		if( is_wp_error( $terms ) ) {
100 100
 			glsr_log()->error( $terms->get_error_message() );
101 101
 			return [];
102 102
 		}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			'post_status' => 'publish',
114 114
 			'post_type' => 'any',
115 115
 		];
116
-		if( is_numeric( $searchTerm )) {
116
+		if( is_numeric( $searchTerm ) ) {
117 117
 			$args['post__in'] = [$searchTerm];
118 118
 		}
119 119
 		else {
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			ob_start();
133 133
 			glsr()->render( 'partials/editor/search-result', [
134 134
 				'ID' => get_the_ID(),
135
-				'permalink' => esc_url( (string) get_permalink() ),
135
+				'permalink' => esc_url( (string)get_permalink() ),
136 136
 				'title' => esc_attr( get_the_title() ),
137
-			]);
137
+			] );
138 138
 			$results .= ob_get_clean();
139 139
 		}
140 140
 		wp_reset_postdata();
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/Database/OptionManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function all()
30 30
 	{
31
-		if( empty( $this->options )) {
31
+		if( empty($this->options) ) {
32 32
 			$this->reset();
33 33
 		}
34 34
 		return $this->options;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 		$options = $this->all();
46 46
 		$pointer = &$options;
47 47
 		foreach( $keys as $key ) {
48
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
48
+			if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue;
49 49
 			$pointer = &$pointer[$key];
50 50
 		}
51
-		unset( $pointer[$last] );
51
+		unset($pointer[$last]);
52 52
 		return $this->set( $options );
53 53
 	}
54 54
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public function getWP( $path, $fallback = '' )
82 82
 	{
83 83
 		$option = get_option( $path, $fallback );
84
-		return empty( $option )
84
+		return empty($option)
85 85
 			? $fallback
86 86
 			: $option;
87 87
 	}
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 			glsr( DefaultsManager::class )->defaults()
105 105
 		);
106 106
 		array_walk( $options, function( &$value ) {
107
-			if( !is_string( $value ))return;
108
-			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
107
+			if( !is_string( $value ) )return;
108
+			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
109 109
 		});
110 110
 		return glsr( Helper::class )->convertDotNotationArray( $options );
111 111
 	}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public function isRecaptchaEnabled()
117 117
 	{
118 118
 		$integration = $this->get( 'settings.submissions.recaptcha.integration' );
119
-		return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() );
119
+		return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in());
120 120
 	}
121 121
 
122 122
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	public function reset()
126 126
 	{
127 127
 		$options = get_option( static::databaseKey(), [] );
128
-		if( !is_array( $options ) || empty( $options )) {
128
+		if( !is_array( $options ) || empty($options) ) {
129 129
 			delete_option( static::databaseKey() );
130 130
 			$options = wp_parse_args( glsr()->defaults, ['settings' => []] );
131 131
 		}
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function set( $pathOrOptions, $value = '' )
141 141
 	{
142
-		if( is_string( $pathOrOptions )) {
142
+		if( is_string( $pathOrOptions ) ) {
143 143
 			$pathOrOptions = glsr( Helper::class )->dataSet( $this->all(), $pathOrOptions, $value );
144 144
 		}
145
-		if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) {
145
+		if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) {
146 146
 			$this->reset();
147 147
 		}
148 148
 		return $result;
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name ) )return;
17 17
 		$defaults = call_user_func_array( [$this, $name], $args );
18 18
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 19
 		$hookName = str_replace( 'Defaults', '', $hookName );
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	protected function filter( array $values = [] )
33 33
 	{
34
-		return $this->merge( array_filter( $values ));
34
+		return $this->merge( array_filter( $values ) );
35 35
 	}
36 36
 
37 37
 	/**
Please login to merge, or discard this patch.