PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.8.4
Pods – Custom Content Types and Fields v3.2.8.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Integration.php
pods / src / Pods Last commit date
API 2 days ago Admin 2 days ago Blocks 2 days ago CLI 2 days ago Container 2 days ago Data 2 days ago Integrations 2 days ago REST 2 days ago Theme 2 days ago Tools 2 days ago WP 2 days ago Whatsit 2 days ago Config_Handler.php 2 days ago Integration.php 2 days ago Permissions.php 2 days ago Pod_Manager.php 2 days ago Service_Provider.php 2 days ago Service_Provider_Base.php 2 days ago Static_Cache.php 2 days ago Whatsit.php 2 days ago Wisdom_Tracker.php 2 days ago
Integration.php
106 lines
1 <?php
2
3 namespace Pods;
4
5 /**
6 * Integration abstract class.
7 *
8 * @since 2.8.0
9 */
10 abstract class Integration {
11
12 /**
13 * Integration hooks.
14 *
15 * @var array[] {
16 * @type array $action {
17 * @type callable $callback The callback or name of the method on current object.
18 * @type int $priority Priority.
19 * @type int $arguments Number of arguments.
20 * }
21 * @type array $filter {
22 * @type callable $callback The callbackor name of the method on current object.
23 * @type int $priority Priority.
24 * @type int $arguments Number of arguments.
25 * }
26 * }
27 */
28 protected $hooks = [
29 'action' => [
30 // 'name' => [ 'callback', 10, 2 ],
31 ],
32 'filter' => [
33 // 'name' => [ 'callback', 10, 2 ],
34 ],
35 ];
36
37 /**
38 * Whether the integration is active.
39 *
40 * @since 2.8.0
41 *
42 * @return bool
43 */
44 public static function is_active() {
45 return false;
46 }
47
48 /**
49 * Add the class hooks.
50 *
51 * @since 2.8.0
52 */
53 public function hook() {
54 foreach ( $this->hooks as $type => $hooks ) {
55 foreach ( $hooks as $hook => $params ) {
56 if ( is_string( $params[0] ) && method_exists( $this, $params[0] ) ) {
57 $params[0] = [ $this, $params[0] ];
58 }
59
60 if ( ! is_callable( $params[0]) ) {
61 _doing_it_wrong( 'hook', 'Pods Integration should have a callable for the first hook parameter', '2.8.0' );
62 }
63
64 array_unshift( $params, $hook );
65 call_user_func_array( 'add_' . $type, $params );
66 }
67 }
68
69 $this->post_hook();
70 }
71
72 /**
73 * Do any post-hook related functionality.
74 *
75 * @since 3.2.7
76 */
77 public function post_hook() {}
78
79 /**
80 * Remove the class hooks.
81 *
82 * @since 2.8.0
83 */
84 public function unhook() {
85 foreach ( $this->hooks as $type => $hooks ) {
86 foreach ( $hooks as $hook => $params ) {
87 if ( is_string( $params[0] ) && is_callable( $this, $params[0] ) ) {
88 $params[0] = [ $this, $params[0] ];
89 }
90 array_unshift( $params, $hook );
91 call_user_func_array( 'remove_' . $type, $params );
92 }
93 }
94
95 $this->post_unhook();
96 }
97
98 /**
99 * Do any post-unhook related functionality.
100 *
101 * @since 3.2.7
102 */
103 public function post_unhook() {}
104
105 }
106