- Timestamp:
- 02/13/2016 08:21:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-activity.php
r10560 r10588 13 13 /** 14 14 * Database interaction class for the BuddyPress activity component. 15 *16 15 * Instance methods are available for creating/editing an activity, 17 16 * static methods for querying activities. … … 26 25 * ID of the activity item. 27 26 * 27 * @since 1.0.0 28 28 * @var int 29 29 */ … … 33 33 * ID of the associated item. 34 34 * 35 * @since 1.0.0 35 36 * @var int 36 37 */ … … 40 41 * ID of the associated secondary item. 41 42 * 43 * @since 1.0.0 42 44 * @var int 43 45 */ … … 47 49 * ID of user associated with the activity item. 48 50 * 51 * @since 1.0.0 49 52 * @var int 50 53 */ … … 54 57 * The primary URL for the activity in RSS feeds. 55 58 * 59 * @since 1.0.0 56 60 * @var string 57 61 */ … … 61 65 * BuddyPress component the activity item relates to. 62 66 * 67 * @since 1.2.0 63 68 * @var string 64 69 */ … … 68 73 * Activity type, eg 'new_blog_post'. 69 74 * 75 * @since 1.2.0 70 76 * @var string 71 77 */ … … 75 81 * Description of the activity, eg 'Alex updated his profile.'. 76 82 * 83 * @since 1.2.0 77 84 * @var string 78 85 */ … … 82 89 * The content of the activity item. 83 90 * 91 * @since 1.2.0 84 92 * @var string 85 93 */ … … 89 97 * The date the activity item was recorded, in 'Y-m-d h:i:s' format. 90 98 * 99 * @since 1.0.0 91 100 * @var string 92 101 */ … … 96 105 * Whether the item should be hidden in sitewide streams. 97 106 * 107 * @since 1.1.0 98 108 * @var int 99 109 */ … … 103 113 * Node boundary start for activity or activity comment. 104 114 * 115 * @since 1.5.0 105 116 * @var int 106 117 */ … … 110 121 * Node boundary end for activity or activity comment. 111 122 * 123 * @since 1.5.0 112 124 * @var int 113 125 */ … … 117 129 * Whether this item is marked as spam. 118 130 * 131 * @since 1.6.0 119 132 * @var int 120 133 */ … … 123 136 /** 124 137 * Constructor method. 138 * 139 * @since 1.5.0 125 140 * 126 141 * @param int|bool $id Optional. The ID of a specific activity item. … … 135 150 /** 136 151 * Populate the object with data about the specific activity item. 152 * 153 * @since 1.0.0 137 154 */ 138 155 public function populate() { … … 170 187 $this->action = $action; 171 188 172 // If no callback is available, use the literal string from173 // the database row.189 // If no callback is available, use the literal string from 190 // the database row. 174 191 } elseif ( ! empty( $row->action ) ) { 175 192 $this->action = $row->action; 176 193 177 // Provide a fallback to avoid PHP notices.194 // Provide a fallback to avoid PHP notices. 178 195 } else { 179 196 $this->action = ''; … … 183 200 /** 184 201 * Save the activity item to the database. 202 * 203 * @since 1.0.0 185 204 * 186 205 * @return bool True on success. … … 240 259 $this->id = $wpdb->insert_id; 241 260 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. 243 262 } else { 244 263 add_filter( 'bp_activity_at_name_do_notifications', '__return_false' ); … … 262 281 * Get activity items, as specified by parameters. 263 282 * 264 * @since 1. 0.0283 * @since 1.2.0 265 284 * @since 2.4.0 Introduced the `$fields` parameter. 266 285 * … … 373 392 } 374 393 375 // Advanced filtering.394 // Advanced filtering. 376 395 } elseif ( ! empty( $r['filter_query'] ) ) { 377 396 $filter_query = new BP_Activity_Query( $r['filter_query'] ); … … 894 913 $scopes = $scope; 895 914 896 // Explode a comma separated string of scopes.915 // Explode a comma separated string of scopes. 897 916 } elseif ( is_string( $scope ) ) { 898 917 $scopes = explode( ',', $scope ); … … 926 945 * @since 2.2.0 927 946 * 928 * 947 * @param array { 929 948 * Activity query clauses. 930 949 * @type array { … … 932 951 * See {@link BP_Activity_Query::_construct()} for more details. 933 952 * } 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 * } 935 955 * } 936 956 * @param array $r Current activity arguments passed in BP_Activity_Activity::get(). … … 996 1016 /** 997 1017 * Get the first activity ID that matches a set of criteria. 1018 * 1019 * @since 1.2.0 998 1020 * 999 1021 * @todo Should parameters be optional? … … 1237 1259 * 1238 1260 * @since 1.2.0 1261 * 1239 1262 * @deprecated 2.3.0 1240 1263 * 1241 1264 * @param array $activity_ids Activity IDs whose comments should be deleted. 1242 1265 * @param bool $delete_meta Should we delete the activity meta items for these comments. 1243 *1244 1266 * @return bool True on success. 1245 1267 */ … … 1340 1362 $comments = false; 1341 1363 1342 // A true cache miss.1364 // A true cache miss. 1343 1365 } elseif ( empty( $comments ) ) { 1344 1366 … … 1351 1373 $fullname_where = "AND pd.user_id = a.user_id AND pd.field_id = 1"; 1352 1374 1353 // Prevent debug errors.1375 // Prevent debug errors. 1354 1376 } else { 1355 1377 $fullname_select = $fullname_from = $fullname_where = ''; … … 1394 1416 $descendants = $wpdb->get_results( $sql ); 1395 1417 1396 // We use the mptt BETWEEN clause to limit returned1397 // 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. 1398 1420 } else { 1399 1421 $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 ); … … 1415 1437 $ref[ $d->id ] =& $ref[ $d->secondary_item_id ]->children[ $d->id ]; 1416 1438 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. 1418 1440 } else { 1419 1441 $comments[ $d->id ] = $d; … … 1478 1500 * @global wpdb $wpdb WordPress database object. 1479 1501 * 1480 * @param 1481 * @param 1482 * @return int Right 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. 1483 1505 */ 1484 1506 public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) { … … 1532 1554 * Get a list of components that have recorded activity associated with them. 1533 1555 * 1556 * @since 1.2.0 1557 * 1534 1558 * @param bool $skip_last_activity If true, components will not be 1535 1559 * included if the only activity type associated with them is … … 1556 1580 * Get sitewide activity items for use in an RSS feed. 1557 1581 * 1582 * @since 1.0.0 1583 * 1558 1584 * @param int $limit Optional. Number of items to fetch. Default: 35. 1559 1585 * @return array $activity_feed List of activity items, with RSS data added. … … 1619 1645 * Fields and values to filter by. 1620 1646 * 1621 * @type array|string|int $user_id User ID(s).1647 * @type array|string|int $user_id User ID(s). 1622 1648 * @type array|string $object Corresponds to the 'component' 1623 1649 * column in the database. … … 1728 1754 * Check whether an activity item exists with a given string content. 1729 1755 * 1756 * @since 1.1.0 1757 * 1730 1758 * @param string $content The content to filter by. 1731 1759 * @return int|bool The ID of the first matching item if found, otherwise false. … … 1741 1769 /** 1742 1770 * Hide all activity for a given user. 1771 * 1772 * @since 1.2.0 1743 1773 * 1744 1774 * @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.