qodeOptions->options
);
$qode_options_proya = $qodeFramework->qodeOptions->options;
}
}
function qode_theme_menu() {
global $qodeFramework;
init_qode_theme_options();
$page_hook_suffix = add_menu_page(
'Qode Options', // The value used to populate the browser's title bar when the menu page is active
'Qode Options', // The text of the menu in the administrator's sidebar
'administrator', // What roles are able to access the menu
'qode_theme_menu', // The ID used to bind submenu items to this menu
'qode_theme_display' // The callback function used to render this menu
);
foreach ($qodeFramework->qodeOptions->adminPages as $key=>$value ) {
$slug = "";
if (!empty($value->slug)) $slug = "_tab".$value->slug;
$subpage_hook_suffix = add_submenu_page(
'qode_theme_menu',
'Qode Options - '.$value->title, // The value used to populate the browser's title bar when the menu page is active
$value->title, // The text of the menu in the administrator's sidebar
'administrator', // What roles are able to access the menu
'qode_theme_menu'.$slug, // The ID used to bind submenu items to this menu
'qode_theme_display' // The callback function used to render this menu
);
add_action('admin_print_scripts-'.$subpage_hook_suffix, 'enqueue_admin_scripts');
add_action('admin_print_styles-'.$subpage_hook_suffix, 'enqueue_admin_styles');
};
add_action('admin_print_scripts-'.$page_hook_suffix, 'enqueue_admin_scripts');
add_action('admin_print_styles-'.$page_hook_suffix, 'enqueue_admin_styles');
}
add_action( 'admin_menu', 'qode_theme_menu' );
if(!function_exists('qode_add_theme_options_toolbar')) {
/**
* Adds a link to Qode Options in toolbar for easier access
* @param $wp_admin_bar WP_Admin_Bar instance
*/
function qode_add_theme_options_toolbar($wp_admin_bar) {
if(!is_admin()) {
$args = array(
'id' => 'qode_theme_menu',
'title' => 'Qode Options',
'href' => admin_url('admin.php?page=qode_theme_menu'),
'parent' => 'site-name'
);
$wp_admin_bar->add_node($args);
}
}
add_action('admin_bar_menu', 'qode_add_theme_options_toolbar', 999);
}
function register_qode_theme_settings() {
register_setting( 'qode_theme_menu', 'qode_options' );
}
add_action('admin_init', 'register_qode_theme_settings');
function strafter($string, $substring) {
$pos = strpos($string, $substring);
if ($pos === false)
return NULL;
else
return(substr($string, $pos+strlen($substring)));
}
function qode_get_admin_tab(){
return isset($_GET['page']) ? strafter($_GET['page'],'tab') : NULL;
}
function qodef_save_options() {
global $qode_options_proya;
global $qodeFramework;
if(current_user_can('administrator')){
$_REQUEST = stripslashes_deep($_REQUEST);
foreach ($qodeFramework->qodeOptions->options as $key => $value) {
if (isset($_REQUEST[$key])) {
$qode_options_proya[$key] = $_REQUEST[$key];
}
}
update_option('qode_options_proya', $qode_options_proya);
do_action('qode_after_theme_option_save');
echo "Saved";
die();
}
}
add_action('wp_ajax_qodef_save_options', 'qodef_save_options');
function qode_theme_display() {
global $qodeFramework;
$tab = qode_get_admin_tab();
$active_page = $qodeFramework->qodeOptions->getAdminPageFromSlug($tab);
if ($active_page == null) return;
?>
get('Name'); ?>
get('Version') ?>
slug != '_importexport') { ?>
qodeOptions->adminPages as $key=>$page ) {
$slug = "";
if (!empty($page->slug)) $slug = "_tab".$page->slug;
$icon = $page->icon;
?>