7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
24 * Abstract master class for extension.
26 require_once 'Zend/View/Abstract.php';
30 * Concrete class for handling view scripts.
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35 * @license http://framework.zend.com/license/new-bsd New BSD License
37 class Zend_View
extends Zend_View_Abstract
40 * Whether or not to use streams to mimic short tags
43 private $_useViewStream = false;
46 * Whether or not to use stream wrapper if short_open_tag is false
49 private $_useStreamWrapper = false;
54 * Register Zend_View_Stream stream wrapper if short tags are disabled.
56 * @param array $config
59 public function __construct($config = array())
61 $this->_useViewStream
= (bool) ini_get('short_open_tag') ?
false : true;
62 if ($this->_useViewStream
) {
63 if (!in_array('zend.view', stream_get_wrappers())) {
64 require_once 'Zend/View/Stream.php';
65 stream_wrapper_register('zend.view', 'Zend_View_Stream');
69 if (array_key_exists('useStreamWrapper', $config)) {
70 $this->setUseStreamWrapper($config['useStreamWrapper']);
73 parent
::__construct($config);
77 * Set flag indicating if stream wrapper should be used if short_open_tag is off
82 public function setUseStreamWrapper($flag)
84 $this->_useStreamWrapper
= (bool) $flag;
89 * Should the stream wrapper be used if short_open_tag is off?
93 public function useStreamWrapper()
95 return $this->_useStreamWrapper
;
99 * Includes the view script in a scope with only public $this variables.
101 * @param string The view script to execute.
103 protected function _run()
105 if ($this->_useViewStream
&& $this->useStreamWrapper()) {
106 include 'zend.view://' . func_get_arg(0);
108 include func_get_arg(0);