Passed
Push — master ( 576dc5...fc7b10 )
by Paul
04:33
created
plugin/Modules/System.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'inactive-plugin' => 'Inactive Plugins',
38 38
 			'setting' => 'Plugin Settings',
39 39
 		];
40
-		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) {
40
+		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) {
41 41
 			$methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' );
42 42
 			if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
43 43
 				return $carry.$this->implode( $details[$key], $systemDetails );
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$plugins = get_plugins();
56 56
 		$activePlugins = (array)get_option( 'active_plugins', [] );
57
-		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ));
58
-		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
57
+		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
58
+		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
59 59
 	}
60 60
 
61 61
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function getInactivePluginDetails()
80 80
 	{
81 81
 		$activePlugins = (array)get_option( 'active_plugins', [] );
82
-		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins )));
82
+		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
83 83
 	}
84 84
 
85 85
 	/**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$plugins = array_merge(
91 91
 			get_mu_plugins(),
92
-			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
92
+			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) )
93 93
 		);
94
-		if( empty( $plugins ))return;
94
+		if( empty($plugins) )return;
95 95
 		return $this->normalizePluginList( $plugins );
96 96
 	}
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function getMultisitePluginDetails()
102 102
 	{
103
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
103
+		if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return;
104 104
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
105 105
 	}
106 106
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 			'Max Input Vars' => ini_get( 'max_input_vars' ),
123 123
 			'Memory Limit' => ini_get( 'memory_limit' ),
124 124
 			'Post Max Size' => ini_get( 'post_max_size' ),
125
-			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )),
126
-			'Session Name' => esc_html( ini_get( 'session.name' )),
127
-			'Session Save Path' => esc_html( ini_get( 'session.save_path' )),
128
-			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ),
129
-			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ),
125
+			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ),
126
+			'Session Name' => esc_html( ini_get( 'session.name' ) ),
127
+			'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ),
128
+			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ),
129
+			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ),
130 130
 			'Upload Max Filesize' => ini_get( 'upload_max_filesize' ),
131 131
 		];
132 132
 	}
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		$settings = glsr( OptionManager::class )->get( 'settings', [] );
155 155
 		$settings = $helper->flattenArray( $settings, true );
156 156
 		foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) {
157
-			if( empty( $settings[$key] ))continue;
157
+			if( empty($settings[$key]) )continue;
158 158
 			$settings[$key] = str_repeat( '*', 10 );
159 159
 		}
160 160
 		$details = [];
161 161
 		foreach( $settings as $key => $value ) {
162
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
163
-			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
162
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue;
163
+			$value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
164 164
 			$details[$key] = $value;
165 165
 		}
166 166
 		return $details;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				return $value;
241 241
 			}
242 242
 		}
243
-		return implode( ',', array_filter( [DB_HOST, $serverName] ));
243
+		return implode( ',', array_filter( [DB_HOST, $serverName] ) );
244 244
 	}
245 245
 
246 246
 	/**
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	{
262 262
 		$plugins = get_plugins();
263 263
 		$activePlugins = (array)get_option( 'active_plugins', [] );
264
-		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins )));
265
-		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
264
+		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
265
+		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
266 266
 		return $active + $inactive;
267 267
 	}
268 268
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	protected function implode( $title, array $details )
274 274
 	{
275 275
 		$strings = ['['.$title.']'];
276
-		$padding = max( array_map( 'strlen', array_keys( $details )) );
276
+		$padding = max( array_map( 'strlen', array_keys( $details ) ) );
277 277
 		$padding = max( [$padding, static::PAD] );
278 278
 		foreach( $details as $key => $value ) {
279 279
 			$strings[] = is_string( $key )
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 			get_mu_plugins(),
92 92
 			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
93 93
 		);
94
-		if( empty( $plugins ))return;
94
+		if( empty( $plugins )) {
95
+			return;
96
+		}
95 97
 		return $this->normalizePluginList( $plugins );
96 98
 	}
97 99
 
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
 	 */
101 103
 	public function getMultisitePluginDetails()
102 104
 	{
103
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
105
+		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) {
106
+			return;
107
+		}
104 108
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
105 109
 	}
106 110
 
@@ -154,12 +158,16 @@  discard block
 block discarded – undo
154 158
 		$settings = glsr( OptionManager::class )->get( 'settings', [] );
155 159
 		$settings = $helper->flattenArray( $settings, true );
156 160
 		foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) {
157
-			if( empty( $settings[$key] ))continue;
161
+			if( empty( $settings[$key] )) {
162
+				continue;
163
+			}
158 164
 			$settings[$key] = str_repeat( '*', 10 );
159 165
 		}
