Changeset 2430 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/formatting.php
- Timestamp:
- 01/29/2016 07:41:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/formatting.php
r2207 r2430 133 133 // Link to an internal resource. 134 134 else { 135 136 // Link to class variable: {@see WP_Rewrite::$index} 137 if ( false !== strpos( $link, '::$' ) ) { 138 // Nothing to link to currently. 139 } 140 141 // Link to class method: {@see WP_Query::query()} 142 elseif ( false !== strpos( $link, '::' ) ) { 143 $link = '<a href="' . 144 get_post_type_archive_link( 'wp-parser-class' ) . 145 str_replace( array( '::', '()' ), array( '/', '' ), $link ) . 146 '">' . esc_html( $link ) . '</a>'; 147 } 148 149 // Link to hook: {@see 'pre_get_search_form'} 150 elseif ( 1 === preg_match( '/^(‘)\w+(’)$/', $link, $hook ) ) { 151 if ( ! empty( $hook[0] ) ) { 152 $link = '<a href="' . 153 get_post_type_archive_link( 'wp-parser-hook' ) . 154 str_replace( array( '‘', '’' ), '', $link ) . 155 '">' . esc_html( $link ) . '</a>'; 156 } 157 } 158 159 // Link to function: {@see esc_attr()} 160 else { 161 $link = '<a href="' . 162 get_post_type_archive_link( 'wp-parser-function' ) . 163 str_replace( '()', '', $link ) . 164 '">' . esc_html( $link ) . '</a>'; 165 } 166 135 $link = self::link_internal_element( $link ); 167 136 } 168 137 … … 171 140 $content 172 141 ); 142 } 143 144 /** 145 * Parses and links an internal element if a valid element is found. 146 * 147 * @static 148 * @access public 149 * 150 * @param string $link Element string. 151 * @param string HTML link markup if a valid element was found. 152 */ 153 public static function link_internal_element( $link ) { 154 // Link to class variable: {@see WP_Rewrite::$index} 155 if ( false !== strpos( $link, '::$' ) ) { 156 // Nothing to link to currently. 157 } 158 159 // Link to class method: {@see WP_Query::query()} 160 elseif ( false !== strpos( $link, '::' ) ) { 161 $link = '<a href="' . 162 get_post_type_archive_link( 'wp-parser-class' ) . 163 str_replace( array( '::', '()' ), array( '/', '' ), $link ) . 164 '">' . esc_html( $link ) . '</a>'; 165 } 166 167 // Link to hook: {@see 'pre_get_search_form'} 168 elseif ( 1 === preg_match( '/^(‘)\w+(’)$/', $link, $hook ) ) { 169 if ( ! empty( $hook[0] ) ) { 170 $link = '<a href="' . 171 get_post_type_archive_link( 'wp-parser-hook' ) . 172 str_replace( array( '‘', '’' ), '', $link ) . 173 '">' . esc_html( $link ) . '</a>'; 174 } 175 } 176 177 // Link to function: {@see esc_attr()} 178 else { 179 $link = '<a href="' . 180 get_post_type_archive_link( 'wp-parser-function' ) . 181 str_replace( '()', '', $link ) . 182 '">' . esc_html( $link ) . '</a>'; 183 } 184 return $link; 173 185 } 174 186
Note: See TracChangeset
for help on using the changeset viewer.