Passed
Push — master ( fa9b37...f0273c )
by Paul
11:22 queued 05:25
created
src/Config/ConfigManager.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 		$yamlFile = $this->getYamlFile();
43 43
 		$yaml = $this->normalizeYamlValues( $this->normalize(
44 44
 			$this->parseYaml( file_get_contents( $yamlFile ), $yamlFile )
45
-		));
45
+		) );
46 46
 		if( !$yaml['disable_config'] ) {
47
-			$config = array_filter( (array) get_option( Config::id(), [] ));
47
+			$config = array_filter( (array)get_option( Config::id(), [] ) );
48 48
 		}
49
-		return empty( $config )
50
-			? $this->setTimestamp( $yaml, filemtime( $yamlFile ))
51
-			: $this->normalizeYamlValues( $this->normalize( $config ));
49
+		return empty($config)
50
+			? $this->setTimestamp( $yaml, filemtime( $yamlFile ) )
51
+			: $this->normalizeYamlValues( $this->normalize( $config ) );
52 52
 	}
53 53
 
54 54
 	/**
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 	public function compile( $force = false )
59 59
 	{
60 60
 		$configFile = $this->getCompileDestination();
61
-		if( $force || $this->shouldCompile( $configFile )) {
61
+		if( $force || $this->shouldCompile( $configFile ) ) {
62 62
 			$config = $this->normalizeArray( $this->options );
63 63
 			if( $this->parseError ) {
64
-				return (object) $config;
64
+				return (object)$config;
65 65
 			}
66 66
 			file_put_contents( $configFile, sprintf( '<?php // DO NOT MODIFY THIS FILE DIRECTLY!%sreturn (object) %s;',
67 67
 				PHP_EOL,
68
-				$this->parseRawStrings( var_export( $this->setTimestamp( $config ), true ))
69
-			));
68
+				$this->parseRawStrings( var_export( $this->setTimestamp( $config ), true ) )
69
+			) );
70 70
 		}
71 71
 		return include $configFile;
72 72
 	}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function convertArrayToYaml( array $array )
78 78
 	{
79
-		return !empty( $array )
80
-			? trim( $this->parseRawStrings( $this->dumpYaml( $array )))
79
+		return !empty($array)
80
+			? trim( $this->parseRawStrings( $this->dumpYaml( $array ) ) )
81 81
 			: '';
82 82
 	}
83 83
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function getYamlFile()
99 99
 	{
100
-		if( $file = $this->app->getFile( 'pollux.yml' )) {
100
+		if( $file = $this->app->getFile( 'pollux.yml' ) ) {
101 101
 			return $file;
102 102
 		}
103 103
 		return $this->app->path( 'defaults.yml' );
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	public function normalizeArray( array $array )
110 110
 	{
111 111
 		array_walk( $array, function( &$value, $key ) {
112
-			if( !is_numeric( $value ) && is_string( $value )) {
112
+			if( !is_numeric( $value ) && is_string( $value ) ) {
113 113
 				$value = $this->parseYaml( $value, $key );
114 114
 				if( $this->parseError == $key ) {
115 115
 					$value = [];
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		return wp_parse_args(
163 163
 			$config,
164 164
 			$this->parseYaml(
165
-				file_get_contents( $this->app->path( 'defaults.yml' )),
165
+				file_get_contents( $this->app->path( 'defaults.yml' ) ),
166 166
 				$this->app->path( 'defaults.yml' )
167 167
 			)
168 168
 		);
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	protected function parseRawStrings( $configString )
177 177
 	{
178 178
 		$strings = apply_filters( 'pollux/config/raw_strings', static::RAW_STRINGS );
179
-		if( empty( $strings )) {
179
+		if( empty($strings) ) {
180 180
 			return $configString;
181 181
 		}
182
-		$pattern = '/(\')((' . implode( '|', $strings ) . ')\(?.+\))(\')/';
182
+		$pattern = '/(\')(('.implode( '|', $strings ).')\(?.+\))(\')/';
183 183
 		return stripslashes(
184 184
 			preg_replace_callback( $pattern, function( $matches ) {
185 185
 				return str_replace( "''", "'", $matches[2] );
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 	protected function parseYaml( $value, $file = null )
195 195
 	{
196 196
 		try {
197
-			return (array) Yaml::parse( $value );
197
+			return (array)Yaml::parse( $value );
198 198
 		}
199 199
 		catch( ParseException $e ) {
200 200
 			$this->parseError = $file;
201 201
 			if( $file ) {
202 202
 				$file = sprintf( '<code>%s</code>', $file );
203 203
 			}
204
-			$this->app->make( 'Notice' )->addError([
204
+			$this->app->make( 'Notice' )->addError( [
205 205
 				sprintf( '<strong>Pollux Error:</strong> Unable to parse config at line %s (near "%s").',
206 206
 					$e->getParsedLine(),
207 207
 					$e->getSnippet()
208 208
 				),
209 209
 				$file
210
-			]);
210
+			] );
211 211
 			return $value;
212 212
 		}
213 213
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	protected function shouldCompile( $configFile )
220 220
 	{
221
-		if( !file_exists( $configFile )) {
221
+		if( !file_exists( $configFile ) ) {
222 222
 			return true;
223 223
 		}
224 224
 		$config = include $configFile;
Please login to merge, or discard this patch.
src/GateKeeper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	{
37 37
 		$this->notice = pollux_app()->make( 'Notice' );
38 38
 
39
-		add_action( 'current_screen',                         [$this, 'activatePlugin'] );
39
+		add_action( 'current_screen', [$this, 'activatePlugin'] );
40 40
 		add_action( 'wp_ajax_pollux/dependency/activate_url', [$this, 'ajaxActivatePluginLink'] );
41
-		add_action( 'admin_notices',                          [$this, 'printNotices'] );
42
-		add_action( 'current_screen',                         [$this, 'setDependencyNotice'] );
41
+		add_action( 'admin_notices', [$this, 'printNotices'] );
42
+		add_action( 'current_screen', [$this, 'setDependencyNotice'] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 			|| filter_input( INPUT_GET, 'action' ) != 'activate'
52 52
 		)return;
53 53
 		$plugin = filter_input( INPUT_GET, 'plugin' );
54
-		check_admin_referer( 'activate-plugin_' . $plugin );
54
+		check_admin_referer( 'activate-plugin_'.$plugin );
55 55
 		$result = activate_plugin( $plugin, null, is_network_admin(), true );
56
-		if( is_wp_error( $result )) {
56
+		if( is_wp_error( $result ) ) {
57 57
 			wp_die( $result->get_error_message() );
58 58
 		}
59 59
 		wp_safe_redirect( wp_get_referer() );
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		check_ajax_referer( 'updates' );
69 69
 		$plugin = filter_input( INPUT_POST, 'plugin' );
70
-		if( !$this->isPluginDependency( $plugin )) {
70
+		if( !$this->isPluginDependency( $plugin ) ) {
71 71
 			wp_send_json_error();
72 72
 		}
73
-		$activateUrl = add_query_arg([
74
-			'_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin )),
73
+		$activateUrl = add_query_arg( [
74
+			'_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin ) ),
75 75
 			'action' => 'activate',
76 76
 			'page' => pollux_app()->id,
77 77
 			'plugin' => $plugin,
78
-		], self_admin_url( 'options-general.php' ));
79
-		wp_send_json_success([
78
+		], self_admin_url( 'options-general.php' ) );
79
+		wp_send_json_success( [
80 80
 			'activate_url' => $activateUrl,
81 81
 			filter_input( INPUT_POST, 'type' ) => $plugin,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function hasDependency( $plugin )
89 89
 	{
90
-		if( !$this->isPluginDependency( $plugin )) {
90
+		if( !$this->isPluginDependency( $plugin ) ) {
91 91
 			return true;
92 92
 		}
93 93
 		return $this->isPluginInstalled( $plugin ) && $this->isPluginValid( $plugin );
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	public function hasPendingDependencies()
100 100
 	{
101 101
 		foreach( static::DEPENDENCIES as $plugin => $data ) {
102
-			if( !$this->isPluginDependency( $plugin ))continue;
102
+			if( !$this->isPluginDependency( $plugin ) )continue;
103 103
 			$this->isPluginActive( $plugin );
104 104
 			$this->isPluginVersionValid( $plugin );
105 105
 		}
106
-		return !empty( $this->errors );
106
+		return !empty($this->errors);
107 107
 	}
108 108
 
109 109
 	/**
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function isPluginVersionValid( $plugin )
149 149
 	{
150
-		if( !$this->isPluginDependency( $plugin )) {
150
+		if( !$this->isPluginDependency( $plugin ) ) {
151 151
 			return true;
152 152
 		}
153
-		if( !$this->isPluginInstalled( $plugin )) {
153
+		if( !$this->isPluginInstalled( $plugin ) ) {
154 154
 			return false;
155 155
 		}
156 156
 		return $this->catchError( $plugin, 'wrong_version', version_compare(
157 157
 			$this->getPluginRequirements( $plugin, 'version' ),
158 158
 			$this->getAllPlugins()[$plugin]['Version'],
159 159
 			'<='
160
-		));
160
+		) );
161 161
 	}
162 162
 
163 163
 	/**
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	protected function catchError( $plugin, $error, $isValid )
196 196
 	{
197
-		if( !$isValid && $this->isPluginDependency( $plugin )) {
198
-			if( !isset( $this->errors[$plugin] )) {
197
+		if( !$isValid && $this->isPluginDependency( $plugin ) ) {
198
+			if( !isset($this->errors[$plugin]) ) {
199 199
 				$this->errors[$plugin] = [];
200 200
 			}
201 201
 			$this->errors[$plugin] = array_keys( array_flip(
202 202
 				array_merge( $this->errors[$plugin], [$error] )
203
-			));
203
+			) );
204 204
 		}
205 205
 		return $isValid;
206 206
 	}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	protected function getAllPlugins()
212 212
 	{
213
-		require_once ABSPATH . 'wp-admin/includes/plugin.php';
213
+		require_once ABSPATH.'wp-admin/includes/plugin.php';
214 214
 		return array_merge( get_plugins(), $this->getMustUsePlugins() );
215 215
 	}
216 216
 
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 	{
222 222
 		$actions = '';
223 223
 		foreach( $this->errors as $plugin => $errors ) {
224
-			if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' )) {
225
-				$actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin ));
224
+			if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' ) ) {
225
+				$actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin ) );
226 226
 			}
227
-			else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' )) {
228
-				$actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin ));
227
+			else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' ) ) {
228
+				$actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin ) );
229 229
 			}
230
-			else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' )) {
231
-				$actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin ));
230
+			else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' ) ) {
231
+				$actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin ) );
232 232
 			}
233 233
 		}
234 234
 		return $actions;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	protected function getDependencyLinks()
241 241
 	{
242 242
 		return array_reduce( array_keys( $this->errors ), function( $carry, $plugin ) {
243
-			return $carry . $this->getPluginLink( $plugin );
243
+			return $carry.$this->getPluginLink( $plugin );
244 244
 		});
245 245
 	}
246 246
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	protected function getMustUsePlugins()
251 251
 	{
252 252
 		$plugins = get_mu_plugins();
253
-		if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ))) {
253
+		if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ) ) ) {
254 254
 			$autoloadedPlugins = get_site_option( 'bedrock_autoloader' );
255
-			if( !empty( $autoloadedPlugins['plugins'] )) {
255
+			if( !empty($autoloadedPlugins['plugins']) ) {
256 256
 				return array_merge( $plugins, $autoloadedPlugins['plugins'] );
257 257
 			}
258 258
 		}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	protected function getPlugin( $plugin )
266 266
 	{
267
-		if( $this->isPluginInstalled( $plugin )) {
267
+		if( $this->isPluginInstalled( $plugin ) ) {
268 268
 			return $this->getAllPlugins()[$plugin];
269 269
 		}
270 270
 		return false;
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	protected function getPluginData( $plugin, $data, $key = null )
277 277
 	{
278
-		if( !is_array( $data )) {
279
-			throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin ));
278
+		if( !is_array( $data ) ) {
279
+			throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin ) );
280 280
 		}
281 281
 		$data['plugin'] = $plugin;
282 282
 		$data['slug'] = $this->getPluginSlug( $plugin );
283 283
 		$data = array_change_key_case( $data );
284
-		if( is_null( $key )) {
284
+		if( is_null( $key ) ) {
285 285
 			return $data;
286 286
 		}
287 287
 		$key = strtolower( $key );
288
-		return isset( $data[$key] )
288
+		return isset($data[$key])
289 289
 			? $data[$key]
290 290
 			: '';
291 291
 	}
@@ -333,6 +333,6 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	protected function getPluginSlug( $plugin )
335 335
 	{
336
-		return substr( $plugin, 0, strrpos( $plugin, '/' ));
336
+		return substr( $plugin, 0, strrpos( $plugin, '/' ) );
337 337
 	}
338 338
 }
Please login to merge, or discard this patch.
src/PostType/PostType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function init()
46 46
 	{
47
-		if( empty( $this->app->config->post_types ))return;
47
+		if( empty($this->app->config->post_types) )return;
48 48
 
49 49
 		$this->setColumns();
50 50
 		$this->normalize();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			get_post_types( ['_builtin' => true] )
65 65
 		);
66 66
 		array_walk( $types, function( $args, $type ) {
67
-			register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS )));
67
+			register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ) ) );
68 68
 		});
69 69
 	}
70 70
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	protected function normalizeLabels( $labels, array $args )
89 89
 	{
90
-		return wp_parse_args( $labels, $this->setLabels( $args ));
90
+		return wp_parse_args( $labels, $this->setLabels( $args ) );
91 91
 	}
92 92
 
93 93
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	protected function normalizeMenuName( $menuname, array $args )
98 98
 	{
99
-		return empty( $menuname )
99
+		return empty($menuname)
100 100
 			? $args['plural']
101 101
 			: $menuname;
102 102
 	}
Please login to merge, or discard this patch.
src/Facade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@
 block discarded – undo
102 102
 	 */
