Passed
Push — hotfix/fix-counts ( 0ee906...e9420b )
by Paul
03:57
created
plugin/Application.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 	public function catchFatalError()
61 61
 	{
62 62
 		$error = error_get_last();
63
-		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false )return;
63
+		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false ) {
64
+			return;
65
+		}
64 66
 		glsr_log()->error( $error['message'] );
65 67
 	}
66 68
 
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
 		$filePaths[] = $this->path( $view );
112 114
 		$filePaths[] = $this->path( 'views/'.$view );
113 115
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
116
+			if( !file_exists( $file )) {
117
+				continue;
118
+			}
115 119
 			return $file;
116 120
 		}
117 121
 	}
@@ -215,7 +219,9 @@  discard block
 block discarded – undo
215 219
 	 */
216 220
 	public function scheduleCronJob()
217 221
 	{
218
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
222
+		if( wp_next_scheduled( static::CRON_EVENT )) {
223
+			return;
224
+		}
219 225
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
220 226
 	}
221 227
 
@@ -255,7 +261,9 @@  discard block
 block discarded – undo
255 261
 			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
256 262
 			|| $data['action'] != 'update'
257 263
 			|| $data['type'] != 'plugin'
258
-		)return;
264
+		) {
265
+			return;
266
+		}
259 267
 		$this->upgrade();
260 268
 	}
261 269
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = $className.'::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'addons' => 'install_plugins',
138 138
 			'settings' => 'manage_options',
139 139
 		];
140
-		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ));
140
+		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function hasPermission( $page = '' )
147 147
 	{
148 148
 		$isAdmin = $this->isAdmin();
149
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->getPermission( $page )));
149
+		return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) ));
150 150
 	}
151 151
 
152 152
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		$path = plugin_dir_path( $this->file );
176 176
 		if( !$realpath ) {
177
-			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ));
177
+			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
178 178
 		}
179 179
 		$path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
180 180
 		return apply_filters( 'site-reviews/path', $path, $file );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$types = apply_filters( 'site-reviews/addon/types', [] );
