Skip to:
Content

BuddyPress.org

Changeset 10588


Ignore:
Timestamp:
02/13/2016 08:21:29 PM (10 years ago)
Author:
tw2113
Message:

More @since tags and some doc cleanup for BP-Activty-Activity class.

See #6396.

File:
1 edited

Legend:

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

    r10560 r10588  
    1313/**
    1414 * Database interaction class for the BuddyPress activity component.
    15  *
    1615 * Instance methods are available for creating/editing an activity,
    1716 * static methods for querying activities.
     
    2625         * ID of the activity item.
    2726         *
     27         * @since 1.0.0
    2828         * @var int
    2929         */
     
    3333         * ID of the associated item.
    3434         *
     35         * @since 1.0.0
    3536         * @var int
    3637         */
     
    4041         * ID of the associated secondary item.
    4142         *
     43         * @since 1.0.0
    4244         * @var int
    4345         */
     
    4749         * ID of user associated with the activity item.
    4850         *
     51         * @since 1.0.0
    4952         * @var int
    5053         */
     
    5457         * The primary URL for the activity in RSS feeds.
    5558         *
     59         * @since 1.0.0
    5660         * @var string
    5761         */
     
    6165         * BuddyPress component the activity item relates to.
    6266         *
     67         * @since 1.2.0
    6368         * @var string
    6469         */
     
    6873         * Activity type, eg 'new_blog_post'.
    6974         *
     75         * @since 1.2.0
    7076         * @var string
    7177         */
     
    7581         * Description of the activity, eg 'Alex updated his profile.'.
    7682         *
     83         * @since 1.2.0
    7784         * @var string
    7885         */
     
    8289         * The content of the activity item.
    8390         *
     91         * @since 1.2.0
    8492         * @var string
    8593         */
     
    8997         * The date the activity item was recorded, in 'Y-m-d h:i:s' format.
    9098         *
     99         * @since 1.0.0
    91100         * @var string
    92101         */
     
    96105         * Whether the item should be hidden in sitewide streams.
    97106         *
     107         * @since 1.1.0
    98108         * @var int
    99109         */
     
    103113         * Node boundary start for activity or activity comment.
    104114         *
     115         * @since 1.5.0
    105116         * @var int
    106117         */
     
    110121         * Node boundary end for activity or activity comment.
    111122         *
     123         * @since 1.5.0
    112124         * @var int
    113125         */
     
    117129         * Whether this item is marked as spam.
    118130         *
     131         * @since 1.6.0
    119132         * @var int
    120133         */
     
    123136        /**
    124137         * Constructor method.
     138         *
     139         * @since 1.5.0
    125140         *
    126141         * @param int|bool $id Optional. The ID of a specific activity item.
     
    135150        /**
    136151         * Populate the object with data about the specific activity item.
     152         *
     153         * @since 1.0.0
    137154         */
    138155        public function populate() {
     
    170187                        $this->action = $action;
    171188
    172                 // If no callback is available, use the literal string from
    173                 // the database row.
     189                        // If no callback is available, use the literal string from
     190                        // the database row.
    174191                } elseif ( ! empty( $row->action ) ) {
    175192                        $this->action = $row->action;
    176193
    177                 // Provide a fallback to avoid PHP notices.
     194                        // Provide a fallback to avoid PHP notices.
    178195                } else {
    179196                        $this->action = '';
     
    183200        /**
    184201         * Save the activity item to the database.
     202         *
     203         * @since 1.0.0
    185204         *
    186205         * @return bool True on success.
     
    240259                        $this->id = $wpdb->insert_id;
    241260
    242                 // If an existing activity item, prevent any changes to the content generating new @mention notifications.
     261                        // If an existing activity item, prevent any changes to the content generating new @mention notifications.
    243262                } else {
    244263                        add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
     
    262281         * Get activity items, as specified by parameters.
    263282         *
    264          * @since 1.0.0
     283         * @since 1.2.0
    265284         * @since 2.4.0 Introduced the `$fields` parameter.
    266285         *
     
    373392                        }
    374393
    375                 // Advanced filtering.
     394                        // Advanced filtering.
    376395                } elseif ( ! empty( $r['filter_query'] ) ) {
    377396                        $filter_query = new BP_Activity_Query( $r['filter_query'] );
     
    894913                        $scopes = $scope;
    895914
    896                 // Explode a comma separated string of scopes.
     915                        // Explode a comma separated string of scopes.
    897916                } elseif ( is_string( $scope ) ) {
    898917                        $scopes = explode( ',', $scope );
     
    926945                         * @since 2.2.0
    927946                         *
    928                          *  @param array {
     947                         * @param array {
    929948                         *     Activity query clauses.
    930949                         *     @type array {
     
    932951                         *         See {@link BP_Activity_Query::_construct()} for more details.
    933952                         *     }
    934                          *     @type array $override Optional. Override existing activity arguments passed by $r.
     953                         *     @type array  $override Optional. Override existing activity arguments passed by $r.
     954                         *     }
    935955                         * }
    936956                         * @param array $r Current activity arguments passed in BP_Activity_Activity::get().
     
    9961016        /**
    9971017         * Get the first activity ID that matches a set of criteria.
     1018         *
     1019         * @since 1.2.0
    9981020         *
    9991021         * @todo Should parameters be optional?
     
    12371259         *
    12381260         * @since 1.2.0
     1261         *
    12391262         * @deprecated 2.3.0
    12401263         *
    12411264         * @param array $activity_ids Activity IDs whose comments should be deleted.
    12421265         * @param bool  $delete_meta  Should we delete the activity meta items for these comments.
    1243          *
    12441266         * @return bool True on success.
    12451267         */
     
    13401362                        $comments = false;
    13411363
    1342                 // A true cache miss.
     1364                        // A true cache miss.
    13431365                } elseif ( empty( $comments ) ) {
    13441366
     
    13511373                                $fullname_where = "AND pd.user_id = a.user_id AND pd.field_id = 1";
    13521374
    1353                         // Prevent debug errors.
     1375                                // Prevent debug errors.
    13541376                        } else {
    13551377                                $fullname_select = $fullname_from = $fullname_where = '';
     
    13941416                                $descendants = $wpdb->get_results( $sql );
    13951417
    1396                         // We use the mptt BETWEEN clause to limit returned
    1397                         // descendants to the correct part of the tree.
     1418                                // We use the mptt BETWEEN clause to limit returned
     1419                                // descendants to the correct part of the tree.
    13981420                        } else {
    13991421                                $sql = $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} a WHERE a.type = 'activity_comment' {$spam_sql} AND a.item_id = %d and a.mptt_left > %d AND a.mptt_left < %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right );
     
    14151437                                        $ref[ $d->id ] =& $ref[ $d->secondary_item_id ]->children[ $d->id ];
    14161438
    1417                                 // If we don't have a reference on the parent, put in the root level.
     1439                                        // If we don't have a reference on the parent, put in the root level.
    14181440                                } else {
    14191441                                        $comments[ $d->id ] = $d;
     
    14781500         * @global wpdb $wpdb WordPress database object.
    14791501         *
    1480          * @param  int $parent_id ID of an activity or activity comment.
    1481          * @param  int $left      Node boundary start for activity or activity comment.
    1482          * @return int Right      Node boundary of activity or activity comment.
     1502         * @param int $parent_id ID of an activity or activity comment.
     1503         * @param int $left      Node boundary start for activity or activity comment.
     1504         * @return int Right Node boundary of activity or activity comment.
    14831505         */
    14841506        public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
     
    15321554         * Get a list of components that have recorded activity associated with them.
    15331555         *
     1556         * @since 1.2.0
     1557         *
    15341558         * @param bool $skip_last_activity If true, components will not be
    15351559         *                                 included if the only activity type associated with them is
     
    15561580         * Get sitewide activity items for use in an RSS feed.
    15571581         *
     1582         * @since 1.0.0
     1583         *
    15581584         * @param int $limit Optional. Number of items to fetch. Default: 35.
    15591585         * @return array $activity_feed List of activity items, with RSS data added.
     
    16191645         *     Fields and values to filter by.
    16201646         *
    1621          *     @type array|string|int $user_id User ID(s).
     1647         *     @type array|string|int $user_id      User ID(s).
    16221648         *     @type array|string     $object       Corresponds to the 'component'
    16231649         *                                          column in the database.
     
    17281754         * Check whether an activity item exists with a given string content.
    17291755         *
     1756         * @since 1.1.0
     1757         *
    17301758         * @param string $content The content to filter by.
    17311759         * @return int|bool The ID of the first matching item if found, otherwise false.
     
    17411769        /**
    17421770         * Hide all activity for a given user.
     1771         *
     1772         * @since 1.2.0
    17431773         *
    17441774         * @param int $user_id The ID of the user whose activity you want to mark hidden.
Note: See TracChangeset for help on using the changeset viewer.