Passed
Push — master ( c5e678...d8e403 )
by Paul
06:24
created
plugin/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 	 */
12 12
 	public function build( array $args = [] )
13 13
 	{
14
-		require_once( ABSPATH.'wp-admin/includes/template.php' );
14
+		require_once(ABSPATH.'wp-admin/includes/template.php');
15 15
 		ob_start();
16 16
 		wp_star_rating( $args );
17 17
 		return ob_get_clean();
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function renderAssignedToMetabox( WP_Post $post )
150 150
 	{
151
-		if( !$this->isReviewPostType( $post ))return;
151
+		if( !$this->isReviewPostType( $post ) )return;
152 152
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
153 153
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
154 154
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
155 155
 			'id' => $assignedTo,
156 156
 			'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function renderDetailsMetaBox( WP_Post $post )
165 165
 	{
166
-		if( !$this->isReviewPostType( $post ))return;
166
+		if( !$this->isReviewPostType( $post ) )return;
167 167
 		$review = glsr( Database::class )->getReview( $post );
168 168
 		glsr()->render( 'partials/editor/metabox-details', [
169 169
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
170 170
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
171
-		]);
171
+		] );
172 172
 	}
173 173
 
174 174
 	/**
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function renderPinnedInPublishMetaBox()
179 179
 	{
180
-		if( !$this->isReviewPostType( get_post() ))return;
180
+		if( !$this->isReviewPostType( get_post() ) )return;
181 181
 		glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [
182 182
 			'context' => [
183 183
 				'no' => __( 'No', 'site-reviews' ),
184 184
 				'yes' => __( 'Yes', 'site-reviews' ),
185 185
 			],
186
-			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
187
-		]);
186
+			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
187
+		] );
188 188
 	}
189 189
 
190 190
 	/**
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function renderResponseMetaBox( WP_Post $post )
195 195
 	{
196
-		if( !$this->isReviewPostType( $post ))return;
196
+		if( !$this->isReviewPostType( $post ) )return;
197 197
 		wp_nonce_field( 'response', '_nonce-response', false );
198 198
 		glsr()->render( 'partials/editor/metabox-response', [
199 199
 			'response' => glsr( Database::class )->getReview( $post )->response,
200
-		]);
200
+		] );
201 201
 	}
202 202
 
203 203
 	/**
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function renderTaxonomyMetabox( WP_Post $post )
209 209
 	{
210
-		if( !$this->isReviewPostType( $post ))return;
210
+		if( !$this->isReviewPostType( $post ) )return;
211 211
 		glsr()->render( 'partials/editor/metabox-categories', [
212 212
 			'post' => $post,
213 213
 			'tax_name' => Application::TAXONOMY,
214 214
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
215
-		]);
215
+		] );
216 216
 	}
217 217
 
218 218
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function revertReview()
224 224
 	{
225
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
225
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
226 226
 		glsr( Database::class )->revertReview( $postId );
227 227
 		$this->redirect( $postId, 52 );
228 228
 	}
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
246 246
 	{
247 247
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post, $assignedTo );
248
-		if( !( $assignedPost instanceof WP_Post ))return;
248
+		if( !($assignedPost instanceof WP_Post) )return;
249 249
 		return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [
250 250
 			'context' => [
251 251
 				'data.url' => (string)get_permalink( $assignedPost ),
252 252
 				'data.title' => get_the_title( $assignedPost ),
253 253
 			],
254
-		]);
254
+		] );
255 255
 	}
256 256
 
257 257
 	/**
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 				'class' => 'button button-large',
273 273
 				'href' => $revertUrl,
274 274
 				'id' => 'revert',
275
-			]);
275
+			] );
276 276
 		}
277 277
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
278 278
 			'class' => 'button button-large',
279 279
 			'disabled' => true,
280 280
 			'id' => 'revert',
281
-		]);
281
+		] );
282 282
 	}
283 283
 
284 284
 	/**
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
292 292
 			? glsr()->reviewTypes[$review->review_type]
293 293
 			: __( 'Unknown', 'site-reviews' );
294
-		if( !empty( $review->url )) {
294
+		if( !empty($review->url) ) {
295 295
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
296 296
 				'href' => $review->url,
297 297
 				'target' => '_blank',
298
-			]);
298
+			] );
299 299
 		}
300 300
 		return $reviewType;
301 301
 	}
@@ -315,16 +315,16 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	protected function normalizeDetailsMetaBox( $review )
317 317
 	{
318
-		$reviewer = empty( $review->user_id )
318
+		$reviewer = empty($review->user_id)
319 319
 			? __( 'Unregistered user', 'site-reviews' )
320 320
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
321 321
 				'href' => get_author_posts_url( $review->user_id ),
322
-			]);
323
-		$email = empty( $review->email )
322
+			] );
323
+		$email = empty($review->email)
324 324
 			? '—'
325 325
 			: glsr( Builder::class )->a( $review->email, [
326 326
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
327
-			]);
327
+			] );
328 328
 		$metabox = [
329 329
 			__( 'Rating', 'site-reviews' ) => glsr( Html::class )->buildPartial( 'star-rating', ['rating' => $review->rating] ),
330 330
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			__( 'IP Address', 'site-reviews' ) => $review->ip_address,
336 336
 			__( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
337 337
 		];
338
-		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ));
338
+		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
339 339
 	}
340 340
 
341 341
 	/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		$redirectUri = $hasReferer
353 353
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
354 354
 			: get_edit_post_link( $postId );
355
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
355
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
356 356
 		exit;
357 357
 	}
358 358
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 		$this->args = $this->normalize( $args );
22 22
 		if( $this->args['total'] < 2 )return;
23 23
 		$links = $this->buildLinksForDeprecatedThemes();
24
-		if( empty( $links )) {
24
+		if( empty($links) ) {
25 25
 			$links = $this->buildLinks();
26 26
 		}
27 27
 		$links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args );
28
-		if( empty( $links ))return;
28
+		if( empty($links) )return;
29 29
 		return $this->buildTemplate( $links );
30 30
 	}
31 31
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			'total' => $this->args['total'],
45 45
 		];
46 46
 		if( is_front_page() ) {
47
-			unset( $paginateArgs['format'] );
47
+			unset($paginateArgs['format']);
48 48
 		}
49 49
 		return paginate_links( $paginateArgs );
50 50
 	}
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	protected function buildLinksForDeprecatedThemes()
56 56
 	{
57 57
 		$theme = wp_get_theme()->get( 'TextDomain' );
58
-		if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return;
58
+		if( !in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen'] ) )return;
59 59
 		$links = '';
60 60
 		if( $this->args['paged'] > 1 ) {
61
-			$links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">&larr;</span> %s</a></div>',
61
+			$links .= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">&larr;</span> %s</a></div>',
62 62
 				$this->buildUrlForDeprecatedThemes(-1),
63 63
 				__( 'Previous', 'site-reviews' )
64 64
 			);
65 65
 		}
66 66
 		if( $this->args['paged'] < $this->args['total'] ) {
67
-			$links.= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">&rarr;</span></a></div>',
68
-				$this->buildUrlForDeprecatedThemes(1),
67
+			$links .= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">&rarr;</span></a></div>',
68
+				$this->buildUrlForDeprecatedThemes( 1 ),
69 69
 				__( 'Next', 'site-reviews' )
70 70
 			);
71 71
 		}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		$class = 'glsr-navigation navigation pagination';
83 83
 		$screenReaderTemplate = '<h2 class="screen-reader-text">%2$s</h2>';
84 84
 		$innerTemplate = $screenReaderTemplate.'<div class="nav-links">%3$s</div>';
85
-		if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] )) {
85
+		if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] ) ) {
86 86
 			$innerTemplate = '%3$s';
87 87
 		}
88 88
 		else if( $theme == 'twentyfourteen' ) {
@@ -115,6 +115,6 @@  discard block
 block discarded – undo
115 115
 		return wp_parse_args( $args, [
116 116
 			'paged' => glsr( QueryBuilder::class )->getPaged(),
117 117
 			'total' => 1,
118
-		]);
118
+		] );
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function __call( $method, $args )
65 65
 	{
66
-		$instance = new static( $this->globals );
66
+		$instance = new static($this->globals);
67 67
 		$instance->setTagFromMethod( $method );
68
-		call_user_func_array( [$instance, 'normalize'], $args += ['',''] );
68
+		call_user_func_array( [$instance, 'normalize'], $args += ['', ''] );
69 69
 		$tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT );
70 70
 		$generatedTag = in_array( $instance->tag, $tags )
71 71
 			? $instance->buildTag()
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 			'render' => 'is_bool',
90 90
 			'tag' => 'is_string',
91 91
 		];
92
-		if( !isset( $properties[$property] )
93
-			|| empty( array_filter( [$value], $properties[$property] ))
92
+		if( !isset($properties[$property])
93
+			|| empty(array_filter( [$value], $properties[$property] ))
94 94
 		)return;
95 95
 		$this->$property = $value;
96 96
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getOpeningTag()
110 110
 	{
111
-		$attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString();
111
+		$attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString();
112 112
 		return '<'.trim( $this->tag.' '.$attributes ).'>';
113 113
 	}
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	protected function buildCustomField()
119 119
 	{
120 120
 		$className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' );
121
-		if( !class_exists( $className )) {
121
+		if( !class_exists( $className ) ) {
122 122
 			glsr_log()->error( 'Field missing: '.$className );
123 123
 			return;
124 124
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function buildDefaultTag( $text = '' )
132 132
 	{
133
-		if( empty( $text )) {
133
+		if( empty($text) ) {
134 134
 			$text = $this->args['text'];
135 135
 		}
136 136
 		return $this->getOpeningTag().$text.$this->getClosingTag();
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function buildFieldDescription()
143 143
 	{
144
-		if( empty( $this->args['description'] ))return;
145
-		if( !empty( $this->globals['is_widget'] )) {
144
+		if( empty($this->args['description']) )return;
145
+		if( !empty($this->globals['is_widget']) ) {
146 146
 			return $this->small( $this->args['description'] );
147 147
 		}
148 148
 		return $this->p( $this->args['description'], ['class' => 'description'] );
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function buildFormInput()
155 155
 	{
156
-		if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) {
156
+		if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) {
157 157
 			return $this->buildFormLabel().$this->getOpeningTag();
158 158
 		}
159
-		return empty( $this->args['options'] )
159
+		return empty($this->args['options'])
160 160
 			? $this->buildFormInputChoice()
161 161
 			: $this->buildFormInputMultiChoice();
162 162
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	protected function buildFormInputMultiChoice()
176 176
 	{
177 177
 		if( $this->args['type'] == 'checkbox' ) {
178
-			$this->args['name'].= '[]';
178
+			$this->args['name'] .= '[]';
179 179
 		}
180 180
 		$options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
181 181
 			return $carry.$this->li( $this->{$this->args['type']}([
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 				'name' => $this->args['name'],
184 184
 				'text' => $this->args['options'][$key],
185 185
 				'value' => $key,
186
-			]));
186
+			]) );
187 187
 		});
188 188
 		return $this->ul( $options, [
189 189
 			'class' => $this->args['class'],
190 190
 			'id' => $this->args['id'],
191
-		]);
191
+		] );
192 192
 	}
193 193
 
194 194
 	/**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	protected function buildFormLabel()
198 198
 	{
199
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
200
-		return $this->label([
199
+		if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return;
200
+		return $this->label( [
201 201
 			'for' => $this->args['id'],
202 202
 			'text' => $this->args['label'],
203
-		]);
203
+		] );
204 204
 	}
205 205
 
206 206
 	/**
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	protected function buildFormSelectOptions()
218 218
 	{
219 219
 		return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
220
-			return $carry.$this->option([
220
+			return $carry.$this->option( [
221 221
 				'selected' => $this->args['value'] == $key,
222 222
 				'text' => $this->args['options'][$key],
223 223
 				'value' => $key,
224
-			]);
224
+			] );
225 225
 		});
226 226
 	}
227 227
 
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function buildTag()
240 240
 	{
241
-		if( in_array( $this->tag, static::TAGS_SINGLE )) {
241
+		if( in_array( $this->tag, static::TAGS_SINGLE ) ) {
242 242
 			return $this->getOpeningTag();
243 243
 		}
244
-		if( !in_array( $this->tag, static::TAGS_FORM )) {
244
+		if( !in_array( $this->tag, static::TAGS_FORM ) ) {
245 245
 			return $this->buildDefaultTag();
246 246
 		}
247 247
 		return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription();
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	protected function normalize( ...$params )
255 255
 	{
256
-		if( is_string( $params[0] ) || is_numeric( $params[0] )) {
256
+		if( is_string( $params[0] ) || is_numeric( $params[0] ) ) {
257 257
 			$this->setNameOrTextAttributeForTag( $params[0] );
258 258
 		}
259
-		if( is_array( $params[0] )) {
259
+		if( is_array( $params[0] ) ) {
260 260
 			$this->args += $params[0];
261 261
 		}
262
-		else if( is_array( $params[1] )) {
262
+		else if( is_array( $params[1] ) ) {
263 263
 			$this->args += $params[1];
264 264
 		}
265 265
 		$this->args = glsr( BuilderDefaults::class )->merge( $this->args );
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	protected function setTagFromMethod( $method )
285 285
 	{
286 286
 		$this->tag = strtolower( $method );
287
-		if( in_array( $this->tag, static::INPUT_TYPES )) {
287
+		if( in_array( $this->tag, static::INPUT_TYPES ) ) {
288 288
 			$this->args['type'] = $this->tag;
289 289
 			$this->tag = 'input';
290 290
 		}
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsButton.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	public function fields()
14 14
 	{
15 15
 		return [[
16
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
16
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
17 17
 			'minWidth' => 320,
18 18
 			'type' => 'container',
19
-		],[
19
+		], [
20 20
 			'label' => esc_html__( 'Title', 'site-reviews' ),
21 21
 			'name' => 'title',
22 22
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
23 23
 			'type' => 'textbox',
24
-		],[
24
+		], [
25 25
 			'label' => esc_html__( 'Count', 'site-reviews' ),
26 26
 			'maxLength' => 5,
27 27
 			'name' => 'count',
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 			'text' => '10',
30 30
 			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
31 31
 			'type' => 'textbox',
32
-		],[
32
+		], [
33 33
 			'label' => esc_html__( 'Rating', 'site-reviews' ),
34 34
 			'name' => 'rating',
35 35
 			'options' => [
36
-				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )),
37
-				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )),
38
-				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )),
39
-				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )),
40
-				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )),
36
+				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
37
+				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
38
+				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
39
+				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
40
+				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
41 41
 			],
42 42
 			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
43 43
 			'type' => 'listbox',
44
-		],[
44
+		], [
45 45
 			'label' => esc_html__( 'Pagination', 'site-reviews' ),
46 46
 			'name' => 'pagination',
47 47
 			'options' => [
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			'name' => 'assigned_to',
60 60
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ),
61 61
 			'type' => 'textbox',
62
-		],[
62
+		], [
63 63
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
64 64
 			'name' => 'schema',
65 65
 			'options' => [
@@ -68,49 +68,49 @@  discard block
 block discarded – undo
68 68
 			],
69 69
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
70 70
 			'type' => 'listbox',
71
-		],[
71
+		], [
72 72
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
73 73
 			'name' => 'class',
74 74
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
75 75
 			'type' => 'textbox',
76
-		],[
76
+		], [
77 77
 			'columns' => 2,
78 78
 			'items' => [[
79 79
 				'name' => 'hide_assigned_to',
80 80
 				'text' => esc_html__( 'Assigned To', 'site-reviews' ),
81 81
 				'tooltip' => __( 'Hide the assigned to link?', 'site-reviews' ),
82 82
 				'type' => 'checkbox',
83
-			],[
83
+			], [
84 84
 				'name' => 'hide_author',
85 85
 				'text' => esc_html__( 'Author', 'site-reviews' ),
86 86
 				'tooltip' => __( 'Hide the review author?', 'site-reviews' ),
87 87
 				'type' => 'checkbox',
88
-			],[
88
+			], [
89 89
 				'name' => 'hide_avatar',
90 90
 				'text' => esc_html__( 'Avatar', 'site-reviews' ),
91 91
 				'tooltip' => __( 'Hide the reviewer avatar if shown?', 'site-reviews' ),
92 92
 				'type' => 'checkbox',
93
-			],[
93
+			], [
94 94
 				'name' => 'hide_content',
95 95
 				'text' => esc_html__( 'Content', 'site-reviews' ),
96 96
 				'tooltip' => __( 'Hide the review content?', 'site-reviews' ),
97 97
 				'type' => 'checkbox',
98
-			],[
98
+			], [
99 99
 				'name' => 'hide_date',
100 100
 				'text' => esc_html__( 'Date', 'site-reviews' ),
101 101
 				'tooltip' => __( 'Hide the review date?', 'site-reviews' ),
102 102
 				'type' => 'checkbox',
103
-			],[
103
+			], [
104 104
 				'name' => 'hide_rating',
105 105
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
106 106
 				'tooltip' => __( 'Hide the review rating?', 'site-reviews' ),
107 107
 				'type' => 'checkbox',
108
-			],[
108
+			], [
109 109
 				'name' => 'hide_response',
110 110
 				'text' => esc_html__( 'Response', 'site-reviews' ),
111 111
 				'tooltip' => __( 'Hide the review response?', 'site-reviews' ),
112 112
 				'type' => 'checkbox',
113
-			],[
113
+			], [
114 114
 				'name' => 'hide_title',
115 115
 				'text' => esc_html__( 'Title', 'site-reviews' ),
116 116
 				'tooltip' => __( 'Hide the review title?', 'site-reviews' ),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
121 121
 			'spacing' => 5,
122 122
 			'type' => 'container',
123
-		],[
123
+		], [
124 124
 			'hidden' => true,
125 125
 			'name' => 'id',
126 126
 			'type' => 'textbox',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	public function getTerms()
134 134
 	{
135 135
 		$terms = glsr( Database::class )->getTerms();
136
-		if( empty( $terms )) {
136
+		if( empty($terms) ) {
137 137
 			return [];
138 138
 		}
139 139
 		return [
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function enqueueAssets()
25 25
 	{
26
-		if( apply_filters( 'site-reviews/assets/css', true )) {
26
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
27 27
 			wp_enqueue_style(
28 28
 				Application::ID,
29 29
 				$this->getStylesheet(),
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 				glsr()->version
32 32
 			);
33 33
 		}
34
-		if( apply_filters( 'site-reviews/assets/js', true )) {
34
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
35 35
 			$dependencies = apply_filters( 'site-reviews/enqueue/public/dependencies', [] );
36 36
 			wp_enqueue_script(
37 37
 				Application::ID,
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return;
52 52
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
53
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
53
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
54 54
 			'hl' => $language,
55 55
 			'onload' => 'glsr_render_recaptcha',
56 56
 			'render' => 'explicit',
57
-		], 'https://www.google.com/recaptcha/api.js' ));
58
-		$inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ));
57
+		], 'https://www.google.com/recaptcha/api.js' ) );
58
+		$inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ) );
59 59
 		wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' );
60 60
 	}
61 61
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$variables = [
68 68
 			'action' => Application::PREFIX.'action',
69 69
 			'ajaxnonce' => wp_create_nonce( Application::ID.'-ajax-nonce' ),
70
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
70
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
71 71
 			'ajaxurl' => admin_url( 'admin-ajax.php' ),
72 72
 		];
73 73
 		$variables = apply_filters( 'site-reviews/enqueue/public/localize', $variables );
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	protected function getStylesheet()
81 81
 	{
82
-		$currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ));
82
+		$currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ) );
83 83
 		return file_exists( glsr()->path.'assets/styles/themes/'.$currentTheme.'.css' )
84 84
 			? glsr()->url( 'assets/styles/themes/'.$currentTheme.'.css' )
85 85
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAdminAssets.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] );
66 66
 		$dependencies = array_merge( $dependencies, [
67 67
 			'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
68
-		]);
68
+		] );
69 69
 		return $dependencies;
70 70
 	}
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	protected function isCurrentScreen()
76 76
 	{
77 77
 		$screen = glsr_current_screen();
78
-		return $screen && ( $screen->post_type == Application::POST_TYPE
78
+		return $screen && ($screen->post_type == Application::POST_TYPE
79 79
 			|| $screen->base == 'post'
80 80
 			|| $screen->id == 'dashboard'
81 81
 			|| $screen->id == 'widgets'
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$variables = [];
91 91
 		foreach( glsr()->mceShortcodes as $tag => $args ) {
92
-			if( empty( $args['required'] ))continue;
92
+			if( empty($args['required']) )continue;
93 93
 			$variables[$tag] = $args['required'];
94 94
 		}
95 95
 		return $variables;
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( Html::class )->buildPartial( $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/Modules/Html/Partials/SiteReviewsSummary.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$this->args = $args;
36 36
 		$this->reviews = glsr( Database::class )->getReviews( $args )->results;
37
-		if( empty( $this->reviews ) && $this->isHidden( 'if_empty' ))return;
37
+		if( empty($this->reviews) && $this->isHidden( 'if_empty' ) )return;
38 38
 		$this->rating = glsr( Rating::class )->getAverage( $this->reviews );
39 39
 		$this->generateSchema();
40 40
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 				'stars' => $this->buildStars(),
47 47
 				'text' => $this->buildText(),
48 48
 			],
49
-		]);
49
+		] );
50 50
 	}
51 51
 
52 52
 	/**
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	protected function buildPercentage()
56 56
 	{
57
-		if( $this->isHidden( 'bars' ))return;
57
+		if( $this->isHidden( 'bars' ) )return;
58 58
 		$range = range( Rating::MAX_RATING, 1 );
59
-		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ));
60
-		$bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) {
59
+		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ) );
60
+		$bars = array_reduce( $range, function( $carry, $level ) use($percentages) {
61 61
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
62 62
 			$background = $this->buildPercentageBackground( $percentages[$level] );
63 63
 			$percent = $this->buildPercentagePercent( $percentages[$level] );
64 64
 			return $carry.glsr( Builder::class )->div( $label.$background.$percent, [
65 65
 				'class' => 'glsr-bar',
66
-			]);
66
+			] );
67 67
 		});
68 68
 		return $this->wrap( 'percentage', $bars );
69 69
 	}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	protected function buildPercentageBackground( $percent )
76 76
 	{
77
-		$backgroundPercent = glsr( Builder::class )->span([
77
+		$backgroundPercent = glsr( Builder::class )->span( [
78 78
 			'class' => 'glsr-bar-background-percent',
79 79
 			'style' => 'width:'.$percent,
80
-		]);
80
+		] );
81 81
 		return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>';
82 82
 	}
83 83
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function buildRating()
106 106
 	{
107
-		if( $this->isHidden( 'rating' ))return;
107
+		if( $this->isHidden( 'rating' ) )return;
108 108
 		return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' );
109 109
 	}
110 110
 
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	protected function buildStars()
115 115
 	{
116
-		if( $this->isHidden( 'stars' ))return;
116
+		if( $this->isHidden( 'stars' ) )return;
117 117
 		$stars = glsr( Partial::class )->build( 'star-rating', [
118 118
 			'rating' => $this->rating,
119
-		]);
119
+		] );
120 120
 		return $this->wrap( 'stars', $stars );
121 121
 	}
122 122
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function buildText()
127 127
 	{
128
-		if( $this->isHidden( 'summary' ))return;
128
+		if( $this->isHidden( 'summary' ) )return;
129 129
 		$count = count( $this->reviews );
130
-		if( empty( $this->args['text'] )) {
130
+		if( empty($this->args['text']) ) {
131 131
 			 $this->args['text'] = _nx(
132 132
 				'{rating} out of {max} stars (based on %d review)',
133 133
 				'{rating} out of {max} stars (based on %d reviews)',
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 				'site-reviews'
137 137
 			);
138 138
 		}
139
-		$summary = str_replace( ['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] );
140
-		$summary = str_replace( ['%s','%d'], $count, $summary );
139
+		$summary = str_replace( ['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text'] );
140
+		$summary = str_replace( ['%s', '%d'], $count, $summary );
141 141
 		return $this->wrap( 'text', '<span>'.$summary.'</span>' );
142 142
 	}
143 143
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function generateSchema()
148 148
 	{
149
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
149
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
150 150
 		glsr( Schema::class )->store(
151 151
 			glsr( Schema::class )->buildSummary( $this->args )
152 152
 		);
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
 	{
180 180
 		return glsr( Builder::class )->div( $value, [
181 181
 			'class' => 'glsr-summary-'.$key,
182
-		]);
182
+		] );
183 183
 	}
184 184
 }
Please login to merge, or discard this patch.