Make WordPress Core

Ticket #25468: 25468.4.diff

File 25468.4.diff, 2.3 KB (added by kpdesign, 11 years ago)

Second pass on 25468-3.diff

  • src/wp-includes/bookmark.php

     
    136136        $key = md5( serialize( $r ) );
    137137        if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
    138138                if ( is_array($cache) && isset( $cache[ $key ] ) )
    139                         return apply_filters('get_bookmarks', $cache[ $key ], $r );
     139                        $bookmarks = $cache[ $key ];
     140                        /**
     141                         * Filter the returned list of bookmarks.
     142                         *
     143                         * The first instance of the filter returns the cached bookmarks
     144                         * list. The second instance returns a cached bookmarks list if the
     145                         * link category is passed but doesn't exist. The third instance
     146                         * returns the full cached results.
     147                          *
     148                         * @since 2.1.0
     149                         *
     150                         * @param array $bookmarks List of the cached bookmarks.
     151                         * @param array $r         An array of bookmark query arguments. @see get_bookmarks()
     152                         */
     153                        return apply_filters( 'get_bookmarks', $bookmarks, $r );
    140154        }
    141155
    142156        if ( !is_array($cache) )
     
    181195                } else {
    182196                        $cache[ $key ] = array();
    183197                        wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     198                        //duplicate_hook
    184199                        return apply_filters( 'get_bookmarks', array(), $r );
    185200                }
    186201        }
     
    263278        $cache[ $key ] = $results;
    264279        wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
    265280
    266         return apply_filters('get_bookmarks', $results, $r);
     281        //duplicate_hook
     282        return apply_filters( 'get_bookmarks', $results, $r );
    267283}
    268284
    269285/**
     
    352368                return $value;
    353369
    354370        if ( 'edit' == $context ) {
    355                 $value = apply_filters("edit_$field", $value, $bookmark_id);
     371                //duplicate_hook
     372                $value = apply_filters( "edit_$field", $value, $bookmark_id );
    356373
    357374                if ( 'link_notes' == $field ) {
    358375                        $value = esc_html( $value ); // textarea_escaped
     
    360377                        $value = esc_attr($value);
    361378                }
    362379        } else if ( 'db' == $context ) {
    363                 $value = apply_filters("pre_$field", $value);
     380                //duplicate_hook
     381                $value = apply_filters( "pre_$field", $value );
    364382        } else {
    365                 // Use display filters by default.
    366                 $value = apply_filters($field, $value, $bookmark_id, $context);
     383                //duplicate_hook
     384                $value = apply_filters( $field, $value, $bookmark_id, $context );
    367385
    368386                if ( 'attribute' == $context )
    369387                        $value = esc_attr($value);