scripts.php
74 lines
| 1 | <?php |
| 2 | namespace ElementsKit_Lite\Compatibility\Conflicts; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | |
| 7 | /** |
| 8 | * Init |
| 9 | * Initiate all necessary classes, hooks, configs. |
| 10 | * |
| 11 | * @since 1.2.6 |
| 12 | */ |
| 13 | class Scripts { |
| 14 | |
| 15 | /** |
| 16 | * Member Variable |
| 17 | * |
| 18 | * @var instance |
| 19 | */ |
| 20 | private static $instance; |
| 21 | |
| 22 | |
| 23 | /** |
| 24 | * Instance. |
| 25 | * |
| 26 | * Ensures only one instance of the plugin class is loaded or can be loaded. |
| 27 | * |
| 28 | * @since 1.2.6 |
| 29 | * @access public |
| 30 | * @static |
| 31 | * |
| 32 | * @return Init An instance of the class. |
| 33 | */ |
| 34 | public static function instance() { |
| 35 | if ( is_null( self::$instance ) ) { |
| 36 | |
| 37 | // Fire when ElementsKit_Lite instance. |
| 38 | self::$instance = new self(); |
| 39 | } |
| 40 | |
| 41 | return self::$instance; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | /** |
| 46 | * Construct the plugin object. |
| 47 | * |
| 48 | * @since 1.2.6 |
| 49 | * @access public |
| 50 | */ |
| 51 | public function __construct() { |
| 52 | |
| 53 | add_action( 'admin_enqueue_scripts', array( $this, 'deregister_from_admin' ) ); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * Conflicted script deregister function |
| 59 | * |
| 60 | * @since 1.2.6 |
| 61 | * @access public |
| 62 | */ |
| 63 | public function deregister_from_admin() { |
| 64 | |
| 65 | $screen = get_current_screen(); |
| 66 | |
| 67 | if ( in_array( $screen->id, array( 'edit-elementskit_template', 'toplevel_page_elementskit', 'elementskit_page_elementskit-license', 'nav-menus' ) ) ) { |
| 68 | wp_deregister_script( 'wpsp_wp_admin_jquery2' ); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | |
| 73 | } |
| 74 |