PluginProbe
Embed Privacy / 1.11.0
Embed Privacy v1.11.0
1.14.0 1.13.0 trunk 0.1 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.10 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 All 68 releases
embed-privacy / inc / integration / class-wpforo-embeds.php

class-wpforo-embeds.php in Embed Privacy 1.11.0, at inc/integration/class-wpforo-embeds.php

57 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace epiphyt\Embed_Privacy\integration;
3
4 use epiphyt\Embed_Privacy\data\Replacer;
5 use epiphyt\Embed_Privacy\System;
6
7 /**
8 * wpForo Embeds 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 Wpforo_Embeds {
16 /**
17 * Initialize functionality.
18 */
19 public static function init() {
20 \add_action( 'embed_privacy_print_assets', [ self::class, 'enqueue_assets' ] );
21 \add_action( 'embed_privacy_register_assets', [ self::class, 'register_assets' ], 10, 2 );
22 \add_filter( 'wpforo_content_after', [ self::class, 'replace' ], 10 ); // use _after filter to process data after wpautop()
23 }
24
25 /**
26 * Enqueue assets.
27 */
28 public static function enqueue_assets() {
29 if ( System::is_plugin_active( 'wpforo-embeds/wpforoembeds.php' ) ) {
30 \wp_enqueue_style( 'embed-privacy-wpforo-embeds' );
31 }
32 }
33
34 /**
35 * Register assets.
36 *
37 * @param bool $is_debug Whether debug mode is enabled
38 * @param string $suffix A filename suffix
39 */
40 public static function register_assets( $is_debug, $suffix ) {
41 $css_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/style/wpforo-embeds' . $suffix . '.css';
42 $file_version = $is_debug ? (string) \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/style/wpforo-embeds' . $suffix . '.css' ) : \EMBED_PRIVACY_VERSION;
43
44 \wp_register_style( 'embed-privacy-wpforo-embeds', $css_file_url, [], $file_version );
45 }
46
47 /**
48 * Replace activity stream content.
49 *
50 * @param string $content Current activity stream content
51 * @return string Updated activity stream content
52 */
53 public static function replace( $content ) {
54 return Replacer::replace_embeds( $content );
55 }
56 }
57