diff --git wp-includes/template.php wp-includes/template.php
index 9802447..ff26c75 100644
|
|
|
function get_comments_popup_template() { |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
| | 450 | * Get theme directories |
| | 451 | * |
| | 452 | * Gives a map of theme base directories to theme base URIs, allowing searching |
| | 453 | * themes for a certain file in order. |
| | 454 | * |
| | 455 | * @return array Map of base directory to base URI |
| | 456 | */ |
| | 457 | function wp_template_directories() { |
| | 458 | $directories = array( |
| | 459 | get_stylesheet_directory() => get_stylesheet_directory_uri(), |
| | 460 | get_template_directory() => get_template_directory_uri(), |
| | 461 | ); |
| | 462 | return apply_filters( 'wp_template_directories', $directories ); |
| | 463 | } |
| | 464 | |
| | 465 | /** |
| 450 | 466 | * Retrieve the name of the highest priority template file that exists. |
| 451 | 467 | * |
| 452 | 468 | * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which |
| … |
… |
function get_comments_popup_template() { |
| 461 | 477 | */ |
| 462 | 478 | function locate_template($template_names, $load = false, $require_once = true ) { |
| 463 | 479 | $located = ''; |
| | 480 | $basedirs = array_keys( wp_template_directories() ); |
| 464 | 481 | foreach ( (array) $template_names as $template_name ) { |
| 465 | 482 | if ( !$template_name ) |
| 466 | 483 | continue; |
| 467 | | if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { |
| 468 | | $located = STYLESHEETPATH . '/' . $template_name; |
| 469 | | break; |
| 470 | | } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { |
| 471 | | $located = TEMPLATEPATH . '/' . $template_name; |
| 472 | | break; |
| | 484 | |
| | 485 | foreach ( $basedirs as $directory ) { |
| | 486 | if ( file_exists( $directory . '/' . $template_name ) ) { |
| | 487 | $located = $directory . '/' . $template_name; |
| | 488 | break 2; |
| | 489 | } |
| 473 | 490 | } |
| 474 | 491 | } |
| 475 | 492 | |
| … |
… |
function load_template( $_template_file, $require_once = true ) { |
| 503 | 520 | require( $_template_file ); |
| 504 | 521 | } |
| 505 | 522 | |
| | 523 | /** |
| | 524 | * Get URI for an image |
| | 525 | * |
| | 526 | * Uses {@see wp_template_directories} to first find the file, then get the |
| | 527 | * relevant URI for it. |
| | 528 | * |
| | 529 | * @param string $file File name to search for |
| | 530 | * @return string URI for the asset, empty string if none found |
| | 531 | */ |
| | 532 | function theme_url( $file ) { |
| | 533 | $directories = wp_template_directories(); |
| | 534 | $uri = ''; |
| | 535 | |
| | 536 | foreach ( $directories as $directory => $base_uri ) { |
| | 537 | $path = sprintf( '%s/%s', $directory, $file ); |
| | 538 | if ( file_exists( $path ) ) { |
| | 539 | $uri = sprintf( '%s/%s', $base_uri, $file ); |
| | 540 | break; |
| | 541 | } |
| | 542 | } |
| | 543 | |
| | 544 | return apply_filters( 'theme_url', $uri, $file, $directories ); |
| | 545 | } |
| | 546 | |