Changeset 868
- Timestamp:
- 09/23/2014 06:30:18 PM (11 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 6 edited
- 1 moved
-
comments.php (modified) (2 diffs)
-
content-reference.php (modified) (1 diff)
-
content-wp-parser-hook.php (modified) (1 diff)
-
functions.php (modified) (1 diff)
-
inc/template-tags.php (modified) (8 diffs)
-
inc/user-content.php (modified) (4 diffs)
-
js/user-notes.js (moved) (moved from sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/code-example.js) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php
r768 r868 40 40 * See wporg_developer_comment() in inc/template-tags.php for more. 41 41 */ 42 wp_list_comments( array( 'callback' => 'wporg_developer_ example' ) );42 wp_list_comments( array( 'callback' => 'wporg_developer_user_note' ) ); 43 43 ?> 44 44 </ol><!-- .comment-list --> … … 54 54 <?php endif; // have_comments() ?> 55 55 56 <?php if ( DevHub\can_user_post_ example( false, get_the_ID() ) ) : ?>56 <?php if ( DevHub\can_user_post_note( false, get_the_ID() ) ) : ?> 57 57 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> 59 59 60 60 <?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">' . 63 69 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' ) .66 70 '</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>', 69 73 'title_reply' => '', //'Add Example' 70 74 ) ); ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php
r836 r868 152 152 <?php if ( comments_open() || '0' != get_comments_number() ) : ?> 153 153 <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' */ ?> 157 157 </section> 158 158 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php
r836 r868 95 95 <?php if ( comments_open() || '0' != get_comments_number() ) : ?> 96 96 <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' */ ?> 100 100 </section> 101 101 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r862 r868 37 37 38 38 /** 39 * User-submitted content (comments, examples, etc).39 * User-submitted content (comments, notes, etc). 40 40 */ 41 41 require __DIR__ . '/inc/user-content.php'; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r861 r868 73 73 endif; 74 74 75 if ( ! function_exists( 'wporg_developer_ example' ) ) :75 if ( ! function_exists( 'wporg_developer_user_note' ) ) : 76 76 /** 77 * Template for examples.77 * Template for user contributed notes. 78 78 * 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. 80 80 */ 81 function wporg_developer_ example( $comment, $args, $depth ) {81 function wporg_developer_user_note( $comment, $args, $depth ) { 82 82 $GLOBALS['comment'] = $comment; 83 83 … … 130 130 131 131 <?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> 133 133 <?php endif; ?> 134 134 </footer> … … 149 149 endif; 150 150 } 151 endif; // ends check for wporg_developer_ comment()151 endif; // ends check for wporg_developer_user_note() 152 152 153 153 if ( ! function_exists( 'wporg_developer_posted_on' ) ) : … … 226 226 227 227 <?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> 229 229 <br /> 230 230 <?php endif; ?> 231 231 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> 233 233 234 234 <footer class="comment-meta"> … … 716 716 717 717 /** 718 * Does the post type support having examples?718 * Does the post type support having user notes? 719 719 * 720 720 * @param string Optional. The post type name. If blank, assumes current post type. … … 722 722 * @return boolean 723 723 */ 724 function post_type_supports_ examples( $post_type = null ) {724 function post_type_supports_user_notes( $post_type = null ) { 725 725 $post_type = $post_type ? $post_type : get_post_type(); 726 726 … … 812 812 813 813 /** 814 * Indicates if the current user can post a n example.814 * Indicates if the current user can post a user contibuted note. 815 815 * 816 816 * 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. 818 818 * 819 819 * A custom check can be performed by hooking the filter 820 * 'wporg_devhub-can_user_post_ example' and returning a820 * 'wporg_devhub-can_user_post_note' and returning a 821 821 * value other than null. 822 822 * 823 * By default, the ability to post examples is restricted to members of the823 * By default, the ability to post notes is restricted to members of the 824 824 * blog. 825 825 * 826 826 * @param int $post_id The post ID. 827 827 * 828 * @return bool True if the user can post a n 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. 833 833 if ( 0 !== strpos( get_post_type( (int) $post_id ), 'wp-parser-' ) ) { 834 // Temporarily disable commenting that isn't for a n example since various834 // Temporarily disable commenting that isn't for a note since various 835 835 // changes need to take place to enable regular commenting. 836 836 return false; //$open; … … 838 838 839 839 // 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 ) ) ) { 841 841 return $can; 842 842 } 843 843 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. 845 845 return is_user_member_of_blog(); 846 846 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php
r817 r868 1 1 <?php 2 2 /** 3 * Code Reference user submitted content (comments, examples, etc).3 * Code Reference user submitted content (comments, notes, etc). 4 4 * 5 5 * @package wporg-developer … … 19 19 20 20 /** 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. 26 22 */ 27 23 public static function do_init() { … … 30 26 add_filter( 'comments_open', array( __CLASS__, 'prevent_invalid_comment_submissions' ), 10, 2 ); 31 27 32 // Sets whether submitting examples is open for the user33 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 ); 34 30 35 31 // Enqueue scripts and styles … … 71 67 wp_enqueue_style( 'syntaxhighlighter-theme-default' ); 72 68 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 ); 74 70 if ( get_option( 'thread_comments' ) ) { 75 71 wp_enqueue_script( 'comment-reply' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js
r866 r868 1 1 /** 2 * Comments as examples dynamic functionality.2 * Dynamic functionality for comments as user submitted notes. 3 3 * 4 4 */ 5 5 6 6 ( 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 ) { 9 9 e.preventDefault(); 10 $( '#respond, #add- example' ).toggle();10 $( '#respond, #add-user-note' ).toggle(); 11 11 12 12 if ( pos = $( '#submit' ).position() ) {
Note: See TracChangeset
for help on using the changeset viewer.