Test Failed
Push — hotfix/fix-counts ( 4803a6...1fe4ce )
by Paul
04:22
created
plugin/Controllers/TaxonomyController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) )return;
39 39
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 40
 			'class' => 'screen-reader-text',
41 41
 			'for' => Application::TAXONOMY,
42
-		]);
43
-		wp_dropdown_categories([
42
+		] );
43
+		wp_dropdown_categories( [
44 44
 			'depth' => 3,
45 45
 			'hide_empty' => true,
46 46
 			'hide_if_empty' => true,
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'show_option_all' => $this->getShowOptionAll(),
53 53
 			'taxonomy' => Application::TAXONOMY,
54 54
 			'value_field' => 'slug',
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		if( $taxonomy != Application::TAXONOMY || count( $newTTIds ) <= 1 )return;
71 71
 		$diff = array_diff( $newTTIds, $oldTTIds );
72
-		if( empty( $newTerm = array_shift( $diff ))) {
72
+		if( empty($newTerm = array_shift( $diff )) ) {
73 73
 			$newTerm = array_shift( $newTTIds );
74 74
 		}
75 75
 		if( $newTerm ) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	{
94 94
 		$taxonomy = get_taxonomy( Application::TAXONOMY );
95 95
 		return $taxonomy
96
-			? ucfirst( strtolower( $taxonomy->labels->all_items ))
96
+			? ucfirst( strtolower( $taxonomy->labels->all_items ) )
97 97
 			: '';
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 	 */
68 70
 	public function restrictTermSelection( $postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds )
69 71
 	{
70
-		if( $taxonomy != Application::TAXONOMY || count( $newTTIds ) <= 1 )return;
72
+		if( $taxonomy != Application::TAXONOMY || count( $newTTIds ) <= 1 ) {
73
+			return;
74
+		}
71 75
 		$diff = array_diff( $newTTIds, $oldTTIds );
72 76
 		if( empty( $newTerm = array_shift( $diff ))) {
73 77
 			$newTerm = array_shift( $newTTIds );
Please login to merge, or discard this patch.
plugin/Modules/Email.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	public function send()
74 74
 	{
75 75
 		if( !$this->message || !$this->subject || !$this->to )return;
76
-		add_action( 'wp_mail_failed', [$this, 'logMailError']);
76
+		add_action( 'wp_mail_failed', [$this, 'logMailError'] );
77 77
 		$sent = wp_mail(
78 78
 			$this->to,
79 79
 			$this->subject,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			$this->headers,
82 82
 			$this->attachments
83 83
 		);
84
-		remove_action( 'wp_mail_failed', [$this, 'logMailError']);
84
+		remove_action( 'wp_mail_failed', [$this, 'logMailError'] );
85 85
 		$this->reset();
86 86
 		return $sent;
87 87
 	}
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function buildPlainTextMessage( PHPMailer $phpmailer )
94 94
 	{
95
-		if( empty( $this->email ))return;
96
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
95
+		if( empty($this->email) )return;
96
+		if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return;
97 97
 		$message = $this->stripHtmlTags( $phpmailer->Body );
98 98
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
99 99
 	}
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 		$allowed = [
107 107
 			'bcc', 'cc', 'from', 'reply-to',
108 108
 		];
109
-		$headers = array_intersect_key( $this->email, array_flip( $allowed ));
109
+		$headers = array_intersect_key( $this->email, array_flip( $allowed ) );
110 110
 		$headers = array_filter( $headers );
111 111
 		foreach( $headers as $key => $value ) {
112
-			unset( $headers[$key] );
112
+			unset($headers[$key]);
113 113
 			$headers[] = $key.': '.$value;
114 114
 		}
115 115
 		$headers[] = 'Content-Type: text/html';
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function buildHtmlMessage()
123 123
 	{
124
-		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ));
125
-		if( !empty( $template )) {
124
+		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) );
125
+		if( !empty($template) ) {
126 126
 			$message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'], $this->email['template'] );
127 127
 		}
128 128
 		else if( $this->email['template'] ) {
129 129
 			$message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [
130 130
 				'context' => $this->email['template-tags'],
131
-			]);
131
+			] );
132 132
 		}
133
-		if( !isset( $message )) {
133
+		if( !isset($message) ) {
134 134
 			$message = $this->email['message'];
135 135
 		}
136 136
 		$message = $this->email['before'].$message.$this->email['after'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$message = str_replace( ']]>', ']]&gt;', $message );
142 142
 		$message = glsr( Template::class )->build( 'partials/email/index', [
143 143
 			'context' => ['message' => $message],
144
-		]);
144
+		] );
145 145
 		return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this );
