Passed
Push — master ( 510e0e...2d2242 )
by Paul
02:20
created
src/Application.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 
24 24
 	public function __construct()
25 25
 	{
26
-		$this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' );
27
-		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ));
26
+		$this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' );
27
+		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) );
28 28
 
29 29
 		$data = get_file_data( $this->file, array(
30 30
 			'id' => 'Text Domain',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		Facade::clearResolvedInstances();
45 45
 		Facade::setFacadeApplication( $this );
46
-		$this->config = (new Config( $this ))->get();
46
+		$this->config = ( new Config( $this ) )->get();
47 47
 		$this->registerAliases();
48 48
 		$classNames = array(
49 49
 			'MetaBox', 'PostType', 'Taxonomy', 'Settings',
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function buildClassName( $name, $path = '' )
62 62
 	{
63
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
63
+		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) );
64 64
 		$className = implode( '', $className );
65 65
 		return !empty( $path )
66
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
66
+			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) )
67 67
 			: $className;
68 68
 	}
69 69
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function buildMethodName( $name, $prefix = 'get' )
76 76
 	{
77
-		return lcfirst( $this->buildClassName( $prefix . '-' . $name ));
77
+		return lcfirst( $this->buildClassName( $prefix . '-' . $name ) );
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	public function environment( $checkFor = '' )
85 85
 	{
86 86
 		$environment = defined( 'WP_ENV' ) ? WP_ENV : 'production';
87
-		if( !empty( $checkFor )) {
87
+		if( !empty( $checkFor ) ) {
88 88
 			return $environment == $checkFor;
89 89
 		}
90 90
 		return $environment;
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 
102 102
 		$controller = $this->make( 'Controller' );
103 103
 
104
-		add_filter( 'admin_footer_text',          array( $controller, 'filterWordPressFooter' ));
105
-		add_action( 'admin_enqueue_scripts',      array( $controller, 'registerAssets' ));
106
-		add_action( 'admin_init',                 array( $controller, 'removeDashboardWidgets' ));
107
-		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ));
104
+		add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) );
105
+		add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) );
106
+		add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) );
107
+		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) );
108 108
 
109 109
 		// Disallow indexing of the site on non-production environments
110 110
 		if( !$this->environment( 'production' ) && !is_admin() ) {
@@ -153,6 +153,6 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function url( $path = '' )
155 155
 	{
156
-		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ));
156
+		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
157 157
 	}
158 158
 }
Please login to merge, or discard this patch.
src/GateKeeper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$this->plugin = $plugin;
20 20
 
21
-		add_action( 'activated_plugin', array( $this, 'deactivate' ));
22
-		add_action( 'admin_notices',    array( $this, 'deactivate' ));
21
+		add_action( 'activated_plugin', array( $this, 'deactivate' ) );
22
+		add_action( 'admin_notices', array( $this, 'deactivate' ) );
23 23
 	}
24 24
 
25 25
 	/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			: sprintf( __( 'Sorry, Pollux requires PHP %s or greater in order to work properly (your server is running PHP %s).', 'pollux' ), self::MIN_PHP_VERSION, PHP_VERSION );
62 62
 
63 63
 		$message2 = $this->checkPhpVersion()
64
-			? sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), __( 'Update WordPress', 'pollux' ))
64
+			? sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), __( 'Update WordPress', 'pollux' ) )
65 65
 			: __( 'Please contact your hosting provider or server administrator to upgrade the version of PHP running on your server, or find an alternate plugin.', 'pollux' );
66 66
 
67 67
 		printf( '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s %s</p></div>',
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			filter_input( INPUT_GET, 'plugin_status' ),
89 89
 			filter_input( INPUT_GET, 'paged' ),
90 90
 			filter_input( INPUT_GET, 's' )
91
-		)));
91
+		) ) );
92 92
 		exit;
93 93
 	}
94 94
 }
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function init()
29 29
 	{
30
-		if( !is_plugin_active( 'meta-box/meta-box.php' ))return;
30
+		if( !is_plugin_active( 'meta-box/meta-box.php' ) )return;
31 31
 
32 32
 		$this->normalize();
33 33
 
34
-		add_action( 'admin_menu',                             [$this, 'addPage'] );
35
-		add_action( 'pollux/settings/init',                   [$this, 'addSubmitMetaBox'] );
36
-		add_filter( 'pollux/settings/instruction',            [$this, 'filterInstruction'], 10, 3 );
37
-		add_action( 'current_screen',                         [$this, 'register'] );
38
-		add_action( 'admin_footer-toplevel_page_' . self::ID, [$this, 'renderFooterScript'] );
34
+		add_action( 'admin_menu', [ $this, 'addPage' ] );
35
+		add_action( 'pollux/settings/init', [ $this, 'addSubmitMetaBox' ] );
36
+		add_filter( 'pollux/settings/instruction', [ $this, 'filterInstruction' ], 10, 3 );
37
+		add_action( 'current_screen', [ $this, 'register' ] );
38
+		add_action( 'admin_footer-toplevel_page_' . self::ID, [ $this, 'renderFooterScript' ] );
39 39
 
40 40
 		// add_filter( 'pollux/settings/save',        [$this, 'save'] );
41 41
 	}
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 			__( 'Site Settings', 'pollux' ),
51 51
 			'edit_theme_options',
