[wp-trac] [WordPress Trac] #14493: do_enclose() can ping the same URL many times, can't filter URLs to ping

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 31 18:52:01 UTC 2010


#14493: do_enclose() can ping the same URL many times, can't filter URLs to ping
--------------------------+-------------------------------------------------
 Reporter:  mdawaffe      |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Feeds         |     Version:  3.0.1          
 Severity:  normal        |    Keywords:  has-patch      
--------------------------+-------------------------------------------------
 If the same URL is included in a post several times, do_enclose() can
 check that URL for inclusion as a possible enclosure several times.

 Additionally, there's no way to filter what URLs do_enclose() should ping
 for possible inclusion as enclosures.

 Attached adds an array_unique() call to do_enclose().

 Attached adds a {{{do_action_ref_array( 'pre_enclose', array(
 &$post_links, &$pung ) )}}} hook to allow filtration of URLs to ping.
 (Matches the pre_ping hook.)

 do_enclose() has several more problems this patch addresses.

  1. Correct non-functional DELETE FROM postmeta query (bad use of
 wpdb::prepare()).
  2. Use like_escape() in several LIKE queries.
  3. Add an {{{apply_filters( 'enclosure_mime_types', array( 'video',
 'audio' ) )}}} hook.
  4. Currently do_enclose() doesn't allow root URLs as enclosures (e.g.
 http://example.com/), only URLs with a non-trivial path or query.  Move
 that functionality to the new pre_enclose filter.
  5. Efficiency improvements in conditional logic.
  6. Clean up code by reducing control structure nesting depth.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14493>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list