summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-12 23:03:30 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-12 23:03:30 +0000
commit0d4bfdbf8c17706b57e92838d1599cb9e82c893b (patch)
treef02f84d4c598373d7e5921ea3d3e66fd50850d24
parentbed8532fd2d9cc526a74f4fc4214887b37cf6e71 (diff)
downloadwordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.tar.gz
wordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.tar.xz
wordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.zip
WP Merge to 5028
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@915 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/admin-functions.php4
-rw-r--r--wp-admin/categories.php2
-rw-r--r--wp-admin/edit-comments.php2
-rw-r--r--wp-admin/index.php2
-rw-r--r--wp-admin/link-import.php2
-rw-r--r--wp-admin/link-manager.php8
-rw-r--r--wp-admin/rtl.css26
-rw-r--r--wp-admin/wpmu-blogs.php47
-rw-r--r--wp-includes/bookmark-template.php9
-rw-r--r--wp-includes/category-template.php2
-rw-r--r--wp-includes/classes.php3
-rw-r--r--wp-includes/comment-template.php2
-rw-r--r--wp-includes/feed.php4
-rw-r--r--wp-includes/formatting.php9
-rw-r--r--wp-includes/functions.php26
-rw-r--r--wp-includes/general-template.php10
-rw-r--r--wp-includes/link-template.php31
-rw-r--r--wp-includes/post-template.php36
-rw-r--r--wp-includes/post.php2
-rw-r--r--wp-includes/theme.php4
-rw-r--r--wp-includes/vars.php32
-rw-r--r--wp-links-opml.php7
-rw-r--r--xmlrpc.php44
23 files changed, 149 insertions, 165 deletions
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index 79fe7e4..a7b0428 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -709,7 +709,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) {
function write_nested_categories( $categories ) {
foreach ( $categories as $category ) {
- echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( $category['cat_name'] ), "</label></li>";
+ echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
if ( $category['children'] ) {
echo "<ul>\n";
@@ -769,7 +769,7 @@ function dropdown_link_categories( $default = 0 ) {
// Dandy new recursive multiple category stuff.
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
- global $wpdb, $class;
+ global $wpdb;
if (!$categories )
$categories = get_categories( 'hide_empty=0' );
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
index f7a04f9..08e80c3 100644
--- a/wp-admin/categories.php
+++ b/wp-admin/categories.php
@@ -114,7 +114,7 @@ cat_rows();
<?php if ( current_user_can('manage_categories') ) : ?>
<div class="wrap">
-<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category. Instead, posts in the deleted category are set to the category <strong>%s</strong> and links are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p>
+<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category. Instead, posts in the deleted category are set to the category <strong>%s</strong> and links are set to <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category'))), apply_filters('the_category', get_catname(get_option('default_link_category')))) ?></p>
</div>
<?php include('edit-category-form.php'); ?>
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 4ba2479..d3de2c5 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -168,7 +168,7 @@ $post = get_post($comment->comment_post_ID);
$post_title = wp_specialchars( $post->post_title, 'double' );
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
- | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ]</p>
+ ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
</li>
<?php } // end foreach($comment) ?>
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 0988ed7..2a24a82 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -50,7 +50,7 @@ if ( $comments || $numcomments ) :
<?php
if ( $comments ) {
foreach ($comments as $comment) {
- echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
+ echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>');
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
echo '</li>';
}
diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php
index f1f971d..2c8accf 100644
--- a/wp-admin/link-import.php
+++ b/wp-admin/link-import.php
@@ -48,7 +48,7 @@ switch ($step) {
$categories = get_categories('hide_empty=0');
foreach ($categories as $category) {
?>
-<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars($category->cat_name); ?></option>
+<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
<?php
} // end foreach
?>
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index 63a2c90..8b0a4ee 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -80,7 +80,7 @@ $categories = get_categories("hide_empty=1&type=link");
$select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
foreach ((array) $categories as $cat)
- $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars($cat->cat_name) . "</option>\n";
+ $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
$select_cat .= "</select>\n";
$select_order = "<select name=\"order_by\">\n";
@@ -131,8 +131,8 @@ if ( $links ) {
<tbody id="the-list">
<?php
foreach ($links as $link) {
- $link->link_name = attribute_escape($link->link_name);
- $link->link_description = wp_specialchars($link->link_description);
+ $link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
+ $link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
$link->link_url = attribute_escape($link->link_url);
$link->link_category = wp_get_link_cats($link->link_id);
$short_url = str_replace('http://', '', $link->link_url);
@@ -160,7 +160,7 @@ if ( $links ) {
$cat_names = array();
foreach ($link->link_category as $category) {
$cat_name = get_the_category_by_ID($category);
- $cat_name = wp_specialchars($cat_name);
+ $cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
if ( $cat_id != $category )
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
$cat_names[] = $cat_name;
diff --git a/wp-admin/rtl.css b/wp-admin/rtl.css
index ad4af49..3fdf6b5 100644
--- a/wp-admin/rtl.css
+++ b/wp-admin/rtl.css
@@ -42,9 +42,11 @@ textarea, input, select { font: 13px Tahoma, Verdana, Arial, Helvetica, sans-se
#adminmenu {
padding: .2em 2em .3em .2em;
- height: 30px;
+ height: 28px;
}
+#adminmenu li { line-height: 160%; }
+
#adminmenu a {
margin: 0 0 0 10px;
display: block;
@@ -56,23 +58,22 @@ textarea, input, select { font: 13px Tahoma, Verdana, Arial, Helvetica, sans-se
border-left: 2px solid #4f96c8;
}
-#adminmenu li { line-height: 180%; }
+#submenu, #minisub { padding: 1px 3em 0 2em; }
-#submenu, #minisub { padding: 3px 3em 0 2em; }
+#submenu { height: 28px; }
-#submenu .current {
- border-right: 0;
- border-left: 2px solid #045290;
-}
+#submenu li { line-height: 160%; }
#submenu a {
- padding: .3em .4em .4em .4em;
margin: 0 0 0 10px;
display: block;
float: right;
}
-#submenu li { line-height: 120%; }
+#submenu .current {
+ border-right: 0;
+ border-left: 2px solid #045290;
+}
#currenttheme img {
float: right;
@@ -90,7 +91,12 @@ textarea, input, select { font: 13px Tahoma, Verdana, Arial, Helvetica, sans-se
margin-left: 5em;
}
-* html #postexcerpt .dbx-toggle-open, * html #postexcerpt .dbx-toggle-open, #postexcerpt div, #attachmentlinks div {
+#postexcerpt div, #attachmentlinks div {
+ margin-right: auto;
+ margin-left: 8px;
+}
+
+* html #postexcerpt .dbx-toggle-open {
padding-right: 0;
padding-left: 8px;
}
diff --git a/wp-admin/wpmu-blogs.php b/wp-admin/wpmu-blogs.php
index 87b1f55..bfcb52c 100644
--- a/wp-admin/wpmu-blogs.php
+++ b/wp-admin/wpmu-blogs.php
@@ -78,42 +78,21 @@ switch( $_GET[ 'action' ] ) {
</td></tr>
<?php
while( list( $key, $val ) = each( $options ) ) {
- $kellog = @unserialize( $val[ 'option_value' ] );
- if( is_array( $kellog ) ) {
- print '<tr valign="top">
- <th scope="row">' . ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) . '</th>
- <td>';
- print '<textarea rows="5" cols="40" disabled>';
- reset( $kellog );
- while( list( $key, $val ) = each( $kellog ) )
- {
- if( is_array( $val ) ) {
- print "$key:\n";
- while( list( $k, $v ) = each( $val ) ) {
- if( is_array( $v ) ) {
- print " $k:\n";
- while( list( $k1, $v1 ) = each( $v ) ) {
- print " $k1 -> $v1\n";
- }
- } else {
- if( $v1 != '' )
- print " $k1 -> $v1\n";
- }
- }
- } else {
- if( $val != '' )
- print "$key -> $val\n";
- }
+ $disabled = '';
+ if ( is_serialized($val[ 'option_value' ]) ) {
+ if ( is_serialized_string($val[ 'option_value' ]) ) {
+ $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single');
+ } else {
+ $val[ 'option_value' ] = "SERIALIZED DATA";
+ $disabled = ' disabled="disabled"';
}
- print '</textarea></td></tr>';
- } else {
- ?>
- <tr valign="top">
- <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>
- <td><input name="option[<?php echo $val[ 'option_name' ] ?>]" type="text" id="<?php echo $val[ 'option_name' ] ?>" value="<?php echo wp_specialchars( stripslashes( $val[ 'option_value' ] ), 1 ) ?>" size="40" /></td>
- </tr>
- <?php
}
+ ?>
+ <tr valign="top">
+ <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>
+ <td><input name="option[<?php echo $val[ 'option_name' ] ?>]" type="text" id="<?php echo $val[ 'option_name' ] ?>" value="<?php echo wp_specialchars( stripslashes( $val[ 'option_value' ] ), 1 ) ?>" size="40" <?php echo $disabled ?>/></td>
+ </tr>
+ <?php
}
?>
</table>
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 54b6d15..65e38aa 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -266,9 +266,9 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
if ( '' != $rel )
$rel = ' rel="' . $rel . '"';
- $desc = attribute_escape($bookmark->link_description);
- $name = attribute_escape($bookmark->link_name);
- $title = $desc;
+ $desc = attribute_escape(apply_filters('link_description', $bookmark->link_description));
+ $name = attribute_escape(apply_filters('link_title', $bookmark->link_name));
+ $title = $desc;
if ( $show_updated )
if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
@@ -336,7 +336,8 @@ function wp_list_bookmarks($args = '') {
if ( empty($bookmarks) )
continue;
$output .= str_replace(array('%id', '%class'), array("linkcat-$cat->cat_ID", $class), $category_before);
- $output .= "$title_before$cat->cat_name$title_after\n\t<ul>\n";
+ $catname = apply_filters( "link_category", $cat->cat_name );
+ $output .= "$title_before$catname$title_after\n\t<ul>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n$category_after\n";
}
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 0d85c01..32ace67 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -38,7 +38,7 @@ function get_category_link($category_id) {
$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename;
$catlink = str_replace('%category%', $category_nicename, $catlink);
- $catlink = get_option('home') . user_trailingslashit($catlink);
+ $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
}
return apply_filters('category_link', $catlink, $category_id);
}
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 8c8dcd0..5bdeebe 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -580,13 +580,14 @@ class Walker_Category extends Walker {
extract($args);
$cat_name = attribute_escape( $category->cat_name);
+ $cat_name = apply_filters( 'list_cats', $cat_name, $category );
$link = '<a href="' . get_category_link( $category->cat_ID ) . '" ';
if ( $use_desc_for_title == 0 || empty($category->category_description) )
$link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
else
$link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->category_description, $category )) . '"';
$link .= '>';
- $link .= apply_filters( 'list_cats', $category->cat_name, $category ).'</a>';
+ $link .= $cat_name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' ';
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index ea3ce15..ba7c0cb 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -226,7 +226,7 @@ function get_trackback_url() {
$tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
if ( '' != get_option('permalink_structure') )
- $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback');
+ $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
return $tb_url;
}
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 687a304..741bf7b 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -113,7 +113,7 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) {
$link = get_option('home') . '?feed=rss2&amp;author=' . $author_id;
} else {
$link = get_author_posts_url($author_id, $author_nicename);
- $link = $link . user_trailingslashit('feed');
+ $link = $link . user_trailingslashit('feed', 'feed');
}
$link = apply_filters('author_feed_link', $link);
@@ -131,7 +131,7 @@ function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
$link = get_option('home') . '?feed=rss2&amp;cat=' . $cat_ID;
} else {
$link = get_category_link($cat_ID);
- $link = $link . user_trailingslashit('feed/');
+ $link = $link . user_trailingslashit('feed', 'feed');
}
$link = apply_filters('category_feed_link', $link);
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 718a217..b10d53c 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -563,10 +563,11 @@ function backslashit($string) {
}
function trailingslashit($string) {
- if ( '/' != substr($string, -1)) {
- $string .= '/';
- }
- return $string;
+ return untrailingslashit($string) . '/';
+}
+
+function untrailingslashit($string) {
+ return rtrim($string, '/');
}
function addslashes_gpc($gpc) {
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index d843b39..29437a5 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1113,7 +1113,7 @@ function wp_upload_dir() {
return apply_filters('upload_dir', $uploads);
}
-function wp_upload_bits($name, $type, $bits, $overwrite = false) {
+function wp_upload_bits($name, $type, $bits) {
if ( empty($name) )
return array('error' => __("Empty filename"));
@@ -1141,21 +1141,10 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) {
$filename = str_replace("$number$ext", ++$number . $ext, $filename);
}
- // If we are asked to over write the file then make sure
- // the $name has the complete path and is writable.
- if($overwrite) {
- if(!is_writable($name)) {
- return(array("error" => __("Can not over write file.")));
- }
- $new_file = $name;
- $filename = basename($name);
- }
- else {
- $new_file = $upload['path'] . "/$filename";
- if ( ! wp_mkdir_p( dirname($new_file) ) ) {
- $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
- return array('error' => $message);
- }
+ $new_file = $upload['path'] . "/$filename";
+ if ( ! wp_mkdir_p( dirname($new_file) ) ) {
+ $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
+ return array('error' => $message);
}
$ifp = @ fopen($new_file, 'wb');
@@ -1170,11 +1159,8 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) {
$perms = $perms & 0000666;
@ chmod($new_file, $perms);
- // Compute the URL if this is a new file.
+ // Compute the URL
$url = $upload['url'] . "/$filename";
- if($overwrite) {
- $url = $name;
- }
return array('file' => $new_file, 'url' => $url, 'error' => false);
}
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 81d696c..d320d67 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -215,8 +215,8 @@ function wp_title($sep = '&raquo;', $display = true) {
// If there is a post
if ( is_single() || is_page() ) {
$post = $wp_query->get_queried_object();
- $title = strip_tags($post->post_title);
$title = apply_filters('single_post_title', $title);
+ $title = strip_tags($post->post_title);
}
$prefix = '';
@@ -582,12 +582,16 @@ function get_calendar($initial = true) {
);
if ( $ak_post_titles ) {
foreach ( $ak_post_titles as $ak_post_title ) {
+
+ $post_title = apply_filters( "the_title", $ak_post_title->post_title );
+ $post_title = str_replace('"', '&quot;', wptexturize( $post_title ));
+
if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
$ak_titles_for_day['day_'.$ak_post_title->dom] = '';
if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one
- $ak_titles_for_day["$ak_post_title->dom"] = str_replace('"', '&quot;', wptexturize($ak_post_title->post_title));
+ $ak_titles_for_day["$ak_post_title->dom"] = $post_title;
else
- $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . str_replace('"', '&quot;', wptexturize($ak_post_title->post_title));
+ $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
}
}
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 65a502a..10de62a 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -16,14 +16,19 @@ function permalink_link() { // For backwards compatibility
* has a trailing slash, strips the trailing slash if not
* @global object Uses $wp_rewrite
* @param $string string a URL with or without a trailing slash
+ * @param $type_of_url string the type of URL being considered (e.g. single, category, etc) for use in the filter
* @return string
*/
-function user_trailingslashit($string) {
+function user_trailingslashit($string, $type_of_url = '') {
global $wp_rewrite;
if ( $wp_rewrite->use_trailing_slashes )
$string = trailingslashit($string);
else
- $string = preg_replace('|/$|', '', $string); // untrailing slash
+ $string = untrailingslashit($string);
+
+ // Note that $type_of_url can be one of following:
+ // single, single_trackback, single_feed, single_paged, feed, category, page, year, month, day, paged
+ $string = apply_filters('user_trailingslashit', $string, $type_of_url);
return $string;
}
@@ -94,7 +99,9 @@ function get_permalink($id = 0) {
$author,
$post->post_name,
);
- return apply_filters('post_link', get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post);
+ $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
+ $permalink = user_trailingslashit($permalink, 'single');
+ return apply_filters('post_link', $permalink, $post);
} else { // if they're not using the fancy permalink option
$permalink = get_option('home') . '/?p=' . $post->ID;
return apply_filters('post_link', $permalink, $post);
@@ -134,7 +141,7 @@ function _get_page_link( $id = false ) {
$link = get_page_uri($id);
$link = str_replace('%pagename%', $link, $pagestruct);
$link = get_option('home') . "/$link";
- $link = user_trailingslashit($link);
+ $link = user_trailingslashit($link, 'page');
} else {
$link = get_option('home') . "/?page_id=$id";
}
@@ -176,7 +183,7 @@ function get_year_link($year) {
$yearlink = $wp_rewrite->get_year_permastruct();
if ( !empty($yearlink) ) {
$yearlink = str_replace('%year%', $year, $yearlink);
- return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink), $year);
+ return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
} else {
return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year);
}
@@ -192,7 +199,7 @@ function get_month_link($year, $month) {
if ( !empty($monthlink) ) {
$monthlink = str_replace('%year%', $year, $monthlink);
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
- return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink), $year, $month);
+ return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
} else {
return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
}
@@ -212,7 +219,7 @@ function get_day_link($year, $month, $day) {
$daylink = str_replace('%year%', $year, $daylink);
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
- return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink), $year, $month, $day);
+ return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
} else {
return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
}
@@ -236,7 +243,7 @@ function get_feed_link($feed='rss2') {
$permalink = str_replace('%feed%', $feed, $permalink);
$permalink = preg_replace('#/+#', '/', "/$permalink");
- $output = get_option('home') . user_trailingslashit($permalink);
+ $output = get_option('home') . user_trailingslashit($permalink, 'feed');
} else {
if ( false !== strpos($feed, 'comments_') )
$feed = str_replace('comments_', 'comments-', $feed);
@@ -257,7 +264,7 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
$url = trailingslashit( get_permalink() ) . 'feed';
if ( 'rss2' != $feed )
$url .= "/$feed";
- $url = user_trailingslashit($url);
+ $url = user_trailingslashit($url, 'single_feed');
} else {
$url = get_option('home') . "/?feed=$feed&amp;p=$id";
}
@@ -471,13 +478,13 @@ function get_pagenum_link($pagenum = 1) {
$qstr = preg_replace('|^/+|', '', $qstr);
if ( $permalink )
- $qstr = user_trailingslashit($qstr);
+ $qstr = user_trailingslashit($qstr, 'paged');
$qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_option('home') ) . $qstr );
// showing /page/1/ or ?paged=1 is redundant
if ( 1 === $pagenum ) {
- $qstr = str_replace(user_trailingslashit('index.php/page/1'), '', $qstr); // for PATHINFO style
- $qstr = str_replace(user_trailingslashit('page/1'), '', $qstr); // for mod_rewrite style
+ $qstr = str_replace(user_trailingslashit('index.php/page/1', 'paged'), '', $qstr); // for PATHINFO style
+ $qstr = str_replace(user_trailingslashit('page/1', 'paged'), '', $qstr); // for mod_rewrite style
$qstr = remove_query_arg('paged', $qstr); // for query style
}
return $qstr;
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index cfa56f8..3b1ca35 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -155,10 +155,14 @@ function wp_link_pages($args = '') {
$j = str_replace('%',"$i",$pagelink);
$output .= ' ';
if ( ($i != $page) || ((!$more) && ($page==1)) ) {
- if ( '' == get_option('permalink_structure') )
- $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
- else
- $output .= '<a href="' . trailingslashit(get_permalink()) . $i . '/">';
+ if ( 1 == $i ) {
+ $output .= '<a href="' . get_permalink() . '">';
+ } else {
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
+ else
+ $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
+ }
}
$output .= $j;
if ( ($i != $page) || ((!$more) && ($page==1)) )
@@ -170,17 +174,25 @@ function wp_link_pages($args = '') {
$output .= $before;
$i = $page - 1;
if ( $i && $more ) {
- if ( '' == get_option('permalink_structure') )
- $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>';
- else
- $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
+ if ( 1 == $i ) {
+ $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>';
+ } else {
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>';
+ else
+ $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>';
+ }
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
- if ( '' == get_option('permalink_structure') )
- $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
- else
- $output .= '<a href="' . trailingslashit(get_permalink()) . $i . '/">' . $nextpagelink . '</a>';
+ if ( 1 == $i ) {
+ $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>';
+ } else {
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $nextpagelink . '</a>';
+ else
+ $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>';
+ }
}
$output .= $after;
}
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 33a0a3c..810ad31 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -105,6 +105,7 @@ function &get_post(&$post, $output = OBJECT) {
$post_cache[$blog_id][$post->ID] = &$post;
$_post = & $post_cache[$blog_id][$post->ID];
} else {
+ $post = (int) $post;
if ( isset($post_cache[$blog_id][$post]) )
$_post = & $post_cache[$blog_id][$post];
elseif ( $_post = wp_cache_get($post, 'pages') )
@@ -932,6 +933,7 @@ function &get_page(&$page, $output = OBJECT) {
wp_cache_add($page->ID, $page, 'pages');
$_page = $page;
} else {
+ $page = (int) $page;
// first, check the cache
if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) {
// not in the page cache?
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 2f2c1fb..7e45c54 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -441,9 +441,9 @@ function get_theme_mod($name, $default = false) {
$mods = get_option("mods_$theme");
if ( isset($mods[$name]) )
- return $mods[$name];
+ return apply_filters( "theme_mod_$name", $mods[$name] );
- return sprintf($default, get_template_directory_uri());
+ return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri()) );
}
function set_theme_mod($name, $value) {
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index 1675ca4..26f0fa0 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -13,27 +13,27 @@ if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches) ) {
}
// Simple browser detection
-// We should probably be doing true/false instead of 1/0 here ~ Mark
-$is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0;
+$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = false;
-if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT']) )
- $is_lynx = 1;
-elseif ( preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT']) )
- $is_gecko = 1;
-elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']) )
- $is_winIE = 1;
-elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']) )
- $is_macIE = 1;
-elseif ( preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) )
- $is_opera = 1;
-elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']) )
- $is_NS4 = 1;
+if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
+ $is_lynx = true;
+} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
+ $is_gecko = true;
+} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win')) {
+ $is_winIE = true;
+} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
+ $is_macIE = true;
+} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
+ $is_opera = true;
+} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) {
+ $is_NS4 = true;
+}
$is_IE = ( $is_macIE || $is_winIE );
// Server detection
-$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? 1 : 0;
-$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? 1 : 0;
+$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false;
+$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
diff --git a/wp-links-opml.php b/wp-links-opml.php
index 82146fc..4b72322 100644
--- a/wp-links-opml.php
+++ b/wp-links-opml.php
@@ -29,14 +29,17 @@ else
$cats = array (get_category($link_cat));
foreach ((array) $cats as $cat) {
+ $catname = apply_filters('link_category', $cat->cat_name);
+
?>
-<outline type="category" title="<?php echo attribute_escape($cat->cat_name); ?>">
+<outline type="category" title="<?php echo attribute_escape($catname); ?>">
<?php
$bookmarks = get_bookmarks("category={$cat->cat_ID}");
foreach ((array) $bookmarks as $bookmark) {
+ $title = attribute_escape(apply_filters('link_title', $bookmark->link_name));
?>
- <outline text="<?php echo attribute_escape($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
+ <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
<?php
}
diff --git a/xmlrpc.php b/xmlrpc.php
index 69937e0..e1d1b31 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -1393,29 +1393,22 @@ class wp_xmlrpc_server extends IXR_Server {
$type = $data['type'];
$bits = $data['bits'];
- // Default to new file, not over write.
- $overwrite = false;
if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
- $overwrite = true;
-
- // If the file isn't writable then error out now.
- if(!is_writable($data["name"])) {
- return(new IXR_Error(500, "File is not writable, over write failed."));
- }
-
- // We now know the file is good so don't use the sanitized name.
- $name = $data["name"];
-
// Get postmeta info on the object.
- $old_meta = $wpdb->get_row("
- SELECT *
- FROM {$wpdb->postmeta}
- WHERE meta_key = '_wp_attached_file'
- AND meta_value = '{$name}'
+ $old_file = $wpdb->get_row("
+ SELECT ID
+ FROM {$wpdb->posts}
+ WHERE post_title = '{$name}'
+ AND post_type = 'attachment'
");
- // Get post info on the object.
- $old_post = get_post($old_meta->post_id);
+ // Delete previous file.
+ wp_delete_attachment($old_file->ID);
+
+ // Make sure the new name is different by pre-pending the
+ // previous post id.
+ $filename = preg_replace("/^wpid\d+-/", "", $name);
+ $name = "wpid{$old_file->ID}-{$filename}";
}
logIO('O', '(MW) Received '.strlen($bits).' bytes');
@@ -1450,22 +1443,11 @@ class wp_xmlrpc_server extends IXR_Server {
'guid' => $upload[ 'url' ]
);
- // If we are over writing then set the correct post_id and URL
- // instead of getting new ones.
- if($overwrite) {
- $post_id = $old_meta->post_id;
- $attachment["post_parent"] = $old_meta->post_id;
- $attachment["ID"] = $old_meta->post_id;
-
- $upload["url"] = $old_post->guid;
- $attachment["guid"] = $old_post->guid;
- }
-
// Save the data
$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
- return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );
+ return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
}