Option.php
35 lines
| 1 | <?php |
| 2 | namespace Pagup\Bigta\Core; |
| 3 | |
| 4 | class Option |
| 5 | { |
| 6 | public static function all() |
| 7 | { |
| 8 | return get_option( 'bigta' ); |
| 9 | } |
| 10 | |
| 11 | public static function get($key) |
| 12 | { |
| 13 | $option = static::all(); |
| 14 | |
| 15 | return $option[$key]; |
| 16 | } |
| 17 | |
| 18 | public static function check($key) |
| 19 | { |
| 20 | $option = static::all(); |
| 21 | return isset($option[$key]) && !empty($option[$key]); |
| 22 | } |
| 23 | |
| 24 | public static function valid($option, $val) |
| 25 | { |
| 26 | return static::check($option) && static::get($option) == $val; |
| 27 | } |
| 28 | |
| 29 | public static function post_meta($key) |
| 30 | { |
| 31 | // global $post; |
| 32 | $post_id = get_queried_object_id(); |
| 33 | return get_post_meta($post_id, $key, true); |
| 34 | } |
| 35 | } |