]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/bookmark.php
Wordpress 2.8
[autoinstalls/wordpress.git] / wp-includes / bookmark.php
index 3a04a5cd6ec3d08250e5ab8572d91f1e4f96c69b..81df5a796d9daf028dae6a344e6585afc505a5f9 100644 (file)
@@ -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;
 }