コード例 #1
0
ファイル: event.php プロジェクト: stonyyi/anahita
 /**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (is_null($config->event_dispatcher)) {
         throw new KMixinException('event_dispatcher [KEventDispatcher] option is required');
     }
     //Set the event dispatcher
     $this->_event_dispatcher = $config->event_dispatcher;
     //Add the event listeners
     if (!empty($config->event_listeners)) {
         foreach ($config->event_listeners as $event => $listener) {
             $this->addEventListener($event, $listener);
         }
     }
     //Add the event handlers
     if (!empty($config->event_subscribers)) {
         $subscribers = (array) KConfig::unbox($config->event_subscribers);
         foreach ($subscribers as $key => $value) {
             if (is_numeric($key)) {
                 $this->addEventSubscriber($value);
             } else {
                 $this->addEventSubscriber($key, $value);
             }
         }
     }
 }
コード例 #2
0
ファイル: eventdispatcher.php プロジェクト: raeldc/com_learn
 /**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
         
     //Create a event dispatcher object
     $this->_event_dispatcher = $config->event_dispatcher;
 }
コード例 #3
0
ファイル: mimetype.php プロジェクト: raeldc/com_learn
	public function __construct($config = array())
	{
		parent::__construct($config);

		if (isset($config->adapters)) {
			$this->_adapters = $config->adapters;
		}
	}
コード例 #4
0
ファイル: callback.php プロジェクト: raeldc/nooku-server
 /**
  * Object constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (is_null($config->command_chain)) {
         throw new KMixinException('command_chain [KCommandChain] option is required');
     }
     //Set the command priority
     $this->_priority = $config->command_priority;
     //Enque the command in the mixer's command chain
     $config->command_chain->enqueue($this);
 }
コード例 #5
0
ファイル: abstract.php プロジェクト: raeldc/com_learn
	/**
	 * Constructor.
	 *
	 * @param 	object 	An optional KConfig object with configuration options
	 */
	public function __construct( KConfig $config = null) 
	{ 
	    $this->_identifier = $config->identifier;
		parent::__construct($config);
		
		$this->_priority = $config->priority;
		
		//Automatically mixin the behavior
		if($config->auto_mixin) {
		    $this->mixin($this);
		}
	}
コード例 #6
0
 /**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //Create a command chain object
     $this->_command_chain = $config->command_chain;
     //Mixin the callback mixer if callbacks have been enabled
     if ($config->enable_callbacks) {
         $this->_mixer->mixin(new KMixinCallback(new KConfig(array('mixer' => $this->_mixer, 'command_chain' => $this->_command_chain, 'command_priority' => $config->callback_priority))));
     }
     //Enqueue the event command with a lowest priority to make sure it runs last
     if ($config->dispatch_events) {
         $this->_command_chain->enqueue($config->event, $config->event_priority);
     }
 }
コード例 #7
0
ファイル: toolbar.php プロジェクト: stonyyi/anahita
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options.
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //Add the toolbars
     if (!empty($config->toolbars)) {
         $this->_mixer->mixin($this);
         $toolbars = (array) KConfig::unbox($config->toolbars);
         foreach ($toolbars as $key => $value) {
             if (is_numeric($key)) {
                 $this->addToolbar($value);
             } else {
                 $this->addToolbar($key, $value);
             }
         }
     }
 }
コード例 #8
0
 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config = null)
 {
     //Set the service container
     if (isset($config->service_container)) {
         $this->__service_container = $config->service_container;
     }
     //Set the service identifier
     if (isset($config->service_identifier)) {
         $this->__service_identifier = $config->service_identifier;
     }
     parent::__construct($config);
     $this->_priority = $config->priority;
     //Automatically mixin the behavior
     if ($config->auto_mixin) {
         $this->mixin($this);
     }
 }
コード例 #9
0
ファイル: behavior.php プロジェクト: stonyyi/anahita
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options.
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //Set the auto mixin state
     $this->_auto_mixin = $config->auto_mixin;
     if ($config->mixer instanceof KObject) {
         $config->mixer->mixin($this);
     }
     //Add the behaviors
     if (!empty($config->behaviors)) {
         $behaviors = (array) KConfig::unbox($config->behaviors);
         foreach ($behaviors as $key => $value) {
             if (is_numeric($key)) {
                 $this->addBehavior($value);
             } else {
                 $this->addBehavior($key, $value);
             }
         }
     }
 }
コード例 #10
0
ファイル: command.php プロジェクト: stonyyi/anahita
 /**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (is_null($config->command_chain)) {
         throw new KMixinException('command_chain [KCommandChain] option is required');
     }
     //Create a command chain object
     $this->_command_chain = $config->command_chain;
     //Set the mixer in the config
     $config->mixer = $this->_mixer;
     //Mixin the callback mixer if callbacks have been enabled
     if ($config->enable_callbacks) {
         $this->_mixer->mixin(new KMixinCallback($config));
     }
     //Enqueue the event command with a lowest priority to make sure it runs last
     if ($config->dispatch_events) {
         $this->_mixer->mixin(new KMixinEvent($config));
         //@TODO : Add KCommandChain::getCommand()
         $event = $this->_command_chain->getService('koowa:command.event', array('event_dispatcher' => $config->event_dispatcher));
         $this->_command_chain->enqueue($event, $config->event_priority);
     }
 }
コード例 #11
0
 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config = null)
 {
     $this->_identifier = $config->identifier;
     parent::__construct($config);
     $this->_priority = $config->priority;
 }
コード例 #12
0
ファイル: menubar.php プロジェクト: ravenlife/Ninja-Framework
 /**
  * Object constructor
  *
  * @param	array 	An optional associative array of configuration settings.
  * Recognized key values include 'mixer' (this list is not meant to be Comprehensive).
  */
 public function __construct(KConfig $options)
 {
     parent::__construct($options);
     $this->_views = $options->views;
 }