PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.8.0
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.8.0
1.8.0 1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 All 27 releases
flywp / vendor / wedevs / wp-utils / src / HookTrait.php

HookTrait.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.8.0, at vendor/wedevs/wp-utils/src/HookTrait.php

61 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WeDevs\WpUtils;
4
5 trait HookTrait {
6
7 /**
8 * Add action hook.
9 *
10 * @param string $hook
11 * @param string $callback
12 * @param int $priority
13 * @param int $args
14 *
15 * @return true
16 */
17 public function add_action( $hook, $callback, $priority = 10, $args = 1 ) {
18 return add_action( $hook, [$this, $callback], $priority, $args );
19 }
20
21 /**
22 * Add filter hook.
23 *
24 * @param string $hook
25 * @param string $callback
26 * @param int $priority
27 * @param int $args
28 *
29 * @return true
30 */
31 public function add_filter( $hook, $callback, $priority = 10, $args = 1 ) {
32 return add_filter( $hook, [$this, $callback], $priority, $args );
33 }
34
35 /**
36 * Remove action hook.
37 *
38 * @param string $hook
39 * @param string $callback
40 * @param int $priority
41 *
42 * @return bool
43 */
44 public function remove_action( $hook, $callback, $priority = 10 ) {
45 return remove_action( $hook, [$this, $callback], $priority );
46 }
47
48 /**
49 * Remove filter hook.
50 *
51 * @param string $hook
52 * @param string $callback
53 * @param int $priority
54 *
55 * @return bool
56 */
57 public function remove_filter( $hook, $callback, $priority = 10 ) {
58 return remove_filter( $hook, [$this, $callback], $priority );
59 }
60 }
61