X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/5aa86a9053fb0fa15846bb60aac2fb8fdfff524a..refs/tags/wordpress-3.5.2-scripts:/wp-includes/bookmark.php diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index c965d4c8..ab4b8c8c 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -33,11 +33,16 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') { $_bookmark = & $GLOBALS['link']; } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); - $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) ); - wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark'); + if ( $_bookmark ) { + $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); + wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); + } } } + if ( ! $_bookmark ) + return $_bookmark; + $_bookmark = sanitize_bookmark($_bookmark, $filter); if ( $output == OBJECT ) { @@ -101,9 +106,9 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) { * links marked as 'invisible'. * 'show_updated' - Default is 0 (integer). Will show the time of when the * bookmark was last updated. - * 'include' - Default is empty string (string). Include other categories + * 'include' - Default is empty string (string). Include bookmark ID(s) * separated by commas. - * 'exclude' - Default is empty string (string). Exclude other categories + * 'exclude' - Default is empty string (string). Exclude bookmark ID(s) * separated by commas. * * @since 2.1.0 @@ -375,9 +380,8 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { * @since 2.7.0 * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks' */ -function clean_bookmark_cache($bookmark_id) { +function clean_bookmark_cache( $bookmark_id ) { wp_cache_delete( $bookmark_id, 'bookmark' ); wp_cache_delete( 'get_bookmarks', 'bookmark' ); + clean_object_term_cache( $bookmark_id, 'link'); } - -?>