146 146
 	}
147 147
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	protected function normalize( array $email = [] )
163 163
 	{
164 164
 		$email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email );
165
-		if( empty( $email['reply-to'] )) {
165
+		if( empty($email['reply-to']) ) {
166 166
 			$email['reply-to'] = $email['from'];
167 167
 		}
168 168
 		$this->email = apply_filters( 'site-reviews/email/compose', $email, $this );
Please login to merge, or discard this 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
 		add_action( 'wp_mail_failed', [$this, 'logMailError']);
77 79
 		$sent = wp_mail(
78 80
 			$this->to,
@@ -92,8 +94,12 @@  discard block
 block discarded – undo
92 94
 	 */
93 95
 	public function buildPlainTextMessage( PHPMailer $phpmailer )
94 96
 	{
95
-		if( empty( $this->email ))return;
96
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
97
+		if( empty( $this->email )) {
98
+			return;
99
+		}
100
+		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) {
101
+			return;
102
+		}
97 103
 		$message = $this->stripHtmlTags( $phpmailer->Body );
98 104
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
99 105
 	}
Please login to merge, or discard this patch.
plugin/Modules/Notification.php 2 patches
Spacing   +16 added lines, -16 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
 		$types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
36
-		$this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0;
36
+		$this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
37 37
 		$this->slack = in_array( 'slack', $types );
38 38
 		$this->types = $types;
39 39
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty($this->types) )return;
47 47
 		$this->review = $review;
48 48
 		$args = [
49 49
 			'link' => $this->getLink(),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function buildEmail( array $args )
60 60
 	{
61
-		return glsr( Email::class )->compose([
61
+		return glsr( Email::class )->compose( [
62 62
 			'to' => $this->getEmailAddresses(),
63 63
 			'subject' => $args['title'],
64 64
 			'template' => 'email-notification',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				'review_rating' => $this->review->rating,
72 72
 				'review_title' => $this->review->title,
73 73
 			],
74
-		]);
74
+		] );
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'button_url' => $args['link'],
84 84
 			'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
 			'pretext' => $args['title'],
86
-		]);
86
+		] );
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 	protected function getEmailAddresses()
93 93
 	{
94 94
 		$emails = [];
95
-		if( in_array( 'admin', $this->types )) {
95
+		if( in_array( 'admin', $this->types ) ) {
96 96
 			$emails[] = get_option( 'admin_email' );
97 97
 		}
98
-		if( in_array( 'author', $this->types )) {
99
-			$assignedPost = get_post( intval( $this->review->assigned_to ));
98
+		if( in_array( 'author', $this->types ) ) {
99
+			$assignedPost = get_post( intval( $this->review->assigned_to ) );
100 100
 			if( $assignedPost instanceof WP_Post ) {
101 101
 				$this->email = true;
102
-				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ));
102
+				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
 			}
104 104
 		}
105
-		if( in_array( 'custom', $this->types )) {
105
+		if( in_array( 'custom', $this->types ) ) {
106 106
 			$customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107 107
 			$customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108 108
 			$customEmails = explode( ',', $customEmails );
109 109
 			$emails = array_merge( $emails, $customEmails );
110 110
 		}
111
-		$emails = array_filter( array_keys( array_flip( $emails )));
111
+		$emails = array_filter( array_keys( array_flip( $emails ) ) );
112 112
 		return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
 	}
114 114
 
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function getTitle()
127 127
 	{
128
-		$assignedTitle = get_the_title( intval( $this->review->assigned_to ));
128
+		$assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
 		$title = _nx(
130 130
 			'New %s-star review',
131 131
 			'New %s-star review of: %s',
132
-			intval( empty( $assignedTitle )),
132
+			intval( empty($assignedTitle) ),
133 133
 			'This string differs depending on whether or not the review has been assigned to a post.',
134 134
 			'site-reviews'
135 135
 		);
136 136
 		$title = sprintf( '[%s] %s',
137
-			wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ),
137
+			wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ),
138 138
 			sprintf( $title, $this->review->rating, $assignedTitle )
139 139
 		);
