Making WordPress.org

Ticket #454: meta-454.patch

File meta-454.patch, 2.0 KB (added by SergeyBiryukov, 10 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php

     
    2727        $source_file = get_source_file();
    2828        if ( ! empty( $source_file ) ) : ?>
    2929        <section class="source">
    30                 <p><strong><?php _e( 'Source:', 'wporg' ); ?></strong> <a href="<?php echo get_source_file_link( $source_file ); ?>"><?php echo esc_html( $source_file ); ?></a></p>
     30                <p>
     31                        <strong><?php _e( 'Source:', 'wporg' ); ?></strong>
     32                        <a href="<?php echo get_source_file_link( $source_file ); ?>"><?php echo esc_html( $source_file ); ?></a>
     33                        (<a href="<?php echo get_source_file_trac_link( $source_file ); ?>"><?php _e( 'Browse in Trac', 'wporg' ); ?></a>)
     34                </p>
    3135        </section>
    3236        <?php endif; ?>
    3337
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

     
    532532        }
    533533
    534534        /**
     535         * Retrieve URL to source file in Trac
     536         *
     537         * @param string $name
     538         *
     539         * @return string
     540         */
     541        function get_source_file_trac_link( $name = null ) {
     542
     543                $trac_browser_url   = 'https://core.trac.wordpress.org/browser/trunk/src/';
     544                $source_file_object = wp_get_post_terms( empty( $post_id ) ? get_the_ID() : $post_id, 'wp-parser-source-file', array( 'fields' => 'names' ) );
     545
     546                return empty( $source_file_object ) ? '' : esc_url( $trac_browser_url . $source_file_object[0] );
     547        }
     548
     549        /**
    535550         * Retrieve name of source file
    536551         *
    537552         * @param int $post_id