Passed
Push — develop ( 83d763...37b65a )
by Paul
02:45
created
src/PostType/Archive.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		parent::init();
23 23
 
24
-		add_action( 'pollux/archives/saved',          [$this, 'addCustomNoticeOnSave'] );
25
-		add_action( 'pollux/archives/editor',         [$this, 'renderEditor'] );
26
-		add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] );
24
+		add_action( 'pollux/archives/saved', [ $this, 'addCustomNoticeOnSave' ] );
25
+		add_action( 'pollux/archives/editor', [ $this, 'renderEditor' ] );
26
+		add_filter( 'pollux/archives/metabox/submit', [ $this, 'filterSubmitMetaBox' ] );
27 27
 	}
28 28
 
29 29
 	/**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			__( 'Archive', 'pollux' ),
50 50
 			'edit_theme_options',
51 51
 			static::id(),
52
-			[$this, 'renderPage'],
53
-		]));
52
+			[ $this, 'renderPage' ],
53
+		] ) );
54 54
 	}
55 55
 
56 56
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function filterSubmitMetaBox( array $args )
73 73
 	{
74
-		$args[1] = __( 'Save Archive', 'pollux' );
74
+		$args[ 1 ] = __( 'Save Archive', 'pollux' );
75 75
 		return $args;
76 76
 	}
77 77
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				'wp_autoresize_on' => true,
92 92
 				'add_unload_trigger' => false,
93 93
 			],
94
-		]);
94
+		] );
95 95
 	}
96 96
 
97 97
 	/**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			'heading' => sprintf( __( '%s Archive', 'pollux' ), 'Post' ),
107 107
 			'id' => static::id(),
108 108
 			'title' => ArchiveMeta::get( 'title' ),
109
-		]);
109
+		] );
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function getDefaults()
116 116
 	{
117
-		return [];
117
+		return [ ];
118 118
 	}
119 119
 
120 120
 	/**
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
 	public function __construct()
32 32
 	{
33
-		$this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' );
34
-		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ));
33
+		$this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' );
34
+		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) );
35 35
 
36 36
 		$data = get_file_data( $this->file, array(
37 37
 			'id' => 'Text Domain',
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$controller = $this->make( 'Controller' );
56 56
 
57
-		add_action( 'admin_enqueue_scripts',      array( $controller, 'registerAssets' ));
58
-		add_action( 'admin_init',                 array( $controller, 'removeDashboardWidgets' ));
59
-		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ));
60
-		add_filter( 'admin_footer_text',          array( $controller, 'filterWordPressFooter' ));
57
+		add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) );
58
+		add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) );
59
+		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) );
60
+		add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) );
61 61
 
62 62
 		// Disallow indexing of the site on non-production environments
63 63
 		if( !$this->environment( 'production' ) && !is_admin() ) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function environment( $checkFor = '' )
73 73
 	{
74 74
 		$environment = defined( 'WP_ENV' ) ? WP_ENV : 'production';
75
-		if( !empty( $checkFor )) {
75
+		if( !empty( $checkFor ) ) {
76 76
 			return $environment == $checkFor;
77 77
 		}
78 78
 		return $environment;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function onActivation()
85 85
 	{
86
-		if( !get_option( Settings::id() )) {
87
-			update_option( Settings::id(), [] );
86
+		if( !get_option( Settings::id() ) ) {
87
+			update_option( Settings::id(), [ ] );
88 88
 		}
89 89
 	}
90 90
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function url( $path = '' )
112 112
 	{
113
-		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ));
113
+		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
114 114
 	}
115 115
 
116 116
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	{
121 121
 		Facade::clearResolvedInstances();
122 122
 		Facade::setFacadeApplication( $this );
123
-		$this->config = ( new Config( $this ))->get();
123
+		$this->config = ( new Config( $this ) )->get();
124 124
 		$this->registerAliases();
125 125
 		$classNames = array(
126 126
 			'MetaBox\MetaBox',
Please login to merge, or discard this patch.
src/Settings/Settings.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 		// @todo: run GateKeeper to check dependencies and capability (make sure it it run on the correct hook!)
45 45
 		// if( !is_plugin_active( 'meta-box/meta-box.php' ))return;
46 46
 
47
-		$this->normalize( $this->app->config[ static::ID ]);
47
+		$this->normalize( $this->app->config[ static::ID ] );
48 48
 
49
-		add_action( 'admin_menu',                        [$this, 'addPage'] );
50
-		add_action( 'pollux/'.static::ID.'/init',        [$this, 'addSubmitMetaBox'] );
51
-		add_action( 'current_screen',                    [$this, 'register'] );
52
-		add_action( 'admin_menu',                        [$this, 'registerSetting'] );
53
-		add_action( 'pollux/'.static::ID.'/init',        [$this, 'reset'] );
54
-		add_action( 'admin_print_footer_scripts',        [$this, 'renderFooterScript'] );
55
-		add_filter( 'pollux/'.static::ID.'/instruction', [$this, 'filterInstruction'], 10, 3 );
56
-		add_filter( 'wp_redirect',                       [$this, 'filterRedirectOnSave'] );
49
+		add_action( 'admin_menu', [ $this, 'addPage' ] );
50
+		add_action( 'pollux/' . static::ID . '/init', [ $this, 'addSubmitMetaBox' ] );
51
+		add_action( 'current_screen', [ $this, 'register' ] );
52
+		add_action( 'admin_menu', [ $this, 'registerSetting' ] );
53
+		add_action( 'pollux/' . static::ID . '/init', [ $this, 'reset' ] );
54
+		add_action( 'admin_print_footer_scripts', [ $this, 'renderFooterScript' ] );
55
+		add_filter( 'pollux/' . static::ID . '/instruction', [ $this, 'filterInstruction' ], 10, 3 );
56
+		add_filter( 'wp_redirect', [ $this, 'filterRedirectOnSave' ] );
57 57
 	}
58 58
 
59 59
 	/**
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	public function action()
63 63
 	{
64 64
 		$args = func_get_args();
65
-		$hook = sprintf( 'pollux/%s/%s', static::ID, array_shift( $args ));
66
-		return do_action_ref_array( $hook, array_filter( $args ));
65
+		$hook = sprintf( 'pollux/%s/%s', static::ID, array_shift( $args ) );
66
+		return do_action_ref_array( $hook, array_filter( $args ) );
67 67
 	}
68 68
 
69 69
 	/**
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 			__( 'Site Settings', 'pollux' ),
78 78
 			'edit_theme_options',
79 79
 			static::id(),
80
-			[$this, 'renderPage'],
80
+			[ $this, 'renderPage' ],
81 81
 			'dashicons-screenoptions',
82 82
 			1313
83
-		]));
83
+		] ) );
84 84
 	}
85 85
 
86 86
 	/**
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 		call_user_func_array( 'add_meta_box', $this->filter( 'metabox/submit', [
93 93
 			'submitdiv',
94 94
 			__( 'Save Settings', 'pollux' ),
95
-			[$this, 'renderSubmitMetaBox'],
95
+			[ $this, 'renderSubmitMetaBox' ],
96 96
 			$this->hook,
97 97
 			'side',
98 98
 			'high',
99
-		]));
99
+		] ) );
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	public function filter()
106 106
 	{
107 107
 		$args = func_get_args();
108
-		$hook = sprintf( 'pollux/%s/%s', static::ID, array_shift( $args ));
109
-		return apply_filters_ref_array( $hook, array_filter( $args ));
108
+		$hook = sprintf( 'pollux/%s/%s', static::ID, array_shift( $args ) );
109
+		return apply_filters_ref_array( $hook, array_filter( $args ) );
110 110
 	}
111 111
 
112 112
 	/**
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	public function filterRedirectOnSave( $location )
130 130
 	{
131 131
 		if( strpos( $location, 'settings-updated=true' ) === false
132
-			|| strpos( $location, sprintf( 'page=%s', static::id() )) === false ) {
132
+			|| strpos( $location, sprintf( 'page=%s', static::id() ) ) === false ) {
133 133
 			return $location;
134 134
 		}
135
-		return add_query_arg([
135
+		return add_query_arg( [
136 136
 			'page' => static::id(),
137 137
 			'settings-updated' => 'true',
138
-		], admin_url( 'admin.php' ));
138
+		], admin_url( 'admin.php' ) );
139 139
 	}
140 140
 
141 141
 	/**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function filterSavedSettings( $settings )
147 147
 	{
148
-		if( is_null( $settings )) {
149
-			$settings = [];
148
+		if( is_null( $settings ) ) {
149
+			$settings = [ ];
150 150
 		}
151 151
 		$this->action( 'saved' );
152 152
 		return $this->filter( 'save', $settings );
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function register()
160 160
 	{
161
-		if(( new Helper )->getCurrentScreen()->id != $this->hook )return;
161
+		if( ( new Helper )->getCurrentScreen()->id != $this->hook )return;
162 162
 		foreach( parent::register() as $metabox ) {
163 163
 			new RWMetaBox( $metabox );
164 164
 		}
165 165
 		add_screen_option( 'layout_columns', [
166 166
 			'max' => 2,
167 167
 			'default' => 2,
168
-		]);
168
+		] );
169 169
 		$this->action( 'init' );
170 170
 	}
171 171
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function registerSetting()
177 177
 	{
178
-		register_setting( static::id(), static::id(), [$this, 'filterSavedSettings'] );
178
+		register_setting( static::id(), static::id(), [ $this, 'filterSavedSettings' ] );
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function renderFooterScript()
186 186
 	{
187
-		if(( new Helper )->getCurrentScreen()->id != $this->hook )return;
187
+		if( ( new Helper )->getCurrentScreen()->id != $this->hook )return;
188 188
 		$this->render( 'settings/script', [
189 189
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
190 190
 			'hook' => $this->hook,
191 191
 			'id' => static::id(),
192
-		]);
192
+		] );
193 193
 	}
194 194
 
195 195
 	/**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			'columns' => get_current_screen()->get_columns(),
203 203
 			'heading' => __( 'Site Settings', 'pollux' ),
204 204
 			'id' => static::id(),
205
-		]);
205
+		] );
206 206
 	}
207 207
 
208 208
 	/**
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 		];
219 219
 		$this->render( 'settings/submit', [
220 220
 			'reset' => __( 'Reset', 'pollux' ),
221
-			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'admin.php' ))),
221
+			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'admin.php' ) ) ),
222 222
 			'submit' => get_submit_button( __( 'Save', 'pollux' ), 'primary', 'submit', false ),
223
-		]);
223
+		] );
224 224
 	}
225 225
 
226 226
 	/**
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
233 233
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
234 234
 		)return;
235
-		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
235
+		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook ) ) {
236 236
 			update_option( static::id(), $this->getDefaults() );
237 237
 			return add_settings_error( static::id(), 'reset', __( 'All values have been reset to defaults.', 'pollux' ), 'updated' );
238 238
 		}
239
-		add_settings_error( static::id(), 'reset', __( 'Failed to reset values. Please refresh the page and try again.', 'pollux' ));
239
+		add_settings_error( static::id(), 'reset', __( 'Failed to reset values. Please refresh the page and try again.', 'pollux' ) );
240 240
 	}
241 241
 
242 242
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	protected function filterArrayByKey( array $array, $key )
247 247
 	{
248 248
 		return array_filter( $array, function( $value ) use( $key ) {
249
-			return !empty( $value[$key] );
249
+			return !empty( $value[ $key ] );
250 250
 		});
251 251
 	}
252 252
 
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 
260 260
 		array_walk( $metaboxes, function( &$metabox ) {
261 261
 			$fields = array_map( function( $field ) {
262
-				$field = wp_parse_args( $field, ['std' => ''] );
263
-				return [$field['slug'] => $field['std']];
264
-			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
262
+				$field = wp_parse_args( $field, [ 'std' => '' ] );
263
+				return [ $field[ 'slug' ] => $field[ 'std' ] ];
264
+			}, $this->filterArrayByKey( $metabox[ 'fields' ], 'slug' ) );
265 265
 			$metabox = [
266
-				$metabox['slug'] => call_user_func_array( 'array_merge', $fields ),
266
+				$metabox[ 'slug' ] => call_user_func_array( 'array_merge', $fields ),
267 267
 			];
268 268
 		});
269 269
 		return call_user_func_array( 'array_merge', $metaboxes );
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	protected function normalizeFieldName( $name, array $data, $parentId )
286 286
 	{
287
-		return sprintf( '%s[%s][%s]', static::id(), $parentId, $data['slug'] );
287
+		return sprintf( '%s[%s][%s]', static::id(), $parentId, $data[ 'slug' ] );
288 288
 	}
289 289
 
290 290
 	/**
Please login to merge, or discard this patch.