Making WordPress.org

Changeset 5578


Ignore:
Timestamp:
06/15/2017 10:48:35 PM (7 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Change regex for @see linking of hooks to recognize characters and HTML entities that may be present in hook names.

This is valid {@see 'comment_$new_status_$comment->comment_type'} but failed to be recognized as a hook due to the presence of & and ; (from the encoded value of >) and the -.

Example: https://developer.wordpress.org/reference/functions/wp_transition_comment_status/

Fixes #2880.

File:
1 edited

Legend:

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

    r5577 r5578  
    177177
    178178        // Link to hook: {@see 'pre_get_search_form'}
    179         elseif ( 1 === preg_match( '/^(?:\'|(?:‘))([\$\w]+)(?:\'|(?:’))$/', $link, $hook ) ) {
     179        elseif ( 1 === preg_match( '/^(?:\'|(?:‘))([\$\w-&;]+)(?:\'|(?:’))$/', $link, $hook ) ) {
    180180            if ( ! empty( $hook[1] ) ) {
    181181                $link = '<a href="' .
    182182                        get_post_type_archive_link( 'wp-parser-hook' ) .
    183                         sanitize_key( $hook[1] ) . '/' .
     183                        sanitize_key( html_entity_decode( $hook[1] ) ) . '/' .
    184184                        '">' . esc_html( $link ) . '</a>';
    185185            }
Note: See TracChangeset for help on using the changeset viewer.