$_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 ) {
* 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
}
if ( ! empty($search) ) {
- $search = like_escape($search);
+ $search = esc_sql( like_escape( $search ) );
$search = " AND ( (link_url LIKE '%$search%') OR (link_name LIKE '%$search%') OR (link_description LIKE '%$search%') ) ";
}
$join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
}
- if ( $show_updated && get_option('links_recently_updated_time') ) {
- $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_option('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated ";
+ if ( $show_updated ) {
+ $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ";
} else {
$recently_updated_test = '';
}
* @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');
}
-
-?>