103 103
 	protected static function resolveFacadeInstance( $name )
104 104
 	{
105
-		if( is_object( $name )) {
105
+		if( is_object( $name ) ) {
106 106
 			return $name;
107 107
 		}
108 108
 
109
-		if( isset( static::$resolvedInstance[$name] )) {
109
+		if( isset(static::$resolvedInstance[$name]) ) {
110 110
 			return static::$resolvedInstance[$name];
111 111
 		}
112 112
 
Please login to merge, or discard this patch.
src/Container.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function getInstance()
39 39
 	{
40
-		if( is_null( static::$instance )) {
40
+		if( is_null( static::$instance ) ) {
41 41
 			static::$instance = new static;
42 42
 		}
43 43
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function make( $abstract )
70 70
 	{
71
-		$service = isset( $this->services[$abstract] )
71
+		$service = isset($this->services[$abstract])
72 72
 			? $this->services[$abstract]
73 73
 			: $this->addNamespace( $abstract );
74 74
 
75
-		if( is_callable( $service )) {
75
+		if( is_callable( $service ) ) {
76 76
 			return call_user_func_array( $service, [$this] );
77 77
 		}
78
-		if( is_object( $service )) {
78
+		if( is_object( $service ) ) {
79 79
 			return $service;
80 80
 		}
81 81
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function singleton( $abstract, $concrete )
94 94
 	{
95
-		$this->bind( $abstract, $this->make( $concrete ));
95
+		$this->bind( $abstract, $this->make( $concrete ) );
96 96
 	}
97 97
 
98 98
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function __get( $item )
106 106
 	{
107
-		return isset( $this->bucket[$item] )
107
+		return isset($this->bucket[$item])
108 108
 			? $this->bucket[$item]
109 109
 			: null;
110 110
 	}
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function addNamespace( $abstract )
143 143
 	{
144
-		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) {
145
-			$abstract = __NAMESPACE__ . "\\$abstract";
144
+		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) {
145
+			$abstract = __NAMESPACE__."\\$abstract";
146 146
 		}
147 147
 
148 148
 		return $abstract;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			return $this->notInstantiable( $concrete );
184 184
 		}
185 185
 
186
-		if( is_null(( $constructor = $reflector->getConstructor() ))) {
186
+		if( is_null( ($constructor = $reflector->getConstructor()) ) ) {
187 187
 			return new $concrete;
188 188
 		}
189 189
 
Please login to merge, or discard this patch.
pollux.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v3' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v3' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24 24
 if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 
29 29
 $app = GeminiLabs\Pollux\Application::getInstance();
30 30
 
31
-register_activation_hook( __FILE__, array( $app, 'onActivation' ));
32
-register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' ));
31
+register_activation_hook( __FILE__, array( $app, 'onActivation' ) );
32
+register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' ) );
33 33
 
34 34
 $app->register( new GeminiLabs\Pollux\Provider );
35 35
 $app->init();
Please login to merge, or discard this patch.
autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 spl_autoload_register( function( $class )
9 9
 {
10 10
 	$namespaces = [
11
-		'GeminiLabs\\Pollux\\' => __DIR__ . '/src/',
12
-		'GeminiLabs\\Pollux\\Tests\\' => __DIR__ . '/tests/',
13
-		'Symfony\\Component\\Yaml\\' => __DIR__ . '/vendor/symfony/yaml/',
11
+		'GeminiLabs\\Pollux\\' => __DIR__.'/src/',
12
+		'GeminiLabs\\Pollux\\Tests\\' => __DIR__.'/tests/',
13
+		'Symfony\\Component\\Yaml\\' => __DIR__.'/vendor/symfony/yaml/',
14 14
 	];
15 15
 	foreach( $namespaces as $prefix => $base_dir ) {
16 16
 		$len = strlen( $prefix );
17 17
 		if( strncmp( $prefix, $class, $len ) !== 0 )continue;
18
-		$file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php';
18
+		$file = $base_dir.str_replace( '\\', '/', substr( $class, $len ) ).'.php';
19 19
 		if( !file_exists( $file ) )continue;
20 20
 		require $file;
21 21
 		break;
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function filterPluginLinks( array $links )
29 29
 	{
30
-		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ));
30
+		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) );
31 31
 		$links[] = $this->app->config->disable_config
32
-			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ))
33
-			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ));
32
+			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ) )
33
+			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ) );
34 34
 		return $links;
