dashboard
4 months ago
extension
4 months ago
Assets.php
4 months ago
Dashboard.php
4 months ago
Module_Settings.php
4 months ago
Plugin_Installer.php
4 months ago
Assets.php
68 lines
| 1 | <?php |
| 2 | namespace SPEL\includes\Admin; |
| 3 | |
| 4 | // Exit if accessed directly |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * Class Assets |
| 11 | * @package Spider Elements |
| 12 | */ |
| 13 | class Assets { |
| 14 | |
| 15 | /** |
| 16 | * Assets constructor. |
| 17 | */ |
| 18 | public function __construct() { |
| 19 | |
| 20 | // Register Admin Panel Scripts |
| 21 | add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); |
| 22 | |
| 23 | } |
| 24 | |
| 25 | |
| 26 | /** |
| 27 | * Register Admin Panel Scripts |
| 28 | * |
| 29 | * Register custom scripts required to run Spider Elements. |
| 30 | * |
| 31 | * @access public |
| 32 | */ |
| 33 | public function admin_scripts(): void |
| 34 | { |
| 35 | |
| 36 | // List of all Spider Elements admin pages |
| 37 | $spider_elements_pages = [ |
| 38 | 'spider_elements_settings', |
| 39 | 'spider_elements_elements', |
| 40 | 'spider_elements_features', |
| 41 | 'spider_elements_integration', |
| 42 | ]; |
| 43 | |
| 44 | if ( isset( $_GET['page'] ) && in_array( $_GET['page'], $spider_elements_pages, true ) ) { |
| 45 | |
| 46 | // Register Admin Panel Style's |
| 47 | wp_enqueue_style( 'spel-icomoon', SPEL_VEND . '/icomoon/style.css', [], SPEL_VERSION ); |
| 48 | wp_enqueue_style( 'spel-font-awesome', SPEL_VEND . '/font-awesome/css/all.css', [], SPEL_VERSION ); |
| 49 | wp_enqueue_style( 'spel-fancybox', SPEL_VEND . '/fancybox/fancybox.min.css', [], SPEL_VERSION ); |
| 50 | |
| 51 | if ( is_rtl() ) { |
| 52 | wp_enqueue_style( 'spel-admin-rtl', SPEL_CSS . '/admin-rtl.css', [], SPEL_VERSION); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | wp_enqueue_style( 'spel-admin', SPEL_CSS . '/admin.css', [], SPEL_VERSION); |
| 57 | |
| 58 | |
| 59 | // Register Admin Panel Script's |
| 60 | wp_enqueue_script( 'spel-isotope', SPEL_VEND . '/isotope/isotope.min.js', ['jquery'], '2.2.2', ['strategy' => 'defer'] ); |
| 61 | wp_enqueue_script( 'spel-imageloaded', SPEL_VEND . '/imageloaded/imageloaded.min.js', ['jquery'], '4.1.0', ['strategy' => 'defer'] ); |
| 62 | wp_enqueue_script( 'spel-fancybox', SPEL_VEND . '/fancybox/fancybox.min.js', ['jquery'], '3.5.7', ['strategy' => 'defer'] ); |
| 63 | wp_enqueue_script( 'spel-admin', SPEL_JS . '/admin.js', ['jquery'], SPEL_VERSION, ['strategy' => 'defer'] ); |
| 64 | } |
| 65 | |
| 66 | } |
| 67 | |
| 68 | } |