Make WordPress Core


Ignore:
Timestamp:
10/13/2008 06:32:16 PM (18 years ago)
Author:
ryan
Message:

Date and time presets from Viper007Bond. see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options.php

    r9066 r9131  
    4242
    4343case 'update':
    44         $any_changed = 0;
    45 
    4644        $option_page = $_POST[ 'option_page' ];
    4745        check_admin_referer( $option_page . '-options' );
     
    5048                wp_die( __( 'Error! Options page not found.' ) );
    5149
    52         if ( $option_page == 'options' ) {
     50        if ( 'options' == $option_page ) {
    5351                $options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
    5452        } else {
     
    5654        }
    5755
    58         if ($options) {
    59                 foreach ($options as $option) {
     56        // Handle custom date/time formats
     57        if ( 'general' == $option_page ) {
     58                if ( !empty($_POST['date_format']) && !empty($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
     59                        $_POST['date_format'] = $_POST['date_format_custom'];
     60                if ( !empty($_POST['time_format']) && !empty($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
     61                        $_POST['time_format'] = $_POST['time_format_custom'];
     62        }
     63
     64        if ( $options ) {
     65                foreach ( $options as $option ) {
    6066                        $option = trim($option);
    6167                        $value = $_POST[$option];
    62                         if(!is_array($value))   $value = trim($value);
     68                        if ( !is_array($value) ) $value = trim($value);
    6369                        $value = stripslashes_deep($value);
    6470                        update_option($option, $value);
     
    6672        }
    6773
    68         $goback = add_query_arg('updated', 'true', wp_get_referer());
    69         wp_redirect($goback);
    70     break;
     74        $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
     75        wp_redirect( $goback );
     76        break;
    7177
    7278default:
Note: See TracChangeset for help on using the changeset viewer.