Ticket #10559: 10559.001.diff
File 10559.001.diff, 2.1 KB (added by , 15 years ago) |
---|
-
trunk/wp-includes/functions.php
2025 2025 * @param string $time Optional. Time formatted in 'yyyy/mm'. 2026 2026 * @return array See above for description. 2027 2027 */ 2028 function wp_upload_dir( $time = null ) {2028 function wp_upload_dir( $time = null, $subdir = '' ) { 2029 2029 $siteurl = get_option( 'siteurl' ); 2030 2030 $upload_path = get_option( 'upload_path' ); 2031 2031 $upload_path = trim($upload_path); … … 2052 2052 $bdir = $dir; 2053 2053 $burl = $url; 2054 2054 2055 $subdir = ''; 2055 if ( empty($subdir) || strpos($subdir, '..') !== false ) { 2056 $subdir = ''; 2057 } else { 2058 $subdir = '/' . trim( $subdir, '/' ); 2059 } 2056 2060 if ( get_option( 'uploads_use_yearmonth_folders' ) ) { 2057 2061 // Generate the yearly and monthly dirs 2058 2062 if ( !$time ) 2059 2063 $time = current_time( 'mysql' ); 2060 2064 $y = substr( $time, 0, 4 ); 2061 2065 $m = substr( $time, 5, 2 ); 2062 $subdir = "/$y/$m";2066 $subdir .= "/$y/$m"; 2063 2067 } 2064 2068 2065 2069 $dir .= $subdir; … … 3284 3288 $display = $zone['t_continent']; 3285 3289 } else { 3286 3290 // It's inside a continent group 3287 3291 3288 3292 // Continent optgroup 3289 3293 if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) { 3290 3294 $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent']; 3291 3295 $structure[] = '<optgroup label="'. esc_attr( $label ) .'">'; 3292 3296 } 3293 3297 3294 3298 // Add the city to the value 3295 3299 $value[] = $zone['city']; 3296 3300 if ( 'Etc' === $zone['continent'] ) { … … 3318 3322 $selected = 'selected="selected" '; 3319 3323 } 3320 3324 $structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>"; 3321 3325 3322 3326 // Close continent optgroup 3323 3327 if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) { 3324 3328 $structure[] = '</optgroup>'; … … 3340 3344 3341 3345 /** 3342 3346 * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS. 3343 * 3347 * 3344 3348 * @since 2.9.0 3345 3349 * 3346 3350 * @return void