Changeset 12042 for trunk/wp-includes/theme.php
- Timestamp:
- 10/15/2009 08:26:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r12025 r12042 130 130 $theme_root = get_theme_root( $template ); 131 131 $template_dir = "$theme_root/$template"; 132 132 133 133 return apply_filters( 'template_directory', $template_dir, $template, $theme_root ); 134 134 } … … 146 146 $theme_root_uri = get_theme_root_uri( $template ); 147 147 $template_dir_uri = "$theme_root_uri/$template"; 148 148 149 149 return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); 150 150 } … … 267 267 if ( !$theme_files = search_theme_directories() ) 268 268 return false; 269 269 270 270 asort( $theme_files ); 271 271 272 272 foreach ( (array) $theme_files as $theme_file ) { 273 273 $theme_root = $theme_file['theme_root']; … … 308 308 continue; 309 309 } 310 310 311 311 $template = trim( $template ); 312 312 … … 316 316 $template = "$theme_root/$parent_dir/$template"; 317 317 } else { 318 /** 319 * The parent theme doesn't exist in the current theme's folder or sub folder 320 * so lets use the theme root for the parent template. 318 /** 319 * The parent theme doesn't exist in the current theme's folder or sub folder 320 * so lets use the theme root for the parent template. 321 321 */ 322 322 $parent_theme_root = $theme_files[$template]['theme_root']; … … 327 327 continue; 328 328 } 329 329 330 330 } 331 331 } else { 332 332 $template = trim( $theme_root . '/' . $template ); 333 333 } 334 334 335 335 $stylesheet_files = array(); 336 336 $template_files = array(); … … 420 420 421 421 $wp_themes = $themes; 422 422 423 423 return $themes; 424 424 } … … 502 502 function register_theme_directory( $directory ) { 503 503 global $wp_theme_directories; 504 504 505 505 /* The theme directory should be relative to the content directory */ 506 506 $registered_directory = WP_CONTENT_DIR . '/' . $directory; 507 507 508 508 /* If this folder does not exist, return and do not register */ 509 509 if ( !file_exists( $registered_directory ) ) 510 510 return false; 511 511 512 512 $wp_theme_directories[] = $registered_directory; 513 513 514 514 return true; 515 515 } … … 524 524 function search_theme_directories() { 525 525 global $wp_theme_directories, $wp_broken_themes; 526 526 527 527 if ( empty( $wp_theme_directories ) ) 528 528 return false; … … 534 534 foreach ( (array) $wp_theme_directories as $theme_root ) { 535 535 $theme_loc = $theme_root; 536 536 537 537 /* We don't want to replace all forward slashes, see Trac #4541 */ 538 if ( '/' != WP_CONTENT_DIR ) 538 if ( '/' != WP_CONTENT_DIR ) 539 539 $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root); 540 540 … … 552 552 $stylish_dir = @ opendir($theme_root . '/' . $theme_dir); 553 553 $found_stylesheet = false; 554 554 555 555 while ( ($theme_file = readdir($stylish_dir)) !== false ) { 556 556 if ( $theme_file == 'style.css' ) { … … 561 561 } 562 562 @closedir($stylish_dir); 563 563 564 564 if ( !$found_stylesheet ) { // look for themes in that dir 565 565 $subdir = "$theme_root/$theme_dir"; 566 566 $subdir_name = $theme_dir; 567 567 $theme_subdir = @ opendir( $subdir ); 568 568 569 569 while ( ($theme_dir = readdir($theme_subdir)) !== false ) { 570 570 if ( is_dir( $subdir . '/' . $theme_dir) && is_readable($subdir . '/' . $theme_dir) ) { 571 571 if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' ) 572 572 continue; 573 573 574 574 $stylish_dir = @ opendir($subdir . '/' . $theme_dir); 575 575 $found_stylesheet = false; 576 576 577 577 while ( ($theme_file = readdir($stylish_dir)) !== false ) { 578 578 if ( $theme_file == 'style.css' ) { … … 586 586 } 587 587 @closedir($theme_subdir); 588 588 589 589 $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.')); 590 590 } … … 594 594 @closedir( $theme_dir ); 595 595 } 596 596 597 597 return $theme_files; 598 598 } … … 611 611 function get_theme_root( $stylesheet_or_template = false ) { 612 612 $theme_roots = get_theme_roots(); 613 613 614 614 if ( $theme_roots[$stylesheet_or_template] ) 615 615 $theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template]; … … 632 632 function get_theme_root_uri( $stylesheet_or_template = false ) { 633 633 $theme_roots = get_theme_roots(); 634 634 635 635 if ( $theme_roots[$stylesheet_or_template] ) 636 636 $theme_root_uri = content_url( $theme_roots[$stylesheet_or_template] ); … … 737 737 * trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php 738 738 * template, if those files don't exist. 739 * 739 * 740 740 * @since 2.3.0 741 741 * @uses apply_filters() Calls 'tag_template' on file path of tag template. … … 754 754 $templates[] = "tag-$tag_id.php"; 755 755 $templates[] = "tag.php"; 756 756 757 757 $template = locate_template($templates); 758 758 return apply_filters('tag_template', $template);
Note: See TracChangeset
for help on using the changeset viewer.