[ZF-10089] Zend_Log
[zend/radio.git] / library / Zend / View.php
blob2718b139bc199837be79f259bbac58e75357b8ea
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_View
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
19 * @version $Id$
23 /**
24 * Abstract master class for extension.
26 require_once 'Zend/View/Abstract.php';
29 /**
30 * Concrete class for handling view scripts.
32 * @category Zend
33 * @package Zend_View
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
39 /**
40 * Whether or not to use streams to mimic short tags
41 * @var bool
43 private $_useViewStream = false;
45 /**
46 * Whether or not to use stream wrapper if short_open_tag is false
47 * @var bool
49 private $_useStreamWrapper = false;
51 /**
52 * Constructor
54 * Register Zend_View_Stream stream wrapper if short tags are disabled.
56 * @param array $config
57 * @return void
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);
76 /**
77 * Set flag indicating if stream wrapper should be used if short_open_tag is off
79 * @param bool $flag
80 * @return Zend_View
82 public function setUseStreamWrapper($flag)
84 $this->_useStreamWrapper = (bool) $flag;
85 return $this;
88 /**
89 * Should the stream wrapper be used if short_open_tag is off?
91 * @return bool
93 public function useStreamWrapper()
95 return $this->_useStreamWrapper;
98 /**
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);
107 } else {
108 include func_get_arg(0);