WordPress.org

Make WordPress Core

Ticket #13239: 13239.c2c.4.diff

File 13239.c2c.4.diff, 1.3 KB (added by coffee2code, 4 years ago)

Use path_is_absolute() to check for absolute paths

  • wp-includes/theme.php

     
    10641064 * inherit from a parent theme can just overload one file. 
    10651065 * 
    10661066 * @since 2.7.0 
     1067 * @uses apply_filters() Calls 'locate_template' filter on array of template names. 
    10671068 * 
    10681069 * @param string|array $template_names Template file(s) to search for, in order. 
    10691070 * @param bool $load If true the template file will be loaded if it is found. 
     
    10711072 * @return string The template filename if one is located. 
    10721073 */ 
    10731074function locate_template($template_names, $load = false, $require_once = true ) { 
     1075        $template_names = apply_filters( 'locate_template', $template_names, $load, $require_once ); 
     1076 
    10741077        $located = ''; 
    10751078        foreach ( (array) $template_names as $template_name ) { 
    10761079                if ( !$template_name ) 
    10771080                        continue; 
    1078                 if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { 
     1081                if ( path_is_absolute( $template_name ) && file_exists( $template_name ) ) { 
     1082                        $located = $template_name; 
     1083                        break; 
     1084                } else if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { 
    10791085                        $located = STYLESHEETPATH . '/' . $template_name; 
    10801086                        break; 
    10811087                } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {