templates
2 years ago
Admin_Settings.php
2 years ago
Assets.php
2 years ago
Module_Settings.php
2 years ago
notices.php
2 years ago
Assets.php
107 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 SPEL\Admin |
| 12 | */ |
| 13 | class Assets { |
| 14 | |
| 15 | /** |
| 16 | * Assets constructor. |
| 17 | */ |
| 18 | public function __construct() { |
| 19 | |
| 20 | add_action( 'plugins_loaded', [$this, 'register_scripts'] ); |
| 21 | |
| 22 | add_action('fonts_url', [$this, 'fonts_url']); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | public function fonts_url() { |
| 27 | |
| 28 | $fonts_url = ''; |
| 29 | $fonts = array(); |
| 30 | $subsets = ''; |
| 31 | |
| 32 | /* Body font */ |
| 33 | if ( 'off' !== 'on' ) { |
| 34 | $fonts[] = "Inter:400,500,600,700"; |
| 35 | } |
| 36 | if ( 'off' !== 'on' ) { |
| 37 | $fonts[] = "Roboto:400,500,600"; |
| 38 | } |
| 39 | |
| 40 | $is_ssl = is_ssl() ? 'https' : 'http'; |
| 41 | |
| 42 | if ( $fonts ) { |
| 43 | $fonts_url = add_query_arg( array( |
| 44 | 'family' => urlencode( implode( '|', $fonts ) ), |
| 45 | 'subset' => urlencode( $subsets ), |
| 46 | ), "$is_ssl://fonts.googleapis.com/css" ); |
| 47 | } |
| 48 | |
| 49 | return $fonts_url; |
| 50 | |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Register scripts and styles |
| 55 | **/ |
| 56 | public function register_scripts() { |
| 57 | |
| 58 | // Register Elementor Preview Editor Style's |
| 59 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'elementor_editor_scripts' ] ); |
| 60 | |
| 61 | // Register Admin Panel Scripts |
| 62 | add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); |
| 63 | |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Register Widget Styles |
| 68 | * |
| 69 | * Register custom styles required to run Spider Elements. |
| 70 | * |
| 71 | * @access public |
| 72 | */ |
| 73 | public function elementor_editor_scripts() { |
| 74 | wp_enqueue_style( 'spel-el-editor', SPEL_CSS . '/elementor-editor.css', [], SPEL_VERSION ); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Register Admin Panel Scripts |
| 80 | * |
| 81 | * Register custom scripts required to run Spider Elements. |
| 82 | * |
| 83 | * @access public |
| 84 | */ |
| 85 | public function admin_scripts() { |
| 86 | |
| 87 | // Register Admin Panel Styles |
| 88 | wp_enqueue_style( 'spel-fonts', self::fonts_url(), [], SPEL_VERSION ); |
| 89 | wp_enqueue_style( 'icomoon', SPEL_VEND . '/icomoon/style.css', [], SPEL_VERSION ); |
| 90 | wp_enqueue_style( 'spel-circle', SPEL_VEND . '/circle-progressbar/circularprogress.css', [], SPEL_VERSION ); |
| 91 | wp_enqueue_style( 'spel-fancy', SPEL_VEND . '/fancybox/css/jquery.fancybox.min.css', [], SPEL_VERSION ); |
| 92 | wp_enqueue_style( 'spel-admin', SPEL_CSS . '/admin.css', [], SPEL_VERSION); |
| 93 | |
| 94 | // Register Admin Panel Scripts |
| 95 | wp_enqueue_script( 'spel-waypoint', SPEL_VEND . '/circle-progressbar/jquery.waypoints.min.js', ['jquery'], SPEL_VERSION, true ); |
| 96 | wp_enqueue_script( 'spel-counterup', SPEL_VEND . '/circle-progressbar/jquery.counterup.min.js', ['jquery'], SPEL_VERSION, true ); |
| 97 | wp_enqueue_script( 'spel-imageloaded', SPEL_VEND . '/imagesloaded/imagesloaded.pkgd.min.js', ['jquery'], SPEL_VERSION, true ); |
| 98 | wp_enqueue_script( 'spel-isotope', SPEL_VEND . '/isotope/isotope.min.js', ['jquery'], SPEL_VERSION, true ); |
| 99 | wp_enqueue_script( 'spel-fancy', SPEL_VEND . '/fancybox/js/jquery.fancybox.min.js', ['jquery'], SPEL_VERSION, true ); |
| 100 | wp_enqueue_script( 'spel-circle', SPEL_VEND . '/circle-progressbar/circle-progress.js', ['jquery'], SPEL_VERSION, true ); |
| 101 | wp_enqueue_script( 'spel-admin', SPEL_JS . '/admin.js', ['jquery'], SPEL_VERSION, true ); |
| 102 | } |
| 103 | |
| 104 | |
| 105 | } |
| 106 | |
| 107 | new Assets(); |