Passed
Push — master ( fa9b37...f0273c )
by Paul
11:22 queued 05:25
created
src/PostType/Columns.php 1 patch
Spacing   +8 added lines, -8 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;
@@ -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   +14 added lines, -14 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
 	/**
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	{
47 47
 		if( !in_array( 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();
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( 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/Component.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$data = wp_parse_args( $data, $defaults );
40 40
 		foreach( $defaults as $key => $value ) {
41 41
 			$method = Helper::buildMethodName( $key, 'normalize' );
42
-			if( method_exists( $this, $method )) {
42
+			if( method_exists( $this, $method ) ) {
43 43
 				$data[$key] = $this->$method( $data[$key], $data, $id );
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
src/MetaBox/Condition.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function isAbsoluteConditionValid( $method, array $values )
69 69
 	{
70 70
 		foreach( $values as $value ) {
71
-			if( $this->$method( $value ))continue;
71
+			if( $this->$method( $value ) )continue;
72 72
 			return false;
73 73
 		}
74 74
 		return true;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	protected function isConditionValid( $key, $values )
83 83
 	{
84 84
 		$method = Helper::buildMethodName( $key, 'validate' );
85
-		if( !method_exists( $this, $method )) {
85
+		if( !method_exists( $this, $method ) ) {
86 86
 			return $this->validateUnknown( $key, $values );
87 87
 		}
88 88
 		$values = Helper::toArray( $values );
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	protected function isLooseConditionValid( $method, array $values )
99 99
 	{
100 100
 		foreach( $values as $value ) {
101
-			if( !$this->$method( $value ))continue;
101
+			if( !$this->$method( $value ) )continue;
102 102
 			return true;
103 103
 		}
104 104
 		return false;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function normalizeCondition( $conditions )
112 112
 	{
113
-		if( !is_array( $conditions )) {
113
+		if( !is_array( $conditions ) ) {
114 114
 			$conditions = [];
115 115
 		}
116
-		if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) {
116
+		if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) {
117 117
 			foreach( $conditions as $key ) {
118 118
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
119 119
 			}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 		return array_intersect_key(
125 125
 			$conditions,
126
-			array_flip( $this->filter( 'conditions', static::conditions() ))
126
+			array_flip( $this->filter( 'conditions', static::conditions() ) )
127 127
 		);
128 128
 	}
129 129
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function validateIsFrontPage( $value )
171 171
 	{
172
-		return $value == ( $this->getPostId() == get_option( 'page_on_front' ));
172
+		return $value == ($this->getPostId() == get_option( 'page_on_front' ));
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function validateIsHome( $value )
180 180
 	{
181
-		return $value == ( $this->getPostId() == get_option( 'page_for_posts' ));
181
+		return $value == ($this->getPostId() == get_option( 'page_for_posts' ));
182 182
 	}
183 183
 
184 184
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	protected function validateIsPageTemplate( $value )
189 189
 	{
190
-		return Helper::endsWith( $value, basename( get_page_template_slug( $this->getPostId() )));
190
+		return Helper::endsWith( $value, basename( get_page_template_slug( $this->getPostId() ) ) );
191 191
 	}
192 192
 
193 193
 	/**
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 	protected function isAbsoluteConditionValid( $method, array $values )
69 69
 	{
70 70
 		foreach( $values as $value ) {
71
-			if( $this->$method( $value ))continue;
71
+			if( $this->$method( $value )) {
72
+				continue;
73
+			}
72 74
 			return false;
73 75
 		}
74 76
 		return true;
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
 	protected function isLooseConditionValid( $method, array $values )
99 101
 	{
100 102
 		foreach( $values as $value ) {
101
-			if( !$this->$method( $value ))continue;
103
+			if( !$this->$method( $value )) {
104
+				continue;
105
+			}
102 106
 			return true;
103 107
 		}
104 108
 		return false;
Please login to merge, or discard this patch.
src/Settings/Settings.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public static function id()
32 32
 	{
33
-		return apply_filters( sprintf( 'pollux/%s/id', static::ID ), Application::prefix() . static::ID );
33
+		return apply_filters( sprintf( 'pollux/%s/id', static::ID ), Application::prefix().static::ID );
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$this->normalize( $this->app->config->{static::ID} );
44 44
 
45
-		add_action( 'pollux/'.static::ID.'/init',                [$this, 'addSubmitMetaBox'] );
46
-		add_action( 'current_screen',                            [$this, 'register'] );
47
-		add_action( 'admin_menu',                                [$this, 'registerPage'] );
48
-		add_action( 'admin_menu',                                [$this, 'registerSetting'] );
49
-		add_action( 'pollux/'.static::ID.'/init',                [$this, 'resetPage'] );
50
-		add_action( 'admin_print_footer_scripts',                [$this, 'renderFooterScript'] );
51
-		add_filter( 'pollux/'.static::ID.'/instruction',         [$this, 'filterInstruction'], 10, 3 );
45
+		add_action( 'pollux/'.static::ID.'/init', [$this, 'addSubmitMetaBox'] );
46
+		add_action( 'current_screen', [$this, 'register'] );
47
+		add_action( 'admin_menu', [$this, 'registerPage'] );
48
+		add_action( 'admin_menu', [$this, 'registerSetting'] );
49
+		add_action( 'pollux/'.static::ID.'/init', [$this, 'resetPage'] );
50
+		add_action( 'admin_print_footer_scripts', [$this, 'renderFooterScript'] );
51
+		add_filter( 'pollux/'.static::ID.'/instruction', [$this, 'filterInstruction'], 10, 3 );
52 52
 		add_filter( 'pollux/'.static::ID.'/before/instructions', [$this, 'filterBeforeInstructions'] );
53 53
 	}
54 54
 
55 55
 	public function canProceed()
56 56
 	{
57 57
 		return $this->app->gatekeeper->hasDependency( static::DEPENDENCY )
58
-			&& !empty( $this->app->config->{static::ID} );
58
+			&& !empty($this->app->config->{static::ID} );
59 59
 	}
60 60
 
61 61
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			$this->hook,
72 72
 			'side',
73 73
 			'high',
74
-		]));
74
+		] ) );
75 75
 	}
76 76
 
77 77
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		return $this->filter( 'save', array_merge(
105 105
 			array_intersect_key( $this->getSettings(), $settings ),
106 106
 			$settings
107
-		));
107
+		) );
108 108
 	}
109 109
 
110 110
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	public function register()
126 126
 	{
127 127
 		if( Helper::getCurrentScreen()->id != $this->hook )return;
128
-		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) {
128
+		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY ) ) {
129 129
 			foreach( parent::register() as $metabox ) {
130 130
 				new RWMetaBox( $metabox, static::ID, $this );
131 131
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		add_screen_option( 'layout_columns', [
134 134
 			'max' => 2,
135 135
 			'default' => 2,
136
-		]);
136
+		] );
137 137
 		$this->action( 'init' );
138 138
 	}
139 139
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			[$this, 'renderPage'],
152 152
 			'dashicons-screenoptions',
153 153
 			1313
154
-		]));
154
+		] ) );
155 155
 	}
156 156
 
157 157
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
175 175
 			'hook' => $this->hook,
176 176
 			'id' => static::id(),
177
-		]);
177
+		] );
178 178
 	}
179 179
 
180 180
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			'columns' => get_current_screen()->get_columns(),
188 188
 			'heading' => __( 'Site Settings', 'pollux' ),
189 189
 			'id' => static::id(),
190
-		]);
190
+		] );
191 191
 	}
192 192
 
193 193
 	/**
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 		];
205 205
 		$this->app->render( 'settings/submit', [
206 206
 			'reset' => __( 'Reset all', 'pollux' ),
207
-			'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ))),
207
+			'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ) ) ),
208 208
 			'submit' => get_submit_button( __( 'Save', 'pollux' ), 'primary', 'submit', false ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
219 219
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
220 220
 		)return;
221
-		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
221
+		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook ) ) {
222 222
 			update_option( static::id(), $this->getDefaults() );
223 223
 			add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' );
224 224
 		}
225 225
 		else {
226
-			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ));
226
+			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ) );
227 227
 		}
228 228
 		set_transient( 'settings_errors', get_settings_errors(), 30 );
229
-		wp_safe_redirect( add_query_arg( 'settings-updated', 'true',  wp_get_referer() ));
229
+		wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() ) );
230 230
 		exit;
231 231
 	}
232 232
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	protected function filterArrayByKey( array $array, $key )
238 238
 	{
239
-		return array_filter( $array, function( $value ) use( $key ) {
240
-			return !empty( $value[$key] );
239
+		return array_filter( $array, function( $value ) use($key) {
240
+			return !empty($value[$key]);
241 241
 		});
242 242
 	}
243 243
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			$fields = array_map( function( $field ) {
253 253
 				$field = wp_parse_args( $field, ['std' => ''] );
254 254
 				return [$field['slug'] => $field['std']];
255
-			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ));
255
+			}, $this->filterArrayByKey( $metabox['fields'], 'slug' ) );
256 256
 			$metabox = [
257 257
 				$metabox['slug'] => call_user_func_array( 'array_merge', $fields ),
258 258
 			];
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 	protected function getSettings()
264 264
 	{
265
-		return (array) SiteMeta::all();
265
+		return (array)SiteMeta::all();
266 266
 	}
267 267
 
268 268
 	/**
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function init()
40 40
 	{
41
-		if( !$this->canProceed() )return;
41
+		if( !$this->canProceed() ) {
42
+			return;
43
+		}
42 44
 
43 45
 		$this->normalize( $this->app->config->{static::ID} );
44 46
 
@@ -124,7 +126,9 @@  discard block
 block discarded – undo
124 126
 	 */
