Passed
Push — master ( d47355...85ec42 )
by Paul
04:15
created
views/partials/addons/addon.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 			<p>{{ description }}</p>
11 11
 		</div>
12 12
 		<div class="glsr-addon-footer">
13
-		<?php if( !is_wp_error( validate_plugin( $plugin ))) : ?>
14
-			<?php if( is_plugin_active( $plugin )) : ?>
13
+		<?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?>
14
+			<?php if( is_plugin_active( $plugin ) ) : ?>
15 15
 			<span class="glsr-addon-link button button-secondary" disabled>
16 16
 				<?= __( 'Installed', 'site-reviews' ); ?>
17 17
 			</span>
18 18
 			<?php else: ?>
19
-			<a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary">
19
+			<a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary">
20 20
 				<?= __( 'Activate', 'site-reviews' ); ?>
21 21
 			</a>
22 22
 			<?php endif; ?>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,14 +15,20 @@
 block discarded – undo
15 15
 			<span class="glsr-addon-link button button-secondary" disabled>
16 16
 				<?= __( 'Installed', 'site-reviews' ); ?>
17 17
 			</span>
18
-			<?php else: ?>
19
-			<a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary">
18
+			<?php else {
19
+	: ?>
20
+			<a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );
21
+}
22
+?>" class="glsr-addon-link button button-secondary">
20 23
 				<?= __( 'Activate', 'site-reviews' ); ?>
21 24
 			</a>
22 25
 			<?php endif; ?>
23
-		<?php else: ?>
26
+		<?php else {
27
+	: ?>
24 28
 			<a href="{{ link }}" class="glsr-addon-link glsr-external button button-secondary">
25
-				<?= __( 'More Info', 'site-reviews' ); ?>
29
+				<?= __( 'More Info', 'site-reviews' );
30
+}
31
+?>
26 32
 			</a>
27 33
 		<?php endif; ?>
28 34
 		</div>
Please login to merge, or discard this patch.
views/pages/tools/sync.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 <form method="post">
39 39
 	<div class="tablenav bottom">
40 40
 		<div class="actions">
41
-			<?php if( count( $sites ) > 1) : ?>
41
+			<?php if( count( $sites ) > 1 ) : ?>
42 42
 			<label for="bulk-action-selector-bottom" class="screen-reader-text">Select a site to sync</label>
43 43
 			<select name="{{ id }}[site]">
44 44
 				<option>- <?= __( 'Select a Site', 'site-reviews' ); ?> -</option>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,9 +46,12 @@
 block discarded – undo
46 46
 				<option value="<?= $slug; ?>" class="hide-if-no-js"><?= $details['name']; ?></option>
47 47
 				<?php endforeach; ?>
48 48
 			</select>
49
-			<?php else: ?>
49
+			<?php else {
50
+	: ?>
50 51
 				<?php foreach( $sites as $slug => $details ) : ?>
51
-				<input type="hidden" name="{{ id }}[site]" value="<?= $slug; ?>">
52
+				<input type="hidden" name="{{ id }}[site]" value="<?= $slug;
53
+}
54
+?>">
52 55
 				<?php endforeach; ?>
53 56
 			<?php endif; ?>
54 57
 			<input type="hidden" name="{{ id }}[action]" value="sync-reviews">
Please login to merge, or discard this patch.
views/pages/addons/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 				'title' => 'Tripadvisor Reviews',
14 14
 			],
15 15
 			'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php',
16
-		]);
16
+		] );
17 17
 		$template->render( 'partials/addons/addon', [
18 18
 			'context' => [
19 19
 				'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ),
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 				'title' => 'Yelp Reviews',
23 23
 			],
24 24
 			'plugin' => 'site-reviews-yelp/site-reviews-yelp.php',
25
-		]);
25
+		] );
26 26
 	?>
27 27
 	</div>
28 28
 </div>