160 166
 		$details = [];
161 167
 		foreach( $settings as $key => $value ) {
162
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
168
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) {
169
+				continue;
170
+			}
163 171
 			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
164 172
 			$details[$key] = $value;
165 173
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			: $this->$method( $id );
24 24
 		return glsr( Template::class )->build( 'pages/settings/'.$id, [
25 25
 			'context' => $context,
26
-		]);
26
+		] );
27 27
 	}
28 28
 
29 29
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	protected function getSettingFields( $path )
42 42
 	{
43 43
 		$settings = glsr( DefaultsManager::class )->settings();
44
-		return array_filter( $settings, function( $key ) use( $path ) {
44
+		return array_filter( $settings, function( $key ) use($path) {
45 45
 			return glsr( Helper::class )->startsWith( $path, $key );
46 46
 		}, ARRAY_FILTER_USE_KEY );
47 47
 	}
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	protected function getTemplateContext( $id )
54 54
 	{
55
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
55
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
56 56
 		$rows = '';
57 57
 		foreach( $fields as $name => $field ) {
58 58
 			$field = wp_parse_args( $field, ['name' => $name] );
59
-			$rows.= (new Field( $field ))->build();
59
+			$rows .= (new Field( $field ))->build();
60 60
 		}
61 61
 		return [
62 62
 			'rows' => $rows,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	protected function getTemplateContextForTranslations()
70 70
 	{
71 71
 		$translations = glsr( Translator::class )->renderAll();
72
-		$class = empty( $translations )
72
+		$class = empty($translations)
73 73
 			? 'glsr-hidden'
74 74
 			: '';
75 75
 		return [
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	{
25 25
 		wp_send_json( glsr( Html::class )->renderPartial( 'link', [
26 26
 			'post_id' => $request['ID'],
27
-		]));
27
+		] ) );
28 28
 	}
29 29
 
30 30
 	/**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function routerChangeReviewStatus( array $request )
34 34
 	{
35
-		wp_send_json( $this->execute( new ChangeStatus( $request )));
35
+		wp_send_json( $this->execute( new ChangeStatus( $request ) ) );
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	public function routerClearLog()
42 42
 	{
43 43
 		glsr( AdminController::class )->routerClearLog();
44
-		wp_send_json([
44
+		wp_send_json( [
45 45
 			'logger' => glsr( Logger::class )->get(),
46 46
 			'notices' => glsr( Notice::class )->get(),
47
-		]);
47
+		] );
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$shortcode = $request['shortcode'];
56 56
 		$response = false;
57
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
57
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
58 58
 			$data = glsr()->mceShortcodes[$shortcode];
59
-			if( !empty( $data['errors'] )) {
59
+			if( !empty($data['errors']) ) {
60 60
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
61 61
 			}
62 62
 			$response = [
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 	public function routerSearchPosts( array $request )
77 77
 	{
78 78
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
79
-		wp_send_json_success([
79
+		wp_send_json_success( [
80 80
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
81 81
 			'items' => $results,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function routerSearchTranslations( array $request )
89 89
 	{
90
-		if( empty( $request['exclude'] )) {
90
+		if( empty($request['exclude']) ) {
91 91
 			$request['exclude'] = [];
92 92
 		}
93 93
 		$results = glsr( Translator::class )
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 			->exclude()
96 96
 			->exclude( $request['exclude'] )
97 97
 			->renderResults();
98
-		wp_send_json_success([
98
+		wp_send_json_success( [
99 99
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
100 100
 			'items' => $results,
101
-		]);
101
+		] );
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$response = glsr( PublicController::class )->routerCreateReview( $request );
110 110
 		$session = glsr( Session::class );
111
-		wp_send_json([
111
+		wp_send_json( [
112 112
 			'errors' => $session->get( $request['form_id'].'-errors', false, true ),
113 113
 			'message' => $response,
114 114
 			'recaptcha' => $session->get( $request['form_id'].'-recaptcha', false, true ),
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function routerTogglePinned( array $request )
122 122
 	{
123
-		wp_send_json([
123
+		wp_send_json( [
124 124
 			'notices' => glsr( Notice::class )->get(),
125
-			'pinned' => $this->execute( new TogglePinned( $request )),
126
-		]);
125
+			'pinned' => $this->execute( new TogglePinned( $request ) ),
126
+		] );
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
plugin/Router.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  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'] )) {
20
+			return;
21
+		}
20 22
 		$this->checkNonce( $request['action'] );
21 23
 		$this->routeRequest( 'admin', $request['action'], $request );
22 24
 	}
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
 	public function routeWebhookRequest()
72 74
 	{
73 75
 		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
74
-		if( !$request )return;
76
+		if( !$request ) {
77
+			return;
78
+		}
75 79
 		// @todo manage webhook here
76 80
 	}
77 81
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 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
 		$this->routeRequest( 'admin', $request['action'], $request );
22 22
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	public function routeAjaxRequest()
28 28
 	{
29 29
 		$request = $this->normalizeAjaxRequest();
30
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
30
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
31 31
 			glsr_log()->error( 'Nonce check failed for ajax request' )->info( $request );
32 32
 			wp_die( -1, 403 );
33 33
 		}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function routeRequest( $type, $action, array $request = [] )
54 54
 	{
55
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
55
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
56 56
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
57
-		if( is_callable( [$controller, $method] )) {
57
+		if( is_callable( [$controller, $method] ) ) {
58 58
 			call_user_func( [$controller, $method], $request );
59 59
 			return;
60 60
 		}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function routeWebhookRequest()
72 72
 	{
73
-		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
73
+		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ) );
74 74
 		if( !$request )return;
75 75
 		// @todo manage webhook here
76 76
 	}
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 	protected function normalizeAjaxRequest()
110 110
 	{
111 111
 		$request = filter_input( INPUT_POST, 'request', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
112
-		if( isset( $request[Application::ID]['action'] )) {
112
+		if( isset($request[Application::ID]['action']) ) {
113 113
 			$request = $request[Application::ID];
114 114
 		}
115
-		if( !isset( $request['action'] )) {
115
+		if( !isset($request['action']) ) {
116 116
 			glsr_log()->error( 'The AJAX request must include an action' )->info( $request );
117 117
 			wp_die();
118 118
 		}
119
-		if( !isset( $request['nonce'] )) {
119
+		if( !isset($request['nonce']) ) {
120 120
 			glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request );
121 121
 			wp_die();
122 122
 		}
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	public function all()
25 25
 	{
26 26
 		$options = get_option( static::databaseKey(), [] );
27
-		if( !is_array( $options )) {
27
+		if( !is_array( $options ) ) {
28 28
 			delete_option( static::databaseKey() );
29 29
 			$options = ['settings' => []];
30 30
 		}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue;
46 46
 			$pointer = &$pointer[$key];
47 47
 		}
48
-		unset( $pointer[$last] );
48
+		unset($pointer[$last]);
49 49
 		return $this->set( $options );
50 50
 	}
51 51
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 			glsr( DefaultsManager::class )->defaults()
78 78
 		);
79 79
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
81
-			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
80
+			if( !is_string( $value ) )return;
81
+			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
82 82
 		});
83 83
 		return glsr( Helper::class )->convertDotNotationArray( $options );
84 84
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function set( $pathOrOptions, $value = '' )
92 92
 	{
93
-		if( is_string( $pathOrOptions )) {
93
+		if( is_string( $pathOrOptions ) ) {
94 94
 			$pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() );
95 95
 		}
96 96
 		return update_option( static::databaseKey(), (array)$pathOrOptions );
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) {
46
+				continue;
47
+			}
46 48
 			$pointer = &$pointer[$key];
47 49
 		}
48 50
 		unset( $pointer[$last] );
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			glsr( DefaultsManager::class )->defaults()
78 80
 		);
79 81
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
82
+			if( !is_string( $value )) {
83
+				return;
84
+			}
81 85
 			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
82 86
 		});
83 87
 		return glsr( Helper::class )->convertDotNotationArray( $options );
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
 			'aria-label' => '&#8220;'.esc_attr( $title ).'&#8221; ('.__( 'Edit', 'site-reviews' ).')',
38 38
 			'class' => 'row-title',
39 39
 			'href' => get_edit_post_link( $postId ),
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/Modules/ListTable/Columns.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderFilters( $postType )
88 88
 	{
89
-		if( $postType !== Application::POST_TYPE )return;
89
+		if( $postType !== Application::POST_TYPE ) {
90
+			return;
91
+		}
90 92
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
91 93
 			$status = 'publish';
92 94
 		}
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public function renderValues( $column, $postId )
105 107
 	{
106
-		if( glsr_current_screen()->post_type != Application::POST_TYPE )return;
108
+		if( glsr_current_screen()->post_type != Application::POST_TYPE ) {
109
+			return;
110
+		}
107 111
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
108 112
 		echo method_exists( $this, $method )
109 113
 			? call_user_func( [$this, $method], $postId )
@@ -116,7 +120,9 @@  discard block
 block discarded – undo
116 120
 	 */
117 121
 	protected function renderFilterRatings( $ratings )
118 122
 	{
119
-		if( empty( $ratings ))return;
123
+		if( empty( $ratings )) {
124
+			return;
125
+		}
120 126
 		$ratings = array_flip( array_reverse( $ratings ));
121 127
 		array_walk( $ratings, function( &$value, $key ) {
122 128
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -139,7 +145,9 @@  discard block
 block discarded – undo
139 145
 	 */
140 146
 	protected function renderFilterTypes( $types )
141 147
 	{
142
-		if( count( glsr()->reviewTypes ) < 2 )return;
148
+		if( count( glsr()->reviewTypes ) < 2 ) {
149
+			return;
150
+		}
143 151
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
144 152
 			'class' => 'screen-reader-text',
145 153
 			'for' => 'review_type',
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) {
23 23
 			$column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
24 24
 				'href' => (string)get_the_permalink( $assignedPost->ID ),
25
-			]);
25
+			] );
26 26
 		}
27 27
 		return $column;
28 28
 	}
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
37 37
 			? 'pinned '
38 38
 			: '';
39
-		return glsr( Builder::class )->i([
39
+		return glsr( Builder::class )->i( [
40 40
 			'class' => $pinned.'dashicons dashicons-sticky',
41 41
 			'data-id' => $postId,
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		return glsr( Html::class )->buildPartial( 'star-rating', [
62 62
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
63
-		]);
63
+		] );
64 64
 	}
65 65
 
66 66
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	public function buildColumnType( $postId )
71 71
 	{
72 72
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
73
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
73
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
74 74
 			? glsr()->reviewTypes[$reviewMeta->review_type]
75 75
 			: $reviewMeta->review_type;
76 76
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function renderFilters( $postType )
83 83
 	{
84 84
 		if( $postType !== Application::POST_TYPE )return;
85
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
85
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
86 86
 			$status = 'publish';
87 87
 		}
88 88
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function renderFilterRatings( $ratings )
113 113
 	{
114
-		if( empty( $ratings ))return;
115
-		$ratings = array_flip( array_reverse( $ratings ));
114
+		if( empty($ratings) )return;
115
+		$ratings = array_flip( array_reverse( $ratings ) );
116 116
 		array_walk( $ratings, function( &$value, $key ) {
117 117
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
118 118
 			$value = sprintf( $label, $key );
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 		echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
121 121
 			'class' => 'screen-reader-text',
122 122
 			'for' => 'rating',
123
-		]);
124
-		echo glsr( Builder::class )->select([
123
+		] );
124
+		echo glsr( Builder::class )->select( [
125 125
 			'name' => 'rating',
126 126
 			'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
127 127
 			'value' => filter_input( INPUT_GET, 'rating' ),
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
139 139
 			'class' => 'screen-reader-text',
140 140
 			'for' => 'review_type',
141
-		]);
142
-		echo glsr( Builder::class )->select([
141
+		] );
142
+		echo glsr( Builder::class )->select( [
143 143
 			'name' => 'review_type',
144 144
 			'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
145 145
 			'value' => filter_input( INPUT_GET, 'review_type' ),
146
-		]);
146
+		] );
147 147
 	}
148 148
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@
 block discarded – undo
51 51
 	protected function normalize( array $data )
52 52
 	{
53 53
 		$arrayKeys = ['context', 'globals'];
54
-		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ));
54
+		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) );
55 55
 		foreach( $arrayKeys as $key ) {
56
-			if( is_array( $data[$key] ))continue;
56
+			if( is_array( $data[$key] ) )continue;
57 57
 			$data[$key] = [];
58 58
 		}
