Test Setup Failed
Push — master ( 51607c...6b8ca8 )
by Paul
03:43
created
helpers.php 1 patch
Braces   +16 added lines, -8 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
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
  * get_current_screen() is unreliable because it is not defined on all admin pages
16 17
  * @return \WP_Screen|object
17 18
  */
18
-function glsr_current_screen() {
19
+function glsr_current_screen()
20
+{
19 21
 	if( function_exists( 'get_current_screen' )) {
20 22
 		$screen = get_current_screen();
21 23
 	}
@@ -27,7 +29,8 @@  discard block
 block discarded – undo
27 29
 /**
28 30
  * @return \GeminiLabs\SiteReviews\Database
29 31
  */
30
-function glsr_db() {
32
+function glsr_db()
33
+{
31 34
 	return glsr( 'Database' );
32 35
 }
33 36
 
@@ -35,7 +38,8 @@  discard block
 block discarded – undo
35 38
  * @param mixed ...$vars
36 39
  * @return void
37 40
  */
38
-function glsr_debug( ...$vars ) {
41
+function glsr_debug( ...$vars )
42
+{
39 43
 	if( count( $vars ) == 1 ) {
40 44
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
41 45
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -52,7 +56,8 @@  discard block
 block discarded – undo
52 56
 /**
53 57
  * @return \GeminiLabs\SiteReviews\Modules\Logger
54 58
  */
55
-function glsr_log() {
59
+function glsr_log()
60
+{
56 61
 	$args = func_get_args();
57 62
 	$context = isset( $args[1] )
58 63
 		? $args[1]
@@ -68,7 +73,8 @@  discard block
 block discarded – undo
68 73
  * @return void
69 74
  * @callback register_taxonomy() "meta_box_cb"
70 75
  */
71
-function glsr_categories_meta_box( $post, $box ) {
76
+function glsr_categories_meta_box( $post, $box )
77
+{
72 78
 	glsr( 'Controllers\EditorController' )->renderTaxonomyMetabox( $post, $box );
73 79
 }
74 80
 
@@ -77,14 +83,16 @@  discard block
 block discarded – undo
77 83
  * @param mixed $fallback
78 84
  * @return string|array
79 85
  */
80
-function glsr_get_option( $option_path = '', $fallback = '' ) {
86
+function glsr_get_option( $option_path = '', $fallback = '' )
87
+{
81 88
 	return glsr( 'Database\OptionManager' )->get( 'settings.'.$option_path, $fallback );
82 89
 }
83 90
 
84 91
 /**
85 92
  * @return array
86 93
  */
87
-function glsr_get_options() {
94
+function glsr_get_options()
95
+{
88 96
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
89 97
 }
90 98
 
Please login to merge, or discard this patch.
plugin/Handlers/SubmitReview.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
 	protected function sendNotification( $post_id, Command $command )
114 114
 	{
115 115
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
116
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
116
+		if( !in_array( $notificationType, ['default','custom','webhook'] )) {
117
+			return;
118
+		}
117 119
 		$assignedToTitle = get_the_title( (int) $command->assignedTo );
118 120
 		$notificationSubject = _nx(
119 121
 			'New %s-star review',
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 patch
Braces   +31 added lines, -10 removed lines patch added patch discarded remove patch
@@ -93,7 +93,10 @@  discard block
 block discarded – undo
93 93
 			return true;
94 94
 		}
95 95
 		$recaptchaResponse = filter_input( INPUT_POST, 'g-recaptcha-response' );
96
-		if( empty( $recaptchaResponse ))return; //if response is empty we need to return null
96
+		if( empty( $recaptchaResponse )) {
97
+			return;
98
+		}
99
+		//if response is empty we need to return null
97 100
 		if( $integration == 'custom' ) {
98 101
 			return $this->isRecaptchaValid( $recaptchaResponse );
99 102
 		}
@@ -165,8 +168,12 @@  discard block
 block discarded – undo
165 168
 	 */
166 169
 	protected function validateAkismet()
167 170
 	{
168
-		if( !empty( $this->error ))return;
169
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
171
+		if( !empty( $this->error )) {
172
+			return;
173
+		}
174
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
175
+			return;
176
+		}
170 177
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
171 178
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
172 179
 	}
@@ -176,8 +183,12 @@  discard block
 block discarded – undo
176 183
 	 */
177 184
 	protected function validateBlacklist()
178 185
 	{
179
-		if( !empty( $this->error ))return;
180
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
186
+		if( !empty( $this->error )) {
187
+			return;
188
+		}
189
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
190
+			return;
191
+		}
181 192
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.action' );
182 193
 		if( $blacklistAction == 'unapprove' ) {
183 194
 			$this->request['blacklisted'] = true;
@@ -193,9 +204,13 @@  discard block
 block discarded – undo
193 204
 	 */
194 205
 	protected function validateCustom()
195 206
 	{
196
-		if( !empty( $this->error ))return;
207
+		if( !empty( $this->error )) {
208
+			return;
209
+		}
197 210
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
198
-		if( $validated === true )return;
211
+		if( $validated === true ) {
212
+			return;
213
+		}
199 214
 		$this->setSessionValues( 'errors', [] );
200 215
 		$this->setSessionValues( 'values', $this->request );
201 216
 		$this->error = is_string( $validated )
@@ -208,8 +223,12 @@  discard block
 block discarded – undo
208 223
 	 */
209 224
 	protected function validateHoneyPot( array $request )
210 225
 	{
211
-		if( !empty( $this->error ))return;
212
-		if( empty( $request['gotcha'] ))return;
226
+		if( !empty( $this->error )) {
227
+			return;
228
+		}
229
+		if( empty( $request['gotcha'] )) {
230
+			return;
231
+		}
213 232
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
214 233
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
215 234
 	}
@@ -219,7 +238,9 @@  discard block
 block discarded – undo
219 238
 	 */
220 239
 	protected function validateRecaptcha( array $request )
221 240
 	{
222
-		if( !empty( $this->error ))return;
241
+		if( !empty( $this->error )) {
242
+			return;
243
+		}
223 244
 		$isValid = $this->isRecaptchaResponseValid();
224 245
 		if( is_null( $isValid )) {
225 246
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.
plugin/Modules/Email.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function send()
66 66
 	{
67
-		if( !$this->message || !$this->subject || !$this->to )return;
67
+		if( !$this->message || !$this->subject || !$this->to ) {
68
+			return;
69
+		}
68 70
 		$sent = wp_mail(
69 71
 			$this->to,
70 72
 			$this->subject,
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 	 */
84 86
 	public function buildPlainTextMessage( $phpmailer )
85 87
 	{
86
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
88
+		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) {
89
+			return;
90
+		}
87 91
 		$message = $this->stripHtmlTags( $phpmailer->Body );
88 92
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
89 93
 	}
Please login to merge, or discard this patch.
plugin/Modules/Upgrade.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 		natsort( $routines );
17 17
 		array_walk( $routines, function( $routine ) {
18 18
 			$version = str_replace( strtolower( __CLASS__ ).'_', '', $routine );
19
-			if( version_compare( glsr()->version, $version, '>=' ))return;
19
+			if( version_compare( glsr()->version, $version, '>=' )) {
20
+				return;
21
+			}
20 22
 			call_user_func( [$this, $routine] );
21 23
 		});
22 24
 		$this->updateVersion();
@@ -37,5 +39,6 @@  discard block
 block discarded – undo
37 39
 	}
38 40
 
39 41
 	protected function upgrade_3_0_0()
40
-	{}
42
+	{
43
+}
41 44
 }
Please login to merge, or discard this patch.
plugin/Database/Cache.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 			$ipAddresses = array_fill_keys( ['v4', 'v6'], [] );
18 18
 			foreach( array_keys( $ipAddresses ) as $version ) {
19 19
 				$response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version );
20
-				if( is_wp_error( $response ))continue;
20
+				if( is_wp_error( $response )) {
21
+					continue;
22
+				}
21 23
 				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response )));
22 24
 			}
23 25
 			wp_cache_set( Application::ID, $ipAddresses, '_cloudflare_ips' );
Please login to merge, or discard this patch.