Passed
Push — master ( a42385...9b46a7 )
by Paul
04:14
created
plugin/Controllers/EditorController/Metaboxes.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function saveAssignedToMetabox( $postId )
15 15
 	{
16
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
17
-		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
16
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return;
17
+		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) );
18 18
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
19
-			$review = glsr( ReviewManager::class )->single( get_post( $postId ));
19
+			$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
20 20
 			glsr( CountsManager::class )->decreasePostCounts( $review );
21 21
 		}
22 22
 		update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function saveResponseMetabox( $postId )
30 30
 	{
31
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
32
-		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
31
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return;
32
+		$response = strval( glsr( Helper::class )->filterInput( 'response' ) );
33 33
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
34 34
 			'a' => ['href' => [], 'title' => []],
35 35
 			'em' => [],
36 36
 			'strong' => [],
37
-		])));
37
+		] ) ) );
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public function saveAssignedToMetabox( $postId )
15 15
 	{
16
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
16
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
17
+			return;
18
+		}
17 19
 		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
18 20
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
19 21
 			$review = glsr( ReviewManager::class )->single( get_post( $postId ));
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 	 */
29 31
 	public function saveResponseMetabox( $postId )
30 32
 	{
31
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
33
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
34
+			return;
35
+		}
32 36
 		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
33 37
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
34 38
 			'a' => ['href' => [], 'title' => []],
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		sort( $termIds );
27 27
 		sort( $oldTermIds );
28
-		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return;
29
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
28
+		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ) )return;
29
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
30 30
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
31
-		if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) {
31
+		if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms ) ) {
32 32
 			glsr( CountsManager::class )->decreaseTermCounts( $review );
33 33
 		}
34
-		if( $review->term_ids = array_diff( $termIds, $ignoredTerms )) {
34
+		if( $review->term_ids = array_diff( $termIds, $ignoredTerms ) ) {
35 35
 			glsr( CountsManager::class )->increaseTermCounts( $review );
36 36
 		}
37 37
 	}
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function onAfterCreate( $postData, $meta, $postId )
47 47
 	{
48
-		if( !$this->isReviewPostId( $postId ))return;
49
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
48
+		if( !$this->isReviewPostId( $postId ) )return;
49
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
50 50
 		glsr( CountsManager::class )->increase( $review );
51 51
 	}
52 52
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function onBeforeDelete( $postId )
59 59
 	{
60
-		if( !$this->isReviewPostId( $postId ))return;
61
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
60
+		if( !$this->isReviewPostId( $postId ) )return;
61
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
62 62
 		glsr( CountsManager::class )->decrease( $review );
63 63
 	}
64 64
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		if( !$this->isReviewPostId( $postId )
76 76
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
77 77
 		)return;
78
-		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
78
+		$review = glsr( ReviewManager::class )->single( get_post( $postId ) );
79 79
 		if( $review->$metaKey == $metaValue )return;
80 80
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
81 81
 		call_user_func( [$this, $method], $review, $metaValue );
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
124 124
 	{
125
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
126
-		$review = glsr( ReviewManager::class )->single( get_post( $post->ID ));
125
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ) )return;
126
+		$review = glsr( ReviewManager::class )->single( get_post( $post->ID ) );
127 127
 		if( $post->post_status == 'publish' ) {
128 128
 			glsr( CountsManager::class )->increase( $review );
129 129
 		}
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		sort( $termIds );
27 27
 		sort( $oldTermIds );
