PluginProbe
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables / 2.3.0
TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables & Post Tables v2.3.0
2.3.0 2.2.14 2.2.13 2.2.12 2.2.11 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 trunk 1.0.0 1.0.1 2.0.0 2.0.1 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2
← All changes | includes/Traits/PluginHelper.php +22 -8 2.2.7 → 2.3.0 View file →
@@ -1,5 +1,10 @@
1 1 <?php
2 +/**
3 + * Shared plugin-status helper methods
4 + *
5 + * @package TableKit
6 + */
2 7
3 8 namespace TableBuilder\Traits;
4 9
5 10 /**
@@ -7,25 +12,34 @@
7 12 * This is a factory singleton
8 13 *
9 14 * @package TableBuilder\Traits
10 15 */
11 -trait PluginHelper{
12 - public static function is_plugin_active( $plugin ) {
16 +trait PluginHelper {
17 + /**
18 + * Checks whether a plugin is active, site-wide or network-wide.
19 + *
20 + * @param string $plugin Plugin basename, e.g. "table-builder-block-pro/table-builder-block-pro.php".
21 + * @return bool True if the plugin is active on this site or network-wide.
22 + */
23 + public static function is_plugin_active( $plugin ) {
13 24 return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || self::is_plugin_active_for_network( $plugin );
14 25 }
15 26
16 - /**
17 - * Check for network plugin active
18 - */
27 + /**
28 + * Checks whether a plugin is network-activated on a multisite install.
29 + *
30 + * @param string $plugin Plugin basename, e.g. "table-builder-block-pro/table-builder-block-pro.php".
31 + * @return bool True if the plugin is network-active; always false on non-multisite.
32 + */
19 33 public static function is_plugin_active_for_network( $plugin ) {
20 34 if ( ! is_multisite() ) {
21 35 return false;
22 36 }
23 -
37 +
24 38 $plugins = get_site_option( 'active_sitewide_plugins' );
25 39 if ( isset( $plugins[ $plugin ] ) ) {
26 40 return true;
27 41 }
28 -
42 +
29 43 return false;
30 44 }
31 -}
45 +}