| @@ -6,10 +6,10 @@ | ||
| 6 | 6 | protected array $actions; |
| 7 | 7 | protected array $filters; |
| 8 | 8 | |
| 9 | 9 | public function __construct() { |
| 10 | - $this->actions = []; | |
| 11 | - $this->filters = []; | |
| 10 | + $this->actions = array(); | |
| 11 | + $this->filters = array(); | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function add_action( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) { |
| 15 | 15 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
| @@ -27,15 +27,15 @@ | ||
| 27 | 27 | string $callback, |
| 28 | 28 | int $priority, |
| 29 | 29 | int $accepted_args |
| 30 | 30 | ): array { |
| 31 | - $hooks[] = [ | |
| 31 | + $hooks[] = array( | |
| 32 | 32 | 'hook' => $hook, |
| 33 | 33 | 'component' => $component, |
| 34 | 34 | 'callback' => $callback, |
| 35 | 35 | 'priority' => $priority, |
| 36 | - 'accepted_args' => $accepted_args | |
| 37 | - ]; | |
| 36 | + 'accepted_args' => $accepted_args, | |
| 37 | + ); | |
| 38 | 38 | |
| 39 | 39 | return $hooks; |
| 40 | 40 | } |
| 41 | 41 | |
| @@ -43,14 +43,22 @@ | ||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | public function run(): void { |
| 46 | 46 | foreach ( $this->filters as $hook ) { |
| 47 | - add_filter( $hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], | |
| 48 | - $hook['accepted_args'] ); | |
| 47 | + add_filter( | |
| 48 | + $hook['hook'], | |
| 49 | + array( $hook['component'], $hook['callback'] ), | |
| 50 | + $hook['priority'], | |
| 51 | + $hook['accepted_args'] | |
| 52 | + ); | |
| 49 | 53 | } |
| 50 | 54 | |
| 51 | 55 | foreach ( $this->actions as $hook ) { |
| 52 | - add_action( $hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], | |
| 53 | - $hook['accepted_args'] ); | |
| 56 | + add_action( | |
| 57 | + $hook['hook'], | |
| 58 | + array( $hook['component'], $hook['callback'] ), | |
| 59 | + $hook['priority'], | |
| 60 | + $hook['accepted_args'] | |
| 61 | + ); | |
| 54 | 62 | } |
| 55 | 63 | } |
| 56 | 64 | } |