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-2008 Zend Technologies USA Inc. (http://www.zend.com)
18
* @license http://framework.zend.com/license/new-bsd New BSD License
23
* Abstract master class for extension.
25
require_once 'Zend/View/Abstract.php';
29
* Concrete class for handling view scripts.
33
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
34
* @license http://framework.zend.com/license/new-bsd New BSD License
36
class Zend_View extends Zend_View_Abstract
39
* Whether or not to use streams to mimic short tags
42
private $_useViewStream = false;
45
* Whether or not to use stream wrapper if short_open_tag is false
48
private $_useStreamWrapper = false;
53
* Register Zend_View_Stream stream wrapper if short tags are disabled.
55
* @param array $config
58
public function __construct($config = array())
60
$this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true;
61
if ($this->_useViewStream) {
62
if (!in_array('zend.view', stream_get_wrappers())) {
63
require_once 'Zend/View/Stream.php';
64
stream_wrapper_register('zend.view', 'Zend_View_Stream');
68
if (array_key_exists('useStreamWrapper', $config)) {
69
$this->setUseStreamWrapper($config['useStreamWrapper']);
72
parent::__construct($config);
76
* Set flag indicating if stream wrapper should be used if short_open_tag is off
81
public function setUseStreamWrapper($flag)
83
$this->_useStreamWrapper = (bool) $flag;
88
* Should the stream wrapper be used if short_open_tag is off?
92
public function useStreamWrapper()
94
return $this->_useStreamWrapper;
98
* Includes the view script in a scope with only public $this variables.
100
* @param string The view script to execute.
102
protected function _run()
104
if ($this->_useViewStream && $this->useStreamWrapper()) {
105
include 'zend.view://' . func_get_arg(0);
107
include func_get_arg(0);