Passed
Push — master ( 9e5b16...6a4033 )
by Paul
04:16
created
plugin/Modules/Email.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function send()
74 74
 	{
75
-		if( !$this->message || !$this->subject || !$this->to )return;
75
+		if( !$this->message || !$this->subject || !$this->to ) {
76
+			return;
77
+		}
76 78
 		$sent = wp_mail(
77 79
 			$this->to,
78 80
 			$this->subject,
@@ -90,8 +92,12 @@  discard block
 block discarded – undo
90 92
 	 */
91 93
 	public function buildPlainTextMessage( PHPMailer $phpmailer )
92 94
 	{
93
-		if( empty( $this->email ))return;
94
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
95
+		if( empty( $this->email )) {
96
+			return;
97
+		}
98
+		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) {
99
+			return;
100
+		}
95 101
 		$message = $this->stripHtmlTags( $phpmailer->Body );
96 102
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
97 103
 	}
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
 	protected $settings;
30 30
 	protected $taxonomy;
31 31
 
32
-	public function __construct( Application $app ) {
32
+	public function __construct( Application $app )
33
+	{
33 34
 		$this->app = $app;
34 35
 		$this->admin = $app->make( AdminController::class );
35 36
 		$this->editor = $app->make( EditorController::class );
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,9 +16,13 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$queries = [];
18 18
 		foreach( $keys as $key ) {
19
-			if( !array_key_exists( $key, $values ))continue;
19
+			if( !array_key_exists( $key, $values )) {
20
+				continue;
21
+			}
20 22
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
21
-			if( !method_exists( $this, $methodName ))continue;
23
+			if( !method_exists( $this, $methodName )) {
24
+				continue;
25
+			}
22 26
 			$query = call_user_func( [$this, $methodName], $values[$key] );
23 27
 			if( is_array( $query )) {
24 28
 				$queries[] = $query;
@@ -92,7 +96,9 @@  discard block
 block discarded – undo
92 96
 	 */
93 97
 	protected function buildQueryAssignedTo( $value )
94 98
 	{
95
-		if( empty( $value ))return;
99
+		if( empty( $value )) {
100
+			return;
101
+		}
96 102
 		return [
97 103
 			'compare' => 'IN',
98 104
 			'key' => 'assigned_to',
@@ -106,7 +112,9 @@  discard block
 block discarded – undo
106 112
 	 */
107 113
 	protected function buildQueryCategory( $value )
108 114
 	{
109
-		if( empty( $value ))return;
115
+		if( empty( $value )) {
116
+			return;
117
+		}
110 118
 		return [
111 119
 			'field' => 'term_id',
112 120
 			'taxonomy' => Application::TAXONOMY,
@@ -120,7 +128,9 @@  discard block
 block discarded – undo
120 128
 	 */
121 129
 	protected function buildQueryRating( $value )
122 130
 	{
123
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
131
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
132
+			return;
133
+		}
124 134
 		return [
125 135
 			'compare' => '>=',
126 136
 			'key' => 'rating',
@@ -134,7 +144,9 @@  discard block
 block discarded – undo
134 144
 	 */
135 145
 	protected function buildQueryType( $value )
136 146
 	{
137
-		if( in_array( $value, ['','all'] ))return;
147
+		if( in_array( $value, ['','all'] )) {
148
+			return;
149
+		}
138 150
 		return [
139 151
 			'key' => 'review_type',
140 152
 			'value' => $value,
Please login to merge, or discard this patch.
plugin/Modules/Schema/BaseType.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -212,7 +212,9 @@  discard block
 block discarded – undo
212 212
 		$newParents = $parents;
213 213
 		foreach( $parents as $parent ) {
214 214
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
215
-			if( !class_exists( $parentClass ))continue;
215
+			if( !class_exists( $parentClass )) {
216
+				continue;
217
+			}
216 218
 			$newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ));
217 219
 		}
218 220
 		return array_values( array_unique( $newParents ));
@@ -226,7 +228,9 @@  discard block
 block discarded – undo
226 228
 		$parents = $this->getParents();
227 229
 		foreach( $parents as $parent ) {
228 230
 			$parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ );
229
-			if( !class_exists( $parentClass ))continue;
231
+			if( !class_exists( $parentClass )) {
232
+				continue;
233
+			}
230 234
 			$this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed )));
231 235
 		}
232 236
 	}
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 		foreach( glsr( Database::class )->getReviews( $this->args )->results as $review ) {
34 34
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
35 35
 			// @see https://developers.google.com/search/docs/data-types/review
36
-			if( $review->review_type != 'local' )continue;
36
+			if( $review->review_type != 'local' ) {
37
+				continue;
38
+			}
37 39
 			$reviews[] = $this->buildReview( $review );
38 40
 		}
39 41
 		if( !empty( $reviews )) {
@@ -78,7 +80,9 @@  discard block
 block discarded – undo
78 80
 	 */
79 81
 	public function render()
80 82
 	{
81
-		if( is_null( glsr()->schemas ))return;
83
+		if( is_null( glsr()->schemas )) {
84
+			return;
85
+		}
82 86
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
83 87
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
84 88
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -129,7 +133,9 @@  discard block
 block discarded – undo
129 133
 	{
130 134
 		foreach( $values as $value ) {
131 135
 			$option = $this->getSchemaOptionValue( $value );
132
-			if( empty( $option ))continue;
136
+			if( empty( $option )) {
137
+				continue;
138
+			}
133 139
 			$schema->$value( $option );
134 140
 		}
135 141
 		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.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  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' )) {
38
+			return;
39
+		}
38 40
 		$this->rating = glsr( Rating::class )->getAverage( $this->reviews );
39 41
 		$this->generateSchema();
40 42
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -54,7 +56,9 @@  discard block
 block discarded – undo
54 56
 	 */
55 57
 	protected function buildPercentage()
56 58
 	{
57
-		if( $this->isHidden( 'bars' ))return;
59
+		if( $this->isHidden( 'bars' )) {
60
+			return;
61
+		}
58 62
 		$range = range( Rating::MAX_RATING, 1 );
59 63
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews ));
60 64
 		$bars = array_reduce( $range, function( $carry, $level ) use( $percentages ) {
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 	 */
105 109
 	protected function buildRating()
106 110
 	{
107
-		if( $this->isHidden( 'rating' ))return;
111
+		if( $this->isHidden( 'rating' )) {
112
+			return;
113
+		}
108 114
 		return $this->wrap( 'rating', '<span>'.$this->rating.'</span>' );
109 115
 	}
110 116
 
@@ -113,7 +119,9 @@  discard block
 block discarded – undo
113 119
 	 */
114 120
 	protected function buildStars()
115 121
 	{
116
-		if( $this->isHidden( 'stars' ))return;
122
+		if( $this->isHidden( 'stars' )) {
123
+			return;
124
+		}
117 125
 		$stars = glsr( Partial::class )->build( 'star-rating', [
118 126
 			'rating' => $this->rating,
119 127
 		]);
@@ -125,7 +133,9 @@  discard block
 block discarded – undo
125 133
 	 */
126 134
 	protected function buildText()
127 135
 	{
128
-		if( $this->isHidden( 'summary' ))return;
136
+		if( $this->isHidden( 'summary' )) {
137
+			return;
138
+		}
129 139
 		$count = count( $this->reviews );
130 140
 		if( empty( $this->args['text'] )) {
131 141
 			// @todo document this change
@@ -150,7 +160,9 @@  discard block
 block discarded – undo
150 160
 	 */
151 161
 	protected function generateSchema()
152 162
 	{
153
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
163
+		if( !wp_validate_boolean( $this->args['schema'] )) {
164
+			return;
165
+		}
154 166
 		glsr( Schema::class )->store(
155 167
 			glsr( Schema::class )->buildSummary( $this->args )
156 168
 		);
Please login to merge, or discard this patch.
helpers.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * @return mixed
6 6
  */
7
-function glsr( $alias = null ) {
7
+function glsr( $alias = null )
8
+{
8 9
 	$app = \GeminiLabs\SiteReviews\Application::load();
9 10
 	return !empty( $alias )
10 11
 		? $app->make( $alias )
@@ -14,7 +15,8 @@  discard block
 block discarded – undo
14 15
 /**
15 16
  * @return \WP_Screen|object
16 17
  */
17
-function glsr_current_screen() {
18
+function glsr_current_screen()
19
+{
18 20
 	if( function_exists( 'get_current_screen' )) {
19 21
 		$screen = get_current_screen();
20 22
 	}
@@ -26,7 +28,8 @@  discard block
 block discarded – undo
26 28
 /**
27 29
  * @return \GeminiLabs\SiteReviews\Database
28 30
  */
29
-function glsr_db() {
31
+function glsr_db()
32
+{
30 33
 	return glsr( 'Database' );
31 34
 }
32 35
 
@@ -34,7 +37,8 @@  discard block
 block discarded – undo
34 37
  * @param mixed ...$vars
35 38
  * @return void
36 39
  */
37
-function glsr_debug( ...$vars ) {
40
+function glsr_debug( ...$vars )
41
+{
38 42
 	if( count( $vars ) == 1 ) {
39 43
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
40 44
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
 /**
52 56
  * @return \GeminiLabs\SiteReviews\Modules\Console
53 57
  */
54
-function glsr_log() {
58
+function glsr_log()
59
+{
55 60
 	$args = func_get_args();
56 61
 	$context = isset( $args[1] )
57 62
 		? $args[1]
@@ -67,14 +72,16 @@  discard block
 block discarded – undo
67 72
  * @param mixed $fallback
68 73
  * @return string|array
69 74
  */
70
-function glsr_get_option( $path = '', $fallback = '' ) {
75
+function glsr_get_option( $path = '', $fallback = '' )
76
+{
71 77
 	return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback );
72 78
 }
73 79
 
74 80
 /**
75 81
  * @return array
76 82
  */
77
-function glsr_get_options() {
83
+function glsr_get_options()
84
+{
78 85
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
79 86
 }
80 87
 
@@ -82,7 +89,8 @@  discard block
 block discarded – undo
82 89
  * @param int $post_id
83 90
  * @return void|object
84 91
  */
85
-function glsr_get_review( $post_id ) {
92
+function glsr_get_review( $post_id )
93
+{
86 94
 	return glsr( 'Database' )->getReview( get_post( $post_id ));
87 95
 }
88 96
 
@@ -90,6 +98,7 @@  discard block
 block discarded – undo
90 98
  * @return array
91 99
  * @todo document change of $reviews->reviews to $reviews->results
92 100
  */
93
-function glsr_get_reviews( array $args = array() ) {
101
+function glsr_get_reviews( array $args = array() )
102
+{
94 103
 	return glsr( 'Database' )->getReviews( $args );
95 104
 }
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 			get_mu_plugins(),
92 92
 			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
93 93
 		);
94
-		if( empty( $plugins ))return;
94
+		if( empty( $plugins )) {
95
+			return;
96
+		}
95 97
 		return $this->normalizePluginList( $plugins );
96 98
 	}
97 99
 
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
 	 */
101 103
 	public function getMultisitePluginDetails()
102 104
 	{
103
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
105
+		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) {
106
+			return;
107
+		}
104 108
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
105 109
 	}
106 110
 
@@ -157,7 +161,9 @@  discard block
 block discarded – undo
157 161
 		ksort( $settings );
158 162
 		$details = [];
159 163
 		foreach( $settings as $key => $value ) {
160
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
164
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) {
165
+				continue;
166
+			}
161 167
 			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
162 168
 			$details[$key] = $value;
163 169
 		}
@@ -230,7 +236,9 @@  discard block
 block discarded – undo
230 236
 			'WPE_APIKEY' => 'WP Engine',
231 237
 		];
232 238
 		foreach( $checks as $key => $value ) {
233
-			if( !$this->isWebhostCheckValid( $key ))continue;
239
+			if( !$this->isWebhostCheckValid( $key )) {
240
+				continue;
241
+			}
234 242
 			return $value;
235 243
 		}
236 244
 		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ));
@@ -311,7 +319,9 @@  discard block
 block discarded – undo
311 319
 		];
312 320
 		array_walk( $settings, function( &$value, $setting ) use( $keys ) {
313 321
 			foreach( $keys as $key ) {
314
-				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue;
322
+				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value )) {
323
+					continue;
324
+				}
315 325
 				$value = str_repeat( '•', 13 );
316 326
 				return;
317 327
 			}
Please login to merge, or discard this patch.
views/partials/addons/addon.php 1 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.