@@ -47,10 +47,14 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function filterByTaxonomy( WP_Query $query ) |
49 | 49 | { |
50 | - if( !is_admin() || $this->app->screen()->base != 'edit' )return; |
|
50 | + if( !is_admin() || $this->app->screen()->base != 'edit' ) { |
|
51 | + return; |
|
52 | + } |
|
51 | 53 | $vars = &$query->query_vars; |
52 | 54 | foreach( array_keys( $this->taxonomies ) as $taxonomy ) { |
53 | - if( !isset( $vars[$taxonomy] ))return; |
|
55 | + if( !isset( $vars[$taxonomy] )) { |
|
56 | + return; |
|
57 | + } |
|
54 | 58 | if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) { |
55 | 59 | $vars[$taxonomy] = $term->slug; |
56 | 60 | } |
@@ -66,7 +70,9 @@ discard block |
||
66 | 70 | { |
67 | 71 | global $wp_query; |
68 | 72 | foreach( $this->taxonomies as $taxonomy => $args ) { |
69 | - if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue; |
|
73 | + if( !in_array( get_current_screen()->post_type, $args['post_types'] )) { |
|
74 | + continue; |
|
75 | + } |
|
70 | 76 | $selected = isset( $wp_query->query[$taxonomy] ) |
71 | 77 | ? $wp_query->query[$taxonomy] |
72 | 78 | : false; |
@@ -87,7 +93,8 @@ discard block |
||
87 | 93 | */ |
88 | 94 | public function register() |
89 | 95 | { |
90 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
96 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
97 | + { |
|
91 | 98 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
92 | 99 | foreach( $args['post_types'] as $type ) { |
93 | 100 | register_taxonomy_for_object_type( $taxonomy, $type ); |
@@ -130,7 +130,9 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function register( $metaboxes = [] ) |
132 | 132 | { |
133 | - if( $this->app->screen()->id != $this->hook )return; |
|
133 | + if( $this->app->screen()->id != $this->hook ) { |
|
134 | + return; |
|
135 | + } |
|
134 | 136 | foreach( parent::register() as $metabox ) { |
135 | 137 | new SettingsMetaBox( $metabox ); |
136 | 138 | } |
@@ -202,7 +204,9 @@ discard block |
||
202 | 204 | { |
203 | 205 | if( filter_input( INPUT_GET, 'page' ) !== $this->id |
204 | 206 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
205 | - )return; |
|
207 | + ) { |
|
208 | + return; |
|
209 | + } |
|
206 | 210 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
207 | 211 | update_option( $this->id, $this->getDefaults() ); |
208 | 212 | return add_settings_error( $this->id, 'reset', __( 'Settings reset to defaults.', 'pollux' ), 'updated' ); |
@@ -216,7 +220,8 @@ discard block |
||
216 | 220 | */ |
217 | 221 | protected function filterArrayByKey( array $array, $key ) |
218 | 222 | { |
219 | - return array_filter( $array, function( $value ) use( $key ) { |
|
223 | + return array_filter( $array, function( $value ) use( $key ) |
|
224 | + { |
|
220 | 225 | return !empty( $value[$key] ); |
221 | 226 | }); |
222 | 227 | } |
@@ -228,8 +233,10 @@ discard block |
||
228 | 233 | { |
229 | 234 | $metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' ); |
230 | 235 | |
231 | - array_walk( $metaboxes, function( &$metabox ) { |
|
232 | - $fields = array_map( function( $field ) { |
|
236 | + array_walk( $metaboxes, function( &$metabox ) |
|
237 | + { |
|
238 | + $fields = array_map( function( $field ) |
|
239 | + { |
|
233 | 240 | $field = wp_parse_args( $field, ['std' => ''] ); |
234 | 241 | return [$field['slug'] => $field['std']]; |
235 | 242 | }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |