Completed
Push — develop ( 41e75c...71be25 )
by Paul
03:35
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 2 patches
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.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
 	{
50 50
 		if( get_current_screen()->id != sprintf( 'settings_page_%s', pollux_app()->id )
51 51
 			|| filter_input( INPUT_GET, 'action' ) != 'activate'
52
-		)return;
52
+		) {
53
+			return;
54
+		}
53 55
 		$plugin = filter_input( INPUT_GET, 'plugin' );
54 56
 		check_admin_referer( 'activate-plugin_' . $plugin );
55 57
 		$result = activate_plugin( $plugin, null, is_network_admin(), true );
@@ -99,7 +101,9 @@  discard block
 block discarded – undo
99 101
 	public function hasPendingDependencies()
100 102
 	{
101 103
 		foreach( static::DEPENDENCIES as $plugin => $data ) {
102
-			if( !$this->isPluginDependency( $plugin ))continue;
104
+			if( !$this->isPluginDependency( $plugin )) {
105
+				continue;
106
+			}
103 107
 			$this->isPluginActive( $plugin );
104 108
 			$this->isPluginVersionValid( $plugin );
105 109
 		}
@@ -178,7 +182,9 @@  discard block
 block discarded – undo
178 182
 		if( get_current_screen()->id != 'settings_page_pollux'
179 183
 			|| pollux_app()->config->disable_config
180 184
 			|| !$this->hasPendingDependencies()
181
-		)return;
185
+		) {
186
+			return;
187
+		}
182 188
 		$message = sprintf( '<strong>%s:</strong> %s',
183 189
 			__( 'Pollux requires the latest version of the following plugins', 'pollux' ),
184 190
 			$this->getDependencyLinks()
Please login to merge, or discard this patch.
src/PostType/PostType.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@
 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 )) {
48
+			return;
49
+		}
48 50
 
49 51
 		$this->setColumns();
50 52
 		$this->normalize();
Please login to merge, or discard this patch.
src/PostType/Columns.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 		foreach( $this->types as $type => $args ) {
25 25
 			add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 );
26
-			add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) {
26
+			add_filter( "manage_{$type}_posts_columns", function( $columns ) use($args) {
27 27
 				return count( $args['columns'] ) > 1
28 28
 					? $args['columns']
29 29
 					: $columns;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function printColumnValue( $name, $postId )
41 41
 	{
42
-		$method = ( new Helper )->buildMethodName( $name, 'getColumn' );
42
+		$method = (new Helper)->buildMethodName( $name, 'getColumn' );
43 43
 		echo method_exists( $this, $method )
44 44
 			? $this->$method( $postId )
45 45
 			: apply_filters( "pollux/post_type/column/{$name}", '&mdash;', $postId );
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
 	protected function getColumnThumbnail( $postId )
53 53
 	{
54 54
 		if( has_post_thumbnail( $postId ) ) {
55
-			list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), 'thumbnail' );
55
+			list($src, $width, $height) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), 'thumbnail' );
56 56
 			$thumbnail = sprintf( '<img src="%s" alt="%s" width="%s" height="%s">',
57
-				esc_url( set_url_scheme( $src )),
58
-				esc_attr( get_the_title( $postId )),
57
+				esc_url( set_url_scheme( $src ) ),
58
+				esc_attr( get_the_title( $postId ) ),
59 59
 				$width,
60 60
 				$height
61 61
 			);
62 62
 		}
63
-		return empty( $thumbnail )
63
+		return empty($thumbnail)
64 64
 			? '&mdash;'
65 65
 			: $thumbnail;
66 66
 	}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		return count( PostMeta::get( 'media', [
74 74
 			'fallback' => [],
75 75
 			'single' => false,
76
-		]));
76
+		] ) );
77 77
 	}
78 78
 
79 79
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	protected function normalizeColumns( array $columns )
92 92
 	{
93 93
 		$columns = array_flip( $columns );
94
-		$columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ));
94
+		$columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ) );
95 95
 		return ['cb' => '<input type="checkbox">'] + $columns;
