mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- extensions class for future integrations;
This commit is contained in:
+62
-2
@@ -198,6 +198,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
|
||||
// include hook files
|
||||
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
|
||||
//run hook for extensions init
|
||||
add_action( 'plugins_loaded', array( &$this, 'extensions_init' ), -19 );
|
||||
|
||||
add_action( 'init', array( &$this, 'old_update_patch' ), 0 );
|
||||
|
||||
@@ -478,6 +480,14 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function extensions_init() {
|
||||
do_action( 'um_core_loaded' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Include required core files used in admin and on the frontend.
|
||||
*
|
||||
@@ -541,8 +551,45 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->mobile();
|
||||
$this->external_integrations();
|
||||
$this->gdpr();
|
||||
//$this->uploader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get extension API
|
||||
*
|
||||
* @since 2.0.34
|
||||
*
|
||||
* @param $slug
|
||||
*
|
||||
* @return um_ext\um_bbpress\Init
|
||||
*/
|
||||
function extension( $slug ) {
|
||||
if ( empty( $this->classes[ $slug ] ) ) {
|
||||
$class = "um_ext\um_{$slug}\Init";
|
||||
|
||||
/**
|
||||
* @var $class um_ext\um_bbpress\Init
|
||||
*/
|
||||
$this->classes[ $slug ] = $class::instance();
|
||||
}
|
||||
|
||||
return $this->classes[ $slug ];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function call_class( $class ) {
|
||||
$key = strtolower( $class );
|
||||
|
||||
if ( empty( $this->classes[ $key ] ) ) {
|
||||
$this->classes[ $key ] = new $class;
|
||||
}
|
||||
|
||||
return $this->classes[ $key ];
|
||||
}
|
||||
|
||||
|
||||
@@ -844,6 +891,19 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0.34
|
||||
*
|
||||
* @return um\Extensions
|
||||
*/
|
||||
function extensions() {
|
||||
if ( empty( $this->classes['extensions'] ) ) {
|
||||
$this->classes['extensions'] = new um\Extensions();
|
||||
}
|
||||
|
||||
return $this->classes['extensions'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
|
||||
Reference in New Issue
Block a user