- extensions class for future integrations;

This commit is contained in:
nikitozzzzzzz
2018-11-28 11:13:51 +02:00
parent 304845b255
commit 9304f7a982
4 changed files with 313 additions and 8 deletions
+62 -2
View File
@@ -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