PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.2
Pods – Custom Content Types and Fields v3.3.9.2
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
111 lines
1 <?php
2
3 namespace Pods;
4
5 // Don't load directly.
6 if ( ! defined( 'ABSPATH' ) ) {
7 die( '-1' );
8 }
9
10 /**
11 * Integration abstract class.
12 *
13 * @since 2.8.0
14 */
15 abstract class Integration {
16
17 /**
18 * Integration hooks.
19 *
20 * @var array[] {
21 * @type array $action {
22 * @type callable $callback The callback or name of the method on current object.
23 * @type int $priority Priority.
24 * @type int $arguments Number of arguments.
25 * }
26 * @type array $filter {
27 * @type callable $callback The callbackor name of the method on current object.
28 * @type int $priority Priority.
29 * @type int $arguments Number of arguments.
30 * }
31 * }
32 */
33 protected $hooks = [
34 'action' => [
35 // 'name' => [ 'callback', 10, 2 ],
36 ],
37 'filter' => [
38 // 'name' => [ 'callback', 10, 2 ],
39 ],
40 ];
41
42 /**
43 * Whether the integration is active.
44 *
45 * @since 2.8.0
46 *
47 * @return bool
48 */
49 public static function is_active() {
50 return false;
51 }
52
53 /**
54 * Add the class hooks.
55 *
56 * @since 2.8.0
57 */
58 public function hook() {
59 foreach ( $this->hooks as $type => $hooks ) {
60 foreach ( $hooks as $hook => $params ) {
61 if ( is_string( $params[0] ) && method_exists( $this, $params[0] ) ) {
62 $params[0] = [ $this, $params[0] ];
63 }
64
65 if ( ! is_callable( $params[0]) ) {
66 _doing_it_wrong( 'hook', 'Pods Integration should have a callable for the first hook parameter', '2.8.0' );
67 }
68
69 array_unshift( $params, $hook );
70 call_user_func_array( 'add_' . $type, $params );
71 }
72 }
73
74 $this->post_hook();
75 }
76
77 /**
78 * Do any post-hook related functionality.
79 *
80 * @since 3.2.7
81 */
82 public function post_hook() {}
83
84 /**
85 * Remove the class hooks.
86 *
87 * @since 2.8.0
88 */
89 public function unhook() {
90 foreach ( $this->hooks as $type => $hooks ) {
91 foreach ( $hooks as $hook => $params ) {
92 if ( is_string( $params[0] ) && is_callable( $this, $params[0] ) ) {
93 $params[0] = [ $this, $params[0] ];
94 }
95 array_unshift( $params, $hook );
96 call_user_func_array( 'remove_' . $type, $params );
97 }
98 }
99
100 $this->post_unhook();
101 }
102
103 /**
104 * Do any post-unhook related functionality.
105 *
106 * @since 3.2.7
107 */
108 public function post_unhook() {}
109
110 }
111