@@ -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 | } |
@@ -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 | } |
@@ -31,7 +31,8 @@ |
||
| 31 | 31 | 'name' => 'Plugin Name', |
| 32 | 32 | 'version' => 'Version', |
| 33 | 33 | ), 'plugin' ); |
| 34 | - array_walk( $data, function( $value, $key ) { |
|
| 34 | + array_walk( $data, function( $value, $key ) |
|
| 35 | + { |
|
| 35 | 36 | $this->$key = $value; |
| 36 | 37 | }); |
| 37 | 38 | } |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function __construct( $plugin ) |
| 16 | 16 | { |
| 17 | - if( $this->proceed() )return; |
|
| 17 | + if( $this->proceed() ) { |
|
| 18 | + return; |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | $this->plugin = $plugin; |
| 20 | 22 | |
@@ -66,7 +66,9 @@ |
||
| 66 | 66 | trailingslashit( dirname( dirname( ABSPATH ))), |
| 67 | 67 | ]); |
| 68 | 68 | foreach( (array) $configLocations as $location ) { |
| 69 | - if( !file_exists( $location . $configYaml ))continue; |
|
| 69 | + if( !file_exists( $location . $configYaml )) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 70 | 72 | return $location . $configYaml; |
| 71 | 73 | } |
| 72 | 74 | return $this->app->path( 'defaults.yml' ); |
@@ -133,7 +133,9 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function register() |
| 135 | 135 | { |
| 136 | - if( $this->app->screen()->id != $this->hook )return; |
|
| 136 | + if( $this->app->screen()->id != $this->hook ) { |
|
| 137 | + return; |
|
| 138 | + } |
|
| 137 | 139 | foreach( parent::register() as $metabox ) { |
| 138 | 140 | new RWMetaBox( $metabox ); |
| 139 | 141 | } |
@@ -205,7 +207,9 @@ discard block |
||
| 205 | 207 | { |
| 206 | 208 | if( filter_input( INPUT_GET, 'page' ) !== $this->id |
| 207 | 209 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
| 208 | - )return; |
|
| 210 | + ) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 209 | 213 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
| 210 | 214 | update_option( $this->id, $this->getDefaults() ); |
| 211 | 215 | return add_settings_error( $this->id, 'reset', __( 'Settings reset to defaults.', 'pollux' ), 'updated' ); |
@@ -219,7 +223,8 @@ discard block |
||
| 219 | 223 | */ |
| 220 | 224 | protected function filterArrayByKey( array $array, $key ) |
| 221 | 225 | { |
| 222 | - return array_filter( $array, function( $value ) use( $key ) { |
|
| 226 | + return array_filter( $array, function( $value ) use( $key ) |
|
| 227 | + { |
|
| 223 | 228 | return !empty( $value[$key] ); |
| 224 | 229 | }); |
| 225 | 230 | } |
@@ -231,8 +236,10 @@ discard block |
||
| 231 | 236 | { |
| 232 | 237 | $metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' ); |
| 233 | 238 | |
| 234 | - array_walk( $metaboxes, function( &$metabox ) { |
|
| 235 | - $fields = array_map( function( $field ) { |
|
| 239 | + array_walk( $metaboxes, function( &$metabox ) |
|
| 240 | + { |
|
| 241 | + $fields = array_map( function( $field ) |
|
| 242 | + { |
|
| 236 | 243 | $field = wp_parse_args( $field, ['std' => ''] ); |
| 237 | 244 | return [$field['slug'] => $field['std']]; |
| 238 | 245 | }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |
@@ -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 ); |