Passed
Push — master ( ed8579...f866b8 )
by Paul
05:30
created
plugin/Router.php 1 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/Notification.php 1 patch
Spacing   +16 added lines, -16 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
 		$types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
36
-		$this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0;
36
+		$this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
37 37
 		$this->slack = in_array( 'slack', $types );
38 38
 		$this->types = $types;
39 39
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty($this->types) )return;
47 47
 		$this->review = $review;
48 48
 		$args = [
49 49
 			'link' => $this->getLink(),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function buildEmail( array $args )
60 60
 	{
61
-		return glsr( Email::class )->compose([
61
+		return glsr( Email::class )->compose( [
62 62
 			'to' => $this->getEmailAddresses(),
63 63
 			'subject' => $args['title'],
64 64
 			'template' => 'email-notification',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				'review_rating' => $this->review->rating,
72 72
 				'review_title' => $this->review->title,
73 73
 			],
74
-		]);
74
+		] );
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'button_url' => $args['link'],
84 84
 			'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
 			'pretext' => $args['title'],
86
-		]);
86
+		] );
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 	protected function getEmailAddresses()
93 93
 	{
94 94
 		$emails = [];
95
-		if( in_array( 'admin', $this->types )) {
95
+		if( in_array( 'admin', $this->types ) ) {
96 96
 			$emails[] = get_option( 'admin_email' );
97 97
 		}
98
-		if( in_array( 'author', $this->types )) {
99
-			$assignedPost = get_post( intval( $this->review->assigned_to ));
98
+		if( in_array( 'author', $this->types ) ) {
99
+			$assignedPost = get_post( intval( $this->review->assigned_to ) );
100 100
 			if( $assignedPost instanceof WP_Post ) {
101 101
 				$this->email = true;
102
-				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ));
102
+				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
 			}
104 104
 		}
105
-		if( in_array( 'custom', $this->types )) {
105
+		if( in_array( 'custom', $this->types ) ) {
106 106
 			$customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107 107
 			$customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108 108
 			$customEmails = explode( ',', $customEmails );
109 109
 			$emails = array_merge( $emails, $customEmails );
110 110
 		}
111
-		$emails = array_filter( array_keys( array_flip( $emails )));
111
+		$emails = array_filter( array_keys( array_flip( $emails ) ) );
112 112
 		return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
 	}
114 114
 
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function getTitle()
127 127
 	{
128
-		$assignedTitle = get_the_title( intval( $this->review->assigned_to ));
128
+		$assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
 		$title = _nx(
130 130
 			'New %s-star review',
131 131
 			'New %s-star review of: %s',
132
-			intval( empty( $assignedTitle )),
132
+			intval( empty($assignedTitle) ),
133 133
 			'This string differs depending on whether or not the review has been assigned to a post.',
134 134
 			'site-reviews'
135 135
 		);
136 136
 		$title = sprintf( '[%s] %s',
137
-			wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ),
137
+			wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ),
138 138
 			sprintf( $title, $this->review->rating, $assignedTitle )
139 139
 		);
140 140
 		return apply_filters( 'site-reviews/notification/title', $title, $this->review );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$email = $this->buildEmail( $args );
149 149
 		if( !$this->email )return;