35 35
 	}
36 36
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84 84
 			'dashboard_primary',
85 85
 			'dashboard_quick_press',
86
-		]);
86
+		] );
87 87
 		foreach( $widgets as $widget ) {
88 88
 			remove_meta_box( $widget, 'dashboard', 'normal' );
89 89
 		}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	protected function registerSettingsAssets( WP_Screen $screen )
154 154
 	{
155
-		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) {
155
+		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() ) ) {
156 156
 			wp_enqueue_script( 'common' );
157 157
 			wp_enqueue_script( 'postbox' );
158 158
 			wp_enqueue_script( 'wp-lists' );
Please login to merge, or discard this patch.
src/PostType/Archive.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		parent::init();
27 27
 
28 28
 		add_action( 'wp_ajax_pollux/archives/featured/html', [$this, 'getFeaturedImageHtml'] );
29
-		add_action( 'pollux/archives/init',                  [$this, 'registerFeaturedImageMetaBox'] );
30
-		add_action( 'pollux/archives/editor',                [$this, 'renderEditor'], 10, 2 );
31
-		add_action( 'wp_ajax_pollux/archives/featured',      [$this, 'setFeaturedImage'] );
32
-		add_filter( 'pollux/archives/metabox/submit',        [$this, 'filterSubmitMetaBox'] );
33
-		add_filter( 'pollux/archives/show/instructions',     '__return_true' );
29
+		add_action( 'pollux/archives/init', [$this, 'registerFeaturedImageMetaBox'] );
30
+		add_action( 'pollux/archives/editor', [$this, 'renderEditor'], 10, 2 );
31
+		add_action( 'wp_ajax_pollux/archives/featured', [$this, 'setFeaturedImage'] );
32
+		add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] );
33
+		add_filter( 'pollux/archives/show/instructions', '__return_true' );
34 34
 	}