52 52
 			self::ID,
53
-			[$this, 'renderPage'],
53
+			[ $this, 'renderPage' ],
54 54
 			'dashicons-screenoptions',
55 55
 			1313
56
-		]));
56
+		] ) );
57 57
 	}
58 58
 
59 59
 	/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		call_user_func_array( 'add_meta_box', apply_filters( 'pollux/settings/metabox/submit', [
65 65
 			'submitdiv',
66 66
 			__( 'Save Settings', 'pollux' ),
67
-			[ $this, 'renderSubmitMetaBox'],
67
+			[ $this, 'renderSubmitMetaBox' ],
68 68
 			$this->hook,
69 69
 			'side',
70 70
 			'high',
71
-		]));
71
+		] ) );
72 72
 	}
73 73
 
74 74
 	/**
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function isVisible( $bool, array $metabox )
87 87
 	{
88
-		if( defined( 'DOING_AJAX' ) && DOING_AJAX || !isset( $metabox['condition'] )) {
88
+		if( defined( 'DOING_AJAX' ) && DOING_AJAX || !isset( $metabox[ 'condition' ] ) ) {
89 89
 			return $bool;
90 90
 		}
91
-		return $this->verifyMetaBoxCondition( $metabox['condition'] );
91
+		return $this->verifyMetaBoxCondition( $metabox[ 'condition' ] );
92 92
 	}
93 93
 
94 94
 	/**
95 95
 	 * @return void
96 96
 	 */
97
-	public function register( $metaboxes = [] )
97
+	public function register( $metaboxes = [ ] )
98 98
 	{
99 99
 		if( get_current_screen()->id != $this->hook )return;
100 100
 		foreach( parent::register() as $metabox ) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
114 114
 			'hook' => $this->hook,
115 115
 			'id' => self::ID,
116
-		]);
116
+		] );
117 117
 	}
118 118
 
119 119
 	/**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		// add_screen_option( 'layout_columns', ['max' => 2, 'default' => 2] );
125 125
 		$this->render( 'settings/index', [
126
-			'columns' => 2,//get_current_screen()->get_columns(),
126
+			'columns' => 2, //get_current_screen()->get_columns(),
127 127
 			'id' => self::ID,
128 128
 			'title' => __( 'Site Settings', 'pollux' ),
129
-		]);
129
+		] );
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
 	public function renderSubmitMetaBox()
136 136
 	{
137 137
 		$query = [
138
-			'_wpnonce' => wp_create_nonce( sprintf( '%s-reset', self::ID )),
138
+			'_wpnonce' => wp_create_nonce( sprintf( '%s-reset', self::ID ) ),
139 139
 			'action' => 'reset_settings',
140 140
 			'page' => self::ID,
141 141
 		];
142 142
 		$this->render( 'settings/submit', [
143 143
 			'reset' => __( 'Reset Settings', 'pollux' ),
144
-			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'admin.php' ))),
144
+			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'admin.php' ) ) ),
145 145
 			'submit' => get_submit_button( __( 'Save', 'pollux' ), 'primary', 'submit', false ),
146
-		]);
146
+		] );
147 147
 	}
148 148
 
149 149
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	protected function getInstructions()
153 153
 	{
154 154
 		return array_filter( $this->metaboxes, function( $metabox ) {
155
-			return $this->verifyMetaBoxCondition( $metabox['condition'] );
155
+			return $this->verifyMetaBoxCondition( $metabox[ 'condition' ] );
156 156
 		});
157 157
 	}
158 158
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function getPostTypes()
163 163
 	{
164
-		return [];
164
+		return [ ];
165 165
 	}
166 166
 
167 167
 	/**
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function normalize()
171 171
 	{
172
-		$this->metaboxes = [];
173
-		foreach( $this->app->config['settings'] as $id => $metabox ) {
174
-			unset( $metabox['post_types'], $metabox['pages'] );
172
+		$this->metaboxes = [ ];
173
+		foreach( $this->app->config[ 'settings' ] as $id => $metabox ) {
174
+			unset( $metabox[ 'post_types' ], $metabox[ 'pages' ] );
175 175
 			$defaults = [
176
-				'condition' => [],
177
-				'fields' => [],
176
+				'condition' => [ ],
177
+				'fields' => [ ],
178 178
 				'id' => $id,
179 179
 				'slug' => $id,
180 180
 			];
181
-			$this->metaboxes[] = $this->normalizeThis( $metabox, $defaults, $id );
181
+			$this->metaboxes[ ] = $this->normalizeThis( $metabox, $defaults, $id );
182 182
 		}
183 183
 	}
184 184
 
185 185
 	protected function normalizeFieldName( $name, array $data, $parentId )
186 186
 	{
187
-		if( !empty( $name )) {
187
+		if( !empty( $name ) ) {
188 188
 			return $name;
189 189
 		}
190
-		$name = str_replace( sprintf( '%s-%s-', self::ID, $parentId ), '', $data['id'] );
190
+		$name = str_replace( sprintf( '%s-%s-', self::ID, $parentId ), '', $data[ 'id' ] );
191 191
 		return sprintf( '%s[%s][%s]', self::ID, $parentId, $name );
192 192
 	}
193 193
 
Please login to merge, or discard this patch.
src/Component.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 * @param string $view
31 31
 	 * @return void
32 32
 	 */