150
-		if( empty( $email->to )) {
150
+		if( empty($email->to) ) {
151 151
 			glsr_log()->error( 'Email notification was not sent: missing email address' );
152 152
 			return;
153 153
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		if( !$this->slack )return;
165 165
 		$notification = $this->buildSlackNotification( $args );
166 166
 		$result = $notification->send();
167
-		if( is_wp_error( $result )) {
167
+		if( is_wp_error( $result ) ) {
168 168
 			$notification->review = null;
169 169
 			glsr_log()->error( $result->get_error_message() )->debug( $notification );
170 170
 		}
Please login to merge, or discard this patch.
plugin/Modules/Blacklist.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function isBlacklisted( array $review )
13 13
 	{
14
-		$target = implode( "\n", array_filter([
14
+		$target = implode( "\n", array_filter( [
15 15
 			$review['name'],
16 16
 			$review['content'],
17 17
 			$review['email'],
18 18
 			$review['ip_address'],
19 19
 			$review['title'],
20
-		]));
20
+		] ) );
21 21
 		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22 22
 			$this->check( $target ),
23 23
 			$review
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function check( $target )
32 32
 	{
33
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
34
-		if( empty( $blacklist )) {
33
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
34
+		if( empty($blacklist) ) {
35 35
 			return false;
36 36
 		}
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array)$lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
41
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42
-			if( preg_match( $pattern, $target )) {
40
+			if( empty($line) || 256 < strlen( $line ) )continue;
41
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
42
+			if( preg_match( $pattern, $target ) ) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function __get( $key )
21 21
 	{
22
-		if( array_key_exists( $key, $this->values )) {
22
+		if( array_key_exists( $key, $this->values ) ) {
23 23
 			return $this->values[$key];
24 24
 		}
25 25
 		return '';
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 1 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/Defaults/DefaultsAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name ) )return;
17 17
 		$defaults = call_user_func_array( [$this, $name], $args );
18 18
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 19
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this patch.
plugin/Modules/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function get()
110 110
 	{
111
-		return empty( $this->log )
111
+		return empty($this->log)
112 112
 			? __( 'Console is empty', 'site-reviews' )
113 113
 			: $this->log;
114 114
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	public function humanSize( $valueIfEmpty = null )
121 121
 	{
122 122
 		$bytes = $this->size();
123
-		if( empty( $bytes ) && is_string( $valueIfEmpty )) {
123
+		if( empty($bytes) && is_string( $valueIfEmpty ) ) {
124 124
 			return $valueIfEmpty;
125 125
 		}
126
-		$exponent = floor( log( max( $bytes, 1 ), 1024 ));
127
-		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent];
126
+		$exponent = floor( log( max( $bytes, 1 ), 1024 ) );
127
+		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent];
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	public function log( $level, $message, array $context = [] )
148 148
 	{
149 149
 		$constants = (new ReflectionClass( __CLASS__ ))->getConstants();
150
-		if( in_array( $level, $constants, true )) {
150
+		if( in_array( $level, $constants, true ) ) {
151 151
 			$entry = $this->buildLogEntry( $level, $message, $context );
152
-			file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
152
+			file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
153 153
 			$this->reset();
154 154
 		}
155 155
 		return $this;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function interpolate( $message, $context = [] )
224 224
 	{
225
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
225
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
226 226
 			return print_r( $message, true );
227 227
 		}
228 228
 		$replace = [];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		if( $value instanceof DateTime ) {
251 251
 			$value = $value->format( 'Y-m-d H:i:s' );
252 252
 		}
253
-		else if( $this->isObjectOrArray( $value )) {
253
+		else if( $this->isObjectOrArray( $value ) ) {
254 254
 			$value = json_encode( $value );
255 255
 		}
256 256
 		return (string)$value;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->clear();
266 266
 			file_put_contents(
267 267
 				$this->file,
268
-				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ))
268
+				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) )
269 269
 			);
270 270
 		}
271 271
 	}
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function renderAssignedToMetabox( WP_Post $post )
121 121
 	{
122
-		if( !$this->isReviewPostType( $post ))return;
122
+		if( !$this->isReviewPostType( $post ) )return;
123 123
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
124 124
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
125 125
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
126 126
 			'id' => $assignedTo,
127 127
 			'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function renderDetailsMetaBox( WP_Post $post )
136 136
 	{
137
-		if( !$this->isReviewPostType( $post ))return;
137
+		if( !$this->isReviewPostType( $post ) )return;
138 138
 		$review = glsr( ReviewManager::class )->single( $post );
139 139
 		glsr()->render( 'partials/editor/metabox-details', [
140 140
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
141 141
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
142
-		]);
142
+		] );
143 143
 	}
144 144
 
145 145
 	/**
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function renderPinnedInPublishMetaBox()
150 150
 	{
151
-		if( !$this->isReviewPostType( get_post() ))return;
151
+		if( !$this->isReviewPostType( get_post() ) )return;
152 152
 		glsr( Template::class )->render( 'partials/editor/pinned', [
153 153
 			'context' => [
154 154
 				'no' => __( 'No', 'site-reviews' ),
155 155
 				'yes' => __( 'Yes', 'site-reviews' ),
156 156
 			],
157
-			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
158
-		]);
157
+			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
158
+		] );
159 159
 	}
160 160
 
161 161
 	/**
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function renderResponseMetaBox( WP_Post $post )
166 166
 	{
167
-		if( !$this->isReviewPostType( $post ))return;
167
+		if( !$this->isReviewPostType( $post ) )return;
168 168
 		wp_nonce_field( 'response', '_nonce-response', false );
169 169
 		glsr()->render( 'partials/editor/metabox-response', [
170 170
 			'response' => get_post_meta( $post->ID, 'response', true ),
171
-		]);
171
+		] );
172 172
 	}
173 173
 
174 174
 	/**
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function renderTaxonomyMetabox( WP_Post $post )
180 180
 	{
181
-		if( !$this->isReviewPostType( $post ))return;
181
+		if( !$this->isReviewPostType( $post ) )return;
182 182
 		glsr()->render( 'partials/editor/metabox-categories', [
183 183
 			'post' => $post,
184 184
 			'tax_name' => Application::TAXONOMY,
185 185
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
186
-		]);
186
+		] );
187 187
 	}
188 188
 
189 189
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function revertReview()
195 195
 	{
196
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
196
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
197 197
 		glsr( ReviewManager::class )->revert( $postId );
198 198
 		$this->redirect( $postId, 52 );
199 199
 	}
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
217 217
 	{
218 218
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
219
-		if( !( $assignedPost instanceof WP_Post ))return;
219
+		if( !($assignedPost instanceof WP_Post) )return;
220 220
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
221 221
 			'context' => [
222 222
 				'data.url' => (string)get_permalink( $assignedPost ),
223 223
 				'data.title' => get_the_title( $assignedPost ),
224 224
 			],
225
-		]);
225
+		] );
226 226
 	}
227 227
 
228 228
 	/**
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 				'class' => 'button button-large',
243 243
 				'href' => $revertUrl,
244 244
 				'id' => 'revert',
245
-			]);
245
+			] );
246 246
 		}
247 247
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
248 248
 			'class' => 'button button-large',
249 249
 			'disabled' => true,
250 250
 			'id' => 'revert',
251
-		]);
251
+		] );
252 252
 	}
253 253
 
254 254
 	/**
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
262 262
 			? glsr()->reviewTypes[$review->review_type]
263 263
 			: __( 'Unknown', 'site-reviews' );
264
-		if( !empty( $review->url )) {
264
+		if( !empty($review->url) ) {
265 265
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
266 266
 				'href' => $review->url,
267 267
 				'target' => '_blank',
268
-			]);
268
+			] );
269 269
 		}
270 270
 		return $reviewType;
271 271
 	}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	protected function normalizeDetailsMetaBox( Review $review )
286 286
 	{
287
-		$user = empty( $review->user_id )
287
+		$user = empty($review->user_id)
288 288
 			? __( 'Unregistered user', 'site-reviews' )
289 289
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
290 290
 				'href' => get_author_posts_url( $review->user_id ),
291
-			]);
292
-		$email = empty( $review->email )
291
+			] );
292
+		$email = empty($review->email)
293 293
 			? '&mdash;'
294 294
 			: glsr( Builder::class )->a( $review->email, [
295 295
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
296
-			]);
296
+			] );
297 297
 		$metabox = [
298 298
 			__( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ),
299 299
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 			__( 'IP Address', 'site-reviews' ) => $review->ip_address,
305 305
 			__( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
306 306
 		];
307
-		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ));
307
+		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
308 308
 	}
309 309
 
310 310
 	/**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		$redirectUri = $hasReferer
322 322
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
323 323
 			: get_edit_post_link( $postId );
324
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
324
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
325 325
 		exit;
326 326
 	}
327 327
 }
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
26 26
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 27
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 28
 				'class' => 'pending-count',
29
-			]);
29
+			] );
30 30
 			$awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
31 31
 				'class' => 'awaiting-mod count-'.$postCount->pending,
32
-			]);
32
+			] );
33 33
 			$menu[$key][0] .= ' '.$awaitingModeration;
34 34
 			if( $typenow === Application::POST_TYPE ) {
35
-				$menu[$key][4].= ' current';
35
+				$menu[$key][4] .= ' current';
36 36
 			}
37 37
 			break;
38 38
 		}
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 			'tools' => __( 'Tools', 'site-reviews' ),
50 50
 			'addons' => __( 'Addons', 'site-reviews' ),
51 51
 			'documentation' => __( 'Documentation', 'site-reviews' ),
52
-		]);
52
+		] );
53 53
 		foreach( $pages as $slug => $title ) {
54 54
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 55
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
56
+			if( !is_callable( $callback ) )continue;
57 57
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$this->renderPage( 'addons', [
69 69
 			'template' => glsr( Template::class ),
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 			'shortcodes' => __( 'Shortcodes', 'site-reviews' ),
84 84
 			'hooks' => __( 'Hooks', 'site-reviews' ),
85 85
 			'functions' => __( 'Functions', 'site-reviews' ),
86
-		]);
86
+		] );
87 87
 		$this->renderPage( 'documentation', [
88 88
 			'tabs' => $tabs,
89
-		]);
89
+		] );
90 90
 	}
91 91
 
92 92
 	/**
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 			'translations' => __( 'Translations', 'site-reviews' ),
105 105
 			'addons' => __( 'Addons', 'site-reviews' ),
106 106
 			'licenses' => __( 'Licenses', 'site-reviews' ),
107
-		]);
108
-		if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) {
109
-			unset( $tabs['addons'] );
107
+		] );
108
+		if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) {
109
+			unset($tabs['addons']);
110 110
 		}
111
-		if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) {
112
-			unset( $tabs['licenses'] );
111
+		if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) {
112
+			unset($tabs['licenses']);
113 113
 		}
114 114
 		$this->renderPage( 'settings', [
115 115
 			'notices' => $this->getNotices(),
116 116
 			'settings' => glsr( Settings::class ),
117 117
 			'tabs' => $tabs,
118
-		]);
118
+		] );
119 119
 	}
120 120
 
121 121
 	/**
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 			'sync' => __( 'Sync Reviews', 'site-reviews' ),
131 131
 			'console' => __( 'Console', 'site-reviews' ),
132 132
 			'system-info' => __( 'System Info', 'site-reviews' ),
133
-		]);
134
-		if( !apply_filters( 'site-reviews/addon/sync/enable', false )) {
135
-			unset( $tabs['sync'] );
133
+		] );
134
+		if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
135
+			unset($tabs['sync']);
136 136
 		}
137 137
 		$this->renderPage( 'tools', [
138 138
 			'data' => [
139 139
 				'context' => [
140
-					'console' => strval( glsr( Console::class )),
140
+					'console' => strval( glsr( Console::class ) ),
141 141
 					'id' => Application::ID,
142
-					'system' => strval( glsr( System::class )),
142
+					'system' => strval( glsr( System::class ) ),
143 143
 				],
144 144
 				'sites' => apply_filters( 'site-reviews/addon/sync/sites', [] ),
145 145
 			],
146 146
 			'notices' => $this->getNotices(),
147 147
 			'tabs' => $tabs,
148 148
 			'template' => glsr( Template::class ),
149
-		]);
149
+		] );
150 150
 	}
151 151
 
152 152
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	{
168 168
 		return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
169 169
 			'id' => 'glsr-notices',
170
-		]);
170
+		] );
171 171
 	}
172 172
 
173 173
 	/**
Please login to merge, or discard this patch.