Deprecate permalink_single_rss(). Add the_permalink_rss() with accompanying filter. Props joostdevalk and Otto42. fixes #4654
git-svn-id: http://svn.automattic.com/wordpress/trunk@5910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d3754cc69b
commit
9b395107f4
|
@ -25,7 +25,7 @@ require_once ('admin-header.php');
|
|||
<select name="author">
|
||||
<option value="all" selected="selected"><?php _e('All'); ?></option>
|
||||
<?php
|
||||
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
|
||||
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
|
||||
foreach ( $authors as $id ) {
|
||||
$o = get_userdata( $id );
|
||||
echo "<option value='$o->ID'>$o->display_name</option>";
|
||||
|
@ -131,9 +131,9 @@ print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
|||
?>
|
||||
|
||||
<!--
|
||||
This is a WordPress eXtended RSS file generated by WordPress as an export of
|
||||
your blog. It contains information about your blog's posts, comments, and
|
||||
categories. You may use this file to transfer that content from one site to
|
||||
This is a WordPress eXtended RSS file generated by WordPress as an export of
|
||||
your blog. It contains information about your blog's posts, comments, and
|
||||
categories. You may use this file to transfer that content from one site to
|
||||
another. This file is not intended to serve as a complete backup of your
|
||||
blog.
|
||||
|
||||
|
@ -143,10 +143,10 @@ print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
|||
2. Go to Manage > Import in the blog's admin.
|
||||
3. Choose "WordPress" from the list of importers.
|
||||
4. Upload this file using the form provided on that page.
|
||||
5. You will first be asked to map the authors in this export file to users
|
||||
on the blog. For each author, you may choose to map an existing user on
|
||||
5. You will first be asked to map the authors in this export file to users
|
||||
on the blog. For each author, you may choose to map an existing user on
|
||||
the blog or to create a new user.
|
||||
6. WordPress will then import each of the posts, comments, and categories
|
||||
6. WordPress will then import each of the posts, comments, and categories
|
||||
contained in this file onto your blog.
|
||||
-->
|
||||
|
||||
|
@ -174,11 +174,11 @@ print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
|||
while ( $next_posts = array_splice($post_ids, 0, 20) ) {
|
||||
$where = "WHERE ID IN (".join(',', $next_posts).")";
|
||||
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
|
||||
foreach ($posts as $post) {
|
||||
foreach ($posts as $post) {
|
||||
start_wp(); ?>
|
||||
<item>
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
<?php the_category_rss() ?>
|
||||
|
|
100
wp-app.php
100
wp-app.php
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/*
|
||||
/*
|
||||
* wp-app.php - Atom Publishing Protocol support for WordPress
|
||||
* Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/
|
||||
* Modified by: Dougal Campbell, http://dougal.gunters.org/
|
||||
|
@ -166,7 +166,7 @@ class AtomParser {
|
|||
array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
|
||||
} else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
|
||||
$this->in_content = array();
|
||||
$this->is_xhtml = $attrs['type'] == 'xhtml';
|
||||
$this->is_xhtml = $attrs['type'] == 'xhtml';
|
||||
array_push($this->in_content, array($tag,$this->depth));
|
||||
} else if($tag == 'link') {
|
||||
array_push($this->entry->links, $attrs);
|
||||
|
@ -182,7 +182,7 @@ class AtomParser {
|
|||
$tag = array_pop(split(":", $name));
|
||||
|
||||
if(!empty($this->in_content)) {
|
||||
if($this->in_content[0][0] == $tag &&
|
||||
if($this->in_content[0][0] == $tag &&
|
||||
$this->in_content[0][1] == $this->depth) {
|
||||
array_shift($this->in_content);
|
||||
if($this->is_xhtml) {
|
||||
|
@ -245,14 +245,14 @@ class AtomParser {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
function xml_escape($string)
|
||||
{
|
||||
return str_replace(array('&','"',"'",'<','>'),
|
||||
array('&','"',''','<','>'),
|
||||
return str_replace(array('&','"',"'",'<','>'),
|
||||
array('&','"',''','<','>'),
|
||||
$string );
|
||||
}
|
||||
}
|
||||
|
@ -284,27 +284,27 @@ class AtomServer {
|
|||
$this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
|
||||
|
||||
$this->selectors = array(
|
||||
'@/service@' =>
|
||||
'@/service@' =>
|
||||
array('GET' => 'get_service'),
|
||||
'@/categories@' =>
|
||||
array('GET' => 'get_categories_xml'),
|
||||
'@/post/(\d+)@' =>
|
||||
array('GET' => 'get_post',
|
||||
'PUT' => 'put_post',
|
||||
'@/post/(\d+)@' =>
|
||||
array('GET' => 'get_post',
|
||||
'PUT' => 'put_post',
|
||||
'DELETE' => 'delete_post'),
|
||||
'@/posts/?([^/]+)?@' =>
|
||||
array('GET' => 'get_posts',
|
||||
'@/posts/?([^/]+)?@' =>
|
||||
array('GET' => 'get_posts',
|
||||
'POST' => 'create_post'),
|
||||
'@/attachments/?(\d+)?@' =>
|
||||
array('GET' => 'get_attachment',
|
||||
'@/attachments/?(\d+)?@' =>
|
||||
array('GET' => 'get_attachment',
|
||||
'POST' => 'create_attachment'),
|
||||
'@/attachment/file/(\d+)@' =>
|
||||
array('GET' => 'get_file',
|
||||
'PUT' => 'put_file',
|
||||
'@/attachment/file/(\d+)@' =>
|
||||
array('GET' => 'get_file',
|
||||
'PUT' => 'put_file',
|
||||
'DELETE' => 'delete_file'),
|
||||
'@/attachment/(\d+)@' =>
|
||||
array('GET' => 'get_attachment',
|
||||
'PUT' => 'put_attachment',
|
||||
'@/attachment/(\d+)@' =>
|
||||
array('GET' => 'get_attachment',
|
||||
'PUT' => 'put_attachment',
|
||||
'DELETE' => 'delete_attachment'),
|
||||
);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ class AtomServer {
|
|||
$method = 'GET';
|
||||
}
|
||||
|
||||
// lame.
|
||||
// lame.
|
||||
if(strlen($path) == 0 || $path == '/') {
|
||||
$path = '/service';
|
||||
}
|
||||
|
@ -354,27 +354,27 @@ class AtomServer {
|
|||
function get_service() {
|
||||
log_app('function','get_service()');
|
||||
$entries_url = $this->get_entries_url();
|
||||
$categories_url = $this->get_categories_url();
|
||||
$categories_url = $this->get_categories_url();
|
||||
$media_url = $this->get_attachments_url();
|
||||
$accepted_content_types = join(',',$this->media_content_types);
|
||||
$introspection = <<<EOD
|
||||
<service xmlns="http://purl.org/atom/app#" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<workspace title="WordPress Workspace">
|
||||
<collection href="$entries_url" title="Posts">
|
||||
<atom:title>WordPress Posts</atom:title>
|
||||
<accept>entry</accept>
|
||||
<categories href="$categories_url" />
|
||||
</collection>
|
||||
<collection href="$media_url" title="Media">
|
||||
<atom:title>WordPress Media</atom:title>
|
||||
<accept>$accepted_content_types</accept>
|
||||
</collection>
|
||||
</workspace>
|
||||
<service xmlns="http://purl.org/atom/app#" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<workspace title="WordPress Workspace">
|
||||
<collection href="$entries_url" title="Posts">
|
||||
<atom:title>WordPress Posts</atom:title>
|
||||
<accept>entry</accept>
|
||||
<categories href="$categories_url" />
|
||||
</collection>
|
||||
<collection href="$media_url" title="Media">
|
||||
<atom:title>WordPress Media</atom:title>
|
||||
<accept>$accepted_content_types</accept>
|
||||
</collection>
|
||||
</workspace>
|
||||
</service>
|
||||
|
||||
EOD;
|
||||
|
||||
$this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE);
|
||||
$this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
function get_categories_xml() {
|
||||
|
@ -393,7 +393,7 @@ function get_categories_xml() {
|
|||
$categories
|
||||
</app:categories>
|
||||
EOD;
|
||||
$this->output($output, $this->CATEGORIES_CONTENT_TYPE);
|
||||
$this->output($output, $this->CATEGORIES_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -894,7 +894,7 @@ EOD;
|
|||
$total_count = $this->get_posts_count();
|
||||
$last_page = (int) ceil($total_count / $count);
|
||||
$next_page = (($page + 1) > $last_page) ? NULL : $page + 1;
|
||||
$prev_page = ($page - 1) < 1 ? NULL : $page - 1;
|
||||
$prev_page = ($page - 1) < 1 ? NULL : $page - 1;
|
||||
$last_page = ((int)$last_page == 1 || (int)$last_page == 0) ? NULL : (int) $last_page;
|
||||
?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://purl.org/atom/app#" xml:lang="<?php echo get_option('rss_language'); ?>">
|
||||
<id><?php $this->the_entries_url() ?></id>
|
||||
|
@ -912,7 +912,7 @@ EOD;
|
|||
<link rel="self" type="application/atom+xml" href="<?php $this->the_entries_url() ?>" />
|
||||
<rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights>
|
||||
<generator uri="http://wordpress.com/" version="1.0.5-dc">WordPress.com Atom API</generator>
|
||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
|
||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
|
||||
$post = $GLOBALS['post'];
|
||||
?>
|
||||
<entry>
|
||||
|
@ -934,7 +934,7 @@ $post = $GLOBALS['post'];
|
|||
<link rel="edit" href="<?php $this->the_entry_url() ?>" />
|
||||
<link rel="edit-media" href="<?php $this->the_media_url() ?>" />
|
||||
<?php } else { ?>
|
||||
<link href="<?php permalink_single_rss() ?>" />
|
||||
<link href="<?php the_permalink_rss() ?>" />
|
||||
<link rel="edit" href="<?php $this->the_entry_url() ?>" />
|
||||
<?php } ?>
|
||||
<?php foreach(get_the_category() as $category) { ?>
|
||||
|
@ -945,10 +945,10 @@ $post = $GLOBALS['post'];
|
|||
<?php endif; ?>
|
||||
</entry>
|
||||
<?php
|
||||
endwhile;
|
||||
endwhile;
|
||||
endif;
|
||||
?></feed>
|
||||
<?php
|
||||
<?php
|
||||
$feed = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $feed;
|
||||
|
@ -990,7 +990,7 @@ $post = $GLOBALS['post'];
|
|||
<link rel="edit-media" href="<?php $this->the_media_url() ?>" />
|
||||
<content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid(); ?>"/>
|
||||
<?php } else { ?>
|
||||
<link href="<?php permalink_single_rss() ?>" />
|
||||
<link href="<?php the_permalink_rss() ?>" />
|
||||
<link rel="edit" href="<?php $this->the_entry_url() ?>" />
|
||||
<?php } ?>
|
||||
<?php foreach(get_the_category() as $category) { ?>
|
||||
|
@ -1011,17 +1011,17 @@ $post = $GLOBALS['post'];
|
|||
ob_end_clean();
|
||||
|
||||
log_app('get_entry returning:',$entry);
|
||||
return $entry;
|
||||
return $entry;
|
||||
}
|
||||
|
||||
function ok() {
|
||||
function ok() {
|
||||
log_app('Status','200: OK');
|
||||
header('Content-Type: text/plain');
|
||||
status_header('200');
|
||||
exit;
|
||||
}
|
||||
|
||||
function no_content() {
|
||||
function no_content() {
|
||||
log_app('Status','204: No Content');
|
||||
header('Content-Type: text/plain');
|
||||
status_header('204');
|
||||
|
@ -1109,7 +1109,7 @@ $post = $GLOBALS['post'];
|
|||
log_app('Status','401: Auth Required');
|
||||
nocache_headers();
|
||||
header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
|
||||
header('WWW-Authenticate: Form action="' . get_option('siteurl') . '/wp-login.php"', false);
|
||||
header('WWW-Authenticate: Form action="' . get_option('siteurl') . '/wp-login.php"', false);
|
||||
header("HTTP/1.1 401 $msg");
|
||||
header('Status: ' . $msg);
|
||||
header('Content-Type: plain/text');
|
||||
|
@ -1159,7 +1159,7 @@ $post = $GLOBALS['post'];
|
|||
// if using mod_rewrite/ENV hack
|
||||
// http://www.besthostratings.com/articles/http-auth-php-cgi.html
|
||||
if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
|
||||
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
|
||||
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
|
||||
explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ $post = $GLOBALS['post'];
|
|||
log_app("get_accepted_content_type", "type=$type, subtype=$subtype");
|
||||
|
||||
foreach($types as $t) {
|
||||
list($acceptedType,$acceptedSubtype) = explode('/',$t);
|
||||
list($acceptedType,$acceptedSubtype) = explode('/',$t);
|
||||
if($acceptedType == '*' || $acceptedType == $type) {
|
||||
if($acceptedSubtype == '*' || $acceptedSubtype == $subtype)
|
||||
return $type;
|
||||
|
@ -1233,9 +1233,9 @@ $post = $GLOBALS['post'];
|
|||
@header("ETag: $wp_etag");
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
$client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||
else
|
||||
else
|
||||
$client_etag = false;
|
||||
|
||||
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||
|
|
|
@ -236,7 +236,7 @@ function wp_get_linksbyname($category, $args = '') {
|
|||
$cat = get_term_by('name', $cat_name, 'link_category');
|
||||
if ( !$cat )
|
||||
return false;
|
||||
$cat_id = $cat->term_id;
|
||||
$cat_id = $cat->term_id;
|
||||
|
||||
$args = add_query_arg('category', $cat_id, $args);
|
||||
wp_get_links($args);
|
||||
|
@ -266,7 +266,7 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
|
|||
$cat_id = -1;
|
||||
$cat = get_term_by('name', $cat_name, 'link_category');
|
||||
if ( $cat )
|
||||
$cat_id = $cat->term_id;
|
||||
$cat_id = $cat->term_id;
|
||||
|
||||
return get_linkobjects($cat_id, $orderby, $limit);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
|
|||
|
||||
$links_array = array();
|
||||
foreach ($links as $link) {
|
||||
$links_array[] = $link;
|
||||
$links_array[] = $link;
|
||||
}
|
||||
|
||||
return $links_array;
|
||||
|
@ -484,4 +484,9 @@ function permalink_link() {
|
|||
the_permalink();
|
||||
}
|
||||
|
||||
// Use the_permalink_rss()
|
||||
function permalink_single_rss($file = '') {
|
||||
the_permalink_rss();
|
||||
}
|
||||
|
||||
?>
|
|
@ -31,14 +31,14 @@ $more = 1;
|
|||
<?php endif; ?>
|
||||
</author>
|
||||
<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
|
||||
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
|
||||
<link rel="alternate" type="text/html" href="<?php the_permalink_rss() ?>" />
|
||||
<id><?php the_guid(); ?></id>
|
||||
<updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
|
||||
<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
|
||||
<?php the_category_rss('atom') ?>
|
||||
<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
|
||||
<?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 the_permalink_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
||||
<?php endif; ?>
|
||||
<?php atom_enclosure(); ?>
|
||||
<?php do_action('atom_entry'); ?>
|
||||
|
|
|
@ -27,15 +27,15 @@ $more = 1;
|
|||
<items>
|
||||
<rdf:Seq>
|
||||
<?php while (have_posts()): the_post(); ?>
|
||||
<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
|
||||
<rdf:li rdf:resource="<?php the_permalink_rss() ?>"/>
|
||||
<?php endwhile; ?>
|
||||
</rdf:Seq>
|
||||
</items>
|
||||
</channel>
|
||||
<?php rewind_posts(); while (have_posts()): the_post(); ?>
|
||||
<item rdf:about="<?php permalink_single_rss() ?>">
|
||||
<item rdf:about="<?php the_permalink_rss() ?>">
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
|
|
|
@ -23,7 +23,7 @@ $more = 1;
|
|||
<?php } else { // use content ?>
|
||||
<description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
|
||||
<?php } ?>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<?php do_action('rss_item'); ?>
|
||||
</item>
|
||||
<?php endwhile; ?>
|
||||
|
|
|
@ -17,12 +17,12 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
|
|||
else
|
||||
printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
|
||||
?></title>
|
||||
<link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
|
||||
<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
|
||||
<description><?php bloginfo_rss("description") ?></description>
|
||||
<pubDate><?php echo gmdate('r'); ?></pubDate>
|
||||
<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
if ( have_comments() ) : while ( have_comments() ) : the_comment();
|
||||
$comment_post = get_post($comment->comment_post_ID);
|
||||
get_post_custom($comment_post->ID);
|
||||
|
|
|
@ -24,7 +24,7 @@ $more = 1;
|
|||
<?php while( have_posts()) : the_post(); ?>
|
||||
<item>
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<comments><?php comments_link(); ?></comments>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
|
|
|
@ -69,12 +69,11 @@ function the_excerpt_rss() {
|
|||
echo apply_filters('the_excerpt_rss', $output);
|
||||
}
|
||||
|
||||
function the_permalink_rss() {
|
||||
echo apply_filters('the_permalink_rss', get_permalink());
|
||||
|
||||
function permalink_single_rss($file = '') {
|
||||
echo get_permalink();
|
||||
}
|
||||
|
||||
|
||||
function comment_link() {
|
||||
echo get_comment_link();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue