Passed
Push — master ( 251272...937ebe )
by Paul
06:42 queued 03:14
created
plugin/Actions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -54,57 +54,57 @@
 block discarded – undo
54 54
 	 */
55 55
 	public function run()
56 56
 	{
57
-		add_action( 'admin_enqueue_scripts',                        [$this->admin, 'enqueueAssets'] );
58
-		add_action( 'admin_init',                                   [$this->admin, 'registerTinymcePopups'] );
59
-		add_action( 'media_buttons',                                [$this->admin, 'renderTinymceButton'], 11 );
60
-		add_action( 'plugins_loaded',                               [$this->app, 'getDefaults'], 11 );
61
-		add_action( 'plugins_loaded',                               [$this->app, 'registerAddons'] );
62
-		add_action( 'plugins_loaded',                               [$this->app, 'registerLanguages'] );
63
-		add_action( 'plugins_loaded',                               [$this->app, 'registerReviewTypes'] );
64
-		add_action( 'upgrader_process_complete',                    [$this->app, 'upgraded'], 10, 2 );
65
-		add_action( 'init',                                         [$this->blocks, 'registerAssets'], 9 );
66
-		add_action( 'init',                                         [$this->blocks, 'registerBlocks'] );
67
-		add_action( 'admin_enqueue_scripts',                        [$this->editor, 'customizePostStatusLabels'] );
68
-		add_action( 'add_meta_boxes_'.Application::POST_TYPE,       [$this->editor, 'registerMetaBoxes'] );
69
-		add_action( 'admin_print_scripts',                          [$this->editor, 'removeAutosave'], 999 );
70
-		add_action( 'admin_menu',                                   [$this->editor, 'removeMetaBoxes'] );
71
-		add_action( 'current_screen',                               [$this->editor, 'removePostTypeSupport'] );
72
-		add_action( 'post_submitbox_misc_actions',                  [$this->editor, 'renderPinnedInPublishMetaBox'] );
73
-		add_action( 'admin_head',                                   [$this->editor, 'renderReviewFields'] );
74
-		add_action( 'admin_action_revert',                          [$this->editor, 'revertReview'] );
75
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->editor, 'saveMetaboxes'] );
76
-		add_action( 'admin_action_approve',                         [$this->listtable, 'approve'] );
77
-		add_action( 'bulk_edit_custom_box',                         [$this->listtable, 'renderBulkEditFields'], 10, 2 );
78
-		add_action( 'restrict_manage_posts',                        [$this->listtable, 'renderColumnFilters'] );
79
-		add_action( 'manage_posts_custom_column',                   [$this->listtable, 'renderColumnValues'], 10, 2 );
80
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->listtable, 'saveBulkEditFields'] );
81
-		add_action( 'pre_get_posts',                                [$this->listtable, 'setQueryForColumn'] );
82
-		add_action( 'admin_action_unapprove',                       [$this->listtable, 'unapprove'] );
83
-		add_action( 'init',                                         [$this->main, 'registerPostType'], 8 );
84
-		add_action( 'init',                                         [$this->main, 'registerShortcodes'] );
85
-		add_action( 'init',                                         [$this->main, 'registerTaxonomy'] );
86
-		add_action( 'widgets_init',                                 [$this->main, 'registerWidgets'] );
87
-		add_action( 'admin_menu',                                   [$this->menu, 'registerMenuCount'] );
88
-		add_action( 'admin_menu',                                   [$this->menu, 'registerSubMenus'] );
89
-		add_action( 'admin_init',                                   [$this->menu, 'setCustomPermissions'], 999 );
90
-		add_action( 'wp_enqueue_scripts',                           [$this->public, 'enqueueAssets'], 999 );
91
-		add_filter( 'site-reviews/builder',                         [$this->public, 'modifyBuilder'] );
92
-		add_action( 'wp_footer',                                    [$this->public, 'renderSchema'] );
93
-		add_action( 'set_object_terms',                             [$this->review, 'onAfterChangeCategory'], 10, 6 );
94
-		add_action( 'transition_post_status',                       [$this->review, 'onAfterChangeStatus'], 10, 3 );
95
-		add_action( 'site-reviews/review/created',                  [$this->review, 'onAfterCreate'] );
96
-		add_action( 'before_delete_post',                           [$this->review, 'onBeforeDelete'] );
97
-		add_action( 'update_postmeta',                              [$this->review, 'onBeforeUpdate'], 10, 4 );
98
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
99
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
57
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
58
+		add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] );
59
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
60
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
61
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
62
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
63
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
64
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
65
+		add_action( 'init', [$this->blocks, 'registerAssets'], 9 );
66
+		add_action( 'init', [$this->blocks, 'registerBlocks'] );
67
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
68
+		add_action( 'add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes'] );
69
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
70
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
71
+		add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] );
72
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
73
+		add_action( 'admin_head', [$this->editor, 'renderReviewFields'] );
74
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
75
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
76
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
77
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
78
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
79
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 );
80
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
81
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
82
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
83
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
84
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
85
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
86
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
87
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
88
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
89
+		add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 );
90
+		add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 );
91
+		add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] );
92
+		add_action( 'wp_footer', [$this->public, 'renderSchema'] );
93
+		add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 );
94
+		add_action( 'transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3 );
95
+		add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] );
96
+		add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] );
97
+		add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 );
98
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
99
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
100 100
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
101
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
102
-		add_action( 'site-reviews/schedule/session/purge',          [$this->session, 'deleteExpiredSessions'] );
103
-		add_action( 'admin_init',                                   [$this->settings, 'registerSettings'] );
104
-		add_action( Application::TAXONOMY.'_term_edit_form_top',    [$this->taxonomy, 'disableParents'] );
105
-		add_action( Application::TAXONOMY.'_term_new_form_tag',     [$this->taxonomy, 'disableParents'] );
106
-		add_action( Application::TAXONOMY.'_add_form_fields',       [$this->taxonomy, 'enableParents'] );
107
-		add_action( Application::TAXONOMY.'_edit_form',             [$this->taxonomy, 'enableParents'] );
108
-		add_action( 'restrict_manage_posts',                        [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
101
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
102
+		add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] );
103
+		add_action( 'admin_init', [$this->settings, 'registerSettings'] );
104
+		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] );
105
+		add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] );
106
+		add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] );
107
+		add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] );
108
+		add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->validateBlacklist();
68 68
 		$this->validateAkismet();
