Ticket #4131: 4131.diff
File 4131.diff, 2.4 KB (added by , 17 years ago) |
---|
-
wp-admin/includes/theme.php
42 42 $description = $description[1]; 43 43 44 44 if ( !empty( $name ) ) { 45 $page_templates[trim( $name )] = basename( $template );45 $page_templates[trim( $name )] = theme_basename( $template ); 46 46 } 47 47 } 48 48 } -
wp-includes/theme.php
239 238 $stylesheet_files[] = "$theme_loc/$stylesheet/$file"; 240 239 } 241 240 } 241 @ $stylesheet_dir->close(); 242 242 243 243 $template_files = array(); 244 244 $template_dir = @ dir("$theme_root/$template"); 245 245 if ( $template_dir ) { 246 246 while(($file = $template_dir->read()) !== false) { 247 if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) 247 if( preg_match('|^\.+$|', $file) ) 248 continue; 249 if ( preg_match('|\.php$|', $file) ) { 248 250 $template_files[] = "$theme_loc/$template/$file"; 251 } elseif ( is_dir("$theme_root/$template/$file") ){ 252 $template_subdir = @ dir("$theme_root/$template/$file"); 253 while(($subfile = $template_subdir->read()) !== false) { 254 if( preg_match('|^\.+$|', $file) ) 255 continue; 256 if ( preg_match('|\.php$|', $subfile) ) 257 $template_files[] = "$theme_loc/$template/$file/$subfile"; 258 } 259 @ $template_subdir->close(); 260 } 249 261 } 250 262 } 251 263 @ $template_dir->close(); 264 252 265 $template_dir = dirname($template_files[0]); 253 266 $stylesheet_dir = dirname($stylesheet_files[0]); 254 267 … … 563 575 add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init')); 564 576 } 565 577 578 /** 579 * theme_basename() - Gets the basename of a theme. 580 * 581 * This method extracts the filename of a theme file from a path 582 * 583 * @package WordPress 584 * @subpackage Plugin 585 * @since 2.4 586 * 587 * @access private 588 * 589 * @param string $file The filename of a theme file 590 * @return string The filename relitive to the themes folder 591 */ 592 function theme_basename($file) { 593 $file = str_replace('\\','/',$file); // sanitize for Win32 installs 594 $file = preg_replace('|/+|','/', $file); // remove any duplicate slash 595 $file = preg_replace('|^.*/themes/.*?/|','',$file); // get relative path from theme dir 596 return $file; 597 } 598 566 599 ?>