Attempt to fix jQuery UI unselectable form fields in widgets, label can be either explicit or implicit, not both.

git-svn-id: http://svn.automattic.com/wordpress/trunk@11431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-05-22 16:13:05 +00:00
parent 7bada8f202
commit c8ad766bb7
5 changed files with 72 additions and 95 deletions

View File

@ -16,7 +16,7 @@ wpWidgets = {
c.sortable('enable').sortable('refresh'); c.sortable('enable').sortable('refresh');
} }
}); });
$('#widgets-left div.sidebar-name').click(function(){ $('#widgets-left div.sidebar-name').click(function(){
if ( $(this).siblings('.widget-holder').is(':visible') ) { if ( $(this).siblings('.widget-holder').is(':visible') ) {
$(this).parent().addClass('closed'); $(this).parent().addClass('closed');
@ -24,11 +24,11 @@ wpWidgets = {
$(this).parent().removeClass('closed'); $(this).parent().removeClass('closed');
} }
}); });
$('#widgets-right .widget, #wp_inactive_widgets .widget').each(function(){ $('#widgets-right .widget, #wp_inactive_widgets .widget').each(function(){
wpWidgets.appendTitle(this); wpWidgets.appendTitle(this);
}); });
this.addEvents(); this.addEvents();
$('.widget-error').parents('.widget').find('a.widget-action').click(); $('.widget-error').parents('.widget').find('a.widget-action').click();
@ -93,6 +93,12 @@ wpWidgets = {
} }
}).not(':visible').sortable('disable'); }).not(':visible').sortable('disable');
wpWidgets.resize(); wpWidgets.resize();
$('.widget-inside label').each(function(){
var f = $(this).attr('for');
if ( f && f == $('input', this).attr('id') )
$(this).removeAttr('for');
});
}, },
saveOrder : function(sb) { saveOrder : function(sb) {

View File

@ -1 +1 @@
var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.sortable("disable");a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("enable").sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item.find("form").serialize(),g,0,0);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click()}wpWidgets.saveOrder(g);wpWidgets.resize();wpWidgets.fixWebkit()},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable");wpWidgets.resize()},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}e+="&"+a.param(b);a.post(ajaxurl,e,function(g){var i,h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}h=a(d).parents(".widget");if(c){h.slideUp("normal",function(){a(this).remove();wpWidgets.resize()});if(!a(".widget_number",h).val()){i=a(".widget-id",h).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==i){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){h.css({width:"",marginLeft:""});wpWidgets.appendTitle(h)})}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){var c;if(this.id.indexOf("title")!=-1){c=a(this).val().replace(/<[^<>]+>/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;");a(".widget-title .in-widget-title",b).html(": "+c);return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery); var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.sortable("disable");a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("enable").sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item.find("form").serialize(),g,0,0);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click()}wpWidgets.saveOrder(g);wpWidgets.resize();wpWidgets.fixWebkit()},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable");wpWidgets.resize();a(".widget-inside label").each(function(){var c=a(this).attr("for");if(c&&c==a("input",this).attr("id")){a(this).removeAttr("for")}})},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}e+="&"+a.param(b);a.post(ajaxurl,e,function(g){var i,h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}h=a(d).parents(".widget");if(c){h.slideUp("normal",function(){a(this).remove();wpWidgets.resize()});if(!a(".widget_number",h).val()){i=a(".widget-id",h).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==i){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){h.css({width:"",marginLeft:""});wpWidgets.appendTitle(h)})}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){var c;if(this.id.indexOf("title")!=-1){c=a(this).val().replace(/<[^<>]+>/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;");a(".widget-title .in-widget-title",b).html(": "+c);return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery);

View File

@ -3279,3 +3279,7 @@ p.popular-tags a {
#post-body-content .tagsdiv .the-tags { #post-body-content .tagsdiv .the-tags {
margin: 0 5px; margin: 0 5px;
} }
label {
vertical-align: middle;
}

View File

