Changeset 1266
- Timestamp:
- 04/25/08 09:03:55 (3 months ago)
- Files:
-
- trunk/wp-admin/css/colors-classic.css (modified) (1 diff)
- trunk/wp-admin/css/colors-fresh.css (modified) (1 diff)
- trunk/wp-admin/includes/media.php (modified) (15 diffs)
- trunk/wp-config-sample.php (modified) (1 diff)
- trunk/wp-includes/formatting.php (modified) (4 diffs)
- trunk/wp-includes/js/autosave.js (modified) (3 diffs)
- trunk/wp-includes/media.php (modified) (4 diffs)
- trunk/wp-includes/pluggable.php (modified) (3 diffs)
- trunk/wp-includes/script-loader.php (modified) (1 diff)
- trunk/wp-includes/shortcodes.php (modified) (6 diffs)
- trunk/wp-includes/version.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/css/colors-classic.css
r1218 r1266 191 191 color: #07273e; 192 192 border-color: #a3a3a3; 193 } 194 195 .button[disabled], .button:disabled { 196 background-color: #999; 193 197 } 194 198 trunk/wp-admin/css/colors-fresh.css
r1218 r1266 187 187 color: #246; 188 188 border-color: #80b5d0; 189 } 190 191 .button[disabled], .button:disabled { 192 background-color: #999; 189 193 } 190 194 trunk/wp-admin/includes/media.php
r1260 r1266 633 633 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 634 634 $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 ) . "' />"; 636 636 } 637 637 … … 675 675 $delete_href = wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); 676 676 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' ) ) . "' />"; 678 678 if ( $delete ) 679 679 $delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>"; … … 708 708 $item .= $field[$field['input']]; 709 709 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>"; 711 711 } 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'] ) . "' />"; 713 713 } 714 714 if ( !empty($field['helps']) ) … … 738 738 739 739 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"; 741 741 742 742 return $item; … … 766 766 767 767 ?> 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; ?>' /> 769 769 <div id="media-upload-notice"> 770 770 <?php if (isset($errors['upload_notice']) ) { ?> … … 815 815 816 816 <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> 818 818 <p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p> 819 819 </div> … … 825 825 <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> 826 826 </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; ?>" /> 828 828 <br class="clear" /> 829 829 <?php if ( is_lighttpd_before_150() ): ?> … … 845 845 846 846 <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; ?>" /> 848 848 <?php wp_nonce_field('media-form'); ?> 849 849 <h3><?php _e('From Computer'); ?></h3> … … 865 865 <?php echo get_media_items( $id, $errors ); ?> 866 866 </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' ) ); ?>" /> 868 868 869 869 <?php elseif ( is_callable($callback) ) : ?> … … 879 879 </div> 880 880 </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' ) ); ?>" /> 882 882 <?php 883 883 endif; … … 912 912 <?php echo get_media_items($post_id, $errors); ?> 913 913 </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'] ); ?>" /> 919 919 </form> 920 920 <?php … … 943 943 944 944 <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'] ); ?>" /> 949 949 950 950 <div id="search-filter"> 951 951 <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" /> 953 953 </div> 954 954 … … 1024 1024 $default = ''; 1025 1025 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" ); 1028 1028 echo "</option>\n"; 1029 1029 } … … 1032 1032 <?php } ?> 1033 1033 1034 <input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" class="button-secondary" />1034 <input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter »' ) ); ?>" class="button-secondary" /> 1035 1035 1036 1036 </div> … … 1060 1060 <?php echo get_media_items(null, $errors); ?> 1061 1061 </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; ?>" /> 1064 1064 </form> 1065 1065 <?php trunk/wp-config-sample.php
r1218 r1266 12 12 13 13 // 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 http s://www.grc.com/passwords.htm15 // to get a phrasegenerated 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. 16 16 define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase. 17 17 define('SECRET_SALT', 'put your unique phrase here'); // Change this to a unique phrase. trunk/wp-includes/formatting.php
r1260 r1266 27 27 $curl = $textarr[$i]; 28 28 29 if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag or shortcode29 if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag 30 30 // static strings 31 31 $curl = str_replace($static_characters, $static_replacements, $curl); … … 75 75 $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 76 76 $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 shortcodes78 77 $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 79 78 $pee = preg_replace( '|<p>|', "$1<p>", $pee ); … … 94 93 $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee ); 95 94 $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 96 96 97 97 return $pee; … … 842 842 $text = apply_filters('the_content', $text); 843 843 $text = str_replace(']]>', ']]>', $text); 844 $text = preg_replace('|//\s*<!\[CDATA\[|', '<![CDATA[', $text);845 844 $text = strip_tags($text); 846 845 $excerpt_length = 55; trunk/wp-includes/js/autosave.js
r1260 r1266 57 57 var tempID = jQuery('#post_ID').val(); 58 58 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 60 60 if ( tempID < 0 && postID > 0) // update media buttons 61 61 jQuery('#media-buttons a').each(function(){ 62 62 this.href = this.href.replace(tempID, postID); 63 63 }); 64 } 65 autosave_enable_buttons(); // re-enable disabled form buttons 64 } else { 65 autosave_enable_buttons(); // re-enable disabled form buttons 66 } 66 67 } 67 68 … … 79 80 }, function(html) { 80 81 jQuery('#_wpnonce').val(html); 82 autosave_enable_buttons(); // re-enable disabled form buttons 81 83 }); 82 84 jQuery('#hiddenaction').val('editpost'); … … 128 130 function autosave_disable_buttons() { 129 131 jQuery("#submitpost :button:enabled, #submitpost :submit:enabled").attr('disabled', 'disabled'); 130 setTimeout(autosave_enable_buttons, 1000); // Re-enable 1sec 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. 131 133 } 132 134 trunk/wp-includes/media.php
r1260 r1266 288 288 if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) ) 289 289 return false; 290 290 291 291 $data = $imagedata['sizes'][$size]; 292 292 // include the full filesystem path of the intermediate file … … 302 302 // returns an array (url, width, height), or false if no image is available 303 303 function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { 304 304 305 305 // get a thumbnail or intermediate image if there is one 306 306 if ( $image = image_downsize($attachment_id, $size) ) … … 329 329 $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />'; 330 330 } 331 331 332 332 return $html; 333 333 } 334 334 335 add_shortcode('gallery', 'gallery_shortcode' , true);335 add_shortcode('gallery', 'gallery_shortcode'); 336 336 337 337 function gallery_shortcode($attr) { … … 378 378 $columns = intval($columns); 379 379 $itemwidth = $columns > 0 ? floor(100/$columns) : 100; 380 380 381 381 $output = apply_filters('gallery_style', " 382 382 <style type='text/css'> trunk/wp-includes/pluggable.php
r1260 r1266 481 481 } 482 482 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; 484 488 485 489 $expired = $expiration; … … 489 493 $expired += 3600; 490 494 495 // Quick check to see if an honest cookie has expired 491 496 if ( $expired < time() ) 492 497 return false; 493 498 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); 496 501 497 502 if ( $hmac != $hash ) … … 521 526 $user = get_userdata($user_id); 522 527 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); 525 530 526 531 $cookie = $user->user_login . '|' . $expiration . '|' . $hash; trunk/wp-includes/script-loader.php
r1260 r1266 48 48 ) ); 49 49 50 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '2008042 2' );50 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' ); 51 51 52 52 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); trunk/wp-includes/shortcodes.php
r1260 r1266 48 48 $shortcode_tags = array(); 49 49 50 function add_shortcode($tag, $func , $after_formatting = false) {50 function add_shortcode($tag, $func) { 51 51 global $shortcode_tags; 52 52 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; 56 55 } 57 56 … … 59 58 global $shortcode_tags; 60 59 61 unset($shortcode_tags[ 9][$tag], $shortcode_tags[11][$tag]);60 unset($shortcode_tags[$tag]); 62 61 } 63 62 … … 68 67 } 69 68 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) { 69 function do_shortcode($content) { 86 70 global $shortcode_tags; 87 71 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; 90 74 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 79 function get_shortcode_regex() { 80 global $shortcode_tags; 81 $tagnames = array_keys($shortcode_tags); 92 82 $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); 93 83 … … 95 85 } 96 86 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) { 87 function do_shortcode_tag($m) { 101 88 global $shortcode_tags; 102 89 … … 106 93 if ( isset($m[4]) ) { 107 94 // 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]); 109 96 } else { 110 97 // 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); 112 99 } 113 100 } … … 148 135 } 149 136 150 add_filter( 'the_content', 'do_shortcode', 9 ); 151 add_filter( 'the_content', 'do_shortcode_after_formatting', 11 ); 137 add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop() 152 138 153 139 ?> trunk/wp-includes/version.php
r1260 r1266 9 9 * @global string $wp_version 10 10 */ 11 $wp_version = '2.5.1 ';11 $wp_version = '2.5.1-beta'; 12 12 13 13 /**
