Passed
Push — master ( b4a9df...e8093c )
by Paul
05:31
created
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'navigation' => $navigation,
58 58
 				'reviews' => $this->buildReviews(),
59 59
 			],
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		$reviews = '';
69 69
 		foreach( $this->reviews->results as $index => $result ) {
70 70
 			$this->current = $index;
71
-			$reviews.= glsr( Template::class )->build( 'templates/review', [
71
+			$reviews .= glsr( Template::class )->build( 'templates/review', [
72 72
 				'context' => $this->buildReview( $result )->values,
73
-			]);
73
+			] );
74 74
 		}
75 75
 		return $reviews;
76 76
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$renderedFields = [];
86 86
 		foreach( $review as $key => $value ) {
87 87
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
88
-			if( !method_exists( $this, $method ))continue;
88
+			if( !method_exists( $this, $method ) )continue;
89 89
 			$renderedFields[$key] = $this->$method( $key, $value );
90 90
 		}
91 91
 		$renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields );
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function buildOptionAssignedTo( $key, $value )
101 101
 	{
102
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
102
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
103 103
 		$post = glsr( Polylang::class )->getPost( $value );
104
-		if( !( $post instanceof WP_Post ))return;
104
+		if( !($post instanceof WP_Post) )return;
105 105
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
106 106
 			'href' => get_the_permalink( $post->ID ),
107
-		]);
107
+		] );
108 108
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
109 109
 		return $this->wrap( $key, '<span>'.$assignedTo.'</span>' );
110 110
 	}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function buildOptionAuthor( $key, $value )
118 118
 	{
119
-		if( $this->isHidden( $key ))return;
119
+		if( $this->isHidden( $key ) )return;
120 120
 		return $this->wrap( $key, '<span>'.$value.'</span>' );
121 121
 	}
122 122
 
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function buildOptionAvatar( $key, $value )
129 129
 	{
130
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
130
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
131 131
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
132
-		return $this->wrap( $key, glsr( Builder::class )->img([
132
+		return $this->wrap( $key, glsr( Builder::class )->img( [
133 133
 			'src' => $this->generateAvatar( $value ),
134 134
 			'height' => $size,
135 135
 			'width' => $size,
136
-		]));
136
+		] ) );
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	protected function buildOptionContent( $key, $value )
145 145
 	{
146 146
 		$text = $this->normalizeText( $value );
147
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
147
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
148 148
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
149 149
 	}
150 150
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	protected function buildOptionDate( $key, $value )
157 157
 	{
158
-		if( $this->isHidden( $key ))return;
158
+		if( $this->isHidden( $key ) )return;
159 159
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
160 160
 		if( $dateFormat == 'relative' ) {
161 161
 			$date = glsr( Date::class )->relative( $value );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			$format = $dateFormat == 'custom'
165 165
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
166 166
 				: (string)get_option( 'date_format' );
167
-			$date = date_i18n( $format, strtotime( $value ));
167
+			$date = date_i18n( $format, strtotime( $value ) );
168 168
 		}
169 169
 		return $this->wrap( $key, '<span>'.$date.'</span>' );
170 170
 	}
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	protected function buildOptionRating( $key, $value )
178 178
 	{
179
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
179
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
180 180
 		$rating = glsr( Partial::class )->build( 'star-rating', [
181 181
 			'rating' => $value,
182
-		]);
182
+		] );
183 183
 		return $this->wrap( $key, $rating );
184 184
 	}
