| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* For singleton accessor, use VP_WP_MassEnqueuer class instead. |
| 5 |
*/ |
| 6 |
class VP_WP_Enqueuer |
| 7 |
{ |
| 8 |
|
| 9 |
private $_loaders = array(); |
| 10 |
|
| 11 |
private $_id; |
| 12 |
|
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
$this->_id = spl_object_hash($this); |
| 16 |
$loader = new VP_WP_Loader(); |
| 17 |
add_action('vp_loader_register_' . $this->_id, array($loader, 'register'), 10, 2); |
| 18 |
} |
| 19 |
|
| 20 |
public function add_loader($loader) |
| 21 |
{ |
| 22 |
$this->_loaders[] = $loader; |
| 23 |
} |
| 24 |
|
| 25 |
public function register() |
| 26 |
{ |
| 27 |
add_action('admin_enqueue_scripts', array($this, 'register_caller')); |
| 28 |
} |
| 29 |
|
| 30 |
public function register_caller($hook_suffix) |
| 31 |
{ |
| 32 |
do_action('vp_loader_register_' . $this->_id, $this->_loaders, $hook_suffix); |
| 33 |
} |
| 34 |
|
| 35 |
} |