mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-08 17:38:26 +01:00
Make /feed/ and /comments/feed work with path info. Introduce get_feed_link().
git-svn-id: http://svn.automattic.com/wordpress/trunk@1382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
96e44262b4
commit
b863cf90d1
@ -1303,6 +1303,11 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';
|
||||
$pageregex = 'page/?([0-9]{1,})/?$';
|
||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||
$index = get_settings('blogfilename');
|
||||
$prefix = '';
|
||||
if (preg_match('#^/*' . $index . '#', $front)) {
|
||||
$prefix = $index . '/';
|
||||
}
|
||||
|
||||
// If the permalink does not have year, month, and day, we need to create a
|
||||
// separate archive rule.
|
||||
@ -1314,15 +1319,15 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||
}
|
||||
|
||||
// Site feed
|
||||
$sitefeedmatch = 'feed/?([_0-9a-z-]+)?/?$';
|
||||
$sitefeedmatch = $prefix . 'feed/?([_0-9a-z-]+)?/?$';
|
||||
$sitefeedquery = 'index.php?feed=_' . preg_index(1, $matches);
|
||||
|
||||
// Site comment feed
|
||||
$sitecommentfeedmatch = 'comments/feed/?([_0-9a-z-]+)?/?$';
|
||||
$sitecommentfeedmatch = $prefix . 'comments/feed/?([_0-9a-z-]+)?/?$';
|
||||
$sitecommentfeedquery = 'index.php?feed=_' . preg_index(1, $matches) . '&withcomments=1';
|
||||
|
||||
// Site page
|
||||
$sitepagematch = $pageregex;
|
||||
$sitepagematch = $prefix . $pageregex;
|
||||
$sitepagequery = 'index.php?paged=' . preg_index(1, $matches);
|
||||
|
||||
$site_rewrite = array(
|
||||
|
@ -20,16 +20,6 @@ function bloginfo_unicode($show='') {
|
||||
|
||||
function get_bloginfo($show='') {
|
||||
|
||||
$do_perma = 0;
|
||||
$feed_url = get_settings('siteurl');
|
||||
$comment_feed_url = get_settings('siteurl');
|
||||
|
||||
if ('' != get_settings('permalink_structure')) {
|
||||
$do_perma = 1;
|
||||
$feed_url = get_settings('home') . '/feed';
|
||||
$comment_feed_url = get_settings('home') . '/comments/feed';
|
||||
}
|
||||
|
||||
switch($show) {
|
||||
case 'url':
|
||||
case 'siteurl':
|
||||
@ -39,34 +29,19 @@ function get_bloginfo($show='') {
|
||||
$output = get_settings('blogdescription');
|
||||
break;
|
||||
case 'rdf_url':
|
||||
$output = get_settings('siteurl') .'/wp-rdf.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rdf/';
|
||||
}
|
||||
$output = get_feed_link('rdf');
|
||||
break;
|
||||
case 'rss_url':
|
||||
$output = get_settings('siteurl') .'/wp-rss.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rss/';
|
||||
}
|
||||
$output = get_feed_link('rss');
|
||||
break;
|
||||
case 'rss2_url':
|
||||
$output = get_settings('siteurl') .'/wp-rss2.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rss2/';
|
||||
}
|
||||
$output = get_feed_link('rss2');
|
||||
break;
|
||||
case 'atom_url':
|
||||
$output = get_settings('siteurl') .'/wp-atom.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/atom/';
|
||||
}
|
||||
$output = get_feed_link('atom');
|
||||
break;
|
||||
case 'comments_rss2_url':
|
||||
$output = get_settings('siteurl') .'/wp-commentsrss2.php';
|
||||
if ($do_perma) {
|
||||
$output = $comment_feed_url . '/rss2/';
|
||||
}
|
||||
$output = get_feed_link('comments_rss2');
|
||||
break;
|
||||
case 'pingback_url':
|
||||
$output = get_settings('siteurl') .'/xmlrpc.php';
|
||||
|
@ -134,6 +134,63 @@ function get_day_link($year, $month, $day) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_feed_link($feed='rss2') {
|
||||
$do_perma = 0;
|
||||
$feed_url = get_settings('siteurl');
|
||||
$comment_feed_url = $feed_url;
|
||||
|
||||
$permalink = get_settings('permalink_structure');
|
||||
if ('' != $permalink) {
|
||||
$do_perma = 1;
|
||||
$feed_url = get_settings('home');
|
||||
$index = get_settings('blogfilename');
|
||||
$prefix = '';
|
||||
if (preg_match('#^/*' . $index . '#', $permalink)) {
|
||||
$feed_url .= '/' . $index;
|
||||
}
|
||||
|
||||
$comment_feed_url = $feed_url;
|
||||
$feed_url .= '/feed';
|
||||
$comment_feed_url .= '/comments/feed';
|
||||
}
|
||||
|
||||
switch($feed) {
|
||||
case 'rdf':
|
||||
$output = $feed_url .'/wp-rdf.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rdf/';
|
||||
}
|
||||
break;
|
||||
case 'rss':
|
||||
$output = $feed_url . '/wp-rss.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rss/';
|
||||
}
|
||||
break;
|
||||
case 'atom':
|
||||
$output = $feed_url .'/wp-atom.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/atom/';
|
||||
}
|
||||
break;
|
||||
case 'comments_rss2':
|
||||
$output = $feed_url .'/wp-commentsrss2.php';
|
||||
if ($do_perma) {
|
||||
$output = $comment_feed_url . '/rss2/';
|
||||
}
|
||||
break;
|
||||
case 'rss2':
|
||||
default:
|
||||
$output = $feed_url .'/wp-rss2.php';
|
||||
if ($do_perma) {
|
||||
$output = $feed_url . '/rss2/';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function edit_post_link($link = 'Edit This', $before = '', $after = '') {
|
||||
global $user_level, $post;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user