PluginProbe
Embed Privacy / 1.10.0
Embed Privacy v1.10.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-astra.php

class-astra.php in Embed Privacy 1.10.0, at inc/integration/class-astra.php

47 lines 1.3 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\handler\Theme;
5
6 /**
7 * Astra integration for Embed Privacy.
8 *
9 * @author Epiphyt
10 * @license GPL2
11 * @package epiphyt\Embed_Privacy
12 * @since 1.10.0
13 */
14 final class Astra {
15 /**
16 * Initialize functionality.
17 */
18 public static function init() {
19 \add_action( 'embed_privacy_print_assets', [ self::class, 'enqueue_assets' ] );
20 \add_action( 'embed_privacy_register_assets', [ self::class, 'register_assets' ], 10, 2 );
21 }
22
23 /**
24 * Enqueue assets.
25 */
26 public static function enqueue_assets() {
27 if ( Theme::is( 'Astra' ) ) {
28 \wp_enqueue_style( 'embed-privacy-astra' );
29 }
30 }
31
32 /**
33 * Register assets.
34 *
35 * @param bool $is_debug Whether debug mode is enabled
36 * @param string $suffix A filename suffix
37 */
38 public static function register_assets( $is_debug, $suffix ) {
39 // Astra is too greedy with its CSS selectors
40 // see https://github.com/epiphyt/embed-privacy/issues/33
41 $css_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/style/astra' . $suffix . '.css';
42 $file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/style/astra' . $suffix . '.css' ) : \EMBED_PRIVACY_VERSION;
43
44 \wp_register_style( 'embed-privacy-astra', $css_file_url, [], $file_version );
45 }
46 }
47