PluginProbe ʕ •ᴥ•ʔ
External Links – nofollow, noopener & new window / 2.66
External Links – nofollow, noopener & new window v2.66
2.66 0.31 0.32 0.33 0.34 0.35 1.01 1.02 1.03 1.10 1.20 1.21 1.30 1.31 1.40 1.41 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.60 1.61 1.62 1.70 1.80 1.81 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 2.3 2.32 2.35 2.40 2.42 2.43 2.45 2.46 2.47 2.48 2.50 2.51 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 trunk 0.10 0.11 0.12 0.20 0.21 0.30
wp-external-links / libs / fwp / component-bases / class-fwp-register-hook-base.php
wp-external-links / libs / fwp / component-bases Last commit date
class-fwp-plugin-base.php 1 year ago class-fwp-register-hook-base.php 1 year ago class-fwp-settings-section-base.php 3 years ago class-fwp-template-tag-base.php 3 years ago
class-fwp-register-hook-base.php
84 lines
1 <?php
2 /**
3 * Class FWP_Register_Hook_Base_1x0x0
4 *
5 * @package FWP
6 * @category WordPress Library
7 * @version 1.0.0
8
9 * @link https://www.webfactoryltd.com/
10 */
11 abstract class FWP_Register_Hook_Base_1x0x0 extends WPRun_Base_1x0x0
12 {
13
14 /**
15 * @var string
16 */
17 protected $hook_type = null;
18
19 /**
20 * @var wpdb
21 */
22 private $wpdb = null;
23
24 /**
25 * Initialize
26 * @triggers E_USER_NOTICE Hook function does not exist
27 */
28 protected function init( $plugin_file, wpdb $wpdb )
29 {
30 $this->wpdb = $wpdb;
31
32 $wp_hook_function = 'register_'. $this->hook_type .'_hook';
33
34 if ( ! function_exists( $wp_hook_function ) ) {
35 return false;
36 }
37
38 $wp_hook_function(
39 $plugin_file
40 , $this->get_callback( 'procedure' )
41 );
42 }
43
44 /**
45 * Plugin activation procedure
46 */
47 protected function procedure( $networkwide = null )
48 {
49 if ( is_multisite() && $networkwide ) {
50 // network activation
51 $sites = get_sites();
52 $active_blog = $this->wpdb->blogid;
53
54 foreach ( $sites as $site ) {
55 switch_to_blog( $site->blog_id );
56 $this->site_procedure();
57 }
58
59 // switch back to active blog
60 switch_to_blog( $active_blog );
61
62 $this->network_procedure();
63 } else {
64 // single site activation
65 $this->site_procedure();
66 }
67 }
68
69 /**
70 * Network hook procedure
71 * @return void
72 */
73 protected function network_procedure()
74 {
75 }
76
77 /**
78 * Site hook procedure
79 * @return void
80 */
81 abstract protected function site_procedure();
82
83 }
84