Permalink
Browse files

Clean up of whitespace

  • Loading branch information...
1 parent 7b058c5 commit dc1e9804bf9087fadec749d0196906bdf1d6e133 @lukemorton committed Jan 11, 2011
Showing with 87 additions and 87 deletions.
  1. +55 −55 classes/prophet/controller.php
  2. +22 −22 classes/prophet/controller/error.php
  3. +1 −1 classes/prophet/exception.php
  4. +9 −9 init.php
@@ -10,71 +10,71 @@ class Prophet_Controller extends Kohana_Controller {
/**
* @var string The view class
- * @protected
+ * @protected
*/
protected $_view_class = 'View';
-
+
/**
* @var array Define viewless actions here
- * @protected
+ * @protected
*/
protected $_viewless = array();
-
+
/**
* @var mixed Holds the current view instance
- * @protected
+ * @protected
*/
protected $_view = NULL;
-
- /**
- * Magic get method used for lazy loading the view so if you
- * don't call the view, it won't be loaded.
- *
- * @param string Variable name
- */
- public function __get($name)
- {
- if ($name === 'view')
- {
- if ($this->_view === NULL && ! in_array($this->request->action(), $this->_viewless))
- {
- $view_parts = array();
-
- foreach (array('directory', 'controller', 'action') as $_part)
- {
- $part = call_user_func(array($this->request, $_part));
-
- if ( ! empty($part))
- {
- $view_parts[] = $part;
- }
- }
-
- // Build the view location
- $view_location = implode('/', $view_parts);
-
- // Load the view using chosen class
- $this->_view = call_user_func($this->_view_class.'::factory', $view_location);
- }
-
- return $this->_view;
- }
- }
-
- /**
- * Magic set method
- *
- * @param string Name
- * @param mixed Value
- * @return void
- */
- public function __set($name, $value)
- {
- if ($name === 'view')
- {
- $this->_view = $value;
- }
- }
+
+ /**
+ * Magic get method used for lazy loading the view so if you
+ * don't call the view, it won't be loaded.
+ *
+ * @param string Variable name
+ */
+ public function __get($name)
+ {
+ if ($name === 'view')
+ {
+ if ($this->_view === NULL && ! in_array($this->request->action(), $this->_viewless))
+ {
+ $view_parts = array();
+
+ foreach (array('directory', 'controller', 'action') as $_part)
+ {
+ $part = call_user_func(array($this->request, $_part));
+
+ if ( ! empty($part))
+ {
+ $view_parts[] = $part;
+ }
+ }
+
+ // Build the view location
+ $view_location = implode('/', $view_parts);
+
+ // Load the view using chosen class
+ $this->_view = call_user_func($this->_view_class.'::factory', $view_location);
+ }
+
+ return $this->_view;
+ }
+ }
+
+ /**
+ * Magic set method
+ *
+ * @param string Name
+ * @param mixed Value
+ * @return void
+ */
+ public function __set($name, $value)
+ {
+ if ($name === 'view')
+ {
+ $this->_view = $value;
+ }
+ }
/**
* The after method turns the view into a response
@@ -1,26 +1,26 @@
<?php defined('SYSPATH') or die('No direct script access.');
class Prophet_Controller_Error extends Controller {
-
- public function before()
- {
- // External requests default to 404
- if ($this->request->is_initial())
- {
- $this->request->action(404);
- }
-
- return parent::before();
- }
-
- public function action_404()
- {
- $this->response->status(404);
- }
-
- public function action_500()
- {
- $this->response->status(500);
- }
-
+
+ public function before()
+ {
+ // External requests default to 404
+ if ($this->request->is_initial())
+ {
+ $this->request->action(404);
+ }
+
+ return parent::before();
+ }
+
+ public function action_404()
+ {
+ $this->response->status(404);
+ }
+
+ public function action_500()
+ {
+ $this->response->status(500);
+ }
+
}
@@ -1 +1 @@
-<?php defined('SYSPATH') or die('No direct script access.');class Prophet_Exception { public static function handler(Exception $e) { if (Kohana::$environment === Kohana::DEVELOPMENT) { Kohana_Exception::handler($e); } // It's a nice time to log :) Kohana::$log->add(Kohana_Log::ERROR, Kohana_Exception::text($e)); if ( ! defined('SUPPRESS_REQUEST')) { $request = array( // Get status from current request 'action' => Request::current()->status(), // If exception has a message this can be passed on 'message' => rawurlencode($e->getMessage()), ); // Override status if HTTP_Exception thrown if ($e instanceof HTTP_Exception) { $request['action'] = $e->getCode(); } echo Request::factory(Route::get('prophet_error')->uri($request)) ->execute() ->send_headers() ->response; } } }
+<?php defined('SYSPATH') or die('No direct script access.');class Prophet_Exception { public static function handler(Exception $e) { if (Kohana::$environment === Kohana::DEVELOPMENT) { Kohana_Exception::handler($e); } // It's a nice time to log :) Kohana::$log->add(Kohana_Log::ERROR, Kohana_Exception::text($e)); if ( ! defined('SUPPRESS_REQUEST')) { $request = array( // Get status from current request 'action' => Request::current()->status(), // If exception has a message this can be passed on 'message' => rawurlencode($e->getMessage()), ); // Override status if HTTP_Exception thrown if ($e instanceof HTTP_Exception) { $request['action'] = $e->getCode(); } echo Request::factory(Route::get('prophet_error')->uri($request)) ->execute() ->send_headers() ->response; } } }
View
@@ -2,19 +2,19 @@
if (Kohana::$errors)
{
- // Override Kohana exception handler
- set_exception_handler(array('prophet', 'exception_handler'));
+ // Override Kohana exception handler
+ set_exception_handler(array('prophet', 'exception_handler'));
}
// Error Route for internal error requests
Route::set('prophet_error', 'prophet_error/<action>(/<message>)', array('action' => '[0-9]{3}', 'message' => '.*'))
- ->defaults(array(
- 'controller' => 'error',
- ));
+ ->defaults(array(
+ 'controller' => 'error',
+ ));
// Catch All Route (404 Response)
Route::set('prophet_catchall', '<catchall>', array('catchall' => '.*'))
- ->defaults(array(
- 'controller' => 'error',
- 'action' => '404',
- ));
+ ->defaults(array(
+ 'controller' => 'error',
+ 'action' => '404',
+ ));

0 comments on commit dc1e980

Please sign in to comment.