Changeset 12050 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/reference/template-source.php
- Timestamp:
- 09/05/2022 05:14:31 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/reference/template-source.php
r11311 r12050 11 11 $source_file = get_source_file(); 12 12 if ( ! empty( $source_file ) ) : 13 $source_code = post_type_has_source_code() ? get_source_code() : ''; 13 14 ?> 14 15 <hr /> … … 16 17 <h2><?php _e( 'Source', 'wporg' ); ?></h2> 17 18 <p> 18 <?php printf( __( 'File: %s', 'wporg' ), 19 '<a href="' . esc_url( get_source_file_archive_link( $source_file ) ) . '">' . esc_html( $source_file ) . '</a>' 20 ); ?> 19 <?php 20 printf( 21 __( 'File: %s.', 'wporg' ), 22 '<code>' . esc_html( $source_file ) . '</code>' 23 ); 24 ?> 25 26 <?php 27 printf( 28 '<a href="%s">%s</a>', 29 esc_url( get_source_file_archive_link( $source_file ) ), 30 __( 'View all references', 'wporg' ) 31 ); 32 ?> 21 33 </p> 22 34 23 <?php if ( post_type_has_source_code() ) : ?> 24 <div class="source-code-container"> 25 <pre class="brush: php; toolbar: false; first-line: <?php echo esc_attr( get_post_meta( get_the_ID(), '_wp-parser_line_num', true ) ); ?>"><?php echo htmlentities( get_source_code() ); ?></pre> 26 </div> 35 <?php if ( ! empty( $source_code ) ) : ?> 36 <?php 37 echo do_blocks( 38 sprintf( 39 '<!-- wp:code {"lineNumbers":true} --><pre class="wp-block-code" data-start="%1$s" aria-label="%2$s"><code lang="php" class="language-php line-numbers">%3$s</code></pre><!-- /wp:code -->', 40 esc_attr( get_post_meta( get_the_ID(), '_wp-parser_line_num', true ) ), 41 __( 'Function source code', 'wporg' ), 42 htmlentities( $source_code ) 43 ) 44 ); 45 ?> 46 27 47 <p class="source-code-links"> 28 <span>29 <a href="#" class="show-complete-source"><?php _e( 'Expand full source code', 'wporg' ); ?></a>30 <a href="#" class="less-complete-source"><?php _e( 'Collapse full source code', 'wporg' ); ?></a>31 </span>32 48 <span><a href="<?php echo get_source_file_link(); ?>"><?php _e( 'View on Trac', 'wporg' ); ?></a></span> 33 49 <span><a href="<?php echo get_github_source_file_link(); ?>"><?php _e( 'View on GitHub', 'wporg' ); ?></a></span>
Note: See TracChangeset
for help on using the changeset viewer.