From eba717f95f586d2538007bd18da6e9b32b076c30 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 31 Oct 2008 22:12:14 +0000 Subject: Merge over vendor code. git-svn-id: http://gallery.svn.sourceforge.net/svnroot/gallery/trunk/eval/gx/gallery3/trunk@18408 57fcd75e-5312-0410-8df3-f5eb6fbb1595 --- kohana/libraries/Controller.php | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 kohana/libraries/Controller.php (limited to 'kohana/libraries/Controller.php') diff --git a/kohana/libraries/Controller.php b/kohana/libraries/Controller.php new file mode 100644 index 00000000..8572e77f --- /dev/null +++ b/kohana/libraries/Controller.php @@ -0,0 +1,78 @@ +uri = URI::instance(); + + // Input should always be available + $this->input = Input::instance(); + } + + /** + * Handles methods that do not exist. + * + * @param string method name + * @param array arguments + * @return void + */ + public function __call($method, $args) + { + // Default to showing a 404 page + Event::run('system.404'); + } + + /** + * Includes a View within the controller scope. + * + * @param string view filename + * @param array array of view variables + * @return string + */ + public function _kohana_load_view($kohana_view_filename, $kohana_input_data) + { + if ($kohana_view_filename == '') + return; + + // Buffering on + ob_start(); + + // Import the view variables to local namespace + extract($kohana_input_data, EXTR_SKIP); + + // Views are straight HTML pages with embedded PHP, so importing them + // this way insures that $this can be accessed as if the user was in + // the controller, which gives the easiest access to libraries in views + include $kohana_view_filename; + + // Fetch the output and close the buffer + return ob_get_clean(); + } + +} // End Controller Class \ No newline at end of file -- cgit v1.2.3