Ticket #36259: 36259.patch
| File 36259.patch, 1.8 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/options.php
168 168 169 169 if ( 'general' == $option_page ) { 170 170 // Handle custom date/time formats. 171 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) 171 $using_locales_default_date_format = false; 172 $using_locales_default_time_format = false; 173 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) { 172 174 $_POST['date_format'] = $_POST['date_format_custom']; 173 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) 175 } elseif ( $_POST['date_format'] === __( 'F j, Y' ) ) { 176 $using_locales_default_date_format = true; 177 } 178 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) { 174 179 $_POST['time_format'] = $_POST['time_format_custom']; 180 } elseif ( $_POST['time_format'] === __( 'g:i a' ) ) { 181 $using_locales_default_time_format = true; 182 } 175 183 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. 176 184 if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { 177 185 $_POST['gmt_offset'] = $_POST['timezone_string']; … … 222 230 } else { 223 231 unload_textdomain( 'default' ); 224 232 } 233 234 // Set date/time formats to defaults if they were used before the update. 235 if ( $using_locales_default_date_format ) { 236 update_option( 'date_format', __( 'F j, Y' ) ); 237 } 238 if ( $using_locales_default_time_format ) { 239 update_option( 'time_format', __( 'g:i a' ) ); 240 } 225 241 } 226 242 227 243 /**