Please login to merge, or discard this patch.
plugin/Modules/Html/Review.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function __get( $key )
21 21
 	{
22
-		if( array_key_exists( $key, $this->values )) {
22
+		if( array_key_exists( $key, $this->values ) ) {
23 23
 			return $this->values[$key];
24 24
 		}
25 25
 		return '';
Please login to merge, or discard this patch.
activate.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@
 block discarded – undo
60 60
 	 */
61 61
 	public function deactivate( $plugin )
62 62
 	{
63
-		if( $this->isValid() )return;
63
+		if( $this->isValid() ) {
64
+			return;
65
+		}
64 66
 		$pluginSlug = plugin_basename( $this->file );
65 67
 		if( $plugin == $pluginSlug ) {
66 68
 			$this->redirect(); //exit
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$this->versions = wp_parse_args( $versions, array(
31 31
 			'php' => static::MIN_PHP_VERSION,
32 32
 			'wordpress' => static::MIN_WORDPRESS_VERSION,
33
-		));
33
+		) );
34 34
 	}
35 35
 
36 36
 	/**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 		if( $this->isValid() ) {
42 42
 			return true;
43 43
 		}
44
-		add_action( 'activated_plugin', array( $this, 'deactivate' ));
45
-		add_action( 'admin_notices', array( $this, 'deactivate' ));
44
+		add_action( 'activated_plugin', array( $this, 'deactivate' ) );
45
+		add_action( 'admin_notices', array( $this, 'deactivate' ) );
46 46
 		return false;
47 47
 	}
48 48
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			filter_input( INPUT_GET, 'plugin_status' ),
138 138
 			filter_input( INPUT_GET, 'paged' ),
139 139
 			filter_input( INPUT_GET, 's' )
140
-		)));
140
+		) ) );
141 141
 		exit;
142 142
 	}
143 143
 }
Please login to merge, or discard this patch.
uninstall.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() )return;
6
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) {
7
+	return;
8
+}
7 9
 
8 10
 delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() );
9 11
 delete_option( 'widget_'.glsr()->id.'_site-reviews' );
Please login to merge, or discard this patch.
site-reviews.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v3' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v3' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24 24
 if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
@@ -27,6 +27,6 @@  discard block
 block discarded – undo
27 27
 
28 28
 $app = new GeminiLabs\SiteReviews\Application;
29 29
 $app->make( 'Provider' )->register( $app );
30
-register_activation_hook( __FILE__, array( $app, 'activate' ));
31
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
30
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
31
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
32 32
 $app->init();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v3' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
24
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) {
25
+	return;
26
+}
25 27
 require_once __DIR__.'/autoload.php';
26 28
 require_once __DIR__.'/compatibility.php';
27 29
 require_once __DIR__.'/helpers.php';
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 2 patches
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 		$reviewValues = [];
84 84
 		foreach( $review as $key => $value ) {
85 85
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
86
-			if( !method_exists( $this, $method ))continue;
86
+			if( !method_exists( $this, $method )) {
87
+				continue;
88
+			}
87 89
 			$reviewValues[$key] = $this->$method( $key, $value );
88 90
 		}
89 91
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', $reviewValues );
@@ -97,9 +99,13 @@  discard block
 block discarded – undo
97 99
 	 */
98 100
 	protected function buildOptionAssignedTo( $key, $value )
99 101
 	{
100
-		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return;
102
+		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' )) {
103
+			return;
104
+		}
101 105
 		$post = get_post( intval( $value ));
102
-		if( !( $post instanceof WP_Post ))return;
106
+		if( !( $post instanceof WP_Post )) {
107
+			return;
108
+		}
103 109
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
104 110
 			'href' => get_the_permalink( $post->ID ),
105 111
 		]);
@@ -114,7 +120,9 @@  discard block
 block discarded – undo
114 120
 	 */
115 121
 	protected function buildOptionAuthor( $key, $value )
