WordPress.org

Making WordPress.org

Changeset 3233


Ignore:
Timestamp:
05/24/16 20:55:22 (19 months ago)
Author:
coffee2code
Message:

developer.wordpress.org: Fix auto-linking of inline @see tags for dynamic hooks.

  • Fix regex for hooks in link_internal_element () to allow $.
  • Remove $ and encoded quotes from hook slug in URL.
  • Don't capture encoded quotes in match for slug, saving the need to remove them.

Fixes #1730.

File:
1 edited

Legend:

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

    r3050 r3233  
    174174 
    175175        // Link to hook: {@see 'pre_get_search_form'} 
    176         elseif ( 1 === preg_match( '/^(‘)\w+(’)$/', $link, $hook ) ) { 
    177             if ( ! empty( $hook[0] ) ) { 
     176        elseif ( 1 === preg_match( '/^(?:‘)([\$\w]+)(?:’)$/', $link, $hook ) ) { 
     177            if ( ! empty( $hook[1] ) ) { 
    178178                $link = '<a href="' . 
    179179                        get_post_type_archive_link( 'wp-parser-hook' ) . 
    180                         str_replace( array( '&#8216;', '&#8217;' ), '', $link ) . 
     180                        sanitize_key( $hook[1] ) . '/' . 
    181181                        '">' . esc_html( $link ) . '</a>'; 
    182182            } 
Note: See TracChangeset for help on using the changeset viewer.