207 207
 		$this->reviewTypes = wp_parse_args( $types, [
208 208
 			'local' => __( 'Local', 'site-reviews' ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
219 219
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
220
-		if( !file_exists( $file )) {
220
+		if( !file_exists( $file ) ) {
221 221
 			glsr_log()->error( 'File not found: '.$file );
222 222
 			return;
223 223
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function scheduleCronJob()
233 233
 	{
234
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
234
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
235 235
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
236 236
 	}
237 237
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function unscheduleCronJob()
251 251
 	{
252
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
252
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
253 253
 	}
254 254
 
255 255
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function url( $path = '' )
283 283
 	{
284
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
284
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
285 285
 		return apply_filters( 'site-reviews/url', $url, $path );
286 286
 	}
287 287
 }
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 		foreach( glsr( ReviewManager::class )->get( $this->args ) as $review ) {
36 36
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
37 37
 			// @see https://developers.google.com/search/docs/data-types/review
38
-			if( $review->review_type != 'local' )continue;
38
+			if( $review->review_type != 'local' ) {
39
+				continue;
40
+			}
39 41
 			$reviews[] = $this->buildReview( $review );
40 42
 		}
41 43
 		if( !empty( $reviews )) {
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 	 */
81 83
 	public function render()
82 84
 	{
83
-		if( empty( glsr()->schemas ))return;
85
+		if( empty( glsr()->schemas )) {
86
+			return;
87
+		}
84 88
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
85 89
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
86 90
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -132,7 +136,9 @@  discard block
 block discarded – undo
132 136
 	{
133 137
 		foreach( $values as $value ) {
134 138
 			$option = $this->getSchemaOptionValue( $value );
135
-			if( empty( $option ))continue;
139
+			if( empty( $option )) {
140
+				continue;
141
+			}
136 142
 			$schema->$value( $option );
137 143
 		}
138 144
 		return $schema;
@@ -242,7 +248,9 @@  discard block
 block discarded – undo
242 248
 		if( $value != $fallback ) {
243 249
 			return $value;
244 250
 		}
245
-		if( !is_single() && !is_page() )return;
251
+		if( !is_single() && !is_page() ) {
252
+			return;
253
+		}
246 254
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
247 255
 		if( method_exists( $this, $method )) {
248 256
 			return $this->$method();
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 			if( $review->review_type != 'local' )continue;
39 39
 			$reviews[] = $this->buildReview( $review );
40 40
 		}
41
-		if( !empty( $reviews )) {
41
+		if( !empty($reviews) ) {
42 42
 			array_walk( $reviews, function( &$review ) {
43
-				unset( $review['@context'] );
44
-				unset( $review['itemReviewed'] );
43
+				unset($review['@context']);
44
+				unset($review['itemReviewed']);
45 45
 			});
46 46
 			$schema['review'] = $reviews;
47 47
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function buildSummary( $args = null )
56 56
 	{
57
-		if( is_array( $args )) {
57
+		if( is_array( $args ) ) {
58 58
 			$this->args = $args;
59 59
 		}
60 60
 		$buildSummary = glsr( Helper::class )->buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' );
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		$schema = method_exists( $this, $buildSummary )
63 63
 			? $this->$buildSummary()
64 64
 			: $this->buildSummaryForCustom();
65
-		if( !empty( $count )) {
65
+		if( !empty($count) ) {
66 66
 			$schema->aggregateRating(
67 67
 				$this->getSchemaType( 'AggregateRating' )
68 68
 					->ratingValue( $this->getRatingValue() )
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function render()
82 82
 	{
83
-		if( empty( glsr()->schemas ))return;
83
+		if( empty(glsr()->schemas) )return;
84 84
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
85 85
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
86 86
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
87
-		));
87
+		) );
88 88
 	}
89 89
 
90 90
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	{
95 95
 		$schemas = glsr()->schemas;
96 96
 		$schemas[] = $schema;
97
-		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas )));
97
+		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) );
98 98
 	}
99 99
 
100 100
 	/**
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
 	protected function buildReview( $review )
105 105
 	{
106 106
 		$schema = $this->getSchemaType( 'Review' )
107
-			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use( $review ) {
107
+			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use($review) {
108 108
 				$schema->name( $review->title );
109 109
 			})
110
-			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use( $review ) {
110
+			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use($review) {
111 111
 				$schema->reviewBody( $review->content );
112 112
 			})
113
-			->datePublished(( new DateTime( $review->date )))
114
-			->author( $this->getSchemaType( 'Person' )->name( $review->author ))
115
-			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' )));
116
-		if( !empty( $review->rating )) {
113
+			->datePublished( (new DateTime( $review->date )) )
114
+			->author( $this->getSchemaType( 'Person' )->name( $review->author ) )
115
+			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) );
116
+		if( !empty($review->rating) ) {
117 117
 			$schema->reviewRating(
118 118
 				$this->getSchemaType( 'Rating' )
119 119
 					->ratingValue( $review->rating )
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		foreach( $values as $value ) {
134 134
 			$option = $this->getSchemaOptionValue( $value );
135
-			if( empty( $option ))continue;
135
+			if( empty($option) )continue;
136 136
 			$schema->$value( $option );
137 137
 		}
138 138
 		return $schema;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	{
146 146
 		return $this->buildSchemaValues( $this->getSchemaType(), [
147 147
 			'description', 'image', 'name', 'url',
148
-		]);
148
+		] );
149 149
 	}
150 150
 
151 151
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		return $this->buildSchemaValues( $this->buildSummaryForCustom(), [
157 157
 			'address', 'priceRange', 'telephone',
158
-		]);
158
+		] );
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 		$offerType = $this->getSchemaOption( 'offerType', 'AggregateOffer' );
167 167
 		$offers = $this->buildSchemaValues( $this->getSchemaType( $offerType ), [
168 168
 			'highPrice', 'lowPrice', 'price', 'priceCurrency',
169
-		]);
169
+		] );
170 170
 		return $this->buildSummaryForCustom()
171
-			->doIf( !empty( $offers->getProperties() ), function( $schema ) use( $offers ) {
171
+			->doIf( !empty($offers->getProperties()), function( $schema ) use($offers) {
172 172
 				$schema->offers( $offers );
173 173
 			})
174 174
 			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ).'#product' );
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	protected function getRatingCounts()
181 181
 	{
182
-		if( !isset( $this->ratingCounts )) {
182
+		if( !isset($this->ratingCounts) ) {
183 183
 			$this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $this->args );
184 184
 		}
185 185
 		return $this->ratingCounts;
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 	protected function getSchemaOption( $option, $fallback )
202 202
 	{
203 203
 		$option = strtolower( $option );
204
-		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) {
204
+		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
205 205
 			return $schemaOption;
206 206
 		}
207 207
 		$setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option );
208
-		if( is_array( $setting )) {
208
+		if( is_array( $setting ) ) {
209 209
 			return $this->getSchemaOptionDefault( $setting, $fallback );
210 210
 		}
211
-		return !empty( $setting )
211
+		return !empty($setting)
212 212
 			? $setting
213 213
 			: $fallback;
214 214
 	}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		$setting = wp_parse_args( $setting, [
223 223
 			'custom' => '',
224 224
 			'default' => $fallback,
225
-		]);
225
+		] );
226 226
 		return $setting['default'] != 'custom'
227 227
 			? $setting['default']
228 228
 			: $setting['custom'];
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		}
242 242
 		if( !is_single() && !is_page() )return;
243 243
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
244
-		if( method_exists( $this, $method )) {
244
+		if( method_exists( $this, $method ) ) {
245 245
 			return $this->$method();
246 246
 		}
247 247
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function getSchemaType( $type = null )
254 254
 	{
255
-		if( !is_string( $type )) {
255
+		if( !is_string( $type ) ) {
256 256
 			$type = $this->getSchemaOption( 'type', 'LocalBusiness' );
257 257
 		}
258 258
 		$className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' );
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	protected function getThingDescription()
268 268
 	{
269 269
 		$post = get_post();
270
-		if( !( $post instanceof WP_Post )) {
270
+		if( !($post instanceof WP_Post) ) {
271 271
 			return '';
272 272
 		}
273
-		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ));
274
-		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ));
273
+		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) );
274
+		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) );
275 275
 	}
276 276
 
277 277
 	/**
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	public function __construct( array $values = [] )
16 16
 	{
17 17
 		$this->values = $values;
18
-		parent::__construct( $values, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
18
+		parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
19 19
 	}
20 20
 
21 21
 	/**
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __toString()
35 35
 	{
36
-		if( empty( $this->values ))return;
36
+		if( empty($this->values) )return;
37 37
 		return glsr( Template::class )->build( 'templates/review', [
38 38
 			'context' => $this->values,
39
-		]);
39
+		] );
40 40
 	}
41 41
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
 	 */
34 34
 	public function __toString()
35 35
 	{
36
-		if( empty( $this->values ))return;
36
+		if( empty( $this->values )) {
37
+			return;
38
+		}
37 39
 		return glsr( Template::class )->build( 'templates/review', [
38 40
 			'context' => $this->values,
39 41
 		]);
Please login to merge, or discard this patch.
plugin/Reviews.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		$this->args = $args;
30 30
 		$this->max_num_pages = $maxPageCount;
31 31
 		$this->results = $reviews;
32
-		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
32
+		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
 	}
34 34
 
35 35
 	/**
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function build( array $args = [] )
70 70
 	{
71
-		if( empty( $this->ID )) {
71
+		if( empty($this->ID) ) {
72 72
 			return new ReviewHtml;
73 73
 		}
74 74
 		$partial = glsr( SiteReviewsPartial::class );
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function offsetGet( $key )
94 94
 	{
95
-		if( property_exists( $this, $key )) {
95
+		if( property_exists( $this, $key ) ) {
96 96
 			return $this->$key;
97 97
 		}
98
-		if( array_key_exists( $key, (array)$this->custom )) {
98
+		if( array_key_exists( $key, (array)$this->custom ) ) {
99 99
 			return $this->custom[$key];
100 100
 		}
101 101
 		return null;
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function offsetSet( $key, $value )
110 110
 	{
111
-		if( property_exists( $this, $key )) {
111
+		if( property_exists( $this, $key ) ) {
112 112
 			$this->$key = $value;
113 113
 			return;
114 114
 		}
115
-		if( !is_array( $this->custom )) {
115
+		if( !is_array( $this->custom ) ) {
116 116
 			$this->custom = array_filter( (array)$this->custom );
117 117
 		}
118 118
 		$this->custom[$key] = $value;
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 			'review_type' => 'local',
158 158
 		];
159 159
 		$meta = array_filter(
160
-			array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))),
160
+			array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ),
161 161
 			'strlen'
162 162
 		);
163
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
163
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
164 164
 		$this->modified = $this->isModified( $properties );
165 165
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
166
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
167 167
 			$this->$key = maybe_unserialize( $value );
168 168
 		});
169 169
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	protected function setTermIds( WP_Post $post )
175 175
 	{
176 176
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
177
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
178 178
 		foreach( $terms as $term ) {
179 179
 			$this->term_ids[] = $term->term_id;
180 180
 		}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function __construct( WP_Post $post )
38 38
 	{
39
-		if( $post->post_type != Application::POST_TYPE )return;
39
+		if( $post->post_type != Application::POST_TYPE ) {
40
+			return;
41
+		}
40 42
 		$this->content = $post->post_content;
41 43
 		$this->date = $post->post_date;
42 44
 		$this->ID = intval( $post->ID );
@@ -163,7 +165,9 @@  discard block
 block discarded – undo
163 165
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
164 166
 		$this->modified = $this->isModified( $properties );
165 167
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
168
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
169
+				return;
170
+			}
167 171
 			$this->$key = maybe_unserialize( $value );
168 172
 		});
169 173
 	}
@@ -174,7 +178,9 @@  discard block
 block discarded – undo
174 178
 	protected function setTermIds( WP_Post $post )
175 179
 	{
176 180
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
181
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
182
+			return;
183
+		}
178 184
 		foreach( $terms as $term ) {
179 185
 			$this->term_ids[] = $term->term_id;
180 186
 		}
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +18 added lines, -18 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( Translation::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
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	public function routerSubmitReview( array $request )
121 121
 	{
122 122
 		$command = glsr( PublicController::class )->routerSubmitReview( $request );
123
-		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
123
+		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
124 124
 		$redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
125 125
 		$data = [
126 126
 			'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function routerTogglePinned( array $request )
142 142
 	{
143
-		$isPinned = $this->execute( new TogglePinned( $request ));
144
-		wp_send_json_success([
143
+		$isPinned = $this->execute( new TogglePinned( $request ) );
144
+		wp_send_json_success( [
145 145
 			'notices' => glsr( Notice::class )->get(),
146 146
 			'pinned' => $isPinned,
147
-		]);
147
+		] );
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	public function filterEnqueuedScripts( $tag, $handle )
34 34
 	{
35 35
 		$scripts = [Application::ID.'/google-recaptcha'];
36
-		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) {
36
+		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) {
37 37
 			$tag = str_replace( ' src=', ' async src=', $tag );
38 38
 		}
39
-		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) {
39
+		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) {
40 40
 			$tag = str_replace( ' src=', ' defer src=', $tag );
41 41
 		}
42 42
 		return $tag;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function filterFieldOrder( array $config )
51 51
 	{
52
-		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ));
52
+		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) );
53 53
 		return array_intersect_key( array_merge( array_flip( $order ), $config ), $config );
54 54
 	}
55 55
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$validated = glsr( ValidateReview::class )->validate( $request );
102 102
 		$command = new CreateReview( $validated->request );
103
-		if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) {
103
+		if( empty($validated->error) && !$validated->recaptchaIsUnset ) {
104 104
 			$this->execute( $command );
105 105
 		}
106 106
 		return $command;
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 				$termId = intval( $termId );
126 126
 			}
127 127
 			$term = term_exists( $termId, Application::TAXONOMY );
128
-			if( !isset( $term['term_id'] ))continue;
128
+			if( !isset( $term['term_id'] )) {
129
+				continue;
130
+			}
129 131
 			$terms[] = $term;
130 132
 		}
131 133
 		return $terms;
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
 	 */
138 140
 	public function revert( $postId )
139 141
 	{
140
-		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
142
+		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) {
143
+			return;
144
+		}
141 145
 		delete_post_meta( $postId, '_edit_last' );
142 146
 		$result = wp_update_post([
143 147
 			'ID' => $postId,
@@ -182,7 +186,9 @@  discard block
 block discarded – undo
182 186
 	protected function setTerms( $postId, $termIds )
183 187
 	{
184 188
 		$termIds = $this->normalizeTermIds( $termIds );
185
-		if( empty( $termIds ))return;
189
+		if( empty( $termIds )) {
190
+			return;
191
+		}
186 192
 		$termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
187 193
 		if( is_wp_error( $termTaxonomyIds )) {
188 194
 			glsr_log()->error( $termTaxonomyIds->get_error_message() );
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 			'post_type' => Application::POST_TYPE,
40 40
 		];
41 41
 		$postId = wp_insert_post( $postValues, true );
42
-		if( is_wp_error( $postId )) {
42
+		if( is_wp_error( $postId ) ) {
43 43
 			glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
44 44
 			return false;
45 45
 		}
46 46
 		$this->setTerms( $postId, $command->category );
47
-		$review = $this->single( get_post( $postId ));
47
+		$review = $this->single( get_post( $postId ) );
48 48
 		do_action( 'site-reviews/review/created', $review, $command );
49 49
 		return $review;
50 50
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function delete( $metaReviewId )
57 57
 	{
58
-		if( $postId = $this->getPostId( $metaReviewId )) {
58
+		if( $postId = $this->getPostId( $metaReviewId ) ) {
59 59
 			wp_delete_post( $postId, true );
60 60
 		}
61 61
 	}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 	public function getRatingCounts( array $args = [] )
114 114
 	{
115 115
 		$args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args );
116
-		$counts = glsr( CountsManager::class )->get([
116
+		$counts = glsr( CountsManager::class )->get( [
117 117
 			'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ),
118 118
 			'term_ids' => $this->normalizeTermIds( $args['category'] ),
119 119
 			'type' => $args['type'],
120
-		]);
120
+		] );
121 121
 		return glsr( CountsManager::class )->flatten( $counts, [
122 122
 			'min' => $args['rating'],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public function normalizeTermIds( $commaSeparatedTermIds )
131 131
 	{
132 132
 		$termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' );
133
-		return array_unique( array_map( 'intval', $termIds ));
133
+		return array_unique( array_map( 'intval', $termIds ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		$terms = [];
143 143
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
144 144
 		foreach( $termIds as $termId ) {
145
-			if( is_numeric( $termId )) {
145
+			if( is_numeric( $termId ) ) {
146 146
 				$termId = intval( $termId );
147 147
 			}
148 148
 			$term = term_exists( $termId, Application::TAXONOMY );
149
-			if( !isset( $term['term_id'] ))continue;
149
+			if( !isset($term['term_id']) )continue;
150 150
 			$terms[] = $term;
151 151
 		}
152 152
 		return $terms;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
162 162
 		delete_post_meta( $postId, '_edit_last' );
163
-		$result = wp_update_post([
163
+		$result = wp_update_post( [
164 164
 			'ID' => $postId,
165 165
 			'post_content' => get_post_meta( $postId, 'content', true ),
166 166
 			'post_date' => get_post_meta( $postId, 'date', true ),
167 167
 			'post_title' => get_post_meta( $postId, 'title', true ),
168
-		]);
169
-		if( is_wp_error( $result )) {
168
+		] );
169
+		if( is_wp_error( $result ) ) {
170 170
 			glsr_log()->error( $result->get_error_message() );
171 171
 		}
172 172
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	protected function getNewPostStatus( array $review, $isBlacklisted )
191 191
 	{
192 192
 		$requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' );
193
-		return $review['review_type'] == 'local' && ( $requireApproval || $isBlacklisted )
193
+		return $review['review_type'] == 'local' && ($requireApproval || $isBlacklisted)
194 194
 			? 'pending'
195 195
 			: 'publish';
196 196
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	protected function setTerms( $postId, $termIds )
204 204
 	{
205 205
 		$termIds = $this->normalizeTermIds( $termIds );
206
-		if( empty( $termIds ))return;
206
+		if( empty($termIds) )return;
207 207
 		$termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
208
-		if( is_wp_error( $termTaxonomyIds )) {
208
+		if( is_wp_error( $termTaxonomyIds ) ) {
209 209
 			glsr_log()->error( $termTaxonomyIds->get_error_message() );
210 210
 		}
211 211
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 2 patches
Braces   +42 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
 			$field = method_exists( $this, $method )
68 68
 				? $this->$method( $key, $value )
69 69
 				: apply_filters( 'site-reviews/review/build/'.$key, false, $value, $this, $review );
70
-			if( $field === false )continue;
70
+			if( $field === false ) {
71
+				continue;
72
+			}
71 73
 			$renderedFields[$key] = $field;
72 74
 		}
73 75
 		$this->wrap( $renderedFields, $review );
@@ -95,7 +97,9 @@  discard block
 block discarded – undo
95 97
 	 */
96 98
 	public function generateSchema()
97 99
 	{
98
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
100
+		if( !wp_validate_boolean( $this->args['schema'] )) {
101
+			return;
102
+		}
99 103
 		glsr( Schema::class )->store(
100 104
 			glsr( Schema::class )->build( $this->args )
101 105
 		);
@@ -121,9 +125,13 @@  discard block
 block discarded – undo
121 125
 	 */
122 126
 	protected function buildOptionAssignedTo( $key, $value )
123 127
 	{
124
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
128
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) {
129
+			return;
130
+		}
125 131
 		$post = glsr( Polylang::class )->getPost( $value );
126
-		if( !( $post instanceof WP_Post ))return;
132
+		if( !( $post instanceof WP_Post )) {
133
+			return;
134
+		}
127 135
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
128 136
 			'href' => get_the_permalink( $post->ID ),
129 137
 		]);
@@ -138,7 +146,9 @@  discard block
 block discarded – undo
138 146
 	 */
139 147
 	protected function buildOptionAuthor( $key, $value )
140 148
 	{
141
-		if( $this->isHidden( $key ))return;
149
+		if( $this->isHidden( $key )) {
150
+			return;
151
+		}
142 152
 		return '<span>'.$value.'</span>';
143 153
 	}
144 154
 
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 	 */
150 160
 	protected function buildOptionAvatar( $key, $value )
151 161
 	{
152
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
162
+		if( $this->isHidden( $key, 'settings.reviews.avatars' )) {
163
+			return;
164
+		}
153 165
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
154 166
 		return glsr( Builder::class )->img([
155 167
 			'height' => $size,
@@ -167,7 +179,9 @@  discard block
 block discarded – undo
167 179
 	protected function buildOptionContent( $key, $value )
168 180
 	{
169 181
 		$text = $this->normalizeText( $value );
170
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
182
+		if( $this->isHiddenOrEmpty( $key, $text )) {
183
+			return;
184
+		}
171 185
 		return '<p>'.$text.'</p>';
172 186
 	}
173 187
 
@@ -178,7 +192,9 @@  discard block
 block discarded – undo
178 192
 	 */
179 193
 	protected function buildOptionDate( $key, $value )
180 194
 	{
181
-		if( $this->isHidden( $key ))return;
195
+		if( $this->isHidden( $key )) {
196
+			return;
197
+		}
182 198
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
183 199
 		if( $dateFormat == 'relative' ) {
184 200
 			$date = glsr( Date::class )->relative( $value );
@@ -199,7 +215,9 @@  discard block
 block discarded – undo
199 215
 	 */
200 216
 	protected function buildOptionRating( $key, $value )
201 217
 	{
202
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
218
+		if( $this->isHiddenOrEmpty( $key, $value )) {
219
+			return;
220
+		}
203 221
 		return glsr_star_rating( $value );
204 222
 	}
205 223
 
@@ -210,7 +228,9 @@  discard block
 block discarded – undo
210 228
 	 */
211 229
 	protected function buildOptionResponse( $key, $value )
212 230
 	{
213
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
231
+		if( $this->isHiddenOrEmpty( $key, $value )) {
232
+			return;
233
+		}
214 234
 		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
215 235
 		$text = $this->normalizeText( $value );
216 236
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
@@ -226,7 +246,9 @@  discard block
 block discarded – undo
226 246
 	 */
227 247
 	protected function buildOptionTitle( $key, $value )
228 248
 	{
229
-		if( $this->isHidden( $key ))return;
249
+		if( $this->isHidden( $key )) {
250
+			return;
251
+		}
230 252
 		if( empty( $value )) {
231 253
 			$value = __( 'No Title', 'site-reviews' );
232 254
 		}
@@ -285,9 +307,13 @@  discard block
 block discarded – undo
285 307
 		$words->setText( $text );
286 308
 		$count = 0;
287 309
 		foreach( $words as $offset ){
288
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
310
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
311
+				continue;
312
+			}
289 313
 			$count++;
290
-			if( $count != $limit )continue;
314
+			if( $count != $limit ) {
315
+				continue;
316
+			}
291 317
 			return $offset;
292 318
 		}
293 319
 		return strlen( $text );
@@ -363,7 +389,9 @@  discard block
 block discarded – undo
363 389
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
364 390
 		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
365 391
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
366
-			if( empty( $value ))return;
392
+			if( empty( $value )) {
393
+				return;
394
+			}
367 395
 			$value = glsr( Builder::class )->div( $value, [
368 396
 				'class' => 'glsr-review-'.$key,
369 397
 			]);
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		foreach( $this->reviews as $index => $review ) {
86 86
 			$renderedReviews[] = glsr( Template::class )->build( 'templates/review', [
87 87
 				'context' => $this->buildReview( $review )->values,
88
-			]);
88
+			] );
89 89
 		}
90 90
 		return new ReviewsHtml( $renderedReviews, $this->reviews->max_num_pages, $this->args );
91 91
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function generateSchema()
97 97
 	{
98
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
98
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
99 99
 		glsr( Schema::class )->store(
100 100
 			glsr( Schema::class )->build( $this->args )
101 101
 		);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function isHidden( $key, $path = '' )
110 110
 	{
111
-		$isOptionEnabled = !empty( $path )
111
+		$isOptionEnabled = !empty($path)
112 112
 			? $this->isOptionEnabled( $path )
113 113
 			: true;
114 114
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function buildOptionAssignedTo( $key, $value )
123 123
 	{
124
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
124
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
125 125
 		$post = glsr( Polylang::class )->getPost( $value );
126
-		if( !( $post instanceof WP_Post ))return;
126
+		if( !($post instanceof WP_Post) )return;
127 127
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
128 128
 			'href' => get_the_permalink( $post->ID ),
129
-		]);
129
+		] );
130 130
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
131 131
 		return '<span>'.$assignedTo.'</span>';
132 132
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function buildOptionAuthor( $key, $value )
140 140
 	{
141
-		if( $this->isHidden( $key ))return;
141
+		if( $this->isHidden( $key ) )return;
142 142
 		return '<span>'.$value.'</span>';
143 143
 	}
144 144
 
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function buildOptionAvatar( $key, $value )
151 151
 	{
152
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
152
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
153 153
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
154
-		return glsr( Builder::class )->img([
154
+		return glsr( Builder::class )->img( [
155 155
 			'height' => $size,
156 156
 			'src' => $this->generateAvatar( $value ),
157 157
 			'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
158 158
 			'width' => $size,
159
-		]);
159
+		] );
160 160
 	}
161 161
 
162 162
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	protected function buildOptionContent( $key, $value )
168 168
 	{
169 169
 		$text = $this->normalizeText( $value );
170
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
170
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
171 171
 		return '<p>'.$text.'</p>';
172 172
 	}
173 173
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function buildOptionDate( $key, $value )
180 180
 	{
181
-		if( $this->isHidden( $key ))return;
181
+		if( $this->isHidden( $key ) )return;
182 182
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
183 183
 		if( $dateFormat == 'relative' ) {
184 184
 			$date = glsr( Date::class )->relative( $value );
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			$format = $dateFormat == 'custom'
188 188
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
189 189
 				: (string)get_option( 'date_format' );
190
-			$date = date_i18n( $format, strtotime( $value ));
190
+			$date = date_i18n( $format, strtotime( $value ) );
191 191
 		}
192 192
 		return '<span>'.$date.'</span>';
193 193
 	}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function buildOptionRating( $key, $value )
201 201
 	{
202
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
202
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
203 203
 		return glsr_star_rating( $value );
204 204
 	}
205 205
 
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	protected function buildOptionResponse( $key, $value )
212 212
 	{
213
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
214
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
213
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
214
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
215 215
 		$text = $this->normalizeText( $value );
216 216
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
217 217
 		$response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function buildOptionTitle( $key, $value )
228 228
 	{
229
-		if( $this->isHidden( $key ))return;
230
-		if( empty( $value )) {
229
+		if( $this->isHidden( $key ) )return;
230
+		if( empty($value) ) {
231 231
 			$value = __( 'No Title', 'site-reviews' );
232 232
 		}
233 233
 		return '<h3>'.$value.'</h3>';
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 			return $avatarUrl;
244 244
 		}
245 245
 		$authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
246
-		if( empty( $authorIdOrEmail )) {
246
+		if( empty($authorIdOrEmail) ) {
247 247
 			$authorIdOrEmail = $this->current->email;
248 248
 		}
249
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
249
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
250 250
 			return $newAvatar;
251 251
 		}
252 252
 		return $avatarUrl;
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	protected function getExcerpt( $text )
260 260
 	{
261
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
261
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
262 262
 		$split = extension_loaded( 'intl' )
263 263
 			? $this->getExcerptIntlSplit( $text, $limit )
264 264
 			: $this->getExcerptSplit( $text, $limit );
265 265
 		$hiddenText = substr( $text, $split );
266
-		if( !empty( $hiddenText )) {
266
+		if( !empty($hiddenText) ) {
267 267
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
268 268
 				'class' => 'glsr-hidden glsr-hidden-text',
269 269
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
270 270
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
271
-			]);
272
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
271
+			] );
272
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
273 273
 		}
274 274
 		return $text;
275 275
 	}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
285 285
 		$words->setText( $text );
286 286
 		$count = 0;
287
-		foreach( $words as $offset ){
287
+		foreach( $words as $offset ) {
288 288
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
289 289
 			$count++;
290 290
 			if( $count != $limit )continue;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	protected function getExcerptSplit( $text, $limit )
302 302
 	{
303 303
 		if( str_word_count( $text, 0 ) > $limit ) {
304
-			$words = array_keys( str_word_count( $text, 2 ));
304
+			$words = array_keys( str_word_count( $text, 2 ) );
305 305
 			return $words[$limit];
306 306
 		}
307 307
 		return strlen( $text );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	protected function getOption( $path, $fallback = '' )
316 316
 	{
317
-		if( array_key_exists( $path, $this->options )) {
317
+		if( array_key_exists( $path, $this->options ) ) {
318 318
 			return $this->options[$path];
319 319
 		}
320 320
 		return $fallback;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	protected function isHiddenOrEmpty( $key, $value )
329 329
 	{
330
-		return $this->isHidden( $key ) || empty( $value );
330
+		return $this->isHidden( $key ) || empty($value);
331 331
 	}
332 332
 
333 333
 	/**
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
 	protected function normalizeText( $text )
347 347
 	{
348 348
 		$text = wp_kses( $text, wp_kses_allowed_html() );
349
-		$text = convert_smilies( strip_shortcodes( $text ));
349
+		$text = convert_smilies( strip_shortcodes( $text ) );
350 350
 		$text = str_replace( ']]>', ']]&gt;', $text );
351 351
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
352
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
352
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
353 353
 			$text = $this->getExcerpt( $text );
354 354
 		}
355
-		return wptexturize( nl2br( $text ));
355
+		return wptexturize( nl2br( $text ) );
356 356
 	}
357 357
 
358 358
 	/**
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
 	protected function wrap( array &$renderedFields, Review $review )
362 362
 	{
363 363
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
364
-		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
364
+		array_walk( $renderedFields, function( &$value, $key ) use($review) {
365 365
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
366
-			if( empty( $value ))return;
366
+			if( empty($value) )return;
367 367
 			$value = glsr( Builder::class )->div( $value, [
368 368
 				'class' => 'glsr-review-'.$key,
369
-			]);
369
+			] );
370 370
 		});
371 371
 	}
372 372
 }
Please login to merge, or discard this patch.