Ticket #58905: 58905.diff
File 58905.diff, 2.1 KB (added by , 20 months ago) |
---|
-
src/wp-includes/template.php
704 704 if ( ! $template_name ) { 705 705 continue; 706 706 } 707 if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) { 708 $located = STYLESHEETPATH . '/' . $template_name; 707 708 $stylesheet = STYLESHEETPATH . '/' . $template_name; 709 $template = TEMPLATEPATH . '/' . $template_name; 710 $template_compat = ABSPATH . WPINC . '/theme-compat/' . $template_name; 711 712 if ( file_exists( $stylesheet ) && 0 === strpos( realpath( $stylesheet ), realpath( STYLESHEETPATH ) ) ) { 713 $located = $stylesheet; 709 714 break; 710 } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name) ) {711 $located = TEMPLATEPATH . '/' . $template_name;715 } elseif ( file_exists( $template ) && 0 === strpos( realpath( $template ), realpath( TEMPLATEPATH ) ) ) { 716 $located = $template; 712 717 break; 713 } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name) ) {714 $located = ABSPATH . WPINC . '/theme-compat/' . $template_name;718 } elseif ( file_exists( $template_compat ) && 0 === strpos( realpath( $template_compat ), realpath( ABSPATH . WPINC . '/theme-compat/' ) ) ) { 719 $located = $template_compat; 715 720 break; 716 721 } 717 722 } -
tests/phpunit/tests/template.php
628 628 ), 629 629 ); 630 630 } 631 public function test_locate_template_file_outside_of_the_directory() { 632 $template = locate_template( '../../templates/template.html', false, false ); 633 $this->assertEmpty( $template ); 634 } 631 635 636 public function test_locate_template_file_inside_of_the_directory() { 637 $template = locate_template( 'index.php', false, false ); 638 $this->assertNotEmpty( $template ); 639 } 640 632 641 public function assertTemplateHierarchy( $url, array $expected, $message = '' ) { 633 642 $this->go_to( $url ); 634 643 $hierarchy = $this->get_template_hierarchy();