Passed
Push — master ( fe5b90...baa8e1 )
by Paul
05:38
created
plugin/Controllers/ListTableController/Columns.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) {
23 23
 			$column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
24 24
 				'href' => (string)get_the_permalink( $assignedPost->ID ),
25
-			]);
25
+			] );
26 26
 		}
27 27
 		return $column;
28 28
 	}
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		$pinned = get_post_meta( $postId, 'pinned', true )
37 37
 			? 'pinned '
38 38
 			: '';
39
-		return glsr( Builder::class )->i([
39
+		return glsr( Builder::class )->i( [
40 40
 			'class' => $pinned.'dashicons dashicons-sticky',
41 41
 			'data-id' => $postId,
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function buildColumnReviewer( $postId )
50 50
 	{
51
-		return strval( get_post_meta( $postId, 'author', true ));
51
+		return strval( get_post_meta( $postId, 'author', true ) );
52 52
 	}
53 53
 
54 54
 	/**
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	public function buildColumnRating( $postId )
60 60
 	{
61 61
 		return glsr( Partial::class )->build( 'star-rating', [
62
-			'rating' => intval( get_post_meta( $postId, 'rating', true )),
63
-		]);
62
+			'rating' => intval( get_post_meta( $postId, 'rating', true ) ),
63
+		] );
64 64
 	}
65 65
 
66 66
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function renderFilters( $postType )
83 83
 	{
84 84
 		if( $postType !== Application::POST_TYPE )return;
85
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
85
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
86 86
 			$status = 'publish';
87 87
 		}
88 88
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function renderFilterRatings( $ratings )
113 113
 	{
114
-		if( empty( $ratings ))return;
115
-		$ratings = array_flip( array_reverse( $ratings ));
114
+		if( empty($ratings) )return;
115
+		$ratings = array_flip( array_reverse( $ratings ) );
116 116
 		array_walk( $ratings, function( &$value, $key ) {
117 117
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
118 118
 			$value = sprintf( $label, $key );
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 		echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
121 121
 			'class' => 'screen-reader-text',
122 122
 			'for' => 'rating',
123
-		]);
124
-		echo glsr( Builder::class )->select([
123
+		] );
124
+		echo glsr( Builder::class )->select( [
125 125
 			'name' => 'rating',
126 126
 			'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
127 127
 			'value' => filter_input( INPUT_GET, 'rating' ),
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
139 139
 			'class' => 'screen-reader-text',
140 140
 			'for' => 'review_type',
141
-		]);
142
-		echo glsr( Builder::class )->select([
141
+		] );
142
+		echo glsr( Builder::class )->select( [
143 143
 			'name' => 'review_type',
144 144
 			'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
145 145
 			'value' => filter_input( INPUT_GET, 'review_type' ),
146
-		]);
146
+		] );
147 147
 	}
148 148
 }
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$translations = $this->getTranslations();
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
 			try {
48 48
 				$potFile = glsr()->path( glsr()->languages.'/'.Application::ID.'.pot' );
49 49
 				$entries = $this->normalize( Parser::parseFile( $potFile )->getEntries() );
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
78 78
 	{
79
-		if( !is_array( $entries )) {
79
+		if( !is_array( $entries ) ) {
80 80
 			$entries = $this->results;
81 81
 		}
82
-		if( !is_array( $filterWith )) {
82
+		if( !is_array( $filterWith ) ) {
83 83
 			$filterWith = $this->getTranslations();
84 84
 		}
85
-		$keys = array_flip( array_column( $filterWith, 'id' ));
85
+		$keys = array_flip( array_column( $filterWith, 'id' ) );
86 86
 		$this->results = $intersect
87 87
 			? array_intersect_key( $entries, $keys )
88 88
 			: array_diff_key( $entries, $keys );
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		return $this->translate( $translation, $domain, [
101 101
 			'single' => $text,
102
-		]);
102
+		] );
103 103
 	}
104 104
 
105 105
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		return $this->translate( $translation, $domain, [
115 115
 			'context' => $context,
116 116
 			'single' => $text,
117
-		]);
117
+		] );
118 118
 	}
119 119
 
120 120
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			'number' => $number,
132 132
 			'plural' => $plural,
133 133
 			'single' => $single,
134
-		]);
134
+		] );
135 135
 	}
136 136
 
137 137
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			'number' => $number,
151 151
 			'plural' => $plural,
152 152
 			'single' => $single,
153
-		]);
153
+		] );
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	public function render( $template, array $entry )
161 161
 	{
162 162
 		$data = array_combine(
163
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
163
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
164 164
 			$entry
165 165
 		);
166 166
 		ob_start();
167 167
 		glsr( Template::class )->render( 'partials/translations/'.$template, [
168 168
 			'context' => $data,
169
-		]);
169
+		] );
170 170
 		return ob_get_clean();
171 171
 	}
172 172
 
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
200 200
 				's1' => $this->getEntryString( $entry, 'msgid' ),
201 201
 			];
202
-			$text = !empty( $data['p1'] )
202
+			$text = !empty($data['p1'])
203 203
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
204 204
 				: $data['s1'];
205 205
 			$rendered .= $this->render( 'result', [
206 206
 				'entry' => wp_json_encode( $data ),
207 207
 				'text' => wp_strip_all_tags( $text ),
208
-			]);
208
+			] );
209 209
 		}
210 210
 		if( $resetAfterRender ) {
211 211
 			$this->reset();
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 	public function search( $needle = '' )
239 239
 	{
240 240
 		$this->reset();
241
-		$needle = trim( strtolower( $needle ));
241
+		$needle = trim( strtolower( $needle ) );
242 242
 		foreach( $this->entries() as $key => $entry ) {
243
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
244
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
243
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
244
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
245 245
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
246
-				if( in_array( $needle, [$single, $plural] )) {
246
+				if( in_array( $needle, [$single, $plural] ) ) {
247 247
 					$this->results[$key] = $entry;
248 248
 				}
249 249
 			}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		}
267 267
 		$args = $this->normalizeTranslationArgs( $args );
268 268
 		$strings = $this->getTranslationStrings( $args['single'], $args['plural'] );
269
-		if( empty( $strings )) {
269
+		if( empty($strings) ) {
270 270
 			return $original;
271 271
 		}
272 272
 		$string = current( $strings );
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	protected function getEntryString( array $entry, $key )
283 283
 	{
284
-		return isset( $entry[$key] )
285
-			? implode( '', (array) $entry[$key] )
284
+		return isset($entry[$key])
285
+			? implode( '', (array)$entry[$key] )
286 286
 			: '';
287 287
 	}
288 288
 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	protected function getTranslations()
294 294
 	{
295 295
 		static $translations;
296
-		if( empty( $translations )) {
296
+		if( empty($translations) ) {
297 297
 			$settings = glsr( OptionManager::class )->get( 'settings' );
298
-			$translations = isset( $settings['strings'] )
299
-				? $this->normalizeSettings( (array) $settings['strings'] )
298
+			$translations = isset($settings['strings'])
299
+				? $this->normalizeSettings( (array)$settings['strings'] )
300 300
 				: [];
301 301
 		}
302 302
 		return $translations;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	protected function getTranslationStrings( $single, $plural )
311 311
 	{
312
-		return array_filter( $this->getTranslations(), function( $string ) use( $single, $plural ) {
312
+		return array_filter( $this->getTranslations(), function( $string ) use($single, $plural) {
313 313
 			return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' )
314 314
 				&& $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' );
315 315
 		});
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		$keys = [
324 324
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
325 325
 		];
326
-		array_walk( $entries, function( &$entry ) use( $keys ) {
326
+		array_walk( $entries, function( &$entry ) use($keys) {
327 327
 			foreach( $keys as $key ) {
328 328
 				$entry = $this->normalizeEntryString( $entry, $key );
329 329
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	protected function normalizeEntryString( array $entry, $key )
339 339
 	{
340
-		if( isset( $entry[$key] )) {
340
+		if( isset($entry[$key]) ) {
341 341
 			$entry[$key] = $this->getEntryString( $entry, $key );
342 342
 		}
343 343
 		return $entry;
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
352 352
 		$strings = array_filter( $strings, 'is_array' );
353 353
 		foreach( $strings as &$string ) {
354
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
354
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
355 355
 			$string = wp_parse_args( $string, $defaultString );
356 356
 		}
357 357
 		return array_filter( $strings, function( $string ) {
358
-			return !empty( $string['id'] );
358
+			return !empty($string['id']);
359 359
 		});
360 360
 	}
361 361
 
@@ -379,10 +379,10 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	protected function translatePlural( $domain, array $string, array $args )
381 381
 	{
382
-		if( !empty( $string['s2'] )) {
382
+		if( !empty($string['s2']) ) {
383 383
 			$args['single'] = $string['s2'];
384 384
 		}
385
-		if( !empty( $string['p2'] )) {
385
+		if( !empty($string['p2']) ) {
386 386
 			$args['plural'] = $string['p2'];
387 387
 		}
388 388
 		return get_translations_for_domain( $domain )->translate_plural(
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	protected function translateSingle( $domain, array $string, array $args )
401 401
 	{
402
-		if( !empty( $string['s2'] )) {
402
+		if( !empty($string['s2']) ) {
403 403
 			$args['single'] = $string['s2'];
404 404
 		}
405 405
 		return get_translations_for_domain( $domain )->translate(
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 			'after_widget' => '</div>',
23 23
 			'before_title' => '<h3 class="glsr-shortcode-title">',
24 24
 			'after_title' => '</h3>',
25
-		]);
25
+		] );
26 26
 		$instance = $this->normalize( $instance );
27 27
 		$partial = glsr( Partial::class )->build( $shortcodePartial, $instance );
28
-		if( !empty( $instance['title'] )) {
28
+		if( !empty($instance['title']) ) {
29 29
 			$instance['title'] = $args['before_title'].$instance['title'].$args['after_title'];
30 30
 		}
31 31
 		return $args['before_widget'].$instance['title'].$partial.$args['after_widget'];
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function normalize( $args )
70 70
 	{
71
-		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
71
+		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) );
72 72
 		array_walk( $args, function( &$value, $key ) {
73 73
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
74
-			if( !method_exists( $this, $methodName ))return;
74
+			if( !method_exists( $this, $methodName ) )return;
75 75
 			$value = $this->$methodName( $value );
76 76
 		});
77 77
 		return $this->sanitize( $args );
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function normalizeHide( $hide )
105 105
 	{
106
-		if( is_string( $hide )) {
106
+		if( is_string( $hide ) ) {
107 107
 			$hide = explode( ',', $hide );
108 108
 		}
109 109
 		$hiddenKeys = defined( 'static::HIDDEN_KEYS' )
110 110
 			? static::HIDDEN_KEYS
111 111
 			: [];
112
-		return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) {
112
+		return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) {
113 113
 			return in_array( $value, $hiddenKeys );
114 114
 		});
115 115
 	}
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 			__( 'Terrible', 'site-reviews' ),
138 138
 		];
139 139
 		$defaults = array_pad( $defaults, Rating::MAX_RATING, '' );
140
-		$labels = array_map( 'trim', explode( ',', $labels ));
140
+		$labels = array_map( 'trim', explode( ',', $labels ) );
141 141
 		foreach( $defaults as $i => $label ) {
142
-			if( empty( $labels[$i] ))continue;
142
+			if( empty($labels[$i]) )continue;
143 143
 			$defaults[$i] = $labels[$i];
144 144
 		}
145 145
 		return array_combine( range( Rating::MAX_RATING, 1 ), $defaults );
Please login to merge, or discard this patch.
plugin/Commands/CreateReview.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 	public function __construct( $input )
29 29
 	{
30 30
 		$this->request = $input;
31
-		$this->ajax_request = isset( $input['ajax_request'] );
31
+		$this->ajax_request = isset($input['ajax_request']);
32 32
 		$this->assigned_to = $this->getNumeric( 'assign_to' );
33
-		$this->author = sanitize_text_field( $this->get( 'name' ));
34
-		$this->avatar = get_avatar_url( $this->get( 'email' ));
35
-		$this->blacklisted = isset( $input['blacklisted'] );
36
-		$this->category = sanitize_key( $this->get( 'category' ));
37
-		$this->content = sanitize_textarea_field( $this->get( 'content' ));
33
+		$this->author = sanitize_text_field( $this->get( 'name' ) );
34
+		$this->avatar = get_avatar_url( $this->get( 'email' ) );
35
+		$this->blacklisted = isset($input['blacklisted']);
36
+		$this->category = sanitize_key( $this->get( 'category' ) );
37
+		$this->content = sanitize_textarea_field( $this->get( 'content' ) );
38 38
 		$this->custom = $this->getCustom();
39
-		$this->email = sanitize_email( $this->get( 'email' ));
40
-		$this->form_id = sanitize_key( $this->get( 'form_id' ));
39
+		$this->email = sanitize_email( $this->get( 'email' ) );
40
+		$this->form_id = sanitize_key( $this->get( 'form_id' ) );
41 41
 		$this->ip_address = $this->get( 'ip_address' );
42
-		$this->post_id = intval( $this->get( 'post_id' ));
43
-		$this->rating = intval( $this->get( 'rating' ));
42
+		$this->post_id = intval( $this->get( 'post_id' ) );
43
+		$this->rating = intval( $this->get( 'rating' ) );
44 44
 		$this->referer = $this->get( 'referer' );
45
-		$this->terms = isset( $input['terms'] );
46
-		$this->title = sanitize_text_field( $this->get( 'title' ));
45
+		$this->terms = isset($input['terms']);
46
+		$this->title = sanitize_text_field( $this->get( 'title' ) );
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	protected function get( $key )
54 54
 	{
55
-		return isset( $this->request[$key] )
55
+		return isset($this->request[$key])
56 56
 			? (string)$this->request[$key]
57 57
 			: '';
58 58
 	}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		];
70 70
 		$custom = $this->request;
71 71
 		foreach( $unset as $value ) {
72
-			unset( $custom[$value] );
72
+			unset($custom[$value]);
73 73
 		}
74 74
 		return $custom;
75 75
 	}
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function routerChangeStatus( array $request )
24 24
 	{
25
-		wp_send_json_success( $this->execute( new ChangeStatus( $request )));
25
+		wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	public function routerClearConsole()
32 32
 	{
33 33
 		glsr( AdminController::class )->routerClearConsole();
34
-		wp_send_json_success([
34
+		wp_send_json_success( [
35 35
 			'console' => glsr( Console::class )->get(),
36 36
 			'notices' => glsr( Notice::class )->get(),
37
-		]);
37
+		] );
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	public function routerCountReviews()
44 44
 	{
45 45
 		glsr( AdminController::class )->routerCountReviews();
46
-		wp_send_json_success([
46
+		wp_send_json_success( [
47 47
 			'notices' => glsr( Notice::class )->get(),
48
-		]);
48
+		] );
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$shortcode = $request['shortcode'];
57 57
 		$response = false;
58
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
58
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
59 59
 			$data = glsr()->mceShortcodes[$shortcode];
60
-			if( !empty( $data['errors'] )) {
60
+			if( !empty($data['errors']) ) {
61 61
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
62 62
 			}
63 63
 			$response = [
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	public function routerFetchConsole()
78 78
 	{
79 79
 		glsr( AdminController::class )->routerFetchConsole();
80
-		wp_send_json_success([
80
+		wp_send_json_success( [
81 81
 			'console' => glsr( Console::class )->get(),
82 82
 			'notices' => glsr( Notice::class )->get(),
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public function routerSearchPosts( array $request )
90 90
 	{
91 91
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
92
-		wp_send_json_success([
92
+		wp_send_json_success( [
93 93
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
94 94
 			'items' => $results,
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function routerSearchTranslations( array $request )
102 102
 	{
103
-		if( empty( $request['exclude'] )) {
103
+		if( empty($request['exclude']) ) {
104 104
 			$request['exclude'] = [];
105 105
 		}
106 106
 		$results = glsr( Translator::class )
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 			->exclude()
109 109
 			->exclude( $request['exclude'] )
110 110
 			->renderResults();
111
-		wp_send_json_success([
111
+		wp_send_json_success( [
112 112
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
113 113
 			'items' => $results,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 			'errors' => glsr( Session::class )->get( $request['form_id'].'errors', false, true ),
125 125
 			'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ),
126 126
 			'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ),
127
-			'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ))),
127
+			'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ) ) ),
128 128
 		];
129
-		if( !wp_validate_boolean( $data['errors'] )) {
129
+		if( !wp_validate_boolean( $data['errors'] ) ) {
130 130
 			glsr( Session::class )->clear();
131 131
 			wp_send_json_success( $data );
132 132
 		}
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function routerTogglePinned( array $request )
140 140
 	{
141
-		$isPinned = $this->execute( new TogglePinned( $request ));
142
-		wp_send_json_success([
141
+		$isPinned = $this->execute( new TogglePinned( $request ) );
142
+		wp_send_json_success( [
143 143
 			'notices' => glsr( Notice::class )->get(),
144 144
 			'pinned' => $isPinned,
145
-		]);
145
+		] );
146 146
 	}
147 147
 }
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,15 +17,15 @@  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
 		do_action( 'site-reviews/local/review/submitted', null, $command ); // @compat
26 26
 		do_action( 'site-reviews/review/submitted', $review );
27 27
 		if( $command->ajax_request )return;
28
-		wp_safe_redirect( $this->getReferer( $command ));
28
+		wp_safe_redirect( $this->getReferer( $command ) );
29 29
 		exit;
30 30
 	}
31 31
 
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	protected function getReferer( Command $command )
36 36
 	{
37
-		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
38
-		if( empty( $referer )) {
37
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
38
+		if( empty($referer) ) {
39 39
 			$referer = $command->referer;
40 40
 		}
41
-		if( empty( $referer )) {
41
+		if( empty($referer) ) {
42 42
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
43 43
 			$referer = home_url();
44 44
 		}
Please login to merge, or discard this patch.
deprecated.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,64 +3,64 @@
 block discarded – undo
3 3
 defined( 'WPINC' ) || die;
4 4
 
5 5
 add_action( 'site-reviews/review/submitted', function() {
6
-	if( has_action( 'site-reviews/local/review/submitted' )) {
6
+	if( has_action( 'site-reviews/local/review/submitted' ) ) {
7 7
 		glsr_log()->notice( 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.' );
8 8
 	}
9
-	if( has_filter( 'site-reviews/local/review/submitted/message' )) {
9
+	if( has_filter( 'site-reviews/local/review/submitted/message' ) ) {
10 10
 		glsr_log()->notice( 'The "site-reviews/local/review/submitted/message" hook has been deprecated.' );
11 11
 	}
12 12
 });
13 13
 
14 14
 add_filter( 'site-reviews/create/review-values', function( $values ) {
15
-	if( has_filter( 'site-reviews/local/review' )) {
15
+	if( has_filter( 'site-reviews/local/review' ) ) {
16 16
 		glsr_log()->notice( 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.' );
17 17
 	}
18 18
 	return $values;
19 19
 });
20 20
 
21 21
 add_filter( 'site-reviews/get/defaults', function( $defaults ) {
22
-	if( has_filter( 'site-reviews/addon/defaults' )) {
22
+	if( has_filter( 'site-reviews/addon/defaults' ) ) {
23 23
 		glsr_log()->notice( 'The "site-reviews/addon/defaults" hook has been deprecated. Please use the "site-reviews/get/defaults" hook instead.' );
24 24
 	}
25 25
 	return $defaults;
26 26
 });
27 27
 
28 28
 add_filter( 'site-reviews/rating/average', function( $average ) {
29
-	if( has_filter( 'site-reviews/average/rating' )) {
29
+	if( has_filter( 'site-reviews/average/rating' ) ) {
30 30
 		glsr_log()->notice( 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.' );
31 31
 	}
32 32
 	return $average;
33 33
 });
34 34
 
35 35
 add_filter( 'site-reviews/rating/ranking', function( $ranking ) {
36
-	if( has_filter( 'site-reviews/bayesian/ranking' )) {
36
+	if( has_filter( 'site-reviews/bayesian/ranking' ) ) {
37 37
 		glsr_log()->notice( 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.' );
38 38
 	}
39 39
 	return $ranking;
40 40
 });
41 41
 
42 42
 add_filter( 'site-reviews/review/build/before', function( $review ) {
43
-	if( has_filter( 'site-reviews/rendered/review/meta/order' )) {
43
+	if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) {
44 44
 		glsr_log()->notice( 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom template instead (refer to the documentation).' );
45 45
 	}
46
-	if( has_filter( 'site-reviews/rendered/review/order' )) {
46
+	if( has_filter( 'site-reviews/rendered/review/order' ) ) {
47 47
 		glsr_log()->notice( 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom template instead (refer to the documentation).' );
48 48
 	}
49 49
 	return $review;
50 50
 });
51 51
 
52 52
 add_filter( 'site-reviews/review/build/after', function( $review ) {
53
-	if( has_filter( 'site-reviews/reviews/review/text' )) {
53
+	if( has_filter( 'site-reviews/reviews/review/text' ) ) {
54 54
 		glsr_log()->notice( 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.' );
55 55
 	}
56
-	if( has_filter( 'site-reviews/reviews/review/title' )) {
56
+	if( has_filter( 'site-reviews/reviews/review/title' ) ) {
57 57
 		glsr_log()->notice( 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.' );
58 58
 	}
59 59
 	return $review;
60 60
 });
61 61
 
62 62
 add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) {
63
-	if( has_filter( 'site-reviews/enqueue/localize' )) {
63
+	if( has_filter( 'site-reviews/enqueue/localize' ) ) {
64 64
 		glsr_log()->notice( 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.' );
65 65
 	}
66 66
 	return $variables;
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				'response' => $this->buildResponse(),
66 66
 				'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(),
67 67
 			],
68
-		]);
68
+		] );
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			'context' => [
78 78
 				'text' => trim( $this->getLoginText().' '.$this->getRegisterText() ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	protected function buildRecaptcha()
87 87
 	{
88 88
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
89
-		return glsr( Builder::class )->div([
89
+		return glsr( Builder::class )->div( [
90 90
 			'class' => 'glsr-recaptcha-holder',
91 91
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
92
-			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )),
92
+			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ),
93 93
 			'data-size' => 'invisible',
94
-		]);
94
+		] );
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function buildResponse()
101 101
 	{
102
-		$classes = !empty( $this->errors )
102
+		$classes = !empty($this->errors)
103 103
 			? glsr( StyleValidationDefaults::class )->defaults()['message_error_class']
104 104
 			: '';
105 105
 		return glsr( Template::class )->build( 'templates/form/response', [
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 				'class' => $classes,
108 108
 				'message' => wpautop( $this->message ),
109 109
 			],
110
-			'has_errors' => !empty( $this->errors ),
111
-		]);
110
+			'has_errors' => !empty($this->errors),
111
+		] );
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'context' => [
121 121
 				'text' => __( 'Submit your review', 'site-reviews' ),
122 122
 			],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$fields = array_merge(
140 140
 			$this->getHiddenFields(),
141 141
 			[$this->getHoneypotField()],
142
-			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ))
142
+			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) )
143 143
 		);
144 144
 		return $fields;
145 145
 	}
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function getLoginText()
151 151
 	{
152
-		$loginLink = glsr( Builder::class )->a([
153
-			'href' => wp_login_url( strval( get_permalink() )),
152
+		$loginLink = glsr( Builder::class )->a( [
153
+			'href' => wp_login_url( strval( get_permalink() ) ),
154 154
 			'text' => __( 'logged in', 'site-reviews' ),
155
-		]);
155
+		] );
156 156
 		return sprintf( __( 'You must be %s to submit a review.', 'site-reviews' ), $loginLink );
157 157
 	}
158 158
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	protected function getRegisterText()
163 163
 	{
164 164
 		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
165
-		$registerLink = glsr( Builder::class )->a([
165
+		$registerLink = glsr( Builder::class )->a( [
166 166
 			'href' => wp_registration_url(),
167 167
 			'text' => __( 'register', 'site-reviews' ),
168
-		]);
168
+		] );
169 169
 		return sprintf( __( 'You may also %s for an account.', 'site-reviews' ), $registerLink );
170 170
 	}
171 171
 
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
 		$fields = [[
178 178
 			'name' => 'action',
179 179
 			'value' => 'submit-review',
180
-		],[
180
+		], [
181 181
 			'name' => 'assign_to',
182 182
 			'value' => $this->args['assign_to'],
183
-		],[
183
+		], [
184 184
 			'name' => 'category',
185 185
 			'value' => $this->args['category'],
186
-		],[
186
+		], [
187 187
 			'name' => 'excluded',
188 188
 			'value' => $this->args['excluded'], // @todo should default to "[]"
189
-		],[
189
+		], [
190 190
 			'name' => 'form_id',
191 191
 			'value' => $this->args['id'],
192
-		],[
192
+		], [
193 193
 			'name' => 'nonce',
194 194
 			'value' => wp_create_nonce( 'submit-review' ),
195
-		],[
195
+		], [
196 196
 			'name' => 'post_id',
197 197
 			'value' => get_the_ID(),
198
-		],[
198
+		], [
199 199
 			'name' => 'referer',
200
-			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )),
200
+			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ),
201 201
 		]];
202 202
 		return array_map( function( $field ) {
203
-			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ));
203
+			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) );
204 204
 		}, $fields );
205 205
 	}
206 206
 
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function getHoneypotField()
211 211
 	{
212
-		return new Field([
212
+		return new Field( [
213 213
 			'name' => 'gotcha',
214 214
 			'type' => 'honeypot',
215
-		]);
215
+		] );
216 216
 	}
217 217
 
218 218
 	/**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function normalizeFieldClass( Field &$field )
222 222
 	{
223
-		if( !isset( $field->field['class'] )) {
223
+		if( !isset($field->field['class']) ) {
224 224
 			$field->field['class'] = '';
225 225
 		}
226 226
 		$field->field['class'] = trim( $field->field['class'].' glsr-field-control' );
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	protected function normalizeFieldErrors( Field &$field )
233 233
 	{
234
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
234
+		if( !array_key_exists( $field->field['path'], $this->errors ) )return;
235 235
 		$field->field['errors'] = $this->errors[$field->field['path']];
236 236
 	}
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	protected function normalizeFieldRequired( Field &$field )
242 242
 	{
243
-		if( !in_array( $field->field['path'], $this->required ))return;
243
+		if( !in_array( $field->field['path'], $this->required ) )return;
244 244
 		$field->field['required'] = true;
245 245
 	}
246 246
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	protected function normalizeFieldValue( Field &$field )
266 266
 	{
267
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
268
-		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
267
+		if( !array_key_exists( $field->field['path'], $this->values ) )return;
268
+		if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) {
269 269
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
270 270
 		}
271 271
 		else {
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				'navigation' => $navigation,
57 57
 				'reviews' => $this->buildReviews(),
58 58
 			],
59
-		]);
59
+		] );
60 60
 	}
61 61
 
62 62
 	/**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 		$reviews = '';
68 68
 		foreach( $this->reviews->results as $index => $result ) {
69 69
 			$this->current = $index;
70
-			$reviews.= glsr( Template::class )->build( 'templates/review', [
70
+			$reviews .= glsr( Template::class )->build( 'templates/review', [
71 71
 				'context' => $this->buildReview( $result )->values,
72
-			]);
72
+			] );
73 73
 		}
74 74
 		return $reviews;
75 75
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$reviewValues = [];
85 85
 		foreach( $review as $key => $value ) {
86 86
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
87
-			if( !method_exists( $this, $method ))continue;
87
+			if( !method_exists( $this, $method ) )continue;
88 88
 			$reviewValues[$key] = $this->$method( $key, $value );
89 89
 		}
90 90
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', (array)$reviewValues );
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function buildOptionAssignedTo( $key, $value )
100 100
 	{
101
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
102
-		$post = get_post( intval( $value ));
103
-		if( !( $post instanceof WP_Post ))return;
101
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
102
+		$post = get_post( intval( $value ) );
103
+		if( !($post instanceof WP_Post) )return;
104 104
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
105 105
 			'href' => get_the_permalink( $post->ID ),
106
-		]);
106
+		] );
107 107
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
108 108
 		return $this->wrap( $key, '<span>'.$assignedTo.'</span>' );
109 109
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	protected function buildOptionAuthor( $key, $value )
117 117
 	{
118
-		if( $this->isHidden( $key ))return;
118
+		if( $this->isHidden( $key ) )return;
119 119
 		return $this->wrap( $key, '<span>'.$value.'</span>' );
120 120
 	}
121 121
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function buildOptionAvatar( $key, $value )
128 128
 	{
129
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
129
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
130 130
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
131
-		return $this->wrap( $key, glsr( Builder::class )->img([
131
+		return $this->wrap( $key, glsr( Builder::class )->img( [
132 132
 			'src' => $this->generateAvatar( $value ),
133 133
 			'height' => $size,
134 134
 			'width' => $size,
135
-		]));
135
+		] ) );
136 136
 	}
137 137
 
138 138
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	protected function buildOptionContent( $key, $value )
144 144
 	{
145 145
 		$text = $this->normalizeText( $value );
146
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
146
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
147 147
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
148 148
 	}
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	protected function buildOptionDate( $key, $value )
156 156
 	{
157
-		if( $this->isHidden( $key ))return;
157
+		if( $this->isHidden( $key ) )return;
158 158
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
159 159
 		if( $dateFormat == 'relative' ) {
160 160
 			$date = glsr( Date::class )->relative( $value );
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			$format = $dateFormat == 'custom'
164 164
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
165 165
 				: (string)get_option( 'date_format' );
166
-			$date = date_i18n( $format, strtotime( $value ));
166
+			$date = date_i18n( $format, strtotime( $value ) );
167 167
 		}
168 168
 		return $this->wrap( $key, '<span>'.$date.'</span>' );
169 169
 	}
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function buildOptionRating( $key, $value )
177 177
 	{
178
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
178
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
179 179
 		$rating = glsr( Partial::class )->build( 'star-rating', [
180 180
 			'rating' => $value,
181
-		]);
181
+		] );
182 182
 		return $this->wrap( $key, $rating );
183 183
 	}
184 184
 
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	protected function buildOptionResponse( $key, $value )
191 191
 	{
192
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
193
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
192
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
193
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
194 194
 		$text = $this->normalizeText( $value );
195 195
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
196 196
 		return $this->wrap( $key,
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	protected function buildOptionTitle( $key, $value )
208 208
 	{
209
-		if( $this->isHidden( $key ))return;
210
-		if( empty( $value )) {
209
+		if( $this->isHidden( $key ) )return;
210
+		if( empty($value) ) {
211 211
 			$value = __( 'No Title', 'site-reviews' );
212 212
 		}
213 213
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 			return $avatarUrl;
225 225
 		}
226 226
 		$authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id );
227
-		if( empty( $authorIdOrEmail )) {
227
+		if( empty($authorIdOrEmail) ) {
228 228
 			$authorIdOrEmail = $review->email;
229 229
 		}
230
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
230
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
231 231
 			return $newAvatar;
232 232
 		}
233 233
 		return $avatarUrl;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function generateSchema()
240 240
 	{
241
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
241
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
242 242
 		glsr( Schema::class )->store(
243 243
 			glsr( Schema::class )->build( $this->args )
244 244
 		);
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	protected function getExcerpt( $text )
263 263
 	{
264
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
264
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
265 265
 		$split = extension_loaded( 'intl' )
266 266
 			? $this->getExcerptIntlSplit( $text, $limit )
267 267
 			: $this->getExcerptSplit( $text, $limit );
268 268
 		$hiddenText = substr( $text, $split );
269
-		if( !empty( $hiddenText )) {
269
+		if( !empty($hiddenText) ) {
270 270
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
271 271
 				'class' => 'glsr-hidden glsr-hidden-text',
272 272
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
273 273
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
274
-			]);
275
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
274
+			] );
275
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
276 276
 		}
277 277
 		return nl2br( $text );
278 278
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
288 288
 		$words->setText( $text );
289 289
 		$count = 0;
290
-		foreach( $words as $offset ){
290
+		foreach( $words as $offset ) {
291 291
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
292 292
 			$count++;
293 293
 			if( $count != $limit )continue;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	protected function getExcerptSplit( $text, $limit )
305 305
 	{
306 306
 		if( str_word_count( $text, 0 ) > $limit ) {
307
-			$words = array_keys( str_word_count( $text, 2 ));
307
+			$words = array_keys( str_word_count( $text, 2 ) );
308 308
 			return $words[$limit];
309 309
 		}
310 310
 		return strlen( $text );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	protected function getOption( $path, $fallback = '' )
319 319
 	{
320
-		if( array_key_exists( $path, $this->options )) {
320
+		if( array_key_exists( $path, $this->options ) ) {
321 321
 			return $this->options[$path];
322 322
 		}
323 323
 		return $fallback;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	protected function isHidden( $key, $path = '' )
332 332
 	{
333
-		$isOptionEnabled = !empty( $path )
333
+		$isOptionEnabled = !empty($path)
334 334
 			? $this->isOptionEnabled( $path )
335 335
 			: true;
336 336
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	protected function isHiddenOrEmpty( $key, $value )
345 345
 	{
346
-		return $this->isHidden( $key ) || empty( $value );
346
+		return $this->isHidden( $key ) || empty($value);
347 347
 	}
348 348
 
349 349
 	/**
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 	protected function normalizeText( $text )
363 363
 	{
364 364
 		$text = wp_kses( $text, wp_kses_allowed_html() );
365
-		$text = convert_smilies( strip_shortcodes( $text ));
365
+		$text = convert_smilies( strip_shortcodes( $text ) );
366 366
 		$text = str_replace( ']]>', ']]&gt;', $text );
367 367
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
368
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
368
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
369 369
 			$text = $this->getExcerpt( $text );
370 370
 		}
371 371
 		return wptexturize( $text );
@@ -380,6 +380,6 @@  discard block
 block discarded – undo
380 380
 	{
381 381
 		return glsr( Builder::class )->div( $value, [
382 382
 			'class' => 'glsr-review-'.$key,
383
-		]);
383
+		] );
384 384
 	}
385 385
 }
Please login to merge, or discard this patch.