mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
9e53314c3a
- new code structure, optimized for next development; - created spl_autoloader for remove includes; - UM classes with namespaces; - deprecated global $ultimatemember; variable (use UM() instead); - new UM/WP roles logic; - new settings class and logic (deprecated Redux framework, deprecated some old options, added some new options); - new dependencies class for extensions; - WP native styles for backend fields; - new upgrades and license activations for extensions; - new logic form backend forms and fields; - created uninstall.php file for delete permanently all UM settings; - optimized registration/upgrade profile process; Deprecated Hooks: um_new_user_registration_plain um_user_registration_extra_hook um_add_user_frontend um_post_registration_global_hook um_admin_extend_directory_options_general (was action...will be filter)
132 lines
3.3 KiB
PHP
132 lines
3.3 KiB
PHP
<?php
|
|
namespace um;
|
|
|
|
// Exit if executed directly
|
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
/**
|
|
* Ultimate Member Dependency Checker
|
|
*
|
|
* Checks if Ultimate Member plugin is enabled
|
|
*/
|
|
if ( ! class_exists( 'um\Dependencies' ) ) {
|
|
class Dependencies {
|
|
|
|
private static $active_plugins;
|
|
|
|
|
|
/**
|
|
* Get all active plugins
|
|
*/
|
|
public static function init() {
|
|
|
|
self::$active_plugins = (array) get_option( 'active_plugins', array() );
|
|
|
|
if ( is_multisite() )
|
|
self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
|
}
|
|
|
|
|
|
/**
|
|
* Check if UltimateMember core plugin is active
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function ultimatemember_active_check() {
|
|
|
|
if ( ! self::$active_plugins ) self::init();
|
|
|
|
return in_array( 'ultimate-member/ultimate-member.php', self::$active_plugins ) || array_key_exists( 'ultimate-member/ultimate-member.php', self::$active_plugins );
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Check if bbPress plugin is active
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function bbpress_active_check() {
|
|
|
|
if ( ! self::$active_plugins ) self::init();
|
|
|
|
return in_array( 'bbpress/bbpress.php', self::$active_plugins ) || array_key_exists( 'bbpress/bbpress.php', self::$active_plugins );
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Check if myCRED plugin is active
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function mycred_active_check() {
|
|
|
|
if ( ! self::$active_plugins ) self::init();
|
|
|
|
return in_array( 'mycred/mycred.php', self::$active_plugins ) || array_key_exists( 'mycred/mycred.php', self::$active_plugins );
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Check if Woocommerce plugin is active
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function woocommerce_active_check() {
|
|
|
|
if ( ! self::$active_plugins ) self::init();
|
|
|
|
return in_array( 'woocommerce/woocommerce.php', self::$active_plugins ) || array_key_exists( 'woocommerce/woocommerce.php', self::$active_plugins );
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @param string $extension_version Extension version
|
|
* @return mixed
|
|
*/
|
|
public static function ultimatemember_version_check( $extension_version ) {
|
|
|
|
return version_compare( ultimatemember_version, $extension_version, '>=' );
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @param string $extension_version Extension version
|
|
* @return mixed
|
|
*/
|
|
public static function php_version_check( $extension_version ) {
|
|
|
|
return version_compare( phpversion(), $extension_version, '>=' );
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if ( ! function_exists( 'is_um_active' ) ) {
|
|
/**
|
|
* Check UltimateMember core is active
|
|
*
|
|
* @return bool active - true | inactive - false
|
|
*/
|
|
function is_um_active() {
|
|
return Dependencies::ultimatemember_active_check();
|
|
}
|
|
}
|
|
|
|
|
|
if ( ! function_exists( 'is_um_version_required' ) ) {
|
|
/**
|
|
* Check UltimateMember core required version
|
|
*
|
|
* @return bool Larger then required - true | Less than necessary - false
|
|
*/
|
|
function is_um_version_required( $version ) {
|
|
return Dependencies::ultimatemember_version_check( $version );
|
|
}
|
|
} |