Correctly add args to strings that contain only a query string and not a full URI.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2005-02-06 03:40:08 +00:00
parent 6d302677fc
commit e0d7582c46
9 changed files with 32 additions and 32 deletions

View File

@ -598,7 +598,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
} }
if ($wpdb->query($query)) { if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id); do_action('wp_set_comment_status', $comment_id, $comment_status);
return true; return true;
} else { } else {
return false; return false;

View File

@ -131,7 +131,7 @@ function the_category_rss($type = 'rss') {
$the_list .= "\n\t<category>$category->cat_name</category>"; $the_list .= "\n\t<category>$category->cat_name</category>";
} }
} }
echo apply_filters('the_category_rss', $the_list); echo apply_filters('the_category_rss', $the_list, $type);
} }
function rss_enclosure() { function rss_enclosure() {

View File

@ -389,7 +389,7 @@ function user_can_edit_user($user_id, $other_user) {
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
global $wpdb; global $wpdb;
do_action('wp_blacklist_check'); do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) { if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) {
foreach ($chars[1] as $char) { foreach ($chars[1] as $char) {
@ -461,7 +461,7 @@ function wp_new_comment( $commentdata, $spam = false ) {
$time_lastcomment = mysql2date('U', $lasttime); $time_lastcomment = mysql2date('U', $lasttime);
$time_newcomment = mysql2date('U', $now_gmt); $time_newcomment = mysql2date('U', $now_gmt);
if ( ($time_newcomment - $time_lastcomment) < 15 ) { if ( ($time_newcomment - $time_lastcomment) < 15 ) {
do_action('comment_flood_trigger'); do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') );
} }
} }
@ -482,7 +482,7 @@ function wp_new_comment( $commentdata, $spam = false ) {
"); ");
$comment_id = $wpdb->insert_id; $comment_id = $wpdb->insert_id;
do_action('comment_post', $comment_id); do_action('comment_post', $comment_id, $approved);
if ( 'spam' !== $approved ) { // If it's spam save it silently for later crunching if ( 'spam' !== $approved ) { // If it's spam save it silently for later crunching
if ( '0' == $approved ) if ( '0' == $approved )

View File

@ -1669,7 +1669,7 @@ function add_query_arg() {
$query = $parts[1]; $query = $parts[1];
} }
} }
else { else if (! ststr($uri, '/')) {
$base = $uri . '?'; $base = $uri . '?';
$query = ''; $query = '';
} }

View File

@ -136,7 +136,7 @@ function get_author_link($echo = false, $author_id, $author_nicename) {
$link = get_settings('home') . trailingslashit($link); $link = get_settings('home') . trailingslashit($link);
} }
$link = apply_filters('author_link', $link); $link = apply_filters('author_link', $link, $author_id, $author_nicename);
if ($echo) echo $link; if ($echo) echo $link;
return $link; return $link;
} }

View File