96 96
 	}
97 97
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$defaults = [
104 104
 			'author' => __( 'Author', 'pollux' ),
105 105
 			'categories' => __( 'Categories', 'pollux' ),
106
-			'comments' => sprintf( '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>', __( 'Comments', 'pollux' )),
106
+			'comments' => sprintf( '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>', __( 'Comments', 'pollux' ) ),
107 107
 			'date' => __( 'Date', 'pollux' ),
108 108
 			'media' => __( 'Media', 'pollux' ),
109 109
 			'slug' => __( 'Slug', 'pollux' ),
Please login to merge, or discard this patch.
src/PostType/DisablePosts.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 
28 28
 		remove_action( 'welcome_panel', 'wp_welcome_panel' );
29 29
 
30
-		add_action( 'init',               [$this, 'disable'] );
30
+		add_action( 'init', [$this, 'disable'] );
31 31
 		add_action( 'wp_dashboard_setup', [$this, 'modifyDashboardWidgets'] );
32
-		add_action( 'welcome_panel',      [$this, 'modifyWelcomePanel'] );
33
-		add_action( 'admin_bar_menu',     [$this, 'removeFromAdminBar'], 999 );
34
-		add_action( 'admin_menu',         [$this, 'removeFromAdminMenu'] );
35
-		add_action( 'admin_init',         [$this, 'unregisterDashboardWidgets'] );
36
-		add_action( 'widgets_init',       [$this, 'unregisterWidgets'], 1 );
37
-		add_filter( 'posts_results',      [$this, 'filterPostQuery'] );
38
-		add_filter( 'pre_get_posts',      [$this, 'filterSearchQuery'] );
32
+		add_action( 'welcome_panel', [$this, 'modifyWelcomePanel'] );
33
+		add_action( 'admin_bar_menu', [$this, 'removeFromAdminBar'], 999 );
34
+		add_action( 'admin_menu', [$this, 'removeFromAdminMenu'] );
35
+		add_action( 'admin_init', [$this, 'unregisterDashboardWidgets'] );
36
+		add_action( 'widgets_init', [$this, 'unregisterWidgets'], 1 );
37
+		add_filter( 'posts_results', [$this, 'filterPostQuery'] );
38
+		add_filter( 'pre_get_posts', [$this, 'filterSearchQuery'] );
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function disable()
46 46
 	{
47
-		if( !in_array(( new Helper )->getCurrentScreen()->pagenow, [
47
+		if( !in_array( (new Helper)->getCurrentScreen()->pagenow, [
48 48
 			'edit.php', 'edit-tags.php', 'post-new.php',
49
-		]))return;
49
+		] ) )return;
50 50
 
51 51
 		if( !filter_input_array( INPUT_GET, [
52 52
 			'post_type' => FILTER_DEFAULT,
53 53
 			'taxonomy' => FILTER_DEFAULT,
54
-		])) {
54
+		] ) ) {
55 55
 			wp_safe_redirect( get_admin_url(), 301 );
56 56
 			exit;
57 57
 		}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		if( $this->isAdmin() || !$query->is_main_query() || !is_search() ) {
87 87
 			return $query;
88 88
 		}
89
-		$post_types = get_post_types( ['exclude_from_search' => false ] );
90
-		unset( $post_types['post'] );
89
+		$post_types = get_post_types( ['exclude_from_search' => false] );
90
+		unset($post_types['post']);
91 91
 		$query->set( 'post_type', array_values( $post_types ) );
92 92
 		return $query;
