diff options
Diffstat (limited to 'wp-includes/bookmark.php')
| -rw-r--r-- | wp-includes/bookmark.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 5aea9a8..ad2e696 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -3,6 +3,7 @@ function get_bookmark($bookmark_id, $output = OBJECT) { global $wpdb; + $bookmark_id = (int) $bookmark_id; $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$bookmark_id'"); $link->link_category = wp_get_link_cats($bookmark_id); @@ -24,16 +25,17 @@ function get_link($bookmark_id, $output = OBJECT) { function get_bookmarks($args = '') { global $wpdb; - - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', - 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => ''); - $r = array_merge($defaults, $r); - extract($r); + + $defaults = array( + 'orderby' => 'name', 'order' => 'ASC', + 'limit' => -1, 'category' => '', + 'category_name' => '', 'hide_invisible' => 1, + 'show_updated' => 0, 'include' => '', + 'exclude' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r ); $key = md5( serialize( $r ) ); if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) @@ -135,7 +137,7 @@ function get_bookmarks($args = '') { $results = $wpdb->get_results($query); $cache[ $key ] = $results; - wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); + wp_cache_add( 'get_bookmarks', $cache, 'bookmark' ); return apply_filters('get_bookmarks', $results, $r); } |
