Passed
Push — master ( fa9b37...f0273c )
by Paul
11:22 queued 05:25
created
src/MetaBox/Instruction.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		$instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) {
24 24
 			$fields = $this->getInstructionFields( $metabox );
25
-			if( empty( $fields )) {
25
+			if( empty($fields) ) {
26 26
 				return $html;
27 27
 			}
28
-			return $html . sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
28
+			return $html.sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
29 29
 				$metabox['title'],
30 30
 				$fields
31 31
 			);
32 32
 		});
33
-		return $this->filter( 'before/instructions', '' ) . $instructions . $this->filter( 'after/instructions', '' );
33
+		return $this->filter( 'before/instructions', '' ).$instructions.$this->filter( 'after/instructions', '' );
34 34
 	}
35 35
 
36 36
 	/**
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	protected function getInstructionFields( $metabox )
40 40
 	{
41 41
 		$skipFields = ['custom_html', 'divider', 'heading', 'taxonomy'];
42
-		return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox, $skipFields ) {
42
+		return array_reduce( $metabox['fields'], function( $html, $field ) use($metabox, $skipFields) {
43 43
 			return $this->validate( $field['condition'] ) && !in_array( $field['type'], $skipFields )
44
-				? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL
44
+				? $html.$this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ).PHP_EOL
45 45
 				: $html;
46 46
 		});
47 47
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) {
87 87
 			return $this->show( false, $metabox );
88
-		})) > 0 );
88
+		}) ) > 0 );
89 89
 	}
90 90
 
91 91
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@
 block discarded – undo
62 62
 	 */
63 63
 	protected function initInstructions()
64 64
 	{
65
-		if( !$this->showInstructions() )return;
65
+		if( !$this->showInstructions() ) {
66
+			return;
67
+		}
66 68
 		return [
67 69
 			'infodiv' => [
68 70
 				'context' => 'side',
Please login to merge, or discard this patch.
src/Notice.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$method = strtolower( $name );
31 31
 		$status = substr( $method, 3 );
32
-		if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] )) {
33
-			return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args ));
32
+		if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] ) ) {
33
+			return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args ) );
34 34
 		}
35
-		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
35
+		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ) );
36 36
 	}
37 37
 
38 38
 	public function __get( $property )
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		if( $property == 'all' ) {
41 41
 			return $this->app->notices;
42 42
 		}
43
-		throw new Exception( sprintf( 'Not a valid property: %s', $property ));
43
+		throw new Exception( sprintf( 'Not a valid property: %s', $property ) );
44 44
 	}
45 45
 
