Changeset 768
- Timestamp:
- 07/29/2014 06:57:54 PM (11 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php
r724 r768 40 40 * See wporg_developer_comment() in inc/template-tags.php for more. 41 41 */ 42 wp_list_comments( array( 'callback' => 'wporg_developer_ comment' ) );42 wp_list_comments( array( 'callback' => 'wporg_developer_example' ) ); 43 43 ?> 44 44 </ol><!-- .comment-list --> … … 53 53 54 54 <?php endif; // have_comments() ?> 55 56 <?php if ( DevHub\can_user_post_example( false, get_the_ID() ) ) : ?> 55 57 56 58 <p id="add-example" style="display:none;"><a href=""><?php _e( 'Have an example to add?', 'wporg' ); ?></a></p> … … 68 70 ) ); ?> 69 71 72 <?php endif; ?> 73 70 74 </div><!-- #comments --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php
r725 r768 141 141 <?php endif; ?> 142 142 143 <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog()) ) : ?>143 <?php if ( comments_open() || '0' != get_comments_number() ) : ?> 144 144 <hr/> 145 145 <section class="examples"> 146 146 <h2><?php _e( 'Examples', 'wporg' ); ?></h2> 147 <?php get_template_part( 'code-example' );?>147 <?php comments_template(); /* TODO: add '/examples.php' */ ?> 148 148 </section> 149 149 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php
r724 r768 84 84 */ ?> 85 85 86 <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog()) ) : ?>86 <?php if ( comments_open() || '0' != get_comments_number() ) : ?> 87 87 <hr/> 88 88 <section class="examples"> 89 89 <h2><?php _e( 'Examples', 'wporg' ); ?></h2> 90 <?php get_template_part( 'code-example' );?>90 <?php comments_template(); /* TODO: add '/examples.php' */ ?> 91 91 </section> 92 92 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r752 r768 57 57 add_filter( 'the_excerpt', __NAMESPACE__ . '\\lowercase_P_dangit_just_once' ); 58 58 add_filter( 'the_content', __NAMESPACE__ . '\\make_doclink_clickable', 10, 5 ); 59 add_filter( 'comments_open', __NAMESPACE__ . '\\can_user_post_example', 10, 2 ); 59 60 60 61 // Temporarily disable comments … … 350 351 wp_enqueue_script( 'wporg-developer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); 351 352 352 if ( is_singular() && comments_open() ) {353 if ( is_singular() && ( '0' != get_comments_number() || post_type_has_source_code() ) ) { 353 354 wp_enqueue_script( 'wporg-developer-function-reference', get_template_directory_uri() . '/js/function-reference.js', array( 'jquery', 'syntaxhighlighter-core', 'syntaxhighlighter-brush-php' ), '20140515', true ); 354 355 wp_enqueue_style( 'syntaxhighlighter-core' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r751 r768 73 73 endif; 74 74 75 if ( ! function_exists( 'wporg_developer_ comment' ) ) :75 if ( ! function_exists( 'wporg_developer_example' ) ) : 76 76 /** 77 * Template for comments and pingbacks.77 * Template for examples. 78 78 * 79 * Used as a callback by wp_list_comments() for displaying the comments.79 * Used as a callback by wp_list_comments() for displaying the examples. 80 80 */ 81 function wporg_developer_ comment( $comment, $args, $depth ) {81 function wporg_developer_example( $comment, $args, $depth ) { 82 82 $GLOBALS['comment'] = $comment; 83 83 … … 753 753 } 754 754 755 /** 756 * Indicates if the current user can post an example. 757 * 758 * This only affects post types wp-parser-* as they are the only things 759 * that can have examples. 760 * 761 * A custom check can be performed by hooking the filter 762 * 'wporg_devhub-can_user_post_example' and returning a 763 * value other than null. 764 * 765 * By default, the ability to post examples is restricted to members of the 766 * blog. 767 * 768 * @param int $post_id The post ID. 769 * 770 * @return bool True if the user can post an example. 771 */ 772 function can_user_post_example( $open, $post_id ) { 773 774 // Only proceed if the post type is one that has examples. 775 if ( 0 !== strpos( get_post_type( (int) $post_id ), 'wp-parser-' ) ) { 776 // Temporarily disable commenting that isn't for an example since various 777 // changes need to take place to enable regular commenting. 778 return false; //$open; 779 } 780 781 // Permit default logic to be overridden via filter that returns value other than null. 782 if ( null !== ( $can = apply_filters( 'wporg_devhub-can_user_post_example', null, $post_id ) ) ) { 783 return $can; 784 } 785 786 // Default to limiting ability to post examples to members of the blog. 787 return is_user_member_of_blog(); 788 } 789 755 790 }
Note: See TracChangeset
for help on using the changeset viewer.