| 1 |
<?php |
| 2 |
namespace epiphyt\Embed_Privacy\integration; |
| 3 |
|
| 4 |
use epiphyt\Embed_Privacy\data\Replacer; |
| 5 |
use epiphyt\Embed_Privacy\Embed_Privacy; |
| 6 |
|
| 7 |
/** |
| 8 |
* BuddyPress integration for Embed Privacy. |
| 9 |
* |
| 10 |
* @author Epiphyt |
| 11 |
* @license GPL2 |
| 12 |
* @package epiphyt\Embed_Privacy |
| 13 |
* @since 1.11.0 |
| 14 |
*/ |
| 15 |
final class Buddypress { |
| 16 |
/** |
| 17 |
* Initialize functionality. |
| 18 |
*/ |
| 19 |
public static function init() { |
| 20 |
\add_action( 'bp_enqueue_community_scripts', [ self::class, 'register_scripts' ], 2 ); |
| 21 |
\add_action( 'bp_enqueue_community_scripts', [ self::class, 'enqueue_assets' ] ); |
| 22 |
\add_filter( 'bp_get_activity_content_body', [ self::class, 'replace_activity_content' ] ); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Enqueue Embed Privacy assets for BuddyPress. |
| 27 |
*/ |
| 28 |
public static function enqueue_assets() { |
| 29 |
Embed_Privacy::get_instance()->frontend->print_assets(); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Register Embed Privacy assets for BuddyPress. |
| 34 |
*/ |
| 35 |
public static function register_scripts() { |
| 36 |
Embed_Privacy::get_instance()->frontend->register_assets(); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Replace activity stream content. |
| 41 |
* |
| 42 |
* @param string $content Current activity stream content |
| 43 |
* @return string Updated activity stream content |
| 44 |
*/ |
| 45 |
public static function replace_activity_content( $content ) { |
| 46 |
return Replacer::replace_embeds( $content ); |
| 47 |
} |
| 48 |
} |
| 49 |
|