本文整理汇总了PHP中KService::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP KService::getInstance方法的具体用法?PHP KService::getInstance怎么用?PHP KService::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KService
的用法示例。
在下文中一共展示了KService::getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Return the singleton instnace of PlgContentfilterChain. This method also imports all the
* content filter plugins.
*
* @return PlgContentfilterChain
*/
public static function getInstance()
{
static $_instance;
if (!$_instance) {
$_instance = new self(new KConfig(array('service_container' => KService::getInstance())));
KService::set('plg:contentfilter.chain', $_instance);
JPluginHelper::importPlugin('contentfilter');
}
return $_instance;
}
示例2: __construct
/**
* Constructor
*
* Prevent creating instances of this class by making the contructor private
*
* @param array An optional array with configuration options.
*/
private final function __construct($config = array())
{
//Initialize the path
$this->_path = dirname(__FILE__);
//Load the legacy functions
require_once $this->_path . '/legacy.php';
//Setup the loader
require_once $this->_path . '/loader/loader.php';
$loader = KLoader::getInstance($config);
//Setup the factory
$service = KService::getInstance($config);
$service->set('koowa:loader', $loader);
}
示例3: __construct
/**
* Constructor
*/
public function __construct($dispatcher, $config = array())
{
if (!$config instanceof KConfig) {
$config = new KConfig($config);
}
//Inject the identifier
$config->service_identifier = KService::getIdentifier('plg:koowa.' . $config['name']);
//Inject the service container
$config->service_container = KService::getInstance();
parent::__construct($config);
//Set the plugin params
if (is_string($config->params)) {
$config->params = $this->_parseParams($config->params);
}
$this->_params = $config->params;
//Setup lazy wiring for publishers we are subscribing too
foreach ($config->event_publishers as $publisher) {
KService::setConfig($publisher, array('event_subscribers' => array($this)));
}
if ($dispatcher instanceof KEventDispatcher) {
$dispatcher->addEventSubscriber($this);
}
}
示例4: __construct
/**
* Constructor
*/
function __construct($dispatcher, $config = array())
{
if (isset($config['params'])) {
if ($config['params'] instanceof JRegistry) {
$this->_params = $config['params'];
} else {
$this->_params = new JRegistry();
$this->_params->loadINI($config['params']);
}
}
if (isset($config['name'])) {
$this->_name = $config['name'];
}
if (isset($config['type'])) {
$this->_type = $config['type'];
}
//Inject the identifier
$config['service_identifier'] = KService::getIdentifier('plg:koowa.' . $this->_name);
//Inject the service container
$config['service_container'] = KService::getInstance();
//Inject the dispatcher
$config['dispatcher'] = $dispatcher;
parent::__construct(new KConfig($config));
}
示例5: __construct
/**
* Constructor
*/
function __construct($dispatcher, $config = array())
{
if (isset($config['params'])) {
if ($config['params'] instanceof JRegistry) {
$this->_params = $config['params'];
} else {
$this->_params = new JRegistry();
if (version_compare(JVERSION, '1.6', '<')) {
$this->_params->loadINI($config['params']);
} else {
$this->_params->loadString($config['params'], 'INI');
}
}
}
if (isset($config['name'])) {
$this->_name = $config['name'];
}
if (isset($config['type'])) {
$this->_type = $config['type'];
}
//Inject the identifier
$config['service_identifier'] = KService::getIdentifier('plg:koowa.' . $this->_name);
//Inject the service container
$config['service_container'] = KService::getInstance();
//Inject the dispatcher
$config['dispatcher'] = KService::get('com://admin/default.event.dispatcher');
parent::__construct(new KConfig($config));
}