WordPress.org

Make WordPress Core

Changeset 33963


Ignore:
Timestamp:
09/09/2015 02:50:43 AM (5 years ago)
Author:
wonderboymusic
Message:

After [33891], get_comment() returns global $comment if no args are passed and the global is set (after setting the default to null here). This allows us to ditch global comment imports.

See #33638.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/comment.php

    r33891 r33963  
    157157 * @since 2.5.0
    158158 *
    159  * @global object $comment
    160  *
    161159 * @param string $name User name.
    162160 * @return string Avatar with Admin name.
    163161 */
    164162function floated_admin_avatar( $name ) {
    165     global $comment;
    166     $avatar = get_avatar( $comment, 32, 'mystery' );
     163    $avatar = get_avatar( get_comment(), 32, 'mystery' );
    167164    return "$avatar $name";
    168165}
  • trunk/src/wp-includes/comment-functions.php

    r33954 r33963  
    170170 * @return WP_Comment|array|null Depends on $output value.
    171171 */
    172 function get_comment(&$comment, $output = OBJECT) {
     172function get_comment( &$comment = null, $output = OBJECT ) {
    173173    if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
    174174        $comment = $GLOBALS['comment'];
  • trunk/src/wp-includes/comment-template.php

    r33962 r33963  
    153153 * address and use it for their own means good and bad.
    154154 *
    155  * @global object $comment The current Comment row object.
    156  *
    157155 * @since 2.7.0
    158156 *
     
    164162 */
    165163function get_comment_author_email_link( $linktext = '', $before = '', $after = '' ) {
    166     global $comment;
    167 
     164    $comment = get_comment();
    168165    /**
    169166     * Filter the comment author's email for display.
     
    605602 * @since 1.5.0
    606603 *
    607  * @global object $comment
    608  *
    609604 * @return int The comment ID.
    610605 */
    611606function get_comment_ID() {
    612     global $comment;
     607    $comment = get_comment();
    613608
    614609    /**
     
    874869 * @since 1.5.0
    875870 *
    876  * @global object $comment
    877  *
    878871 * @param string $d         Optional. The format of the time. Default user's settings.
    879872 * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
     
    883876 */
    884877function get_comment_time( $d = '', $gmt = false, $translate = true ) {
    885     global $comment;
     878    $comment = get_comment();
     879
    886880    $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
    887881    if ( '' == $d )
     
    16541648 * @since 2.7.0
    16551649 *
    1656  * @global object $comment
    1657  *
    16581650 * @param string $noreplytext  Optional. Text to display when not replying to a comment.
    16591651 *                             Default false.
     
    16651657 */
    16661658function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
    1667     global $comment;
     1659    $comment = get_comment();
    16681660
    16691661    if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
  • trunk/src/wp-includes/link-template.php

    r33891 r33963  
    13121312 * @since 1.0.0
    13131313 *
    1314  * @global object $comment
    1315  *
    13161314 * @param string $text   Optional. Anchor text.
    13171315 * @param string $before Optional. Display before edit link.
     
    13191317 */
    13201318function edit_comment_link( $text = null, $before = '', $after = '' ) {
    1321     global $comment;
     1319    $comment = get_comment();
    13221320
    13231321    if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
  • trunk/src/wp-includes/query.php

    r33925 r33963  
    38453845     * @since 2.2.0
    38463846     * @access public
    3847      * @global object $comment Current comment.
     3847     * @global WP_Comment $comment Current comment.
    38483848     */
    38493849    public function the_comment() {
Note: See TracChangeset for help on using the changeset viewer.