Changeset 3153927
- Timestamp:
- 09/18/2024 12:12:33 PM (19 months ago)
- Location:
- woot-ro/trunk
- Files:
-
- 1 added
- 1 edited
-
includes/class-woot-loader.php (modified) (7 diffs)
-
public/js/woot-locations.min.js (added)
Legend:
- Unmodified
- Added
- Removed
-
woot-ro/trunk/includes/class-woot-loader.php
r3153520 r3153927 22 22 * @author Woot.ro <tehnic@woot.ro> 23 23 */ 24 class Woot_Loader { 24 class Woot_Loader 25 { 25 26 26 27 /** … … 47 48 * @since 1.0.0 48 49 */ 49 public function __construct() { 50 public function __construct() 51 { 50 52 51 53 $this->actions = array(); 52 54 $this->filters = array(); 53 54 55 } 55 56 … … 64 65 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. 65 66 */ 66 public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { 67 $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); 67 public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) 68 { 69 $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); 68 70 } 69 71 … … 78 80 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 79 81 */ 80 public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { 81 $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); 82 public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) 83 { 84 $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); 82 85 } 83 86 … … 96 99 * @return array The collection of actions and filters registered with WordPress. 97 100 */ 98 private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { 101 private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) 102 { 99 103 100 104 $hooks[] = array( … … 107 111 108 112 return $hooks; 109 110 113 } 111 114 … … 115 118 * @since 1.0.0 116 119 */ 117 public function run() { 120 public function run() 121 { 118 122 119 foreach ( $this->filters as $hook) {120 add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args']);123 foreach ($this->filters as $hook) { 124 add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); 121 125 } 122 126 123 foreach ( $this->actions as $hook) {124 add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args']);127 foreach ($this->actions as $hook) { 128 add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); 125 129 } 126 127 130 } 128 129 131 }
Note: See TracChangeset
for help on using the changeset viewer.