function woothemes_add_admin()
{
    global $query_string;
    $options = get_option('woo_template');
    $themename = get_option('woo_themename');
    $shortname = get_option('woo_shortname');
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes') {
        if (isset($_REQUEST['woo_save']) && 'reset' == $_REQUEST['woo_save']) {
            global $wpdb;
            $query = "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'woo_%'";
            $wpdb->query($query);
            header("Location: admin.php?page=woothemes&reset=true");
            die;
        }
    }
    // Check all the Options, then if the no options are created for a relative sub-page... it's not created.
    if (function_exists('add_object_page')) {
        add_object_page('Page Title', $themename, 8, 'woothemes', 'woothemes_options_page', get_bloginfo('template_url') . '/functions/images/woo-icon.png');
    } else {
        add_menu_page('Page Title', $themename, 8, 'woothemes_home', 'woothemes_options_page', get_bloginfo('template_url') . '/functions/images/woo-icon.png');
    }
    $woopage = add_submenu_page('woothemes', $themename, 'Theme Options', 8, 'woothemes', 'woothemes_options_page');
    // Default
    $wooframeworksettings = add_submenu_page('woothemes', 'Framework Settings', 'Framework Settings', 8, 'woothemes_framework_settings', 'woothemes_framework_settings_page');
    //Woothemes Custom Navigation Menu Item
    if (function_exists('woo_custom_navigation_menu')) {
        woo_custom_navigation_menu();
    }
    //Wootheme "Buy Themes" Pagevoid   add_submenu_page  (string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, [callback $function = ''])
    if (get_option('woo_framework_update') == 'true') {
        $woothemepage = add_submenu_page('woothemes', 'WooFramework Update', 'Update Framework', 8, 'woothemes_framework_update', 'woothemes_framework_update_page');
    }
    //Wootheme "Buy Themes" Page
    if (get_option('woo_buy_themes') != 'true') {
        $woothemepage = add_submenu_page('woothemes', 'Available WooThemes', 'Buy Themes', 8, 'woothemes_themes', 'woothemes_more_themes_page');
        add_action("admin_print_scripts-{$woothemepage}", 'woo_load_only');
    }
    // Add framework functionaily to the head individually
    add_action("admin_print_scripts-{$woopage}", 'woo_load_only');
    add_action("admin_print_scripts-{$wooframeworksettings}", 'woo_load_only');
}
 function woothemes_add_admin()
 {
     global $query_string;
     global $current_user;
     $current_user_id = $current_user->user_login;
     $super_user = get_option('framework_woo_super_user');
     $themename = get_option('woo_themename');
     $shortname = get_option('woo_shortname');
     // Reset the settings, sanitizing the various requests made.
     // Use a SWITCH to determine which settings to update.
     /* Make sure we're making a request.
       	------------------------------------------------------------*/
     if (isset($_REQUEST['page'])) {
         // Sanitize page being requested.
         $_page = '';
         $_page = mysql_real_escape_string(strtolower(trim(strip_tags($_REQUEST['page']))));
         // Sanitize action being requested.
         $_action = '';
         if (isset($_REQUEST['woo_save'])) {
             $_action = mysql_real_escape_string(strtolower(trim(strip_tags($_REQUEST['woo_save']))));
         }
         // End IF Statement
         // If the action is "reset", run the SWITCH.
         /* Perform settings reset.
          		------------------------------------------------------------*/
         if ($_action == 'reset') {
             // Add nonce security check.
             if (function_exists('check_ajax_referer')) {
                 if ($_page == 'woothemes_seo') {
                     check_ajax_referer('wooframework-seo-options-reset', '_ajax_nonce');
                 } else {
                     check_ajax_referer('wooframework-theme-options-reset', '_ajax_nonce');
                 }
             }
             // End IF Statement
             switch ($_page) {
                 case 'woothemes':
                     $options = get_option('woo_template');
                     woo_reset_options($options, 'woothemes');
                     header("Location: admin.php?page=woothemes&reset=true");
                     die;
                     break;
                 case 'woothemes_framework_settings':
                     $options = get_option('woo_framework_template');
                     woo_reset_options($options);
                     header("Location: admin.php?page=woothemes_framework_settings&reset=true");
                     die;
                     break;
                 case 'woothemes_seo':
                     $options = get_option('woo_seo_template');
                     woo_reset_options($options);
                     header("Location: admin.php?page=woothemes_seo&reset=true");
                     die;
                     break;
                 case 'woothemes_sbm':
                     delete_option('sbm_woo_sbm_options');
                     header("Location: admin.php?page=woothemes_sbm&reset=true");
                     die;
                     break;
             }
             // End SWITCH Statement
         }
         // End IF Statement
     }
     // End IF Statement
     // Check all the Options, then if the no options are created for a relative sub-page... it's not created.
     if (get_option('framework_woo_backend_icon')) {
         $icon = get_option('framework_woo_backend_icon');
     } else {
         $icon = get_template_directory_uri() . '/functions/images/woo-icon.png';
     }
     if (function_exists('add_object_page')) {
         add_object_page('Page Title', $themename, 'manage_options', 'woothemes', 'woothemes_options_page', $icon);
     } else {
         add_menu_page('Page Title', $themename, 'manage_options', 'woothemes_home', 'woothemes_options_page', $icon);
     }
     $woopage = add_submenu_page('woothemes', $themename, __('Theme Options', 'woothemes'), 'manage_options', 'woothemes', 'woothemes_options_page');
     // Default
     // Framework Settings Menu Item
     $wooframeworksettings = '';
     if ($super_user == $current_user_id || empty($super_user)) {
         $wooframeworksettings = add_submenu_page('woothemes', __('Framework Settings', 'woothemes'), __('Framework Settings', 'woothemes'), 'manage_options', 'woothemes_framework_settings', 'woothemes_framework_settings_page');
     }
     // Add SEO Menu Item
     $wooseo = '';
     if (get_option('framework_woo_seo_disable') != 'true') {
         $wooseo = add_submenu_page('woothemes', 'SEO', 'SEO', 'manage_options', 'woothemes_seo', 'woothemes_seo_page');
     }
     // Add Sidebar Manager Menu Item
     $woosbm = '';
     if (get_option('framework_woo_sbm_disable') != 'true') {
         $woosbm = add_submenu_page('woothemes', 'Sidebar Manager', 'Sidebar Manager', 'manage_options', 'woothemes_sbm', 'woothemes_sbm_page');
     }
     // Woothemes Content Builder
     if (function_exists('woothemes_content_builder_menu')) {
         woothemes_content_builder_menu();
     }
     // Custom Navigation Menu Item
     if (function_exists('woo_custom_navigation_menu')) {
         woo_custom_navigation_menu();
     }
     // Update Framework Menu Item
     if ($super_user == $current_user_id || empty($super_user)) {
         $woothemepage = add_submenu_page('woothemes', 'WooFramework Update', 'Update Framework', 'manage_options', 'woothemes_framework_update', 'woothemes_framework_update_page');
     }
     // Update Timthumb Menu Item
     $file_located = locate_template('thumb.php');
     if ($file_located != '') {
         $file_test = woo_check_if_thumbs_are_equal($file_located, true);
     } else {
         $file_test = false;
     }
     $timthumb_update = get_option('woo_timthumb_update');
     if (($super_user == $current_user_id || empty($super_user)) && $timthumb_update == '' && $file_test) {
         $woothemepage = add_submenu_page('woothemes', 'Timthumb Update', 'Update Timthumb', 'manage_options', 'woothemes_timthumb_update', 'woothemes_timthumb_update_page');
     }
     // Buy Themes Menu Item
     if (get_option('framework_woo_buy_themes_disable') != 'true') {
         $woothemepage = add_submenu_page('woothemes', __('Available WooThemes', 'woothemes'), __('Buy Themes', 'woothemes'), 'manage_options', 'woothemes_themes', 'woothemes_more_themes_page');
         add_action("admin_print_scripts-{$woothemepage}", 'woo_load_only');
         add_action("admin_print_styles-{$woothemepage}", 'woo_framework_load_css');
     }
     // Add framework functionaily to the head individually
     add_action("admin_print_scripts-{$woopage}", 'woo_load_only');
     add_action("admin_print_scripts-{$wooframeworksettings}", 'woo_load_only');
     add_action("admin_print_scripts-{$wooseo}", 'woo_load_only');
     add_action("admin_print_scripts-{$woosbm}", 'woo_load_only');
     // Load Framework CSS Files
     add_action("admin_print_styles-{$woopage}", 'woo_framework_load_css');
     add_action("admin_print_styles-{$wooframeworksettings}", 'woo_framework_load_css');
     add_action("admin_print_styles-{$wooseo}", 'woo_framework_load_css');
     add_action("admin_print_styles-{$woosbm}", 'woo_framework_load_css');
     // Add the non-JavaScript "save" to the load of each of the screens.
     add_action("load-{$woopage}", 'woo_nonajax_callback');
     add_action("load-{$wooframeworksettings}", 'woo_nonajax_callback');
     add_action("load-{$wooseo}", 'woo_nonajax_callback');
     // add_action( "load-$woosbm", 'woo_nonajax_callback' );
 }
