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