33
-	public function render( $view, array $data = [] )
33
+	public function render( $view, array $data = [ ] )
34 34
 	{
35 35
 		$file = apply_filters( 'pollux/views/file',
36
-			$this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))),
36
+			$this->app->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ),
37 37
 			$view,
38 38
 			$data
39 39
 		);
40
-		if( file_exists( $file )) {
40
+		if( file_exists( $file ) ) {
41 41
 			extract( $data );
42 42
 			return include $file;
43 43
 		}
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function getClassname( $toLowerCase = true )
51 51
 	{
52
-		$paths = explode( '\\', get_class( $this ));
52
+		$paths = explode( '\\', get_class( $this ) );
53 53
 		return wp_validate_boolean( $toLowerCase )
54
-			? strtolower( end( $paths ))
54
+			? strtolower( end( $paths ) )
55 55
 			: end( $paths );
56 56
 	}
57 57
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 		$data = wp_parse_args( $data, $defaults );
65 65
 		foreach( $defaults as $key => $value ) {
66 66
 			$method = $this->app->buildMethodName( $key, 'normalize' );
67
-			if( method_exists( $this, $method )) {
68
-				$data[$key] = $this->$method( $data[$key], $data, $id );
67
+			if( method_exists( $this, $method ) ) {
68
+				$data[ $key ] = $this->$method( $data[ $key ], $data, $id );
69 69
 			}
70 70
 		}
71 71
 		return $data;
Please login to merge, or discard this patch.
src/SiteMeta.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@
 block discarded – undo
45 45
 	 */
46 46
 	protected function normalize( array $options, $key, $fallback )
47 47
 	{
48
-		if( !array_key_exists( $key, $options )) {
48
+		if( !array_key_exists( $key, $options ) ) {
49 49
 			return $fallback;
50 50
 		}
51
-		$option = $options[$key];
51
+		$option = $options[ $key ];
52 52
 		$option = is_array( $option )
53 53
 			? array_filter( $option )
54 54
 			: trim( $option );
Please login to merge, or discard this patch.
src/Facade.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function clearResolvedInstances()
50 50
 	{
51
-		static::$resolvedInstance = [];
51
+		static::$resolvedInstance = [ ];
52 52
 	}
53 53
 
54 54
 	/**
@@ -102,14 +102,14 @@  discard block
 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] )) {
110
-			return static::$resolvedInstance[$name];
109
+		if( isset( static::$resolvedInstance[ $name ] ) ) {
110
+			return static::$resolvedInstance[ $name ];
111 111
 		}
112 112
 
113
-		return static::$resolvedInstance[$name] = static::$app->make( $name );
113
+		return static::$resolvedInstance[ $name ] = static::$app->make( $name );
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
src/PostMeta.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
 
7 7
 class PostMeta
8 8
 {
9
-	public function get( $metaKey, array $args = [] )
9
+	public function get( $metaKey, array $args = [ ] )
10 10
 	{
11
-		if( empty( $metaKey ))return;
11
+		if( empty( $metaKey ) )return;
12 12
 
13 13
 		$args = $this->normalize( $args );
14
-		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
15
-		$metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] );
14
+		$metaKey = $this->buildMetaKey( $metaKey, $args[ 'prefix' ] );
15
+		$metaValue = get_post_meta( $args[ 'id' ], $metaKey, $args[ 'single' ] );
16 16
 
17
-		if( is_string( $metaValue )) {
17
+		if( is_string( $metaValue ) ) {
18 18
 			$metaValue = trim( $metaValue );
19 19
 		}
20 20
 		return empty( $metaValue )
21
-			? $args['fallback']
21
+			? $args[ 'fallback' ]
22 22
 			: $metaValue;
23 23
 	}
24 24
 
25 25
 	protected function buildMetaKey( $metaKey, $prefix )
26 26
 	{
27
-		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ))
27
+		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ) )
28 28
 			? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey )
29 29
 			: $prefix . $metaKey;
30 30
 	}
@@ -37,6 +37,6 @@  discard block
 block discarded – undo
37 37
 			'single'   => true,
38 38
 			'prefix'   => Application::PREFIX,
39 39
 		];
40
-		return shortcode_atts( $defaults, array_change_key_case( $args ));
40
+		return shortcode_atts( $defaults, array_change_key_case( $args ) );
41 41
 	}
42 42
 }
Please login to merge, or discard this patch.