@@ -42,6 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | + * @param boolean $bool |
|
| 45 | 46 | * @return bool |
| 46 | 47 | */ |
| 47 | 48 | public function isVisible( $bool, array $metabox ) |
@@ -167,7 +168,7 @@ discard block |
||
| 167 | 168 | } |
| 168 | 169 | |
| 169 | 170 | /** |
| 170 | - * @param mixed $condition |
|
| 171 | + * @param mixed $conditions |
|
| 171 | 172 | * @return array |
| 172 | 173 | */ |
| 173 | 174 | protected function normalizeCondition( $conditions ) |
@@ -59,7 +59,8 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function verifyMetaBoxCondition( array $conditions ) |
| 61 | 61 | { |
| 62 | - array_walk( $conditions, function( &$value, $key ) { |
|
| 62 | + array_walk( $conditions, function( &$value, $key ) |
|
| 63 | + { |
|
| 63 | 64 | $method = $this->app->buildMethodName( $key, 'validate' ); |
| 64 | 65 | $value = method_exists( $this, $method ) |
| 65 | 66 | ? $this->$method( $value ) |
@@ -70,9 +71,12 @@ discard block |
||
| 70 | 71 | |
| 71 | 72 | protected function addInstructions() |
| 72 | 73 | { |
| 73 | - if( !count( array_filter( $this->metaboxes, function( $metabox ) { |
|
| 74 | + if( !count( array_filter( $this->metaboxes, function( $metabox ) |
|
| 75 | + { |
|
| 74 | 76 | return $this->isVisible( false, $metabox ); |
| 75 | - })))return; |
|
| 77 | + }))) { |
|
| 78 | + return; |
|
| 79 | + } |
|
| 76 | 80 | $this->metaboxes[] = [ |
| 77 | 81 | 'id' => 'infodiv', |
| 78 | 82 | 'post_types' => $this->getPostTypes(), |
@@ -91,8 +95,10 @@ discard block |
||
| 91 | 95 | */ |
| 92 | 96 | protected function generateInstructions() |
| 93 | 97 | { |
| 94 | - return array_reduce( $this->getInstructions(), function( $html, $metabox ) { |
|
| 95 | - $fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) { |
|
| 98 | + return array_reduce( $this->getInstructions(), function( $html, $metabox ) |
|
| 99 | + { |
|
| 100 | + $fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) |
|
| 101 | + { |
|
| 96 | 102 | $hook = sprintf( 'pollux/%s/instruction', $this->getClassname() ); |
| 97 | 103 | error_log( print_r( $metabox, 1 )); |
| 98 | 104 | return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL; |
@@ -110,7 +116,8 @@ discard block |
||
| 110 | 116 | protected function getInstructions() |
| 111 | 117 | { |
| 112 | 118 | $type = get_post_type( $this->getPostId() ); |
| 113 | - return array_filter( $this->metaboxes, function( $metabox ) use( $type ) { |
|
| 119 | + return array_filter( $this->metaboxes, function( $metabox ) use( $type ) |
|
| 120 | + { |
|
| 114 | 121 | return $this->verifyMetaBoxCondition( $metabox['condition'] ) |
| 115 | 122 | && in_array( $type, $metabox['post_types'] ); |
| 116 | 123 | }); |
@@ -177,7 +184,8 @@ discard block |
||
| 177 | 184 | foreach( $conditions as $key ) { |
| 178 | 185 | $conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
| 179 | 186 | } |
| 180 | - $conditions = array_filter( $conditions, function( $key ) { |
|
| 187 | + $conditions = array_filter( $conditions, function( $key ) |
|
| 188 | + { |
|
| 181 | 189 | return !is_numeric( $key ); |
| 182 | 190 | }, ARRAY_FILTER_USE_KEY ); |
| 183 | 191 | } |
@@ -193,7 +201,8 @@ discard block |
||
| 193 | 201 | */ |
| 194 | 202 | protected function normalizeFields( array $fields, array $data, $parentId ) |
| 195 | 203 | { |
| 196 | - return array_map( function( $id, $field ) use( $parentId ) { |
|
| 204 | + return array_map( function( $id, $field ) use( $parentId ) |
|
| 205 | + { |
|
| 197 | 206 | $defaults = [ |
| 198 | 207 | 'id' => $id, |
| 199 | 208 | 'field_name' => '', |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * @param int $postId |
| 173 | - * @return string |
|
| 173 | + * @return integer |
|
| 174 | 174 | */ |
| 175 | 175 | protected function getColumnMedia( $postId ) |
| 176 | 176 | { |
@@ -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( self::CUSTOM_KEYS ))); |
| 76 | 78 | }); |
| 77 | 79 | } |
@@ -72,7 +72,6 @@ |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * @param string $id |
|
| 76 | 75 | * @return string |
| 77 | 76 | */ |
| 78 | 77 | public function filterInstruction( $instruction, $fieldId, $metaboxId ) |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function init() |
| 29 | 29 | { |
| 30 | - if( !is_plugin_active( 'meta-box/meta-box.php' ))return; |
|
| 30 | + if( !is_plugin_active( 'meta-box/meta-box.php' )) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $this->normalize(); |
| 33 | 35 | |
@@ -96,7 +98,9 @@ discard block |
||
| 96 | 98 | */ |
| 97 | 99 | public function register( $metaboxes = [] ) |
| 98 | 100 | { |
| 99 | - if( get_current_screen()->id != $this->hook )return; |
|
| 101 | + if( get_current_screen()->id != $this->hook ) { |
|
| 102 | + return; |
|
| 103 | + } |
|
| 100 | 104 | foreach( parent::register() as $metabox ) { |
| 101 | 105 | new SettingsMetaBox( $metabox ); |
| 102 | 106 | } |
@@ -151,7 +155,8 @@ discard block |
||
| 151 | 155 | */ |
| 152 | 156 | protected function getInstructions() |
| 153 | 157 | { |
| 154 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 158 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 159 | + { |
|
| 155 | 160 | return $this->verifyMetaBoxCondition( $metabox['condition'] ); |
| 156 | 161 | }); |
| 157 | 162 | } |
@@ -107,7 +107,6 @@ |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * @param mixed $condition |
|
| 111 | 110 | * @return array |
| 112 | 111 | */ |
| 113 | 112 | protected function normalizeLabels( $labels, array $args ) |
@@ -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( empty( $vars[$taxonomy] ) || !is_numeric( $vars[$taxonomy] ))continue; |
|
| 54 | + if( empty( $vars[$taxonomy] ) || !is_numeric( $vars[$taxonomy] )) { |
|
| 55 | + continue; |
|
| 56 | + } |
|
| 53 | 57 | $vars[$taxonomy] = get_term_by( 'id', $vars[$taxonomy], $taxonomy )->slug; |
| 54 | 58 | } |
| 55 | 59 | return $query; |
@@ -62,7 +66,9 @@ discard block |
||
| 62 | 66 | { |
| 63 | 67 | global $wp_query; |
| 64 | 68 | foreach( $this->taxonomies as $taxonomy => $args ) { |
| 65 | - if( !in_array( get_current_screen()->post_type, $args['post_types'] ))continue; |
|
| 69 | + if( !in_array( get_current_screen()->post_type, $args['post_types'] )) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 66 | 72 | $selected = isset( $wp_query->query[$taxonomy] ) |
| 67 | 73 | ? $wp_query->query[$taxonomy] |
| 68 | 74 | : false; |
@@ -86,7 +92,8 @@ discard block |
||
| 86 | 92 | $this->taxonomies, |
| 87 | 93 | get_taxonomies( ['_builtin' => true] ) |
| 88 | 94 | ); |
| 89 | - array_walk( $this->taxonomies, function( $args, $taxonomy ) { |
|
| 95 | + array_walk( $this->taxonomies, function( $args, $taxonomy ) |
|
| 96 | + { |
|
| 90 | 97 | register_taxonomy( $taxonomy, $args['post_types'], array_diff_key( $args, array_flip( self::CUSTOM_KEYS ))); |
| 91 | 98 | foreach( $args['post_types'] as $type ) { |
| 92 | 99 | register_taxonomy_for_object_type( $taxonomy, $type ); |
@@ -5,7 +5,8 @@ discard block |
||
| 5 | 5 | * |
| 6 | 6 | * @return mixed |
| 7 | 7 | */ |
| 8 | -function pollux_get_post_meta( $metaKey, array $args = [] ) { |
|
| 8 | +function pollux_get_post_meta( $metaKey, array $args = [] ) |
|
| 9 | +{ |
|
| 9 | 10 | return \GeminiLabs\Pollux\Facades\PostMeta::get( $metaKey, $args ); |
| 10 | 11 | } |
| 11 | 12 | |
@@ -14,6 +15,7 @@ discard block |
||
| 14 | 15 | * |
| 15 | 16 | * @return mixed |
| 16 | 17 | */ |
| 17 | -function pollux_get_option( $group, $key = false, $fallback = '' ) { |
|
| 18 | +function pollux_get_option( $group, $key = false, $fallback = '' ) |
|
| 19 | +{ |
|
| 18 | 20 | return \GeminiLabs\Pollux\Facades\SiteMeta::get( $group, $key, $fallback ); |
| 19 | 21 | } |
@@ -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 | } |
@@ -64,7 +64,9 @@ |
||
| 64 | 64 | trailingslashit( dirname( ABSPATH )), |
| 65 | 65 | ]); |
| 66 | 66 | foreach( $configLocations as $location ) { |
| 67 | - if( !file_exists( $location . $configYaml ))continue; |
|
| 67 | + if( !file_exists( $location . $configYaml )) { |
|
| 68 | + continue; |
|
| 69 | + } |
|
| 68 | 70 | return $location . $configYaml; |
| 69 | 71 | } |
| 70 | 72 | return $this->app->path( 'defaults.yml' ); |
@@ -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. |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function filterWordPressFooter( $text ) |
| 25 | 25 | { |
| 26 | - if( $this->app->config['remove_wordpress_footer'] )return; |
|
| 26 | + if( $this->app->config['remove_wordpress_footer'] ) { |
|
| 27 | + return; |
|
| 28 | + } |
|
| 27 | 29 | return $text; |
| 28 | 30 | } |
| 29 | 31 | |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | */ |
| 65 | 67 | public function removeDashboardWidgets() |
| 66 | 68 | { |
| 67 | - if( !$this->app->config['remove_dashboard_widgets'] )return; |
|
| 69 | + if( !$this->app->config['remove_dashboard_widgets'] ) { |
|
| 70 | + return; |
|
| 71 | + } |
|
| 68 | 72 | $widgets = apply_filters( 'pollux/dashoard/widgets', [ |
| 69 | 73 | 'dashboard_primary', |
| 70 | 74 | 'dashboard_quick_press', |
@@ -80,7 +84,9 @@ discard block |
||
| 80 | 84 | */ |
| 81 | 85 | public function removeWordPressMenu() |
| 82 | 86 | { |
| 83 | - if( !$this->app->config['remove_wordpress_menu'] )return; |
|
| 87 | + if( !$this->app->config['remove_wordpress_menu'] ) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 84 | 90 | global $wp_admin_bar; |
| 85 | 91 | $wp_admin_bar->remove_menu( 'wp-logo' ); |
| 86 | 92 | } |