Passed
Push — master ( 042452...c272a3 )
by Paul
05:20
created
plugin/Handlers/EnqueuePublicAssets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function enqueueAssets()
25 25
 	{
26
-		if( apply_filters( 'site-reviews/assets/css', true )) {
26
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
27 27
 			wp_enqueue_style(
28 28
 				Application::ID,
29 29
 				$this->getStylesheet(),
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 				glsr()->version
32 32
 			);
33 33
 		}
34
-		if( apply_filters( 'site-reviews/assets/js', true )) {
34
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
35 35
 			$dependencies = apply_filters( 'site-reviews/enqueue/public/dependencies', [] );
36 36
 			wp_enqueue_script(
37 37
 				Application::ID,
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return;
52 52
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
53
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
53
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
54 54
 			'hl' => $language,
55 55
 			'onload' => 'glsr_render_recaptcha',
56 56
 			'render' => 'explicit',
57
-		], 'https://www.google.com/recaptcha/api.js' ));
58
-		$inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ));
57
+		], 'https://www.google.com/recaptcha/api.js' ) );
58
+		$inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ) );
59 59
 		wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' );
60 60
 	}
61 61
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$variables = [
68 68
 			'action' => Application::PREFIX.'action',
69 69
 			'ajaxnonce' => wp_create_nonce( Application::ID.'-ajax-nonce' ),
70
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
70
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
71 71
 			'ajaxurl' => admin_url( 'admin-ajax.php' ),
72 72
 		];
73 73
 		$variables = apply_filters( 'site-reviews/enqueue/public/localize', $variables );
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	protected function getStylesheet()
81 81
 	{
82
-		$currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ));
83
-		return file_exists( glsr()->path( 'assets/styles/themes/'.$currentTheme.'.css' ))
82
+		$currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ) );
83
+		return file_exists( glsr()->path( 'assets/styles/themes/'.$currentTheme.'.css' ) )
84 84
 			? glsr()->url( 'assets/styles/themes/'.$currentTheme.'.css' )
85 85
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
86 86
 	}
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 		if( $this->command->author ) {
83 83
 			$fields[] = ['value' => trim( $this->command->author.$this->command->email.' - '.$this->command->ip_address )];
84 84
 		}
85
-		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ))];
86
-		return json_encode([
85
+		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ) )];
86
+		return json_encode( [
87 87
 			'icon_url' => glsr()->url( 'assets/img/icon.png' ),
88 88
 			'username' => glsr()->name,
89 89
 			'attachments' => [[
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'fallback' => $this->createEmailNotification( $args )->read( 'plaintext' ),
93 93
 				'fields' => $fields,
94 94
 			]],
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	protected function sendNotification( $postId )
103 103
 	{
104 104
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
105
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
105
+		if( !in_array( $notificationType, ['default', 'custom', 'webhook'] ) )return;
106 106
 		$assignedToTitle = get_the_title( (int)$this->command->assigned_to );
107 107
 		$notificationSubject = _nx(
108 108
 			'New %s-star review',
109 109
 			'New %s-star review of: %s',
110
-			intval( empty( $assignedToTitle )),
110
+			intval( empty($assignedToTitle) ),
111 111
 			'The text is different depending on whether or not the review has been assigned to a post.',
112 112
 			'site-reviews'
113 113
 		);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			sprintf( $notificationSubject, $this->command->rating, $assignedToTitle )
117 117
 		);
118 118
 		$args = [
119
-			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $postId ))),
119
+			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $postId ) ) ),
120 120
 			'notification_title' => $notificationTitle,
121 121
 			'notification_type' => $notificationType,
122 122
 		];
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 		$args['recipient'] = $args['notification_type'] !== 'default'
135 135
 			? glsr( OptionManager::class )->get( 'settings.general.notification_email' )
136 136
 			: get_option( 'admin_email' );
137
-		$result = !empty( $args['recipient'] )
137
+		$result = !empty($args['recipient'])
138 138
 			? $this->createEmailNotification( $args )->send()
139 139
 			: false;
140
-		if( !is_bool( $result )) {
141
-			glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' ));
140
+		if( !is_bool( $result ) ) {
141
+			glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' ) );
142 142
 		}
143 143
 		if( $result === false ) {
144
-			glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ));
144
+			glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ) );
145 145
 		}
146 146
 	}
147 147
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	protected function sendWebhookNotification( array $args )
152 152
 	{
153
-		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return;
153
+		if( !($endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )) )return;
154 154
 		$notification = $this->createWebhookNotification( $args );
155 155
 		$result = wp_remote_post( $endpoint, [
156 156
 			'blocking' => false,
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 			'redirection' => 5,
162 162
 			'sslverify' => false,
163 163
 			'timeout' => 45,
164
-		]);
165
-		if( is_wp_error( $result )) {
164
+		] );
165
+		if( is_wp_error( $result ) ) {
166 166
 			glsr_log()->error( $result->get_error_message() );
167 167
 		}
168 168
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@  discard block
 block discarded – undo
102 102
 	protected function sendNotification( $postId )
103 103
 	{
104 104
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
105
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
105
+		if( !in_array( $notificationType, ['default','custom','webhook'] )) {
106
+			return;
107
+		}
106 108
 		$assignedToTitle = get_the_title( (int)$this->command->assigned_to );
107 109
 		$notificationSubject = _nx(
108 110
 			'New %s-star review',
@@ -150,7 +152,9 @@  discard block
 block discarded – undo
150 152
 	 */
151 153
 	protected function sendWebhookNotification( array $args )
152 154
 	{
153
-		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return;
155
+		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) {
156
+			return;
157
+		}
154 158
 		$notification = $this->createWebhookNotification( $args );
155 159
 		$result = wp_remote_post( $endpoint, [
156 160
 			'blocking' => false,
Please login to merge, or discard this patch.