@ -64,18 +64,17 @@ class WP_Widget_Pages extends WP_Widget {
$title = esc_attr( $instance['title'] ); $title = esc_attr( $instance['title'] );
$exclude = esc_attr( $instance['exclude'] ); $exclude = esc_attr( $instance['exclude'] );
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<p> <p>
<label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?> <label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>
<select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat"> <select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">
<option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option> <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
<option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option> <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
<option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
</select> </select>
</label>
</p> </p>
<p> <p>
<label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" /></label> <label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
<br /> <br />
<small><?php _e( 'Page IDs, separated by commas.' ); ?></small> <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
</p> </p>
@ -140,7 +139,7 @@ class WP_Widget_Links extends WP_Widget {
$link_cats = get_terms( 'link_category'); $link_cats = get_terms( 'link_category');
?> ?>
<p> <p>
<label for="<?php echo $this->get_field_id('category'); ?>"> <label for="<?php echo $this->get_field_id('category'); ?>" class="screen-reader-text"><?php _e('Select Link Category'); ?></label>
<select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>"> <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
<option value=""><?php _e('All Links'); ?></option> <option value=""><?php _e('All Links'); ?></option>
<?php <?php
@ -150,16 +149,16 @@ class WP_Widget_Links extends WP_Widget {
. '>' . $link_cat->name . "</option>\n"; . '>' . $link_cat->name . "</option>\n";
} }
?> ?>
</select></label></p> </select></p>
<p> <p>
<label for="<?php echo $this->get_field_id('images'); ?>"> <label for="<?php echo $this->get_field_id('images'); ?>"><?php _e('Show Link Image'); ?></label>
<input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" /> <?php _e('Show Link Image'); ?></label><br /> <input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" /><br />
<label for="<?php echo $this->get_field_id('name'); ?>"> <label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Show Link Name'); ?></label>
<input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" /> <?php _e('Show Link Name'); ?></label><br /> <input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" /><br />
<label for="<?php echo $this->get_field_id('description'); ?>"> <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Show Link Description'); ?></label>
<input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" /> <?php _e('Show Link Description'); ?></label><br /> <input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" /><br />
<label for="<?php echo $this->get_field_id('rating'); ?>"> <label for="<?php echo $this->get_field_id('rating'); ?>"><?php _e('Show Link Rating'); ?></label>
<input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" /> <?php _e('Show Link Rating'); ?></label> <input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" />
</p> </p>
<?php <?php
} }
@ -261,11 +260,11 @@ class WP_Widget_Archives extends WP_Widget {
$count = $instance['count'] ? 'checked="checked"' : ''; $count = $instance['count'] ? 'checked="checked"' : '';
$dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; $dropdown = $instance['dropdown'] ? 'checked="checked"' : '';
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p> <p>
<label for="<?php echo $this->get_field_id('count'); ?>"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <?php _e('Show post counts'); ?></label> <input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>
<br /> <br />
<label for="<?php echo $this->get_field_id('dropdown'); ?>"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <?php _e('Display as a drop down'); ?></label> <input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as a drop down'); ?></label>
</p> </p>
<?php <?php
} }
@ -316,7 +315,7 @@ class WP_Widget_Meta extends WP_Widget {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']); $title = strip_tags($instance['title']);
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<?php <?php
} }
} }
@ -356,10 +355,8 @@ class WP_Widget_Calendar extends WP_Widget {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']); $title = strip_tags($instance['title']);
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
</label></p>
<?php <?php
} }
} }
@ -404,16 +401,12 @@ class WP_Widget_Text extends WP_Widget {
$title = strip_tags($instance['title']); $title = strip_tags($instance['title']);
$text = format_to_edit($instance['text']); $text = format_to_edit($instance['text']);
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
</label></p>
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea> <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
<p><label for="<?php echo $this->get_field_id('filter'); ?>"> <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
<input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<?php _e('Automatically add paragraphs.') ?>
</label></p>
<?php <?php
} }
} }
@ -494,25 +487,17 @@ class WP_Widget_Categories extends WP_Widget {
$hierarchical = (bool) $instance['hierarchical']; $hierarchical = (bool) $instance['hierarchical'];
$dropdown = (bool) $instance['dropdown']; $dropdown = (bool) $instance['dropdown'];
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
<?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</label></p>
<p><label for="<?php echo $this->get_field_id('dropdown'); ?>"> <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Show as dropdown' ); ?></label><br />
<?php _e( 'Show as dropdown' ); ?>
</label><br />
<label for="<?php echo $this->get_field_id('count'); ?>">
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
<?php _e( 'Show post counts' ); ?> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
</label><br />
<label for="<?php echo $this->get_field_id('hierarchical'); ?>">
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
<?php _e( 'Show hierarchy' ); ?> <label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
</label></p>
<?php <?php
} }
@ -596,14 +581,12 @@ class WP_Widget_Recent_Posts extends WP_Widget {
if ( !$number = (int) $instance['number'] ) if ( !$number = (int) $instance['number'] )
$number = 5; $number = 5;
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"> <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:'); ?></label>
<?php _e('Number of posts to show:'); ?> <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></label> <small><?php _e('(at most 15)'); ?></small></p>
<br /><small><?php _e('(at most 15)'); ?></small></p>
<?php <?php
} }
} }
@ -682,14 +665,12 @@ class WP_Widget_Recent_Comments extends WP_Widget {
$title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
$number = isset($instance['number']) ? absint($instance['number']) : 5; $number = isset($instance['number']) ? absint($instance['number']) : 5;
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"> <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of comments to show:'); ?></label>
<?php _e('Number of comments to show:'); ?> <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></label> <small><?php _e('(at most 15)'); ?></small></p>
<br /><small><?php _e('(at most 15)'); ?></small></p>
<?php <?php
} }
} }
@ -891,40 +872,28 @@ function wp_widget_rss_form( $args, $inputs = null ) {
if ( $inputs['url'] ) : if ( $inputs['url'] ) :
?> ?>
<p><label for="rss-url-<?php echo $number; ?>"> <p><label for="rss-url-<?php echo $number; ?>"><?php _e('Enter the RSS feed URL here:'); ?></label>
<?php _e('Enter the RSS feed URL here:'); ?> <input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" /></p>
<input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" />
</label></p>
<?php endif; if ( $inputs['title'] ) : ?> <?php endif; if ( $inputs['title'] ) : ?>
<p><label for="rss-title-<?php echo $number; ?>"> <p><label for="rss-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):'); ?></label>
<?php _e('Give the feed a title (optional):'); ?> <input class="widefat" id="rss-title-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" /></p>
<input class="widefat" id="rss-title-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
</label></p>
<?php endif; if ( $inputs['items'] ) : ?> <?php endif; if ( $inputs['items'] ) : ?>
<p><label for="rss-items-<?php echo $number; ?>"> <p><label for="rss-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?'); ?></label>
<?php _e('How many items would you like to display?'); ?>
<select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]"> <select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
<?php <?php
for ( $i = 1; $i <= 20; ++$i ) for ( $i = 1; $i <= 20; ++$i )
echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>"; echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>";
?> ?>
</select> </select></p>
</label></p>
<?php endif; if ( $inputs['show_summary'] ) : ?> <?php endif; if ( $inputs['show_summary'] ) : ?>
<p><label for="rss-show-summary-<?php echo $number; ?>"> <p><input id="rss-show-summary-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_summary]" type="checkbox" value="1" <?php if ( $show_summary ) echo 'checked="checked"'; ?>/>
<input id="rss-show-summary-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_summary]" type="checkbox" value="1" <?php if ( $show_summary ) echo 'checked="checked"'; ?>/> <label for="rss-show-summary-<?php echo $number; ?>"><?php _e('Display item content?'); ?></label></p>
<?php _e('Display item content?'); ?>
</label></p>
<?php endif; if ( $inputs['show_author'] ) : ?> <?php endif; if ( $inputs['show_author'] ) : ?>
<p><label for="rss-show-author-<?php echo $number; ?>"> <p><input id="rss-show-author-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_author]" type="checkbox" value="1" <?php if ( $show_author ) echo 'checked="checked"'; ?>/>
<input id="rss-show-author-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_author]" type="checkbox" value="1" <?php if ( $show_author ) echo 'checked="checked"'; ?>/> <label for="rss-show-author-<?php echo $number; ?>"><?php _e('Display item author if available?'); ?></label></p>
<?php _e('Display item author if available?'); ?>
</label></p>
<?php endif; if ( $inputs['show_date'] ) : ?> <?php endif; if ( $inputs['show_date'] ) : ?>
<p><label for="rss-show-date-<?php echo $number; ?>"> <p><input id="rss-show-date-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_date]" type="checkbox" value="1" <?php if ( $show_date ) echo 'checked="checked"'; ?>/>
<input id="rss-show-date-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_date]" type="checkbox" value="1" <?php if ( $show_date ) echo 'checked="checked"'; ?>/> <label for="rss-show-date-<?php echo $number; ?>"><?php _e('Display item date?'); ?></label></p>
<?php _e('Display item date?'); ?>
</label></p>
<?php <?php
endif; endif;
foreach ( array_keys($default_inputs) as $input ) : foreach ( array_keys($default_inputs) as $input ) :
@ -1011,10 +980,8 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
function form( $instance ) { function form( $instance ) {
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
<?php _e('Title:') ?> <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</label></p>
<?php <?php
} }
} }

View File

@ -326,7 +326,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' ); $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' );
$scripts->add_data( 'media-upload', 'group', 1 ); $scripts->add_data( 'media-upload', 'group', 1 );
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090515' ); $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090522' );
$scripts->add_data( 'admin-widgets', 'group', 1 ); $scripts->add_data( 'admin-widgets', 'group', 1 );
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' ); $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );