PluginProbe
Accessibility / trunk
Accessibility vtrunk
trunk 1.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
accessibility / includes / class-accesibility-loader.php

class-accesibility-loader.php in Accessibility trunk, at includes/class-accesibility-loader.php

50 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Description of class-wc-brands-expand-loader
5 *
6 * @author ohad
7 */
8 class OcAccessibility_Loader {
9
10 protected $actions;
11 protected $filters;
12
13 public function __construct() {
14
15 $this->actions = array();
16 $this->filters = array();
17 }
18
19 public function add_action($hook, $component, $callback) {
20 $this->actions = $this->add($this->actions, $hook, $component, $callback);
21 }
22
23 public function add_filter($hook, $component, $callback) {
24 $this->filters = $this->add($this->filters, $hook, $component, $callback);
25 }
26
27 private function add($hooks, $hook, $component, $callback) {
28
29 $hooks[] = array(
30 'hook' => $hook,
31 'component' => $component,
32 'callback' => $callback
33 );
34
35 return $hooks;
36 }
37
38 public function run() {
39
40 foreach ($this->filters as $hook) {
41 add_filter($hook['hook'], array($hook['component'], $hook['callback']));
42 }
43
44 foreach ($this->actions as $hook) {
45 add_action($hook['hook'], array($hook['component'], $hook['callback']));
46 }
47 }
48
49 }
50