Passed
Push — master ( 92d1bc...99b252 )
by Paul
04:41
created
plugin/Handlers/CreateReview.php 1 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.
plugin/Modules/Validator/ValidateReview.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -193,8 +193,12 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function validateAkismet()
195 195
 	{
196
-		if( !empty( $this->error ))return;
197
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
196
+		if( !empty( $this->error )) {
197
+			return;
198
+		}
199
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
200
+			return;
201
+		}
198 202
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
199 203
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
200 204
 	}
@@ -204,8 +208,12 @@  discard block
 block discarded – undo
204 208
 	 */
205 209
 	protected function validateBlacklist()
206 210
 	{
207
-		if( !empty( $this->error ))return;
208
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
211
+		if( !empty( $this->error )) {
212
+			return;
213
+		}
214
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
215
+			return;
216
+		}
209 217
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
210 218
 		if( $blacklistAction == 'reject' ) {
211 219
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -220,9 +228,13 @@  discard block
 block discarded – undo
220 228
 	 */
221 229
 	protected function validateCustom()
222 230
 	{
223
-		if( !empty( $this->error ))return;
231
+		if( !empty( $this->error )) {
232
+			return;
233
+		}
224 234
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
225
-		if( $validated === true )return;
235
+		if( $validated === true ) {
236
+			return;
237
+		}
226 238
 		$this->setSessionValues( 'errors', [] );
227 239
 		$this->setSessionValues( 'values', $this->request );
228 240
 		$this->error = is_string( $validated )
@@ -235,8 +247,12 @@  discard block
 block discarded – undo
235 247
 	 */
236 248
 	protected function validateHoneyPot()
237 249
 	{
238
-		if( !empty( $this->error ))return;
239
-		if( empty( $this->request['gotcha'] ))return;
250
+		if( !empty( $this->error )) {
251
+			return;
252
+		}
253
+		if( empty( $this->request['gotcha'] )) {
254
+			return;
255
+		}
240 256
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
241 257
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
242 258
 	}
@@ -246,7 +262,9 @@  discard block
 block discarded – undo
246 262
 	 */
247 263
 	protected function validateRecaptcha()
248 264
 	{
249
-		if( !empty( $this->error ))return;
265
+		if( !empty( $this->error )) {
266
+			return;
267
+		}
250 268
 		$isValid = $this->isRecaptchaResponseValid();
251 269
 		if( is_null( $isValid )) {
252 270
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.
plugin/Controllers/TaxonomyController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		glsr( Html::class )->render()->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderFilters( $postType )
88 88
 	{
89
-		if( $postType !== Application::POST_TYPE )return;
89
+		if( $postType !== Application::POST_TYPE ) {
90
+			return;
91
+		}
90 92
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
91 93
 			$status = 'publish';
92 94
 		}
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public function renderValues( $column, $postId )
105 107
 	{
106
-		if( glsr_current_screen()->post_type != Application::POST_TYPE )return;
108
+		if( glsr_current_screen()->post_type != Application::POST_TYPE ) {
109
+			return;
110
+		}
107 111
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
108 112
 		echo method_exists( $this, $method )
109 113
 			? call_user_func( [$this, $method], $postId )
@@ -116,7 +120,9 @@  discard block
 block discarded – undo
116 120
 	 */
117 121
 	protected function renderFilterRatings( $ratings )
118 122
 	{
119
-		if( empty( $ratings ))return;
123
+		if( empty( $ratings )) {
124
+			return;
125
+		}
120 126
 		$ratings = array_flip( array_reverse( $ratings ));
121 127
 		array_walk( $ratings, function( &$value, $key ) {
122 128
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -139,7 +145,9 @@  discard block
 block discarded – undo
139 145
 	 */
140 146
 	protected function renderFilterTypes( $types )
141 147
 	{
142
-		if( count( glsr()->reviewTypes ) < 2 )return;
148
+		if( count( glsr()->reviewTypes ) < 2 ) {
149
+			return;
150
+		}
143 151
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
144 152
 			'class' => 'screen-reader-text',
145 153
 			'for' => 'review_type',
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Labels.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@
 block discarded – undo
48 48
 	public function filterUpdateMessages( array $messages )
49 49
 	{
50 50
 		$post = get_post();
51
-		if( !( $post instanceof WP_Post ))return;
51
+		if( !( $post instanceof WP_Post )) {
52
+			return;
53
+		}
52 54
 		$strings = $this->getReviewLabels();
53 55
 		$restored = filter_input( INPUT_GET, 'revision' );
54 56
 		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) {
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function onCreateReview( $postData, $meta, $postId )
24 24
 	{
25
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
25
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
26
+			return;
27
+		}
26 28
 		$this->updateAssignedToPost( $review );
27 29
 	}
28 30
 
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 	 */
33 35
 	public function onDeleteReview( $postId )
34 36
 	{
35
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
37
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
38
+			return;
39
+		}
36 40
 		$review->post_status = 'deleted'; // important to change the post_status here first!
37 41
 		$this->updateAssignedToPost( $review );
38 42
 	}
@@ -52,7 +56,9 @@  discard block
 block discarded – undo
52 56
 	 */
53 57
 	public function saveAssignedToMetabox( $postId )
54 58
 	{
55
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
59
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
60
+			return;
61
+		}
56 62
 		$assignedTo = glsr( Helper::class )->filterInput( 'assigned_to' );
57 63
 		$assignedTo || $assignedTo = '';
58 64
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -67,7 +73,9 @@  discard block
 block discarded – undo
67 73
 	 */
68 74
 	public function saveResponseMetabox( $postId )
69 75
 	{
70
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
76
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
77
+			return;
78
+		}
71 79
 		$response = glsr( Helper::class )->filterInput( 'response' );
72 80
 		$response || $response = '';
73 81
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
@@ -120,9 +128,13 @@  discard block
 block discarded – undo
120 128
 	 */
121 129
 	protected function updateAssignedToPost( WP_Post $review )
122 130
 	{
123
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
131
+		if( !( $postId = $this->getAssignedToPostId( $review->ID ))) {
132
+			return;
133
+		}
124 134
 		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
125
-		if( empty( $reviewIds ))return;
135
+		if( empty( $reviewIds )) {
136
+			return;
137
+		}
126 138
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
127 139
 		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
128 140
 		if( empty( $updatedReviewIds )) {
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function renderReviewEditor( WP_Post $post )
109 109
 	{
110
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
110
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
111
+			return;
112
+		}
111 113
 		glsr()->render( 'partials/editor/review', [
112 114
 			'post' => $post,
113 115
 		]);
@@ -119,7 +121,9 @@  discard block
 block discarded – undo
119 121
 	 */
120 122
 	public function renderReviewNotice( WP_Post $post )
121 123
 	{
122
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
124
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
125
+			return;
126
+		}
123 127
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
124 128
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
125 129
 			'context' => [
@@ -134,13 +138,19 @@  discard block
 block discarded – undo
134 138
 	 */
135 139
 	public function renderTinymceButton()
136 140
 	{
137
-		if( glsr_current_screen()->base != 'post' )return;
141
+		if( glsr_current_screen()->base != 'post' ) {
142
+			return;
143
+		}
138 144
 		$shortcodes = [];
139 145
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
140
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
146
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
147
+				continue;
148
+			}
141 149
 			$shortcodes[$shortcode] = $values;
142 150
 		}
143
-		if( empty( $shortcodes ))return;
151
+		if( empty( $shortcodes )) {
152
+			return;
153
+		}
144 154
 		glsr()->render( 'partials/editor/tinymce', [
145 155
 			'shortcodes' => $shortcodes,
146 156
 		]);
Please login to merge, or discard this patch.
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.