Making WordPress.org


Ignore:
Timestamp:
04/12/2016 09:43:39 PM (10 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Fix display of standalone HTML tags that were not backticked in summary/excerpt.

e.g. ​https://developer.wordpress.org/reference/hooks/comment_form/

File:
1 edited

Legend:

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

    r2941 r2942  
    11471147                        $summary = str_replace( array( '<!--', '-->' ), array( '<code>&lt;!--', '--&gt;</code>' ), $summary );
    11481148
     1149                        // Fix standalone HTML tags that were not backticked.
     1150                        // e.g. https://developer.wordpress.org/reference/hooks/comment_form/
     1151                        if ( false !== strpos( $summary, '<' ) ) {
     1152                                $summary = preg_replace_callback(
     1153                                        '/(\s)(<[^ >]+>)(\s)/',
     1154                                        function ( $matches ) { return $matches[1] . '<code>' . htmlentities( $matches[2] ) . '</code>' . $matches[3]; },
     1155                                        $summary
     1156                                );
     1157                        }
     1158
    11491159                        $summary = apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $summary ) );
    11501160                }
Note: See TracChangeset for help on using the changeset viewer.