Beispiel #3
0
function woothemes_add_admin()
{
    global $query_string;
    global $current_user;
    $current_user_id = $current_user->ID;
    $super_user = get_option('framework_woo_super_user');
    $themename = get_option('woo_themename');
    $shortname = get_option('woo_shortname');
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes') {
        if (isset($_REQUEST['woo_save']) && 'reset' == $_REQUEST['woo_save']) {
            $options = get_option('woo_template');
            woo_reset_options($options, 'woothemes');
            header("Location: admin.php?page=woothemes&reset=true");
            die;
        }
    } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes_framework_settings') {
        if (isset($_REQUEST['woo_save']) && 'reset' == $_REQUEST['woo_save']) {
            $options = get_option('woo_framework_template');
            woo_reset_options($options);
            header("Location: admin.php?page=woothemes_framework_settings&reset=true");
            die;
        }
    } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes_seo') {
        if (isset($_REQUEST['woo_save']) && 'reset' == $_REQUEST['woo_save']) {
            $options = get_option('woo_seo_template');
            woo_reset_options($options);
            header("Location: admin.php?page=woothemes_seo&reset=true");
            die;
        }
    }
    // Check all the Options, then if the no options are created for a relative sub-page... it's not created.
    if (get_option('framework_woo_backend_icon')) {
        $icon = get_option('framework_woo_backend_icon');
    } else {
        $icon = get_bloginfo('template_url') . '/functions/images/woo-icon.png';
    }
    if (function_exists('add_object_page')) {
        add_object_page('Page Title', $themename, 8, 'woothemes', 'woothemes_options_page', $icon);
    } else {
        add_menu_page('Page Title', $themename, 8, 'woothemes_home', 'woothemes_options_page', $icon);
    }
    $woopage = add_submenu_page('woothemes', $themename, 'Theme Options', 8, 'woothemes', 'woothemes_options_page');
    // Default
    if ($super_user == $current_user_id || empty($super_user)) {
        $wooframeworksettings = add_submenu_page('woothemes', 'Framework Settings', 'Framework Settings', 8, 'woothemes_framework_settings', 'woothemes_framework_settings_page');
    }
    $wooseo = add_submenu_page('woothemes', 'SEO', 'SEO', 8, 'woothemes_seo', 'woothemes_seo_page');
    //Woothemes Custom Navigation Menu Item
    if (function_exists('woo_custom_navigation_menu')) {
        woo_custom_navigation_menu();
    }
    //Wootheme "Buy Themes" Pagevoid   add_submenu_page  (string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, [callback $function = ''])
    if (get_option('framework_woo_framework_update') == 'true') {
        $woothemepage = add_submenu_page('woothemes', 'WooFramework Update', 'Update Framework', 8, 'woothemes_framework_update', 'woothemes_framework_update_page');
    }
    //Wootheme "Buy Themes" Page
    if (get_option('framework_woo_buy_themes') != 'true') {
        $woothemepage = add_submenu_page('woothemes', 'Available WooThemes', 'Buy Themes', 8, 'woothemes_themes', 'woothemes_more_themes_page');
        add_action("admin_print_scripts-{$woothemepage}", 'woo_load_only');
    }
    // Add framework functionaily to the head individually
    add_action("admin_print_scripts-{$woopage}", 'woo_load_only');
    add_action("admin_print_scripts-{$wooframeworksettings}", 'woo_load_only');
    add_action("admin_print_scripts-{$wooseo}", 'woo_load_only');
}