do_enclose() can ping the same URL many times, can't filter URLs to ping
|Reported by:||mdawaffe||Owned by:||nacin|
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.
- Correct non-functional DELETE FROM postmeta query (bad use of wpdb::prepare()).
- Use like_escape() in several LIKE queries.
- Add an apply_filters( 'enclosure_mime_types', array( 'video', 'audio' ) ) hook.
- 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.
- Efficiency improvements in conditional logic.
- Clean up code by reducing control structure nesting depth.
Change History (10)
- Keywords 3.2-early added
- Milestone changed from 3.1 to Future Release
- Type changed from defect (bug) to enhancement
- Keywords 3.6-early added; 3.2-early removed
- Owner set to nacin
- Status changed from new to accepted