protected function _initView() { $theme = 'default'; $templatePath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates'; Zend_Registry::set('user_date_format', 'm-d-Y'); Zend_Registry::set('calendar_date_format', 'mm-dd-yy'); Zend_Registry::set('db_date_format', 'Y-m-d'); Zend_Registry::set('perpage', 10); Zend_Registry::set('menu', 'home'); Zend_Registry::set('eventid', ''); $dir_name = $_SERVER['DOCUMENT_ROOT'] . rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/'); Zend_Registry::set('acess_file_path', $dir_name . SEPARATOR . "application" . SEPARATOR . "modules" . SEPARATOR . "default" . SEPARATOR . "plugins" . SEPARATOR . "AccessControl.php"); Zend_Registry::set('siteconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "site_constants.php"); Zend_Registry::set('emailconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "email_constants.php"); Zend_Registry::set('emptab_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "emptabconfigure.php"); Zend_Registry::set('emailconfig_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "mail_settings_constants.php"); Zend_Registry::set('application_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "application_constants.php"); $date = new Zend_Date(); Zend_Registry::set('currentdate', $date->get('yyyy-MM-dd HH:mm:ss')); Zend_Registry::set('currenttime', $date->get('HH:mm:ss')); Zend_Registry::set('logo_url', '/public/images/landing_header.jpg'); $view = new Zend_View(); $view->setEscape('stripslashes'); $view->setBasePath($templatePath); $view->setScriptPath(APPLICATION_PATH); $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $this; }
/** * @group ZF-9595 */ public function testEscapeShouldAllowAndUseMoreThanOneArgument() { $view = new Zend_View(); $view->setEscape(array($this, 'escape')); $this->assertEquals('foobar', $view->escape('foo', 'bar')); }
public function testCustomEscape() { $view = new Zend_View(); $view->setEscape('strip_tags'); $original = "<p>Some text</p>"; $escaped = $view->escape($original); $this->assertNotEquals($original, $escaped); $this->assertEquals("Some text", $escaped); }
private static function setupView() { $view = new Zend_View(); $view->setEncoding('ISO-8859-1'); $view->setEscape('htmlentities'); $view->setBasePath('./application/views/'); /** Define o diretório onde estarão as visões */ $view->addHelperPath('./application/views/helpers', 'View_Helper'); Zend_Registry::set('view', $view); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); Zend_Layout::startMvc(array('layoutPath' => './application/layouts')); }