@@ -13,9 +13,13 @@ |
||
13 | 13 | ]; |
14 | 14 | foreach( $namespaces as $prefix => $base_dir ) { |
15 | 15 | $len = strlen( $prefix ); |
16 | - if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
|
16 | + if( strncmp( $prefix, $class, $len ) !== 0 ) { |
|
17 | + continue; |
|
18 | + } |
|
17 | 19 | $file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php'; |
18 | - if( !file_exists( $file ) )continue; |
|
20 | + if( !file_exists( $file ) ) { |
|
21 | + continue; |
|
22 | + } |
|
19 | 23 | require $file; |
20 | 24 | break; |
21 | 25 | } |
@@ -31,7 +31,8 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | private function __clone() |
34 | - {} |
|
34 | + { |
|
35 | +} |
|
35 | 36 | |
36 | 37 | /** |
37 | 38 | * Get or create the singleton alias loader instance. |
@@ -18,7 +18,8 @@ |
||
18 | 18 | { |
19 | 19 | foreach( $this->types as $type => $args ) { |
20 | 20 | add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 ); |
21 | - add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) { |
|
21 | + add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) |
|
22 | + { |
|
22 | 23 | return count( $args['columns'] ) > 1 |
23 | 24 | ? $args['columns'] |
24 | 25 | : $columns; |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function validate( array $conditions ) |
23 | 23 | { |
24 | - array_walk( $conditions, function( &$value, $key ) { |
|
24 | + array_walk( $conditions, function( &$value, $key ) |
|
25 | + { |
|
25 | 26 | $method = ( new Helper )->buildMethodName( $key, 'validate' ); |
26 | 27 | $value = method_exists( $this, $method ) |
27 | 28 | ? $this->$method( $value ) |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | foreach( $conditions as $key ) { |
42 | 43 | $conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
43 | 44 | } |
44 | - $conditions = array_filter( $conditions, function( $key ) { |
|
45 | + $conditions = array_filter( $conditions, function( $key ) |
|
46 | + { |
|
45 | 47 | return !is_numeric( $key ); |
46 | 48 | }, ARRAY_FILTER_USE_KEY ); |
47 | 49 | } |
@@ -12,7 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | public function get( $metaKey, array $args = [] ) |
14 | 14 | { |
15 | - if( empty( $metaKey ))return; |
|
15 | + if( empty( $metaKey )) { |
|
16 | + return; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $args = $this->normalize( $args ); |
18 | 20 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
@@ -22,8 +22,10 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function generateInstructions() |
24 | 24 | { |
25 | - $instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) { |
|
26 | - $fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) { |
|
25 | + $instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) |
|
26 | + { |
|
27 | + $fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) |
|
28 | + { |
|
27 | 29 | return $this->validate( $field['condition'] ) |
28 | 30 | ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
29 | 31 | : $html; |
@@ -41,7 +43,8 @@ discard block |
||
41 | 43 | */ |
42 | 44 | protected function getInstructions() |
43 | 45 | { |
44 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
46 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
47 | + { |
|
45 | 48 | return $this->validate( $metabox['condition'] ) |
46 | 49 | && $this->hasPostType( $metabox ); |
47 | 50 | }); |
@@ -52,7 +55,9 @@ discard block |
||
52 | 55 | */ |
53 | 56 | protected function initInstructions() |
54 | 57 | { |
55 | - if( !$this->showInstructions() )return; |
|
58 | + if( !$this->showInstructions() ) { |
|
59 | + return; |
|
60 | + } |
|
56 | 61 | return [ |
57 | 62 | 'infodiv' => [ |
58 | 63 | 'context' => 'side', |
@@ -73,7 +78,8 @@ discard block |
||
73 | 78 | */ |
74 | 79 | protected function showInstructions() |
75 | 80 | { |
76 | - return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
|
81 | + return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) |
|
82 | + { |
|
77 | 83 | return $this->show( false, $metabox ); |
78 | 84 | })) > 0 ); |
79 | 85 | } |
@@ -40,7 +40,8 @@ discard block |
||
40 | 40 | public function filterBeforeInstructions() |
41 | 41 | { |
42 | 42 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
43 | - array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
|
43 | + array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) |
|
44 | + { |
|
44 | 45 | return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
45 | 46 | }) |
46 | 47 | ); |
@@ -110,7 +111,9 @@ discard block |
||
110 | 111 | */ |
111 | 112 | public function registerFeaturedImageMetaBox() |
112 | 113 | { |
113 | - if( !current_user_can( 'upload_files' ))return; |
|
114 | + if( !current_user_can( 'upload_files' )) { |
|
115 | + return; |
|
116 | + } |
|
114 | 117 | add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
115 | 118 | } |
116 | 119 | |
@@ -186,7 +189,9 @@ discard block |
||
186 | 189 | public function renderPage() |
187 | 190 | { |
188 | 191 | $type = $this->getPostType(); |
189 | - if( empty( $type ))return; |
|
192 | + if( empty( $type )) { |
|
193 | + return; |
|
194 | + } |
|
190 | 195 | $labels = get_post_type_labels( get_post_type_object( $type )); |
191 | 196 | $this->app->render( 'archive/index', [ |
192 | 197 | 'columns' => get_current_screen()->get_columns(), |
@@ -223,7 +228,8 @@ discard block |
||
223 | 228 | */ |
224 | 229 | protected function getPostTypesWithArchive() |
225 | 230 | { |
226 | - $types = array_map( function( $value ) { |
|
231 | + $types = array_map( function( $value ) |
|
232 | + { |
|
227 | 233 | return sprintf( 'edit.php?post_type=%s', $value ); |
228 | 234 | }, get_post_types( ['has_archive' => 1] )); |
229 | 235 | return array_merge( $types, ['post' => 'edit.php'] ); |
@@ -35,7 +35,9 @@ discard block |
||
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 |
||
50 | 52 | */ |
51 | 53 | public function filterByTaxonomy( WP_Query $query ) |
52 | 54 | { |
53 | - if( !is_admin() || ( new Helper )->getCurrentScreen()->base != 'edit' )return; |
|
55 | + if( !is_admin() || ( new 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 |
||
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; |
@@ -90,7 +98,8 @@ discard block |
||
90 | 98 | */ |
91 | 99 | public function register() |
92 | 100 | { |
93 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
101 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
102 | + { |
|
94 | 103 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
95 | 104 | foreach( $args['post_types'] as $type ) { |
96 | 105 | register_taxonomy_for_object_type( $taxonomy, $type ); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function init() |
47 | 47 | { |
48 | - if( empty( $this->app->config->post_types ))return; |
|
48 | + if( empty( $this->app->config->post_types )) { |
|
49 | + return; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $this->setColumns(); |
51 | 53 | $this->normalize(); |
@@ -64,7 +66,8 @@ discard block |
||
64 | 66 | $this->types, |
65 | 67 | get_post_types( ['_builtin' => true] ) |
66 | 68 | ); |
67 | - array_walk( $types, function( $args, $type ) { |
|
69 | + array_walk( $types, function( $args, $type ) |
|
70 | + { |
|
68 | 71 | register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
69 | 72 | }); |
70 | 73 | } |