116 122
 	{
117
-		if( $this->isHidden( $key ))return;
123
+		if( $this->isHidden( $key )) {
124
+			return;
125
+		}
118 126
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
119 127
 			? apply_filters( 'site-reviews/review/author/prefix', '&mdash;' )
120 128
 			: '';
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function buildOptionAvatar( $key, $value )
130 138
 	{
131
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
139
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' )) {
140
+			return;
141
+		}
132 142
 		$size = $this->getOption( 'settings.reviews.avatars.size', 40 );
133 143
 		return $this->wrap( $key, glsr( Builder::class )->img([
134 144
 			'src' => $this->generateAvatar( $value ),
@@ -145,7 +155,9 @@  discard block
 block discarded – undo
145 155
 	protected function buildOptionContent( $key, $value )
146 156
 	{
147 157
 		$text = $this->normalizeText( $value );
148
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
158
+		if( $this->isHiddenOrEmpty( $key, $text )) {
159
+			return;
160
+		}
149 161
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
150 162
 	}
151 163
 
@@ -156,7 +168,9 @@  discard block
 block discarded – undo
156 168
 	 */
157 169
 	protected function buildOptionDate( $key, $value )
158 170
 	{
159
-		if( $this->isHidden( $key ))return;
171
+		if( $this->isHidden( $key )) {
172
+			return;
173
+		}
160 174
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
161 175
 		if( $dateFormat == 'relative' ) {
162 176
 			$date = glsr( Date::class )->relative( $value );
@@ -177,7 +191,9 @@  discard block
 block discarded – undo
177 191
 	 */
178 192
 	protected function buildOptionRating( $key, $value )
179 193
 	{
180
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
194
+		if( $this->isHiddenOrEmpty( $key, $value )) {
195
+			return;
196
+		}
181 197
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
182 198
 			'rating' => $value,
183 199
 		]);
@@ -191,7 +207,9 @@  discard block
 block discarded – undo
191 207
 	 */
192 208
 	protected function buildOptionResponse( $key, $value )
193 209
 	{
194
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
210
+		if( $this->isHiddenOrEmpty( $key, $value )) {
211
+			return;
212
+		}
195 213
 		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
196 214
 		$text = $this->normalizeText( $value );
197 215
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
@@ -208,7 +226,9 @@  discard block
 block discarded – undo
208 226
 	 */
209 227
 	protected function buildOptionTitle( $key, $value )
210 228
 	{
211
-		if( $this->isHidden( $key ))return;
229
+		if( $this->isHidden( $key )) {
230
+			return;
231
+		}
212 232
 		if( empty( $value )) {
213 233
 			$value = __( 'No Title', 'site-reviews' );
214 234
 		}
@@ -238,7 +258,9 @@  discard block
 block discarded – undo
238 258
 	 */
239 259
 	protected function generateSchema()
240 260
 	{
241
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
261
+		if( !wp_validate_boolean( $this->args['schema'] )) {
262
+			return;
263
+		}
242 264
 		glsr( Schema::class )->store(
243 265
 			glsr( Schema::class )->build( $this->args )
244 266
 		);
@@ -289,9 +311,13 @@  discard block
 block discarded – undo
289 311
 		$words->setText( $text );
290 312
 		$count = 0;
291 313
 		foreach( $words as $offset ){
292
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
314
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
315
+				continue;
316
+			}
293 317
 			$count++;
294
-			if( $count != $limit )continue;
318
+			if( $count != $limit ) {
319
+				continue;
320
+			}
295 321
 			return $offset;
296 322
 		}
297 323
 		return strlen( $text );
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'navigation' => $navigation,
58 58
 			],
59 59
 			'reviews' => $this->buildReviews(),
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$reviewValues = [];
84 84
 		foreach( $review as $key => $value ) {
85 85
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
86
-			if( !method_exists( $this, $method ))continue;
86
+			if( !method_exists( $this, $method ) )continue;
87 87
 			$reviewValues[$key] = $this->$method( $key, $value );
88 88
 		}
89 89
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', $reviewValues );
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	protected function buildOptionAssignedTo( $key, $value )
99 99
 	{
100
-		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return;
101
-		$post = get_post( intval( $value ));
102
-		if( !( $post instanceof WP_Post ))return;
100
+		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return;
101
+		$post = get_post( intval( $value ) );
102
+		if( !($post instanceof WP_Post) )return;
103 103
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
104 104
 			'href' => get_the_permalink( $post->ID ),
105
-		]);
105
+		] );
106 106
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
107 107
 		return $this->wrap( $key, '<span>'.$assignedTo.'</span>' );
108 108
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function buildOptionAuthor( $key, $value )
116 116
 	{
117
-		if( $this->isHidden( $key ))return;
117
+		if( $this->isHidden( $key ) )return;
118 118
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
119 119
 			? apply_filters( 'site-reviews/review/author/prefix', '&mdash;' )
120 120
 			: '';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function buildOptionAvatar( $key, $value )
130 130
 	{
131
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
131
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return;
132 132
 		$size = $this->getOption( 'settings.reviews.avatars.size', 40 );
133
-		return $this->wrap( $key, glsr( Builder::class )->img([
133
+		return $this->wrap( $key, glsr( Builder::class )->img( [
134 134
 			'src' => $this->generateAvatar( $value ),
135 135
 			'height' => $size,
136 136
 			'width' => $size,
137
-		]));
137
+		] ) );
138 138
 	}
139 139
 
140 140
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	protected function buildOptionContent( $key, $value )
146 146
 	{
147 147
 		$text = $this->normalizeText( $value );
148
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
148
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
149 149
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
150 150
 	}
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function buildOptionDate( $key, $value )
158 158
 	{
159
-		if( $this->isHidden( $key ))return;
159
+		if( $this->isHidden( $key ) )return;
160 160
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
161 161
 		if( $dateFormat == 'relative' ) {
162 162
 			$date = glsr( Date::class )->relative( $value );
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			$format = $dateFormat == 'custom'
166 166
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
167 167
 				: (string)get_option( 'date_format' );
168
-			$date = date_i18n( $format, strtotime( $value ));
168
+			$date = date_i18n( $format, strtotime( $value ) );
169 169
 		}
170 170
 		return $this->wrap( $key, '<span>'.$date.'</span>' );
171 171
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function buildOptionRating( $key, $value )
179 179
 	{
180
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
180
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
181 181
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
182 182
 			'rating' => $value,
183
-		]);
183
+		] );
184 184
 		return $this->wrap( $key, $rating );
185 185
 	}
186 186
 
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	protected function buildOptionResponse( $key, $value )
193 193
 	{
194
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
195
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
194
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
195
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
196 196
 		$text = $this->normalizeText( $value );
197 197
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
198 198
 		return $this->wrap( $key,
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	protected function buildOptionTitle( $key, $value )
210 210
 	{
211
-		if( $this->isHidden( $key ))return;
212
-		if( empty( $value )) {
211
+		if( $this->isHidden( $key ) )return;
212
+		if( empty($value) ) {
213 213
 			$value = __( 'No Title', 'site-reviews' );
214 214
 		}
215 215
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			return $avatarUrl;
228 228
 		}
229 229
 		$authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id );
230
-		if( empty( $authorIdOrEmail )) {
230
+		if( empty($authorIdOrEmail) ) {
231 231
 			$authorIdOrEmail = $review->email;
232 232
 		}
233 233
 		return (string)get_avatar_url( $authorIdOrEmail );
@@ -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
 		);
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getExcerpt( $text )
264 264
 	{
265
-		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ));
265
+		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ) );
266 266
 		$split = extension_loaded( 'intl' )