28
-		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return;
28
+		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId )) {
29
+			return;
30
+		}
29 31
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
30 32
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
31 33
 		if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) {
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
 	 */
46 48
 	public function onAfterCreate( $postData, $meta, $postId )
47 49
 	{
48
-		if( !$this->isReviewPostId( $postId ))return;
50
+		if( !$this->isReviewPostId( $postId )) {
51
+			return;
52
+		}
49 53
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
50 54
 		glsr( CountsManager::class )->increase( $review );
51 55
 	}
@@ -57,7 +61,9 @@  discard block
 block discarded – undo
57 61
 	 */
58 62
 	public function onBeforeDelete( $postId )
59 63
 	{
60
-		if( !$this->isReviewPostId( $postId ))return;
64
+		if( !$this->isReviewPostId( $postId )) {
65
+			return;
66
+		}
61 67
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
62 68
 		glsr( CountsManager::class )->decrease( $review );
63 69
 	}
@@ -74,9 +80,13 @@  discard block
 block discarded – undo
74 80
 	{
75 81
 		if( !$this->isReviewPostId( $postId )
76 82
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
77
-		)return;
83
+		) {
84
+			return;
85
+		}
78 86
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
79
-		if( $review->$metaKey == $metaValue )return;
87
+		if( $review->$metaKey == $metaValue ) {
88
+			return;
89
+		}
80 90
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
81 91
 		call_user_func( [$this, $method], $review, $metaValue );
82 92
 	}
@@ -122,7 +132,9 @@  discard block
 block discarded – undo
122 132
 	 */
123 133
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
124 134
 	{
125
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
135
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) {
136
+			return;
137
+		}
126 138
 		$review = glsr( ReviewManager::class )->single( get_post( $post->ID ));
127 139
 		if( $post->post_status == 'publish' ) {
128 140
 			glsr( CountsManager::class )->increase( $review );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/StarRating.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function build( array $args = [] )
14 14
 	{
15
-		require_once( ABSPATH.'wp-admin/includes/template.php' );
15
+		require_once(ABSPATH.'wp-admin/includes/template.php');
16 16
 		ob_start();
17 17
 		wp_star_rating( $args );
18 18
 		$stars = ob_get_clean();
19 19
 		return glsr( Builder::class )->div( $stars, [
20 20
 			'class' => 'glsr-stars',
21
-		]);
21
+		] );
22 22
 	}
23 23
 }
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,9 @@  discard block
 block discarded – undo
93 93
 		foreach( $this->rules as $attribute => $rules ) {
94 94
 			foreach( $rules as $rule ) {
95 95
 				$this->validateAttribute( $attribute, $rule );
96
-				if( $this->shouldStopValidating( $attribute ))break;
96
+				if( $this->shouldStopValidating( $attribute )) {
97
+					break;
98
+				}
97 99
 			}
98 100
 		}
99 101
 		return $this->errors;
@@ -109,7 +111,9 @@  discard block
 block discarded – undo
109 111
 	public function validateAttribute( $attribute, $rule )
