class-autoloader-handler.php
2 weeks ago
class-autoloader-locator.php
2 weeks ago
class-autoloader.php
2 weeks ago
class-container.php
2 weeks ago
class-hook-manager.php
2 weeks ago
class-latest-autoloader-guard.php
2 weeks ago
class-manifest-reader.php
2 weeks ago
class-path-processor.php
2 weeks ago
class-php-autoloader.php
2 weeks ago
class-plugin-locator.php
2 weeks ago
class-plugins-handler.php
2 weeks ago
class-shutdown-handler.php
2 weeks ago
class-version-loader.php
2 weeks ago
class-version-selector.php
2 weeks ago
index.php
11 months ago
class-hook-manager.php
33 lines
| 1 | <?php |
| 2 | namespace Automattic\Jetpack\Autoloader\jp362475ab3000a6225facecf40e51a264\al5_0_8; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | // phpcs:ignore |
| 5 | class Hook_Manager { |
| 6 | private $registered_hooks; |
| 7 | public function __construct() { |
| 8 | $this->registered_hooks = array(); |
| 9 | } |
| 10 | public function add_action( $tag, $callable, $priority = 10, $accepted_args = 1 ) { |
| 11 | $this->registered_hooks[ $tag ][] = array( |
| 12 | 'priority' => $priority, |
| 13 | 'callable' => $callable, |
| 14 | ); |
| 15 | add_action( $tag, $callable, $priority, $accepted_args ); |
| 16 | } |
| 17 | public function add_filter( $tag, $callable, $priority = 10, $accepted_args = 1 ) { |
| 18 | $this->registered_hooks[ $tag ][] = array( |
| 19 | 'priority' => $priority, |
| 20 | 'callable' => $callable, |
| 21 | ); |
| 22 | add_filter( $tag, $callable, $priority, $accepted_args ); |
| 23 | } |
| 24 | public function reset() { |
| 25 | foreach ( $this->registered_hooks as $tag => $hooks ) { |
| 26 | foreach ( $hooks as $hook ) { |
| 27 | remove_filter( $tag, $hook['callable'], $hook['priority'] ); |
| 28 | } |
| 29 | } |
| 30 | $this->registered_hooks = array(); |
| 31 | } |
| 32 | } |
| 33 |