public function current() { $path = str_replace(VIEWS, NULL, $this->_iterator->current()->getPathname()); if (!$this->_current instanceof self || $this->_current->path != $path) { $this->_current = View::loadFromPath($path); } return $this->_current; }
private static function __loadExistingView($path) { try { $existing = View::loadFromPath($path); return $existing; } catch (ViewException $e) { switch ($e->getCode()) { case View::ERROR_VIEW_NOT_FOUND: throw new SymphonyErrorPage(__('The view you requested to edit does not exist.'), __('View not found'), NULL, array('header' => 'HTTP/1.0 404 Not Found')); break; default: case View::ERROR_FAILED_TO_LOAD: throw new SymphonyErrorPage(__('The view you requested could not be loaded. Please check it is readable and the XML is valid.'), __('Failed to load view')); break; } } catch (Exception $e) { throw new SymphonyErrorPage(sprintf(__("An unknown error has occurred. %s"), $e->getMessage()), __('Unknown Error'), NULL, array('header' => 'HTTP/1.0 500 Internal Server Error')); } }