getOptionValue( 'google_maps_api_key' );
$google_maps_extensions = '';
$google_maps_extensions_array = apply_filters( 'qode_google_maps_extensions_array', array() );
if ( ! empty( $google_maps_extensions_array ) ) {
$google_maps_extensions .= '&libraries=';
$google_maps_extensions .= implode( ',', $google_maps_extensions_array );
}
if ( ! empty( $google_maps_api_key ) ) {
wp_enqueue_script( 'qodef-admin-maps', '//maps.googleapis.com/maps/api/js?key=' . esc_attr( $google_maps_api_key ) . $google_maps_extensions, array(), false, true );
wp_enqueue_script( 'jquery.geocomplete', get_template_directory_uri() . '/framework/admin/assets/js/jquery.geocomplete.min.js', array('qodef-admin-maps'), false, true );
}
}
do_action( 'qode_action_admin_scripts_init' );
}
add_action('admin_init', 'qode_admin_scripts_init');
/**
* Enqueue styles and scripts for admin page
*/
function enqueue_admin_styles() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style('qodef-bootstrap');
wp_enqueue_style('select2');
wp_enqueue_style('qodef-page-admin');
wp_enqueue_style('qodef-options-admin');
wp_enqueue_style('qodef-ui-admin');
wp_enqueue_style('jquery.nouislider.min');
wp_enqueue_style('qodef-forms-admin');
wp_enqueue_style('font-awesome-admin');
}
function enqueue_admin_scripts() {
wp_enqueue_script('underscore'); //underscore
wp_enqueue_script('wp-color-picker'); //colorpicker
wp_enqueue_script('bootstrap.min');
wp_enqueue_script('select2');
wp_enqueue_media();
wp_enqueue_script('jquery.nouislider.min');
wp_enqueue_script('qodef-ui-admin');
wp_enqueue_script('qodef-ui-repeater');
}
function enqueue_meta_box_styles() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style('qodef-bootstrap');
wp_enqueue_style('select2');
wp_enqueue_style('qodef-page-admin');
wp_enqueue_style('qodef-meta-boxes-admin');
wp_enqueue_style('qodef-ui-admin');
wp_enqueue_style('jquery.nouislider.min');
wp_enqueue_style('qodef-forms-admin');
wp_enqueue_style('font-awesome-admin');
}
function enqueue_meta_box_scripts() {
wp_enqueue_script('underscore'); //underscore
wp_enqueue_script('wp-color-picker'); //colorpicker
wp_enqueue_script('bootstrap.min');
wp_enqueue_script('select2');
wp_enqueue_media();
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery.nouislider.min');
wp_enqueue_script('qodef-ui-admin');
wp_enqueue_script('qodef-ui-repeater');
}
global $qode_options_proya;
$qode_options_proya = get_option('qode_options_proya');
function init_qode_theme_options() {
global $qode_options_proya;
global $qodeFramework;
if(isset($qode_options_proya['reset_to_defaults'])){
if( $qode_options_proya['reset_to_defaults'] == 'yes' ) delete_option( "qode_options_proya");
}
if (! get_option("qode_options_proya")) {
add_option( "qode_options_proya",
$qodeFramework->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' );
function qode_theme_import_menu() {
global $qodeFramework;
init_qode_theme_options();
$page_hook_suffix = add_menu_page(
'Qode Import', // The value used to populate the browser's title bar when the menu page is active
'Qode Import', // The text of the menu in the administrator's sidebar
'administrator', // What roles are able to access the menu
'qode_options_import_page', // The ID used to bind submenu items to this menu
'qode_theme_import_display', // The callback function used to render this menu
'dashicons-download'
);
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_import_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);
check_ajax_referer('qode_ajax_save_nonce', 'qode_ajax_save_nonce');
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;
?>