Changeset 10835
- Timestamp:
- 03/25/2009 04:51:08 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/theme.php
r10715 r10835 140 140 141 141 if ( !empty( $name ) ) { 142 $page_templates[trim( $name )] = basename( $template );142 $page_templates[trim( $name )] = theme_basename( $template ); 143 143 } 144 144 } -
trunk/wp-admin/theme-editor.php
r10792 r10835 152 152 $template_mapping = array(); 153 153 $template_dir = $themes[$theme]['Template Dir']; 154 foreach ($themes[$theme]['Template Files'] as $template_file) {154 foreach ( $themes[$theme]['Template Files'] as $template_file ) { 155 155 $description = trim( get_file_description($template_file) ); 156 156 $template_show = basename($template_file); … … 178 178 <?php 179 179 $template_mapping = array(); 180 foreach ($themes[$theme]['Stylesheet Files'] as $style_file) {180 foreach ( $themes[$theme]['Stylesheet Files'] as $style_file ) { 181 181 $description = trim( get_file_description($style_file) ); 182 182 $style_show = basename($style_file); … … 205 205 <?php if ( isset($functions ) && count($functions) ) { ?> 206 206 <div id="documentation"> 207 <label for="docs-list"> Documentation:</label>207 <label for="docs-list"><?php _e('Documentation:') ?></label> 208 208 <?php echo $docs_select; ?> 209 209 <input type="button" class="button" value=" <?php _e( 'Lookup' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /> -
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.