59 59
 		return $data;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 		$arrayKeys = ['context', 'globals'];
54 54
 		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ));
55 55
 		foreach( $arrayKeys as $key ) {
56
-			if( is_array( $data[$key] ))continue;
56
+			if( is_array( $data[$key] )) {
57
+				continue;
58
+			}
57 59
 			$data[$key] = [];
58 60
 		}
59 61
 		return $data;
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
37 37
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
38
-		]);
38
+		] );
39 39
 		return $links;
40 40
 	}
41 41
 
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 	public function filterDashboardGlanceItems( array $items )
47 47
 	{
48 48
 		$postCount = wp_count_posts( Application::POST_TYPE );
49
-		if( empty( $postCount->publish )) {
49
+		if( empty($postCount->publish) ) {
50 50
 			return $items;
51 51
 		}
52 52
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
53
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
53
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
54 54
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
55 55
 			? glsr( Builder::class )->a( $text, [
56 56
 				'class' => 'glsr-review-count',
57 57
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
58
-			])
58
+			] )
59 59
 			: glsr( Builder::class )->span( $text, [
60 60
 				'class' => 'glsr-review-count',
61
-			]);
61
+			] );
62 62
 		return $items;
63 63
 	}
64 64
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public function filterTinymcePlugins( array $plugins )
70 70
 	{
71 71
 		if( user_can_richedit()
72
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
72
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
73 73
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
74 74
 		}
75 75
 		return $plugins;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function registerPointers()
83 83
 	{
84
-		$command = new RegisterPointers([[
84
+		$command = new RegisterPointers( [[
85 85
 			'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
86 86
 			'id' => 'glsr-pointer-pinned',
87 87
 			'position' => [
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'screen' => Application::POST_TYPE,
92 92
 			'target' => '#misc-pub-pinned',
93 93
 			'title' => __( 'Pin Your Reviews', 'site-reviews' ),
94
-		]]);
94
+		]] );
95 95
 		$this->execute( $command );
96 96
 	}
97 97
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function registerShortcodeButtons()
103 103
 	{
104
-		$command = new RegisterShortcodeButtons([
104
+		$command = new RegisterShortcodeButtons( [
105 105
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
106 106
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
107 107
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
108
-		]);
108
+		] );
109 109
 		$this->execute( $command );
110 110
 	}
111 111
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
119 119
 		glsr()->render( 'partials/editor/review', [
120 120
 			'post' => $post,
121
-		]);
121
+		] );
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function renderReviewNotice( WP_Post $post )
129 129
 	{
130
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
131
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
130
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
131
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
132 132
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
133 133
 			'context' => [
134 134
 				'notices' => glsr( Notice::class )->get(),
135 135
 			],
136
-		]);
136
+		] );
137 137
 	}
