WordPress.org

Making WordPress.org

Changeset 741


Ignore:
Timestamp:
07/09/2014 06:20:39 PM (7 years ago)
Author:
coffee2code
Message:

Code Reference: omit ending 'endif;' from source code parsing when erroneously included within line number range. Fixes #534

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r737 r741  
    725725                $line++;
    726726                $source_line = fgets( $handle );
     727
     728                // Stop reading file once end_line is reached.
    727729                if ( $line > $end_line ) {
    728730                    break;
    729731                }
     732
     733                // Skip lines until start_line is reached.
    730734                if ( $line < $start_line ) {
    731735                    continue;
    732736                }
     737
     738                // Skip the last line if it is "endif;"; the parser includes the
     739                // endif of a if/endif wrapping typical of pluggable functions.
     740                if ( $line === $end_line && 'endif;' === trim( $source_line ) ) {
     741                    continue;
     742                }
     743
    733744                $source_code .= $source_line;
    734745            }
Note: See TracChangeset for help on using the changeset viewer.