[wp-trac] [WordPress Trac] #7207: Optimizations for atom_enclosures
and rss_enclosures
WordPress Trac
wp-trac at lists.automattic.com
Sun Jun 29 18:27:37 GMT 2008
#7207: Optimizations for atom_enclosures and rss_enclosures
--------------------------+-------------------------------------------------
Reporter: jacobsantos | Owner: anonymous
Type: defect | Status: new
Priority: low | Milestone: 2.7
Component: Optimization | Version: 2.5.1
Severity: minor | Keywords:
--------------------------+-------------------------------------------------
{{{
$metadata = get_post_custom();
if( isset($metadata['enclosure']) ) {
foreach( (array) $metadata['enclosure'] as $enc ) {
$enclosure = split("\n", $enc);
echo apply_filters('atom_enclosure', '<link href="' .
trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' .
trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
}
}
}}}
Might be faster than
{{{
foreach (get_post_custom() as $key => $val) {
if ($key == 'enclosure') {
foreach ((array)$val as $enc) {
$enclosure = split("\n", $enc);
echo apply_filters('atom_enclosure', '<link href="' .
trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' .
trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
}
}
}
}}}
I'll create a patch later, my repository is dirty at the moment.
--
Ticket URL: <http://trac.wordpress.org/ticket/7207>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list