@@ -54,7 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | foreach( $this->types as $type => $args ) { |
| 56 | 56 | add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 ); |
| 57 | - add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) { |
|
| 57 | + add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) |
|
| 58 | + { |
|
| 58 | 59 | return count( $args['columns'] ) > 1 |
| 59 | 60 | ? $args['columns'] |
| 60 | 61 | : $columns; |
@@ -71,7 +72,8 @@ discard block |
||
| 71 | 72 | $this->types, |
| 72 | 73 | get_post_types( ['_builtin' => true] ) |
| 73 | 74 | ); |
| 74 | - array_walk( $types, function( $args, $type ) { |
|
| 75 | + array_walk( $types, function( $args, $type ) |
|
| 76 | + { |
|
| 75 | 77 | register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
| 76 | 78 | }); |
| 77 | 79 | } |
@@ -46,10 +46,14 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function filterBy( WP_Query $query ) |
| 48 | 48 | { |
| 49 | - if( !is_admin() || get_current_screen()->base != 'edit' )return; |
|
| 49 | + if( !is_admin() || get_current_screen()->base != 'edit' ) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 50 | 52 | $vars = &$query->query_vars; |
| 51 | 53 | foreach( array_keys( $this->taxonomies ) as $taxonomy ) { |
| 52 | - if( !isset( $vars[$taxonomy] ))return; |
|
| 54 | + if( !isset( $vars[$taxonomy] )) { |
|
| 55 | + return; |
|
| 56 | + } |
|
| 53 | 57 | if( $term = get_term_by( 'id', $vars[$taxonomy], $taxonomy )) { |
| 54 | 58 | $vars[$taxonomy] = $term->slug; |
| 55 | 59 | } |
@@ -64,7 +68,9 @@ discard block |
||
| 64 | 68 | { |
| 65 | 69 | global $wp_query; |
| 66 | 70 | foreach( $this->taxonomies as $taxonomy => $args ) { |
| 67 | - if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue; |
|
| 71 | + if( !in_array( get_current_screen()->post_type, $args['post_types'] )) { |
|
| 72 | + continue; |
|
| 73 | + } |
|
| 68 | 74 | $selected = isset( $wp_query->query[$taxonomy] ) |
| 69 | 75 | ? $wp_query->query[$taxonomy] |
| 70 | 76 | : false; |
@@ -84,7 +90,8 @@ discard block |
||
| 84 | 90 | */ |
| 85 | 91 | public function register() |
| 86 | 92 | { |
| 87 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
| 93 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
| 94 | + { |
|
| 88 | 95 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
| 89 | 96 | foreach( $args['post_types'] as $type ) { |
| 90 | 97 | register_taxonomy_for_object_type( $taxonomy, $type ); |
@@ -28,7 +28,9 @@ discard block |
||
| 28 | 28 | public function init() |
| 29 | 29 | { |
| 30 | 30 | // @todo: run GateKeeper here instead to check dependencies and capability |
| 31 | - if( !is_plugin_active( 'meta-box/meta-box.php' ))return; |
|
| 31 | + if( !is_plugin_active( 'meta-box/meta-box.php' )) { |
|
| 32 | + return; |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | $this->normalize(); |
| 34 | 36 | |
@@ -105,7 +107,9 @@ discard block |
||
| 105 | 107 | */ |
| 106 | 108 | public function register( $metaboxes = [] ) |
| 107 | 109 | { |
| 108 | - if( get_current_screen()->id != $this->hook )return; |
|
| 110 | + if( get_current_screen()->id != $this->hook ) { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 109 | 113 | foreach( parent::register() as $metabox ) { |
| 110 | 114 | new SettingsMetaBox( $metabox ); |
| 111 | 115 | } |
@@ -178,7 +182,9 @@ discard block |
||
| 178 | 182 | { |
| 179 | 183 | if( filter_input( INPUT_GET, 'page' ) !== static::ID |
| 180 | 184 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
| 181 | - )return; |
|
| 185 | + ) { |
|
| 186 | + return; |
|
| 187 | + } |
|
| 182 | 188 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
| 183 | 189 | delete_option( static::ID ); |
| 184 | 190 | // @todo: now trigger save to restore defaults |
@@ -192,7 +198,8 @@ discard block |
||
| 192 | 198 | */ |
| 193 | 199 | protected function getInstructions() |
| 194 | 200 | { |
| 195 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 201 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 202 | + { |
|
| 196 | 203 | return $this->verifyMetaBoxCondition( $metabox['condition'] ); |
| 197 | 204 | }); |
| 198 | 205 | } |