WordPress.org

Make WordPress Core

Changeset 27208


Ignore:
Timestamp:
02/20/2014 05:45:19 PM (8 years ago)
Author:
DrewAPicture
Message:

Inline documentation for various SQL clause hooks in wp-includes/query.php.

Covers documentation for SQL clause hooks related to comment feeds, including:

  • comment_feed_join
  • comment_feed_where
  • comment_feed_groupby
  • comment_feed_orderby
  • comment_feed_limits

Props dougwollison, DrewAPicture.
See #25514.

File:
1 edited

Legend:

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

    r27207 r27208  
    28492849
    28502850            if ( !$q['suppress_filters'] ) {
    2851                 $cjoin = apply_filters_ref_array('comment_feed_join', array( $cjoin, &$this ) );
    2852                 $cwhere = apply_filters_ref_array('comment_feed_where', array( $cwhere, &$this ) );
    2853                 $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( $cgroupby, &$this ) );
    2854                 $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    2855                 $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     2851                /**
     2852                 * Filter the JOIN clause of the comments feed query before sending.
     2853                 *
     2854                 * @since 2.2.0
     2855                 *
     2856                 * @param string   $cjoin The JOIN clause of the query.
     2857                 * @param WP_Query &$this The WP_Query instance (passed by reference).
     2858                 */
     2859                $cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
     2860
     2861                /**
     2862                 * Filter the WHERE clause of the comments feed query before sending.
     2863                 *
     2864                 * @since 2.2.0
     2865                 *
     2866                 * @param string   $cwhere The WHERE clause of the query.
     2867                 * @param WP_Query &$this  The WP_Query instance (passed by reference).
     2868                 */
     2869                $cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
     2870
     2871                /**
     2872                 * Filter the GROUP BY clause of the comments feed query before sending.
     2873                 *
     2874                 * @since 2.2.0
     2875                 *
     2876                 * @param string   $cgroupby The GROUP BY clause of the query.
     2877                 * @param WP_Query &$this    The WP_Query instance (passed by reference).
     2878                 */
     2879                $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
     2880
     2881                /**
     2882                 * Filter the ORDER BY clause of the comments feed query before sending.
     2883                 *
     2884                 * @since 2.8.0
     2885                 *
     2886                 * @param string   $corderby The ORDER BY clause of the query.
     2887                 * @param WP_Query &$this    The WP_Query instance (passed by reference).
     2888                 */
     2889                $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     2890
     2891                /**
     2892                 * Filter the LIMIT clause of the comments feed query before sending.
     2893                 *
     2894                 * @since 2.8.0
     2895                 *
     2896                 * @param string   $climits The JOIN clause of the query.
     2897                 * @param WP_Query &$this   The WP_Query instance (passed by reference).
     2898                 */
     2899                $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
    28562900            }
    28572901            $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
     
    31593203
    31603204        if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
    3161             $cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) );
    3162             $cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
    3163             $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( '', &$this ) );
     3205            /** This filter is documented in wp-includes/query.php */
     3206            $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
     3207
     3208            /** This filter is documented in wp-includes/query.php */
     3209            $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
     3210
     3211            /** This filter is documented in wp-includes/query.php */
     3212            $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
    31643213            $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    3165             $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     3214
     3215            /** This filter is documented in wp-includes/query.php */
     3216            $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    31663217            $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
    3167             $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     3218
     3219            /** This filter is documented in wp-includes/query.php */
     3220            $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     3221
    31683222            $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
    31693223            $this->comments = $wpdb->get_results($comments_request);
Note: See TracChangeset for help on using the changeset viewer.