Commit fc3ead39 authored by lechuck's avatar lechuck Committed by lechuck
Browse files

Upgrade buddypress 1.8.1

parent cda09d26
......@@ -45,14 +45,13 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
* @return bool False on failure
*/
function bp_activity_action_permalink_router() {
global $bp;
// Not viewing activity
if ( !bp_is_activity_component() || !bp_is_current_action( 'p' ) )
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'p' ) )
return false;
// No activity to display
if ( !bp_action_variable( 0 ) || !is_numeric( bp_action_variable( 0 ) ) )
if ( ! bp_action_variable( 0 ) || ! is_numeric( bp_action_variable( 0 ) ) )
return false;
// Get the activity details
......@@ -62,7 +61,6 @@ function bp_activity_action_permalink_router() {
if ( empty( $activity['activities'][0] ) ) {
bp_do_404();
return;
} else {
$activity = $activity['activities'][0];
}
......@@ -71,10 +69,10 @@ function bp_activity_action_permalink_router() {
$redirect = false;
// Redirect based on the type of activity
if ( bp_is_active( 'groups' ) && $activity->component == $bp->groups->id ) {
if ( bp_is_active( 'groups' ) && $activity->component == buddypress()->groups->id ) {
// Activity is a user update
if ( !empty( $activity->user_id ) ) {
if ( ! empty( $activity->user_id ) ) {
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
// Activity is something else
......@@ -87,20 +85,21 @@ function bp_activity_action_permalink_router() {
}
// Set redirect to users' activity stream
} else {
} else if ( ! empty( $activity->user_id ) ) {
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
}
// If set, add the original query string back onto the redirect URL
if ( !empty( $_SERVER['QUERY_STRING'] ) ) {
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
$query_frags = array();
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
}
// Allow redirect to be filtered
if ( !$redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) )
if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
bp_core_redirect( bp_get_root_domain() );
}
// Redirect to the actual activity permalink page
bp_core_redirect( $redirect );
......@@ -422,16 +421,22 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
* @return bool False on failure
*/
function bp_activity_action_sitewide_feed() {
global $bp, $wp_query;
global $bp;
if ( !bp_is_activity_component() || !bp_is_current_action( 'feed' ) || bp_is_user() || !empty( $bp->groups->current_group ) )
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
return false;
$wp_query->is_404 = false;
status_header( 200 );
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'sitewide',
/* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */
'title' => sprintf( __( '%s | Site Wide Activity', 'buddypress' ), bp_get_site_name() ),
include_once( 'feeds/bp-activity-sitewide-feed.php' );
die;
'link' => bp_get_activity_directory_permalink(),
'description' => __( 'Activity feed for the entire site.', 'buddypress' ),
'activity_args' => 'display_comments=threaded'
) );
}
add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
......@@ -448,16 +453,21 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
* @return bool False on failure
*/
function bp_activity_action_personal_feed() {
global $wp_query;
if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) )
if ( ! bp_is_user_activity() || ! bp_is_current_action( 'feed' ) ) {
return false;
}
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'personal',
$wp_query->is_404 = false;
status_header( 200 );
/* translators: Personal activity RSS title - "[Site Name] | [User Display Name] | Activity" */
'title' => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
include_once( 'feeds/bp-activity-personal-feed.php' );
die;
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() ),
'description' => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
'activity_args' => 'user_id=' . bp_displayed_user_id()
) );
}
add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
......@@ -477,16 +487,21 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
* @return bool False on failure
*/
function bp_activity_action_friends_feed() {
global $wp_query;
if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
if ( ! bp_is_active( 'friends' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_friends_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
return false;
}
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'friends',
$wp_query->is_404 = false;
status_header( 200 );
/* translators: Friends activity RSS title - "[Site Name] | [User Display Name] | Friends Activity" */
'title' => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
include_once( 'feeds/bp-activity-friends-feed.php' );
die;
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() ),
'description' => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
'activity_args' => 'scope=friends'
) );
}
add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
......@@ -506,16 +521,29 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
* @return bool False on failure
*/
function bp_activity_action_my_groups_feed() {
global $wp_query;
if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
if ( ! bp_is_active( 'groups' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_groups_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
return false;
}
$wp_query->is_404 = false;
status_header( 200 );
include_once( 'feeds/bp-activity-mygroups-feed.php' );
die;
// get displayed user's group IDs
$groups = groups_get_user_groups();
$group_ids = implode( ',', $groups['groups'] );
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'mygroups',
/* translators: Member groups activity RSS title - "[Site Name] | [User Display Name] | Groups Activity" */
'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
'description' => sprintf( __( "Public group activity feed of which %s is a member of.", 'buddypress' ), bp_get_displayed_user_fullname() ),
'activity_args' => array(
'object' => buddypress()->groups->id,
'primary_id' => $group_ids,
'display_comments' => 'threaded'
)
) );
}
add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
......@@ -533,16 +561,27 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
* @return bool False on failure
*/
function bp_activity_action_mentions_feed() {
global $wp_query;
if ( ! bp_activity_do_mentions() ) {
return false;
}
if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
if ( !bp_is_user_activity() || ! bp_is_current_action( 'mentions' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
return false;
}
$wp_query->is_404 = false;
status_header( 200 );
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'mentions',
include_once( 'feeds/bp-activity-mentions-feed.php' );
die;
/* translators: User mentions activity RSS title - "[Site Name] | [User Display Name] | Mentions" */
'title' => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/',
'description' => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
'activity_args' => array(
'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
)
) );
}
add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
......@@ -560,16 +599,25 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
* @return bool False on failure
*/
function bp_activity_action_favorites_feed() {
global $wp_query;
if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
if ( ! bp_is_user_activity() || ! bp_is_current_action( 'favorites' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
return false;
}
// get displayed user's favorite activity IDs
$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
$fav_ids = implode( ',', (array) $favs );
// setup the feed
buddypress()->activity->feed = new BP_Activity_Feed( array(
'id' => 'favorites',
$wp_query->is_404 = false;
status_header( 200 );
/* translators: User activity favorites RSS title - "[Site Name] | [User Display Name] | Favorites" */
'title' => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
include_once( 'feeds/bp-activity-favorites-feed.php' );
die;
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/',
'description' => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
'activity_args' => 'include=' . $fav_ids
) );
}
add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
......
......@@ -588,7 +588,7 @@ function bp_activity_admin_edit() {
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
<div id="post-body-content">
<div id="postdiv" class="postarea">
<div id="postdiv">
<div id="bp_activity_action" class="postbox">
<h3><?php _e( 'Action', 'buddypress' ); ?></h3>
<div class="inside">
......@@ -1127,13 +1127,13 @@ class BP_Activity_List_Table extends WP_List_Table {
* @since BuddyPress (1.6)
*/
function get_views() {
$redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'error', 'spammed', 'unspammed', 'updated', ), $_SERVER['REQUEST_URI'] );
?>
$url_base = bp_get_admin_url( 'admin.php?page=bp-activity' ); ?>
<ul class="subsubsub">
<li class="all"><a href="<?php echo esc_attr( esc_url( $redirect_to ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
<li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $redirect_to ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
<li class="all"><a href="<?php echo esc_attr( esc_url( $url_base ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
<li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
<?php do_action( 'bp_activity_list_table_get_views', $redirect_to, $this->view ); ?>
<?php do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
</ul>
<?php
}
......@@ -1224,7 +1224,7 @@ class BP_Activity_List_Table extends WP_List_Table {
* @since BuddyPress (1.6)
*/
function column_cb( $item ) {
printf( '<input type="checkbox" name="aid[]" value="%d" />', (int) $item['id'] );
printf( '<label class="screen-reader-text" for="aid-%1$d">' . __( 'Select activity item %1$d', 'buddypress' ) . '</label><input type="checkbox" name="aid[]" value="%1$d" id="aid-%1$d" />', $item['id'] );
}
/**
......@@ -1297,7 +1297,7 @@ class BP_Activity_List_Table extends WP_List_Table {
$actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
/* translators: 2: activity admin ui date/time */
printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress' ), bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $item['id'] . '/', date_i18n( get_option( 'date_format' ), strtotime( $item['date_recorded'] ) ), date_i18n( get_option( 'time_format' ), strtotime( $item['date_recorded'] ) ) );
printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress' ), bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $item['id'] . '/', get_date_from_gmt( $item['date_recorded'], get_option( 'date_format' ) ), get_date_from_gmt( $item['date_recorded'], get_option( 'time_format' ) ) );
// End timestamp
echo '</div>';
......
......@@ -32,6 +32,23 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
'meta_table' => $bp->activity->table_name_meta,
'cache_key_prefix' => 'bp_activity_meta'
);
bp_update_meta_cache( $cache_args );
}
/**
* Clear the cache for all metadata of a given activity
*
* @param int $activity_id
*/
function bp_activity_clear_meta_cache_for_activity( $activity_id ) {
global $wp_object_cache;
if ( is_object( $wp_object_cache ) && ! empty( $wp_object_cache->cache['bp'] ) ) {
foreach ( $wp_object_cache->cache['bp'] as $ckey => $cvalue ) {
if ( 0 === strpos( $ckey, 'bp_activity_meta_' . $activity_id ) ) {
wp_cache_delete( $ckey, 'bp' );
}
}
}
}
......@@ -144,6 +144,7 @@ class BP_Activity_Activity {
'sort' => 'DESC', // ASC or DESC
'exclude' => false, // Array of ids to exclude
'in' => false, // Array of ids to limit query by (IN)
'meta_query' => false, // Filter by activitymeta
'filter' => false, // See self::get_filter_sql()
'search_terms' => false, // Terms to search by
'display_comments' => false, // Whether to include activity comments
......@@ -154,10 +155,12 @@ class BP_Activity_Activity {
extract( $r );
// Select conditions
$select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
$select_sql = "SELECT DISTINCT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
$join_sql = '';
// Where conditions
$where_conditions = array();
......@@ -169,7 +172,7 @@ class BP_Activity_Activity {
// Searching
if ( $search_terms ) {
$search_terms = $wpdb->escape( $search_terms );
$search_terms = esc_sql( $search_terms );
$where_conditions['search_sql'] = "a.content LIKE '%%" . esc_sql( like_escape( $search_terms ) ) . "%%'";
}
......@@ -197,6 +200,17 @@ class BP_Activity_Activity {
$where_conditions['in'] = "a.id IN ({$in})";
}
// Process meta_query into SQL
$meta_query_sql = self::get_meta_query_sql( $meta_query );
if ( ! empty( $meta_query_sql['join'] ) ) {
$join_sql .= $meta_query_sql['join'];
}
if ( ! empty( $meta_query_sql['where'] ) ) {
$where_conditions[] = $meta_query_sql['where'];
}
// Alter the query based on whether we want to show activity item
// comments in the stream like normal comments or threaded below
// the activity.
......@@ -228,12 +242,12 @@ class BP_Activity_Activity {
$per_page = absint( $per_page );
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
} else {
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
}
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
$total_activities = $wpdb->get_var( $total_activities_sql );
......@@ -242,7 +256,7 @@ class BP_Activity_Activity {
$activity_user_ids = wp_list_pluck( $activities, 'user_id' );
$activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
if ( !empty( $activity_user_ids ) ) {
if ( !empty( $activity_user_ids ) ) {
if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
foreach ( (array) $names as $name )
$tmp_names[$name->user_id] = $name->user_fullname;
......@@ -280,6 +294,46 @@ class BP_Activity_Activity {
return array( 'activities' => $activities, 'total' => (int) $total_activities );
}
/**
* Get the SQL for the 'meta_query' param in BP_Activity_Activity::get()
*
* We use WP_Meta_Query to do the heavy lifting of parsing the
* meta_query array and creating the necessary SQL clauses. However,
* since BP_Activity_Activity::get() builds its SQL differently than
* WP_Query, we have to alter the return value (stripping the leading
* AND keyword from the 'where' clause).
*
* @since BuddyPress (1.8)
*
* @param array $meta_query An array of meta_query filters. See the
* documentation for WP_Meta_Query for details.
* @return array $sql_array 'join' and 'where' clauses
*/
public static function get_meta_query_sql( $meta_query = array() ) {
global $wpdb;
$sql_array = array(
'join' => '',
'where' => '',
);
if ( ! empty( $meta_query ) ) {
$activity_meta_query = new WP_Meta_Query( $meta_query );
// WP_Meta_Query expects the table name at
// $wpdb->activitymeta
$wpdb->activitymeta = buddypress()->activity->table_name_meta;
$meta_sql = $activity_meta_query->get_sql( 'activity', 'a', 'id' );
// Strip the leading AND - BP handles it in get()
$sql_array['where'] = preg_replace( '/^\sAND/', '', $meta_sql['where'] );
$sql_array['join'] = $meta_sql['join'];
}
return $sql_array;
}
/**
* In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
* As of 1.5.x, use BP_Activity_Activity::get() with an 'in' parameter instead.
......@@ -425,6 +479,10 @@ class BP_Activity_Activity {
$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
foreach ( (array) $activity_ids as $activity_id ) {
bp_activity_clear_meta_cache_for_activity( $activity_id );
}
return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" );
}
......@@ -556,10 +614,14 @@ class BP_Activity_Activity {
return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
}
/**
* Fetch a list of all components that have activity items recorded
*
* @return array
*/
function get_recorded_components() {
global $wpdb, $bp;
return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ) );
return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
}
function get_sitewide_items_for_feed( $limit = 35 ) {
......@@ -668,3 +730,285 @@ class BP_Activity_Activity {
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
}
}
/**
* Create a RSS feed using the activity component.
*
* You should only construct a new feed when you've validated that you're on
* the appropriate screen.
*
* See {@link bp_activity_action_sitewide_feed()} as an example.
*
* Accepted parameters:
* id - internal id for the feed; should be alphanumeric only
* (required)
* title - RSS feed title
* link - Relevant link for the RSS feed
* description - RSS feed description
* ttl - Time-to-live (see inline doc in constructor)
* update_period - Part of the syndication module (see inline doc in
* constructor for more info)
* update_frequency - Part of the syndication module (see inline doc in
* constructor for more info)
* max - Number of feed items to display
* activity_args - Arguments passed to {@link bp_has_activities()}
*
* @since BuddyPress (1.8)
*/
class BP_Activity_Feed {
/**
* Holds our custom class properties.
*
* These variables are stored in a protected array that is magically
* updated using PHP 5.2+ methods.
*
* @see BP_Feed::__construct() This is where $data is added
* @var array
*/
protected $data;
/**
* Magic method for checking the existence of a certain data variable.
*
* @param string $key
*/
public function __isset( $key ) { return isset( $this->data[$key] ); }
/**
* Magic method for getting a certain data variable.
*
* @param string $key
*/
public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
/**
* Constructor.
*
* @param array $args Optional
*/
public function __construct( $args = array() ) {
// If feeds are disabled, stop now!
if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
global $wp_query;
// set feed flag to false
$wp_query->is_feed = false;
return false;
}
// Setup data
$this->data = wp_parse_args( $args, array(
// Internal identifier for the RSS feed - should be alphanumeric only
'id' => '',
// RSS title - should be plain-text
'title' => '',
// relevant link for the RSS feed
'link' => '',