Revert accidental bits that snuck in with [8376]. see #7227

git-svn-id: http://svn.automattic.com/wordpress/trunk@8377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-19 19:00:56 +00:00
parent 8831ea942b
commit d845973d7b
2 changed files with 8 additions and 24 deletions

View File

@ -761,36 +761,20 @@ function &get_terms($taxonomies, $args = '') {
function is_term($term, $taxonomy = '') {
global $wpdb;
$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
if ( is_int($term) ) {
if ( 0 == $term )
return 0;
$where = 't.term_id = %d';
if ( !empty($taxonomy) )
return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
else
return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
}
if ( '' === $slug = sanitize_title($term) )
} else {
if ( '' === $term = sanitize_title($term) )
return 0;
$where = 't.slug = %s';
$else_where = 't.name = %s';
if ( !empty($taxonomy) ) {
if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) )
return $result;
return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
}
if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) )
return $result;
if ( !empty($taxonomy) )
return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) );
return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $term) );
}
/**

View File

@ -15,6 +15,6 @@ $wp_version = '2.7-bleeding';
*
* @global int $wp_db_version
*/
$wp_db_version = 8370;
$wp_db_version = 8202;
?>