@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | |
5 | 5 | class PostMeta |
6 | 6 | { |
7 | - public function get( $value, array $args = [] ) |
|
7 | + public function get($value, array $args = []) |
|
8 | 8 | { |
9 | - if( empty( $value ))return; |
|
9 | + if (empty($value))return; |
|
10 | 10 | |
11 | - $args = $this->normalize( $args ); |
|
11 | + $args = $this->normalize($args); |
|
12 | 12 | |
13 | - if( substr( $value, 0, 1 ) == '_' && !empty( $args['prefix'] )) { |
|
14 | - $args['prefix'] = sprintf( '_%s', rtrim( $args['prefix'], '_' )); |
|
13 | + if (substr($value, 0, 1) == '_' && !empty($args['prefix'])) { |
|
14 | + $args['prefix'] = sprintf('_%s', rtrim($args['prefix'], '_')); |
|
15 | 15 | } |
16 | 16 | |
17 | - $metaValue = get_post_meta( $args['ID'], $args['prefix'] . $value, $args['single'] ); |
|
17 | + $metaValue = get_post_meta($args['ID'], $args['prefix'] . $value, $args['single']); |
|
18 | 18 | |
19 | - return empty( $metaValue ) |
|
19 | + return empty($metaValue) |
|
20 | 20 | ? $args['fallback'] |
21 | 21 | : $metaValue; |
22 | 22 | } |
23 | 23 | |
24 | - protected function normalize( array $args ) |
|
24 | + protected function normalize(array $args) |
|
25 | 25 | { |
26 | 26 | $defaults = [ |
27 | 27 | 'ID' => get_the_ID(), |
@@ -29,6 +29,6 @@ discard block |
||
29 | 29 | 'single' => true, |
30 | 30 | 'prefix' => 'pollux_', |
31 | 31 | ]; |
32 | - return shortcode_atts( $defaults, $args ); |
|
32 | + return shortcode_atts($defaults, $args); |
|
33 | 33 | } |
34 | 34 | } |
@@ -6,7 +6,9 @@ |
||
6 | 6 | { |
7 | 7 | public function get( $value, array $args = [] ) |
8 | 8 | { |
9 | - if( empty( $value ))return; |
|
9 | + if( empty( $value )) { |
|
10 | + return; |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $args = $this->normalize( $args ); |
12 | 14 |