Making WordPress.org


Ignore:
Timestamp:
07/30/2014 09:45:32 PM (11 years ago)
Author:
coffee2code
Message:

Code Reference: permit examples to contain any markup

  • Add post_type_supports_examples()
  • Permit examples to have any content
  • Fully escape content of examples via 'get_comment_text'
File:
1 edited

Legend:

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

    r768 r771  
    9494                <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    9595                    <div class="comment-content code-example-container">
    96                         <pre class="brush: php; toolbar: false;"><?php echo htmlentities( get_comment_text() ); ?></pre>
     96                        <pre class="brush: php; toolbar: false;"><?php comment_text(); /* Fully escaped via filter */ ?></pre>
    9797                    </div>
    9898                    <!-- .comment-content -->
     
    671671
    672672    /**
     673     * Does the post type support having examples?
     674     *
     675     * @param  string  Optional. The post type name. If blank, assumes current post type.
     676     *
     677     * @return boolean
     678     */
     679    function post_type_supports_examples( $post_type = null ) {
     680        $post_type = $post_type ? $post_type : get_post_type();
     681
     682        return ( 0 === strpos( $post_type, 'wp-parser-' ) );
     683    }
     684
     685    /**
    673686     * Retrieve the root directory of the parsed WP code.
    674687     *
Note: See TracChangeset for help on using the changeset viewer.