138 138
 
139 139
 	/**
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 		if( glsr_current_screen()->base != 'post' )return;
146 146
 		$shortcodes = [];
147 147
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
148
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
148
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
149 149
 			$shortcodes[$shortcode] = $values;
150 150
 		}
151
-		if( empty( $shortcodes ))return;
151
+		if( empty($shortcodes) )return;
152 152
 		glsr()->render( 'partials/editor/tinymce', [
153 153
 			'shortcodes' => $shortcodes,
154
-		]);
154
+		] );
155 155
 	}
156 156
 
157 157
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	public function routerClearLog()
161 161
 	{
162 162
 		glsr( Logger::class )->clear();
163
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
163
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
164 164
 	}
165 165
 
166 166
 	/**
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
 	{
195 195
 		$file = $_FILES['import-file'];
196 196
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
197
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
197
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
198 198
 		}
199
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
200
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
199
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
200
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
201 201
 		}
202 202
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
203
-		if( empty( $settings )) {
204
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
203
+		if( empty($settings) ) {
204
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
205 205
 		}
206
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
207
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
206
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
207
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
208 208
 	}
209 209
 
210 210
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
223 223
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
224 224
 		];
225
-		return !isset( $errors[$errorCode] )
225
+		return !isset($errors[$errorCode])
226 226
 			? __( 'Unknown upload error.', 'site-reviews' )
227 227
 			: $errors[$errorCode];
228 228
 	}
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function renderReviewEditor( WP_Post $post )
117 117
 	{
118
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
118
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
119
+			return;
120
+		}
119 121
 		glsr()->render( 'partials/editor/review', [
120 122
 			'post' => $post,
121 123
 		]);
@@ -127,7 +129,9 @@  discard block
 block discarded – undo
127 129
 	 */
128 130
 	public function renderReviewNotice( WP_Post $post )
129 131
 	{
130
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
132
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
133
+			return;
134
+		}
131 135
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
132 136
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
133 137
 			'context' => [
@@ -142,13 +146,19 @@  discard block
 block discarded – undo
142 146
 	 */
143 147
 	public function renderTinymceButton()
144 148
 	{
145
-		if( glsr_current_screen()->base != 'post' )return;
149
+		if( glsr_current_screen()->base != 'post' ) {
150
+			return;
151
+		}
146 152
 		$shortcodes = [];
147 153
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
148
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
154
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
155
+				continue;
156
+			}
149 157
 			$shortcodes[$shortcode] = $values;
150 158
 		}
151
-		if( empty( $shortcodes ))return;
159
+		if( empty( $shortcodes )) {
160
+			return;
161
+		}
152 162
 		glsr()->render( 'partials/editor/tinymce', [
153 163
 			'shortcodes' => $shortcodes,
154 164
 		]);
Please login to merge, or discard this patch.