Server IP : 149.255.58.128 / Your IP : 216.73.216.215
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /home/wheelch2/public_html/wp-includes/Requests/src//Hooks.php
<?php
/**
* Handles adding and dispatching events
*
* @package Requests\EventDispatcher
*/
namespace WpOrg\Requests;
use WpOrg\Requests\Exception\InvalidArgument;
use WpOrg\Requests\HookManager;
use WpOrg\Requests\Utility\InputValidator;
/**
* Handles adding and dispatching events
*
* @package Requests\EventDispatcher
*/
class Hooks implements HookManager {
/**
* Registered callbacks for each hook
*
* @var array
*/
protected $hooks = [];
/**
* Register a callback for a hook
*
* @param string $hook Hook name
* @param callable $callback Function/method to call on event
* @param int $priority Priority number. <0 is executed earlier, >0 is executed later
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $hook argument is not a string.
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $callback argument is not callable.
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $priority argument is not an integer.
*/
public function register($hook, $callback, $priority = 0) {
if (is_string($hook) === false) {
throw InvalidArgument::create(1, '$hook', 'string', gettype($hook));
}
if (is_callable($callback) === false) {
throw InvalidArgument::create(2, '$callback', 'callable', gettype($callback));
}
if (InputValidator::is_numeric_array_key($priority) === false) {
throw InvalidArgument::create(3, '$priority', 'integer', gettype($priority));
}
if (!isset($this->hooks[$hook])) {
$this->hooks[$hook] = [
$priority => [],
];
} elseif (!isset($this->hooks[$hook][$priority])) {
$this->hooks[$hook][$priority] = [];
}
$this->hooks[$hook][$priority][] = $callback;
}
/**
* Dispatch a message
*
* @param string $hook Hook name
* @param array $parameters Parameters to pass to callbacks
* @return boolean Successfulness
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $hook argument is not a string.
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $parameters argument is not an array.
*/
public function dispatch($hook, $parameters = []) {
if (is_string($hook) === false) {
throw InvalidArgument::create(1, '$hook', 'string', gettype($hook));
}
// Check strictly against array, as Array* objects don't work in combination with `call_user_func_array()`.
if (is_array($parameters) === false) {
throw InvalidArgument::create(2, '$parameters', 'array', gettype($parameters));
}
if (empty($this->hooks[$hook])) {
return false;
}
if (!empty($parameters)) {
// Strip potential keys from the array to prevent them being interpreted as parameter names in PHP 8.0.
$parameters = array_values($parameters);
}
ksort($this->hooks[$hook]);
foreach ($this->hooks[$hook] as $priority => $hooked) {
foreach ($hooked as $callback) {
$callback(...$parameters);
}
}
return true;
}
public function __wakeup() {
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
}
}
Name |
Size |
Last Modified |
Owner / Group |
Permissions |
Options |
.. | -- | May 29 2023 22:38:19 | 1032 / wheelch2 | 0755 | |
Auth | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Cookie | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Exception | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Proxy | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Response | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Transport | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
Utility | -- | May 29 2023 22:38:18 | 1032 / wheelch2 | 0755 | |
| | | | | |
Auth.php | 0.84 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Autoload.php | 9.116 KB | April 05 2023 17:42:26 | 1032 / wheelch2 | 0644 | |
Capability.php | 0.637 KB | April 05 2023 17:42:26 | 1032 / wheelch2 | 0644 | |
Cookie.php | 14.752 KB | April 05 2023 17:42:26 | 1032 / wheelch2 | 0644 | |
Exception.php | 1.088 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
HookManager.php | 0.692 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Hooks.php | 2.961 KB | October 12 2023 17:04:34 | 1032 / wheelch2 | 0644 | |
IdnaEncoder.php | 12.144 KB | April 05 2023 17:42:26 | 1032 / wheelch2 | 0644 | |
Ipv6.php | 5.507 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Iri.php | 28.928 KB | October 12 2023 17:04:34 | 1032 / wheelch2 | 0644 | |
Port.php | 1.47 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Proxy.php | 0.847 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Requests.php | 33.203 KB | November 09 2023 02:02:24 | 1032 / wheelch2 | 0644 | |
Response.php | 4.181 KB | April 05 2023 17:42:26 | 1032 / wheelch2 | 0644 | |
Session.php | 8.894 KB | October 12 2023 17:04:34 | 1032 / wheelch2 | 0644 | |
Ssl.php | 5.298 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |
Transport.php | 1.508 KB | December 16 2022 03:02:18 | 1032 / wheelch2 | 0644 | |