Passed
Push — master ( d85e7c...97923e )
by Paul
04:16
created
plugin/Controllers/SettingsController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 			return $input;
22 22
 		}
23 23
 		$triggered = true;
24
-		if( !is_array( $input )) {
24
+		if( !is_array( $input ) ) {
25 25
 			$input = ['settings' => []];
26 26
 		}
27 27
 		if( key( $input ) == 'settings' ) {
28
-			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
28
+			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
 		}
30 30
 		$options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
31 31
 		$options = $this->sanitizeSubmissions( $input, $options );
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		foreach( $settings as $setting ) {
44 44
 			register_setting( Application::ID.'-'.$setting, OptionManager::databaseKey(), [
45 45
 				'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
-			]);
46
+			] );
47 47
 		}
48 48
 		glsr( Settings::class )->register();
49 49
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	protected function sanitizeSubmissions( array $input, array $options )
55 55
 	{
56
-		if( isset( $input['settings']['submissions'] )) {
56
+		if( isset($input['settings']['submissions']) ) {
57 57
 			$inputForm = $input['settings']['submissions'];
58
-			$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
58
+			$options['settings']['submissions']['required'] = isset($inputForm['required'])
59 59
 				? $inputForm['required']
60 60
 				: [];
61 61
 		}
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	protected function sanitizeTranslations( array $input, array $options )
69 69
 	{
70
-		if( isset( $input['settings']['translations'] )) {
71
-			$options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ));
70
+		if( isset($input['settings']['translations']) ) {
71
+			$options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ) );
72 72
 			array_walk( $options['settings']['translations'], function( &$string ) {
73
-				if( isset( $string['s2'] )) {
73
+				if( isset($string['s2']) ) {
74 74
 					$string['s2'] = wp_strip_all_tags( $string['s2'] );
75 75
 				}
76
-				if( isset( $string['p2'] )) {
76
+				if( isset($string['p2']) ) {
77 77
 					$string['p2'] = wp_strip_all_tags( $string['p2'] );
78 78
 				}
79 79
 			});
Please login to merge, or discard this patch.
plugin/Commands/CreateReview.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 	public function __construct( $input )
25 25
 	{
26
-		$this->ajaxRequest = isset( $input['ajax_request'] );
26
+		$this->ajaxRequest = isset($input['ajax_request']);
27 27
 		$this->assignedTo = is_numeric( $input['assign_to'] )
28 28
 			? $input['assign_to']
29 29
 			: '';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$this->rating = intval( $input['rating'] );
38 38
 		$this->referrer = $input['_wp_http_referer'];
39 39
 		$this->request = $input;
40
-		$this->terms = isset( $input['terms'] );
40
+		$this->terms = isset($input['terms']);
41 41
 		$this->title = sanitize_text_field( $input['title'] );
42 42
 	}
43 43
 }
Please login to merge, or discard this patch.
plugin/Modules/Blacklist.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function isBlacklisted( CreateReview $review )
14 14
 	{
15
-		$target = implode( "\n", array_filter([
15
+		$target = implode( "\n", array_filter( [
16 16
 			$review->author,
17 17
 			$review->content,
18 18
 			$review->email,
19 19
 			$review->ipAddress,
20 20
 			$review->title,
21
-		]));
22
-		return (bool) apply_filters( 'site-reviews/blacklist/is-blacklisted',
21
+		] ) );
22
+		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
23 23
 			$this->check( $target ),
24 24
 			$review
25 25
 		);
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	protected function check( $target )
33 33
 	{
34
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.entries' ));
35
-		if( empty( $blacklist )) {
34
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.entries' ) );
35
+		if( empty($blacklist) ) {
36 36
 			return false;
37 37
 		}
38 38
 		$lines = explode( "\n", $blacklist );
39
-		foreach( (array) $lines as $line ) {
39
+		foreach( (array)$lines as $line ) {
40 40
 			$line = trim( $line );
41
-			if( empty( $line ) || 256 < strlen( $line ))continue;
42
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
43
-			if( preg_match( $pattern, $target )) {
41
+			if( empty($line) || 256 < strlen( $line ) )continue;
42
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
43
+			if( preg_match( $pattern, $target ) ) {
44 44
 				return true;
45 45
 			}
46 46
 		}
Please login to merge, or discard this patch.
plugin/Database/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 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 )) {
20
+				if( is_wp_error( $response ) ) {
21 21
 					glsr_log()->error( $response->get_error_message() );
22 22
 					continue;
23 23
 				}
24
-				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response )));
24
+				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) );
25 25
 			}
