コード例 #1
0
ファイル: chain.php プロジェクト: stonyyi/anahita
 /**
  * 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
0
 /**
  * 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
0
ファイル: default.php プロジェクト: stonyyi/anahita
 /**
  * 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
0
 /**
  * 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
0
ファイル: default.php プロジェクト: Roma48/mayak
 /**
  * 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));
 }