diff options
-rw-r--r-- | wp-admin/admin-functions.php | 24 | ||||
-rw-r--r-- | wp-content/themes/default/sidebar.php | 2 | ||||
-rw-r--r-- | wp-includes/category.php | 16 | ||||
-rw-r--r-- | wp-includes/theme.php | 23 | ||||
-rw-r--r-- | wp-settings.php | 1 |
5 files changed, 33 insertions, 33 deletions
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index fba1748..60f45f3 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1267,30 +1267,6 @@ function edInsertContent(myField, myValue) { '; } -function validate_current_theme() { - $theme_loc = 'wp-content/themes'; - $theme_root = ABSPATH.$theme_loc; - - $template = get_settings('template'); - $stylesheet = get_settings('stylesheet'); - - if (($template != 'default') && (!file_exists( get_template_directory() . "/index.php"))) { - update_option('template', 'default'); - update_option('stylesheet', 'default'); - do_action('switch_theme', 'Default'); - return false; - } - - if (($stylesheet != 'default') && (!file_exists( get_stylesheet_directory() . "/style.css"))) { - update_option('template', 'default'); - update_option('stylesheet', 'default'); - do_action('switch_theme', 'Default'); - return false; - } - - return true; -} - function get_broken_themes() { global $wp_broken_themes; diff --git a/wp-content/themes/default/sidebar.php b/wp-content/themes/default/sidebar.php index 7ed8c11..0ce9b38 100644 --- a/wp-content/themes/default/sidebar.php +++ b/wp-content/themes/default/sidebar.php @@ -46,7 +46,7 @@ </ul> </li> - <?php wp_list_categories('sort_column=name&optioncount=1&hierarchical=0&title_li=<h2>Categories</h2>'); ?> + <?php wp_list_categories('optioncount=1&hierarchical=0&title_li=<h2>Categories</h2>'); ?> <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php wp_list_bookmarks(); ?> diff --git a/wp-includes/category.php b/wp-includes/category.php index 8c73e6c..30392a7 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -20,9 +20,14 @@ function &get_categories($args = '') { parse_str($args, $r); $defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', - 'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, $exclude => '', $include => ''); + 'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, $exclude => '', $include => '', + 'number' => ''); $r = array_merge($defaults, $r); - $r['orderby'] = "cat_" . $r['orderby']; // restricts order by to cat_ID and cat_name fields + if ( 'count' == $r['orderby'] ) + $r['orderby'] = 'category_count'; + else + $r['orderby'] = "cat_" . $r['orderby']; // restricts order by to cat_ID and cat_name fields + $r['number'] = (int) $r['number']; extract($r); $where = 'cat_ID > 0'; @@ -70,7 +75,12 @@ function &get_categories($args = '') { $having = 'HAVING category_count > 0'; } - $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE $where $having ORDER BY $orderby $order"); + if ( !empty($number) ) + $number = 'LIMIT ' . $number; + else + $number = ''; + + $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE $where $having ORDER BY $orderby $order $number"); if ( empty($categories) ) return array(); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 182d148..2ce5641 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -26,11 +26,6 @@ function get_stylesheet_uri() { } function get_template() { - $template = get_settings('template'); - if (!file_exists(get_theme_root() . "/$template")) { //works for dirs too - update_option('template', 'default'); - update_option('stylesheet', 'default'); - } return apply_filters('template', get_settings('template')); } @@ -375,4 +370,22 @@ function load_template($file) { require_once($file); } +function validate_current_theme() { + if ((get_template() != 'default') && (!file_exists(get_template_directory() . '/index.php'))) { + update_option('template', 'default'); + update_option('stylesheet', 'default'); + do_action('switch_theme', 'Default'); + return false; + } + + if ((get_stylesheet() != 'default') && (!file_exists(get_template_directory() . '/style.css'))) { + update_option('template', 'default'); + update_option('stylesheet', 'default'); + do_action('switch_theme', 'Default'); + return false; + } + + return true; +} + ?> diff --git a/wp-settings.php b/wp-settings.php index a70c430..0036d26 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -264,6 +264,7 @@ $wp_query = new WP_Query(); $wp_rewrite = new WP_Rewrite(); $wp = new WP(); +validate_current_theme(); define('TEMPLATEPATH', get_template_directory()); // Load the default text localization domain. |