93 93
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function modifyDashboardWidgets()
100 100
 	{
101
-		if( !is_blog_admin() || !current_user_can( 'edit_posts' ))return;
101
+		if( !is_blog_admin() || !current_user_can( 'edit_posts' ) )return;
102 102
 
103 103
 		global $wp_meta_boxes;
104 104
 		$widgets = &$wp_meta_boxes['dashboard']['normal']['core'];
105
-		if( !isset( $widgets['dashboard_right_now']['callback'] ))return;
105
+		if( !isset($widgets['dashboard_right_now']['callback']) )return;
106 106
 		$widgets['dashboard_right_now']['callback'] = function() {
107 107
 			ob_start();
108 108
 			wp_dashboard_right_now();
@@ -166,6 +166,6 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function isAdmin()
168 168
 	{
169
-		return is_admin() || ( new Helper )->getCurrentScreen()->pagenow == 'wp-login.php';
169
+		return is_admin() || (new Helper)->getCurrentScreen()->pagenow == 'wp-login.php';
170 170
 	}
171 171
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function init()
25 25
 	{
26
-		if( !$this->app->config->disable_posts )return;
26
+		if( !$this->app->config->disable_posts ) {
27
+			return;
28
+		}
27 29
 
28 30
 		remove_action( 'welcome_panel', 'wp_welcome_panel' );
29 31
 
@@ -46,7 +48,9 @@  discard block
 block discarded – undo
46 48
 	{
47 49
 		if( !in_array(( new Helper )->getCurrentScreen()->pagenow, [
48 50
 			'edit.php', 'edit-tags.php', 'post-new.php',
49
-		]))return;
51
+		])) {
52
+			return;
53
+		}
50 54
 
51 55
 		if( !filter_input_array( INPUT_GET, [
52 56
 			'post_type' => FILTER_DEFAULT,
@@ -98,11 +102,15 @@  discard block
 block discarded – undo
98 102
 	 */
99 103
 	public function modifyDashboardWidgets()
100 104
 	{
101
-		if( !is_blog_admin() || !current_user_can( 'edit_posts' ))return;
105
+		if( !is_blog_admin() || !current_user_can( 'edit_posts' )) {
106
+			return;
107
+		}
102 108
 
103 109
 		global $wp_meta_boxes;
104 110
 		$widgets = &$wp_meta_boxes['dashboard']['normal']['core'];
105
-		if( !isset( $widgets['dashboard_right_now']['callback'] ))return;
111
+		if( !isset( $widgets['dashboard_right_now']['callback'] )) {
112
+			return;
113
+		}
106 114
 		$widgets['dashboard_right_now']['callback'] = function() {
107 115
 			ob_start();
108 116
 			wp_dashboard_right_now();
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.
uninstall.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/pollux.php';
6
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() )return;
6
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) {
7
+	return;
8
+}
7 9
 
8 10
 delete_option( GeminiLabs\Pollux\Config\Config::id() );
9 11
 delete_option( GeminiLabs\Pollux\PostType\Archive::id() );
Please login to merge, or discard this patch.
pollux.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v3' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
24
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) {
25
+	return;
26
+}
25 27
 require_once __DIR__.'/autoload.php';
26 28
 require_once __DIR__.'/helpers.php';
27 29
 require_once __DIR__.'/thirdparty.php';
Please login to merge, or discard this patch.
autoload.php 2 patches
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.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * PSR-4 autoloader
7 7
  */
8
-spl_autoload_register( function( $class )
9
-{
8
+spl_autoload_register( function( $class ) {
10 9
 	$namespaces = [
11 10
 		'GeminiLabs\\Pollux\\' => __DIR__ . '/src/',
12 11
 		'GeminiLabs\\Pollux\\Tests\\' => __DIR__ . '/tests/',
@@ -14,9 +13,13 @@  discard block
 block discarded – undo
14 13
 	];
15 14
 	foreach( $namespaces as $prefix => $base_dir ) {
16 15
 		$len = strlen( $prefix );
17
-		if( strncmp( $prefix, $class, $len ) !== 0 )continue;
16
+		if( strncmp( $prefix, $class, $len ) !== 0 ) {
17
+			continue;
18
+		}
18 19
 		$file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php';
19
-		if( !file_exists( $file ) )continue;
20
+		if( !file_exists( $file ) ) {
21
+			continue;
22
+		}
20 23
 		require $file;
21 24
 		break;
22 25
 	}
Please login to merge, or discard this patch.