WordPress.org

Make WordPress Core

Ticket #14243: functions.php.diff

File functions.php.diff, 640 bytes (added by nkuttler, 10 years ago)

Patch using Tokenizer

  • .php

    old new  
    41794179                $all_headers = $default_headers;
    41804180        }
    41814181
     4182        $tmp_data = '';
     4183        $tokens = token_get_all( "<?php\n" . $file_data ); // fake being PHP code
     4184        foreach ( $tokens as $token ) {
     4185            if ( ( $token[0] == T_COMMENT || $token[0] == T_DOC_COMMENT )
     4186                && !preg_match( "/^#/", $token[1] ) ) {
     4187                $tmp_data .= $token[1];
     4188            }   
     4189        }
     4190        $file_data = $tmp_data;
    41824191
    41834192        foreach ( $all_headers as $field => $regex ) {
    41844193                preg_match( '/' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});