/**
  * Set filters
  *
  * @package BuddyDrive Component
  * @subpackage Screens
  * @since 1.2.0
  */
 private function setup_filters()
 {
     if (bp_is_current_component('buddydrive') || buddydrive_is_group()) {
         add_filter('bp_located_template', array($this, 'template_filter'), 20, 2);
         add_filter('bp_get_template_stack', array($this, 'add_to_template_stack'), 10, 1);
     }
 }
/**
 * Loads the css and javascript when on Friends/Group BuddyDrive
 *
 * @uses bp_is_current_component()  to check for BuddyDrive component
 * @uses buddydrive_is_group() to include the group case
 * @uses wp_enqueue_style() to load BuddyDrive style
 * @uses wp_enqueue_script() to load BuddyDrive script
 * @uses buddydrive_get_includes_url() to get the includes url
 * @uses wp_localize_script() to add some translation to js messages/output
 * @uses buddydrive_get_js_l10n() to get the translation
 * @uses buddydrive_is_user_buddydrive() to check we're not on loggedin user's BuddyDrive
 */
function buddydrive_file_enqueue_scripts()
{
    if (bp_is_current_component('buddydrive') || buddydrive_is_group()) {
        $budddrive_css = apply_filters('buddydrive_global_css', array('stylesheet_uri' => buddydrive_get_includes_url() . 'css/buddydrive.css', 'deps' => array('dashicons')));
        // style is for every BuddyDrive screens
        wp_enqueue_style('buddydrive', $budddrive_css['stylesheet_uri'], $budddrive_css['deps'], buddydrive_get_version());
        // in group and friends BuddyDrive, loads a specific script
        if (!buddydrive_is_user_buddydrive()) {
            wp_enqueue_script('buddydrive-view', buddydrive_get_includes_url() . 'js/buddydrive-view.js', array('jquery'), buddydrive_get_version(), true);
            wp_localize_script('buddydrive-view', 'buddydrive_view', buddydrive_get_js_l10n());
        }
    }
}
/**
 * Checks if a user can share an item
 *
 * @uses buddydrive_get_owner_id() to get owner's id
 * @uses bp_loggedin_user_id() to get current user id
 * @return boolean true or false
 */
function buddydrive_current_user_can_share()
{
    $can_share = false;
    if (buddydrive_get_owner_id() == bp_loggedin_user_id() && !buddydrive_is_group()) {
        $can_share = true;
    }
    return apply_filters('buddydrive_current_user_can_share', $can_share);
}