125 127
 	public function register()
126 128
 	{
127
-		if( Helper::getCurrentScreen()->id != $this->hook )return;
129
+		if( Helper::getCurrentScreen()->id != $this->hook ) {
130
+			return;
131
+		}
128 132
 		if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) {
129 133
 			foreach( parent::register() as $metabox ) {
130 134
 				new RWMetaBox( $metabox, static::ID, $this );
@@ -169,7 +173,9 @@  discard block
 block discarded – undo
169 173
 	 */
170 174
 	public function renderFooterScript()
171 175
 	{
172
-		if( Helper::getCurrentScreen()->id != $this->hook )return;
176
+		if( Helper::getCurrentScreen()->id != $this->hook ) {
177
+			return;
178
+		}
173 179
 		$this->app->render( 'settings/script', [
174 180
 			'confirm' => __( 'Are you sure want to do this?', 'pollux' ),
175 181
 			'hook' => $this->hook,
@@ -217,7 +223,9 @@  discard block
 block discarded – undo
217 223
 	{
218 224
 		if( filter_input( INPUT_GET, 'page' ) !== static::id()
219 225
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
220
-		)return;
226
+		) {
227
+			return;
228
+		}
221 229
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) {
222 230
 			update_option( static::id(), $this->getDefaults() );
223 231
 			add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' );
Please login to merge, or discard this patch.
src/Helper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public static function buildClassName( $name, $path = '' )
13 13
 	{
14
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
14
+		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) );
15 15
 		$className = implode( '', $className );
16
-		return !empty( $path )
17
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
16
+		return !empty($path)
17
+			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) )
18 18
 			: $className;
19 19
 	}
20 20
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public static function buildMethodName( $name, $prefix = 'get' )
27 27
 	{
28
-		return lcfirst( static::buildClassName( $prefix . '-' . $name ));
28
+		return lcfirst( static::buildClassName( $prefix.'-'.$name ) );
29 29
 	}
30 30
 
31 31
 	/**
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public static function getCurrentScreen()
62 62
 	{
63 63
 		global $hook_suffix, $pagenow;
64
-		if( function_exists( 'get_current_screen' )) {
64
+		if( function_exists( 'get_current_screen' ) ) {
65 65
 			$screen = get_current_screen();
66 66
 		}
67
-		if( empty( $screen )) {
67
+		if( empty($screen) ) {
68 68
 			$screen = new \stdClass();
69 69
 			$screen->base = $screen->id = $hook_suffix;
70 70
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function startsWith( $needle, $haystack )
81 81
 	{
82
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
82
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
83 83
 	}
84 84
 
85 85
 	/**
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function toArray( $value )
90 90
 	{
91
-		return array_filter( (array) $value );
91
+		return array_filter( (array)$value );
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.
src/Taxonomy/Taxonomy.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function init()
37 37
 	{
38
-		if( empty( $this->app->config->taxonomies ))return;
38
+		if( empty($this->app->config->taxonomies) )return;
39 39
 
40 40
 		$this->normalize();
41 41
 
42
-		add_action( 'restrict_manage_posts', [ $this, 'printFilters'] );
43
-		add_action( 'init',                  [ $this, 'register'] );
44
-		add_filter( 'parse_query',           [ $this, 'filterByTaxonomy'] );
42
+		add_action( 'restrict_manage_posts', [$this, 'printFilters'] );
43
+		add_action( 'init', [$this, 'register'] );
44
+		add_filter( 'parse_query', [$this, 'filterByTaxonomy'] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' )return;
54 54
 		$vars = &$query->query_vars;
55 55
 		foreach( array_keys( $this->taxonomies ) as $taxonomy ) {
56
-			if( !isset( $vars[$taxonomy] ))return;
57
-			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
56
+			if( !isset($vars[$taxonomy]) )return;
57
+			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy ) ) {
58 58
 				$vars[$taxonomy] = $term->slug;
59 59
 			}
60 60
 		}
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		global $wp_query;
71 71
 		foreach( $this->taxonomies as $taxonomy => $args ) {
72
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
73
-			$selected = isset( $wp_query->query[$taxonomy] )
72
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] ) )continue;
73
+			$selected = isset($wp_query->query[$taxonomy])
74 74
 				? $wp_query->query[$taxonomy]
75 75
 				: false;
76
-			wp_dropdown_categories([
76
+			wp_dropdown_categories( [
77 77
 				'hide_if_empty' => true,
78 78
 				'name' => $taxonomy,
79 79
 				'orderby' => 'name',
80 80
 				'selected' => $selected,
81 81
 				'show_option_all' => $args['labels']['all_items'],
82 82
 				'taxonomy' => $taxonomy,
83
-			]);
83
+			] );
84 84
 		}
85 85
 	}
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	public function register()
92 92
 	{
93 93
 		array_walk( $this->taxonomies, function( $args, $taxonomy ) {
94
-			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS )));
94
+			register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS ) ) );
95 95
 			foreach( $args['post_types'] as $type ) {
96 96
 				register_taxonomy_for_object_type( $taxonomy, $type );
97 97
 			}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function normalizeLabels( $labels, array $args )
122 122
 	{
123
-		return wp_parse_args( $labels, $this->setLabels( $args ));
123
+		return wp_parse_args( $labels, $this->setLabels( $args ) );
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	protected function normalizeMenuName( $menuname, array $args )
131 131
 	{
132
-		return empty( $menuname )
132
+		return empty($menuname)
133 133
 			? $args['plural']
134 134
 			: $menuname;
135 135
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function init()
37 37
 	{
38
-		if( empty( $this->app->config->taxonomies ))return;
38
+		if( empty( $this->app->config->taxonomies )) {
39
+			return;
40
+		}
39 41
 
40 42
 		$this->normalize();
41 43
 
@@ -50,10 +52,14 @@  discard block
 block discarded – undo
50 52
 	 */
51 53
 	public function filterByTaxonomy( WP_Query $query )
52 54
 	{
53
-		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' )return;
55
+		if( !is_admin() || Helper::getCurrentScreen()->base != 'edit' ) {
56
+			return;
57
+		}
54 58
 		$vars = &$query->query_vars;
55 59
 		foreach( array_keys( $this->taxonomies ) as $taxonomy ) {
56
-			if( !isset( $vars[$taxonomy] ))return;
60
+			if( !isset( $vars[$taxonomy] )) {
61
+				return;
62
+			}
57 63
 			if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) {
58 64
 				$vars[$taxonomy] = $term->slug;
59 65
 			}
@@ -69,7 +75,9 @@  discard block
 block discarded – undo
69 75
 	{
70 76
 		global $wp_query;
71 77
 		foreach( $this->taxonomies as $taxonomy => $args ) {
72
-			if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue;
78
+			if( !in_array( get_current_screen()->post_type, $args['post_types'] )) {
79
+				continue;
80
+			}
73 81
 			$selected = isset( $wp_query->query[$taxonomy] )
74 82
 				? $wp_query->query[$taxonomy]
75 83
 				: false;
Please login to merge, or discard this patch.
src/MetaBox/MetaBox.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function init()
34 34
 	{
35
-		if( empty( $this->app->config->{static::ID} ))return;
35
+		if( empty($this->app->config->{static::ID} ) )return;
36 36
 		$this->normalize( $this->app->config->{static::ID}, [
37 37
 			'post_types' => [],
38
-		]);
38
+		] );
39 39
 		add_filter( 'rwmb_normalize_map_field', [$this, 'normalizeMapField'] );
40
-		add_filter( 'rwmb_show',                [$this, 'show'], 10, 2 );
41
-		add_filter( 'rwmb_meta_boxes',          [$this, 'register'] );
42
-		add_filter( 'rwmb_outer_html',          [$this, 'renderField'], 10, 2 );
40
+		add_filter( 'rwmb_show', [$this, 'show'], 10, 2 );
41
+		add_filter( 'rwmb_meta_boxes', [$this, 'register'] );
42
+		add_filter( 'rwmb_outer_html', [$this, 'renderField'], 10, 2 );
43 43
 	}
44 44
 
45 45
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		return PostMeta::get( $key, [
74 74
 			'id' => $this->getPostId(),
75
-		]);
75
+		] );
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function normalizeMapField( $field )
83 83
 	{
84
-		if( empty( $field['address_field'] )) {
84
+		if( empty($field['address_field']) ) {
85 85
 			return $field;
86 86
 		}
87
-		if( !Helper::startsWith( Application::PREFIX, $field['address_field'] )) {
88
-			$field['address_field'] = Application::PREFIX . $field['address_field'];
87
+		if( !Helper::startsWith( Application::PREFIX, $field['address_field'] ) ) {
88
+			$field['address_field'] = Application::PREFIX.$field['address_field'];
89 89
 		}
90 90
 		$apiKey = SiteMeta::services( $field['api_key'] );
91
-		if( !empty( $apiKey ) && is_string( $apiKey )) {
91
+		if( !empty($apiKey) && is_string( $apiKey ) ) {
92 92
 			$field['api_key'] = $apiKey;
93 93
 		}
94 94
 		return $field;
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function register()
102 102
 	{
103
-		if( current_user_can( 'switch_themes' )) {
103
+		if( current_user_can( 'switch_themes' ) ) {
104 104
 			$instructions = $this->initInstructions();
105
-			if( is_array( $instructions )) {
105
+			if( is_array( $instructions ) ) {
106 106
 				$this->normalize( $instructions );
107 107
 			}
108 108
 		}
109 109
 		$metaboxes = func_num_args()
110
-			? Helper::toArray( func_get_arg(0) )
110
+			? Helper::toArray( func_get_arg( 0 ) )
111 111
 			: [];
112 112
 		return array_merge( $metaboxes, $this->metaboxes );
113 113
 	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function renderField( $html, $field )
120 120
 	{
121
-		return !isset( $field['condition'] ) || $this->validate( $field['condition'] )
121
+		return !isset($field['condition']) || $this->validate( $field['condition'] )
122 122
 			? $html
123 123
 			: '';
124 124
 	}
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	public function show( $bool, array $metabox )
131 131
 	{
132 132
 		if( defined( 'DOING_AJAX' )
133
-			|| !isset( $metabox['condition'] )
134
-			|| !$this->hasPostType( $metabox )) {
133
+			|| !isset($metabox['condition'])
134
+			|| !$this->hasPostType( $metabox ) ) {
135 135
 			return $bool;
136 136
 		}
137 137
 		return $this->validate( $metabox['condition'] );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function getPostId()
144 144
 	{
145
-		if( !( $postId = filter_input( INPUT_GET, 'post' ))) {
145
+		if( !($postId = filter_input( INPUT_GET, 'post' )) ) {
146 146
 			$postId = filter_input( INPUT_POST, 'post_ID' );
147 147
 		}
148 148
 		return intval( $postId );
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		return array_unique( iterator_to_array(
157 157
 			new RecursiveIteratorIterator(
158
-				new RecursiveArrayIterator( array_column( $this->metaboxes, 'post_types' ))
158
+				new RecursiveArrayIterator( array_column( $this->metaboxes, 'post_types' ) )
159 159
 			),
160 160
 			false
161
-		));
161
+		) );
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function hasPostType( array $metabox )
168 168
 	{
169
-		if( !isset( $metabox['post_types'] )) {
169
+		if( !isset($metabox['post_types']) ) {
170 170
 			return true;
171 171
 		}
172
-		if( !( $type = filter_input( INPUT_GET, 'post_type' ))) {
172
+		if( !($type = filter_input( INPUT_GET, 'post_type' )) ) {
173 173
 			$type = get_post_type( $this->getPostId() );
174 174
 		}
175 175
 		return in_array( $type, $metabox['post_types'] );
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				'id' => $id,
188 188
 				'slug' => $id,
189 189
 				'validation' => [],
190
-			]);
190
+			] );
191 191
 			$this->metaboxes[] = $this->setDependencies(
192 192
 				$this->normalizeThis( $metabox, $data, $id )
193 193
 			);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	protected function normalizeDepends( $depends, array $data, $parentId )
203 203
 	{
204
-		return is_string( $depends ) && !empty( $depends )
204
+		return is_string( $depends ) && !empty($depends)
205 205
 			? $this->normalizeId( $depends, $data, $parentId )
206 206
 			: '';
207 207
 	}
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	protected function normalizeFields( array $fields, array $data, $parentId )
223 223
 	{
224
-		return array_map( function( $id, $field ) use( $parentId ) {
225
-			$defaults =  [
224
+		return array_map( function( $id, $field ) use($parentId) {
225
+			$defaults = [
226 226
 				'attributes' => [],
227 227
 				'class' => '',
228 228
 				'condition' => [],
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function normalizeId( $id, array $data, $parentId )
244 244
 	{
245
-		return Application::prefix() . $id;
245
+		return Application::prefix().$id;
246 246
 	}
247 247
 
248 248
 	/**
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 	protected function normalizeValidation( array $validation, array $data, $parentId )
261 261
 	{
262 262
 		foreach( ['messages', 'rules'] as $key ) {
263
-			if( empty( $validation[$key] ))continue;
263
+			if( empty($validation[$key]) )continue;
264 264
 			foreach( $validation[$key] as $id => $value ) {
265 265
 				$validation[$key][$this->normalizeFieldName( $id, ['slug' => $id], $parentId )] = $value;
266
-				unset( $validation[$key][$id] );
266
+				unset($validation[$key][$id]);
267 267
 			}
268 268
 		}
269 269
 		return $validation;
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
 	{
277 277
 		$fields = &$metabox['fields'];
278 278
 		$depends = array_column( $fields, 'depends' );
279
-		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox ) {
280
-			if( empty( $value ))return;
279
+		array_walk( $depends, function( $value, $index ) use(&$fields, $metabox) {
280
+			if( empty($value) )return;
281 281
 			$fields[$index]['attributes']['data-depends'] = $value;
282
-			list( $key, $value ) = array_pad( explode( '|', $value ), 2, null );
283
-			$dependency = array_search( $key, array_column( $fields, 'id' ));
282
+			list($key, $value) = array_pad( explode( '|', $value ), 2, null );
283
+			$dependency = array_search( $key, array_column( $fields, 'id' ) );
284 284
 			$metaValue = $this->getMetaValue( $fields[$dependency]['slug'], '', $metabox['slug'] );
285 285
 			$isHidden = $value === null
286 286
 				? $metaValue === ''
287 287
 				: $metaValue != $value;
288 288
 			if( $isHidden ) {
289
-				$fields[$index]['class'] = trim( 'hidden ' . $fields[$index]['class'] );
289
+				$fields[$index]['class'] = trim( 'hidden '.$fields[$index]['class'] );
290 290
 			}
291 291
 		});
292 292
 		return $metabox;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function init()
34 34
 	{
35
-		if( empty( $this->app->config->{static::ID} ))return;
35
+		if( empty( $this->app->config->{static::ID} )) {
36
+			return;
37
+		}
36 38
 		$this->normalize( $this->app->config->{static::ID}, [
37 39
 			'post_types' => [],
38 40
 		]);
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
 	protected function normalizeValidation( array $validation, array $data, $parentId )
261 263
 	{
262 264
 		foreach( ['messages', 'rules'] as $key ) {
263
-			if( empty( $validation[$key] ))continue;
265
+			if( empty( $validation[$key] )) {
266
+				continue;
267
+			}
264 268
 			foreach( $validation[$key] as $id => $value ) {
265 269
 				$validation[$key][$this->normalizeFieldName( $id, ['slug' => $id], $parentId )] = $value;
266 270
 				unset( $validation[$key][$id] );
@@ -277,7 +281,9 @@  discard block
 block discarded – undo
277 281
 		$fields = &$metabox['fields'];
278 282
 		$depends = array_column( $fields, 'depends' );
279 283
 		array_walk( $depends, function( $value, $index ) use( &$fields, $metabox ) {
280
-			if( empty( $value ))return;
284
+			if( empty( $value )) {
285
+				return;
286
+			}
281 287
 			$fields[$index]['attributes']['data-depends'] = $value;
282 288
 			list( $key, $value ) = array_pad( explode( '|', $value ), 2, null );
283 289
 			$dependency = array_search( $key, array_column( $fields, 'id' ));
Please login to merge, or discard this patch.
src/Settings/RWMetaBox.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		add_action( 'pollux/archives/init', [$this, 'add_meta_boxes'] );
26 26
 		add_action( 'pollux/settings/init', [$this, 'add_meta_boxes'] );
27
-		add_filter( 'rwmb_field_meta',      [$this, '_get_field_meta'], 10, 3 );
27
+		add_filter( 'rwmb_field_meta', [$this, '_get_field_meta'], 10, 3 );
28 28
 		add_filter( 'rwmb_normalize_field', [$this, '_normalize_field'] );
29 29
 	}
30 30
 
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function _get_field_meta( $meta, array $field, $saved )
38 38
 	{
39
-		if( !$this->is_edit_screen() || !empty( Helper::toArray( $meta )) || empty( $field['slug'] )) {
39
+		if( !$this->is_edit_screen() || !empty(Helper::toArray( $meta )) || empty($field['slug']) ) {
40 40
 			return $meta;
41 41
 		}
42
-		$meta = call_user_func( [RWMB_Helpers_Field::get_class( $field ), 'esc_meta'], ( $saved
42
+		$meta = call_user_func( [RWMB_Helpers_Field::get_class( $field ), 'esc_meta'], ($saved
43 43
 			? $this->pollux_caller->getMetaValue( $field['slug'], $meta, $this->meta_box['slug'] )
44 44
 			: $field['std']
45
-		));
45
+		) );
46 46
 		return $this->_normalize_field_meta( $meta, $field );
47 47
 	}
48 48
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function _normalize_field( array $field )
53 53
 	{
54
-		if( !empty( $field['multiple'] ) && $field['id'] == substr( $field['field_name'], 0, -2 )) {
55
-			$parts = array_filter( explode( '-', $field['id'] ));
54
+		if( !empty($field['multiple']) && $field['id'] == substr( $field['field_name'], 0, -2 ) ) {
55
+			$parts = array_filter( explode( '-', $field['id'] ) );
56 56
 			$first = array_shift( $parts );
57 57
 			$field['field_name'] = array_reduce( $parts, function( $carry, $part ) {
58 58
 				return sprintf( '%s[%s]', $carry, $part );
59
-			}, $first ) . '[]';
59
+			}, $first ).'[]';
60 60
 		}
61 61
 		return $field;
62 62
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function _normalize_field_meta( $meta, array $field )
69 69
 	{
70
-		if( !empty( $meta ) && is_array( $meta )) {
70
+		if( !empty($meta) && is_array( $meta ) ) {
71 71
 			return $meta;
72 72
 		}
73 73
 		if( $field['clone'] ) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function is_saved()
111 111
 	{
112 112
 		foreach( array_column( $this->fields, 'slug' ) as $field ) {
113
-			if( !is_null( $this->pollux_caller->getMetaValue( $field, null, $this->meta_box['slug'] ))) {
113
+			if( !is_null( $this->pollux_caller->getMetaValue( $field, null, $this->meta_box['slug'] ) ) ) {
114 114
 				return true;
115 115
 			}
116 116
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public static function normalize( $metabox )
125 125
 	{
126
-		unset( $metabox['post_types'] );
126
+		unset($metabox['post_types']);
127 127
 		return wp_parse_args( $metabox, ['slug' => ''] );
128 128
 	}
129 129
 }
Please login to merge, or discard this patch.