Preserve tag escaping. Props koopersmith, Nils Jueneman. For 3.0

git-svn-id: http://svn.automattic.com/wordpress/branches/3.0@17401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-02-05 18:34:01 +00:00
parent 6f31fa6e29
commit be60cf359a
4 changed files with 26 additions and 15 deletions

View File

@ -689,6 +689,8 @@ function get_post_meta_by_id( $mid ) {
$mid = (int) $mid;
$meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
if ( empty($meta) )
return false;
if ( is_serialized_string( $meta->meta_value ) )
$meta->meta_value = maybe_unserialize( $meta->meta_value );
return $meta;

View File

@ -36,30 +36,39 @@ tagBox = {
},
quickClicks : function(el) {
var thetags = $('.the-tags', el), tagchecklist = $('.tagchecklist', el), current_tags;
var thetags = $('.the-tags', el),
tagchecklist = $('.tagchecklist', el),
id = $(el).attr('id'),
current_tags, disabled;
if ( !thetags.length )
return;
var disabled = thetags.attr('disabled');
disabled = thetags.attr('disabled');
current_tags = thetags.val().split(',');
tagchecklist.empty();
$.each( current_tags, function( key, val ) {
var txt, button_id, id = $(el).attr('id');
var span, xbutton;
val = $.trim(val);
if ( !val.match(/^\s+$/) && '' != val ) {
button_id = id + '-check-num-' + key;
if ( disabled )
txt = '<span>' + val + '</span> ';
else
txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
tagchecklist.append(txt);
if ( ! disabled )
$( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
val = $.trim( val );
if ( ! val )
return;
// Create a new span, and ensure the text is properly escaped.
span = $('<span />').text( val );
// If tags editing isn't disabled, create the X button.
if ( ! disabled ) {
xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton">X</a>' );
xbutton.click( function(){ tagBox.parseTags(this); });
span.prepend('&nbsp;').prepend( xbutton );
}
// Append the span to the tag list.
tagchecklist.append( span );
});
},

File diff suppressed because one or more lines are too long

View File

@ -275,7 +275,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
$scripts->add_data( 'postbox', 'group', 1 );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20100526' );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110203' );
$scripts->add_data( 'post', 'group', 1 );
$scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'),