Changeset 724
- Timestamp:
- 06/29/2014 08:41:47 AM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php
r554 r724 23 23 <div id="comments" class="comments-area"> 24 24 25 <?php // You can start editing here -- including this comment! ?>26 27 25 <?php if ( have_comments() ) : ?> 28 <h2 class="comments-title">29 <?php30 printf( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'wporg' ),31 number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );32 ?>33 </h2>34 35 26 <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> 36 27 <nav id="comment-nav-above" class="comment-navigation" role="navigation"> … … 63 54 <?php endif; // have_comments() ?> 64 55 65 <?php 66 // If comments are closed and there are comments, let's leave a little note, shall we? 67 if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : 68 ?> 69 <p class="no-comments"><?php _e( 'Comments are closed.', 'wporg' ); ?></p> 70 <?php endif; ?> 56 <p id="add-example" style="display:none;"><a href=""><?php _e( 'Have an example to add?', 'wporg' ); ?></a></p> 71 57 72 <?php comment_form(); ?> 58 <?php comment_form( array( 59 '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>', 60 'comment_notes_after' => '<p class="examples-are-gpl">' . 61 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' ) . 62 '</p><p>' . 63 __( 'The entirety of your submission is considered a code example. Any included non-code text should be formatted as code comments.', 'wporg' ) . 64 '</p>', 65 'label_submit' => __( 'Add Example', 'wporg' ), 66 '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>', 67 'title_reply' => '', //'Add Example' 68 ) ); ?> 73 69 74 70 </div><!-- #comments --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php
r714 r724 96 96 <h2><?php _e( 'Learn More', 'wporg' ); ?></h2> 97 97 </section> 98 <hr/>99 <section class="examples">100 <h2><?php _e( 'Examples', 'wporg' ); ?></h2>101 </section>102 98 */ ?> 103 99 … … 145 141 <?php endif; ?> 146 142 143 <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog() ) ) : ?> 144 <hr/> 145 <section class="examples"> 146 <h2><?php _e( 'Examples', 'wporg' ); ?></h2> 147 <?php get_template_part( 'code-example' ); ?> 148 </section> 149 <?php endif; ?> 150 147 151 <?php endif; ?> 148 152 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php
r687 r724 82 82 <h2><?php _e( 'Learn More', 'wporg' ); ?></h2> 83 83 </section> 84 */ ?> 85 86 <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog() ) ) : ?> 84 87 <hr/> 85 88 <section class="examples"> 86 89 <h2><?php _e( 'Examples', 'wporg' ); ?></h2> 90 <?php get_template_part( 'code-example' ); ?> 87 91 </section> 88 */ ?> 92 <?php endif; ?> 93 89 94 <?php endif; ?> 90 95 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r688 r724 55 55 56 56 // Temporarily disable comments 57 add_filter( 'comments_open', '__return_false' );57 //add_filter( 'comments_open', '__return_false' ); 58 58 59 59 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items', 10, 2 ); 60 61 treat_comments_as_examples(); 60 62 } 61 63 … … 350 352 } 351 353 352 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 353 wp_enqueue_script( 'comment-reply' ); 354 } 355 } 354 if ( is_singular() && comments_open() ) { 355 wp_enqueue_script( 'wporg-developer-code-examples', get_template_directory_uri() . '/js/code-example.js', array(), '20140423', true ); 356 if ( get_option( 'thread_comments' ) ) { 357 wp_enqueue_script( 'comment-reply' ); 358 } 359 } 360 } 361 362 /** 363 * Handles adding/removing hooks to enable comments as examples. 364 * 365 * Mostly gives users greater permissions in terms of comment content. 366 * 367 * In order to submit code examples, users must be able to post with less restrictions. 368 */ 369 function treat_comments_as_examples() { 370 // Restricts commenting to logged in users. 371 add_filter( 'comments_open', __NAMESPACE__ . '\\prevent_invalid_comment_submissions', 10, 2 ); 372 373 if ( ! current_user_can( 'unfiltered_html' ) ) { 374 remove_filter( 'pre_comment_content', 'wp_filter_kses' ); 375 add_filter( 'pre_comment_content', 'wp_filter_post_kses' ); 376 } 377 378 // Force comment registration to be true 379 add_filter( 'pre_option_comment_registration', '__return_true' ); 380 381 // Force comment moderation to be true 382 add_filter( 'pre_option_comment_moderation', '__return_true' ); 383 384 // Remove reply to link 385 add_filter( 'comment_reply_link', '__return_empty_string' ); 386 387 /* foreach ( array( 'comment_save_pre', 'pre_comment_content' ) as $filter ) { 388 add_filter( $filter, 'balanceTags', 50 ); 389 }*/ 390 391 remove_filter( 'comment_text', 'capital_P_dangit', 31 ); 392 393 remove_filter( 'comment_text', 'wptexturize' ); 394 remove_filter( 'comment_text', 'convert_chars' ); 395 remove_filter( 'comment_text', 'make_clickable', 9 ); 396 remove_filter( 'comment_text', 'force_balance_tags', 25 ); 397 remove_filter( 'comment_text', 'convert_smilies', 20 ); 398 remove_filter( 'comment_text', 'wpautop', 30 ); 399 400 remove_filter( 'pre_comment_content', 'wp_rel_nofollow', 15 ); 401 } 402 403 /** 404 * Disables commenting to invalid or non-users. 405 * 406 * @param bool $status Default commenting status for post. 407 * @return bool False if commenter isn't a user, otherwise the passed in status. 408 */ 409 function prevent_invalid_comment_submissions( $status, $post_id ) { 410 if ( $_POST && ( ! is_user_logged_in() || ! is_user_member_of_blog() ) ) { 411 return false; 412 } 413 414 return $status; 415 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r722 r724 93 93 <li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>> 94 94 <article id="div-comment-<?php comment_ID(); ?>" class="comment-body"> 95 <div class="comment-content code-example-container"> 96 <pre class="brush: php; toolbar: false;"><?php echo htmlentities( get_comment_text() ); ?></pre> 97 </div> 98 <!-- .comment-content --> 99 95 100 <footer class="comment-meta"> 96 101 <div class="comment-author vcard"> 102 <span class="comment-author-attribution"> 97 103 <?php if ( 0 != $args['avatar_size'] ) { 98 104 echo get_avatar( $comment, $args['avatar_size'] ); 99 105 } ?> 100 <?php printf( __( '%s <span class="says">says:</span>', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> 101 </div> 102 <!-- .comment-author --> 103 104 <div class="comment-metadata"> 105 <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> 106 107 <?php 108 // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter 109 if ( $comment->user_id ) { 110 $commenter = get_user_by( 'id', $comment->user_id ); 111 $url = 'https://profiles.wordpress.org/' . esc_attr( $commenter->user_nicename ) . '/'; 112 $author = get_the_author_meta( 'display_name', $comment->user_id ); 113 $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>$author</a>"; 114 } else { 115 $comment_author_link = ''; 116 } 117 printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) ); 118 ?> 119 120 </span> 121 — 122 Added on <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> 106 123 <time datetime="<?php comment_time( 'c' ); ?>"> 107 124 <?php printf( _x( '%1$s at %2$s', '1: date, 2: time', 'wporg' ), get_comment_date(), get_comment_time() ); ?> … … 113 130 114 131 <?php if ( '0' == $comment->comment_approved ) : ?> 115 <p class="comment-awaiting-moderation"><?php _e( 'Your commentis awaiting moderation.', 'wporg' ); ?></p>132 <p class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></p> 116 133 <?php endif; ?> 117 134 </footer> 118 135 <!-- .comment-meta --> 119 120 <div class="comment-content">121 <?php comment_text(); ?>122 </div>123 <!-- .comment-content -->124 136 125 137 <?php -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss
r687 r724 899 899 list-style: none; 900 900 margin: 0 0 1.5em 0; 901 border-top: 1px solid #eee;902 901 padding: 0; 903 902 } … … 906 905 padding: 24px 24px 0 24px; 907 906 padding: 1.5rem 1.5rem 0 1.5rem; 908 border: 1pxsolid #eee;909 border- top: none;907 border: 0 solid #eee; 908 border-bottom-width: 1px; 910 909 background: #fff; 910 } 911 912 .comment-list li:first-child { 913 padding-top: 0; 911 914 } 912 915 … … 915 918 width: 2.5em; 916 919 height: 2.5em; 917 margin: 01em 0.5em 0;920 margin: -0.5em 1em 0.5em 0; 918 921 padding: 0.125em; 919 922 border: 1px solid #eee; 923 } 924 925 .comment-author-attribution { 926 font-weight: bold; 920 927 } 921 928 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single.php
r594 r724 20 20 <?php //wporg_developer_post_nav(); ?> 21 21 22 <?php23 // If comments are open or we have at least one comment, load up the comment template24 if ( comments_open() || '0' != get_comments_number() ) :25 comments_template();26 endif;27 ?>28 29 22 <?php endwhile; // end of the loop. ?> 30 23 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css
r687 r724 1101 1101 list-style: none; 1102 1102 margin: 0 0 1.5em 0; 1103 border-top: 1px solid #eee;1104 1103 padding: 0; 1105 1104 } … … 1107 1106 padding: 24px 24px 0 24px; 1108 1107 padding: 1.5rem 1.5rem 0 1.5rem; 1109 border: 1pxsolid #eee;1110 border- top: none;1108 border: 0 solid #eee; 1109 border-bottom-width: 1px; 1111 1110 background: #fff; 1111 } 1112 .devhub-wrap .comment-list li { 1113 padding-top: 0; 1112 1114 } 1113 1115 .devhub-wrap .comment-list .avatar { … … 1115 1117 width: 2.5em; 1116 1118 height: 2.5em; 1117 margin: 01em 0.5em 0;1119 margin: -0.5em 1em 0.5em 0; 1118 1120 padding: 0.125em; 1119 1121 border: 1px solid #eee; 1122 } 1123 .devhub-wrap .comment-author-attribution { 1124 font-weight: bold; 1120 1125 } 1121 1126 .devhub-wrap .comment-meta {
Note: See TracChangeset
for help on using the changeset viewer.