Making WordPress.org

Changeset 868


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

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

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
6 edited
1 moved

Legend:

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

    r768 r868  
    4040                                 * See wporg_developer_comment() in inc/template-tags.php for more.
    4141                                 */
    42                                 wp_list_comments( array( 'callback' => 'wporg_developer_example' ) );
     42                                wp_list_comments( array( 'callback' => 'wporg_developer_user_note' ) );
    4343                        ?>
    4444                </ol><!-- .comment-list -->
    … …  
    5454        <?php endif; // have_comments() ?>
    5555
    56         <?php if ( DevHub\can_user_post_example( false, get_the_ID() ) ) : ?>
     56        <?php if ( DevHub\can_user_post_note( false, get_the_ID() ) ) : ?>
    5757
    58         <p id="add-example" style="display:none;"><a href=""><?php _e( 'Have an example to add?', 'wporg' ); ?></a></p>
     58        <p id="add-user-note" style="display:none;"><a href=""><?php _e( 'Have a note to contribute?', 'wporg' ); ?></a></p>
    5959
    6060        <?php comment_form( array(
    61                 'comment_field'       => '<p class="comment-form-comment"><label for="comment">' . _x( 'Add Example', 'noun', 'wporg' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    62                 'comment_notes_after' => '<p class="examples-are-gpl">' .
     61                'comment_field'       => '<p class="comment-form-comment"><label for="comment">' . _x( 'Add Note', 'noun', 'wporg' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
     62                'comment_notes_after' => '<p>' .
     63                        __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' ) .
     64                        '</p><p>' .
     65                        __( 'Do not use this form for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' ) .
     66                        '</p><p>' .
     67                        sprintf( __( 'You can enter text and code. Code should be wrapped in the %s shortcode.', 'wporg' ), '[code][/code]' ) .
     68                        '</p><p class="user-notes-are-gpl">' .
    6369                        sprintf( __( '<strong>NOTE:</strong> All contributions are licensed under <a href="%s">GFDL</a> and are moderated before appearing on the site.', 'wporg' ), 'https://gnu.org/licenses/fdl.html' ) .
    64                         '</p><p>' .
    65                         __( 'The entirety of your submission is considered a code example. Any included non-code text should be formatted as code comments.', 'wporg' ) .
    6670                        '</p>',
    67                 'label_submit'        => __( 'Add Example', 'wporg' ),
    68                 'must_log_in'         => '<p>' . sprintf( __( 'You must <a href="%s">log in</a> before being able to submit an example.', 'wporg' ), 'https://wordpress.org/support/bb-login.php' ) . '</p>',
     71                'label_submit'        => __( 'Add Note', 'wporg' ),
     72                'must_log_in'         => '<p>' . sprintf( __( 'You must <a href="%s">log in</a> before being able to contribute a note.', 'wporg' ), 'https://wordpress.org/support/bb-login.php' ) . '</p>',
    6973                'title_reply'         =>  '', //'Add Example'
    7074        ) ); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php

    r836 r868  
    152152        <?php if ( comments_open() || '0' != get_comments_number() ) : ?>
    153153        <hr/>
    154         <section class="examples">
    155                 <h2><?php _e( 'Examples', 'wporg' ); ?></h2>
    156                 <?php comments_template(); /* TODO: add '/examples.php' */ ?>
     154        <section class="user-notes">
     155                <h2><?php _e( 'User Contributed Notes', 'wporg' ); ?></h2>
     156                <?php comments_template(); /* TODO: add '/user-notes.php' */ ?>
    157157        </section>
    158158        <?php endif; ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php

    r836 r868  
    9595                <?php if ( comments_open() || '0' != get_comments_number() ) : ?>
    9696                <hr/>
    97                 <section class="examples">
    98                         <h2><?php _e( 'Examples', 'wporg' ); ?></h2>
    99                         <?php comments_template(); /* TODO: add '/examples.php' */ ?>
     97                <section class="user-notes">
     98                        <h2><?php _e( 'User Contributed Notes', 'wporg' ); ?></h2>
     99                        <?php comments_template(); /* TODO: add '/user-notes.php' */ ?>
    100100                </section>
    101101                <?php endif; ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php

    r862 r868  
    3737
    3838/**
    39  * User-submitted content (comments, examples, etc).
     39 * User-submitted content (comments, notes, etc).
    4040 */
    4141require __DIR__ . '/inc/user-content.php';
  • 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        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

    r817 r868  
    11<?php
    22/**
    3  * Code Reference user submitted content (comments, examples, etc).
     3 * Code Reference user submitted content (comments, notes, etc).
    44 *
    55 * @package wporg-developer
    … …  
    1919
    2020        /**
    21          * Handles adding/removing hooks to enable comments as examples.
    22          *
    23          * Mostly gives users greater permissions in terms of comment content.
    24          *
    25          * In order to submit code examples, users must be able to post with less restrictions.
     21         * Handles adding/removing hooks to enable comments as user contributed notes.
    2622         */
    2723        public static function do_init() {
    … …  
    3026                add_filter( 'comments_open',                    array( __CLASS__, 'prevent_invalid_comment_submissions' ), 10, 2 );
    3127
    32                 // Sets whether submitting examples is open for the user
    33                 add_filter( 'comments_open',                    '\DevHub\\can_user_post_example', 10, 2 );
     28                // Sets whether submitting notes is open for the user
     29                add_filter( 'comments_open',                    '\DevHub\\can_user_post_note', 10, 2 );
    3430
    3531                // Enqueue scripts and styles
    … …  
    7167                        wp_enqueue_style( 'syntaxhighlighter-theme-default' );
    7268
    73                         wp_enqueue_script( 'wporg-developer-code-examples', get_template_directory_uri() . '/js/code-example.js', array(), '20140423', true );
     69                        wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array(), '20140912', true );
    7470                        if ( get_option( 'thread_comments' ) ) {
    7571                                wp_enqueue_script( 'comment-reply' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js

    r866 r868  
    11/**
    2  * Comments as examples dynamic functionality.
     2 * Dynamic functionality for comments as user submitted notes.
    33 *
    44 */
    55
    66( function( $ ) {
    7         $( '#respond, #add-example' ).toggle();
    8         $( '#add-example' ).click( function( e ) {
     7        $( '#respond, #add-user-note' ).toggle();
     8        $( '#add-user-note' ).click( function( e ) {
    99                e.preventDefault();
    10                 $( '#respond, #add-example' ).toggle();
     10                $( '#respond, #add-user-note' ).toggle();
    1111
    1212                if ( pos = $( '#submit' ).position() ) {
Note: See TracChangeset for help on using the changeset viewer.