PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / rmccue / requests / library / Requests / Hooks.php
ameliabooking / vendor / rmccue / requests / library / Requests Last commit date
Auth 4 years ago Cookie 2 years ago Exception 4 years ago Proxy 4 years ago Response 4 years ago Transport 2 years ago Utility 2 years ago Auth.php 4 years ago Cookie.php 4 years ago Exception.php 4 years ago Hooker.php 4 years ago Hooks.php 2 years ago IDNAEncoder.php 4 years ago IPv6.php 4 years ago IRI.php 2 years ago Proxy.php 4 years ago Response.php 4 years ago SSL.php 4 years ago Session.php 2 years ago Transport.php 4 years ago
Hooks.php
72 lines
1 <?php
2 /**
3 * Handles adding and dispatching events
4 *
5 * @package Requests
6 * @subpackage Utilities
7 */
8
9 /**
10 * Handles adding and dispatching events
11 *
12 * @package Requests
13 * @subpackage Utilities
14 */
15 class Requests_Hooks implements Requests_Hooker {
16
17 public function __wakeup(){throw new \LogicException( __CLASS__ . " should never be unserialized" );}
18
19 /**
20 * Registered callbacks for each hook
21 *
22 * @var array
23 */
24 protected $hooks = array();
25
26 /**
27 * Constructor
28 */
29 public function __construct() {
30 // pass
31 }
32
33 /**
34 * Register a callback for a hook
35 *
36 * @param string $hook Hook name
37 * @param callback $callback Function/method to call on event
38 * @param int $priority Priority number. <0 is executed earlier, >0 is executed later
39 */
40 public function register($hook, $callback, $priority = 0) {
41 if (!isset($this->hooks[$hook])) {
42 $this->hooks[$hook] = array();
43 }
44 if (!isset($this->hooks[$hook][$priority])) {
45 $this->hooks[$hook][$priority] = array();
46 }
47
48 $this->hooks[$hook][$priority][] = $callback;
49 }
50
51 /**
52 * Dispatch a message
53 *
54 * @param string $hook Hook name
55 * @param array $parameters Parameters to pass to callbacks
56 * @return boolean Successfulness
57 */
58 public function dispatch($hook, $parameters = array()) {
59 if (empty($this->hooks[$hook])) {
60 return false;
61 }
62
63 foreach ($this->hooks[$hook] as $priority => $hooked) {
64 foreach ($hooked as $callback) {
65 call_user_func_array($callback, $parameters);
66 }
67 }
68
69 return true;
70 }
71 }
72