mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- wpcs;
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace um;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ultimate Member Dependency Checker
|
||||
@@ -12,7 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
*/
|
||||
if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Dependencies
|
||||
*
|
||||
@@ -20,171 +19,163 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
*/
|
||||
class Dependencies {
|
||||
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private static $active_plugins;
|
||||
|
||||
|
||||
/**
|
||||
* For backward compatibility checking
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $ext_required_version = array(
|
||||
'bbpress' => '2.0.7',
|
||||
'followers' => '2.1.6',
|
||||
'forumwp' => '2.0.4',
|
||||
'friends' => '2.1.4',
|
||||
'frontend-posting' => '1.0.0',
|
||||
'google-authenticator' => '1.0.0',
|
||||
'groups' => '2.1.7',
|
||||
'instagram' => '2.0.5',
|
||||
'jobboardwp' => '1.0.0',
|
||||
'mailchimp' => '2.2.0',
|
||||
'messaging' => '2.2.5',
|
||||
'mycred' => '2.1.6',
|
||||
'notices' => '2.0.5',
|
||||
'notifications' => '2.1.3',
|
||||
'online' => '2.1.1',
|
||||
'private-content' => '2.0.5',
|
||||
'profile-completeness' => '2.1.2',
|
||||
'profile-tabs' => '1.0.0',
|
||||
'recaptcha' => '2.1.2',
|
||||
'reviews' => '2.1.5',
|
||||
'social-activity' => '2.2.0',
|
||||
'social-login' => '2.2.0',
|
||||
'terms-conditions' => '2.1.1',
|
||||
'unsplash' => '2.0.2',
|
||||
'user-bookmarks' => '2.0.2',
|
||||
'user-locations' => '1.0.0',
|
||||
'user-notes' => '1.0.0',
|
||||
'user-photos' => '2.0.4',
|
||||
'user-tags' => '2.1.0',
|
||||
'verified-users' => '2.0.5',
|
||||
'woocommerce' => '2.1.9',
|
||||
'bbpress' => '2.0.7',
|
||||
'followers' => '2.1.6',
|
||||
'forumwp' => '2.0.4',
|
||||
'friends' => '2.1.4',
|
||||
'groups' => '2.1.7',
|
||||
'jobboardwp' => '1.0.0',
|
||||
'mailchimp' => '2.2.0',
|
||||
'messaging' => '2.2.5',
|
||||
'mycred' => '2.1.6',
|
||||
'notices' => '2.0.5',
|
||||
'notifications' => '2.1.3',
|
||||
'online' => '2.1.1',
|
||||
'private-content' => '2.0.5',
|
||||
'profile-completeness' => '2.1.2',
|
||||
'profile-tabs' => '1.0.0',
|
||||
'recaptcha' => '2.1.2',
|
||||
'reviews' => '2.1.5',
|
||||
'social-activity' => '2.2.0',
|
||||
'social-login' => '2.2.0',
|
||||
'stripe' => '1.0.0',
|
||||
'terms-conditions' => '2.1.1',
|
||||
'unsplash' => '2.0.2',
|
||||
'user-bookmarks' => '2.0.2',
|
||||
'user-locations' => '1.0.0',
|
||||
'user-notes' => '1.0.0',
|
||||
'user-photos' => '2.0.4',
|
||||
'user-tags' => '2.1.0',
|
||||
'verified-users' => '2.0.5',
|
||||
'woocommerce' => '2.1.9',
|
||||
|
||||
/*????*/
|
||||
'restrict-content' => '2.0',
|
||||
'restrict-content' => '2.0',
|
||||
|
||||
/*alpha*/
|
||||
'user-exporter' => '1.0.0',
|
||||
|
||||
'user-exporter' => '1.0.0',
|
||||
'google-authenticator' => '1.0.0',
|
||||
'frontend-posting' => '1.0.0',
|
||||
/*in development*/
|
||||
'filesharing' => '1.0.0',
|
||||
'beaver-builder' => '2.0',
|
||||
'user-events' => '1.0.0',
|
||||
'stripe' => '1.0.0',
|
||||
);
|
||||
'filesharing' => '1.0.0',
|
||||
'beaver-builder' => '2.0',
|
||||
'user-events' => '1.0.0',
|
||||
|
||||
// deprecated
|
||||
'instagram' => '2.0.5',
|
||||
);
|
||||
|
||||
/**
|
||||
* Get all active plugins
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
self::$active_plugins = (array) get_option( 'active_plugins', array() );
|
||||
|
||||
if ( is_multisite() )
|
||||
if ( is_multisite() ) {
|
||||
self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_active_plugins() {
|
||||
if ( ! self::$active_plugins ) self::init();
|
||||
if ( ! self::$active_plugins ) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
return self::$active_plugins;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if UltimateMember core plugin is active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ultimatemember_active_check() {
|
||||
|
||||
if ( ! self::$active_plugins ) self::init();
|
||||
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();
|
||||
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 ForumWP plugin is active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function forumwp_active_check() {
|
||||
|
||||
if ( ! self::$active_plugins ) self::init();
|
||||
if ( ! self::$active_plugins ) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
return in_array( 'forumwp/forumwp.php', self::$active_plugins ) || array_key_exists( 'forumwp/forumwp.php', self::$active_plugins );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if JobBoardWP plugin is active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function jobboardwp_active_check() {
|
||||
|
||||
if ( ! self::$active_plugins ) self::init();
|
||||
if ( ! self::$active_plugins ) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
return in_array( 'jobboardwp/jobboardwp.php', self::$active_plugins ) || array_key_exists( 'jobboardwp/jobboardwp.php', self::$active_plugins );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if myCRED plugin is active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function mycred_active_check() {
|
||||
|
||||
if ( ! self::$active_plugins ) self::init();
|
||||
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();
|
||||
if ( ! self::$active_plugins ) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
return in_array( 'woocommerce/woocommerce.php', self::$active_plugins ) || array_key_exists( 'woocommerce/woocommerce.php', self::$active_plugins );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare UM core and extension versions
|
||||
*
|
||||
@@ -228,17 +219,13 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $extension_version Extension version
|
||||
* @return mixed
|
||||
*/
|
||||
public static function php_version_check( $extension_version ) {
|
||||
|
||||
return version_compare( phpversion(), $extension_version, '>=' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,4 +239,4 @@ if ( ! function_exists( 'is_um_active' ) ) {
|
||||
function is_um_active() {
|
||||
return Dependencies::ultimatemember_active_check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user