Changeset 1266

Show
Ignore:
Timestamp:
04/25/08 09:03:55 (3 months ago)
Author:
donncha
Message:

WP Merge to revision 7826

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/css/colors-classic.css

    r1218 r1266  
    191191        color: #07273e; 
    192192        border-color: #a3a3a3; 
     193} 
     194 
     195.button[disabled], .button:disabled { 
     196        background-color: #999; 
    193197} 
    194198 
  • trunk/wp-admin/css/colors-fresh.css

    r1218 r1266  
    187187        color: #246; 
    188188        border-color: #80b5d0; 
     189} 
     190 
     191.button[disabled], .button:disabled { 
     192        background-color: #999; 
    189193} 
    190194 
  • trunk/wp-admin/includes/media.php

    r1260 r1266  
    633633                $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 
    634634                $type = array_shift($keys); 
    635                 $type = "<input type='hidden' id='type-of-$attachment_id' value='$type' />"; 
     635                $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />"; 
    636636        } 
    637637 
     
    675675        $delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id); 
    676676        if ( $send ) 
    677                 $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . __('Insert into Post') . "' />"; 
     677                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />"; 
    678678        if ( $delete ) 
    679679                $delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>"; 
     
    708708                        $item .= $field[$field['input']]; 
    709709                elseif ( $field['input'] == 'textarea' ) { 
    710                         $item .= "<textarea type='text' id='$name' name='$name'>" . wp_specialchars($field['value'], 1) . "</textarea>"; 
     710                        $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . "</textarea>"; 
    711711                } else { 
    712                         $item .= "<input type='text' id='$name' name='$name' value='" . wp_specialchars($field['value'], 1) . "' />"; 
     712                        $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "' />"; 
    713713                } 
    714714                if ( !empty($field['helps']) ) 
     
    738738 
    739739        foreach ( $hidden_fields as $name => $value ) 
    740                 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . wp_specialchars($value, 1) . "' />\n"; 
     740                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 
    741741 
    742742        return $item; 
     
    766766 
    767767?> 
    768 <input type='hidden' name='post_id' value='<?php echo $post_id; ?>' /> 
     768<input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' /> 
    769769<div id="media-upload-notice"> 
    770770<?php if (isset($errors['upload_notice']) ) { ?> 
     
    815815 
    816816<div id="flash-upload-ui"> 
    817         <p><input id="flash-browse-button" type="button" value="<?php _e('Choose files to upload'); ?>" class="button" /></p> 
     817        <p><input id="flash-browse-button" type="button" value="<?php echo attribute_escape( __( 'Choose files to upload' ) ); ?>" class="button" /></p> 
    818818        <p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> 
    819819</div> 
     
    825825        <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a> 
    826826        </p> 
    827         <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
     827        <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
    828828        <br class="clear" /> 
    829829        <?php if ( is_lighttpd_before_150() ): ?> 
     
    845845 
    846846<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form"> 
    847 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
     847<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
    848848<?php wp_nonce_field('media-form'); ?> 
    849849<h3><?php _e('From Computer'); ?></h3> 
     
    865865<?php echo get_media_items( $id, $errors ); ?> 
    866866</div> 
    867 <input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" /> 
     867<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 
    868868 
    869869<?php elseif ( is_callable($callback) ) : ?> 
     
    879879</div> 
    880880</div> 
    881 <input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" /> 
     881<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 
    882882<?php 
    883883        endif; 
     
    912912<?php echo get_media_items($post_id, $errors); ?> 
    913913</div> 
    914 <input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" /> 
    915 <input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php _e('Insert gallery into post'); ?>" /> 
    916 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
    917 <input type="hidden" name="type" value="<?php echo $GLOBALS['type']; ?>" /> 
    918 <input type="hidden" name="tab" value="<?php echo $GLOBALS['tab']; ?>" /> 
     914<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 
     915<input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" /> 
     916<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
     917<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" /> 
     918<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" /> 
    919919</form> 
    920920<?php 
     
    943943 
    944944<form id="filter" action="" method="get"> 
    945 <input type="hidden" name="type" value="<?php echo $type; ?>" /> 
    946 <input type="hidden" name="tab" value="<?php echo $tab; ?>" /> 
    947 <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" /> 
    948 <input type="hidden" name="post_mime_type" value="<?php echo wp_specialchars($_GET['post_mime_type'], true); ?>" /> 
     945<input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" /> 
     946<input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" /> 
     947<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> 
     948<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" /> 
    949949 
    950950<div id="search-filter"> 
    951951        <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" /> 
    952         <input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" /> 
     952        <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" /> 
    953953</div> 
    954954 
     
    10241024                $default = ''; 
    10251025 
    1026         echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>"; 
    1027         echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear"
     1026        echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>"; 
     1027        echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" )
    10281028        echo "</option>\n"; 
    10291029} 
     
    10321032<?php } ?> 
    10331033 
    1034 <input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button-secondary" /> 
     1034<input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter &#187;' ) ); ?>" class="button-secondary" /> 
    10351035 
    10361036</div> 
     
    10601060<?php echo get_media_items(null, $errors); ?> 
    10611061</div> 
    1062 <input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" /> 
    1063 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
     1062<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" /> 
     1063<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
    10641064</form> 
    10651065<?php 
  • trunk/wp-config-sample.php

    r1218 r1266  
    1212 
    1313// Change SECRET_KEY to a unique phrase.  You won't have to remember it later, 
    14 // so make it long and complicated.  You can visit https://www.grc.com/passwords.htm 
    15 // to get a phrase generated for you, or just make something up. 
     14// so make it long and complicated.  You can visit http://api.wordpress.org/secret-key/1.0/ 
     15// to get a secret key generated for you, or just make something up. 
    1616define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase. 
    1717define('SECRET_SALT', 'put your unique phrase here'); // Change this to a unique phrase. 
  • trunk/wp-includes/formatting.php

    r1260 r1266  
    2727                $curl = $textarr[$i]; 
    2828 
    29                 if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag or shortcode 
     29                if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag 
    3030                        // static strings 
    3131                        $curl = str_replace($static_characters, $static_replacements, $curl); 
     
    7575        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
    7676        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
    77         $pee = preg_replace('/<p>(\s*?' . get_shortcode_regex(true) . '\s*)<\/p>/s', '$1', $pee); // don't auto-p wrap post-formatting shortcodes 
    7877        $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 
    7978        $pee = preg_replace( '|<p>|', "$1<p>", $pee ); 
     
    9493                $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee ); 
    9594        $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 
     95        $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone 
    9696 
    9797        return $pee; 
     
    842842                $text = apply_filters('the_content', $text); 
    843843                $text = str_replace(']]>', ']]&gt;', $text); 
    844                 $text = preg_replace('|//\s*<!\[CDATA\[|', '<![CDATA[', $text); 
    845844                $text = strip_tags($text); 
    846845                $excerpt_length = 55; 
  • trunk/wp-includes/js/autosave.js

    r1260 r1266  
    5757                var tempID = jQuery('#post_ID').val(); 
    5858                var postID = parseInt( res.responses[0].id ); 
    59                 autosave_update_post_ID( postID ); 
     59                autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here 
    6060                if ( tempID < 0 && postID > 0) // update media buttons 
    6161                        jQuery('#media-buttons a').each(function(){ 
    6262                                this.href = this.href.replace(tempID, postID); 
    6363                        }); 
    64         } 
    65         autosave_enable_buttons(); // re-enable disabled form buttons 
     64        } else { 
     65                autosave_enable_buttons(); // re-enable disabled form buttons 
     66        } 
    6667} 
    6768 
     
    7980                }, function(html) { 
    8081                        jQuery('#_wpnonce').val(html); 
     82                        autosave_enable_buttons(); // re-enable disabled form buttons 
    8183                }); 
    8284                jQuery('#hiddenaction').val('editpost'); 
     
    128130function autosave_disable_buttons() { 
    129131        jQuery("#submitpost :button:enabled, #submitpost :submit:enabled").attr('disabled', 'disabled'); 
    130         setTimeout(autosave_enable_buttons, 1000); // Re-enable 1 sec later.  Just gives autosave a head start to avoid collisions. 
     132        setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions. 
    131133} 
    132134 
  • trunk/wp-includes/media.php

    r1260 r1266  
    288288        if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) ) 
    289289                return false; 
    290  
     290                 
    291291        $data = $imagedata['sizes'][$size]; 
    292292        // include the full filesystem path of the intermediate file 
     
    302302// returns an array (url, width, height), or false if no image is available 
    303303function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { 
    304  
     304         
    305305        // get a thumbnail or intermediate image if there is one 
    306306        if ( $image = image_downsize($attachment_id, $size) ) 
     
    329329                $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />'; 
    330330        } 
    331  
     331         
    332332        return $html; 
    333333} 
    334334 
    335 add_shortcode('gallery', 'gallery_shortcode', true); 
     335add_shortcode('gallery', 'gallery_shortcode'); 
    336336 
    337337function gallery_shortcode($attr) { 
     
    378378        $columns = intval($columns); 
    379379        $itemwidth = $columns > 0 ? floor(100/$columns) : 100; 
    380  
     380         
    381381        $output = apply_filters('gallery_style', " 
    382382                <style type='text/css'> 
  • trunk/wp-includes/pluggable.php

    r1260 r1266  
    481481        } 
    482482 
    483         list($username, $expiration, $hmac) = explode('|', $cookie); 
     483        $cookie_elements = explode('|', $cookie); 
     484        if ( count($cookie_elements) != 3 ) 
     485                return false; 
     486 
     487        list($username, $expiration, $hmac) = $cookie_elements; 
    484488 
    485489        $expired = $expiration; 
     
    489493                $expired += 3600; 
    490494 
     495        // Quick check to see if an honest cookie has expired 
    491496        if ( $expired < time() ) 
    492497                return false; 
    493498 
    494         $key = wp_hash($username . $expiration); 
    495         $hash = hash_hmac('md5', $username . $expiration, $key); 
     499        $key = wp_hash($username . '|' . $expiration); 
     500        $hash = hash_hmac('md5', $username . '|' . $expiration, $key); 
    496501 
    497502        if ( $hmac != $hash ) 
     
    521526        $user = get_userdata($user_id); 
    522527 
    523         $key = wp_hash($user->user_login . $expiration); 
    524         $hash = hash_hmac('md5', $user->user_login . $expiration, $key); 
     528        $key = wp_hash($user->user_login . '|' . $expiration); 
     529        $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key); 
    525530 
    526531        $cookie = $user->user_login . '|' . $expiration . '|' . $hash; 
  • trunk/wp-includes/script-loader.php

    r1260 r1266  
    4848                ) ); 
    4949 
    50                 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080422' ); 
     50                $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' ); 
    5151 
    5252                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); 
  • trunk/wp-includes/shortcodes.php

    r1260 r1266  
    4848$shortcode_tags = array(); 
    4949 
    50 function add_shortcode($tag, $func, $after_formatting = false) { 
     50function add_shortcode($tag, $func) { 
    5151        global $shortcode_tags; 
    5252 
    53         if ( is_callable($func) ) { 
    54                 $shortcode_tags[($after_formatting)? 11:9][$tag] = $func; 
    55         } 
     53        if ( is_callable($func) ) 
     54                $shortcode_tags[$tag] = $func; 
    5655} 
    5756 
     
    5958        global $shortcode_tags; 
    6059 
    61         unset($shortcode_tags[9][$tag], $shortcode_tags[11][$tag]); 
     60        unset($shortcode_tags[$tag]); 
    6261} 
    6362 
     
    6867} 
    6968 
    70 function do_shortcode_after_formatting($content) { 
    71     return do_shortcode($content, true); 
    72 
    73 function do_shortcode($content, $after_formatting = false) { 
    74     $pattern = get_shortcode_regex($after_formatting); 
    75     if (!$pattern) { 
    76         return $content; 
    77     } else { 
    78         $callback_func = 'do_shortcode_tag'; 
    79         if ($after_formatting) 
    80            $callback_func .= '_after_formatting'; 
    81  
    82         return preg_replace_callback('/' . $pattern . '/s', $callback_func, $content); 
    83     } 
    84 
    85 function get_shortcode_regex($after_formatting) { 
     69function do_shortcode($content) { 
    8670        global $shortcode_tags; 
    8771 
    88         if (empty($shortcode_tags[($after_formatting)? 11:9]) || !is_array($shortcode_tags[($after_formatting)? 11:9])) 
    89                 return false
     72        if (empty($shortcode_tags) || !is_array($shortcode_tags)) 
     73                return $content
    9074 
    91         $tagnames = array_keys($shortcode_tags[($after_formatting)? 11:9]); 
     75        $pattern = get_shortcode_regex(); 
     76        return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content); 
     77
     78 
     79function get_shortcode_regex() { 
     80        global $shortcode_tags; 
     81        $tagnames = array_keys($shortcode_tags); 
    9282        $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); 
    9383 
     
    9585} 
    9686 
    97 function do_shortcode_tag_after_formatting($m) { 
    98     return do_shortcode_tag($m, true); 
    99 
    100 function do_shortcode_tag($m, $after_formatting = false) { 
     87function do_shortcode_tag($m) { 
    10188        global $shortcode_tags; 
    10289 
     
    10693        if ( isset($m[4]) ) { 
    10794                // enclosing tag - extra parameter 
    108                 return call_user_func($shortcode_tags[($after_formatting)? 11:9][$tag], $attr, $m[4]); 
     95                return call_user_func($shortcode_tags[$tag], $attr, $m[4]); 
    10996        } else { 
    11097                // self-closing tag 
    111                 return call_user_func($shortcode_tags[($after_formatting)? 11:9][$tag], $attr); 
     98                return call_user_func($shortcode_tags[$tag], $attr); 
    11299        } 
    113100} 
     
    148135} 
    149136 
    150 add_filter( 'the_content', 'do_shortcode', 9 ); 
    151 add_filter( 'the_content', 'do_shortcode_after_formatting', 11 ); 
     137add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()  
    152138 
    153139?> 
  • trunk/wp-includes/version.php

    r1260 r1266  
    99 * @global string $wp_version 
    1010 */ 
    11 $wp_version = '2.5.1'; 
     11$wp_version = '2.5.1-beta'; 
    1212 
    1313/**