46 46
 	/**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function activateButton( array $plugin )
50 50
 	{
51
-		$actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] ));
51
+		$actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] ) );
52 52
 		return $this->button( sprintf( '%s %s', __( 'Activate', 'pollux' ), $plugin['name'] ), [
53 53
 			'data-name' => $plugin['name'],
54 54
 			'data-plugin' => $plugin['plugin'],
55 55
 			'data-slug' => $plugin['slug'],
56
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] )),
57
-		]);
56
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] ) ),
57
+		] );
58 58
 	}
59 59
 
60 60
 	/**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 		$atts = wp_parse_args( $atts, [
67 67
 			'class' => '',
68 68
 			'href' => '',
69
-		]);
70
-		$atts['class'] = trim( $atts['class'] . ' button button-small' );
71
-		$attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use( $atts ) {
72
-			return $carry . sprintf( ' %s="%s"', $key, $atts[$key] );
69
+		] );
70
+		$atts['class'] = trim( $atts['class'].' button button-small' );
71
+		$attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use($atts) {
72
+			return $carry.sprintf( ' %s="%s"', $key, $atts[$key] );
73 73
 		});
74 74
 		return sprintf( '<a%s>%s</a>', $attributes, $title );
75 75
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		if( $unset ) {
83 83
 			$index = array_search( $notice, $this->app->notices );
84 84
 			if( $index !== false ) {
85
-				unset( $this->app->notices[$index] );
85
+				unset($this->app->notices[$index]);
86 86
 			}
87 87
 		}
88 88
 		return $this->buildNotice( $notice );
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function installButton( array $plugin )
95 95
 	{
96
-		$actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] ));
96
+		$actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] ) );
97 97
 		return $this->button( sprintf( '%s %s', __( 'Install', 'pollux' ), $plugin['name'] ), [
98 98
 			'data-name' => $plugin['name'],
99 99
 			'data-plugin' => $plugin['plugin'],
100 100
 			'data-slug' => $plugin['slug'],
101
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] )),
102
-		]);
101
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] ) ),
102
+		] );
103 103
 	}
104 104
 
105 105
 	/**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function updateButton( array $plugin )
109 109
 	{
110
-		$actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] ));
110
+		$actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] ) );
111 111
 		return $this->button( sprintf( '%s %s', __( 'Update', 'pollux' ), $plugin['name'] ), [
112 112
 			'data-name' => $plugin['name'],
113 113
 			'data-plugin' => $plugin['plugin'],
114 114
 			'data-slug' => $plugin['slug'],
115
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] )),
116
-		]);
115
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] ) ),
116
+		] );
117 117
 	}
118 118
 
119 119
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	{
136 136
 		$this->app->notices[] = [
137 137
 			'dismissible' => $dismissible,
138
-			'message' => $this->buildMessage( array_filter( (array) $messages )),
138
+			'message' => $this->buildMessage( array_filter( (array)$messages ) ),
139 139
 			'type' => $type,
140 140
 		];
141 141
 		$this->app->notices = array_unique( $this->app->notices, SORT_REGULAR );
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	protected function buildMessage( array $messages )
148 148
 	{
149 149
 		foreach( $messages as $key => &$message ) {
150
-			if( !is_wp_error( $message ))continue;
150
+			if( !is_wp_error( $message ) )continue;
151 151
 			$message = $message->get_error_message();
152 152
 		}
153
-		return wpautop( implode( PHP_EOL . PHP_EOL, $messages ));
153
+		return wpautop( implode( PHP_EOL.PHP_EOL, $messages ) );
154 154
 	}
155 155
 
156 156
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,9 @@
 block discarded – undo
147 147
 	protected function buildMessage( array $messages )
148 148
 	{
149 149
 		foreach( $messages as $key => &$message ) {
150
-			if( !is_wp_error( $message ))continue;
150
+			if( !is_wp_error( $message )) {
151
+				continue;
152
+			}
151 153
 			$message = $message->get_error_message();
152 154
 		}
153 155
 		return wpautop( implode( PHP_EOL . PHP_EOL, $messages ));
Please login to merge, or discard this patch.
src/Application.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function __construct()
33 33
 	{
34
-		$this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' );
35
-		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ));
34
+		$this->file = realpath( dirname( dirname( __FILE__ ) ).'/pollux.php' );
35
+		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) );
36 36
 
37 37
 		$data = get_file_data( $this->file, array(
38 38
 			'id' => 'Text Domain',
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 		add_action( 'plugins_loaded', function() {
59 59
 			$this->bootstrap();
60 60
 		});
61
-		add_action( 'admin_enqueue_scripts',           array( $controller, 'registerAssets' ));
62
-		add_action( 'admin_init',                      array( $controller, 'removeDashboardWidgets' ));
63
-		add_action( 'wp_before_admin_bar_render',      array( $controller, 'removeWordPressMenu' ));
64
-		add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ));
65
-		add_filter( 'admin_footer_text',               array( $controller, 'filterWordPressFooter' ));
61
+		add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) );
62
+		add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) );
63
+		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) );
64
+		add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ) );
65
+		add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) );
66 66
 
67 67
 		// Disallow indexing of the site on non-production environments
68 68
 		if( !$this->environment( 'production' ) && !is_admin() ) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public function environment( $checkFor = '' )
78 78
 	{
79 79
 		$environment = defined( 'WP_ENV' ) ? WP_ENV : 'production';
80
-		if( !empty( $checkFor )) {
80
+		if( !empty($checkFor) ) {
81 81
 			return $environment == $checkFor;
82 82
 		}
83 83
 		return $environment;
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 		$theme = wp_get_theme();
93 93
 		$filename = apply_filters( 'pollux/file', $filename );
94 94
 		$locations = apply_filters( 'pollux/file/locations', [
95
-			trailingslashit( trailingslashit( $theme->theme_root ) . $theme->stylesheet ),
96
-			trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ),
95
+			trailingslashit( trailingslashit( $theme->theme_root ).$theme->stylesheet ),
96
+			trailingslashit( trailingslashit( $theme->theme_root ).$theme->template ),
97 97
 			trailingslashit( WP_CONTENT_DIR ),
98 98
 			trailingslashit( ABSPATH ),
99
-			trailingslashit( dirname( ABSPATH )),
100
-			trailingslashit( dirname( dirname( ABSPATH ))),
101
-		]);
102
-		foreach( (array) $locations as $location ) {
103
-			if( !file_exists( $location . $filename ))continue;
104
-			return $location . $filename;
99
+			trailingslashit( dirname( ABSPATH ) ),
100
+			trailingslashit( dirname( dirname( ABSPATH ) ) ),
101
+		] );
102
+		foreach( (array)$locations as $location ) {
103
+			if( !file_exists( $location.$filename ) )continue;
104
+			return $location.$filename;
105 105
 		}
106 106
 		return null;
107 107
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function path( $file = '' )
128 128
 	{
129
-		return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' );
129
+		return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' );
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	public function render( $view, array $data = [] )
137 137
 	{
138 138
 		$file = apply_filters( 'pollux/views/file',
139
-			$this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))),
139
+			$this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ),
140 140
 			$view,
141 141
 			$data
142 142
 		);
143
-		if( !file_exists( $file ))return;
143
+		if( !file_exists( $file ) )return;
144 144
 		extract( $data );
145 145
 		include $file;
146 146
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function url( $path = '' )
153 153
 	{
154
-		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ));
154
+		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
155 155
 	}
156 156
 
157 157
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function loadHooks()
186 186
 	{
187
-		if( $file = $this->getFile( 'pollux-hooks.php' )) {
187
+		if( $file = $this->getFile( 'pollux-hooks.php' ) ) {
188 188
 			include_once $file;
189 189
 		}
190 190
 	}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	protected function loadTextdomain()
196 196
 	{
197
-		load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ) . '/languages/' );
197
+		load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ).'/languages/' );
198 198
 	}
199 199
 
200 200
 	/**
@@ -206,6 +206,6 @@  discard block
 block discarded – undo
206 206
 			'ArchiveMeta' => 'GeminiLabs\Pollux\Facades\ArchiveMeta',
207 207
 			'PostMeta' => 'GeminiLabs\Pollux\Facades\PostMeta',
208 208
 			'SiteMeta' => 'GeminiLabs\Pollux\Facades\SiteMeta',
209
-		)))->register();
209
+		) ) )->register();
210 210
 	}
211 211
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,9 @@  discard block
 block discarded – undo
100 100
 			trailingslashit( dirname( dirname( ABSPATH ))),
101 101
 		]);
102 102
 		foreach( (array) $locations as $location ) {
103
-			if( !file_exists( $location . $filename ))continue;
103
+			if( !file_exists( $location . $filename )) {
104
+				continue;
105
+			}
104 106
 			return $location . $filename;
105 107
 		}
106 108
 		return null;
@@ -140,7 +142,9 @@  discard block
 block discarded – undo
140 142
 			$view,
141 143
 			$data
142 144
 		);
143
-		if( !file_exists( $file ))return;
145
+		if( !file_exists( $file )) {
146
+			return;
147
+		}
144 148
 		extract( $data );
145 149
 		include $file;
146 150
 	}
Please login to merge, or discard this patch.
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/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.