X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be8dc178e77d0b46189bbd8e33a216a9b90942..refs/tags/wordpress-2.8:/wp-includes/bookmark.php diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 3a04a5cd..81df5a79 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -142,10 +142,15 @@ function get_bookmarks($args = '') { $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); + $cache = array(); $key = md5( serialize( $r ) ); - if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) - if ( isset( $cache[ $key ] ) ) + if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { + if ( is_array($cache) && isset( $cache[ $key ] ) ) return apply_filters('get_bookmarks', $cache[ $key ], $r ); + } + + if ( !is_array($cache) ) + $cache = array(); $inclusions = ''; if ( !empty($include) ) { @@ -180,9 +185,14 @@ function get_bookmarks($args = '') { if (!empty($exclusions)) $exclusions .= ')'; - if ( ! empty($category_name) ) { - if ( $category = get_term_by('name', $category_name, 'link_category') ) + if ( !empty($category_name) ) { + if ( $category = get_term_by('name', $category_name, 'link_category') ) { $category = $category->term_id; + } else { + $cache[ $key ] = array(); + wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); + return apply_filters( 'get_bookmarks', array(), $r ); + } } if ( ! empty($search) ) { @@ -335,7 +345,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { if ( in_array($field, $format_to_edit) ) { $value = format_to_edit($value); } else { - $value = attribute_escape($value); + $value = esc_attr($value); } } else if ( 'db' == $context ) { $value = apply_filters("pre_$field", $value); @@ -345,9 +355,9 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { } if ( 'attribute' == $context ) - $value = attribute_escape($value); + $value = esc_attr($value); else if ( 'js' == $context ) - $value = js_escape($value); + $value = esc_js($value); return $value; }