26 26
 			wp_cache_set( Application::ID, $ipAddresses, '_cloudflare_ips' );
27 27
 		}
Please login to merge, or discard this patch.
plugin/Router.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
19
-		if( !isset( $request['action'] ))return;
19
+		if( !isset($request['action']) )return;
20 20
 		$this->checkNonce( $request['action'] );
21 21
 		switch( $request['action'] ) {
22 22
 			case 'clear-log':
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	public function routeAjaxRequest()
43 43
 	{
44 44
 		$request = $this->normalizeAjaxRequest();
45
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
45
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
46 46
 			glsr_log()->error( 'Nonce check failed for ajax request' )->info( $request );
47 47
 			wp_die( -1, 403 );
48 48
 		}
49 49
 		$controller = glsr( AjaxController::class );
50 50
 		$method = glsr( Helper::class )->buildMethodName( $request['action'] );
51
-		if( is_callable( [$controller, $method] )) {
51
+		if( is_callable( [$controller, $method] ) ) {
52 52
 			call_user_func( [$controller, $method], $request );
53 53
 		}
54 54
 		else {
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function routePublicPostRequest()
64 64
 	{
65
-		switch( filter_input( INPUT_POST, 'action' )) {
65
+		switch( filter_input( INPUT_POST, 'action' ) ) {
66 66
 			case 'submit-review':
67
-				glsr( PublicController::class )->routerCreateReview( $this->normalize( $_POST ));
67
+				glsr( PublicController::class )->routerCreateReview( $this->normalize( $_POST ) );
68 68
 				break;
69 69
 		}
70 70
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function routeWebhookRequest()
76 76
 	{
77
-		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
77
+		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ) );
78 78
 		if( !$request )return;
79 79
 		// @todo manage webhook here
80 80
 	}
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	protected function normalizeAjaxRequest()
113 113
 	{
114 114
 		$request = filter_input( INPUT_POST, 'request', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
115
-		if( isset( $request[Application::ID]['action'] )) {
115
+		if( isset($request[Application::ID]['action']) ) {
116 116
 			$request = $request[Application::ID];
117 117
 		}
118
-		if( !isset( $request['action'] )) {
118
+		if( !isset($request['action']) ) {
119 119
 			glsr_log()->error( 'The AJAX request must include an action' )->info( $request );
120 120
 			wp_die();
121 121
 		}
122
-		if( !isset( $request['nonce'] )) {
122
+		if( !isset($request['nonce']) ) {
123 123
 			glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request );
124 124
 			wp_die();
125 125
 		}
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	protected function createWebhookNotification( Command $command, array $args )
64 64
 	{
65 65
 		$fields = [];
66
-		$fields[] = ['title' => str_repeat( ':star:', (int) $command->rating )];
66
+		$fields[] = ['title' => str_repeat( ':star:', (int)$command->rating )];
67 67
 		if( $command->title ) {
68 68
 			$fields[] = ['title' => $command->title];
69 69
 		}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 		if( $command->author ) {
77 77
 			$fields[] = ['value' => trim( $command->author.$command->email.' - '.$command->ipAddress )];
78 78
 		}
79
-		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ))];
80
-		return json_encode([
79
+		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ) )];
80
+		return json_encode( [
81 81
 			'icon_url' => glsr()->url.'assets/img/icon.png',
82 82
 			'username' => glsr()->name,
83 83
 			'attachments' => [[
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				'fallback' => $this->createEmailNotification( $command, $args )->read( 'plaintext' ),
87 87
 				'fields' => $fields,
88 88
 			]],
89
-		]);
89
+		] );
90 90
 	}
91 91
 
92 92
 	/**
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	protected function sendNotification( $post_id, Command $command )
116 116
 	{
117 117
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
118
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
119
-		$assignedToTitle = get_the_title( (int) $command->assignedTo );
118
+		if( !in_array( $notificationType, ['default', 'custom', 'webhook'] ) )return;
119
+		$assignedToTitle = get_the_title( (int)$command->assignedTo );
120 120
 		$notificationSubject = _nx(
121 121
 			'New %s-star review',
122 122
 			'New %s-star review of: %s',
123
-			(int) empty( $assignedToTitle ),
123
+			(int)empty($assignedToTitle),
124 124
 			'The text is different depending on whether or not the review has been assigned to a post.',
125 125
 			'site-reviews'
126 126
 		);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			sprintf( $notificationSubject, $command->rating, $assignedToTitle )
130 130
 		);
131 131
 		$args = [
132
-			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ))),
132
+			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ) ) ),
133 133
 			'notification_title' => $notificationTitle,
134 134
 			'notification_type' => $notificationType,
135 135
 		];
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 		$args['recipient'] = $args['notification_type'] === 'default'
147 147
 			? get_option( 'admin_email' )
148 148
 			: glsr( OptionManager::class )->get( 'settings.general.notification_email' );
149
-		$result = !empty( $args['recipient'] )
149
+		$result = !empty($args['recipient'])
150 150
 			? $this->createEmailNotification( $command, $args )->send()
151 151
 			: false;
152 152
 		if( $result === null ) {
153
-			glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' ));
153
+			glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' ) );
154 154
 		}
155 155
 		if( $result === false ) {
156
-			glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ));
156
+			glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ) );
157 157
 		}
158 158
 	}
159 159
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	protected function sendWebhookNotification( Command $command, array $args )
164 164
 	{
165
-		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return;
165
+		if( !($endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )) )return;
166 166
 		$notification = $this->createWebhookNotification( $command, $args );
167 167
 		$result = wp_remote_post( $endpoint, [
168 168
 			'method' => 'POST',
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 			'sslverify' => false,
174 174
 			'headers' => ['Content-Type' => 'application/json'],
175 175
 			'body' => apply_filters( 'site-reviews/webhook/notification', $notification, $command ),
176
-		]);
177
-		if( is_wp_error( $result )) {
176
+		] );
177
+		if( is_wp_error( $result ) ) {
178 178
 			glsr_log()->error( $result->get_error_message() );
179 179
 		}
180 180
 	}
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function handle( Command $command )
14 14
 	{
15
-		$postId = wp_update_post([
15
+		$postId = wp_update_post( [
16 16
 			'ID' => $command->id,
17 17
 			'post_status' => $command->status,
18
-		]);
19
-		if( is_wp_error( $postId )) {
18
+		] );
19
+		if( is_wp_error( $postId ) ) {
20 20
 			glsr_log()->error( $postId->get_error_message() );
21 21
 			return [];
22 22
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'href' => get_edit_post_link( $postId ),
38 38
 			'class' => 'row-title',
39 39
 			'title' => __( 'Edit', 'site-reviews' ).' &#8220;'.esc_attr( $title ).'&#8221;',
40
-		]);
40
+		] );
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	protected function getPostState( $postId )
48 48
 	{
49 49
 		ob_start();
50
-		_post_states( get_post( $postId ));
50
+		_post_states( get_post( $postId ) );
51 51
 		return ob_get_clean();
52 52
 	}
53 53
 }
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAssets.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 		$this->dependencies = glsr( Html::class )->getDependencies();
22 22
 		$ajaxNonce = wp_create_nonce( Application::ID.'-ajax-nonce' );
23 23
 		$variables = [
24
-			'action'  => glsr()->prefix . '_action',
25
-			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' )),
24
+			'action'  => glsr()->prefix.'_action',
25
+			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' ) ),
26 26
 			'ajaxnonce' => $ajaxNonce,
27
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
27
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
28 28
 		];
29 29
 		$this->enqueue();
30
-		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ));
30
+		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ) );
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function enqueue()
37 37
 	{
38
-		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ));
38
+		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ) );
39 39
 		$stylesheet = file_exists( glsr()->path.'assets/css/'.$currentTheme.'.css' )
40 40
 			? glsr()->url.'assets/css/'.$currentTheme.'.css'
41 41
 			: glsr()->url.'assets/css/'.Application::ID.'.css';
42
-		if( apply_filters( 'site-reviews/assets/css', true )) {
42
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
43 43
 			wp_enqueue_style(
44 44
 				Application::ID,
45 45
 				$stylesheet,
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				glsr()->version
48 48
 			);
49 49
 		}
50
-		if( apply_filters( 'site-reviews/assets/js', true )) {
50
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
51 51
 			wp_enqueue_script(
52 52
 				Application::ID,
53 53
 				glsr()->url.'assets/js/'.Application::ID.'.js',
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function enqueueRecaptchaScript()
68 68
 	{
69
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
69
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
70 70
 			'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ),
71 71
 			'onload' => 'glsr_render_recaptcha',
72 72
 			'render' => 'explicit',
73
-		], 'https://www.google.com/recaptcha/api.js' ));
73
+		], 'https://www.google.com/recaptcha/api.js' ) );
74 74
 		$inlineScript = file_get_contents( glsr()->path.'js/recaptcha.js' );
75 75
 		wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' );
76 76
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.