mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-24 21:32:51 +02:00
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,7 +38,7 @@ $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 ; ?>
|
||||||
|
@ -173,18 +173,28 @@ 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) ) {
|
|
||||||
while ( list($key, $val) = each($custom_fields) ) {
|
|
||||||
if ($key == 'enclosure') {
|
if ($key == 'enclosure') {
|
||||||
if ( is_array($val) ) {
|
|
||||||
foreach ((array)$val as $enc) {
|
foreach ((array)$val as $enc) {
|
||||||
$enclosure = split("\n", $enc);
|
$enclosure = split("\n", $enc);
|
||||||
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
echo apply_filters('rss_enclosure', '<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
Block a user