Proper atom enclosures. Props rob1n. fixes #1464
git-svn-id: http://svn.automattic.com/wordpress/trunk@4930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6dd7765ae1
commit
2696432efc
|
@ -38,8 +38,8 @@ $more = 1;
|
||||||
<?php if ( !get_option('rss_use_excerpt') ) : ?>
|
<?php if ( !get_option('rss_use_excerpt') ) : ?>
|
||||||
<content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
<content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php rss_enclosure(); ?>
|
<?php atom_enclosure(); ?>
|
||||||
<?php do_action('atom_entry'); ?>
|
<?php do_action('atom_entry'); ?>
|
||||||
</entry>
|
</entry>
|
||||||
<?php endwhile ; ?>
|
<?php endwhile ; ?>
|
||||||
</feed>
|
</feed>
|
|
@ -173,19 +173,29 @@ function rss_enclosure() {
|
||||||
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
|
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$custom_fields = get_post_custom();
|
foreach (get_post_custom() as $k => $v) {
|
||||||
if ( is_array($custom_fields) ) {
|
if ($key == 'enclosure') {
|
||||||
while ( list($key, $val) = each($custom_fields) ) {
|
foreach ((array)$val as $enc) {
|
||||||
if ( $key == 'enclosure' ) {
|
$enclosure = split("\n", $enc);
|
||||||
if ( is_array($val) ) {
|
echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
|
||||||
foreach ( (array) $val as $enc ) {
|
|
||||||
$enclosure = split( "\n", $enc );
|
|
||||||
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
function atom_enclosure() {
|
||||||
|
global $id, $post;
|
||||||
|
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (get_post_custom() as $k => $v) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue