Skip to:
Content

bbPress.org

Changeset 4885


Ignore:
Timestamp:
05/06/2013 03:45:16 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Fix a few widget fields that were not saving correctly. Props alex-ye. Fixes #2319 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/widgets.php

    r4814 r4885  
    162162        $instance             = $old_instance;
    163163        $instance['title']    = strip_tags( $new_instance['title'] );
    164         $instance['register'] = esc_url( $new_instance['register'] );
    165         $instance['lostpass'] = esc_url( $new_instance['lostpass'] );
     164        $instance['register'] = esc_url_raw( $new_instance['register'] );
     165        $instance['lostpass'] = esc_url_raw( $new_instance['lostpass'] );
    166166
    167167        return $instance;
     
    601601        $instance                 = $old_instance;
    602602        $instance['title']        = strip_tags( $new_instance['title'] );
    603         $instance['parent_forum'] = $new_instance['parent_forum'];
     603        $instance['parent_forum'] = sanitize_text_field( $new_instance['parent_forum'] );
    604604
    605605        // Force to any
     
    835835     */
    836836    public function update( $new_instance = array(), $old_instance = array() ) {
    837         $instance              = $old_instance;
    838         $instance['title']     = strip_tags( $new_instance['title'] );
    839         $instance['order_by']  = strip_tags( $new_instance['order_by'] );
    840         $instance['show_date'] = (bool) $new_instance['show_date'];
    841         $instance['show_user'] = (bool) $new_instance['show_user'];
    842         $instance['max_shown'] = (int) $new_instance['max_shown'];
     837        $instance                 = $old_instance;
     838        $instance['title']        = strip_tags( $new_instance['title'] );
     839        $instance['order_by']     = strip_tags( $new_instance['order_by'] );
     840        $instance['parent_forum'] = sanitize_text_field( $new_instance['parent_forum'] );
     841        $instance['show_date']    = (bool) $new_instance['show_date'];
     842        $instance['show_user']    = (bool) $new_instance['show_user'];
     843        $instance['max_shown']    = (int) $new_instance['max_shown'];
    843844
    844845        // Force to any
    845         if ( !empty( $instance['parent_forum'] ) || !is_numeric( $instance['parent_forum'] ) ) {
     846        if ( !empty( $instance['parent_forum'] ) && !is_numeric( $instance['parent_forum'] ) ) {
    846847            $instance['parent_forum'] = 'any';
    847         } else {
    848             $instance['parent_forum'] = (int) $new_instance['parent_forum'];
    849848        }
    850849
     
    879878        </p>
    880879
    881         <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:',    'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $settings['show_date'] ); ?> /></label></p>
    882         <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show topic author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $settings['show_user'] ); ?> /></label></p>
     880        <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:',    'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( true, $settings['show_date'] ); ?> value="1" /></label></p>
     881        <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show topic author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( true, $settings['show_user'] ); ?> value="1" /></label></p>
    883882
    884883        <p>
     
    12251224        <p><label for="<?php echo $this->get_field_id( 'title'     ); ?>"><?php _e( 'Title:',                   'bbpress' ); ?> <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( $settings['title']     ); ?>" /></label></p>
    12261225        <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo esc_attr( $settings['max_shown'] ); ?>" /></label></p>
    1227         <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:',          'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $settings['show_date'] ); ?> /></label></p>
    1228         <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:',       'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $settings['show_user'] ); ?> /></label></p>
     1226        <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:',          'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( true, $settings['show_date'] ); ?> value="1" /></label></p>
     1227        <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:',       'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( true, $settings['show_user'] ); ?> value="1" /></label></p>
    12291228
    12301229        <?php
Note: See TracChangeset for help on using the changeset viewer.