Esempio n. 1
0
 /**
  * Constructor method
  *
  * @package BP Reshare
  * @subpackage Component
  * @since 1.0
  *
  * @uses buddyreshare_get_component_id() to get the id of the component
  * @uses buddyreshare_get_component_name() to get the name of the component
  * @uses buddyreshare_get_includes_dir() to get plugin's include dir
  * @uses buddypress() to get BuddyPress main instance
  */
 function __construct()
 {
     parent::start(buddyreshare_get_component_id(), buddyreshare_get_component_name(), buddyreshare_get_includes_dir());
     buddypress()->active_components[$this->id] = '1';
     $this->includes();
     $this->setup_hooks();
 }
Esempio n. 2
0
/**
 * Builds the reshare button
 *
 * @package BP Reshare
 * @since    1.0
 * 
 * @global  BP_Activity_Template $activities_template
 * @uses    buddyreshare_activity_can_reshare() to check if the activity can be reshared
 * @uses    buddyreshare_activity_get_button_class() to get button's classe
 * @uses    buddyreshare_activity_get_reshares_count() to get the number of reshares
 * @uses    bp_get_activity_id() to get activity id
 * @uses    buddyreshare_get_component_id() to get component's id
 * @uses 	buddyreshare_activity_get_action_url() to get action url
 * @uses 	buddyreshare_activity_get_id_to_reshare() to get the activity id to reshare
 * @uses  	buddyreshare_activity_get_button_title() to get the button title
 * @uses    bp_get_button() to build the button
 * @return  string reshare button
 */
function buddyreshare_activity_get_button()
{
    global $activities_template;
    if (!buddyreshare_activity_can_reshare()) {
        return false;
    }
    $caption = apply_filters('buddyreshare_activity_get_button_caption', buddyreshare_activity_get_button_title());
    $link_text = '<span class="' . buddyreshare_activity_get_button_class() . '">' . $caption . '</span><span class="rs-count">' . buddyreshare_activity_get_reshares_count() . '</span>';
    $button = array('id' => 'reshare-container-' . bp_get_activity_id(), 'component' => buddyreshare_get_component_id(), 'must_be_logged_in' => true, 'wrapper' => false, 'block_self' => false, 'link_id' => 'bp-reshare-' . bp_get_activity_id(), 'link_href' => buddyreshare_activity_get_action_url(), 'link_rel' => buddyreshare_activity_get_id_to_reshare(), 'link_title' => buddyreshare_activity_get_button_title(), 'link_text' => $link_text, 'link_class' => 'button reshare-button bp-secondary-action');
    // Filter and return the HTML button
    return bp_get_button(apply_filters('buddyreshare_activity_get_button', $button));
}
Esempio n. 3
0
/**
 * Builds an array of the reshare activity actions
 * 
 * @package BP Reshare
 * @since    1.0
 * 
 * @uses buddypress() to get BuddyPress main instance
 * @uses buddyreshare_get_component_id() to get plugin's id
 */
function buddyreshare_reshare_types()
{
    $activity_types = buddypress()->activity->actions;
    $reshare_types = array();
    if (!empty($activity_types->{buddyreshare_get_component_id()})) {
        $reshare_types = array_values((array) $activity_types->{buddyreshare_get_component_id()});
    }
    return $reshare_types;
}