@ -39,7 +39,7 @@ function get_category_link($echo = false, $category_id, $category_nicename) {
$catlink = str_replace('%category%', $category_nicename, $catlink); $catlink = str_replace('%category%', $category_nicename, $catlink);
$catlink = get_settings('home') . trailingslashit($catlink); $catlink = get_settings('home') . trailingslashit($catlink);
} }
$catlink = apply_filters('category_link', $catlink); $catlink = apply_filters('category_link', $catlink, $category_id, $category_nicename);
if ($echo) echo $catlink; if ($echo) echo $catlink;
return $catlink; return $catlink;
} }
@ -99,7 +99,7 @@ function the_category($separator = '', $parents='') {
++$i; ++$i;
} }
} }
echo apply_filters('the_category', $thelist); echo apply_filters('the_category', $thelist, $separator, $parents);
} }
function get_the_category_by_ID($cat_ID) { function get_the_category_by_ID($cat_ID) {
@ -173,7 +173,7 @@ function category_description($category = 0) {
global $cat, $wpdb, $cache_categories; global $cat, $wpdb, $cache_categories;
if (!$category) $category = $cat; if (!$category) $category = $cat;
$category_description = $cache_categories[$category]->category_description; $category_description = $cache_categories[$category]->category_description;
$category_description = apply_filters('category_description', $category_description); $category_description = apply_filters('category_description', $category_description, $category);
return $category_description; return $category_description;
} }
@ -212,7 +212,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
if (intval($optionnone) == 1) echo "\t<option value='0'>None</option>\n"; if (intval($optionnone) == 1) echo "\t<option value='0'>None</option>\n";
if ($categories) { if ($categories) {
foreach ($categories as $category) { foreach ($categories as $category) {
$cat_name = apply_filters('list_cats', $category->cat_name); $cat_name = apply_filters('list_cats', $category->cat_name, $category);
echo "\t<option value=\"".$category->cat_ID."\""; echo "\t<option value=\"".$category->cat_ID."\"";
if ($category->cat_ID == $selected) if ($category->cat_ID == $selected)
echo ' selected="selected"'; echo ' selected="selected"';
@ -328,10 +328,10 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
if ($use_desc_for_title == 0 || empty($category->category_description)) { if ($use_desc_for_title == 0 || empty($category->category_description)) {
$link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"'; $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"';
} else { } else {
$link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description)) . '"'; $link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category)) . '"';
} }
$link .= '>'; $link .= '>';
$link .= apply_filters('list_cats', $category->cat_name).'</a>'; $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) { if ( (! empty($feed_image)) || (! empty($feed)) ) {

View File

@ -59,7 +59,7 @@ function wp_meta() {
function bloginfo($show='') { function bloginfo($show='') {
$info = get_bloginfo($show); $info = get_bloginfo($show);
$info = apply_filters('bloginfo', $info); $info = apply_filters('bloginfo', $info, $show);
echo convert_chars($info); echo convert_chars($info);
} }
@ -595,7 +595,7 @@ function the_date($d='', $before='', $after='', $echo = true) {
$the_date .= $after; $the_date .= $after;
$previousday = $day; $previousday = $day;
} }
$the_date = apply_filters('the_date', $the_date); $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
if ($echo) { if ($echo) {
echo $the_date; echo $the_date;
} else { } else {
@ -604,7 +604,7 @@ function the_date($d='', $before='', $after='', $echo = true) {
} }
function the_time( $d = '' ) { function the_time( $d = '' ) {
echo apply_filters('the_time', get_the_time( $d ) ); echo apply_filters('the_time', get_the_time( $d ), $d);
} }
function get_the_time( $d = '' ) { function get_the_time( $d = '' ) {
@ -612,7 +612,7 @@ function get_the_time( $d = '' ) {
$the_time = get_post_time(get_settings('time_format')); $the_time = get_post_time(get_settings('time_format'));
else else
$the_time = get_post_time($d); $the_time = get_post_time($d);
return apply_filters('get_the_time', $the_time); return apply_filters('get_the_time', $the_time, $d);
} }
function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
@ -623,7 +623,7 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
$time = $post->post_date; $time = $post->post_date;
$time = mysql2date($d, $time); $time = mysql2date($d, $time);
return apply_filters('get_the_time', $time); return apply_filters('get_the_time', $time, $d, $gmt);
} }
function the_weekday() { function the_weekday() {
@ -642,7 +642,7 @@ function the_weekday_date($before='',$after='') {
$the_weekday_date .= $after; $the_weekday_date .= $after;
$previousweekday = $day; $previousweekday = $day;
} }
$the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date); $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
echo $the_weekday_date; echo $the_weekday_date;
} }

View File

