- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.8/wp-includes/formatting.php
r12073 r11635 601 601 function sanitize_file_name( $filename ) { 602 602 $filename_raw = $filename; 603 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}" , chr(0));603 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}"); 604 604 $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw); 605 605 $filename = str_replace($special_chars, '', $filename); … … 1453 1453 * 1454 1454 * Requires and returns a date in the Y-m-d H:i:s format. Simply subtracts the 1455 * value of the 'gmt_offset' option. Return format can be overridden using the 1456 * $format parameter 1455 * value of the 'gmt_offset' option. 1457 1456 * 1458 1457 * @since 1.2.0 … … 1460 1459 * @uses get_option() to retrieve the the value of 'gmt_offset'. 1461 1460 * @param string $string The date to be converted. 1462 * @param string $format The format string for the returned date (default is Y-m-d H:i:s)1463 1461 * @return string GMT version of the date provided. 1464 1462 */ 1465 function get_gmt_from_date($string , $format = 'Y-m-d H:i:s') {1463 function get_gmt_from_date($string) { 1466 1464 preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 1467 1465 $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 1468 $string_gmt = gmdate( $format, $string_time - get_option('gmt_offset') * 3600);1466 $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600); 1469 1467 return $string_gmt; 1470 1468 } … … 1474 1472 * 1475 1473 * Requires and returns in the Y-m-d H:i:s format. Simply adds the value of 1476 * gmt_offset. Return format can be overridden using the $format parameter1474 * gmt_offset. 1477 1475 * 1478 1476 * @since 1.2.0 1479 1477 * 1480 1478 * @param string $string The date to be converted. 1481 * @param string $format The format string for the returned date (default is Y-m-d H:i:s)1482 1479 * @return string Formatted date relative to the GMT offset. 1483 1480 */ 1484 function get_date_from_gmt($string , $format = 'Y-m-d H:i:s') {1481 function get_date_from_gmt($string) { 1485 1482 preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 1486 1483 $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 1487 $string_localtime = gmdate( $format, $string_time + get_option('gmt_offset')*3600);1484 $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600); 1488 1485 return $string_localtime; 1489 1486 }
Note: See TracChangeset
for help on using the changeset viewer.