Clean feed and trackback URLs.

git-svn-id: https://develop.svn.wordpress.org/trunk@836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2004-02-05 20:55:50 +00:00
parent be109e5ac0
commit 6ebd3ca6c0
12 changed files with 143 additions and 24 deletions

View File

@@ -73,6 +73,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!<p>\s*(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
@@ -146,6 +147,12 @@ function backslashit($string) {
return $string;
}
function trailingslashit($string) {
if ( '/' != substr($string, -1)) {
$string .= '/';
}
return $string;
}
function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1) {
global $month, $weekday;

View File

@@ -36,6 +36,23 @@ function get_category_link($echo = false, $category_id, $category_nicename) {
return $link;
}
function get_category_rss_link($echo = false, $category_id, $category_nicename) {
global $querystring_start, $querystring_equal, $siteurl;
$cat_ID = $category_id;
$permalink_structure = get_settings('permalink_structure');
if ('' == $permalink_structure) {
$file = "$siteurl/wp-rss2.php";
$link = $file . $querystring_start . 'cat' . $querystring_equal . $category_id;
} else {
$link = get_category_link(0, $category_id, $category_nicename);
$link = $link . "/feed/";
}
if ($echo) echo $link;
return $link;
}
function the_category($seperator = '', $parents='') {
$categories = get_the_category();
if ('' == $seperator) {
@@ -318,4 +335,4 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
}
echo $thelist;
}
?>
?>

View File

@@ -209,7 +209,13 @@ function comment_time($d='') {
function comments_rss_link($link_text='Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
global $id;
global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
$url = $siteurl.'/'.$commentsrssfilename.$querystring_start.'p'.$querystring_equal.$id;
if ('' != get_settings('permalink_structure')) {
$url = trailingslashit(get_permalink()) . 'rss2/';
} else {
$url = $siteurl.'/'.$commentsrssfilename.$querystring_start.'p'.$querystring_equal.$id;
}
$url = '<a href="'.$url.'">'.$link_text.'</a>';
echo $url;
}
@@ -252,6 +258,11 @@ function permalink_comments_rss() {
function trackback_url($display = true) {
global $siteurl, $id;
$tb_url = $siteurl.'/wp-trackback.php/'.$id;
if ('' != get_settings('permalink_structure')) {
$tb_url = get_permalink() . 'trackback/';
}
if ($display) {
echo $tb_url;
} else {

View File

@@ -23,6 +23,17 @@ function bloginfo_unicode($show='') {
function get_bloginfo($show='') {
global $siteurl, $blogfilename, $blogname, $blogdescription, $siteurl, $admin_email;
$do_perma = 0;
$feed_url = $siteurl;
$comment_feed_url = $siteurl;
if ('' != get_settings('permalink_structure')) {
$do_perma = 1;
$feed_url = $siteurl . '/feed';
$comment_feed_url = $siteurl . '/comments/feed';
}
switch($show) {
case "url":
$output = $siteurl."/".$blogfilename;
@@ -32,18 +43,33 @@ function get_bloginfo($show='') {
break;
case "rdf_url":
$output = $siteurl.'/wp-rdf.php';
if ($do_perma) {
$output = $feed_url . '/rdf/';
}
break;
case "rss_url":
$output = $siteurl.'/wp-rss.php';
if ($do_perma) {
$output = $feed_url . '/rss/';
}
break;
case "rss2_url":
$output = $siteurl.'/wp-rss2.php';
if ($do_perma) {
$output = $feed_url . '/rss2/';
}
break;
case "atom_url":
$output = $siteurl.'/wp-atom.php';
if ($do_perma) {
$output = $feed_url . '/atom/';
}
break;
case "comments_rss2_url":
$output = $siteurl.'/wp-commentsrss2.php';
if ($do_perma) {
$output = $comment_feed_url . '/rss2/';
}
break;
case "pingback_url":
$output = $siteurl.'/xmlrpc.php';