@ -74,10 +74,10 @@ function get_permalink($id = false) {
$author, $author,
$idpost->post_name, $idpost->post_name,
); );
return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink)); return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $idpost);
} else { // if they're not using the fancy permalink option } else { // if they're not using the fancy permalink option
$permalink = get_settings('home') . '/?p=' . $idpost->ID; $permalink = get_settings('home') . '/?p=' . $idpost->ID;
return apply_filters('post_link', $permalink); return apply_filters('post_link', $permalink, $idpost);
} }
} }
@ -98,7 +98,7 @@ function get_page_link($id = false) {
$link = get_settings('home') . "/?page_id=$id"; $link = get_settings('home') . "/?page_id=$id";
} }
return apply_filters('page_link', $link); return apply_filters('page_link', $link, $id);
} }
function get_year_link($year) { function get_year_link($year) {
@ -107,9 +107,9 @@ function get_year_link($year) {
$yearlink = $wp_rewrite->get_year_permastruct(); $yearlink = $wp_rewrite->get_year_permastruct();
if (!empty($yearlink)) { if (!empty($yearlink)) {
$yearlink = str_replace('%year%', $year, $yearlink); $yearlink = str_replace('%year%', $year, $yearlink);
return apply_filters('year_link', get_settings('home') . trailingslashit($yearlink)); return apply_filters('year_link', get_settings('home') . trailingslashit($yearlink), $year);
} else { } else {
return apply_filters('year_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year); return apply_filters('year_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year, $year);
} }
} }
@ -121,9 +121,9 @@ function get_month_link($year, $month) {
if (!empty($monthlink)) { if (!empty($monthlink)) {
$monthlink = str_replace('%year%', $year, $monthlink); $monthlink = str_replace('%year%', $year, $monthlink);
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
return apply_filters('month_link', get_settings('home') . trailingslashit($monthlink)); return apply_filters('month_link', get_settings('home') . trailingslashit($monthlink), $year, $month);
} else { } else {
return apply_filters('month_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2)); return apply_filters('month_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2), $year, $month);
} }
} }
@ -138,9 +138,9 @@ function get_day_link($year, $month, $day) {
$daylink = str_replace('%year%', $year, $daylink); $daylink = str_replace('%year%', $year, $daylink);
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
return apply_filters('day_link', get_settings('home') . trailingslashit($daylink)); return apply_filters('day_link', get_settings('home') . trailingslashit($daylink), $year, $month, $day);
} else { } else {
return apply_filters('day_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2).zeroise($day, 2)); return apply_filters('day_link', get_settings('home') .'/'. $querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2).zeroise($day, 2), $year, $month, $day);
} }
} }
@ -170,7 +170,7 @@ function get_feed_link($feed='rss2') {
$output = get_settings('siteurl') . "/wp-{$feed}.php"; $output = get_settings('siteurl') . "/wp-{$feed}.php";
} }
return apply_filters('feed_link', $output); return apply_filters('feed_link', $output, $feed);
} }
function edit_post_link($link = 'Edit This', $before = '', $after = '') { function edit_post_link($link = 'Edit This', $before = '', $after = '') {
@ -264,7 +264,7 @@ function previous_post_link($format='&laquo; %link', $link='%title', $in_same_ca
return; return;
} }
$title = apply_filters('the_title', $post->post_title); $title = apply_filters('the_title', $post->post_title, $post);
$string = '<a href="'.get_permalink($post->ID).'">'; $string = '<a href="'.get_permalink($post->ID).'">';
@ -284,7 +284,7 @@ function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat =
return; return;
} }
$title = apply_filters('the_title', $post->post_title); $title = apply_filters('the_title', $post->post_title, $post);
$string = '<a href="'.get_permalink($post->ID).'">'; $string = '<a href="'.get_permalink($post->ID).'">';

View File

@ -31,7 +31,7 @@ function the_ID() {
function the_title($before = '', $after = '', $echo = true) { function the_title($before = '', $after = '', $echo = true) {
$title = get_the_title(); $title = get_the_title();
if (!empty($title)) { if (!empty($title)) {
$title = apply_filters('the_title', $before . $title . $after); $title = apply_filters('the_title', $before . $title . $after, $before, $after);
if ($echo) if ($echo)
echo $title; echo $title;
else else