author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Atom Feed Template for displaying Atom Comments feed. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
*/ |
|
7 |
||
8 |
header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true); |
|
9 |
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'; |
|
10 |
?> |
|
11 |
<feed |
|
12 |
xmlns="http://www.w3.org/2005/Atom" |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
13 |
xml:lang="<?php bloginfo_rss( 'language' ); ?>" |
136 | 14 |
xmlns:thr="http://purl.org/syndication/thread/1.0" |
15 |
<?php do_action('atom_ns'); do_action('atom_comments_ns'); ?> |
|
16 |
> |
|
17 |
<title type="text"><?php |
|
18 |
if ( is_singular() ) |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
19 |
printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() ); |
136 | 20 |
elseif ( is_search() ) |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
21 |
printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); |
136 | 22 |
else |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
23 |
printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() ); |
136 | 24 |
?></title> |
25 |
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> |
|
26 |
||
27 |
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated> |
|
28 |
||
29 |
<?php if ( is_singular() ) { ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
30 |
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" /> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
31 |
<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
32 |
<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id> |
136 | 33 |
<?php } elseif(is_search()) { ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
34 |
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" /> |
136 | 35 |
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" /> |
36 |
<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id> |
|
37 |
<?php } else { ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
38 |
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" /> |
136 | 39 |
<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" /> |
40 |
<id><?php bloginfo_rss('comments_atom_url'); ?></id> |
|
41 |
<?php } ?> |
|
42 |
<?php do_action('comments_atom_head'); ?> |
|
43 |
<?php |
|
44 |
if ( have_comments() ) : while ( have_comments() ) : the_comment(); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID ); |
136 | 46 |
?> |
47 |
<entry> |
|
48 |
<title><?php |
|
49 |
if ( !is_singular() ) { |
|
50 |
$title = get_the_title($comment_post->ID); |
|
51 |
$title = apply_filters('the_title_rss', $title); |
|
52 |
printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); |
|
53 |
} else { |
|
54 |
printf(ent2ncr(__('By: %s')), get_comment_author_rss()); |
|
55 |
} |
|
56 |
?></title> |
|
57 |
<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" /> |
|
58 |
||
59 |
<author> |
|
60 |
<name><?php comment_author_rss(); ?></name> |
|
61 |
<?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?> |
|
62 |
||
63 |
</author> |
|
64 |
||
65 |
<id><?php comment_guid(); ?></id> |
|
66 |
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></updated> |
|
67 |
<published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></published> |
|
68 |
<?php if ( post_password_required($comment_post) ) : ?> |
|
69 |
<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> |
|
70 |
<?php else : // post pass ?> |
|
71 |
<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content> |
|
72 |
<?php endif; // post pass |
|
73 |
// Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt) |
|
74 |
if ( $comment->comment_parent == 0 ) : // This comment is top level ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
75 |
<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" /> |
136 | 76 |
<?php else : // This comment is in reply to another comment |
77 |
$parent_comment = get_comment($comment->comment_parent); |
|
78 |
// The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system |
|
79 |
?> |
|
80 |
<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" /> |
|
81 |
<?php endif; |
|
82 |
do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID); |
|
83 |
?> |
|
84 |
</entry> |
|
85 |
<?php endwhile; endif; ?> |
|
86 |
</feed> |