@@ -10,19 +10,19 @@ discard block |
||
| 10 | 10 | * @param string $metaKey |
| 11 | 11 | * @return mixed |
| 12 | 12 | */ |
| 13 | - public function get( $metaKey, array $args = [] ) |
|
| 13 | + public function get( $metaKey, array $args = [ ] ) |
|
| 14 | 14 | { |
| 15 | - if( empty( $metaKey ))return; |
|
| 15 | + if( empty( $metaKey ) )return; |
|
| 16 | 16 | |
| 17 | 17 | $args = $this->normalize( $args ); |
| 18 | - $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
|
| 19 | - $metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] ); |
|
| 18 | + $metaKey = $this->buildMetaKey( $metaKey, $args[ 'prefix' ] ); |
|
| 19 | + $metaValue = get_post_meta( $args[ 'id' ], $metaKey, $args[ 'single' ] ); |
|
| 20 | 20 | |
| 21 | - if( is_string( $metaValue )) { |
|
| 21 | + if( is_string( $metaValue ) ) { |
|
| 22 | 22 | $metaValue = trim( $metaValue ); |
| 23 | 23 | } |
| 24 | 24 | return empty( $metaValue ) |
| 25 | - ? $args['fallback'] |
|
| 25 | + ? $args[ 'fallback' ] |
|
| 26 | 26 | : $metaValue; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected function buildMetaKey( $metaKey, $prefix ) |
| 35 | 35 | { |
| 36 | - return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix )) |
|
| 36 | + return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ) ) |
|
| 37 | 37 | ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey ) |
| 38 | 38 | : $prefix . $metaKey; |
| 39 | 39 | } |
@@ -49,6 +49,6 @@ discard block |
||
| 49 | 49 | 'single' => true, |
| 50 | 50 | 'prefix' => apply_filters( 'pollux/prefix', Application::PREFIX ), |
| 51 | 51 | ]; |
| 52 | - return shortcode_atts( $defaults, array_change_key_case( $args )); |
|
| 52 | + return shortcode_atts( $defaults, array_change_key_case( $args ) ); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -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'] ); |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // $this->normalize( $this->app->config['archives'] ); |
| 28 | 28 | |
| 29 | - add_action( 'admin_menu', [$this, 'addPage'] ); |
|
| 30 | - add_action( 'pollux/archive/editor', [$this, 'renderEditor'] ); |
|
| 29 | + add_action( 'admin_menu', [ $this, 'addPage' ] ); |
|
| 30 | + add_action( 'pollux/archive/editor', [ $this, 'renderEditor' ] ); |
|
| 31 | 31 | // add_action( 'pollux/settings/init', [$this, 'addSubmitMetaBox'] ); |
| 32 | 32 | // add_action( 'current_screen', [$this, 'register'] ); |
| 33 | 33 | // add_action( 'admin_menu', [$this, 'registerSetting'] ); |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | __( 'Archive Page', 'pollux' ), |
| 49 | 49 | 'edit_theme_options', |
| 50 | 50 | $this->id, |
| 51 | - [$this, 'renderPage'], |
|
| 51 | + [ $this, 'renderPage' ], |
|
| 52 | 52 | 'dashicons-screenoptions', |
| 53 | 53 | 1310 |
| 54 | - ])); |
|
| 54 | + ] ) ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'columns' => get_current_screen()->get_columns(), |
| 65 | 65 | 'id' => $this->id, |
| 66 | 66 | 'title' => __( 'Archive Page', 'pollux' ), |
| 67 | - ]); |
|
| 67 | + ] ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -83,6 +83,6 @@ discard block |
||
| 83 | 83 | 'wp_autoresize_on' => true, |
| 84 | 84 | 'add_unload_trigger' => false, |
| 85 | 85 | ], |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - CONST ID = 'pollux_archives'; |
|
| 15 | + const ID = 'pollux_archives'; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * {@inheritdoc} |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | public function get( $group = null, $key = null, $fallback = null ) |
| 16 | 16 | { |
| 17 | 17 | $options = $this->getOption(); |
| 18 | - if( empty( $options )) { |
|
| 18 | + if( empty( $options ) ) { |
|
| 19 | 19 | return $fallback; |
| 20 | 20 | } |
| 21 | - if( !is_string( $group )) { |
|
| 21 | + if( !is_string( $group ) ) { |
|
| 22 | 22 | return $options; |
| 23 | 23 | } |
| 24 | 24 | $group = $this->normalize( $options, $group, $fallback ); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function getOption() |
| 34 | 34 | { |
| 35 | - return get_option( apply_filters( 'pollux/settings/option', Settings::ID ), [] ); |
|
| 35 | + return get_option( apply_filters( 'pollux/settings/option', Settings::ID ), [ ] ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | protected function normalize( array $options, $key, $fallback ) |
| 44 | 44 | { |
| 45 | - if( !array_key_exists( $key, $options )) { |
|
| 45 | + if( !array_key_exists( $key, $options ) ) { |
|
| 46 | 46 | return $fallback; |
| 47 | 47 | } |
| 48 | - $option = $options[$key]; |
|
| 48 | + $option = $options[ $key ]; |
|
| 49 | 49 | $option = is_array( $option ) |
| 50 | 50 | ? array_filter( $option ) |
| 51 | 51 | : trim( $option ); |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | protected function getOption() |
| 14 | 14 | { |
| 15 | - return get_option( apply_filters( 'pollux/archive/option', Archive::ID ), [] ); |
|
| 15 | + return get_option( apply_filters( 'pollux/archive/option', Archive::ID ), [ ] ); |
|
| 16 | 16 | } |
| 17 | 17 | } |