Changeset 10835 for trunk/wp-includes/theme.php
- Timestamp:
- 03/25/2009 04:51:08 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r10825 r10835 373 373 } 374 374 } 375 } 376 375 @ $stylesheet_dir->close(); 376 } 377 377 378 $template_dir = @ dir("$theme_root/$template"); 378 379 if ( $template_dir ) { 379 while(($file = $template_dir->read()) !== false) { 380 if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) 380 while ( ($file = $template_dir->read()) !== false ) { 381 if ( preg_match('|^\.+$|', $file) ) 382 continue; 383 if ( preg_match('|\.php$|', $file) ) { 381 384 $template_files[] = "$theme_loc/$template/$file"; 385 } elseif ( is_dir("$theme_root/$template/$file") ) { 386 $template_subdir = @ dir("$theme_root/$template/$file"); 387 while ( ($subfile = $template_subdir->read()) !== false ) { 388 if ( preg_match('|^\.+$|', $subfile) ) 389 continue; 390 if ( preg_match('|\.php$|', $subfile) ) 391 $template_files[] = "$theme_loc/$template/$file/$subfile"; 392 } 393 @ $template_subdir->close(); 394 } 382 395 } 396 @ $template_dir->close(); 383 397 } 384 398 … … 1118 1132 } 1119 1133 1134 /** 1135 * Get the basename of a theme. 1136 * 1137 * This method extracts the filename of a theme file from a path 1138 * 1139 * @package WordPress 1140 * @subpackage Plugin 1141 * @since 2.8.0 1142 * 1143 * @access private 1144 * 1145 * @param string $file The filename of a theme file 1146 * @return string The filename relative to the themes folder 1147 */ 1148 function theme_basename($file) { 1149 $file = str_replace('\\','/',$file); // sanitize for Win32 installs 1150 $file = preg_replace('|/+|','/', $file); // remove any duplicate slash 1151 $theme_dir = str_replace('\\','/', get_theme_root()); // sanitize for Win32 installs 1152 $theme_dir = preg_replace('|/+|','/', $theme_dir); // remove any duplicate slash 1153 $file = preg_replace('|^.*/themes/.*?/|','',$file); // get relative path from theme dir 1154 return $file; 1155 } 1156 1120 1157 ?>
Note: See TracChangeset
for help on using the changeset viewer.