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' ) ) { 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', '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', 'Framework Settings', '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' ); } // Buy Themes Menu Item if(get_option( 'framework_woo_buy_themes_disable') != 'true') { $woothemepage = add_submenu_page( 'woothemes', 'Available WooThemes', 'Buy Themes', 'manage_options', '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' ); add_action( "admin_print_scripts-$woosbm", 'woo_load_only' ); } } add_action( 'admin_menu', 'woothemes_add_admin' ); /*-----------------------------------------------------------------------------------*/ /* WooThemes Reset Function - woo_reset_options */ /*-----------------------------------------------------------------------------------*/ if (!function_exists( 'woo_reset_options')) { function woo_reset_options($options,$page = ''){ $excludes = array( 'blogname' , 'blogdescription' ); foreach($options as $option){ if(isset($option['id'])){ $option_id = $option['id']; $option_type = $option['type']; //Skip assigned id's if(in_array($option_id,$excludes)) { continue; } if($option_type == 'multicheck'){ foreach($option['options'] as $option_key => $option_option){ $del = $option_id . "_" . $option_key; delete_option($del); } } else if(is_array($option_type)) { foreach($option_type as $inner_option){ $option_id = $inner_option['id']; $del = $option_id; delete_option($option_id); } } else { delete_option($option_id); } } } //When Theme Options page is reset - Add the woo_options option if($page == 'woothemes'){ delete_option( 'woo_options' ); } } } /*-----------------------------------------------------------------------------------*/ /* Framework options panel - woothemes_options_page */ /*-----------------------------------------------------------------------------------*/ if (!function_exists( 'woothemes_options_page')) { function woothemes_options_page(){ $options = get_option( 'woo_template' ); $themename = get_option( 'woo_themename' ); $shortname = get_option( 'woo_shortname' ); $manualurl = get_option( 'woo_manual' ); //Framework Version in Backend Header $woo_framework_version = get_option( 'woo_framework_version' ); //Version in Backend Header $theme_data = get_theme_data( get_template_directory() . '/style.css' ); $local_version = $theme_data['Version']; //GET themes update RSS feed and do magic include_once(ABSPATH . WPINC . '/feed.php' ); $pos = strpos($manualurl, 'documentation' ); $theme_slug = str_replace( "/", "", substr($manualurl, ($pos + 13))); //13 for the word documentation //add filter to make the rss read cache clear every 4 hours //add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 14400;' ) ); //Check for latest version of the theme $update_message = ''; if(get_option( 'framework_woo_theme_version_checker') == 'true') { $update_message = woothemes_version_checker($local_version); } global $pagenow; ?>
'.$error.')