本文整理汇总了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);
}