140 140
 		return apply_filters( 'site-reviews/notification/title', $title, $this->review );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	protected function sendToEmail( array $args )
147 147
 	{
148 148
 		$email = $this->buildEmail( $args );
149
-		if( empty( $email->to )) {
149
+		if( empty($email->to) ) {
150 150
 			glsr_log()->error( 'Email notification was not sent (missing email address)' );
151 151
 			return;
152 152
 		}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		if( !$this->slack )return;
162 162
 		$notification = $this->buildSlackNotification( $args );
163 163
 		$result = $notification->send();
164
-		if( is_wp_error( $result )) {
164
+		if( is_wp_error( $result ) ) {
165 165
 			$notification->review = null;
166 166
 			glsr_log()->error( $result->get_error_message() )->debug( $notification );
167 167
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty( $this->types )) {
47
+			return;
48
+		}
47 49
 		$this->review = $review;
48 50
 		$args = [
49 51
 			'link' => $this->getLink(),
@@ -158,7 +160,9 @@  discard block
 block discarded – undo
158 160
 	 */
159 161
 	protected function sendToSlack( array $args )
160 162
 	{
161
-		if( !$this->slack )return;
163
+		if( !$this->slack ) {
164
+			return;
165
+		}
162 166
 		$notification = $this->buildSlackNotification( $args );
163 167
 		$result = $notification->send();
164 168
 		if( is_wp_error( $result )) {
Please login to merge, or discard this patch.
plugin/Database/SqlQueries.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function deleteAllSessions( $sessionCookiePrefix )
24 24
 	{
25
-		return $this->db->query("
25
+		return $this->db->query( "
26 26
 			DELETE
27 27
 			FROM {$this->db->options}
28 28
 			WHERE option_name LIKE '{$sessionCookiePrefix}_%'
29
-		");
29
+		" );
30 30
 	}
31 31
 
32 32
 	/**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function deleteExpiredSessions( $expiredSessions )
37 37
 	{
38
-		return $this->db->query("
38
+		return $this->db->query( "
39 39
 			DELETE
40 40
 			FROM {$this->db->options}
41 41
 			WHERE option_name IN ('{$expiredSessions}')
42
-		");
42
+		" );
43 43
 	}
44 44
 
45 45
 	/**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function getExpiredSessions( $sessionCookiePrefix, $limit )
51 51
 	{
52
-		return (array) $this->db->get_results("
52
+		return (array)$this->db->get_results( "
53 53
 			SELECT option_name AS name, option_value AS expiration
54 54
 			FROM {$this->db->options}
55 55
 			WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%'
56 56
 			ORDER BY option_value ASC
57 57
 			LIMIT 0, {$limit}
58
-		");
58
+		" );
59 59
 	}
60 60
 
61 61
 	/**
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function getPostIdFromReviewId( $metaReviewId )
66 66
 	{
67
-		$postId = $this->db->get_var("
67
+		$postId = $this->db->get_var( "
68 68
 			SELECT p.ID
69 69
 			FROM {$this->db->posts} AS p
70 70
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
71 71
 			WHERE p.post_type = '{$this->postType}'
72 72
 			AND m.meta_key = 'review_id'
73 73
 			AND m.meta_value = '{$metaReviewId}'
74
-		");
74
+		" );
75 75
 		return intval( $postId );
76 76
 	}
77 77
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getReviewCounts( array $args, $lastPostId = 0, $limit = 500 )
84 84
 	{
85
-		return (array) $this->db->get_results("
85
+		return (array)$this->db->get_results( "
86 86
 			SELECT DISTINCT p.ID, m1.meta_value AS rating, m2.meta_value AS type
87 87
 			FROM {$this->db->posts} AS p
88 88
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			{$this->getAndForCounts( $args )}
97 97
 			ORDER By p.ID ASC
98 98
 			LIMIT {$limit}
99
-		");
99
+		" );
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getReviewCountsFor( $metaKey )
108 108
 	{
109
-		return (array) $this->db->get_results("
109
+		return (array)$this->db->get_results( "
110 110
 			SELECT DISTINCT m.meta_value AS name, COUNT(*) num_posts
111 111
 			FROM {$this->db->posts} AS p
112 112
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
113 113
 			WHERE p.post_type = '{$this->postType}'
114 114
 			AND m.meta_key = '{$metaKey}'
115 115
 			GROUP BY name
116
-		");
116
+		" );
117 117
 	}
118 118
 
119 119
 	/**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function getReviewIdsByType( $reviewType )
125 125
 	{
126
-		$results = $this->db->get_col("
126
+		$results = $this->db->get_col( "
127 127
 			SELECT DISTINCT m1.meta_value AS review_id
128 128
 			FROM {$this->db->posts} AS p
129 129
 			INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 			AND m1.meta_key = 'review_id'
133 133
 			AND m2.meta_key = 'review_type'
134 134
 			AND m2.meta_value = '{$reviewType}'
135
-		");
136
-		return array_keys( array_flip( $results ));
135
+		" );
136
+		return array_keys( array_flip( $results ) );
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 )
145 145
 	{
146 146
 		sort( $postIds );
147
-		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds )), $limit );
147
+		$postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit );
148 148
 		$postIds = implode( ',', $postIds );
149
-		return (array) $this->db->get_results("
149
+		return (array)$this->db->get_results( "
150 150
 			SELECT p.ID, m.meta_value AS rating
151 151
 			FROM {$this->db->posts} AS p
152 152
 			INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			GROUP BY p.ID
159 159
 			ORDER By p.ID ASC
160 160
 			LIMIT {$limit}
161
-		");
161
+		" );
162 162
 	}
163 163
 
164 164
 	/**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function getReviewsMeta( $key, $status = 'publish' )
170 170
 	{
171
-		$values = $this->db->get_col("
171
+		$values = $this->db->get_col( "
172 172
 			SELECT DISTINCT m.meta_value
173 173
 			FROM {$this->db->postmeta} m
174 174
 			LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			AND p.post_status = '{$status}'
179 179
 			GROUP BY p.ID -- remove duplicate meta_value entries
180 180
 			ORDER BY m.meta_id ASC -- sort by oldest meta_value
181
-		");
181
+		" );
182 182
 		sort( $values );
183 183
 		return $values;
184 184
 	}
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	protected function getAndForCounts( array $args, $and = '' )
191 191
 	{
192
-		$postIds = implode( ',', array_filter( $args['post_ids'] ));
193
-		$termIds = implode( ',', array_filter( $args['term_ids'] ));
194
-		if( !empty( $args['type'] )) {
195
-			$and.= "AND m2.meta_value = '{$args['type']}' ";
192
+		$postIds = implode( ',', array_filter( $args['post_ids'] ) );
193
+		$termIds = implode( ',', array_filter( $args['term_ids'] ) );
194
+		if( !empty($args['type']) ) {
195
+			$and .= "AND m2.meta_value = '{$args['type']}' ";
196 196
 		}
197 197
 		if( $postIds ) {
198
-			$and.= "AND m3.meta_key = 'assigned_to' AND m3.meta_value IN ({$postIds}) ";
198
+			$and .= "AND m3.meta_key = 'assigned_to' AND m3.meta_value IN ({$postIds}) ";
199 199
 		}
200 200
 		if( $termIds ) {
201
-			$and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
201
+			$and .= "AND tr.term_taxonomy_id IN ({$termIds}) ";
202 202
 		}
203 203
 		return $and;
204 204
 	}
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function getInnerJoinForCounts( array $args, $innerJoin = '' )
211 211
 	{
212
-		if( !empty( $args['post_ids'] )) {
213
-			$innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
212
+		if( !empty($args['post_ids']) ) {
213
+			$innerJoin .= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
214 214
 		}
215
-		if( !empty( $args['term_ids'] )) {
216
-			$innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
215
+		if( !empty($args['term_ids']) ) {
216
+			$innerJoin .= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
217 217
 		}
218 218
 		return $innerJoin;
219 219
 	}
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 		$query = $this->queryReviews( $args );
31 31
 		while( $query ) {
32 32
 			// glsr_log($query);
33
-			$types = array_keys( array_flip( glsr_array_column( $query->reviews, 'type' )));
34
-			$types = array_unique( array_merge( ['local'], $types ));
33
+			$types = array_keys( array_flip( glsr_array_column( $query->reviews, 'type' ) ) );
34
+			$types = array_unique( array_merge( ['local'], $types ) );
35 35
 			foreach( $types as $type ) {
36 36
 				$type = $this->normalizeType( $type );
37
-				if( isset( $counts[$type] ))continue;
37
+				if( isset($counts[$type]) )continue;
38 38
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
39 39
 			}
40 40
 			foreach( $query->reviews as $review ) {
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	{
74 74
 		$terms = glsr( Database::class )->getTerms( ['fields' => 'all'] );
75 75
 		foreach( $terms as $term ) {
76
-			$this->setTermCounts( $term->term_id, $this->buildTermCounts( $term->term_taxonomy_id ));
76
+			$this->setTermCounts( $term->term_id, $this->buildTermCounts( $term->term_taxonomy_id ) );
77 77
 		}
78 78
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
79 79
 		foreach( $postIds as $postId ) {
80
-			$this->setPostCounts( $postId, $this->buildPostCounts( $postId ));
80
+			$this->setPostCounts( $postId, $this->buildPostCounts( $postId ) );
81 81
 		}
82 82
 		$this->setCounts( $this->buildCounts() );
83 83
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			$this->getCounts(),
102 102
 			$review->review_type,
103 103
 			$review->rating
104
-		));
104
+		) );
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function decreasePostCounts( Review $review )
111 111
 	{
112
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
112
+		if( empty($counts = $this->getPostCounts( $review->assigned_to )) )return;
113 113
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
114 114
 		$this->setPostCounts( $review->assigned_to, $counts );
115 115
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	public function decreaseTermCounts( Review $review )
121 121
 	{
122 122
 		foreach( $review->term_ids as $termId ) {
123
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
123
+			if( empty($counts = $this->getTermCounts( $termId )) )continue;
124 124
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
125 125
 			$this->setTermCounts( $termId, $counts );
126 126
 		}
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	public function flatten( array $reviewCounts, array $args = [] )
133 133
 	{
134 134
 		$counts = [];
135
-		array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) {
136
-			$counts[$index] = $num + intval( glsr_get( $counts, $index, 0 ));
135
+		array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) {
136
+			$counts[$index] = $num + intval( glsr_get( $counts, $index, 0 ) );
137 137
 		});
138 138
 		$args = wp_parse_args( $args, [
139 139
 			'max' => Rating::MAX_RATING,
140 140
 			'min' => Rating::MIN_RATING,
141
-		]);
141
+		] );
142 142
 		foreach( $counts as $index => &$num ) {
143
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
143
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ) )continue;
144 144
 			$num = 0;
145 145
 		}
146 146
 		return $counts;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		$args = $this->normalizeArgs( $args );
155 155
 		$counts = [];
156
-		if( $this->isMixedCount( $args )) {
156
+		if( $this->isMixedCount( $args ) ) {
157 157
 			$counts = [$this->buildCounts( $args )]; // force query the database
158 158
 		}
159 159
 		else {
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 			foreach( $args['term_ids'] as $termId ) {
164 164
 				$counts[] = $this->getTermCounts( $termId );
165 165
 			}
166
-			if( empty( $counts )) {
166
+			if( empty($counts) ) {
167 167
 				$counts[] = $this->getCounts();
168 168
 			}
169 169
 		}
170 170
 		return in_array( $args['type'], ['', 'all'] )
171 171
 			? $this->normalize( [$this->flatten( $counts )] )
172
-			: $this->normalize( glsr_array_column( $counts, $args['type'] ));
172
+			: $this->normalize( glsr_array_column( $counts, $args['type'] ) );
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	public function getCounts()
179 179
 	{
180 180
 		$counts = glsr( OptionManager::class )->get( 'counts', [] );
181
-		if( !is_array( $counts )) {
181
+		if( !is_array( $counts ) ) {
182 182
 			glsr_log()->error( '$counts is not an array' )->debug( $counts );
183 183
 			return [];
184 184
 		}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function getPostCounts( $postId )
193 193
 	{
194
-		return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true ));
194
+		return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true ) );
195 195
 	}
196 196
 
197 197
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function getTermCounts( $termId )
202 202
 	{
203
-		return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true ));
203
+		return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true ) );
204 204
 	}
205 205
 
206 206
 	/**
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function increaseCounts( Review $review )
220 220
 	{
221
-		if( empty( $counts = $this->getCounts() )) {
221
+		if( empty($counts = $this->getCounts()) ) {
222 222
 			$counts = $this->buildCounts();
223 223
 		}
224
-		$this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating ));
224
+		$this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating ) );
225 225
 	}
226 226
 
227 227
 	/**
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function increasePostCounts( Review $review )
231 231
 	{
232
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
232
+		if( !(get_post( $review->assigned_to ) instanceof WP_Post) )return;
233 233
 		$counts = $this->getPostCounts( $review->assigned_to );
234
-		$counts = empty( $counts )
234
+		$counts = empty($counts)
235 235
 			? $this->buildPostCounts( $review->assigned_to )
236 236
 			: $this->increaseRating( $counts, $review->review_type, $review->rating );
237 237
 		$this->setPostCounts( $review->assigned_to, $counts );
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public function increaseTermCounts( Review $review )
244 244
 	{
245
-		$terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ));
245
+		$terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ) );
246 246
 		foreach( $terms as $term ) {
247 247
 			$counts = $this->getTermCounts( $term['term_id'] );
248
-			$counts = empty( $counts )
248
+			$counts = empty($counts)
249 249
 				? $this->buildTermCounts( $term['term_taxonomy_id'] )
250 250
 				: $this->increaseRating( $counts, $review->review_type, $review->rating );
251 251
 			$this->setTermCounts( $term['term_id'], $counts );
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	{
269 269
 		$ratingCounts = $this->flatten( $reviewCounts );
270 270
 		update_post_meta( $postId, static::META_COUNT, $reviewCounts );
271
-		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
272
-		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
271
+		update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
272
+		update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
273 273
 	}
274 274
 
275 275
 	/**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	public function setTermCounts( $termId, array $reviewCounts )
280 280
 	{
281 281
 		$term = get_term( $termId, Application::TAXONOMY );
282
-		if( !isset( $term->term_id ))return;
282
+		if( !isset($term->term_id) )return;
283 283
 		$ratingCounts = $this->flatten( $reviewCounts );
284 284
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
285
-		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
286
-		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ));
285
+		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
286
+		update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
287 287
 	}
288 288
 
289 289
 	/**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	protected function decreaseRating( array $reviewCounts, $type, $rating )
295 295
 	{
296
-		if( isset( $reviewCounts[$type][$rating] )) {
296
+		if( isset($reviewCounts[$type][$rating]) ) {
297 297
 			$reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 );
298 298
 		}
299 299
 		return $reviewCounts;
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 */
307 307
 	protected function increaseRating( array $reviewCounts, $type, $rating )
308 308
 	{
309
-		if( !array_key_exists( $type, glsr()->reviewTypes )) {
309
+		if( !array_key_exists( $type, glsr()->reviewTypes ) ) {
310 310
 			return $reviewCounts;
311 311
 		}
312
-		if( !array_key_exists( $type, $reviewCounts )) {
312
+		if( !array_key_exists( $type, $reviewCounts ) ) {
313 313
 			$reviewCounts[$type] = [];
314 314
 		}
315 315
 		$reviewCounts = $this->normalize( $reviewCounts );
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	protected function isMixedCount( array $args )
324 324
 	{
325
-		return !empty( $args['post_ids'] ) && !empty( $args['term_ids'] );
325
+		return !empty($args['post_ids']) && !empty($args['term_ids']);
326 326
 	}
327 327
 
328 328
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	protected function normalize( array $reviewCounts )
332 332
 	{
333
-		if( empty( $reviewCounts )) {
333
+		if( empty($reviewCounts) ) {
334 334
 			$reviewCounts = [[]];
335 335
 		}
336 336
 		foreach( $reviewCounts as &$counts ) {
337 337
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
338
-				if( isset( $counts[$index] ))continue;
338
+				if( isset($counts[$index]) )continue;
339 339
 				$counts[$index] = 0;
340 340
 			}
341 341
 			ksort( $counts );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			'post_ids' => [],
353 353
 			'term_ids' => [],
354 354
 			'type' => 'local',
355
-		]);
355
+		] );
356 356
 		$args['post_ids'] = glsr( Polylang::class )->getPostIds( $args['post_ids'] );
357 357
 		$args['type'] = $this->normalizeType( $args['type'] );
358 358
 		return $args;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	protected function normalizeType( $type )
366 366
 	{
367
-		return empty( $type ) || !is_string( $type )
367
+		return empty($type) || !is_string( $type )
368 368
 			? 'local'
369 369
 			: $type;
370 370
 	}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		$hasMore = is_array( $reviews )
380 380
 			? count( $reviews ) == static::LIMIT
381 381
 			: false;
382
-		return (object) [
382
+		return (object)[
383 383
 			'has_more' => $hasMore,
384 384
 			'reviews' => $reviews,
385 385
 		];
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 			$types = array_unique( array_merge( ['local'], $types ));
35 35
 			foreach( $types as $type ) {
36 36
 				$type = $this->normalizeType( $type );
37
-				if( isset( $counts[$type] ))continue;
37
+				if( isset( $counts[$type] )) {
38
+					continue;
39
+				}
38 40
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
39 41
 			}
40 42
 			foreach( $query->reviews as $review ) {
@@ -109,7 +111,9 @@  discard block
 block discarded – undo
109 111
 	 */
110 112
 	public function decreasePostCounts( Review $review )
111 113
 	{
112
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
114
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
115
+			return;
116
+		}
113 117
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
114 118
 		$this->setPostCounts( $review->assigned_to, $counts );
115 119
 	}
@@ -120,7 +124,9 @@  discard block
 block discarded – undo
120 124
 	public function decreaseTermCounts( Review $review )
121 125
 	{
122 126
 		foreach( $review->term_ids as $termId ) {
123
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
127
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
128
+				continue;
129
+			}
124 130
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
125 131
 			$this->setTermCounts( $termId, $counts );
126 132
 		}
@@ -140,7 +146,9 @@  discard block
 block discarded – undo
140 146
 			'min' => Rating::MIN_RATING,
141 147
 		]);
142 148
 		foreach( $counts as $index => &$num ) {
143
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
149
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
150
+				continue;
151
+			}
144 152
 			$num = 0;
145 153
 		}
146 154
 		return $counts;
@@ -229,7 +237,9 @@  discard block
 block discarded – undo
229 237
 	 */
230 238
 	public function increasePostCounts( Review $review )
231 239
 	{
232
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
240
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
241
+			return;
242
+		}
233 243
 		$counts = $this->getPostCounts( $review->assigned_to );
234 244
 		$counts = empty( $counts )
235 245
 			? $this->buildPostCounts( $review->assigned_to )
@@ -279,7 +289,9 @@  discard block
 block discarded – undo
279 289
 	public function setTermCounts( $termId, array $reviewCounts )
280 290
 	{
281 291
 		$term = get_term( $termId, Application::TAXONOMY );
282
-		if( !isset( $term->term_id ))return;
292
+		if( !isset( $term->term_id )) {
293
+			return;
294
+		}
283 295
 		$ratingCounts = $this->flatten( $reviewCounts );
284 296
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
285 297
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -335,7 +347,9 @@  discard block
 block discarded – undo
335 347
 		}
336 348
 		foreach( $reviewCounts as &$counts ) {
337 349
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
338
-				if( isset( $counts[$index] ))continue;
350
+				if( isset( $counts[$index] )) {
351
+					continue;
352
+				}
339 353
 				$counts[$index] = 0;
340 354
 			}
341 355
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Modules/Html/Settings.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	protected function getSettingFields( $path )
56 56
 	{
57
-		return array_filter( $this->settings, function( $key ) use( $path ) {
57
+		return array_filter( $this->settings, function( $key ) use($path) {
58 58
 			return glsr( Helper::class )->startsWith( $path, $key );
59 59
 		}, ARRAY_FILTER_USE_KEY );
60 60
 	}
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 			$field = wp_parse_args( $field, [
70 70
 				'is_setting' => true,
71 71
 				'name' => $name,
72
-			]);
73
-			$rows.= new Field( $this->normalize( $field ));
72
+			] );
73
+			$rows .= new Field( $this->normalize( $field ) );
74 74
 		}
75 75
 		return $rows;
76 76
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	protected function getTemplateData( $id )
83 83
 	{
84
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
84
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
85 85
 		return [
86 86
 			'context' => [
87 87
 				'rows' => $this->getSettingRows( $fields ),
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function getTemplateDataForAddons( $id )
97 97
 	{
98
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
98
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
99 99
 		$settings = glsr( Helper::class )->convertDotNotationArray( $fields );
100 100
 		$settingKeys = array_keys( $settings['settings']['addons'] );
101 101
 		$results = [];
102 102
 		foreach( $settingKeys as $key ) {
103
-			$addonFields = array_filter( $fields, function( $path ) use( $key ) {
103
+			$addonFields = array_filter( $fields, function( $path ) use($key) {
104 104
 				return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path );
105 105
 			}, ARRAY_FILTER_USE_KEY );
106 106
 			$results[$key] = $this->getSettingRows( $addonFields );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function getTemplateDataForLicenses( $id )
119 119
 	{
120
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
120
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
121 121
 		ksort( $fields );
122 122
 		return [
123 123
 			'context' => [
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	protected function getTemplateDataForTranslations()
133 133
 	{
134 134
 		$translations = glsr( Translation::class )->renderAll();
135
-		$class = empty( $translations )
135
+		$class = empty($translations)
136 136
 			? 'glsr-hidden'
137 137
 			: '';
138 138
 		return [
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			$path,
156 156
 			glsr( Helper::class )->dataGet( glsr()->defaults, $path )
157 157
 		);
158
-		if( is_array( $expectedValue )) {
158
+		if( is_array( $expectedValue ) ) {
159 159
 			return is_array( $optionValue )
160
-				? count( array_intersect( $optionValue, $expectedValue )) === 0
160
+				? count( array_intersect( $optionValue, $expectedValue ) ) === 0
161 161
 				: !in_array( $optionValue, $expectedValue );
162 162
 		}
163 163
 		return $optionValue != $expectedValue;
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function isMultiDependency( $path )
170 170
 	{
171
-		if( isset( $this->settings[$path] )) {
171
+		if( isset($this->settings[$path]) ) {
172 172
 			$field = $this->settings[$path];
173
-			return ( $field['type'] == 'checkbox' && !empty( $field['options'] ))
174
-				|| !empty( $field['multiple'] );
173
+			return ($field['type'] == 'checkbox' && !empty($field['options']))
174
+				|| !empty($field['multiple']);
175 175
 		}
176 176
 		return false;
177 177
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	protected function normalizeDependsOn( array $field )
194 194
 	{
195
-		if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) {
195
+		if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) {
196 196
 			$isFieldHidden = false;
197 197
 			$conditions = [];
198 198
 			foreach( $field['depends_on'] as $path => $value ) {
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 					'name' => $this->getFieldNameForDependsOn( $path ),
201 201
 					'value' => $value,
202 202
 				];
203
-				if( $this->isFieldHidden( $path, $value )) {
203
+				if( $this->isFieldHidden( $path, $value ) ) {
204 204
 					$isFieldHidden = true;
205 205
 				}
206 206
 			}
207
-			$field['data-depends'] = json_encode( $conditions, JSON_HEX_APOS|JSON_HEX_QUOT );
207
+			$field['data-depends'] = json_encode( $conditions, JSON_HEX_APOS | JSON_HEX_QUOT );
208 208
 			$field['is_hidden'] = $isFieldHidden;
209 209
 		}
210 210
 		return $field;
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	protected function normalizeLabelAndLegend( array $field )
217 217
 	{
218
-		if( !empty( $field['label'] )) {
218
+		if( !empty($field['label']) ) {
219 219
 			$field['legend'] = $field['label'];
220
-			unset( $field['label'] );
220
+			unset($field['label']);
221 221
 		}
222 222
 		else {
223 223
 			$field['is_valid'] = false;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	protected function normalizeValue( array $field )
233 233
 	{
234
-		if( !isset( $field['value'] )) {
234
+		if( !isset($field['value']) ) {
235 235
 			$field['value'] = glsr( OptionManager::class )->get(
236 236
 				$field['name'],
237 237
 				$this->getFieldDefault( $field )
Please login to merge, or discard this patch.