Revert accidental bits that snuck in with [8376]. see #7227
git-svn-id: https://develop.svn.wordpress.org/trunk@8377 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9ba30a1b30
commit
686e7e79aa
|
@ -761,36 +761,20 @@ function &get_terms($taxonomies, $args = '') {
|
||||||
function is_term($term, $taxonomy = '') {
|
function is_term($term, $taxonomy = '') {
|
||||||
global $wpdb;
|
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 ( is_int($term) ) {
|
||||||
if ( 0 == $term )
|
if ( 0 == $term )
|
||||||
return 0;
|
return 0;
|
||||||
$where = 't.term_id = %d';
|
$where = 't.term_id = %d';
|
||||||
if ( !empty($taxonomy) )
|
} else {
|
||||||
return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
|
if ( '' === $term = sanitize_title($term) )
|
||||||
else
|
|
||||||
return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( '' === $slug = sanitize_title($term) )
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
$where = 't.slug = %s';
|
$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) ) )
|
if ( !empty($taxonomy) )
|
||||||
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 $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) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,6 @@ $wp_version = '2.7-bleeding';
|
||||||
*
|
*
|
||||||
* @global int $wp_db_version
|
* @global int $wp_db_version
|
||||||
*/
|
*/
|
||||||
$wp_db_version = 8370;
|
$wp_db_version = 8202;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue