Passed
Push — hotfix/fix-counts ( 0ee906...e9420b )
by Paul
03:57
created
plugin/Modules/Schema/BaseType.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function __call( $method, array $arguments )
41 41
 	{
42
-		return $this->setProperty( $method, glsr_get( $arguments, 0 ));
42
+		return $this->setProperty( $method, glsr_get( $arguments, 0 ) );
43 43
 	}
44 44
 
45 45
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param mixed $default
94 94
 	 * @return mixed
95 95
 	 */
96
-	public function getProperty( $property, $default = null)
96
+	public function getProperty( $property, $default = null )
97 97
 	{
98 98
 		return glsr_get( $this->properties, $property, $default );
99 99
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function offsetUnset( $offset )
163 163
 	{
164
-		unset( $this->properties[$offset] );
164
+		unset($this->properties[$offset]);
165 165
 	}
166 166
 
167 167
 	/**
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function getParents( $parents = null )
209 209
 	{
210
-		if( !isset( $parents )) {
210
+		if( !isset($parents) ) {
211 211
 			$parents = $this->parents;
212 212
 		}
213 213
 		$newParents = $parents;
214 214
 		foreach( $parents as $parent ) {
215 215
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
216
-			if( !class_exists( $parentClass ))continue;
217
-			$newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ));
216
+			if( !class_exists( $parentClass ) )continue;
217
+			$newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) );
218 218
 		}
219
-		return array_values( array_unique( $newParents ));
219
+		return array_values( array_unique( $newParents ) );
220 220
 	}
221 221
 
222 222
 	/**
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 		$parents = $this->getParents();
228 228
 		foreach( $parents as $parent ) {
229 229
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
230
-			if( !class_exists( $parentClass ))continue;
231
-			$this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed )));
230
+			if( !class_exists( $parentClass ) )continue;
231
+			$this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) );
232 232
 		}
233 233
 	}
234 234
 
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function serializeProperty( $property )
240 240
 	{
241
-		if( is_array( $property )) {
241
+		if( is_array( $property ) ) {
242 242
 			return array_map( [$this, 'serializeProperty'], $property );
243 243
 		}
244 244
 		if( $property instanceof Type ) {
245 245
 			$property = $property->toArray();
246
-			unset( $property['@context'] );
246
+			unset($property['@context']);
247 247
 		}
248 248
 		if( $property instanceof DateTimeInterface ) {
249 249
 			$property = $property->format( DateTime::ATOM );
250 250
 		}
251
-		if( is_object( $property )) {
251
+		if( is_object( $property ) ) {
252 252
 			throw new InvalidProperty();
253 253
 		}
254 254
 		return $property;
Please login to merge, or discard this patch.
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/TaxonomyController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) )return;
39 39
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 40
 			'class' => 'screen-reader-text',
41 41
 			'for' => Application::TAXONOMY,
42
-		]);
43
-		wp_dropdown_categories([
42
+		] );
43
+		wp_dropdown_categories( [
44 44
 			'depth' => 3,
45 45
 			'hide_empty' => true,
46 46
 			'hide_if_empty' => true,
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'show_option_all' => $this->getShowOptionAll(),
53 53
 			'taxonomy' => Application::TAXONOMY,
54 54
 			'value_field' => 'slug',
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	{
72 72
 		$taxonomy = get_taxonomy( Application::TAXONOMY );
73 73
 		return $taxonomy
74
-			? ucfirst( strtolower( $taxonomy->labels->all_items ))
74
+			? ucfirst( strtolower( $taxonomy->labels->all_items ) )
75 75
 			: '';
76 76
 	}
77 77
 }
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/Controllers/AdminController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function enqueueAssets()
26 26
 	{
27
-		$command = new EnqueueAdminAssets([
27
+		$command = new EnqueueAdminAssets( [
28 28
 			'pointers' => [[
29 29
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
30 30
 				'id' => 'glsr-pointer-pinned',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				'target' => '#misc-pub-pinned',
37 37
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
38 38
 			]],
39
-		]);
39
+		] );
40 40
 		$this->execute( $command );
41 41
 	}
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
50 50
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
51
-		]);
51
+		] );
52 52
 		return $links;
53 53
 	}
54 54
 
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	public function filterDashboardGlanceItems( $items )
61 61
 	{
62 62
 		$postCount = wp_count_posts( Application::POST_TYPE );
63
-		if( empty( $postCount->publish )) {
63
+		if( empty($postCount->publish) ) {
64 64
 			return $items;
65 65
 		}
66 66
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
67
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
67
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
68 68
 		$items = glsr( Helper::class )->consolidateArray( $items );
69 69
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
70 70
 			? glsr( Builder::class )->a( $text, [
71 71
 				'class' => 'glsr-review-count',
72 72
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
73
-			])
73
+			] )
74 74
 			: glsr( Builder::class )->span( $text, [
75 75
 				'class' => 'glsr-review-count',
76
-			]);
76
+			] );
77 77
 		return $items;
78 78
 	}
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function filterTinymcePlugins( $plugins )
86 86
 	{
87
-		if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) {
87
+		if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) {
88 88
 			$plugins = glsr( Helper::class )->consolidateArray( $plugins );
89 89
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
90 90
 		}
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function registerTinymcePopups()
99 99
 	{
100
-		$command = new RegisterTinymcePopups([
100
+		$command = new RegisterTinymcePopups( [
101 101
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
102 102
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
103 103
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
104
-		]);
104
+		] );
105 105
 		$this->execute( $command );
106 106
 	}
107 107
 
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	public function renderTinymceButton( $editorId )
114 114
 	{
115 115
 		$allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId );
116
-		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return;
116
+		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ) )return;
117 117
 		$shortcodes = [];
118 118
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
119 119
 			$shortcodes[$shortcode] = $values;
120 120
 		}
121
-		if( empty( $shortcodes ))return;
121
+		if( empty($shortcodes) )return;
122 122
 		glsr()->render( 'partials/editor/tinymce', [
123 123
 			'shortcodes' => $shortcodes,
124
-		]);
124
+		] );
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public function routerClearConsole()
131 131
 	{
132 132
 		glsr( Console::class )->clear();
133
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
133
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function routerFetchConsole()
140 140
 	{
141
-		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ));
141
+		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
142 142
 	}
143 143
 
144 144
 	/**
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 		}
158 158
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
159 159
 		foreach( $postIds as $postId ) {
160
-			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ));
160
+			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) );
161 161
 		}
162 162
 		$countManager->setCounts( $countManager->buildCounts() );
163 163
 		if( $showNotice ) {
164
-			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ));
164
+			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
165 165
 		}
166
-		glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ));
166
+		glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) );
167 167
 	}
168 168
 
169 169
 	/**
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 	{
198 198
 		$file = $_FILES['import-file'];
199 199
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
200
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
200
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
201 201
 		}
202
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
203
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
202
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
203
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
204 204
 		}
205 205
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
206
-		if( empty( $settings )) {
207
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
206
+		if( empty($settings) ) {
207
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
208 208
 		}
209
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
210
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
209
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
210
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
211 211
 	}
212 212
 
213 213
 	/**
@@ -225,6 +225,6 @@  discard block
 block discarded – undo
225 225
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
226 226
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
227 227
 		];
228
-		return glsr_get( $errors, $errorCode, __( 'Unknown upload error.', 'site-reviews' ));
228
+		return glsr_get( $errors, $errorCode, __( 'Unknown upload error.', 'site-reviews' ) );
229 229
 	}
230 230
 }
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.