summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
commite30516b2ee40c1c45c8f288c20a3d4372e478624 (patch)
treebd6b8bcc4c06697f50e6985a6b08620e25bc572e /wp-includes
parente20c9aa016d6885c6e3fc7425525b4090f05ac2a (diff)
WP Merge to #4124
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@734 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/bookmark-template.php7
-rw-r--r--wp-includes/category-template.php3
-rw-r--r--wp-includes/category.php5
-rw-r--r--wp-includes/classes.php10
-rw-r--r--wp-includes/formatting.php6
-rw-r--r--wp-includes/functions.php20
-rw-r--r--wp-includes/general-template.php31
-rw-r--r--wp-includes/post-template.php2
8 files changed, 42 insertions, 42 deletions
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index da3626b..3c14c3c 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -271,8 +271,11 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
$title = $desc;
if ( $show_updated )
- if ( '00' != substr($bookmark->link_updated_f, 0, 2) )
- $title .= ' (Last updated ' . date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
+ if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
+ $title .= ' ';
+ $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)));
+ $title .= ')';
+ }
if ( '' != $title )
$title = ' title="' . $title . '"';
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 2c7db3a..346fbb6 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -47,7 +47,7 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
else
$name = $parent->cat_name;
- if ( $parent->category_parent )
+ if ( $parent->category_parent && ($parent->category_parent != $parent->cat_ID) )
$chain .= get_category_parents($parent->category_parent, $link, $separator, $nicename);
if ( $link )
@@ -169,6 +169,7 @@ function wp_dropdown_categories($args = '') {
'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1,
'selected' => 0, 'hierarchical' => 0, 'name' => 'cat',
'class' => 'postform');
+ $defaults['selected'] = ( is_category() ) ? get_query_var('cat') : 0;
$r = array_merge($defaults, $r);
$r['include_last_update_time'] = $r['show_last_update'];
extract($r);
diff --git a/wp-includes/category.php b/wp-includes/category.php
index 648ef4f..6ffb210 100644
--- a/wp-includes/category.php
+++ b/wp-includes/category.php
@@ -172,7 +172,7 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
foreach ($categories as $category) {
$path = '/' . $leaf_path;
$curcategory = $category;
- while ($curcategory->category_parent != 0) {
+ while ( ($curcategory->category_parent != 0) && ($curcategory->category_parent != $curcategory->cat_ID) ) {
$curcategory = $wpdb->get_row("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE cat_ID = '$curcategory->category_parent'");
$path = '/' . $curcategory->category_nicename . $path;
}
@@ -219,6 +219,9 @@ function &_get_cat_children($category_id, $categories) {
$category_list = array();
foreach ( $categories as $category ) {
+ if ( $category->cat_ID == $category_id )
+ continue;
+
if ( $category->category_parent == $category_id ) {
$category_list[] = $category;
if ( $children = _get_cat_children($category->cat_ID, $categories) )
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index bf6caba..3c1db01 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -25,9 +25,9 @@ class retrospam_mgr {
$cnt++;
}
}
- echo "<div class='updated'><p>$cnt comment";
- if ($cnt != 1 ) echo "s";
- echo " moved to the moderation queue.</p></div>\n";
+ echo "<div class='updated'><p> ";
+ printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
+ echo "</p></div>\n";
} // End function move_spam
function find_spam() {
@@ -56,7 +56,7 @@ class retrospam_mgr {
$numfound = count($counters[found]);
$numqueue = $counters[in_queue];
- $body = '<p>' . sprintf(__('Suspected spam comments: <strong>%s</strong>'), $numfound) . '</p>';
+ $body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
if ( count($counters[found]) > 0 ) {
$id_list = implode( ',', $counters[found] );
@@ -696,7 +696,7 @@ class Walker_CategoryDropdown extends Walker {
if ( $category->cat_ID == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
- $output .= $cat_name;
+ $output .= $pad.$cat_name;
if ( $args['show_count'] )
$output .= '&nbsp;&nbsp;('. $category->category_count .')';
if ( $args['show_last_update'] ) {
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 1be7f1e..0f5cc74 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -76,7 +76,7 @@ function wpautop($pee, $br = 1) {
$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
}
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
- $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
+ $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
return $pee;
@@ -1037,7 +1037,9 @@ function wp_richedit_pre($text) {
function clean_url( $url ) {
if ('' == $url) return $url;
- $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $url);
+ $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $url);
+ $strip = array('%0d', '%0a');
+ $url = str_replace($strip, '', $url);
$url = str_replace(';//', '://', $url);
$url = (!strstr($url, '://')) ? 'http://'.$url : $url;
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 68e9427..de40712 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -320,22 +320,6 @@ function gzip_compression() {
}
}
-
-// functions to count the page generation time (from phpBB2)
-// ( or just any time between timer_start() and timer_stop() )
-
-function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
- global $timestart, $timeend;
- $mtime = microtime();
- $mtime = explode(' ',$mtime);
- $mtime = $mtime[1] + $mtime[0];
- $timeend = $mtime;
- $timetotal = $timeend-$timestart;
- if ( $display )
- echo number_format($timetotal,$precision);
- return $timetotal;
-}
-
function make_url_footnote($content) {
preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches);
$j = 0;
@@ -979,7 +963,7 @@ function wp_upload_bits($name, $type, $bits) {
$ifp = @ fopen($new_file, 'wb');
if ( ! $ifp )
- return array('error' => "Could not write file $new_file.");
+ return array('error' => sprintf(__('Could not write file %s'), $new_file));
$success = @ fwrite($ifp, $bits);
fclose($ifp);
@@ -1123,7 +1107,7 @@ function wp_explain_nonce($action) {
}
}
- return __('Are you sure you want to do this');
+ return __('Are you sure you want to do this?');
}
function wp_nonce_ays($action) {
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 34ed1c3..dd390aa 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -63,6 +63,8 @@ function bloginfo($show='') {
!strstr($show, 'home')) {
$info = apply_filters('bloginfo', $info, $show);
$info = convert_chars($info);
+ } else {
+ $info = apply_filters('bloginfo_url', $info, $show);
}
echo $info;
@@ -323,12 +325,9 @@ function wp_get_archives($args = '') {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
$url = get_month_link($arcresult->year, $arcresult->month);
- if ( $show_post_count ) {
- $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
+ $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
+ if ( $show_post_count )
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
- } else {
- $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
- }
echo get_archives_link($url, $text, $format, $before, $after);
}
}
@@ -338,29 +337,30 @@ function wp_get_archives($args = '') {
$afterafter = $after;
foreach ($arcresults as $arcresult) {
$url = get_year_link($arcresult->year);
- if ($show_post_count) {
- $text = sprintf('%d', $arcresult->year);
+ $text = sprintf('%d', $arcresult->year);
+ if ($show_post_count)
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
- } else {
- $text = sprintf('%d', $arcresult->year);
- }
echo get_archives_link($url, $text, $format, $before, $after);
}
}
} elseif ( 'daily' == $type ) {
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
+ $afterafter = $after;
foreach ( $arcresults as $arcresult ) {
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
$date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
$text = mysql2date($archive_day_date_format, $date);
+ if ($show_post_count)
+ $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
echo get_archives_link($url, $text, $format, $before, $after);
}
}
} elseif ( 'weekly' == $type ) {
$start_of_week = get_option('start_of_week');
- $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit);
$arc_w_last = '';
+ $afterafter = $after;
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
if ( $arcresult->week != $arc_w_last ) {
@@ -371,6 +371,8 @@ function wp_get_archives($args = '') {
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
$url = sprintf('%s/%s%sm%s%s%sw%s%d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
+ if ($show_post_count)
+ $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
echo get_archives_link($url, $text, $format, $before, $after);
}
}
@@ -800,4 +802,9 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
<?php
}
+function the_search_query() {
+ global $s;
+ echo wp_specialchars( stripslashes($s), 1 );
+}
+
?>
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index d339c7f..7acd655 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -330,7 +330,7 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false)
return "<a href=\"{$_post->guid}\" title=\"{$_post->post_title}\" >{$innerHTML}</a>";
} else {
- $p .= __('Missing attachment');
+ $p .= __('Missing Attachment');
}
return $p;
}