Changeset 915

Show
Ignore:
Timestamp:
03/12/07 23:03:30 (2 years ago)
Author:
donncha
Message:

WP Merge to 5028

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r909 r915  
    710710function write_nested_categories( $categories ) { 
    711711        foreach ( $categories as $category ) { 
    712                 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>"; 
     712                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>"; 
    713713 
    714714                if ( $category['children'] ) { 
     
    770770// Dandy new recursive multiple category stuff. 
    771771function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { 
    772         global $wpdb, $class
     772        global $wpdb
    773773 
    774774        if (!$categories ) 
  • trunk/wp-admin/categories.php

    r829 r915  
    115115<?php if ( current_user_can('manage_categories') ) : ?> 
    116116<div class="wrap"> 
    117 <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> 
     117<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> 
    118118</div> 
    119119 
  • trunk/wp-admin/edit-comments.php

    r909 r915  
    169169$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 
    170170?> 
    171  | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ]</p> 
     171 ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p> 
    172172                </li> 
    173173 
  • trunk/wp-admin/index.php

    r899 r915  
    5151if ( $comments ) { 
    5252foreach ($comments as $comment) { 
    53         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>'); 
     53        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>'); 
    5454        edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
    5555        echo '</li>'; 
  • trunk/wp-admin/link-import.php

    r904 r915  
    4949foreach ($categories as $category) { 
    5050?> 
    51 <option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars($category->cat_name); ?></option> 
     51<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option> 
    5252<?php 
    5353} // end foreach 
  • trunk/wp-admin/link-manager.php

    r832 r915  
    8181$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n"; 
    8282foreach ((array) $categories as $cat) 
    83         $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars($cat->cat_name) . "</option>\n"; 
     83        $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"; 
    8484$select_cat .= "</select>\n"; 
    8585 
     
    132132<?php 
    133133        foreach ($links as $link) { 
    134                 $link->link_name = attribute_escape($link->link_name); 
    135                 $link->link_description = wp_specialchars($link->link_description); 
     134                $link->link_name = attribute_escape(apply_filters('link_title', $link->link_name)); 
     135                $link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description)); 
    136136                $link->link_url = attribute_escape($link->link_url); 
    137137                $link->link_category = wp_get_link_cats($link->link_id); 
     
    161161                                        foreach ($link->link_category as $category) { 
    162162                                                $cat_name = get_the_category_by_ID($category); 
    163                                                 $cat_name = wp_specialchars($cat_name); 
     163                                                $cat_name = wp_specialchars(apply_filters('link_category', $cat_name)); 
    164164                                                if ( $cat_id != $category ) 
    165165                                                        $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; 
  • trunk/wp-admin/rtl.css

    r804 r915  
    4343#adminmenu { 
    4444        padding: .2em 2em .3em .2em; 
    45         height: 30px; 
     45        height: 28px; 
    4646} 
     47 
     48#adminmenu li { line-height: 160%; } 
    4749 
    4850#adminmenu a { 
     
    5759} 
    5860 
    59 #adminmenu li { line-height: 180%; } 
     61#submenu, #minisub { padding: 1px 3em 0 2em; } 
    6062 
    61 #submenu, #minisub { padding: 3px 3em 0 2em; } 
     63#submenu { height: 28px; } 
     64 
     65#submenu li { line-height: 160%; } 
     66 
     67#submenu a { 
     68        margin: 0 0 0 10px; 
     69        display: block; 
     70        float: right; 
     71
    6272 
    6373#submenu .current { 
     
    6575        border-left: 2px solid #045290; 
    6676} 
    67  
    68 #submenu a { 
    69         padding: .3em .4em .4em .4em; 
    70         margin: 0 0 0 10px; 
    71         display: block; 
    72         float: right; 
    73 } 
    74  
    75 #submenu li { line-height: 120%; } 
    7677 
    7778#currenttheme img { 
     
    9192} 
    9293 
    93 * html #postexcerpt .dbx-toggle-open, * html #postexcerpt .dbx-toggle-open, #postexcerpt div, #attachmentlinks div { 
     94#postexcerpt div, #attachmentlinks div { 
     95        margin-right: auto; 
     96        margin-left: 8px; 
     97
     98 
     99* html #postexcerpt .dbx-toggle-open { 
    94100        padding-right: 0; 
    95101        padding-left: 8px; 
  • trunk/wp-admin/wpmu-blogs.php

    r884 r915  
    7979    <?php 
    8080    while( list( $key, $val ) = each( $options ) ) {  
    81         $kellog = @unserialize( $val[ 'option_value' ] ); 
    82         if( is_array( $kellog ) ) { 
    83                 print '<tr valign="top">  
    84                        <th scope="row">' . ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) . '</th>  
    85                        <td>'; 
    86                 print '<textarea rows="5" cols="40" disabled>'; 
    87                 reset( $kellog ); 
    88                 while( list( $key, $val ) = each( $kellog ) )  
    89                 {  
    90                     if( is_array( $val ) ) { 
    91                         print "$key:\n"; 
    92                         while( list( $k, $v ) = each( $val ) ) { 
    93                             if( is_array( $v ) ) { 
    94                                 print "    $k:\n"; 
    95                                 while( list( $k1, $v1 ) = each( $v ) ) { 
    96                                     print "      $k1 -> $v1\n";  
    97                                 } 
    98                             } else { 
    99                                 if( $v1 != '' ) 
    100                                     print "  $k1 -> $v1\n"; 
    101                             } 
    102                         } 
    103                     } else { 
    104                         if( $val != '' ) 
    105                             print "$key -> $val\n"; 
    106                     } 
    107                 } 
    108                 print '</textarea></td></tr>'; 
    109         } else { 
    110                 ?> 
    111                 <tr valign="top">  
    112                 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>  
    113                 <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>  
    114                 </tr>  
    115                 <?php 
     81        $disabled = ''; 
     82        if ( is_serialized($val[ 'option_value' ]) ) { 
     83                if ( is_serialized_string($val[ 'option_value' ]) ) { 
     84                        $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single'); 
     85                } else { 
     86                        $val[ 'option_value' ] = "SERIALIZED DATA"; 
     87                        $disabled = ' disabled="disabled"'; 
     88                } 
    11689        } 
     90        ?> 
     91        <tr valign="top">  
     92        <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>  
     93        <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>  
     94        </tr>  
     95        <?php 
    11796    } 
    11897    ?> 
  • trunk/wp-includes/bookmark-template.php

    r909 r915  
    267267                        $rel = ' rel="' . $rel . '"'; 
    268268 
    269                 $desc = attribute_escape($bookmark->link_description); 
    270                 $name = attribute_escape($bookmark->link_name); 
    271               $title = $desc; 
     269                $desc = attribute_escape(apply_filters('link_description', $bookmark->link_description));  
     270                $name = attribute_escape(apply_filters('link_title', $bookmark->link_name));  
     271              $title = $desc; 
    272272 
    273273                if ( $show_updated ) 
     
    337337                                continue; 
    338338                        $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->cat_ID", $class), $category_before); 
    339                         $output .= "$title_before$cat->cat_name$title_after\n\t<ul>\n"; 
     339                        $catname = apply_filters( "link_category", $cat->cat_name ); 
     340                        $output .= "$title_before$catname$title_after\n\t<ul>\n"; 
    340341                        $output .= _walk_bookmarks($bookmarks, $r); 
    341342                        $output .= "\n\t</ul>\n$category_after\n"; 
  • trunk/wp-includes/category-template.php

    r904 r915  
    3939 
    4040                $catlink = str_replace('%category%', $category_nicename, $catlink); 
    41                 $catlink = get_option('home') . user_trailingslashit($catlink); 
     41                $catlink = get_option('home') . user_trailingslashit($catlink, 'category'); 
    4242        } 
    4343        return apply_filters('category_link', $catlink, $category_id); 
  • trunk/wp-includes/classes.php

    r909 r915  
    581581 
    582582                $cat_name = attribute_escape( $category->cat_name); 
     583                $cat_name = apply_filters( 'list_cats', $cat_name, $category ); 
    583584                $link = '<a href="' . get_category_link( $category->cat_ID ) . '" '; 
    584585                if ( $use_desc_for_title == 0 || empty($category->category_description) ) 
     
    587588                        $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->category_description, $category )) . '"'; 
    588589                $link .= '>'; 
    589                 $link .= apply_filters( 'list_cats', $category->cat_name, $category ).'</a>'; 
     590                $link .= $cat_name . '</a>'; 
    590591 
    591592                if ( (! empty($feed_image)) || (! empty($feed)) ) { 
  • trunk/wp-includes/comment-template.php

    r909 r915  
    227227 
    228228        if ( '' != get_option('permalink_structure') ) 
    229                 $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback'); 
     229                $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback'); 
    230230 
    231231        return $tb_url; 
  • trunk/wp-includes/feed.php

    r909 r915  
    114114        } else { 
    115115                $link = get_author_posts_url($author_id, $author_nicename); 
    116                 $link = $link . user_trailingslashit('feed'); 
     116                $link = $link . user_trailingslashit('feed', 'feed'); 
    117117        } 
    118118 
     
    132132        } else { 
    133133                $link = get_category_link($cat_ID); 
    134                 $link = $link . user_trailingslashit('feed/'); 
     134                $link = $link . user_trailingslashit('feed', 'feed'); 
    135135        } 
    136136 
  • trunk/wp-includes/formatting.php

    r909 r915  
    564564 
    565565function trailingslashit($string) { 
    566                 if ( '/' != substr($string, -1)) { 
    567                                 $string .= '/'; 
    568                 } 
    569                 return $string; 
     566        return untrailingslashit($string) . '/'; 
     567
     568 
     569function untrailingslashit($string) { 
     570        return rtrim($string, '/'); 
    570571} 
    571572 
  • trunk/wp-includes/functions.php

    r909 r915  
    11141114} 
    11151115 
    1116 function wp_upload_bits($name, $type, $bits, $overwrite = false) { 
     1116function wp_upload_bits($name, $type, $bits) { 
    11171117        if ( empty($name) ) 
    11181118                return array('error' => __("Empty filename")); 
     
    11421142        } 
    11431143 
    1144         // If we are asked to over write the file then make sure 
    1145         // the $name has the complete path and is writable. 
    1146         if($overwrite) { 
    1147                 if(!is_writable($name)) { 
    1148                         return(array("error" => __("Can not over write file."))); 
    1149                 } 
    1150                 $new_file = $name; 
    1151                 $filename = basename($name); 
    1152         } 
    1153         else { 
    1154                 $new_file = $upload['path'] . "/$filename"; 
    1155                 if ( ! wp_mkdir_p( dirname($new_file) ) ) { 
    1156                         $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); 
    1157                         return array('error' => $message); 
    1158                 } 
     1144        $new_file = $upload['path'] . "/$filename"; 
     1145        if ( ! wp_mkdir_p( dirname($new_file) ) ) { 
     1146                $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); 
     1147                return array('error' => $message); 
    11591148        } 
    11601149 
     
    11711160        @ chmod($new_file, $perms); 
    11721161 
    1173         // Compute the URL if this is a new file. 
     1162        // Compute the URL 
    11741163        $url = $upload['url'] . "/$filename"; 
    1175         if($overwrite) { 
    1176                 $url = $name; 
    1177         } 
    11781164 
    11791165        return array('file' => $new_file, 'url' => $url, 'error' => false); 
  • trunk/wp-includes/general-template.php

    r909 r915  
    216216        if ( is_single() || is_page() ) { 
    217217                $post = $wp_query->get_queried_object(); 
     218                $title = apply_filters('single_post_title', $title); 
    218219                $title = strip_tags($post->post_title); 
    219                 $title = apply_filters('single_post_title', $title); 
    220220        } 
    221221 
     
    583583        if ( $ak_post_titles ) { 
    584584                foreach ( $ak_post_titles as $ak_post_title ) { 
     585                         
     586                                $post_title = apply_filters( "the_title", $ak_post_title->post_title ); 
     587                                $post_title = str_replace('"', '&quot;', wptexturize( $post_title )); 
     588                                                                 
    585589                                if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) ) 
    586590                                        $ak_titles_for_day['day_'.$ak_post_title->dom] = ''; 
    587591                                if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one 
    588                                         $ak_titles_for_day["$ak_post_title->dom"] = str_replace('"', '&quot;', wptexturize($ak_post_title->post_title))
     592                                        $ak_titles_for_day["$ak_post_title->dom"] = $post_title
    589593                                else 
    590                                         $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . str_replace('"', '&quot;', wptexturize($ak_post_title->post_title))
     594                                        $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title
    591595                } 
    592596        } 
  • trunk/wp-includes/link-template.php

    r909 r915  
    1717 * @global object Uses $wp_rewrite 
    1818 * @param $string string a URL with or without a trailing slash 
     19 * @param $type_of_url string the type of URL being considered (e.g. single, category, etc) for use in the filter 
    1920 * @return string 
    2021 */ 
    21 function user_trailingslashit($string) { 
     22function user_trailingslashit($string, $type_of_url = '') { 
    2223        global $wp_rewrite; 
    2324        if ( $wp_rewrite->use_trailing_slashes ) 
    2425                $string = trailingslashit($string); 
    2526        else 
    26                 $string = preg_replace('|/$|', '', $string); // untrailing slash 
     27                $string = untrailingslashit($string); 
     28 
     29        // Note that $type_of_url can be one of following: 
     30        // single, single_trackback, single_feed, single_paged, feed, category, page, year, month, day, paged 
     31        $string = apply_filters('user_trailingslashit', $string, $type_of_url); 
    2732        return $string; 
    2833} 
     
    95100                        $post->post_name, 
    96101                ); 
    97                 return apply_filters('post_link', get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post); 
     102                $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink); 
     103                $permalink = user_trailingslashit($permalink, 'single'); 
     104                return apply_filters('post_link', $permalink, $post); 
    98105        } else { // if they're not using the fancy permalink option 
    99106                $permalink = get_option('home') . '/?p=' . $post->ID; 
     
    135142                $link = str_replace('%pagename%', $link, $pagestruct); 
    136143                $link = get_option('home') . "/$link"; 
    137                 $link = user_trailingslashit($link); 
     144                $link = user_trailingslashit($link, 'page'); 
    138145        } else { 
    139146                $link = get_option('home') . "/?page_id=$id"; 
     
    177184        if ( !empty($yearlink) ) { 
    178185                $yearlink = str_replace('%year%', $year, $yearlink); 
    179                 return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink), $year); 
     186                return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year); 
    180187        } else { 
    181188                return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year); 
     
    193200                $monthlink = str_replace('%year%', $year, $monthlink); 
    194201                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); 
    195                 return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink), $year, $month); 
     202                return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month); 
    196203        } else { 
    197204                return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month); 
     
    213220                $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); 
    214221                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); 
    215                 return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink), $year, $month, $day); 
     222                return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day); 
    216223        } else { 
    217224                return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); 
     
    237244                $permalink = str_replace('%feed%', $feed, $permalink); 
    238245                $permalink = preg_replace('#/+#', '/', "/$permalink"); 
    239                 $output =  get_option('home') . user_trailingslashit($permalink); 
     246                $output =  get_option('home') . user_trailingslashit($permalink, 'feed'); 
    240247        } else { 
    241248                if ( false !== strpos($feed, 'comments_') ) 
     
    258265                if ( 'rss2' != $feed ) 
    259266                        $url .= "/$feed"; 
    260                 $url = user_trailingslashit($url); 
     267                $url = user_trailingslashit($url, 'single_feed'); 
    261268        } else { 
    262269                $url = get_option('home') . "/?feed=$feed&amp;p=$id"; 
     
    472479        $qstr = preg_replace('|^/+|', '', $qstr); 
    473480        if ( $permalink ) 
    474                 $qstr = user_trailingslashit($qstr); 
     481                $qstr = user_trailingslashit($qstr, 'paged'); 
    475482        $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_option('home') ) . $qstr ); 
    476483 
    477484        // showing /page/1/ or ?paged=1 is redundant 
    478485        if ( 1 === $pagenum ) { 
    479                 $qstr = str_replace(user_trailingslashit('index.php/page/1'), '', $qstr); // for PATHINFO style 
    480                 $qstr = str_replace(user_trailingslashit('page/1'), '', $qstr); // for mod_rewrite style 
     486                $qstr = str_replace(user_trailingslashit('index.php/page/1', 'paged'), '', $qstr); // for PATHINFO style 
     487                $qstr = str_replace(user_trailingslashit('page/1', 'paged'), '', $qstr); // for mod_rewrite style 
    481488                $qstr = remove_query_arg('paged', $qstr); // for query style 
    482489        } 
  • trunk/wp-includes/post-template.php

    r904 r915  
    156156                                $output .= ' '; 
    157157                                if ( ($i != $page) || ((!$more) && ($page==1)) ) { 
    158                                         if ( '' == get_option('permalink_structure') ) 
    159                                                 $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'; 
    160                                         else 
    161                                                 $output .= '<a href="' . trailingslashit(get_permalink()) . $i . '/">'; 
     158                                        if ( 1 == $i ) { 
     159                                                $output .= '<a href="' . get_permalink() . '">'; 
     160                                        } else { 
     161                                                if ( '' == get_option('permalink_structure') ) 
     162                                                        $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'; 
     163                                                else 
     164                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 
     165                                        } 
    162166                                } 
    163167                                $output .= $j; 
     
    171175                                $i = $page - 1; 
    172176                                if ( $i && $more ) { 
    173                                         if ( '' == get_option('permalink_structure') ) 
    174                                                 $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>'; 
    175                                         else 
    176                                                 $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>'; 
     177                                        if ( 1 == $i ) { 
     178                                                $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>'; 
     179                                        } else { 
     180                                                if ( '' == get_option('permalink_structure') ) 
     181                                                        $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>'; 
     182                                                else 
     183                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>'; 
     184                                        } 
    177185                                } 
    178186                                $i = $page + 1; 
    179187                                if ( $i <= $numpages && $more ) { 
    180                                         if ( '' == get_option('permalink_structure') ) 
    181                                                 $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>'; 
    182                                         else 
    183                                                 $output .= '<a href="' . trailingslashit(get_permalink()) . $i . '/">' . $nextpagelink . '</a>'; 
     188                                        if ( 1 == $i ) { 
     189                                                $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>'; 
     190                                        } else { 
     191                                                if ( '' == get_option('permalink_structure') ) 
     192                                                        $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $nextpagelink . '</a>'; 
     193                                                else 
     194                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>'; 
     195                                        } 
    184196                                } 
    185197                                $output .= $after; 
  • trunk/wp-includes/post.php

    r909 r915  
    106106                $_post = & $post_cache[$blog_id][$post->ID]; 
    107107        } else { 
     108                $post = (int) $post; 
    108109                if ( isset($post_cache[$blog_id][$post]) ) 
    109110                        $_post = & $post_cache[$blog_id][$post]; 
     
    933934                $_page = $page; 
    934935        } else { 
     936                $page = (int) $page; 
    935937                // first, check the cache 
    936938                if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) { 
  • trunk/wp-includes/theme.php

    r909 r915  
    442442 
    443443        if ( isset($mods[$name]) ) 
    444                 return $mods[$name]
    445  
    446         return sprintf($default, get_template_directory_uri()); 
     444                return apply_filters( "theme_mod_$name", $mods[$name] )
     445 
     446        return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri()) ); 
    447447} 
    448448 
  • trunk/wp-includes/vars.php

    r909 r915  
    1414 
    1515// Simple browser detection 
    16 // We should probably be doing true/false instead of 1/0 here ~ Mark 
    17 $is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0; 
     16$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = false; 
    1817 
    19 if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT']) ) 
    20         $is_lynx = 1; 
    21 elseif ( preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT']) ) 
    22         $is_gecko = 1; 
    23 elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']) ) 
    24         $is_winIE = 1; 
    25 elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']) ) 
    26         $is_macIE = 1; 
    27 elseif ( preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) ) 
    28         $is_opera = 1; 
    29 elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']) ) 
    30         $is_NS4 = 1; 
     18if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { 
     19        $is_lynx = true; 
     20} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) { 
     21        $is_gecko = true; 
     22} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win')) { 
     23        $is_winIE = true; 
     24} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) { 
     25        $is_macIE = true; 
     26} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) { 
     27        $is_opera = true; 
     28} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) { 
     29        $is_NS4 = true; 
     30
    3131 
    3232$is_IE = ( $is_macIE || $is_winIE ); 
    3333 
    3434// Server detection 
    35 $is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? 1 : 0
    36 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? 1 : 0
     35$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false
     36$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false
    3737 
    3838// if the config file does not provide the smilies array, let's define it here 
  • trunk/wp-links-opml.php

    r828 r915  
    3030 
    3131foreach ((array) $cats as $cat) { 
     32        $catname = apply_filters('link_category', $cat->cat_name); 
     33 
    3234?> 
    33 <outline type="category" title="<?php echo attribute_escape($cat->cat_name); ?>"> 
     35<outline type="category" title="<?php echo attribute_escape($catname); ?>"> 
    3436<?php 
    3537 
    3638        $bookmarks = get_bookmarks("category={$cat->cat_ID}"); 
    3739        foreach ((array) $bookmarks as $bookmark) { 
     40                $title = attribute_escape(apply_filters('link_title', $bookmark->link_name)); 
    3841?> 
    39         <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; ?>" /> 
     42        <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; ?>" /> 
    4043<?php 
    4144 
  • trunk/xmlrpc.php

    r909 r915  
    13941394                $bits = $data['bits']; 
    13951395 
    1396                 // Default to new file, not over write. 
    1397                 $overwrite = false; 
    13981396                if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) { 
    1399                         $overwrite = true; 
    1400  
    1401                         // If the file isn't writable then error out now. 
    1402                         if(!is_writable($data["name"])) { 
    1403                                 return(new IXR_Error(500, "File is not writable, over write failed.")); 
    1404                         } 
    1405  
    1406                         // We now know the file is good so don't use the sanitized name. 
    1407                         $name = $data["name"]; 
    1408  
    14091397                        // Get postmeta info on the object. 
    1410                         $old_meta = $wpdb->get_row(" 
    1411                                 SELECT * 
    1412                                 FROM {$wpdb->postmeta
    1413                                 WHERE meta_key = '_wp_attached_file
    1414                                         AND meta_value = '{$name}
     1398                        $old_file = $wpdb->get_row(" 
     1399                                SELECT ID 
     1400                                FROM {$wpdb->posts
     1401                                WHERE post_title = '{$name}
     1402                                        AND post_type = 'attachment
    14151403                        "); 
    14161404 
    1417                         // Get post info on the object. 
    1418                         $old_post = get_post($old_meta->post_id); 
     1405                        // Delete previous file. 
     1406                        wp_delete_attachment($old_file->ID); 
     1407 
     1408                        // Make sure the new name is different by pre-pending the 
     1409                        // previous post id. 
     1410                        $filename = preg_replace("/^wpid\d+-/", "", $name); 
     1411                        $name = "wpid{$old_file->ID}-{$filename}"; 
    14191412                } 
    14201413 
     
    14511444                ); 
    14521445 
    1453                 // If we are over writing then set the correct post_id and URL 
    1454                 // instead of getting new ones. 
    1455                 if($overwrite) { 
    1456                         $post_id                                        = $old_meta->post_id; 
    1457                         $attachment["post_parent"]      = $old_meta->post_id; 
    1458                         $attachment["ID"]                       = $old_meta->post_id; 
    1459  
    1460                         $upload["url"]                          = $old_post->guid; 
    1461                         $attachment["guid"]                     = $old_post->guid; 
    1462                 } 
    1463  
    14641446                // Save the data 
    14651447                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 
    14661448                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 
    14671449 
    1468                 return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) ); 
     1450                return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) ); 
    14691451        } 
    14701452