Widgets: Remove unnecessary `sanitize_text_field()` calls in core widget `::form()` methods.
This sanitisation only needs to be run in `::update()` to correctly clean up the input. Props welcher, greenshady. Fixes #42461. Built from https://develop.svn.wordpress.org/trunk@44589 git-svn-id: http://core.svn.wordpress.org/trunk@44420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
11e9c98d5b
commit
2f288c306c
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.1-beta1-44588';
|
||||
$wp_version = '5.1-beta1-44589';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -179,9 +179,8 @@ class WP_Widget_Archives extends WP_Widget {
|
|||
'dropdown' => '',
|
||||
)
|
||||
);
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
?>
|
||||
<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><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( $instance['title'] ); ?>" /></p>
|
||||
<p>
|
||||
<input class="checkbox" type="checkbox"<?php checked( $instance['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 dropdown' ); ?></label>
|
||||
<br/>
|
||||
|
|
|
@ -94,10 +94,9 @@ class WP_Widget_Calendar extends WP_Widget {
|
|||
*/
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
?>
|
||||
<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>
|
||||
<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( $instance['title'] ); ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,13 +160,12 @@ class WP_Widget_Categories extends WP_Widget {
|
|||
public function form( $instance ) {
|
||||
//Defaults
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
$count = isset( $instance['count'] ) ? (bool) $instance['count'] : false;
|
||||
$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
|
||||
$dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
|
||||
?>
|
||||
<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>
|
||||
<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( $instance['title'] ); ?>" /></p>
|
||||
|
||||
<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 ); ?> />
|
||||
<label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
|
||||
|
|
|
@ -113,9 +113,8 @@ class WP_Widget_Meta extends WP_Widget {
|
|||
*/
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
?>
|
||||
<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><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( $instance['title'] ); ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue