mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-09 09:57:38 +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)/?$';
|
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';
|
||||||
$pageregex = 'page/?([0-9]{1,})/?$';
|
$pageregex = 'page/?([0-9]{1,})/?$';
|
||||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
$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
|
// If the permalink does not have year, month, and day, we need to create a
|
||||||
// separate archive rule.
|
// separate archive rule.
|
||||||
@ -1314,15 +1319,15 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Site feed
|
// Site feed
|
||||||
$sitefeedmatch = 'feed/?([_0-9a-z-]+)?/?$';
|
$sitefeedmatch = $prefix . 'feed/?([_0-9a-z-]+)?/?$';
|
||||||
$sitefeedquery = 'index.php?feed=_' . preg_index(1, $matches);
|
$sitefeedquery = 'index.php?feed=_' . preg_index(1, $matches);
|
||||||
|
|
||||||
// Site comment feed
|
// 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';
|
$sitecommentfeedquery = 'index.php?feed=_' . preg_index(1, $matches) . '&withcomments=1';
|
||||||
|
|
||||||
// Site page
|
// Site page
|
||||||
$sitepagematch = $pageregex;
|
$sitepagematch = $prefix . $pageregex;
|
||||||
$sitepagequery = 'index.php?paged=' . preg_index(1, $matches);
|
$sitepagequery = 'index.php?paged=' . preg_index(1, $matches);
|
||||||
|
|
||||||
$site_rewrite = array(
|
$site_rewrite = array(
|
||||||
|
@ -20,16 +20,6 @@ function bloginfo_unicode($show='') {
|
|||||||
|
|
||||||
function get_bloginfo($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) {
|
switch($show) {
|
||||||
case 'url':
|
case 'url':
|
||||||
case 'siteurl':
|
case 'siteurl':
|
||||||
@ -39,34 +29,19 @@ function get_bloginfo($show='') {
|
|||||||
$output = get_settings('blogdescription');
|
$output = get_settings('blogdescription');
|
||||||
break;
|
break;
|
||||||
case 'rdf_url':
|
case 'rdf_url':
|
||||||
$output = get_settings('siteurl') .'/wp-rdf.php';
|
$output = get_feed_link('rdf');
|
||||||
if ($do_perma) {
|
|
||||||
$output = $feed_url . '/rdf/';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'rss_url':
|
case 'rss_url':
|
||||||
$output = get_settings('siteurl') .'/wp-rss.php';
|
$output = get_feed_link('rss');
|
||||||
if ($do_perma) {
|
|
||||||
$output = $feed_url . '/rss/';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'rss2_url':
|
case 'rss2_url':
|
||||||
$output = get_settings('siteurl') .'/wp-rss2.php';
|
$output = get_feed_link('rss2');
|
||||||
if ($do_perma) {
|
|
||||||
$output = $feed_url . '/rss2/';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'atom_url':
|
case 'atom_url':
|
||||||
$output = get_settings('siteurl') .'/wp-atom.php';
|
$output = get_feed_link('atom');
|
||||||
if ($do_perma) {
|
|
||||||
$output = $feed_url . '/atom/';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'comments_rss2_url':
|
case 'comments_rss2_url':
|
||||||
$output = get_settings('siteurl') .'/wp-commentsrss2.php';
|
$output = get_feed_link('comments_rss2');
|
||||||
if ($do_perma) {
|
|
||||||
$output = $comment_feed_url . '/rss2/';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'pingback_url':
|
case 'pingback_url':
|
||||||
$output = get_settings('siteurl') .'/xmlrpc.php';
|
$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 = '') {
|
function edit_post_link($link = 'Edit This', $before = '', $after = '') {
|
||||||
global $user_level, $post;
|
global $user_level, $post;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user