3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * Customizable resource for setting view options. * * Additional configuration options: * * resources.view.class = "Zend_View" * resources.view.scriptPathSpec = * resources.view.scriptPathNoControllerSpec = * resources.view.suffix = * resources.view.noRender = * resources.view.translator = * resources.view.headTitle.title = * resources.view.headTitle.separator = * resources.view.headTitle.defaultAttachOrder = * * Options providing Zend_Application_Resource_View functionality: * * resources.view.doctype = * resources.view.charset = * resources.view.contentType = * * Options handled by the Zend_View_Abstract constructor: * * resources.view.escape = * resources.view.encoding = * resources.view.basePath = * resources.view.basePathPrefix = * resources.view.scriptPath = * resources.view.helperPath = * resources.view.filterPath = * resources.view.filter = * resources.view.strictVars = * resources.view.lfiProtectionOn = * resources.view.assign = * * * @version 2014-06-23 / 2013-12-05 * @author xemlock */ class Zefram_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract { /** * @var string */ protected $_viewClass = 'Zend_View'; /** * @var Zend_View_Abstract */ protected $_view; /** * @param array $options */ public function __construct(array $options = null) { if (isset($options['class'])) { $this->_class = $options['class']; unset($options['class']); } $options = array_change_key_case($options, CASE_LOWER); parent::__construct($options); } /** * @return Zend_View_Abstract */ public function init() { $options = $this->getOptions(); $view = new {$this->_viewClass}($options); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->setView($view); // Set view script path specification if (isset($options['scriptpathspec'])) { $viewRenderer->setViewScriptPathSpec($options['scriptpathspec']); } // Set view script path specification (no controller variant) if (isset($options['scriptpathnocontrollerspec'])) { $viewRenderer->setViewScriptPathNoControllerSpec($options['scriptpathnocontrollerspec']); } // Set view script suffix if (isset($options['suffix'])) { $viewRenderer->setViewSuffix($options['suffix']); } // Set the auto-render flag if (isset($options['norender'])) { $viewRenderer->setNoRender($options['norender']); } // Set doctype using doctype view helper if (isset($options['doctype'])) { $view->doctype()->setDoctype(strtoupper($options['doctype'])); } // Create an HTML5-style meta charset tag using headMeta view helper if (isset($options['charset'])) { if (!$view->doctype()->isHtml5()) { throw new Zend_View_Exception('Meta charset tag requires an HTML5 doctype'); } $view->headMeta()->setCharset($options['charset']); } // Set content-type meta tag using headMeta view helper if (isset($options['contenttype'])) { $view->headMeta()->appendHttpEquiv('Content-Type', $options['contenttype']); } // Add http-equiv meta tags using headMeta view helper if (isset($options['httpequiv'])) { foreach ((array) $httpEquiv as $key => $value) { $view->headMeta()->appendHttpEquiv($key, $value); } } // Set head title if (isset($options['headtitle'])) { foreach ($options['headtitle'] as $key => $value) { switch (strtolower($key)) { case 'title': $view->headTitle()->set($value); break; case 'separator': $view->headTitle()->setSeparator($value); break; case 'defaultattachorder': $view->headTitle()->setDefaultAttachOrder($value); break; } } } // Set a translation adapter for translate view helper if (isset($options['translator'])) { $translate = $options['translator']; if (is_string($translate)) { $bootstrap = $this->getBootstrap(); if ($bootstrap->hasResource($translate) || $bootstrap->hasPluginResource($translate)) { $bootstrap->bootstrap($translate); $translate = $bootstrap->getResource($translate); } else { $translate = null; } } if ($translate) { $view->translate()->setTranslator($translate); } } return $view; } /** * Return initialized view object. * * @return Zend_View_Abstract|null */ public function getView() { return $this->_view; } }
Output for 5.3.0 - 5.4.29
Parse error: syntax error, unexpected '{' in /in/OoBA7 on line 76
Process exited with code 255.