本文整理匯總了PHP中MS_Plugin::set_api方法的典型用法代碼示例。如果您正苦於以下問題:PHP MS_Plugin::set_api方法的具體用法?PHP MS_Plugin::set_api怎麽用?PHP MS_Plugin::set_api使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MS_Plugin
的用法示例。
在下文中一共展示了MS_Plugin::set_api方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Construct Settings manager.
*
* @since 1.0.0
* @internal
*/
public function __construct()
{
parent::__construct();
$this->settings = MS_Plugin::instance()->settings;
/**
* Simple check to allow other plugins to quickly find out if
* Membership2 is loaded and the API was initialized.
*
* Example:
* if ( apply_filters( 'ms_active', false ) ) { ... }
*/
add_filter('ms_active', '__return_true');
/**
* Make the API controller accessible via MS_Plugin::$api
*/
MS_Plugin::set_api($this);
/**
* Notify other plugins that Membership2 is ready.
*/
do_action('ms_init', $this);
}
示例2: __construct
/**
* Private constructor: Singleton pattern.
*
* @since 1.0.0
* @internal
*/
protected function __construct()
{
$this->settings = MS_Plugin::instance()->settings;
/**
* Simple check to allow other plugins to quickly find out if
* Membership2 is loaded and the API was initialized.
*
* Example:
* if ( apply_filters( 'ms_active', false ) ) { ... }
*
* @since 1.0.0
*/
add_filter('ms_active', '__return_true');
/**
* Make the API controller accessible via static property.
*
* Example:
* $api = MS_Plugin::$api;
*
* Alternative:
* $api = apply_filters( 'ms_api', false );
*
* @since 1.0.0
*/
MS_Plugin::set_api($this);
/**
* Notify other plugins that Membership2 is ready.
*
* @since 1.0.0
*/
do_action('ms_init', $this);
}