Shortcodes
3 months ago
DisplayEmailImage.php
3 months ago
Front.php
3 months ago
FrontBuffering.php
3 months ago
FrontCore.php
3 months ago
FrontEnqueue.php
3 months ago
FrontTemplateTags.php
3 months ago
FrontEnqueue.php
57 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OnlineOptimisation\EmailEncoderBundle\Front; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 | |
| 7 | use OnlineOptimisation\EmailEncoderBundle\Traits\PluginHelper; |
| 8 | |
| 9 | class FrontEnqueue |
| 10 | { |
| 11 | use PluginHelper; |
| 12 | |
| 13 | |
| 14 | public function boot(): void |
| 15 | { |
| 16 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] ); |
| 17 | } |
| 18 | |
| 19 | |
| 20 | public function enqueue(): void |
| 21 | { |
| 22 | $protect_using = (string) $this->getSetting( 'protect_using', true ); |
| 23 | $footer_scripts = (bool) $this->getSetting( 'footer_scripts', true ); |
| 24 | |
| 25 | |
| 26 | # JS |
| 27 | if ( $protect_using === 'with_javascript' ) { |
| 28 | |
| 29 | $js_version = md5_file( $this->assetJsDir( 'custom.js' ) ); |
| 30 | wp_enqueue_script( |
| 31 | 'eeb-js-frontend', |
| 32 | $this->assetJsUrl( 'custom.js' ), |
| 33 | [ 'jquery' ], |
| 34 | $js_version, |
| 35 | $footer_scripts |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | # CSS |
| 40 | if ( in_array( $protect_using, [ 'with_javascript', 'without_javascript' ] ) ) { |
| 41 | |
| 42 | $css_version = md5_file( $this->assetCssDir( 'style.css' ) ); |
| 43 | wp_enqueue_style( |
| 44 | 'eeb-css-frontend', |
| 45 | $this->assetCssUrl( 'style.css' ), |
| 46 | [], |
| 47 | $css_version |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | if ( (string) $this->getSetting( 'show_encoded_check', true ) === '1' ) { |
| 52 | wp_enqueue_style( 'dashicons' ); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | } |
| 57 |