aa34346a by Kevin Burton

added TzOption Library in com

1 parent 165a93e2
<?php
namespace Tz\WordPress\Tools\TzOption;
use Tz\WordPress\Tools;
call_user_func(function() {
Tools\add_actions(__NAMESPACE__ . '\Actions');
Tools\add_shortcodes(__NAMESPACE__ . '\ShortCodes');
});
function GetOption($key) {
if ( isset( Vars::$options[$key] ) ) {
return Vars::$options[$key];
} else {
return '-';
}
}
class Actions {
public static function init() {
global $wpdb;
$results = $wpdb->get_results("SELECT * FROM wp_cbv_options", ARRAY_A);
foreach($results as $key => $val) {
Vars::$options[$key] = $val;
}
}
}
class ShortCodes {
public static function TzOption($args, $content, $tag) {
return TzOption\GetOption($args['key']);
}
}
class Vars {
public static $options = array();
}
?>
\ No newline at end of file