WordPress.org

Make WordPress Core

Changeset 21117


Ignore:
Timestamp:
06/25/12 21:07:07 (3 years ago)
Author:
nacin
Message:

Revert detection of page templates to 3.3 functionality.

WP_Theme in 3.4.0 used get_file_data(), which is far too strict when
compared to the original regular expression in get_page_templates().
This causes missing templates when, for example, the PHP comment
starts on the same line as the header.

see #20955 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-theme.php

    r21050 r21117  
    931931 
    932932            foreach ( $files as $file => $full_path ) { 
    933                 $headers = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) ); 
    934                 if ( empty( $headers['Template Name'] ) ) 
     933                if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) 
    935934                    continue; 
    936                 $page_templates[ $file ] = $headers['Template Name']; 
     935                $page_templates[ $file ] = _cleanup_header_comment( $header[1] ); 
    937936            } 
    938937 
Note: See TracChangeset for help on using the changeset viewer.