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