185 185
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	protected function buildOptionResponse( $key, $value )
192 192
 	{
193
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
194
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
193
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
194
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
195 195
 		$text = $this->normalizeText( $value );
196 196
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
197 197
 		return $this->wrap( $key,
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function buildOptionTitle( $key, $value )
209 209
 	{
210
-		if( $this->isHidden( $key ))return;
211
-		if( empty( $value )) {
210
+		if( $this->isHidden( $key ) )return;
211
+		if( empty($value) ) {
212 212
 			$value = __( 'No Title', 'site-reviews' );
213 213
 		}
214 214
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 			return $avatarUrl;
226 226
 		}
227 227
 		$authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id );
228
-		if( empty( $authorIdOrEmail )) {
228
+		if( empty($authorIdOrEmail) ) {
229 229
 			$authorIdOrEmail = $review->email;
230 230
 		}
231
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
231
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
232 232
 			return $newAvatar;
233 233
 		}
234 234
 		return $avatarUrl;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	protected function generateSchema()
241 241
 	{
242
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
242
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
243 243
 		glsr( Schema::class )->store(
244 244
 			glsr( Schema::class )->build( $this->args )
245 245
 		);
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getExcerpt( $text )
264 264
 	{
265
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
265
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
266 266
 		$split = extension_loaded( 'intl' )
267 267
 			? $this->getExcerptIntlSplit( $text, $limit )
268 268
 			: $this->getExcerptSplit( $text, $limit );
269 269
 		$hiddenText = substr( $text, $split );
270
-		if( !empty( $hiddenText )) {
270
+		if( !empty($hiddenText) ) {
271 271
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
272 272
 				'class' => 'glsr-hidden glsr-hidden-text',
273 273
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
274 274
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
275
-			]);
276
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
275
+			] );
276
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
277 277
 		}
278 278
 		return nl2br( $text );
279 279
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
289 289
 		$words->setText( $text );
290 290
 		$count = 0;
291
-		foreach( $words as $offset ){
291
+		foreach( $words as $offset ) {
292 292
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
293 293
 			$count++;
294 294
 			if( $count != $limit )continue;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	protected function getExcerptSplit( $text, $limit )
306 306
 	{
307 307
 		if( str_word_count( $text, 0 ) > $limit ) {
308
-			$words = array_keys( str_word_count( $text, 2 ));
308
+			$words = array_keys( str_word_count( $text, 2 ) );
309 309
 			return $words[$limit];
310 310
 		}
311 311
 		return strlen( $text );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function getOption( $path, $fallback = '' )
320 320
 	{
321
-		if( array_key_exists( $path, $this->options )) {
321
+		if( array_key_exists( $path, $this->options ) ) {
322 322
 			return $this->options[$path];
323 323
 		}
324 324
 		return $fallback;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function isHidden( $key, $path = '' )
333 333
 	{
334
-		$isOptionEnabled = !empty( $path )
334
+		$isOptionEnabled = !empty($path)
335 335
 			? $this->isOptionEnabled( $path )
336 336
 			: true;
337 337
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	protected function isHiddenOrEmpty( $key, $value )
346 346
 	{
347
-		return $this->isHidden( $key ) || empty( $value );
347
+		return $this->isHidden( $key ) || empty($value);
348 348
 	}
349 349
 
350 350
 	/**
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
 	protected function normalizeText( $text )
364 364
 	{
365 365
 		$text = wp_kses( $text, wp_kses_allowed_html() );
366
-		$text = convert_smilies( strip_shortcodes( $text ));
366
+		$text = convert_smilies( strip_shortcodes( $text ) );
367 367
 		$text = str_replace( ']]>', ']]&gt;', $text );
368 368
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
369
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
369
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
370 370
 			$text = $this->getExcerpt( $text );
371 371
 		}
372 372
 		return wptexturize( $text );
@@ -381,6 +381,6 @@  discard block
 block discarded – undo
381 381
 	{
382 382
 		return glsr( Builder::class )->div( $value, [
383 383
 			'class' => 'glsr-review-'.$key,
384
-		]);
384
+		] );
385 385
 	}
386 386
 }
Please login to merge, or discard this patch.
plugin/Defaults/CreateReviewDefaults.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 			'avatar' => '',
19 19
 			'content' => '',
20 20
 			'custom' => '',
21
-			'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )),
21
+			'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ),
22 22
 			'email' => '',
23 23
 			'ip_address' => glsr( Helper::class )->getIpAddress(),
24 24
 			'pinned' => false,
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +12 added lines, -12 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' ) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			$options = $this->sanitizeGeneral( $input, $options );
26 26
 			$options = $this->sanitizeSubmissions( $input, $options );
27 27
 			$options = $this->sanitizeTranslations( $input, $options );
28
-			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
28
+			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
 			return $options;
30 30
 		}
31 31
 		return $input;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
41 41
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 		if( $inputForm['support']['polylang'] == 'yes' ) {
52 52
 			if( !glsr( Polylang::class )->isActive() ) {
53 53
 				$options['settings']['general']['support']['polylang'] = 'no';
54
-				glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ));
54
+				glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
55 55
 			}
56 56
 			else if( !glsr( Polylang::class )->isSupported() ) {
57 57
 				$options['settings']['general']['support']['polylang'] = 'no';
58
-				glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ));
58
+				glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
59 59
 			}
60 60
 		}
61
-		if( !isset( $inputForm['notifications'] )) {
61
+		if( !isset($inputForm['notifications']) ) {
62 62
 			$options['settings']['general']['notifications'] = [];
63 63
 		}
64 64
 		if( trim( $inputForm['notification_message'] ) == '' ) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	protected function sanitizeSubmissions( array $input, array $options )
74 74
 	{
75 75
 		$inputForm = $input['settings']['submissions'];
76
-		if( !isset( $inputForm['required'] )) {
76
+		if( !isset($inputForm['required']) ) {
77 77
 			$options['settings']['submissions']['required'] = [];
78 78
 		}
79 79
 		return $options;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	protected function sanitizeTranslations( array $input, array $options )
86 86
 	{
87
-		if( isset( $input['settings']['strings'] )) {
88
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
87
+		if( isset($input['settings']['strings']) ) {
88
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
89 89
 			$allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]];
90
-			array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) {
91
-				if( isset( $string['s2'] )) {
90
+			array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) {
91
+				if( isset($string['s2']) ) {
92 92
 					$string['s2'] = wp_kses( $string['s2'], $allowedTags );
93 93
 				}
94
-				if( isset( $string['p2'] )) {
94
+				if( isset($string['p2']) ) {
95 95
 					$string['p2'] = wp_kses( $string['p2'], $allowedTags );
96 96
 				}
97 97
 			});
Please login to merge, or discard this patch.
plugin/Helper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$className = $this->camelCase( $name );
18 18
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
19
-		return !empty( $path )
19
+		return !empty($path)
20 20
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
21 21
 			: $className;
22 22
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function buildMethodName( $name, $prefix = '' )
30 30
 	{
31
-		return lcfirst( $prefix.$this->buildClassName( $name ));
31
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function buildPropertyName( $name )
39 39
 	{
40
-		return lcfirst( $this->buildClassName( $name ));
40
+		return lcfirst( $this->buildClassName( $name ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function camelCase( $string )
48 48
 	{
49
-		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string )));
49
+		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
50 50
 		return str_replace( ' ', '', $string );
51 51
 	}
52 52
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function convertPathToId( $path, $prefix = '' )
80 80
 	{
81
-		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ));
81
+		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) );
82 82
 	}
83 83
 
84 84
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$levels = explode( '.', $path );
91 91
 		return array_reduce( $levels, function( $result, $value ) {
92
-			return $result.= '['.$value.']';
92
+			return $result .= '['.$value.']';
93 93
 		}, $prefix );
94 94
 	}
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function convertStringToArray( $string, $callback = null )
102 102
 	{
103
-		$array = array_map( 'trim', explode( ',', $string ));
103
+		$array = array_map( 'trim', explode( ',', $string ) );
104 104
 		return $callback
105 105
 			? array_filter( $array, $callback )
106 106
 			: array_filter( $array );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function dashCase( $string )
114 114
 	{
115
-		return str_replace( '_', '-', $this->snakeCase( $string ));
115
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function filterInput( $key, array $request = [] )
136 136
 	{
137
-		if( isset( $request[$key] )) {
137
+		if( isset($request[$key]) ) {
138 138
 			return $request[$key];
139 139
 		}
140 140
 		$variable = filter_input( INPUT_POST, $key );
141
-		if( is_null( $variable ) && isset( $_POST[$key] )) {
141
+		if( is_null( $variable ) && isset($_POST[$key]) ) {
142 142
 			$variable = $_POST[$key];
143 143
 		}
144 144
 		return $variable;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	public function filterInputArray( $key )
152 152
 	{
153 153
 		$variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
154
-		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) {
154
+		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) {
155 155
 			$variable = $_POST[$key];
156 156
 		}
157 157
 		return (array)$variable;
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		$result = [];
168 168
 		foreach( $array as $key => $value ) {
169 169
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
170
-			if( $this->isIndexedFlatArray( $value )) {
170
+			if( $this->isIndexedFlatArray( $value ) ) {
171 171
 				if( $flattenValue ) {
172 172
 					$value = '['.implode( ', ', $value ).']';
173 173
 				}
174 174
 			}
175
-			else if( is_array( $value )) {
176
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
175
+			else if( is_array( $value ) ) {
176
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
177 177
 				continue;
178 178
 			}
179 179
 			$result[$newKey] = $value;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 				Whip::IPV4 => $cloudflareIps['v4'],
193 193
 				Whip::IPV6 => $cloudflareIps['v6'],
194 194
 			],
195
-		]))->getValidIpAddress();
195
+		] ))->getValidIpAddress();
196 196
 	}
197 197
 
198 198
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		$keys = explode( '.', $path );
207 207
 		foreach( $keys as $key ) {
208
-			if( !isset( $values[$key] )) {
208
+			if( !isset($values[$key]) ) {
209 209
 				return $fallback;
210 210
 			}
211 211
 			$values = $values[$key];
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function isIndexedArray( $array )
221 221
 	{
222
-		if( !is_array( $array )) {
222
+		if( !is_array( $array ) ) {
223 223
 			return false;
224 224
 		}
225 225
 		$current = 0;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function isIndexedFlatArray( $array )
240 240
 	{
241
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
241
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
242 242
 			return false;
243 243
 		}
244 244
 		return $this->isIndexedArray( $array );
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function prefixString( $string, $prefix = '' )
253 253
 	{
254
-		return $prefix.str_replace( $prefix, '', trim( $string ));
254
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
255 255
 	}
256 256
 
257 257
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function snakeCase( $string )
298 298
 	{
299
-		if( !ctype_lower( $string )) {
299
+		if( !ctype_lower( $string ) ) {
300 300
 			$string = preg_replace( '/\s+/u', '', $string );
301 301
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
302 302
 			$string = mb_strtolower( $string, 'UTF-8' );
@@ -311,6 +311,6 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	public function startsWith( $needle, $haystack )
313 313
 	{
314
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
314
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
315 315
 	}
316 316
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 				'loader' => '<div class="glsr-loader"></div>',
28 28
 				'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
29 29
 			],
30
-		]);
30
+		] );
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	protected function buildLinks()
37 37
 	{
38
-		$args = glsr( Style::class )->paginationArgs([
38
+		$args = glsr( Style::class )->paginationArgs( [
39 39
 			'current' => $this->args['paged'],
40 40
 			'total' => $this->args['total'],
41
-		]);
41
+		] );
42 42
 		if( is_front_page() ) {
43
-			unset( $args['format'] );
43
+			unset($args['format']);
44 44
 		}
45 45
 		if( $args['type'] == 'array' ) {
46 46
 			$args['type'] = 'plain';
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
 		return wp_parse_args( $args, [
57 57
 			'paged' => glsr( QueryBuilder::class )->getPaged(),
58 58
 			'total' => 1,
59
-		]);
59
+		] );
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
plugin/Modules/Upgrader/Upgrade_3_0_0.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$this->newSettings['settings.submissions'][] = 'terms';
44 44
 		$this->migrateNotificationSettings();
45 45
 		$this->migrateRecaptchaSettings();
46
-		glsr( OptionManager::class )->set( glsr( Helper::class )->convertDotNotationArray( $this->newSettings ));
46
+		glsr( OptionManager::class )->set( glsr( Helper::class )->convertDotNotationArray( $this->newSettings ) );
47 47
 	}
48 48
 
49 49
 	/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	protected function getOldSettings()
63 63
 	{
64
-		$settings = glsr( Helper::class )->flattenArray( get_option( Application::ID.'-v2', [] ));
64
+		$settings = glsr( Helper::class )->flattenArray( get_option( Application::ID.'-v2', [] ) );
65 65
 		return wp_parse_args( $settings, [
66 66
 			'settings.general.notification' => '',
67 67
 			'settings.general.webhook_url' => '',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			'settings.reviews-form.recaptcha.key' => $this->newSettings['submissions.recaptcha.key'],
75 75
 			'settings.reviews-form.recaptcha.secret' => $this->newSettings['submissions.recaptcha.secret'],
76 76
 			'settings.reviews-form.recaptcha.position' => $this->newSettings['submissions.recaptcha.position'],
77
-		]);
77
+		] );
78 78
 	}
79 79
 
80 80
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function migrateRecaptchaSettings()
100 100
 	{
101
-		if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) {
101
+		if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) {
102 102
 			$this->newSettings['settings.submissions.recaptcha.integration'] == 'all';
103 103
 		}
104 104
 		if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 				'BadgePosition' => $this->oldSettings['settings.reviews-form.recaptcha.position'],
107 107
 				'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'],
108 108
 				'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'],
109
-			]);
109
+			] );
110 110
 			$this->newSettings['settings.submissions.recaptcha.key'] = $invisibleRecaptchaOptions['SiteKey'];
111 111
 			$this->newSettings['settings.submissions.recaptcha.secret'] = $invisibleRecaptchaOptions['SecretKey'];
112 112
 			$this->newSettings['settings.submissions.recaptcha.position'] = $invisibleRecaptchaOptions['BadgePosition'];
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,11 +32,11 @@  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 )));
36
-		if( empty( $referer )) {
35
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
36
+		if( empty($referer) ) {
37 37
 			$referer = $command->referer;
38 38
 		}
39
-		if( empty( $referer )) {
39
+		if( empty($referer) ) {
40 40
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
41 41
 			$referer = home_url();
42 42
 		}
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function enqueueAssets()
27 27
 	{
28
-		$command = new EnqueueAdminAssets([
28
+		$command = new EnqueueAdminAssets( [
29 29
 			'pointers' => [[
30 30
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
31 31
 				'id' => 'glsr-pointer-pinned',
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				'target' => '#misc-pub-pinned',
38 38
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
39 39
 			]],
40
-		]);
40
+		] );
41 41
 		$this->execute( $command );
42 42
 	}
43 43
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	{
50 50
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
51 51
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
52
-		]);
52
+		] );
53 53
 		return $links;
54 54
 	}
55 55
 
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
 	public function filterDashboardGlanceItems( array $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[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
69 69
 			? glsr( Builder::class )->a( $text, [
70 70
 				'class' => 'glsr-review-count',
71 71
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
72
-			])
72
+			] )
73 73
 			: glsr( Builder::class )->span( $text, [
74 74
 				'class' => 'glsr-review-count',
75
-			]);
75
+			] );
76 76
 		return $items;
77 77
 	}
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function filterTinymcePlugins( array $plugins )
84 84
 	{
85 85
 		if( user_can_richedit()
86
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
86
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
87 87
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
88 88
 		}
89 89
 		return $plugins;
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function registerShortcodeButtons()
97 97
 	{
98
-		$command = new RegisterShortcodeButtons([
98
+		$command = new RegisterShortcodeButtons( [
99 99
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
100 100
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
101 101
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
102
-		]);
102
+		] );
103 103
 		$this->execute( $command );
104 104
 	}
105 105
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
112
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
113 113
 		glsr()->render( 'partials/editor/review', [
114 114
 			'post' => $post,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function renderReviewNotice( WP_Post $post )
123 123
 	{
124
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
125
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
124
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
125
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
126 126
 		glsr( Template::class )->render( 'partials/editor/notice', [
127 127
 			'context' => [
128 128
 				'notices' => glsr( Notice::class )->get(),
129 129
 			],
130
-		]);
130
+		] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
142 142
 			$shortcodes[$shortcode] = $values;
143 143
 		}
144
-		if( empty( $shortcodes ))return;
144
+		if( empty($shortcodes) )return;
145 145
 		glsr()->render( 'partials/editor/tinymce', [
146 146
 			'shortcodes' => $shortcodes,
147
-		]);
147
+		] );
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	public function routerClearConsole()
154 154
 	{
155 155
 		glsr( Console::class )->clear();
156
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
156
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function routerFetchConsole()
163 163
 	{
164
-		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ));
164
+		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 	public function routerCountReviews()
171 171
 	{
172 172
 		$countManager = glsr( CountsManager::class );
173
-		$terms = get_terms([
173
+		$terms = get_terms( [
174 174
 			'hide_empty' => true,
175 175
 			'taxonomy' => Application::TAXONOMY,
176
-		]);
176
+		] );
177 177
 		foreach( $terms as $term ) {
178
-			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ));
178
+			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) );
179 179
 		}
180 180
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
181 181
 		foreach( $postIds as $postId ) {
182
-			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ));
182
+			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) );
183 183
 		}
184 184
 		$countManager->setCounts( $countManager->buildCounts() );
185
-		glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ));
185
+		glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
186 186
 	}
187 187
 
188 188
 	/**
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
 	{
217 217
 		$file = $_FILES['import-file'];
218 218
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
219
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
219
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
220 220
 		}
221
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
222
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
221
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
222
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
223 223
 		}
224 224
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
225
-		if( empty( $settings )) {
226
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
225
+		if( empty($settings) ) {
226
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
227 227
 		}
228
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
229
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
228
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
229
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
230 230
 	}
231 231
 
232 232
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
245 245
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
246 246
 		];
247
-		return !isset( $errors[$errorCode] )
247
+		return !isset($errors[$errorCode])
248 248
 			? __( 'Unknown upload error.', 'site-reviews' )
249 249
 			: $errors[$errorCode];
250 250
 	}
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 			'post_type' => Application::POST_TYPE,
36 36
 		];
37 37
 		$postId = wp_insert_post( $postValues, true );
38
-		if( is_wp_error( $postId )) {
38
+		if( is_wp_error( $postId ) ) {
39 39
 			glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
40 40
 			return false;
41 41
 		}
42 42
 		$this->setTerms( $postId, $command->category );
43
-		$review = $this->single( get_post( $postId ));
43
+		$review = $this->single( get_post( $postId ) );
44 44
 		do_action( 'site-reviews/review/created', $review, $command );
45 45
 		return $review;
46 46
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function delete( $metaReviewId )
53 53
 	{
54
-		if( $postId = $this->getPostId( $metaReviewId )) {
54
+		if( $postId = $this->getPostId( $metaReviewId ) ) {
55 55
 			wp_delete_post( $postId, true );
56 56
 		}
57 57
 	}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		$paged = glsr( QueryBuilder::class )->getPaged(
74 74
 			wp_validate_boolean( $args['pagination'] )
75 75
 		);
76
-		$reviews = new WP_Query([
76
+		$reviews = new WP_Query( [
77 77
 			'meta_key' => 'pinned',
78 78
 			'meta_query' => $metaQuery,
79 79
 			'offset' => $args['offset'],
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			'post_type' => Application::POST_TYPE,
87 87
 			'posts_per_page' => $args['count'],
88 88
 			'tax_query' => $taxQuery,
89
-		]);
89
+		] );
90 90
 		return (object)[
91 91
 			'results' => array_map( [$this, 'single'], $reviews->posts ),
92 92
 			'max_num_pages' => $reviews->max_num_pages,
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
113 113
 		foreach( $termIds as $termId ) {
114 114
 			$term = get_term( $termId, Application::TAXONOMY );
115
-			if( !isset( $term->term_id ))continue;
115
+			if( !isset($term->term_id) )continue;
116 116
 			$terms[] = $term->term_id;
117 117
 		}
118 118
 		return $terms;
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 	{
127 127
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
128 128
 		delete_post_meta( $postId, '_edit_last' );
129
-		$result = wp_update_post([
129
+		$result = wp_update_post( [
130 130
 			'ID' => $postId,
131 131
 			'post_content' => get_post_meta( $postId, 'content', true ),
132 132
 			'post_date' => get_post_meta( $postId, 'date', true ),
133 133
 			'post_title' => get_post_meta( $postId, 'title', true ),
134
-		]);
135
-		if( is_wp_error( $result )) {
134
+		] );
135
+		if( is_wp_error( $result ) ) {
136 136
 			glsr_log()->error( $result->get_error_message() );
137 137
 		}
138 138
 	}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	protected function getNewPostStatus( array $review, $isBlacklisted )
155 155
 	{
156 156
 		$requireApprovalOption = glsr( OptionManager::class )->get( 'settings.general.require.approval' );
157
-		return $review['review_type'] == 'local' && ( $requireApprovalOption == 'yes' || $isBlacklisted )
157
+		return $review['review_type'] == 'local' && ($requireApprovalOption == 'yes' || $isBlacklisted)
158 158
 			? 'pending'
159 159
 			: 'publish';
160 160
 	}
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	protected function setTerms( $postId, $termIds )
168 168
 	{
169 169
 		$terms = $this->normalizeTerms( $termIds );
170
-		if( empty( $terms ))return;
170
+		if( empty($terms) )return;
171 171
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
172
-		if( is_wp_error( $result )) {
172
+		if( is_wp_error( $result ) ) {
173 173
 			glsr_log()->error( $result->get_error_message() );
174 174
 		}
175 175
 	}
Please login to merge, or discard this patch.