| 1 |
<?php |
| 2 |
|
| 3 |
namespace ISC; |
| 4 |
|
| 5 |
/** |
| 6 |
* Plugin class |
| 7 |
*/ |
| 8 |
class Plugin { |
| 9 |
use Options; |
| 10 |
|
| 11 |
/** |
| 12 |
* Check if this is the pro version |
| 13 |
* |
| 14 |
* @return bool |
| 15 |
*/ |
| 16 |
public static function is_pro(): bool { |
| 17 |
return defined( 'ISCPRO' ); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Return true if the mentioned module is enabled |
| 22 |
* |
| 23 |
* @param string $module module name. |
| 24 |
* |
| 25 |
* @return bool |
| 26 |
*/ |
| 27 |
public static function is_module_enabled( string $module ) { |
| 28 |
$options = self::get_options(); |
| 29 |
|
| 30 |
// all modules are enabled by default; i.e., when the option is not set |
| 31 |
if ( ! isset( $options['modules'] ) ) { |
| 32 |
return true; |
| 33 |
} |
| 34 |
|
| 35 |
return ( is_array( $options['modules'] ) && in_array( $module, $options['modules'], true ) ); |
| 36 |
} |
| 37 |
} |
| 38 |
|