6b66cbf9 by Kevin Burton

updated TzOption

1 parent aa34346a
......@@ -32,6 +32,17 @@ class Actions {
#toplevel_page_cbvreport:hover .wp-menu-image, #menu-posts-POSTTYPE.wp-has-current-submenu .wp-menu-image {
background-position:6px 7px!important;
}
#toplevel_page_cbv_options .wp-menu-image a img { display:none; }
#toplevel_page_cbv_options .wp-menu-image {
background: url(<?php echo Tools\url('cpt-icons/switch.png', __FILE__) ?>) no-repeat 6px -17px !important;
}
#toplevel_page_cbv_options:hover .wp-menu-image, #menu-posts-POSTTYPE.wp-has-current-submenu .wp-menu-image {
background-position:6px 7px!important;
}
</style>
<?php
......
......@@ -2,33 +2,54 @@
namespace Tz\WordPress\Tools\TzOption;
use Tz\WordPress\Tools;
require_once('wp-admin-menu-classes.php');
const CAPABILITY = "manage_cbv_options";
call_user_func(function() {
$role = get_role('administrator');
$role->add_cap(CAPABILITY);
Tools\add_actions(__NAMESPACE__ . '\Actions');
Tools\add_shortcodes(__NAMESPACE__ . '\ShortCodes');
});
function GetOption($key) {
if ( isset( Vars::$options[$key] ) ) {
return Vars::$options[$key];
} else {
return '-';
return '';
}
}
function display_options() {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'index.php');
}
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;
foreach($results as $rs) {
Vars::$options[$rs['option_name']] = $rs['option_value'];
}
}
public static function admin_menu() {
add_menu_page('CBV Options','CBV Options',CAPABILITY,'cbv_options',__NAMESPACE__ . '\display_options',null,6);
rename_admin_menu_section('Posts','Publications');
swap_admin_menu_sections('CBV Options','Publications');
}
}
class ShortCodes {
public static function TzOption($args, $content, $tag) {
return TzOption\GetOption($args['key']);
if (isset($args['key'])) {
return TzOption\GetOption($args['key']);
}
}
}
......
<?php
namespace Tz\WordPress\Tools\TzOption;
use Tz\WordPress\Tools;
print "<pre>";
print_r(Vars::$options);
print "</pre>";
?>
\ No newline at end of file
......@@ -865,7 +865,7 @@ class Actions {
$timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']);
if ($_POST['indexed']=="") {
$_POST['indexed'] = Sequencer\generate('KCB');
$_POST['indexed'] = Sequencer\generate('CEH');
}
......