Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public function get( $value, array $args = [] ) |
||
8 | { |
||
9 | if( empty( $value ))return; |
||
10 | |||
11 | $args = $this->normalize( $args ); |
||
12 | |||
13 | if( substr( $value, 0, 1 ) == '_' && !empty( $args['prefix'] )) { |
||
14 | $args['prefix'] = sprintf( '_%s', rtrim( $args['prefix'], '_' )); |
||
15 | } |
||
16 | |||
17 | $metaValue = get_post_meta( $args['ID'], $args['prefix'] . $value, $args['single'] ); |
||
18 | |||
19 | return empty( $metaValue ) |
||
20 | ? $args['fallback'] |
||
21 | : $metaValue; |
||
22 | } |
||
23 | |||
35 |