forked from LearnPress/learnpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-lp-asset-key.php
95 lines (89 loc) · 1.73 KB
/
class-lp-asset-key.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* Class LP_Asset_Key
*
* @author tungnx
* @package LearnPress/Classes
* @version 1.0.1
* @since 3.2.8
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class LP_Asset_Key {
/**
* Url of file css/js
*
* @var string
*/
public $_url = '';
/**
* Attach js/css need load
*
* @var array
*/
public $_deps = array();
/**
* Load on footer
*
* @var int
*/
public $_in_footer = 0;
/**
* Value 1 for run wp_register_script(), 0 for run wp_enqueue_script()
*
* @var int
*/
public $_only_register = 1;
/**
* Default value empty will load all page
*
* @var array|string[]
*/
public $_screens = array();
/**
* Set screens(pages) not load js
*
* @var array|string[]
*/
public $_exclude_screens = array();
/**
* Version of addon
*
* @var string
*/
public $_version = '';
/**
* LP_ASSET_KEY constructor.
*
* @param string $url .
* @param array $deps .
* @param string[] $screens .
* @param int $only_register .
* @param int $in_footer .
*/
public function __construct( string $url = '', array $deps = array(), array $screens = array(), int $only_register = 1, int $in_footer = 0, string $version = '' ) {
$this->_url = $url;
$this->_deps = $deps;
$this->_in_footer = $in_footer;
$this->_only_register = $only_register;
$this->_screens = $screens;
$this->_version = $version;
}
/**
* Set pages not call js.
*
* @param string[] $screens .
*/
public function exclude_screen( array $screens = array() ) {
$this->_exclude_screens = $screens;
}
/**
* Set dependency
*
* @param array $deps
*/
public function set_dependency_js( array $deps ) {
$this->_deps = $deps;
}
}