Skip to content

Instantly share code, notes, and snippets.

@gergoerdosi
Created May 26, 2011 09:01
Show Gist options
  • Save gergoerdosi/992805 to your computer and use it in GitHub Desktop.
Save gergoerdosi/992805 to your computer and use it in GitHub Desktop.
Patch to fix typos in Nooku Framework
Index: code/libraries/koowa/event/listener.php
===================================================================
--- code/libraries/koowa/event/listener.php (revision 3368)
+++ code/libraries/koowa/event/listener.php (working copy)
@@ -23,14 +23,14 @@
* @var array
*/
private $__event_handlers;
-
+
/**
* The event priority
*
* @var int
*/
protected $_priority;
-
+
/**
* Constructor.
*
@@ -39,14 +39,14 @@
public function __construct(KConfig $config)
{
parent::__construct($config);
-
+
$this->_priority = $config->priority;
-
+
if($config->auto_connect) {
$this->connect($config->dispatcher);
}
}
-
+
/**
* Initializes the options for the object
*
@@ -58,30 +58,30 @@
protected function _initialize(KConfig $config)
{
$config->append(array(
- 'dispatcher' => KFactory::get('lib.koowa.event.dispatcher');
- 'auto_connect' => true
- 'priority' => KCommand::PRIORITY_NORMAL,
+ 'dispatcher' => KFactory::get('lib.koowa.event.dispatcher'),
+ 'auto_connect' => true,
+ 'priority' => KCommand::PRIORITY_NORMAL
));
parent::_initialize($config);
}
-
+
/**
* Get the object identifier
- *
- * @return KIdentifier
+ *
+ * @return KIdentifier
* @see KObjectIdentifiable
*/
public function getIdentifier()
{
return $this->_identifier;
}
-
+
/**
* Get the event handlers of the listener
- *
+ *
* Event handlers always start with 'on' and need to be public methods
- *
+ *
* @return array An array of public methods
*/
public function getEventHandlers()
@@ -89,53 +89,53 @@
if(!$this->__event_handlers)
{
$handlers = array();
-
+
//Get all the public methods
$reflection = new ReflectionClass($this);
- foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
+ foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
{
if(substr($method, 0, 1) == 'on') {
- $handlers[] = $method;
+ $handlers[] = $method;
}
}
-
+
$this->__event_handlers = $handlers;
}
-
+
return $this->__event_handlers;
}
-
+
/**
* Connect to an event dispatcher
- *
+ *
* @param object The event dispatcher to connect too
* @return KEventListener
*/
public function connect(KEventDispatcher $dispatcher)
{
$handlers = $this->getEventHandlers();
-
+
foreach($handlers as $handler) {
- $dispatcher->addEventListener($handler, $this, $this->_priority);
+ $dispatcher->addEventListener($handler, $this, $this->_priority);
}
-
+
return $this;
}
-
+
/**
* Disconnect from an event dispatcher
- *
+ *
* @param object The event dispatcher to disconnect from
* @return KEventListener
*/
public function disconnect(KEventDispatcher $dispatcher)
{
$handlers = $this->getEventHandlers();
-
+
foreach($handlers as $handler) {
- $dispatcher->removeEventListener($handler, $this);
+ $dispatcher->removeEventListener($handler, $this);
}
-
+
return $this;
}
}
\ No newline at end of file
Index: code/plugins/koowa/default.php
===================================================================
--- code/plugins/koowa/default.php (revision 1496)
+++ code/plugins/koowa/default.php (working copy)
@@ -11,20 +11,20 @@
/**
* Default Koowa plugin
- *
- * Koowa plugins can handle a number of events that are dynamically generated. The following
+ *
+ * Koowa plugins can handle a number of events that are dynamically generated. The following
* is a list of available events. This list is not meant to be exclusive.
- *
+ *
* onControllerBefore[Action]
* onControllerAfter[Action]
* where [Action] is Browse, Read, Edit, Add, Delete or any custom controller action
- *
+ *
* onDatabaseBefore[Action]
* onDatabaseAfter[Action]
* where [Action] is Select, Insert, Update or Delete
- *
+ *
* You can create your own Koowa plugins very easily :
- *
+ *
* <code>
* <?php
* class plgKoowaFoo extends plgKoowaDefault
@@ -33,15 +33,15 @@
* {
* //The caller is a reference to the object that is triggering this event
* $caller = $context->caller;
- *
- * //The result is the actual result of the event, if this is an after event
+ *
+ * //The result is the actual result of the event, if this is an after event
* //the result will contain the result of the action.
* $result = $context->result;
- *
+ *
* //The context object can also contain a number of custom properties
* print_r($context);
- * }
- * }
+ * }
+ * }
}
* </code>
*
@@ -51,6 +51,7 @@
* @subpackage Koowa
*/
abstract class PlgKoowaDefault extends KEventListener
+{
/**
* A JRegistry object holding the parameters for the plugin
*
@@ -71,7 +72,7 @@
* @var string
*/
protected $_type = null;
-
+
/**
* Constructor
*/
@@ -94,16 +95,16 @@
if ( isset( $config['type'] ) ) {
$this->_type = $config['type'];
}
-
+
//Force the identifier to NULL for now
$config['identifier'] = null;
-
+
//Set the dispatcher
$config['dispatcher'] = $dispatcher;
parent::__construct(new KConfig($config));
}
-
+
/**
* Loads the plugin language file
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment