Commit 580d01f8 authored by root's avatar root Committed by lechuck

Import wordpress 3.1.2

parent 30b46044
......@@ -8,7 +8,7 @@
<body>
<h1 id="logo">
<a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" width="250" height="68" /></a>
<br /> Version 3.1
<br /> Version 3.1.2
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
......
......@@ -72,7 +72,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ) ";
} else {
if ( $like_s != trim('/', $current_site->path) )
$blog_s = $current_site->path .= $like_s . $wild . '/';
$blog_s = $current_site->path . $like_s . $wild . '/';
else
$blog_s = $like_s;
$query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' )";
......
......@@ -310,6 +310,8 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( empty( $posts ) )
$posts = $wp_query->posts;
add_filter( 'the_title', 'esc_html' );
if ( $this->hierarchical_display ) {
$this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
} else {
......@@ -320,8 +322,6 @@ class WP_Posts_List_Table extends WP_List_Table {
function _display_rows( $posts ) {
global $post, $mode;
add_filter( 'the_title', 'esc_html' );
// Create array of post IDs.
$post_ids = array();
......@@ -522,7 +522,6 @@ class WP_Posts_List_Table extends WP_List_Table {
}
}
$post->post_title = esc_html( $post->post_title );
$pad = str_repeat( '&#8212; ', $level );
?>
<td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
......
......@@ -1349,7 +1349,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$stylesheet = $this->upgrader->result['destination_name'];
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
$install_actions = array(
......
......@@ -609,7 +609,7 @@ function wp_dashboard_recent_comments() {
$total_items = isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] )
? absint( $widgets['dashboard_recent_comments']['items'] ) : 5;
while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
while ( count( $comments ) < $total_items && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
foreach ( $possible as $comment ) {
if ( count( $comments ) >= $total_items )
......
......@@ -499,6 +499,7 @@ function media_upload_image() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
......@@ -604,6 +605,7 @@ function media_upload_audio() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
......@@ -662,6 +664,7 @@ function media_upload_video() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
......@@ -720,6 +723,7 @@ function media_upload_file() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
......
......@@ -294,7 +294,7 @@ function update_core($from, $to) {
$mysql_version = $wpdb->db_version();
$required_php_version = '4.3';
$required_mysql_version = '4.1.2';
$wp_version = '3.1';
$wp_version = '3.1.2';
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
......
......@@ -38,6 +38,7 @@ if ( isset($_GET['inline']) ) {
$errors = array();
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
......
......@@ -108,7 +108,6 @@ add_contextual_help($current_screen,
'<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' .
'<p>' . __('The next screen for Network will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' .
'<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .
'<p>' . __('Refreshing your browser will take you to a screen with an archive of those added lines of code. A set of six links under Super Admin will appear at the top of the main left navigation menu. The multisite network is now enabled.') . '</p>' .
'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed soon in a future version.') . '</p>' .
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
......
......@@ -15,7 +15,7 @@ require_once( dirname( dirname( __FILE__ ) ) . '/admin.php' );
if ( ! is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! is_main_site() ) {
if ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) ) {
wp_redirect( network_admin_url() );
exit;
}
......
......@@ -28,7 +28,6 @@ add_contextual_help($current_screen,
'<p>' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '</p>' .
'<p>' . __('Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list.') . '</p>' .
'<p>' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '</p>' .
'<p>' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Super Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '</p>' .
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' .
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
......
......@@ -56,7 +56,12 @@ function press_it() {
}
}
// set the post_content and status
$quick['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft';
if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
$quick['post_status'] = 'publish';
elseif ( isset( $_POST['review'] ) )
$quick['post_status'] = 'pending';
else
$quick['post_status'] = 'draft';
$quick['post_content'] = $content;
// error handling for media_sideload
if ( is_wp_error($upload) ) {
......
......@@ -86,7 +86,7 @@ switch ( $step ) :
wp_upgrade();
$backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
$backto = esc_url_raw( $backto );
$backto = esc_url( $backto );
$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
?>
<h2><?php _e( 'Update Complete' ); ?></h2>
......
......@@ -16,7 +16,7 @@ if ( ! is_multisite() ) {
exit;
}
if ( ! is_main_site() ) {
if ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) ) {
wp_redirect( user_admin_url() );
exit;
}
......
......@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Twenty Ten 1.2\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyten\n"
"POT-Creation-Date: 2011-02-22 08:27:25+00:00\n"
"POT-Creation-Date: 2011-02-22 08:27:35+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
......
......@@ -337,14 +337,14 @@ function show_admin_bar( $show ) {
* @return bool Whether the admin bar should be showing.
*/
function is_admin_bar_showing() {
global $show_admin_bar;
global $show_admin_bar, $pagenow;
/* For all these types of request we never want an admin bar period */
if ( defined('XMLRPC_REQUEST') || defined('APP_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
return false;
if ( ! isset( $show_admin_bar ) ) {
if ( ! is_user_logged_in() ) {
if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
$show_admin_bar = false;
} else {
$context = is_admin() ? 'admin' : 'front';
......
......@@ -35,9 +35,9 @@
* not needed or the string of the URL
*/
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
global $wp_rewrite, $is_iis7, $wp_query, $wpdb;
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 && !iis7_supports_permalinks() ) )
if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || $is_IIS )
return;
if ( !$requested_url ) {
......@@ -150,7 +150,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
$term_count += count( $tax_query['terms'] );
$obj = $wp_query->get_queried_object();
if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) {
if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) && !empty($redirect['query']) ) {
if ( !empty($redirect['query']) ) {
if ( is_category() ) {
$redirect['query'] = remove_query_arg( array( 'category_name', 'category', 'cat'), $redirect['query']);
......@@ -195,7 +195,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
}
$addl_path = '';
if ( is_feed() ) {
if ( is_feed() && in_array( get_query_var('feed'), $wp_rewrite->feeds ) ) {
$addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
if ( get_query_var( 'withcomments' ) )
$addl_path .= 'comments/';
......
......@@ -15,7 +15,7 @@
*
* pop3 class
*
* $Id: class-pop3.php 17435 2011-02-09 17:35:36Z ryan $
* $Id: class-pop3.php 17436 2011-02-09 17:36:23Z ryan $
*/
class POP3 {
......
This diff is collapsed.
......@@ -192,6 +192,8 @@
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a img {
width: 16px;
height: 16px;
display: inline;
border: 1px solid #999;
vertical-align: middle;
......@@ -205,6 +207,10 @@
left: 30px;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul {
left: 0;
}
#wpadminbar .quicklinks .menupop li a img.blavatar {
vertical-align: middle;
margin: 0 8px 0 0;
......
......@@ -1386,7 +1386,11 @@ function _make_email_clickable_cb($matches) {
function make_clickable($ret) {
$ret = ' ' . $ret;
// in testing, using arrays here was found to be faster
$ret = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);
$save = @ini_set('pcre.recursion_limit', 10000);
$retval = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]{1,2000}|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);
if (null !== $retval )
$ret = $retval;
@ini_set('pcre.recursion_limit', $save);
$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
// this one is not in an array because we need it to run last, for cleanup of accidental links within links
......
......@@ -4302,7 +4302,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
}
foreach ( $all_headers as $field => $regex ) {
preg_match( '/^[ \t\/*#]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});
preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});
if ( !empty( ${$field} ) )
${$field} = _cleanup_header_comment( ${$field}[1] );
else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -847,6 +847,8 @@ function get_post_type_archive_link( $post_type ) {
$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
if ( $post_type_obj->rewrite['with_front'] )
$struct = $wp_rewrite->front . $struct;
else
$struct = $wp_rewrite->root . $struct;
$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
} else {
$link = home_url( '?post_type=' . $post_type );
......@@ -2411,7 +2413,7 @@ function wp_shortlink_wp_head() {
if ( empty( $shortlink ) )
return;
echo "<link rel='shortlink' href='" . esc_url_raw( $shortlink ) . "' />\n";
echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
}
/**
......
......@@ -368,19 +368,19 @@ function update_meta_cache($meta_type, $object_ids) {
* Possible values: 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'.
* Default: 'CHAR'
*
* @param string $meta_type
* @param string $type Type of meta
* @param string $primary_table
* @param string $primary_id_column
* @param object $context (optional) The main query object
* @return array( 'join' => $join_sql, 'where' => $where_sql )
*/
function _get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_column, $context = null ) {
function _get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
global $wpdb;
if ( ! $meta_table = _get_meta_table( $meta_type ) )
if ( ! $meta_table = _get_meta_table( $type ) )
return false;
$meta_id_column = esc_sql( $meta_type . '_id' );
$meta_id_column = esc_sql( $type . '_id' );
$join = '';
$where = '';
......@@ -442,7 +442,7 @@ function _get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_col
$where .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string}", $meta_value );
}
return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) );
return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $type, $primary_table, $primary_id_column, &$context ) );
}
/**
......
......@@ -1100,9 +1100,8 @@ class Walker_PageDropdown extends Walker {
if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$title = esc_html($page->post_title);
$title = apply_filters( 'list_pages', $page->post_title );
$output .= "$pad$title";
$output .= $pad . esc_html( $title );
$output .= "</option>\n";
}
}
......
......@@ -985,6 +985,11 @@ function register_post_type($post_type, $args = array()) {
if ( $args->has_archive ) {
$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
if ( $args->rewrite['with_front'] )
$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
else
$archive_slug = $wp_rewrite->root . $archive_slug;
$wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
......@@ -5236,4 +5241,4 @@ function _post_format_wp_get_object_terms( $terms ) {
}
add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
?>
\ No newline at end of file
?>
......@@ -1231,13 +1231,22 @@ class WP_Query {
var $is_post_type_archive = false;
/**
* Whether the tax query has been parsed once.
* Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know
* whether we have to re-parse because something has changed
*
* @since 3.1.0
* @access private
* @var bool
*/
var $parsed_tax_query = false;
var $query_vars_hash = false;
/**
* Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made
* via pre_get_posts hooks.
*
* @since 3.1.1
* @access private
*/
var $query_vars_changed = true;
/**
* Resets query flags to false.
......@@ -1395,6 +1404,7 @@ class WP_Query {
$this->query_vars = $this->fill_query_vars($this->query_vars);
$qv = &$this->query_vars;
$this->query_vars_changed = true;
if ( ! empty($qv['robots']) )
$this->is_robots = true;
......@@ -1496,11 +1506,11 @@ class WP_Query {
$this->is_date = true;
}
$this->parsed_tax_query = false;
$this->query_vars_hash = false;
$this->parse_tax_query( $qv );
foreach ( $this->tax_query->queries as $tax_query ) {
if ( 'IN' == $tax_query['operator'] ) {
if ( 'NOT IN' != $tax_query['operator'] ) {
switch ( $tax_query['taxonomy'] ) {
case 'category':
$this->is_category = true;
......@@ -1627,6 +1637,9 @@ class WP_Query {
if ( '404' == $qv['error'] )
$this->set_404();
$this->query_vars_hash = md5( serialize( $this->query_vars ) );
$this->query_vars_changed = false;
do_action_ref_array('parse_query', array(&$this));
}
......@@ -1654,6 +1667,9 @@ class WP_Query {
}
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
if ( 'post_tag' == $taxonomy )
continue; // Handled further down in the $q['tag'] block
if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
$tax_query_defaults = array(
'taxonomy' => $taxonomy,
......@@ -1682,7 +1698,7 @@ class WP_Query {
}
// Category stuff
if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && !$this->parsed_tax_query ) {
if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && $this->query_vars_changed ) {
$q['cat'] = ''.urldecode($q['cat']).'';
$q['cat'] = addslashes_gpc($q['cat']);
$cat_array = preg_split('/[,\s]+/', $q['cat']);
......@@ -1736,7 +1752,7 @@ class WP_Query {
}
// Tag stuff
if ( '' != $q['tag'] && !$this->is_singular && !$this->parsed_tax_query ) {
if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
if ( strpos($q['tag'], ',') !== false ) {
$tags = preg_split('/[,\s]+/', $q['tag']);
foreach ( (array) $tags as $tag ) {
......@@ -1790,7 +1806,7 @@ class WP_Query {
}
if ( !empty($q['tag_slug__in']) ) {
$q['tag_slug__in'] = array_map('sanitize_title', (array) $q['tag_slug__in']);
$q['tag_slug__in'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__in'] ) );
$tax_query[] = array(
'taxonomy' => 'post_tag',
'terms' => $q['tag_slug__in'],
......@@ -1799,7 +1815,7 @@ class WP_Query {
}
if ( !empty($q['tag_slug__and']) ) {
$q['tag_slug__and'] = array_map('sanitize_title', (array) $q['tag_slug__and']);
$q['tag_slug__and'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__and'] ) );
$tax_query[] = array(
'taxonomy' => 'post_tag',
'terms' => $q['tag_slug__and'],
......@@ -1808,8 +1824,6 @@ class WP_Query {
);
}
$this->parsed_tax_query = true;
$this->tax_query = new WP_Tax_Query( $tax_query );
}
......@@ -1879,8 +1893,17 @@ class WP_Query {
// Shorthand.
$q = &$this->query_vars;
// Fill again in case pre_get_posts unset some vars.
$q = $this->fill_query_vars($q);
// Set a flag if a pre_get_posts hook changed the query vars.
$hash = md5( serialize( $this->query_vars ) );
if ( $hash != $this->query_vars_hash ) {
$this->query_vars_changed = true;
$this->query_vars_hash = $hash;
}
unset($hash);
// First let's clear some variables
$distinct = '';
$whichauthor = '';
......@@ -2147,12 +2170,14 @@ class WP_Query {
$search = apply_filters_ref_array('posts_search', array( $search, &$this ) );
// Taxonomies
$this->parse_tax_query( $q );
if ( !$this->is_singular ) {
$this->parse_tax_query( $q );
$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
$join .= $clauses['join'];
$where .= $clauses['where'];
$join .= $clauses['join'];
$where .= $clauses['where'];
}
if ( $this->is_tax ) {
if ( empty($post_type) ) {
......@@ -2439,6 +2464,16 @@ class WP_Query {
$where .= ')';
}
// Parse the meta query again if query vars have changed.
if ( $this->query_vars_changed ) {
$meta_query_hash = md5( serialize( $q['meta_query'] ) );
$_meta_query = $q['meta_query'];
unset( $q['meta_query'] );
_parse_meta_query( $q );
if ( md5( serialize( $q['meta_query'] ) ) != $meta_query_hash && is_array( $_meta_query ) )
$q['meta_query'] = array_merge( $_meta_query, $q['meta_query'] );
}
if ( !empty( $q['meta_query'] ) ) {
$clauses = call_user_func_array( '_get_meta_sql', array( $q['meta_query'], 'post', $wpdb->posts, 'ID', &$this) );
$join .= $clauses['join'];
......@@ -2892,6 +2927,9 @@ class WP_Query {
if ( $term && ! is_wp_error($term) ) {
$this->queried_object = $term;
$this->queried_object_id = (int) $term->term_id;
if ( $this->is_category )
_make_cat_compat( $this->queried_object );
}
} elseif ( $this->is_post_type_archive ) {
$this->queried_object = get_post_type_object( $this->get('post_type') );
......
......@@ -1857,6 +1857,8 @@ class WP_Rewrite {
function add_permastruct($name, $struct, $with_front = true, $ep_mask = EP_NONE) {
if ( $with_front )
$struct = $this->front . $struct;
else
$struct = $this->root . $struct;
$this->extra_permastructs[$name] = array($struct, $ep_mask);
}
......
......@@ -502,7 +502,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110122' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110325' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101224' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101224' );
......
......@@ -15,6 +15,8 @@
* Creates the initial taxonomies when 'init' action is fired.
*/
function create_initial_taxonomies() {
global $wp_rewrite;
register_taxonomy( 'category', 'post', array(
'hierarchical' => true,
'update_count_callback' => '_update_post_term_count',
......@@ -22,7 +24,7 @@ function create_initial_taxonomies() {
'rewrite' => did_action( 'init' ) ? array(
'hierarchical' => true,
'slug' => get_option('category_base') ? get_option('category_base') : 'category',
'with_front' => false) : false,
'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false,
'public' => true,
'show_ui' => true,
'_builtin' => true,
......@@ -34,7 +36,7 @@ function create_initial_taxonomies() {
'query_var' => 'tag',
'rewrite' => did_action( 'init' ) ? array(
'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
'with_front' => false) : false,
'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false,
'public' => true,
'show_ui' => true,
'_builtin' => true,
......@@ -329,7 +331,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
$tag = '([^/]+)';
$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
$wp_rewrite->add_permastruct($taxonomy, "{$wp_rewrite->root}{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
$wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
}
if ( is_null($args['show_ui']) )
......@@ -887,7 +889,10 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
$value = stripslashes($value);
$field = 't.name';
} else {
return get_term( (int) $value, $taxonomy, $output, $filter);
$term = get_term( (int) $value, $taxonomy, $output, $filter);
if ( is_wp_error( $term ) )
$term = false;
return $term;
}
$term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
......@@ -2842,7 +2847,9 @@ function get_term_link( $term, $taxonomy = '') {
$t = get_taxonomy($taxonomy);
if ( empty($termlink) ) {
if ( $t->query_var )
if ( 'category' == $taxonomy )
$termlink = '?cat=' . $term->term_id;
elseif ( $t->query_var )
$termlink = "?$t->query_var=$slug";
else