| @@ -1,111 +1,111 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Class LP_Asset_Key | |
| 5 | - * | |
| 6 | - * @author tungnx | |
| 7 | - * @package LearnPress/Classes | |
| 8 | - * @version 1.0.1 | |
| 9 | - * @since 3.2.8 | |
| 10 | - */ | |
| 11 | - | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | - exit; // Exit if accessed directly | |
| 14 | -} | |
| 15 | - | |
| 16 | -class LP_Asset_Key { | |
| 17 | - /** | |
| 18 | - * Url of file css/js | |
| 19 | - * | |
| 20 | - * @var string | |
| 21 | - */ | |
| 22 | - public $_url = ''; | |
| 23 | - /** | |
| 24 | - * Attach js/css need load | |
| 25 | - * | |
| 26 | - * @var array | |
| 27 | - */ | |
| 28 | - public $_deps = array(); | |
| 29 | - /** | |
| 30 | - * Load on footer | |
| 31 | - * | |
| 32 | - * @var int | |
| 33 | - */ | |
| 34 | - public $_in_footer = 0; | |
| 35 | - /** | |
| 36 | - * Strategy load defer/async support from WP 6.3 | |
| 37 | - * | |
| 38 | - * @var array | |
| 39 | - * @since 4.2.5.5 | |
| 40 | - */ | |
| 41 | - public $_strategy = []; | |
| 42 | - /** | |
| 43 | - * Value 1 for run wp_register_script(), 0 for run wp_enqueue_script() | |
| 44 | - * | |
| 45 | - * @var int | |
| 46 | - */ | |
| 47 | - public $_only_register = 1; | |
| 48 | - /** | |
| 49 | - * Default value empty will load all page | |
| 50 | - * | |
| 51 | - * @var array|string[] | |
| 52 | - */ | |
| 53 | - public $_screens = array(); | |
| 54 | - /** | |
| 55 | - * Set screens(pages) not load js | |
| 56 | - * | |
| 57 | - * @var array|string[] | |
| 58 | - */ | |
| 59 | - public $_exclude_screens = array(); | |
| 60 | - /** | |
| 61 | - * Version of addon | |
| 62 | - * | |
| 63 | - * @var string | |
| 64 | - */ | |
| 65 | - public $_version = ''; | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * LP_ASSET_KEY constructor. | |
| 69 | - * | |
| 70 | - * @param string $url . | |
| 71 | - * @param array $deps . | |
| 72 | - * @param string[] $screens . | |
| 73 | - * @param int $only_register . | |
| 74 | - * @param int $in_footer . | |
| 75 | - */ | |
| 76 | - public function __construct( | |
| 77 | - string $url = '', | |
| 78 | - array $deps = array(), | |
| 79 | - array $screens = array(), | |
| 80 | - int $only_register = 1, | |
| 81 | - int $in_footer = 0, | |
| 82 | - string $version = '', | |
| 83 | - array $strategy = [] | |
| 84 | - ) { | |
| 85 | - $this->_url = $url; | |
| 86 | - $this->_deps = $deps; | |
| 87 | - $this->_in_footer = $in_footer; | |
| 88 | - $this->_only_register = $only_register; | |
| 89 | - $this->_screens = $screens; | |
| 90 | - $this->_version = $version; | |
| 91 | - $this->_strategy = $strategy; | |
| 92 | - } | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * Set pages not call js. | |
| 96 | - * | |
| 97 | - * @param string[] $screens . | |
| 98 | - */ | |
| 99 | - public function exclude_screen( array $screens = array() ) { | |
| 100 | - $this->_exclude_screens = $screens; | |
| 101 | - } | |
| 102 | - | |
| 103 | - /** | |
| 104 | - * Set dependency | |
| 105 | - * | |
| 106 | - * @param array $deps | |
| 107 | - */ | |
| 108 | - public function set_dependency_js( array $deps ) { | |
| 109 | - $this->_deps = $deps; | |
| 110 | - } | |
| 111 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Class LP_Asset_Key | |
| 5 | + * | |
| 6 | + * @author tungnx | |
| 7 | + * @package LearnPress/Classes | |
| 8 | + * @version 1.0.1 | |
| 9 | + * @since 3.2.8 | |
| 10 | + */ | |
| 11 | + | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit; // Exit if accessed directly | |
| 14 | +} | |
| 15 | + | |
| 16 | +class LP_Asset_Key { | |
| 17 | + /** | |
| 18 | + * Url of file css/js | |
| 19 | + * | |
| 20 | + * @var string | |
| 21 | + */ | |
| 22 | + public $_url = ''; | |
| 23 | + /** | |
| 24 | + * Attach js/css need load | |
| 25 | + * | |
| 26 | + * @var array | |
| 27 | + */ | |
| 28 | + public $_deps = array(); | |
| 29 | + /** | |
| 30 | + * Load on footer | |
| 31 | + * | |
| 32 | + * @var int | |
| 33 | + */ | |
| 34 | + public $_in_footer = 0; | |
| 35 | + /** | |
| 36 | + * Strategy load defer/async support from WP 6.3 | |
| 37 | + * | |
| 38 | + * @var array | |
| 39 | + * @since 4.2.5.5 | |
| 40 | + */ | |
| 41 | + public $_strategy = []; | |
| 42 | + /** | |
| 43 | + * Value 1 for run wp_register_script(), 0 for run wp_enqueue_script() | |
| 44 | + * | |
| 45 | + * @var int | |
| 46 | + */ | |
| 47 | + public $_only_register = 1; | |
| 48 | + /** | |
| 49 | + * Default value empty will load all page | |
| 50 | + * | |
| 51 | + * @var array|string[] | |
| 52 | + */ | |
| 53 | + public $_screens = array(); | |
| 54 | + /** | |
| 55 | + * Set screens(pages) not load js | |
| 56 | + * | |
| 57 | + * @var array|string[] | |
| 58 | + */ | |
| 59 | + public $_exclude_screens = array(); | |
| 60 | + /** | |
| 61 | + * Version of addon | |
| 62 | + * | |
| 63 | + * @var string | |
| 64 | + */ | |
| 65 | + public $_version = ''; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * LP_ASSET_KEY constructor. | |
| 69 | + * | |
| 70 | + * @param string $url . | |
| 71 | + * @param array $deps . | |
| 72 | + * @param string[] $screens . | |
| 73 | + * @param int $only_register . | |
| 74 | + * @param int $in_footer . | |
| 75 | + */ | |
| 76 | + public function __construct( | |
| 77 | + string $url = '', | |
| 78 | + array $deps = array(), | |
| 79 | + array $screens = array(), | |
| 80 | + int $only_register = 1, | |
| 81 | + int $in_footer = 0, | |
| 82 | + string $version = '', | |
| 83 | + array $strategy = [] | |
| 84 | + ) { | |
| 85 | + $this->_url = $url; | |
| 86 | + $this->_deps = $deps; | |
| 87 | + $this->_in_footer = $in_footer; | |
| 88 | + $this->_only_register = $only_register; | |
| 89 | + $this->_screens = $screens; | |
| 90 | + $this->_version = $version; | |
| 91 | + $this->_strategy = $strategy; | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Set pages not call js. | |
| 96 | + * | |
| 97 | + * @param string[] $screens . | |
| 98 | + */ | |
| 99 | + public function exclude_screen( array $screens = array() ) { | |
| 100 | + $this->_exclude_screens = $screens; | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * Set dependency | |
| 105 | + * | |
| 106 | + * @param array $deps | |
| 107 | + */ | |
| 108 | + public function set_dependency_js( array $deps ) { | |
| 109 | + $this->_deps = $deps; | |
| 110 | + } | |
| 111 | +} | |