69 69
 		$this->validateRecaptcha();
70
-		if( !empty( $this->error )) {
70
+		if( !empty($this->error) ) {
71 71
 			$this->setSessionValues( 'message', $this->error );
72 72
 		}
73 73
 		return $this;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
92 92
 			return static::RECAPTCHA_DISABLED;
93 93
 		}
94
-		if( empty( $this->request['_recaptcha-token'] )) {
95
-			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ))
94
+		if( empty($this->request['_recaptcha-token']) ) {
95
+			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
96 96
 				? static::RECAPTCHA_EMPTY
97 97
 				: static::RECAPTCHA_FAILED;
98 98
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getRecaptchaTokenStatus()
106 106
 	{
107
-		$endpoint = add_query_arg([
107
+		$endpoint = add_query_arg( [
108 108
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
109 109
 			'response' => $this->request['_recaptcha-token'],
110 110
 			'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
111 111
 		], static::RECAPTCHA_ENDPOINT );
112
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
112
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
113 113
 			glsr_log()->error( $response->get_error_message() );
114 114
 			return static::RECAPTCHA_FAILED;
115 115
 		}
116
-		$response = json_decode( wp_remote_retrieve_body( $response ));
117
-		if( !empty( $response->success )) {
116
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
117
+		if( !empty($response->success) ) {
118 118
 			return boolval( $response->success )
119 119
 				? static::RECAPTCHA_VALID
120 120
 				: static::RECAPTCHA_INVALID;
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$rules = array_intersect_key(
134 134
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
135
-			array_flip( $this->getOption( 'settings.submissions.required', [] ))
135
+			array_flip( $this->getOption( 'settings.submissions.required', [] ) )
136 136
 		);
137
-		$excluded = isset( $request['excluded'] )
137
+		$excluded = isset($request['excluded'])
138 138
 			? explode( ',', $request['excluded'] )
139 139
 			: [];
140
-		return array_diff_key( $rules, array_flip( $excluded ));
140
+		return array_diff_key( $rules, array_flip( $excluded ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$rules = $this->getValidationRules( $request );
149 149
 		$errors = glsr( Validator::class )->validate( $request, $rules );
150
-		if( empty( $errors )) {
150
+		if( empty($errors) ) {
151 151
 			return true;
152 152
 		}
153 153
 		$this->setSessionValues( 'errors', $errors );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
165 165
 	{
166 166
 		glsr( Session::class )->set( $this->form_id.$type, $value );
167
-		if( !empty( $loggedMessage )) {
167
+		if( !empty($loggedMessage) ) {
168 168
 			glsr_log()->warning( $loggedMessage );
169 169
 			glsr_log()->warning( $this->request );
170 170
 		}
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function validateAkismet()
177 177
 	{
178
-		if( !empty( $this->error ))return;
179
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
178
+		if( !empty($this->error) )return;
179
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
180 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission (consider adding the IP address to the blacklist):' );
181 181
 		$this->error = __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' );
182 182
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function validateBlacklist()
188 188
 	{
189
-		if( !empty( $this->error ))return;
190
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty($this->error) )return;
190
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
191 191
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
192 192
 		if( $blacklistAction == 'reject' ) {
193 193
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function validateCustom()
204 204
 	{
205
-		if( !empty( $this->error ))return;
205
+		if( !empty($this->error) )return;
206 206
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
207 207
 		if( $validated === true )return;
208 208
 		$this->setSessionValues( 'errors', [] );
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	protected function validateHoneyPot()
219 219
 	{
220
-		if( !empty( $this->error ))return;
221
-		if( empty( $this->request['gotcha'] ))return;
220
+		if( !empty($this->error) )return;
221
+		if( empty($this->request['gotcha']) )return;
222 222
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
223 223
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
224 224
 	}
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	protected function validateRecaptcha()
230 230
 	{
231
-		if( !empty( $this->error ))return;
231
+		if( !empty($this->error) )return;
232 232
 		$status = $this->getRecaptchaStatus();
233
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
233
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) )return;
234 234
 		if( $status == static::RECAPTCHA_EMPTY ) {
235 235
 			$this->setSessionValues( 'recaptcha', 'unset' );
236 236
 			$this->recaptchaIsUnset = true;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	protected function validateRequest( array $request )
252 252
 	{
253
-		if( !$this->isRequestValid( $request )) {
253
+		if( !$this->isRequestValid( $request ) ) {
254 254
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
255 255
 			return $request;
256 256
 		}
Please login to merge, or discard this patch.
plugin/Modules/Session.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		$cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE );
40 40
 		if( strpos( $cookieId, static::DELIMITER ) !== false ) {
41
-			$cookie = explode( static::DELIMITER, stripslashes( $cookieId ));
41
+			$cookie = explode( static::DELIMITER, stripslashes( $cookieId ) );
42 42
 			$this->sessionId = preg_replace( '/[^A-Za-z0-9_]/', '', $cookie[0] );
43 43
 			$this->expiryTimestamp = absint( $cookie[1] );
44 44
 			$this->expiryTimestampReset = absint( $cookie[2] );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function deleteExpiredSessions( $limit = 1000 )
79 79
 	{
80
-		if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ))) {
80
+		if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ) ) ) {
81 81
 			glsr( SqlQueries::class )->deleteExpiredSessions( $expiredSessions );
82 82
 		}
83 83
 	}
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 	public function get( $key, $fallback = '', $unset = false )
92 92
 	{
93 93
 		$key = sanitize_key( $key );
94
-		$value = isset( $this->sessionData[$key] )
94
+		$value = isset($this->sessionData[$key])
95 95
 			? maybe_unserialize( $this->sessionData[$key] )
96 96
 			: $fallback;
97
-		if( isset( $this->sessionData[$key] ) && $unset ) {
98
-			unset( $this->sessionData[$key] );
97
+		if( isset($this->sessionData[$key]) && $unset ) {
98
+			unset($this->sessionData[$key]);
99 99
 			$this->updateSession();
100 100
 		}
101 101
 		return $value;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	protected function deleteSession()
130 130
 	{
131 131
 		delete_option( $this->getSessionId() );
132
-		delete_option( $this->getSessionId( 'expires' ));
132
+		delete_option( $this->getSessionId( 'expires' ) );
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	protected function generateSessionId()
139 139
 	{
140
-		return md5(( new PasswordHash( 8, false ))->get_random_bytes( 32 ));
140
+		return md5( (new PasswordHash( 8, false ))->get_random_bytes( 32 ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	protected function getExpiredSessions( $limit )
148 148
 	{
149 149
 		$expiredSessions = [];
150
-		$sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ));
151
-		if( !empty( $sessions )) {
150
+		$sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ) );
151
+		if( !empty($sessions) ) {
152 152
 			$now = time();
153 153
 			foreach( $sessions as $session ) {
154 154
 				if( $now <= $session->expiration )continue;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	protected function getSessionId( $separator = '' )
167 167
 	{
168
-		return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ));
168
+		return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ) );
169 169
 	}
170 170
 
171 171
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	{
197 197
 		if( headers_sent() )return;
198 198
 		$cookie = $this->sessionId.static::DELIMITER.$this->expiryTimestamp.static::DELIMITER.$this->expiryTimestampReset;
199
-		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' )));
199
+		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ) ) );
200 200
 		setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath );
201 201
 	}
202 202
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function updateSession()
216 216
 	{
217
-		if( false === get_option( $this->getSessionId() )) {
217
+		if( false === get_option( $this->getSessionId() ) ) {
218 218
 			return $this->createSession();
219 219
 		}
220 220
 		update_option( $this->getSessionId(), $this->sessionData, false );
Please login to merge, or discard this patch.
plugin/Helper.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$className = $this->camelCase( $name );
18 18
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
19
-		return !empty( $path )
19
+		return !empty($path)
20 20
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
21 21
 			: $className;
22 22
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function buildMethodName( $name, $prefix = '' )
30 30
 	{
31
-		return lcfirst( $prefix.$this->buildClassName( $name ));
31
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function buildPropertyName( $name )
39 39
 	{
40
-		return lcfirst( $this->buildClassName( $name ));
40
+		return lcfirst( $this->buildClassName( $name ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function camelCase( $string )
48 48
 	{
49
-		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string )));
49
+		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
50 50
 		return str_replace( ' ', '', $string );
51 51
 	}
52 52
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function convertPathToId( $path, $prefix = '' )
80 80
 	{
81
-		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ));
81
+		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) );
82 82
 	}
83 83
 
84 84
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$levels = explode( '.', $path );
91 91
 		return array_reduce( $levels, function( $result, $value ) {
92
-			return $result.= '['.$value.']';
92
+			return $result .= '['.$value.']';
93 93
 		}, $prefix );
94 94
 	}
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function convertStringToArray( $string, $callback = null )
102 102
 	{
103
-		$array = array_map( 'trim', explode( ',', $string ));
103
+		$array = array_map( 'trim', explode( ',', $string ) );
104 104
 		return $callback
105 105
 			? array_filter( $array, $callback )
106 106
 			: array_filter( $array );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function dashCase( $string )
114 114
 	{
115
-		return str_replace( '_', '-', $this->snakeCase( $string ));
115
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function filterInput( $key, array $request = [] )
136 136
 	{
137
-		if( isset( $request[$key] )) {
137
+		if( isset($request[$key]) ) {
138 138
 			return $request[$key];
139 139
 		}
140 140
 		$variable = filter_input( INPUT_POST, $key );
141
-		if( is_null( $variable ) && isset( $_POST[$key] )) {
141
+		if( is_null( $variable ) && isset($_POST[$key]) ) {
142 142
 			$variable = $_POST[$key];
143 143
 		}
144 144
 		return $variable;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	public function filterInputArray( $key )
152 152
 	{
153 153
 		$variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
154
-		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) {
154
+		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) {
155 155
 			$variable = $_POST[$key];
156 156
 		}
157 157
 		return (array)$variable;
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		$result = [];
168 168
 		foreach( $array as $key => $value ) {
169 169
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
170
-			if( $this->isIndexedFlatArray( $value )) {
170
+			if( $this->isIndexedFlatArray( $value ) ) {
171 171
 				if( $flattenValue ) {
172 172
 					$value = '['.implode( ', ', $value ).']';
173 173
 				}
174 174
 			}
175
-			else if( is_array( $value )) {
176
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
175
+			else if( is_array( $value ) ) {
176
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
177 177
 				continue;
178 178
 			}
179 179
 			$result[$newKey] = $value;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 				Whip::IPV4 => $cloudflareIps['v4'],
196 196
 				Whip::IPV6 => $ipv6,
197 197
 			],
198
-		]))->getValidIpAddress();
198
+		] ))->getValidIpAddress();
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	{
209 209
 		$keys = explode( '.', $path );
210 210
 		foreach( $keys as $key ) {
211
-			if( !isset( $values[$key] )) {
211
+			if( !isset($values[$key]) ) {
212 212
 				return $fallback;
213 213
 			}
214 214
 			$values = $values[$key];
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function insertInArray( array $array, array $insert, $key, $position = 'before' )
225 225
 	{
226
-		$keyPosition = intval( array_search( $key, array_keys( $array )));
226
+		$keyPosition = intval( array_search( $key, array_keys( $array ) ) );
227 227
 		if( 'after' == $position ) {
228 228
 			$keyPosition++;
229 229
 		}
230 230
 		if( false !== $keyPosition ) {
231 231
 			$result = array_slice( $array, 0, $keyPosition );
232 232
 			$result = array_merge( $result, $insert );
233
-			return array_merge( $result, array_slice( $array, $keyPosition ));
233
+			return array_merge( $result, array_slice( $array, $keyPosition ) );
234 234
 		}
235 235
 		return array_merge( $array, $insert );
236 236
 	}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function isIndexedArray( $array )
243 243
 	{
244
-		if( !is_array( $array )) {
244
+		if( !is_array( $array ) ) {
245 245
 			return false;
246 246
 		}
247 247
 		$current = 0;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function isIndexedFlatArray( $array )
262 262
 	{
263
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
263
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
264 264
 			return false;
265 265
 		}
266 266
 		return $this->isIndexedArray( $array );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function prefixString( $string, $prefix = '' )
275 275
 	{
276
-		return $prefix.str_replace( $prefix, '', trim( $string ));
276
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
277 277
 	}
278 278
 
279 279
 	/**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	public function removePrefix( $prefix, $text )
300 300
 	{
301 301
 		return 0 === strpos( $text, $prefix )
302
-			? substr( $text, strlen( $prefix ))
302
+			? substr( $text, strlen( $prefix ) )
303 303
 			: $text;
304 304
 	}
305 305
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	public function snakeCase( $string )
332 332
 	{
333
-		if( !ctype_lower( $string )) {
333
+		if( !ctype_lower( $string ) ) {
334 334
 			$string = preg_replace( '/\s+/u', '', $string );
335 335
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
336 336
 			$string = function_exists( 'mb_strtolower' )
@@ -347,6 +347,6 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public function startsWith( $needle, $haystack )
349 349
 	{
350
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
350
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
351 351
 	}
352 352
 }
Please login to merge, or discard this patch.
plugin/Application.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = 'static::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	public function hasPermission()
135 135
 	{
136 136
 		$isAdmin = $this->isAdmin();
137
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->constant( 'CAPABILITY' )));
137
+		return !$isAdmin || ($isAdmin && current_user_can( $this->constant( 'CAPABILITY' ) ));
138 138
 	}
139 139
 
140 140
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		$types = apply_filters( 'site-reviews/addon/types', [] );
191 191
 		$this->reviewTypes = wp_parse_args( $types, [
192 192
 			'local' => __( 'Local', 'site-reviews' ),
193
-		]);
193
+		] );
194 194
 	}
195 195
 
196 196
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	{
202 202
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
203 203
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
204
-		if( !file_exists( $file )) {
204
+		if( !file_exists( $file ) ) {
205 205
 			glsr_log()->error( 'File not found: '.$file );
206 206
 			return;
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function scheduleCronJob()
217 217
 	{
218
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
218
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
219 219
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
220 220
 	}
221 221
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function unscheduleCronJob()
235 235
 	{
236
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
236
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
237 237
 	}
238 238
 
239 239
 	/**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function url( $path = '' )
267 267
 	{
268
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
268
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
269 269
 		return apply_filters( 'site-reviews/url', $url, $path );
270 270
 	}
271 271
 }
Please login to merge, or discard this patch.
plugin/Modules/Style.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 			'templates/form/submit-button',
51 51
 			'templates/reviews-form',
52 52
 		];
53
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
53
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
54 54
 			return $view;
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->file( $possibleView )))continue;
58
+			if( !file_exists( glsr()->file( $possibleView ) ) )continue;
59 59
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 60
 		}
61 61
 		return $view;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function modifyField( Builder $instance )
90 90
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
91
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return;
92 92
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 93
 	}
94 94
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function customize( Builder $instance )
107 107
 	{
108
-		if( !array_key_exists( $instance->tag, $this->fields ))return;
109
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
108
+		if( !array_key_exists( $instance->tag, $this->fields ) )return;
109
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
110 110
 		$key = $instance->tag.'_'.$args['type'];
111
-		$classes = !isset( $this->fields[$key] )
111
+		$classes = !isset($this->fields[$key])
112 112
 			? $this->fields[$instance->tag]
113 113
 			: $this->fields[$key];
114 114
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$args = wp_parse_args( $instance->args, [
143 143
 			'is_public' => false,
144 144
 			'is_raw' => false,
145
-		]);
145
+		] );
146 146
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
147 147
 			return false;
148 148
 		}
Please login to merge, or discard this patch.
plugin/Database/Cache.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 			foreach( array_keys( $ipAddresses ) as $version ) {
21 21
 				$url = 'https://www.cloudflare.com/ips-'.$version;
22 22
 				$response = wp_remote_get( $url );
23
-				if( is_wp_error( $response )) {
23
+				if( is_wp_error( $response ) ) {
24 24
 					glsr_log()->error( $response->get_error_message() );
25 25
 					continue;
26 26
 				}
27
-				if(( $statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) {
27
+				if( ($statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) {
28 28
 					glsr_log()->error( 'Unable to connect to '.$url.' ['.$statusCode.']' );
29 29
 					continue;
30 30
 				}
31 31
 				$ipAddresses[$version] = array_filter(
32
-					(array)preg_split( '/\R/', wp_remote_retrieve_body( $response ))
32
+					(array)preg_split( '/\R/', wp_remote_retrieve_body( $response ) )
33 33
 				);
34 34
 			}
35 35
 			set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME );
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		if( $test === false ) {
65 65
 			$response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' );
66 66
 			$test = !is_wp_error( $response )
67
-				&& in_array( $response['response']['code'], range( 200, 299 ))
67
+				&& in_array( $response['response']['code'], range( 200, 299 ) )
68 68
 				? 'Works'
69 69
 				: 'Does not work';
70 70
 			set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME );
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewsHtml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 		$this->reviews = $reviews;
31 31
 		$this->navigation = glsr( Partial::class )->build( 'pagination', [
32 32
 			'total' => $maxPageCount,
33
-		]);
34
-		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
33
+		] );
34
+		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
35 35
 	}
36 36
 
37 37
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'navigation' => $this->getNavigation(),
58 58
 				'reviews' => implode( PHP_EOL, $this->reviews ),
59 59
 			],
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			$defaults[] = 'glsr-ajax-pagination';
73 73
 		}
74 74
 		$classes = explode( ' ', $this->args['class'] );
75
-		$classes = array_unique( array_merge( $defaults, $classes ));
75
+		$classes = array_unique( array_merge( $defaults, $classes ) );
76 76
 		return implode( ' ', $classes );
77 77
 	}
78 78
 
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		foreach( $this->reviews as $index => $review ) {
88 88
 			$renderedReviews[] = glsr( Template::class )->build( 'templates/review', [
89 89
 				'context' => $this->buildReview( $review )->values,
90
-			]);
90
+			] );
91 91
 		}
92 92
 		return new ReviewsHtml( $renderedReviews, $this->reviews->max_num_pages, $this->args );
93 93
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function generateSchema()
99 99
 	{
100
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
100
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
101 101
 		glsr( Schema::class )->store(
102 102
 			glsr( Schema::class )->build( $this->args )
103 103
 		);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function isHidden( $key, $path = '' )
112 112
 	{
113
-		$isOptionEnabled = !empty( $path )
113
+		$isOptionEnabled = !empty($path)
114 114
 			? $this->isOptionEnabled( $path )
115 115
 			: true;
116 116
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	protected function buildOptionAssignedTo( $key, $value )
125 125
 	{
126
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
126
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
127 127
 		$post = glsr( Polylang::class )->getPost( $value );
128
-		if( !( $post instanceof WP_Post ))return;
128
+		if( !($post instanceof WP_Post) )return;
129 129
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
130 130
 			'href' => get_the_permalink( $post->ID ),
131
-		]);
131
+		] );
132 132
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
133 133
 		return '<span>'.$assignedTo.'</span>';
134 134
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	protected function buildOptionAuthor( $key, $value )
142 142
 	{
143
-		if( $this->isHidden( $key ))return;
143
+		if( $this->isHidden( $key ) )return;
144 144
 		return '<span>'.$value.'</span>';
145 145
 	}
146 146
 
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	protected function buildOptionAvatar( $key, $value )
153 153
 	{
154
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
154
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
155 155
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
156
-		return glsr( Builder::class )->img([
156
+		return glsr( Builder::class )->img( [
157 157
 			'height' => $size,
158 158
 			'src' => $this->generateAvatar( $value ),
159 159
 			'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
160 160
 			'width' => $size,
161
-		]);
161
+		] );
162 162
 	}
163 163
 
164 164
 	/**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	protected function buildOptionContent( $key, $value )
170 170
 	{
171 171
 		$text = $this->normalizeText( $value );
172
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
172
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
173 173
 		return '<p>'.$text.'</p>';
174 174
 	}
175 175
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	protected function buildOptionDate( $key, $value )
182 182
 	{
183
-		if( $this->isHidden( $key ))return;
183
+		if( $this->isHidden( $key ) )return;
184 184
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
185 185
 		if( $dateFormat == 'relative' ) {
186 186
 			$date = glsr( Date::class )->relative( $value );
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			$format = $dateFormat == 'custom'
190 190
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
191 191
 				: (string)get_option( 'date_format' );
192
-			$date = date_i18n( $format, strtotime( $value ));
192
+			$date = date_i18n( $format, strtotime( $value ) );
193 193
 		}
194 194
 		return '<span>'.$date.'</span>';
195 195
 	}
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	protected function buildOptionRating( $key, $value )
203 203
 	{
204
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
204
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
205 205
 		return glsr( Partial::class )->build( 'star-rating', [
206 206
 			'rating' => $value,
207
-		]);
207
+		] );
208 208
 	}
209 209
 
210 210
 	/**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function buildOptionResponse( $key, $value )
216 216
 	{
217
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
218
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
217
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
218
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
219 219
 		$text = $this->normalizeText( $value );
220 220
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
221 221
 		$response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function buildOptionTitle( $key, $value )
232 232
 	{
233
-		if( $this->isHidden( $key ))return;
234
-		if( empty( $value )) {
233
+		if( $this->isHidden( $key ) )return;
234
+		if( empty($value) ) {
235 235
 			$value = __( 'No Title', 'site-reviews' );
236 236
 		}
237 237
 		return '<h3>'.$value.'</h3>';
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 			return $avatarUrl;
248 248
 		}
249 249
 		$authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
250
-		if( empty( $authorIdOrEmail )) {
250
+		if( empty($authorIdOrEmail) ) {
251 251
 			$authorIdOrEmail = $this->current->email;
252 252
 		}
253
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
253
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
254 254
 			return $newAvatar;
255 255
 		}
256 256
 		return $avatarUrl;
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getExcerpt( $text )
264 264
 	{
265
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
265
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
266 266
 		$split = extension_loaded( 'intl' )
267 267
 			? $this->getExcerptIntlSplit( $text, $limit )
268 268
 			: $this->getExcerptSplit( $text, $limit );
269 269
 		$hiddenText = substr( $text, $split );
270
-		if( !empty( $hiddenText )) {
270
+		if( !empty($hiddenText) ) {
271 271
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
272 272
 				'class' => 'glsr-hidden glsr-hidden-text',
273 273
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
274 274
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
275
-			]);
276
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
275
+			] );
276
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
277 277
 		}
278 278
 		return nl2br( $text );
279 279
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
289 289
 		$words->setText( $text );
290 290
 		$count = 0;
291
-		foreach( $words as $offset ){
291
+		foreach( $words as $offset ) {
292 292
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
293 293
 			$count++;
294 294
 			if( $count != $limit )continue;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	protected function getExcerptSplit( $text, $limit )
306 306
 	{
307 307
 		if( str_word_count( $text, 0 ) > $limit ) {
308
-			$words = array_keys( str_word_count( $text, 2 ));
308
+			$words = array_keys( str_word_count( $text, 2 ) );
309 309
 			return $words[$limit];
310 310
 		}
311 311
 		return strlen( $text );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function getOption( $path, $fallback = '' )
320 320
 	{
321
-		if( array_key_exists( $path, $this->options )) {
321
+		if( array_key_exists( $path, $this->options ) ) {
322 322
 			return $this->options[$path];
323 323
 		}
324 324
 		return $fallback;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function isHiddenOrEmpty( $key, $value )
333 333
 	{
334
-		return $this->isHidden( $key ) || empty( $value );
334
+		return $this->isHidden( $key ) || empty($value);
335 335
 	}
336 336
 
337 337
 	/**
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
 	protected function normalizeText( $text )
351 351
 	{
352 352
 		$text = wp_kses( $text, wp_kses_allowed_html() );
353
-		$text = convert_smilies( strip_shortcodes( $text ));
353
+		$text = convert_smilies( strip_shortcodes( $text ) );
354 354
 		$text = str_replace( ']]>', ']]&gt;', $text );
355 355
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
356
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
356
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
357 357
 			$text = $this->getExcerpt( $text );
358 358
 		}
359 359
 		return wptexturize( $text );
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
 	protected function wrap( array &$renderedFields, Review $review )
366 366
 	{
367 367
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
368
-		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
368
+		array_walk( $renderedFields, function( &$value, $key ) use($review) {
369 369
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
370
-			if( empty( $value ))return;
370
+			if( empty($value) )return;
371 371
 			$value = glsr( Builder::class )->div( $value, [
372 372
 				'class' => 'glsr-review-'.$key,
373
-			]);
373
+			] );
374 374
 		});
375 375
 	}
376 376
 }
Please login to merge, or discard this patch.