35 35
 
36 36
 	public function canProceed()
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
49 49
 			array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) {
50
-				return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL;
50
+				return $instructions.$this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ).PHP_EOL;
51 51
 			})
52 52
 		);
53 53
 	}
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	public function filterSavedSettings( $settings )
71 71
 	{
72 72
 		return $this->filter( 'save', array_intersect_key(
73
-			array_merge( $this->getSettings(), Helper::toArray( $settings )),
73
+			array_merge( $this->getSettings(), Helper::toArray( $settings ) ),
74 74
 			$this->getPostTypesWithArchive()
75
-		));
75
+		) );
76 76
 	}
77 77
 
78 78
 	/**
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function getFeaturedImageHtml()
94 94
 	{
95
-		check_ajax_referer( sprintf( '%s-options', static::id() ));
95
+		check_ajax_referer( sprintf( '%s-options', static::id() ) );
96 96
 		static::$current = filter_input( INPUT_POST, 'post_type' );
97 97
 		ob_start();
98
-		$this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' )));
98
+		$this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' ) ) );
99 99
 		wp_send_json_success( ob_get_clean() );
100 100
 	}
101 101
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	public function register()
118 118
 	{
119 119
 		$screenId = Helper::getCurrentScreen()->id;
120
-		if( in_array( $screenId, $this->hooks )) {
120
+		if( in_array( $screenId, $this->hooks ) ) {
121 121
 			$this->hook = $screenId;
122 122
 		}
123 123
 		parent::register();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function registerFeaturedImageMetaBox()
131 131
 	{
132
-		if( !current_user_can( 'upload_files' ))return;
132
+		if( !current_user_can( 'upload_files' ) )return;
133 133
 		add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' );
134 134
 	}
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	public function registerPage()
141 141
 	{
142 142
 		foreach( $this->getPostTypesWithArchive() as $type => $page ) {
143
-			$labels = get_post_type_labels( get_post_type_object( $type ));
143
+			$labels = get_post_type_labels( get_post_type_object( $type ) );
144 144
 			$this->hooks[$type] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [
145 145
 				$page,
146 146
 				sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ),
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 				static::CAPABILITY,
149 149
 				sprintf( '%s_archive', $type ),
150 150
 				[$this, 'renderPage'],
151
-			]));
151
+			] ) );
152 152
 		}
153 153
 	}
154 154
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				'resize' => false,
170 170
 				'wp_autoresize_on' => true,
171 171
 			],
172
-		]);
172
+		] );
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function renderFeaturedImageMetaBox( $imageId = null )
180 180
 	{
181
-		if( !is_numeric( $imageId )) {
181
+		if( !is_numeric( $imageId ) ) {
182 182
 			$imageId = ArchiveMeta::get( $this->getPostType(), 'featured', -1 );
183 183
 		}
184
-		$imageSize = isset( wp_get_additional_image_sizes()['post-thumbnail'] )
184
+		$imageSize = isset(wp_get_additional_image_sizes()['post-thumbnail'])
185 185
 			? 'post-thumbnail'
186 186
 			: [266, 266];
187 187
 		$thumbnail = get_post( $imageId )
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			'post_type' => $this->getPostType(),
196 196
 			'remove_image' => __( 'Remove featured image', 'pollux' ),
197 197
 			'thumbnail' => $thumbnail,
198
-		]);
198
+		] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	public function renderPage()
206 206
 	{
207 207
 		$type = $this->getPostType();
208
-		if( empty( $type ))return;
209
-		$labels = get_post_type_labels( get_post_type_object( $type ));
208
+		if( empty($type) )return;
209
+		$labels = get_post_type_labels( get_post_type_object( $type ) );
210 210
 		$this->app->render( 'archive/index', [
211 211
 			'columns' => get_current_screen()->get_columns(),
212 212
 			'content' => ArchiveMeta::get( $type, 'content', '' ),
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			'id' => static::id(),
215 215
 			'post_type' => $type,
216 216
 			'title' => ArchiveMeta::get( $type, 'title', '' ),
217
-		]);
217
+		] );
218 218
 	}
219 219
 
220 220
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	protected function getPostType()
232 232
 	{
233 233
 		$type = array_search( $this->hook, $this->hooks );
234
-		if( !empty( $type ) && is_string( $type )) {
234
+		if( !empty($type) && is_string( $type ) ) {
235 235
 			static::$current = $type;
236 236
 		}
237 237
 		return static::$current;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	{
245 245
 		$types = array_map( function( $value ) {
246 246
 			return sprintf( 'edit.php?post_type=%s', $value );
247
-		}, get_post_types( ['has_archive' => 1] ));
247
+		}, get_post_types( ['has_archive' => 1] ) );
248 248
 		return array_merge( $types, ['post' => 'edit.php'] );
249 249
 	}
250 250
 
@@ -253,6 +253,6 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	protected function getSettings()
255 255
 	{
256
-		return (array) ArchiveMeta::all();
256
+		return (array)ArchiveMeta::all();
257 257
 	}
258 258
 }
Please login to merge, or discard this patch.