Add some taxonomy validation. Rearrange funcs.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-06-19 00:33:44 +00:00
parent e8dc080307
commit e2dc2a8dd3
5 changed files with 534 additions and 515 deletions

View File

@ -54,7 +54,7 @@ function wp_delete_link($link_id) {
function wp_get_link_cats($link_id = 0) { function wp_get_link_cats($link_id = 0) {
$cats = get_object_terms($link_id, 'link_category', 'fields=ids'); $cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
return array_unique($cats); return array_unique($cats);
} }

View File

@ -68,7 +68,7 @@ function get_the_category($id = false) {
$categories = get_object_term_cache($id, 'category'); $categories = get_object_term_cache($id, 'category');
if ( false === $categories ) if ( false === $categories )
$categories = get_object_terms($id, 'category'); $categories = wp_get_object_terms($id, 'category');
if ( !empty($categories) ) if ( !empty($categories) )
usort($categories, '_usort_terms_by_name'); usort($categories, '_usort_terms_by_name');
@ -420,7 +420,7 @@ function get_the_tags( $id = 0 ) {
$tags = get_object_term_cache($id, 'post_tag'); $tags = get_object_term_cache($id, 'post_tag');
if ( false === $tags ) if ( false === $tags )
$tags = get_object_terms($id, 'post_tag'); $tags = wp_get_object_terms($id, 'post_tag');
$tags = apply_filters( 'get_the_tags', $tags ); $tags = apply_filters( 'get_the_tags', $tags );
if ( empty( $tags ) ) if ( empty( $tags ) )

View File

@ -360,7 +360,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
$join = ''; $join = '';
if ( $in_same_cat ) { if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->term_relationships AS tr ON $wpdb->posts.ID = tr.object_id "; $join = " INNER JOIN $wpdb->term_relationships AS tr ON $wpdb->posts.ID = tr.object_id ";
$cat_array = get_object_terms($post->ID, 'category', 'fields=tt_ids'); $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids');
$join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]); $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]);
for ( $i = 1; $i < (count($cat_array)); $i++ ) { for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]); $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]);
@ -393,7 +393,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
$join = ''; $join = '';
if ( $in_same_cat ) { if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->term_relationships AS tr ON $wpdb->posts.ID = tr.object_id "; $join = " INNER JOIN $wpdb->term_relationships AS tr ON $wpdb->posts.ID = tr.object_id ";
$cat_array = get_object_terms($post->ID, 'category', 'fields=tt_ids'); $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids');
$join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]); $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]);
for ( $i = 1; $i < (count($cat_array)); $i++ ) { for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]); $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]);

View File

@ -440,7 +440,7 @@ function wp_get_post_categories( $post_id = 0, $args = array() ) {
$defaults = array('fields' => 'ids'); $defaults = array('fields' => 'ids');
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
$cats = get_object_terms($post_id, 'category', $args); $cats = wp_get_object_terms($post_id, 'category', $args);
return $cats; return $cats;
} }
@ -450,7 +450,7 @@ function wp_get_post_tags( $post_id = 0, $args = array() ) {
$defaults = array('fields' => 'all'); $defaults = array('fields' => 'all');
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
$tags = get_object_terms($post_id, 'post_tag', $args); $tags = wp_get_object_terms($post_id, 'post_tag', $args);
return $tags; return $tags;
} }

File diff suppressed because it is too large Load Diff