Changeset 8711 for trunk/src/bp-activity/bp-activity-functions.php
- Timestamp:
- 07/29/2014 01:28:41 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r8710 r8711 18 18 * @since BuddyPress (1.5.0) 19 19 * 20 * @global object $bp BuddyPress global settings21 *22 20 * @return bool True if activity directory page is found, otherwise false. 23 21 */ 24 22 function bp_activity_has_directory() { 25 global $bp; 26 27 return (bool) !empty( $bp->pages->activity->id ); 23 return (bool) !empty( buddypress()->pages->activity->id ); 28 24 } 29 25 … … 79 75 80 76 // We've found some mentions! Check to see if users exist 81 foreach( (array) $usernames as $key =>$username ) {77 foreach( (array) array_values( $usernames ) as $username ) { 82 78 $user_id = bp_activity_get_userid_from_mentionname( $username ); 83 79 84 80 // user ID exists, so let's add it to our array 85 81 if ( ! empty( $user_id ) ) { 86 $mentioned_users[ $user_id] = $username;82 $mentioned_users[ $user_id ] = $username; 87 83 } 88 84 } … … 144 140 145 141 // Increment mention count foreach mentioned user 146 foreach( (array) $usernames as $user_id => $username) {142 foreach( (array) array_keys( $usernames ) as $user_id ) { 147 143 bp_activity_update_mention_count_for_user( $user_id, $activity_id, $action ); 148 144 } … … 1202 1198 $activity->hide_sitewide = $r['hide_sitewide']; 1203 1199 $activity->is_spam = $r['is_spam']; 1204 $activity->action = ! empty( $r['action'] ) ? $r['action'] : bp_activity_generate_action_string( $activity ); 1205 1206 if ( !$activity->save() ) 1207 return false; 1200 $activity->action = ! empty( $r['action'] ) 1201 ? $r['action'] 1202 : bp_activity_generate_action_string( $activity ); 1203 1204 if ( ! $activity->save() ) { 1205 return false; 1206 } 1208 1207 1209 1208 // If this is an activity comment, rebuild the tree 1210 if ( 'activity_comment' == $activity->type ) {1209 if ( 'activity_comment' === $activity->type ) { 1211 1210 BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id ); 1212 1211 } … … 1627 1626 * @param int $comment_id The ID of the comment to be deleted. 1628 1627 */ 1629 function bp_activity_delete_children( $activity_id, $comment_id) { 1628 function bp_activity_delete_children( $activity_id, $comment_id ) { 1629 1630 // Get activity children to delete 1631 $children = BP_Activity_Activity::get_child_comments( $comment_id ); 1632 1630 1633 // Recursively delete all children of this comment. 1631 if ( $children = BP_Activity_Activity::get_child_comments( $comment_id) ) {1634 if ( ! empty( $children ) ) { 1632 1635 foreach( (array) $children as $child ) { 1633 1636 bp_activity_delete_children( $activity_id, $child->id ); 1634 1637 } 1635 1638 } 1636 bp_activity_delete( array( 'secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id ) ); 1639 1640 // Delete the comment itself 1641 bp_activity_delete( array( 1642 'secondary_item_id' => $comment_id, 1643 'type' => 'activity_comment', 1644 'item_id' => $activity_id 1645 ) ); 1637 1646 } 1638 1647 … … 1710 1719 * @param string $link Optional. The unescaped URL that the image should link 1711 1720 * to. If absent, the image will not be a link. 1712 * @param array $a ctivity_args Optional. The args passed to the activity1721 * @param array $args Optional. The args passed to the activity 1713 1722 * creation function (eg bp_blogs_record_activity()). 1714 1723 * @return string $content The content with images stripped and replaced with a … … 1723 1732 1724 1733 if ( !empty( $matches ) && !empty( $matches[0] ) ) { 1734 1725 1735 // Get the SRC value 1726 1736 preg_match( '/<img.*?(src\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $src );
Note: See TracChangeset
for help on using the changeset viewer.