| 1 |
<?php |
| 2 |
/** |
| 3 |
* Selection Lite |
| 4 |
* Carefully selected Elementor addons bundle, for building the most awesome websites |
| 5 |
* |
| 6 |
* @encoding UTF-8 |
| 7 |
* @version 1.12 |
| 8 |
* @copyright (C) 2018-2024 Merkulove ( https://merkulov.design/ ). All rights reserved. |
| 9 |
* @license GPLv3 |
| 10 |
* @contributors merkulove, vladcherviakov, phoenixmkua, podolianochka, viktorialev01 |
| 11 |
* @support help@merkulov.design |
| 12 |
**/ |
| 13 |
|
| 14 |
namespace Merkulove\SelectionLite\Unity; |
| 15 |
|
| 16 |
/** Exit if accessed directly. */ |
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
header( 'Status: 403 Forbidden' ); |
| 19 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Class adds admin CSS styles. |
| 25 |
* |
| 26 |
* @since 1.0 |
| 27 |
* |
| 28 |
**/ |
| 29 |
final class AdminStyles { |
| 30 |
|
| 31 |
/** |
| 32 |
* The one true AdminStyles. |
| 33 |
* |
| 34 |
* @var AdminStyles |
| 35 |
**/ |
| 36 |
private static $instance; |
| 37 |
|
| 38 |
/** |
| 39 |
* Sets up a new AdminStyles instance. |
| 40 |
* |
| 41 |
* @access public |
| 42 |
**/ |
| 43 |
private function __construct() { |
| 44 |
|
| 45 |
add_action( 'admin_enqueue_scripts', [$this, 'admin_styles'] ); |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Add CSS for admin area. |
| 51 |
* |
| 52 |
* @since 1.0 |
| 53 |
* @access public |
| 54 |
* |
| 55 |
* @return void |
| 56 |
**/ |
| 57 |
public function admin_styles() { |
| 58 |
|
| 59 |
/** Plugin Settings Page. */ |
| 60 |
$this->settings_styles(); |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Styles for plugin setting page. |
| 66 |
* |
| 67 |
* @since 1.0 |
| 68 |
* @access private |
| 69 |
* |
| 70 |
* @return void |
| 71 |
**/ |
| 72 |
private function settings_styles() { |
| 73 |
|
| 74 |
/** Add styles only on setting page. */ |
| 75 |
$screen = get_current_screen(); |
| 76 |
if ( null === $screen ) { return; } |
| 77 |
|
| 78 |
/** Add styles only on plugin settings page */ |
| 79 |
if ( in_array( $screen->base, Plugin::get_menu_bases(), true ) ) { |
| 80 |
|
| 81 |
wp_enqueue_style( 'mdp-selection-lite-ui', Plugin::get_url() . 'src/Merkulove/Unity/assets/css/merkulov-ui.min.css', [], Plugin::get_version() ); |
| 82 |
wp_enqueue_style( 'mdp-selection-lite-admin', Plugin::get_url() . 'css/admin' . Plugin::get_suffix() . '.css', [], Plugin::get_version() ); |
| 83 |
|
| 84 |
} |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Main AdminStyles Instance. |
| 90 |
* Insures that only one instance of AdminStyles exists in memory at any one time. |
| 91 |
* |
| 92 |
* @static |
| 93 |
* @since 1.0 |
| 94 |
* @access public |
| 95 |
* |
| 96 |
* @return AdminStyles |
| 97 |
**/ |
| 98 |
public static function get_instance() { |
| 99 |
|
| 100 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { |
| 101 |
|
| 102 |
self::$instance = new self; |
| 103 |
|
| 104 |
} |
| 105 |
|
| 106 |
return self::$instance; |
| 107 |
|
| 108 |
} |
| 109 |
|
| 110 |
} |
| 111 |
|