mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Themes: Make sure get_file_data() recognizes headers prefixed by <?php tag.
This allows for using headers in the format of `<?php // Template Name: Something ?>`, which previously could not be recognized correctly. Props dd32, m_uysl, thomas-vitale, boblinthorst. Fixes #33387. git-svn-id: https://develop.svn.wordpress.org/trunk@51182 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -6287,7 +6287,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
|
||||
}
|
||||
|
||||
foreach ( $all_headers as $field => $regex ) {
|
||||
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
|
||||
if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
|
||||
$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
|
||||
} else {
|
||||
$all_headers[ $field ] = '';
|
||||
|
||||
Reference in New Issue
Block a user