public function renderPartial(Container $container = null, $partial = null) { if (null === $container) { $container = $this->getContainer(); } if (null === $partial) { $partial = $this->getPartial(); } if (empty($partial)) { $e = new Exception('Unable to render menu: No partial view script provided'); $e->setView($this->view); throw $e; } $model = array('container' => $container); if (is_array($partial)) { if (count($partial) != 2) { $e = new Exception('Unable to render menu: A view partial supplied as an array must contain two values: partial view script and module where script can be found'); $e->setView($this->view); throw $e; } return $this->view->partial($partial[0], $partial[1], $model); } return $this->view->partial($partial, null, $model); }
protected function _script($name) { if ($this->isLfiProtectionOn() && preg_match('#\\.\\.[\\\\/]#', $name)) { $e = new Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)'); $e->setView($this); throw $e; } if (0 == count($this->_path['script'])) { $e = new Exception('no view script directory set; unable to determine location for view script'); $e->setView($this); throw $e; } foreach ($this->_path['script'] as $dir) { if (is_readable($dir . $name)) { return $dir . $name; } } $message = "script '{$name}' not found in path (" . implode(PATH_SEPARATOR, $this->_path['script']) . ")"; $e = new Exception($message); $e->setView($this); throw $e; }