Admin.php
3 years ago
Ajax_Handler.php
2 years ago
Controls.php
2 years ago
Core.php
3 years ago
Elements.php
2 years ago
Enqueue.php
3 years ago
Facebook_Feed.php
3 years ago
Helper.php
2 years ago
Library.php
3 years ago
Login_Registration.php
2 years ago
Shared.php
5 years ago
Template_Query.php
4 years ago
Twitter_Feed.php
2 years ago
Woo_Product_Comparable.php
3 years ago
index.php
3 years ago
Enqueue.php
154 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Traits; |
| 4 | |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } // Exit if accessed directly |
| 8 | |
| 9 | use \Essential_Addons_Elementor\Classes\Helper as EnqueueHelper; |
| 10 | |
| 11 | trait Enqueue |
| 12 | { |
| 13 | public function before_enqueue_styles($widgets) |
| 14 | { |
| 15 | // Compatibility: Gravity forms |
| 16 | if (in_array('gravity-form', $widgets) && class_exists('GFCommon')) { |
| 17 | foreach (EnqueueHelper::get_gravity_form_list() as $form_id => $form_name) { |
| 18 | if ($form_id != '0') { |
| 19 | gravity_form_enqueue_scripts($form_id); |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // Compatibility: WPforms |
| 25 | if (in_array('wpforms', $widgets) && function_exists('wpforms')) { |
| 26 | wpforms()->frontend->assets_css(); |
| 27 | } |
| 28 | |
| 29 | // Compatibility: Caldera forms |
| 30 | if (in_array('caldera-form', $widgets) && class_exists('Caldera_Forms')) { |
| 31 | add_filter('caldera_forms_force_enqueue_styles_early', '__return_true'); |
| 32 | } |
| 33 | |
| 34 | // Compatibility: Fluent forms |
| 35 | if (in_array('fluentform', $widgets) && defined('FLUENTFORM')) { |
| 36 | wp_register_style( |
| 37 | 'fluent-form-styles', |
| 38 | WP_PLUGIN_URL . '/fluentform/public/css/fluent-forms-public.css', |
| 39 | false, |
| 40 | FLUENTFORM_VERSION |
| 41 | ); |
| 42 | |
| 43 | wp_register_style( |
| 44 | 'fluentform-public-default', |
| 45 | WP_PLUGIN_URL . '/fluentform/public/css/fluentform-public-default.css', |
| 46 | false, |
| 47 | FLUENTFORM_VERSION |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | // Compatibility: reCaptcha with login/register |
| 52 | if (in_array('login-register', $widgets) && $site_key = get_option('eael_recaptcha_sitekey')) { |
| 53 | $recaptcha_api_args['render'] = 'explicit'; |
| 54 | if ( $recaptcha_language = get_option( 'eael_recaptcha_language' ) ) { |
| 55 | $recaptcha_api_args['hl'] = $recaptcha_language; |
| 56 | } |
| 57 | $recaptcha_api_args = apply_filters( 'eael_lr_recaptcha_api_args', $recaptcha_api_args ); |
| 58 | $recaptcha_api_args = http_build_query( $recaptcha_api_args ); |
| 59 | wp_register_script('eael-recaptcha', "https://www.google.com/recaptcha/api.js?{$recaptcha_api_args}", false, EAEL_PLUGIN_VERSION, false); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // editor styles |
| 64 | public function editor_enqueue_scripts() |
| 65 | { |
| 66 | // ea icon font |
| 67 | wp_enqueue_style( |
| 68 | 'ea-icon', |
| 69 | $this->safe_url(EAEL_PLUGIN_URL . 'assets/admin/css/eaicon.css'), |
| 70 | false, |
| 71 | EAEL_PLUGIN_VERSION |
| 72 | ); |
| 73 | |
| 74 | // editor style |
| 75 | wp_enqueue_style( |
| 76 | 'eael-editor', |
| 77 | $this->safe_url(EAEL_PLUGIN_URL . 'assets/admin/css/editor.css'), |
| 78 | false, |
| 79 | EAEL_PLUGIN_VERSION |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | // templately promo enqueue scripts |
| 84 | public function templately_promo_enqueue_scripts(){ |
| 85 | // enqueue |
| 86 | wp_register_script( |
| 87 | 'templately-promo', |
| 88 | EAEL_PLUGIN_URL . 'assets/admin/js/eael-templately-promo.js', |
| 89 | ['jquery'], |
| 90 | EAEL_PLUGIN_VERSION |
| 91 | ); |
| 92 | |
| 93 | wp_localize_script('templately-promo','localize',[ |
| 94 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 95 | 'nonce' => wp_create_nonce( 'essential-addons-elementor' ), |
| 96 | ]); |
| 97 | wp_enqueue_script('templately-promo'); |
| 98 | // enqueue |
| 99 | wp_enqueue_style( |
| 100 | 'templately-promo', |
| 101 | EAEL_PLUGIN_URL . 'assets/admin/css/eael-templately-promo.css', |
| 102 | EAEL_PLUGIN_VERSION |
| 103 | ); |
| 104 | |
| 105 | |
| 106 | } |
| 107 | |
| 108 | public function templately_promo_enqueue_style(){ |
| 109 | $src = EAEL_PLUGIN_URL . 'assets/admin/images/templately/logo-icon.svg'; |
| 110 | $css = " |
| 111 | .elementor-add-new-section .elementor-add-templately-promo-button{ |
| 112 | background-color: #5d4fff; |
| 113 | background-image: url({$src}); |
| 114 | background-repeat: no-repeat; |
| 115 | background-position: center center; |
| 116 | position: relative; |
| 117 | } |
| 118 | |
| 119 | .elementor-add-new-section .elementor-add-templately-promo-button > i{ |
| 120 | height: 12px; |
| 121 | } |
| 122 | |
| 123 | body .elementor-add-new-section .elementor-add-section-area-button { |
| 124 | margin-left: 0; |
| 125 | }"; |
| 126 | wp_add_inline_style( 'elementor-icons', $css ); |
| 127 | } |
| 128 | |
| 129 | public function essential_blocks_promo_enqueue_scripts() { |
| 130 | if ( is_plugin_active( 'essential-blocks/essential-blocks.php' ) || get_option( 'eael_gb_eb_popup_hide' ) ) { |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | add_action( 'admin_footer', [ $this, 'essential_blocks_promo_admin_js_template' ] ); |
| 135 | wp_enqueue_script( 'eael-gutenberg', $this->safe_url( EAEL_PLUGIN_URL . 'assets/admin/js/eael-essential-blocks-promo.js' ), [ 'jquery' ], EAEL_PLUGIN_VERSION, true ); |
| 136 | wp_enqueue_style( 'eael-gutenberg', $this->safe_url( EAEL_PLUGIN_URL . 'assets/admin/css/eael-essential-blocks-promo.css' ), [], EAEL_PLUGIN_VERSION ); |
| 137 | } |
| 138 | |
| 139 | // replace beehive theme's swiper slider lib file with elementor's swiper lib file |
| 140 | public function beehive_theme_swiper_slider_compatibility( $scripts ) { |
| 141 | unset( $scripts['swiper'] ); |
| 142 | unset( $scripts['beehive-elements'] ); |
| 143 | |
| 144 | $scripts['beehive-elements'] = array( |
| 145 | 'src' => EAEL_PLUGIN_URL . 'assets/front-end/js/view/beehive-elements.min.js', |
| 146 | 'deps' => array( 'jquery' ), |
| 147 | 'in_footer' => true, |
| 148 | 'enqueue' => true, |
| 149 | ); |
| 150 | |
| 151 | return $scripts; |
| 152 | } |
| 153 | } |
| 154 |