tinypay / event

Event class for Kohana 3.x, written to be lightweight like the one in Kohana 2.x with a few fixes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Sample Usage

class Controller_Welcome extends Controller {

	public function action_index()
	{
		$this->request->response = 'hello, world!';

		$foo = 'foo';

		Event::add('test_one', array($this, 'one'));
		Event::add('test_two', array($this, 'two'));

		Event::run('test_one', $foo);

		echo $foo.'
'; } public function one() { echo Event::$data.'
'; Event::$data = 'bar'; $blah = 'inner_foo'; Event::run('test_two', $blah); echo $blah.'
'; echo Event::$data.'
'; } public function two() { echo Event::$data.'
'; Event::$data = 'inner_foo_modified!'; } } // End Welcome

Output

foo
inner_foo
inner_foo_modified!
bar
bar
hello, world!

About

Event class for Kohana 3.x, written to be lightweight like the one in Kohana 2.x with a few fixes