110 112
 	{
111 113
 		list( $rule, $parameters ) = $this->parseRule( $rule );
112
-		if( $rule == '' )return;
114
+		if( $rule == '' ) {
115
+			return;
116
+		}
113 117
 		$value = $this->getValue( $attribute );
114 118
 		if( !method_exists( $this, $method = 'validate'.$rule )) {
115 119
 			throw new BadMethodCallException( "Method [$method] does not exist." );
@@ -178,7 +182,9 @@  discard block
 block discarded – undo
178 182
 	 */
179 183
 	protected function getRule( $attribute, $rules )
180 184
 	{
181
-		if( !array_key_exists( $attribute, $this->rules ))return;
185
+		if( !array_key_exists( $attribute, $this->rules )) {
186
+			return;
187
+		}
182 188
 		$rules = (array)$rules;
183 189
 		foreach( $this->rules[$attribute] as $rule ) {
184 190
 			list( $rule, $parameters ) = $this->parseRule( $rule );
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		foreach( $this->rules as $attribute => $rules ) {
75 75
 			foreach( $rules as $rule ) {
76 76
 				$this->validateAttribute( $attribute, $rule );
77
-				if( $this->shouldStopValidating( $attribute ))break;
77
+				if( $this->shouldStopValidating( $attribute ) )break;
78 78
 			}
79 79
 		}
80 80
 		return $this->errors;
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function validateAttribute( $attribute, $rule )
91 91
 	{
92
-		list( $rule, $parameters ) = $this->parseRule( $rule );
92
+		list($rule, $parameters) = $this->parseRule( $rule );
93 93
 		if( $rule == '' )return;
94 94
 		$value = $this->getValue( $attribute );
95
-		if( !method_exists( $this, $method = 'validate'.$rule )) {
95
+		if( !method_exists( $this, $method = 'validate'.$rule ) ) {
96 96
 			throw new BadMethodCallException( "Method [$method] does not exist." );
97 97
 		}
98
-		if( !$this->$method( $value, $attribute, $parameters )) {
98
+		if( !$this->$method( $value, $attribute, $parameters ) ) {
99 99
 			$this->addFailure( $attribute, $rule, $parameters );
100 100
 		}
101 101
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function getMessage( $attribute, $rule, array $parameters )
146 146
 	{
147
-		if( in_array( $rule, $this->sizeRules )) {
147
+		if( in_array( $rule, $this->sizeRules ) ) {
148 148
 			return $this->getSizeMessage( $attribute, $rule, $parameters );
149 149
 		}
150 150
 		$lowerRule = glsr( Helper::class )->snakeCase( $rule );
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	protected function getRule( $attribute, $rules )
161 161
 	{
162
-		if( !array_key_exists( $attribute, $this->rules ))return;
162
+		if( !array_key_exists( $attribute, $this->rules ) )return;
163 163
 		$rules = (array)$rules;
164 164
 		foreach( $this->rules[$attribute] as $rule ) {
165
-			list( $rule, $parameters ) = $this->parseRule( $rule );
166
-			if( in_array( $rule, $rules )) {
165
+			list($rule, $parameters) = $this->parseRule( $rule );
166
+			if( in_array( $rule, $rules ) ) {
167 167
 				return [$rule, $parameters];
168 168
 			}
169 169
 		}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		if( is_numeric( $value ) && $hasNumeric ) {
182 182
 			return $value;
183 183
 		}
184
-		elseif( is_array( $value )) {
184
+		elseif( is_array( $value ) ) {
185 185
 			return count( $value );
186 186
 		}
187 187
 		return mb_strlen( $value );
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function getValue( $attribute )
209 209
 	{
210
-		if( isset( $this->data[$attribute] )) {
210
+		if( isset($this->data[$attribute]) ) {
211 211
 			return $this->data[$attribute];
212 212
 		}
213 213
 	}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function hasRule( $attribute, $rules )
222 222
 	{
223
-		return !is_null( $this->getRule( $attribute, $rules ));
223
+		return !is_null( $this->getRule( $attribute, $rules ) );
224 224
 	}
225 225
 
226 226
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	{
259 259
 		$parameters = [];
260 260
 		if( strpos( $rule, ':' ) !== false ) {
261
-			list( $rule, $parameter ) = explode( ':', $rule, 2 );
261
+			list($rule, $parameter) = explode( ':', $rule, 2 );
262 262
 			$parameters = $this->parseParameters( $rule, $parameter );
263 263
 		}
264 264
 		$rule = glsr( Helper::class )->camelCase( $rule );
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	protected function shouldStopValidating( $attribute )
288 288
 	{
289 289
 		return $this->hasRule( $attribute, $this->implicitRules )
290
-			&& isset( $this->failedRules[$attribute] )
290
+			&& isset($this->failedRules[$attribute])
291 291
 			&& array_intersect( array_keys( $this->failedRules[$attribute] ), $this->implicitRules );
292 292
 	}
293 293
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	protected function translator( $key, array $parameters )
301 301
 	{
302 302
 		$strings = glsr( ValidationStringsDefaults::class )->defaults();
303
-		if( isset( $strings[$key] )) {
303
+		if( isset($strings[$key]) ) {
304 304
 			return $this->replace( $strings[$key], $parameters );
305 305
 		}
306 306
 		return "error";
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidationRules.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		if( strpos( $message, '%s' ) === false ) {
29 29
 			return $message;
30 30
 		}
31
-		return preg_replace_callback( '/(%s)/', function() use( &$parameters ) {
31
+		return preg_replace_callback( '/(%s)/', function() use(&$parameters) {
32 32
 			foreach( $parameters as $key => $value ) {
33 33
 				return array_shift( $parameters );
34 34
 			}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	public function validateRequired( $value )
114 114
 	{
115 115
 		return is_null( $value )
116
-			|| ( is_string( $value ) && trim( $value ) === '' )
117
-			|| ( is_array( $value ) && count( $value ) < 1 )
116
+			|| (is_string( $value ) && trim( $value ) === '')
117
+			|| (is_array( $value ) && count( $value ) < 1)
118 118
 			? false
119 119
 			: true;
120 120
 	}
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true )) {
59
+			return;
60
+		}
59 61
 		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
60 62
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event',
61 63
 			'flags' => 'gated',
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
 		// wpforms-recaptcha
71 73
 		// google-recaptcha
72 74
 		// nf-google-recaptcha
73
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
75
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
76
+			return;
77
+		}
74 78
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75 79
 		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
76 80
 			'hl' => $language,
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 	public function inlineStyles()
85 89
 	{
86 90
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
91
+		if( !apply_filters( 'site-reviews/assets/css', true )) {
92
+			return;
93
+		}
88 94
 		if( !file_exists( $inlineStylesheetPath )) {
89 95
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 96
 			return;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function enqueueAssets()
29 29
 	{
30
-		if( apply_filters( 'site-reviews/assets/css', true )) {
30
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
31 31
 			wp_enqueue_style(
32 32
 				Application::ID,
33 33
 				$this->getStylesheet(),
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 				glsr()->version
36 36
 			);
37 37
 		}
38
-		if( apply_filters( 'site-reviews/assets/js', true )) {
38
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
39 39
 			$dependencies = apply_filters( 'site-reviews/assets/polyfill', true )
40 40
 				? [Application::ID.'/polyfill']
41 41
 				: [];
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
59
-		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return;
59
+		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [
60 60
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event',
61 61
 			'flags' => 'gated',
62
-		], 'https://cdn.polyfill.io/v2/polyfill.js' ));
62
+		], 'https://cdn.polyfill.io/v2/polyfill.js' ) );
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 		// nf-google-recaptcha
73 73
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
74 74
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
75
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
76 76
 			'hl' => $language,
77 77
 			'render' => 'explicit',
78
-		], 'https://www.google.com/recaptcha/api.js' ));
78
+		], 'https://www.google.com/recaptcha/api.js' ) );
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	public function inlineStyles()
85 85
 	{
86 86
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
88
-		if( !file_exists( $inlineStylesheetPath )) {
87
+		if( !apply_filters( 'site-reviews/assets/css', true ) )return;
88
+		if( !file_exists( $inlineStylesheetPath ) ) {
89 89
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 90
 			return;
91 91
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function getFixedSelectorsForPagination()
122 122
 	{
123
-		$selectors = ['#wpadminbar','.site-navigation-fixed'];
123
+		$selectors = ['#wpadminbar', '.site-navigation-fixed'];
124 124
 		return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors );
125 125
 	}
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	protected function getStylesheet()
131 131
 	{
132 132
 		$currentStyle = glsr( Style::class )->style;
133
-		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ))
133
+		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) )
134 134
 			? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' )
135 135
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
136 136
 	}
Please login to merge, or discard this patch.
plugin/Router.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request )) {
21
+			return;
22
+		}
21 23
 		check_admin_referer( $request['action'] );
22 24
 		$this->routeRequest( 'admin', $request['action'], $request );
23 25
 	}
@@ -39,10 +41,16 @@  discard block
 block discarded – undo
39 41
 	 */
40 42
 	public function routePublicPostRequest()
41 43
 	{
42
-		if( is_admin() )return;
44
+		if( is_admin() ) {
45
+			return;
46
+		}
43 47
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
48
+		if( !$this->isValidPostRequest( $request )) {
49
+			return;
50
+		}
51
+		if( !$this->isValidPublicNonce( $request )) {
52
+			return;
53
+		}
46 54
 		$this->routeRequest( 'public', $request['action'], $request );
47 55
 	}
48 56
 
@@ -51,7 +59,9 @@  discard block
 block discarded – undo
51 59
 	 */
52 60
 	protected function checkAjaxNonce( array $request )
53 61
 	{
54
-		if( !is_user_logged_in() )return;
62
+		if( !is_user_logged_in() ) {
63
+			return;
64
+		}
55 65
 		if( !isset( $request['nonce'] )) {
56 66
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 67
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request ) )return;
21 21
 		check_admin_referer( $request['action'] );
22 22
 		$this->routeRequest( 'admin', $request['action'], $request );
23 23
 	}
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		if( is_admin() )return;
43 43
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
44
+		if( !$this->isValidPostRequest( $request ) )return;
45
+		if( !$this->isValidPublicNonce( $request ) )return;
46 46
 		$this->routeRequest( 'public', $request['action'], $request );
47 47
 	}
48 48
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	protected function checkAjaxNonce( array $request )
53 53
 	{
54 54
 		if( !is_user_logged_in() )return;
55
-		if( !isset( $request['nonce'] )) {
55
+		if( !isset($request['nonce']) ) {
56 56
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 57
 		}
58
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
58
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
59 59
 			$this->sendAjaxError( 'request failed the nonce check', $request, 403 );
60 60
 		}
61 61
 	}
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function checkAjaxRequest( array $request )
67 67
 	{
68
-		if( !isset( $request['action'] )) {
68
+		if( !isset($request['action']) ) {
69 69
 			$this->sendAjaxError( 'request must include an action', $request );
70 70
 		}
71
-		if( empty( $request['ajax_request'] )) {
71
+		if( empty($request['ajax_request']) ) {
72 72
 			$this->sendAjaxError( 'request is invalid', $request );
73 73
 		}
74 74
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function isValidPostRequest( array $request = [] )
97 97
 	{
98
-		return !empty( $request['action'] ) && empty( $request['ajax_request'] );
98
+		return !empty($request['action']) && empty($request['ajax_request']);
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function isValidPublicNonce( array $request )
105 105
 	{
106
-		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) {
106
+		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
107 107
 			glsr_log()->error( 'nonce check failed for public request' )->debug( $request );
108 108
 			return false;
109 109
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	protected function routeRequest( $type, $action, array $request = [] )
119 119
 	{
120 120
 		$actionHook = 'site-reviews/route/'.$type.'/request';
121
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
121
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
122 122
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
123 123
 		$request = apply_filters( 'site-reviews/route/request', $request, $action, $type );
124 124
 		do_action( $actionHook, $action, $request );
125
-		if( is_callable( [$controller, $method] )) {
125
+		if( is_callable( [$controller, $method] ) ) {
126 126
 			call_user_func( [$controller, $method], $request );
127 127
 			return;
128 128
 		}
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		glsr_log()->error( $error )->debug( $request );
142 142
 		glsr_log( $_POST );
143 143
 		glsr( Notice::class )->addError( __( 'There was an error (try refreshing the page).', 'site-reviews' ).' <code>'.$error.'</code>' );
144
-		wp_send_json_error([
144
+		wp_send_json_error( [
145 145
 			'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ),
146 146
 			'notices' => glsr( Notice::class )->get(),
147 147
 			'error' => $error,
148
-		]);
148
+		] );
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
plugin/Modules/Slack.php 2 patches
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 compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint ))return;
38
+		if( empty( $this->endpoint )) {
39
+			return;
40
+		}
39 41
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
40 42
 		$this->review = $review;
41 43
 		$notification = [
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint ))return;
38
+		if( empty($this->endpoint) )return;
39 39
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
40 40
 		$this->review = $review;
41 41
 		$notification = [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function send()
60 60
 	{
61
-		if( empty( $this->endpoint )) {
61
+		if( empty($this->endpoint) ) {
62 62
 			return new WP_Error( 'slack', 'Slack notification was not sent: missing endpoint' );
63 63
 		}
64 64
 		return wp_remote_post( $this->endpoint, [
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			'redirection' => 5,
71 71
 			'sslverify' => false,
72 72
 			'timeout' => 45,
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected function buildAuthorField()
92 92
 	{
93
-		$email = !empty( $this->review->email )
93
+		$email = !empty($this->review->email)
94 94
 			? '<'.$this->review->email.'>'
95 95
 			: '';
96 96
 		$author = trim( rtrim( $this->review->author ).' '.$email );
97
-		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ))];
97
+		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ) )];
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	protected function buildContentField()
104 104
 	{
105
-		return !empty( $this->review->content )
105
+		return !empty($this->review->content)
106 106
 			? ['value' => $this->review->content]
107 107
 			: [];
108 108
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	protected function buildStarsField()
128 128
 	{
129 129
 		$solidStars = str_repeat( '★', $this->review->rating );
130
-		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ));
130
+		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ) );
131 131
 		$stars = $solidStars.$emptyStars;
132 132
 		$stars = apply_filters( 'site-reviews/slack/stars', $stars, $this->review->rating, Rating::MAX_RATING );
133 133
 		return ['title' => $stars];
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function buildTitleField()
140 140
 	{
141
-		return !empty( $this->review->title )
141
+		return !empty($this->review->title)
142 142
 			? ['title' => $this->review->title]
143 143
 			: [];
144 144
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	protected function buildRecaptcha()
87 87
 	{
88
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
88
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
89
+			return;
90
+		}
89 91
 		return glsr( Builder::class )->div([
90 92
 			'class' => 'glsr-recaptcha-holder',
91 93
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
@@ -161,7 +163,9 @@  discard block
 block discarded – undo
161 163
 	 */
162 164
 	protected function getRegisterText()
163 165
 	{
164
-		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
166
+		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' ) {
167
+			return;
168
+		}
165 169
 		$registerLink = glsr( Builder::class )->a([
166 170
 			'href' => wp_registration_url(),
167 171
 			'text' => __( 'register', 'site-reviews' ),
@@ -217,7 +221,9 @@  discard block
 block discarded – undo
217 221
 	 */
218 222
 	protected function normalizeFieldErrors( Field &$field )
219 223
 	{
220
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
224
+		if( !array_key_exists( $field->field['path'], $this->errors )) {
225
+			return;
226
+		}
221 227
 		$field->field['errors'] = $this->errors[$field->field['path']];
222 228
 	}
223 229
 
@@ -226,7 +232,9 @@  discard block
 block discarded – undo
226 232
 	 */
227 233
 	protected function normalizeFieldRequired( Field &$field )
228 234
 	{
229
-		if( !in_array( $field->field['path'], $this->required ))return;
235
+		if( !in_array( $field->field['path'], $this->required )) {
236
+			return;
237
+		}
230 238
 		$field->field['required'] = true;
231 239
 	}
232 240
 
@@ -249,7 +257,9 @@  discard block
 block discarded – undo
249 257
 	 */
250 258
 	protected function normalizeFieldValue( Field &$field )
251 259
 	{
252
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
260
+		if( !array_key_exists( $field->field['path'], $this->values )) {
261
+			return;
262
+		}
253 263
 		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
254 264
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
255 265
 		}
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				'response' => $this->buildResponse(),
66 66
 				'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(),
67 67
 			],
68
-		]);
68
+		] );
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			'context' => [
78 78
 				'text' => trim( $this->getLoginText().' '.$this->getRegisterText() ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	protected function buildRecaptcha()
87 87
 	{
88 88
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
89
-		return glsr( Builder::class )->div([
89
+		return glsr( Builder::class )->div( [
90 90
 			'class' => 'glsr-recaptcha-holder',
91 91
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
92
-			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )),
92
+			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ),
93 93
 			'data-size' => 'invisible',
94
-		]);
94
+		] );
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function buildResponse()
101 101
 	{
102
-		$classes = !empty( $this->errors )
102
+		$classes = !empty($this->errors)
103 103
 			? glsr( StyleValidationDefaults::class )->defaults()['message_error_class']
104 104
 			: '';
105 105
 		return glsr( Template::class )->build( 'templates/form/response', [
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 				'class' => $classes,
108 108
 				'message' => wpautop( $this->message ),
109 109
 			],
110
-			'has_errors' => !empty( $this->errors ),
111
-		]);
110
+			'has_errors' => !empty($this->errors),
111
+		] );
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'context' => [
121 121
 				'text' => __( 'Submit your review', 'site-reviews' ),
122 122
 			],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$fields = array_merge(
140 140
 			$this->getHiddenFields(),
141 141
 			[$this->getHoneypotField()],
142
-			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ))
142
+			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) )
143 143
 		);
144 144
 		return $fields;
145 145
 	}
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function getLoginText()
151 151
 	{
152
-		$loginLink = glsr( Builder::class )->a([
153
-			'href' => wp_login_url( strval( get_permalink() )),
152
+		$loginLink = glsr( Builder::class )->a( [
153
+			'href' => wp_login_url( strval( get_permalink() ) ),
154 154
 			'text' => __( 'logged in', 'site-reviews' ),
155
-		]);
155
+		] );
156 156
 		return sprintf( __( 'You must be %s to submit a review.', 'site-reviews' ), $loginLink );
157 157
 	}
158 158
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	protected function getRegisterText()
163 163
 	{
164 164
 		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
165
-		$registerLink = glsr( Builder::class )->a([
165
+		$registerLink = glsr( Builder::class )->a( [
166 166
 			'href' => wp_registration_url(),
167 167
 			'text' => __( 'register', 'site-reviews' ),
168
-		]);
168
+		] );
169 169
 		return sprintf( __( 'You may also %s for an account.', 'site-reviews' ), $registerLink );
170 170
 	}
171 171
 
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
 		$fields = [[
178 178
 			'name' => 'action',
179 179
 			'value' => 'submit-review',
180
-		],[
180
+		], [
181 181
 			'name' => 'assign_to',
182 182
 			'value' => $this->args['assign_to'],
183
-		],[
183
+		], [
184 184
 			'name' => 'category',
185 185
 			'value' => $this->args['category'],
186
-		],[
186
+		], [
187 187
 			'name' => 'excluded',
188 188
 			'value' => $this->args['excluded'], // @todo should default to "[]"
189
-		],[
189
+		], [
190 190
 			'name' => 'form_id',
191 191
 			'value' => $this->args['id'],
192
-		],[
192
+		], [
193 193
 			'name' => 'nonce',
194 194
 			'value' => wp_create_nonce( 'submit-review' ),
195
-		],[
195
+		], [
196 196
 			'name' => 'post_id',
197 197
 			'value' => get_the_ID(),
198
-		],[
198
+		], [
199 199
 			'name' => 'referer',
200
-			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )),
200
+			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ),
201 201
 		]];
