Making WordPress.org


Ignore:
Timestamp:
01/09/2017 07:15:56 PM (10 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Allow @see notation to reference classes.

While not used much in core docs (except once, and only just recently), the feature could be utilized in explanations and handbooks.

Fixes #2367.

File:
1 edited

Legend:

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

    r3796 r4617  
    184184                                        '">' . esc_html( $link ) . '</a>';
    185185                        }
     186                }
     187
     188                // Link to class: {@see WP_Query}
     189                elseif (
     190                        ( in_array( $link, array(
     191                                'wpdb', 'wp_atom_server', 'wp_xmlrpc_server', // Exceptions that start with lowercase letter
     192                                'AtomFeed', 'AtomEntry', 'AtomParser', 'MagpieRSS', 'Requests', 'RSSCache', 'Translations', 'Walker' // Exceptions that lack an underscore
     193                        ) ) )
     194                        ||
     195                        ( 1 === preg_match ( '/^_?[A-Z][a-zA-Z]+_\w+/', $link ) ) // Otherwise, class names start with (optional underscore, then) uppercase and have underscore
     196                ) {
     197                        $link = sprintf(
     198                                '<a href="%s">%s</a>',
     199                                esc_url( get_post_type_archive_link( 'wp-parser-class' ) . sanitize_key( $link ) ),
     200                                esc_html( $link )
     201                        );
    186202                }
    187203
Note: See TracChangeset for help on using the changeset viewer.