Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/12/2015 05:45:14 AM (10 years ago)
Author:
tw2113
Message:

Further documentation cleanup for Activity Component.

See #6396.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/classes/class-bp-activity-feed.php

    r10248 r10253  
    11<?php
    22/**
    3  * BuddyPress Activity Classes
     3 * BuddyPress Activity Classes.
    44 *
    55 * @package BuddyPress
     
    77 */
    88
    9 // Exit if accessed directly
     9// Exit if accessed directly.
    1010defined( 'ABSPATH' ) || exit;
    1111
     
    1616 * the appropriate screen.
    1717 *
     18 * @since 1.8.0
     19 *
    1820 * See {@link bp_activity_action_sitewide_feed()} as an example.
    1921 *
    2022 * @param array $args {
    21  *   @type string $id               Required. Internal id for the feed; should be alphanumeric only.
     23 *   @type string $id               Required. Internal id for the feed; should be alphanumeric only.
    2224 *   @type string $title            Optional. RSS feed title.
    2325 *   @type string $link             Optional. Relevant link for the RSS feed.
     
    3133 *   @type array  $activity_args    Optional. Arguments passed to {@link bp_has_activities()}
    3234 * }
    33  * @since 1.8.0
    3435 */
    3536class BP_Activity_Feed {
     
    4950     * Magic method for checking the existence of a certain data variable.
    5051     *
    51      * @param string $key
     52     * @param string $key Property to check.
    5253     *
    5354     * @return bool Whether or not data variable exists.
     
    5859     * Magic method for getting a certain data variable.
    5960     *
    60      * @param string $key
     61     * @param string $key Property to get.
    6162     *
    6263     * @return mixed Data in variable if available or null.
     
    9192            global $wp_query;
    9293
    93             // set feed flag to false
     94            // Set feed flag to false.
    9495            $wp_query->is_feed = false;
    9596
     
    9798        }
    9899
    99         // Setup data
     100        // Setup data.
    100101        $this->data = wp_parse_args( $args, array(
    101             // Internal identifier for the RSS feed - should be alphanumeric only
     102            // Internal identifier for the RSS feed - should be alphanumeric only.
    102103            'id'               => '',
    103104
    104             // RSS title - should be plain-text
     105            // RSS title - should be plain-text.
    105106            'title'            => '',
    106107
    107             // relevant link for the RSS feed
     108            // Relevant link for the RSS feed.
    108109            'link'             => '',
    109110
    110             // RSS description - should be plain-text
     111            // RSS description - should be plain-text.
    111112            'description'      => '',
    112113
     
    114115            // requests it again.  This is only acknowledged if the RSS client supports it
    115116            //
    116             // See: http://www.rssboard.org/rss-profile#element-channel-ttl
    117             //      http://www.kbcafe.com/rss/rssfeedstate.html#ttl
     117            // See: http://www.rssboard.org/rss-profile#element-channel-ttl.
     118            // See: http://www.kbcafe.com/rss/rssfeedstate.html#ttl.
    118119            'ttl'              => '30',
    119120
     
    121122            // clients
    122123            //
    123             // See: http://web.resource.org/rss/1.0/modules/syndication/#description
    124             //      http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule
     124            // See: http://web.resource.org/rss/1.0/modules/syndication/#description.
     125            // See: http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule.
    125126            'update_period'    => 'hourly',
    126127            'update_frequency' => 2,
    127128
    128             // Number of items to display
     129            // Number of items to display.
    129130            'max'              => 50,
    130131
    131             // Activity arguments passed to bp_has_activities()
     132            // Activity arguments passed to bp_has_activities().
    132133            'activity_args'    => array()
    133134        ) );
     
    142143        do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
    143144
    144         // Setup class properties
     145        // Setup class properties.
    145146        $this->setup_properties();
    146147
    147         // Check if id is valid
     148        // Check if id is valid.
    148149        if ( empty( $this->id ) ) {
    149150            _doing_it_wrong( 'BP_Activity_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
     
    160161        do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
    161162
    162         // Setup feed hooks
     163        // Setup feed hooks.
    163164        $this->setup_hooks();
    164165
    165         // Output the feed
     166        // Output the feed.
    166167        $this->output();
    167168
    168         // Kill the rest of the output
     169        // Kill the rest of the output.
    169170        die();
    170171    }
     
    242243        switch ( $this->id ) {
    243244
    244             // sitewide and friends feeds use the 'personal' hook
     245            // Sitewide and friends feeds use the 'personal' hook.
    245246            case 'sitewide' :
    246247            case 'friends' :
     
    275276        switch ( $this->id ) {
    276277
    277             // also output parent activity item if we're on a specific feed
     278            // Also output parent activity item if we're on a specific feed.
    278279            case 'favorites' :
    279280            case 'friends' :
     
    300301     */
    301302    protected function http_headers() {
    302         // set up some additional headers if not on a directory page
    303         // this is done b/c BP uses pseudo-pages
     303        // Set up some additional headers if not on a directory page
     304        // this is done b/c BP uses pseudo-pages.
    304305        if ( ! bp_is_directory() ) {
    305306            global $wp_query;
     
    309310        }
    310311
    311         // Set content-type
     312        // Set content-type.
    312313        @header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
    313314        send_nosniff_header();
    314315
    315         // Cache-related variables
     316        // Cache-related variables.
    316317        $last_modified      = mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false );
    317318        $modified_timestamp = strtotime( $last_modified );
    318319        $etag               = md5( $last_modified );
    319320
    320         // Set cache-related headers
     321        // Set cache-related headers.
    321322        @header( 'Last-Modified: ' . $last_modified );
    322323        @header( 'Pragma: no-cache' );
    323324        @header( 'ETag: ' . '"' . $etag . '"' );
    324325
    325         // First commit of BuddyPress! (Easter egg)
     326        // First commit of BuddyPress! (Easter egg).
    326327        @header( 'Expires: Tue, 25 Mar 2008 17:13:55 GMT');
    327328
    328         // Get ETag from supported user agents
     329        // Get ETag from supported user agents.
    329330        if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) {
    330331            $client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );
    331332
    332             // Remove quotes from ETag
     333            // Remove quotes from ETag.
    333334            $client_etag = trim( $client_etag, '"' );
    334335
    335             // Strip suffixes from ETag if they exist (eg. "-gzip")
     336            // Strip suffixes from ETag if they exist (eg. "-gzip").
    336337            $etag_suffix_pos = strpos( $client_etag, '-' );
    337338            if ( ! empty( $etag_suffix_pos ) ) {
     
    339340            }
    340341
    341         // No ETag found
     342        // No ETag found.
    342343        } else {
    343344            $client_etag = false;
    344345        }
    345346
    346         // Get client last modified timestamp from supported user agents
     347        // Get client last modified timestamp from supported user agents.
    347348        $client_last_modified      = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
    348349        $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;
    349350
    350         // Set 304 status if feed hasn't been updated since last fetch
     351        // Set 304 status if feed hasn't been updated since last fetch.
    351352        if ( ( $client_last_modified && $client_etag ) ?
    352353                 ( ( $client_modified_timestamp >= $modified_timestamp ) && ( $client_etag == $etag ) ) :
     
    357358        }
    358359
    359         // If feed hasn't changed as reported by the user agent, set 304 status header
     360        // If feed hasn't changed as reported by the user agent, set 304 status header.
    360361        if ( ! empty( $status ) ) {
    361362            status_header( $status );
    362363
    363             // cached response, so stop now!
     364            // Cached response, so stop now!
    364365            if ( $status == 304 ) {
    365366                exit();
Note: See TracChangeset for help on using the changeset viewer.