202 202
 		return array_map( function( $field ) {
203
-			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ));
203
+			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) );
204 204
 		}, $fields );
205 205
 	}
206 206
 
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function getHoneypotField()
211 211
 	{
212
-		return new Field([
212
+		return new Field( [
213 213
 			'name' => 'gotcha',
214 214
 			'type' => 'honeypot',
215
-		]);
215
+		] );
216 216
 	}
217 217
 
218 218
 	/**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function normalizeFieldClass( Field &$field )
222 222
 	{
223
-		if( !isset( $field->field['class'] )) {
223
+		if( !isset($field->field['class']) ) {
224 224
 			$field->field['class'] = '';
225 225
 		}
226 226
 		$field->field['class'] = trim( $field->field['class'].' glsr-field-control' );
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	protected function normalizeFieldErrors( Field &$field )
233 233
 	{
234
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
234
+		if( !array_key_exists( $field->field['path'], $this->errors ) )return;
235 235
 		$field->field['errors'] = $this->errors[$field->field['path']];
236 236
 	}
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	protected function normalizeFieldRequired( Field &$field )
242 242
 	{
243
-		if( !in_array( $field->field['path'], $this->required ))return;
243
+		if( !in_array( $field->field['path'], $this->required ) )return;
244 244
 		$field->field['required'] = true;
245 245
 	}
246 246
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	protected function normalizeFieldValue( Field &$field )
266 266
 	{
267
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
268
-		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
267
+		if( !array_key_exists( $field->field['path'], $this->values ) )return;
268
+		if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) {
269 269
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
270 270
 		}
271 271
 		else {
Please login to merge, or discard this patch.