267 267
 			? $this->getExcerptIntlSplit( $text, $limit )
268 268
 			: $this->getExcerptSplit( $text, $limit );
269 269
 		$hiddenText = substr( $text, $split );
270
-		if( !empty( $hiddenText )) {
270
+		if( !empty($hiddenText) ) {
271 271
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
272 272
 				'class' => 'glsr-hidden glsr-hidden-text',
273 273
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
274 274
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
275
-			]);
276
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
275
+			] );
276
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
277 277
 		}
278 278
 		return nl2br( $text );
279 279
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
289 289
 		$words->setText( $text );
290 290
 		$count = 0;
291
-		foreach( $words as $offset ){
291
+		foreach( $words as $offset ) {
292 292
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
293 293
 			$count++;
294 294
 			if( $count != $limit )continue;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	protected function getExcerptSplit( $text, $limit )
306 306
 	{
307 307
 		if( str_word_count( $text, 0 ) > $limit ) {
308
-			$words = array_keys( str_word_count( $text, 2 ));
308
+			$words = array_keys( str_word_count( $text, 2 ) );
309 309
 			return $words[$limit];
310 310
 		}
311 311
 		return strlen( $text );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function getOption( $path, $fallback = '' )
320 320
 	{
321
-		if( array_key_exists( $path, $this->options )) {
321
+		if( array_key_exists( $path, $this->options ) ) {
322 322
 			return $this->options[$path];
323 323
 		}
324 324
 		return $fallback;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function isHidden( $key, $path = '' )
333 333
 	{
334
-		$isOptionEnabled = !empty( $path )
334
+		$isOptionEnabled = !empty($path)
335 335
 			? $this->isOptionEnabled( $path )
336 336
 			: true;
337 337
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	protected function isHiddenOrEmpty( $key, $value )
346 346
 	{
347
-		return $this->isHidden( $key ) || empty( $value );
347
+		return $this->isHidden( $key ) || empty($value);
348 348
 	}
349 349
 
350 350
 	/**
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
 	protected function normalizeText( $text )
364 364
 	{
365 365
 		$text = wp_kses( $text, wp_kses_allowed_html() );
366
-		$text = convert_smilies( strip_shortcodes( $text ));
366
+		$text = convert_smilies( strip_shortcodes( $text ) );
367 367
 		$text = str_replace( ']]>', ']]&gt;', $text );
368 368
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
369
-		if( $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' )) {
369
+		if( $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' ) ) {
370 370
 			$text = $this->getExcerpt( $text );
371 371
 		}
372 372
 		return wptexturize( $text );
@@ -381,6 +381,6 @@  discard block
 block discarded – undo
381 381
 	{
382 382
 		return glsr( Builder::class )->div( $value, [
383 383
 			'class' => 'glsr-review-'.$key,
384
-		]);
384
+		] );
385 385
 	}
386 386
 }
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 		foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) {
35 35
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
36 36
 			// @see https://developers.google.com/search/docs/data-types/review
37
-			if( $review->review_type != 'local' )continue;
37
+			if( $review->review_type != 'local' ) {
38
+				continue;
39
+			}
38 40
 			$reviews[] = $this->buildReview( $review );
39 41
 		}
40 42
 		if( !empty( $reviews )) {
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	 */
80 82
 	public function render()
81 83
 	{
82
-		if( is_null( glsr()->schemas ))return;
84
+		if( is_null( glsr()->schemas )) {
85
+			return;
86
+		}
83 87
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
84 88
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
85 89
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -131,7 +135,9 @@  discard block
 block discarded – undo
131 135
 	{
132 136
 		foreach( $values as $value ) {
133 137
 			$option = $this->getSchemaOptionValue( $value );
134
-			if( empty( $option ))continue;
138
+			if( empty( $option )) {
139
+				continue;
140
+			}
135 141
 			$schema->$value( $option );
136 142
 		}
137 143
 		return $schema;
@@ -237,7 +243,9 @@  discard block
 block discarded – undo
237 243
 		if( $value != $fallback ) {
238 244
 			return $value;
239 245
 		}
240
-		if( !is_single() && !is_page() )return;
246
+		if( !is_single() && !is_page() ) {
247
+			return;
248
+		}
241 249
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
242 250
 		if( method_exists( $this, $method )) {
243 251
 			return $this->$method();
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 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( is_null( glsr()->schemas ))return;
83
+		if( is_null( 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
 	/**
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	{
166 166
 		$offers = $this->buildSchemaValues( $this->getSchemaType( 'AggregateOffer' ), [
167 167
 			'highPrice', 'lowPrice', 'priceCurrency',
168
-		]);
168
+		] );
169 169
 		return $this->buildSummaryForCustom()
170 170
 			->offers( $offers )
171
-			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ));
171
+			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ) );
172 172
 	}
173 173
 
174 174
 	/**
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	protected function getRatingCounts()
178 178
 	{
179
-		if( !isset( $this->ratingCounts )) {
180
-			$counts = glsr( CountsManager::class )->get([
181
-				'post_ids' => array_filter( array_map( 'trim', explode( ',', $this->args['assigned_to'] ))),
179
+		if( !isset($this->ratingCounts) ) {
180
+			$counts = glsr( CountsManager::class )->get( [
181
+				'post_ids' => array_filter( array_map( 'trim', explode( ',', $this->args['assigned_to'] ) ) ),
182 182
 				'term_ids' => glsr( ReviewManager::class )->normalizeTerms( $this->args['category'] ),
183
-			]);
183
+			] );
184 184
 			$this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [
185 185
 				'min' => $this->args['rating'],
186
-			]);
186
+			] );
187 187
 		}
188 188
 		return $this->ratingCounts;
189 189
 	}
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 	protected function getSchemaOption( $option, $fallback )
205 205
 	{
206 206
 		$option = strtolower( $option );
207
-		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) {
207
+		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
208 208
 			return $schemaOption;
209 209
 		}
210 210
 		$setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option );
211
-		if( is_array( $setting )) {
211
+		if( is_array( $setting ) ) {
212 212
 			return $this->getSchemaOptionDefault( $setting, $fallback );
213 213
 		}
214
-		return !empty( $setting )
214
+		return !empty($setting)
215 215
 			? $setting
216 216
 			: $fallback;
217 217
 	}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$setting = wp_parse_args( $setting, [
226 226
 			'custom' => '',
227 227
 			'default' => $fallback,
228
-		]);
228
+		] );
229 229
 		return $setting['default'] != 'custom'
230 230
 			? $setting['default']
231 231
 			: $setting['custom'];
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		}
245 245
 		if( !is_single() && !is_page() )return;
246 246
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
247
-		if( method_exists( $this, $method )) {
247
+		if( method_exists( $this, $method ) ) {
248 248
 			return $this->$method();
249 249
 		}
250 250
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	protected function getSchemaType( $type = null )
257 257
 	{
258
-		if( !is_string( $type )) {
258
+		if( !is_string( $type ) ) {
259 259
 			$type = $this->getSchemaOption( 'type', 'LocalBusiness' );
260 260
 		}
261 261
 		$className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' );
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	protected function getThingDescription()
271 271
 	{
272 272
 		$post = get_post();
273
-		if( !( $post instanceof WP_Post )) {
273
+		if( !($post instanceof WP_Post) ) {
274 274
 			return '';
275 275
 		}
276
-		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ));
277
-		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ));
276
+		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) );
277
+		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) );
278 278
 	}
279 279
 
280 280
 	/**
Please login to merge, or discard this patch.