Making WordPress.org


Ignore:
Timestamp:
09/23/2014 06:30:18 PM (11 years ago)
Author:
coffee2code
Message:

Code Reference: rename 'Examples' to 'User Contributed Notes' in an appropriate fashion wherever present

File:
1 edited

Legend:

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

    r861 r868  
    7373    endif;
    7474
    75     if ( ! function_exists( 'wporg_developer_example' ) ) :
     75    if ( ! function_exists( 'wporg_developer_user_note' ) ) :
    7676        /**
    77          * Template for examples.
     77         * Template for user contributed notes.
    7878         *
    79          * Used as a callback by wp_list_comments() for displaying the examples.
     79         * Used as a callback by wp_list_comments() for displaying the notes.
    8080         */
    81         function wporg_developer_example( $comment, $args, $depth ) {
     81        function wporg_developer_user_note( $comment, $args, $depth ) {
    8282            $GLOBALS['comment'] = $comment;
    8383
     
    130130
    131131                        <?php if ( '0' == $comment->comment_approved ) : ?>
    132                             <p class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></p>
     132                            <p class="comment-awaiting-moderation"><?php _e( 'Your note is awaiting moderation.', 'wporg' ); ?></p>
    133133                        <?php endif; ?>
    134134                    </footer>
     
    149149            endif;
    150150        }
    151     endif; // ends check for wporg_developer_comment()
     151    endif; // ends check for wporg_developer_user_note()
    152152
    153153    if ( ! function_exists( 'wporg_developer_posted_on' ) ) :
     
    226226
    227227            <?php if ( $comment->comment_approved == '0' ) : ?>
    228                 <em class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></em>
     228                <em class="comment-awaiting-moderation"><?php _e( 'Your note is awaiting moderation.', 'wporg' ); ?></em>
    229229                <br />
    230230            <?php endif; ?>
    231231
    232             <pre class="example-content"><?php echo htmlentities( get_comment_text() ); ?></pre>
     232            <pre class="user-note-content"><?php echo htmlentities( get_comment_text() ); ?></pre>
    233233
    234234            <footer class="comment-meta">
     
    716716
    717717    /**
    718      * Does the post type support having examples?
     718     * Does the post type support having user notes?
    719719     *
    720720     * @param  string  Optional. The post type name. If blank, assumes current post type.
     
    722722     * @return boolean
    723723     */
    724     function post_type_supports_examples( $post_type = null ) {
     724    function post_type_supports_user_notes( $post_type = null ) {
    725725        $post_type = $post_type ? $post_type : get_post_type();
    726726
     
    812812
    813813    /**
    814      * Indicates if the current user can post an example.
     814     * Indicates if the current user can post a user contibuted note.
    815815     *
    816816     * This only affects post types wp-parser-* as they are the only things
    817      * that can have examples.
     817     * that can have user contributed notes.
    818818     *
    819819     * A custom check can be performed by hooking the filter
    820      * 'wporg_devhub-can_user_post_example' and returning a
     820     * 'wporg_devhub-can_user_post_note' and returning a
    821821     * value other than null.
    822822     *
    823      * By default, the ability to post examples is restricted to members of the
     823     * By default, the ability to post notes is restricted to members of the
    824824     * blog.
    825825     *
    826826     * @param  int  $post_id The post ID.
    827827     *
    828      * @return bool True if the user can post an example.
    829      */
    830     function can_user_post_example( $open, $post_id ) {
    831 
    832         // Only proceed if the post type is one that has examples.
     828     * @return bool True if the user can post a note.
     829     */
     830    function can_user_post_note( $open, $post_id ) {
     831
     832        // Only proceed if the post type is one that has user contributed notes.
    833833        if ( 0 !== strpos( get_post_type( (int) $post_id ), 'wp-parser-' ) ) {
    834             // Temporarily disable commenting that isn't for an example since various
     834            // Temporarily disable commenting that isn't for a note since various
    835835            // changes need to take place to enable regular commenting.
    836836            return false; //$open;
     
    838838
    839839        // Permit default logic to be overridden via filter that returns value other than null.
    840         if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_example', null, $post_id ) ) ) {
     840        if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_note', null, $post_id ) ) ) {
    841841            return $can;
    842842        }
    843843
    844         // Default to limiting ability to post examples to members of the blog.
     844        // Default to limiting ability to post notes to members of the blog.
    845845        return is_user_member_of_blog();
    846846    }
Note: See TracChangeset for help on using the changeset viewer.