View.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_View  
Version
$Id: View.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_View

Package: Zend\View
Concrete class for handling view scripts.
Parent(s)
\Zend_View_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprivatestring $_encoding = 'UTF-8'
inherited
Encoding to use in escaping mechanisms; defaults to utf-8
Inherited from: \Zend_View_Abstract::$$_encoding
Default value'UTF-8'Details
Type
string
Inherited_from
\Zend_View_Abstract::$$_encoding  
>VPropertyprivatestring $_escape = 'htmlspecialchars'
inherited
Callback for escaping.
Inherited from: \Zend_View_Abstract::$$_escape
Default value'htmlspecialchars'Details
Type
string
Inherited_from
\Zend_View_Abstract::$$_escape  
>VPropertyprivatestring $_file = null
inherited
Script file name to execute
Inherited from: \Zend_View_Abstract::$$_file
Default valuenullDetails
Type
string
Inherited_from
\Zend_View_Abstract::$$_file  
>VPropertyprivatearray $_filter = array()
inherited
Stack of Zend_View_Filter names to apply as filters.
Inherited from: \Zend_View_Abstract::$$_filter
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_filter  
>VPropertyprivatearray $_filterClass = array()
inherited
Stack of Zend_View_Filter objects that have been loaded
Inherited from: \Zend_View_Abstract::$$_filterClass
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_filterClass  
>VPropertyprivatearray $_filterLoaded = array()
inherited
Map of filter => class pairs to help in determining filter class from name
Inherited from: \Zend_View_Abstract::$$_filterLoaded
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_filterLoaded  
>VPropertyprivatearray $_filterLoadedDir = array()
inherited
Map of filter => classfile pairs to aid in determining filter classfile
Inherited from: \Zend_View_Abstract::$$_filterLoadedDir
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_filterLoadedDir  
>VPropertyprivatearray $_helper = array()
inherited
Instances of helper objects.
Inherited from: \Zend_View_Abstract::$$_helper
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_helper  
>VPropertyprivatearray $_helperLoaded = array()
inherited
Map of helper => class pairs to help in determining helper class from name
Inherited from: \Zend_View_Abstract::$$_helperLoaded
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_helperLoaded  
>VPropertyprivatearray $_helperLoadedDir = array()
inherited
Map of helper => classfile pairs to aid in determining helper classfile
Inherited from: \Zend_View_Abstract::$$_helperLoadedDir
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_helperLoadedDir  
>VPropertyprivatebool $_lfiProtectionOn = true
inherited
Flag indicating whether or not LFI protection for rendering view scripts is enabled
Inherited from: \Zend_View_Abstract::$$_lfiProtectionOn
Default valuetrueDetails
Type
bool
Inherited_from
\Zend_View_Abstract::$$_lfiProtectionOn  
>VPropertyprivatearray $_loaderTypes = array('filter', 'helper')
inherited
Plugin types
Inherited from: \Zend_View_Abstract::$$_loaderTypes
Default valuearray('filter', 'helper')Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_loaderTypes  
>VPropertyprivatearray $_loaders = array()
inherited
Plugin loaders
Inherited from: \Zend_View_Abstract::$$_loaders
Default valuearray()Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_loaders  
>VPropertyprivatearray $_path = array('script' => array(), 'helper' => array(), 'filter' => array())
inherited
Path stack for script, helper, and filter directories.
Inherited from: \Zend_View_Abstract::$$_path
Default valuearray('script' => array(), 'helper' => array(), 'filter' => array())Details
Type
array
Inherited_from
\Zend_View_Abstract::$$_path  
>VPropertyprivateboolean $_strictVars = false
inherited
Strict variables flag; when on, undefined variables accessed in the view scripts will trigger notices
Inherited from: \Zend_View_Abstract::$$_strictVars
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_View_Abstract::$$_strictVars  
>VPropertyprivatebool $_useStreamWrapper = false
Whether or not to use stream wrapper if short_open_tag is false
Default valuefalseDetails
Type
bool
>VPropertyprivatebool $_useViewStream = false
Whether or not to use streams to mimic short tags
Default valuefalseDetails
Type
bool

Methods

methodpublic__call(string $name, array $args) : string
inherited

Accesses a helper object from within a script.

Inherited from: \Zend_View_Abstract::__call()

If the helper class has a 'view' property, sets it with the current view object.

Parameters
NameTypeDescription
$namestring

The helper name.

$argsarray

The parameters for the helper.

Returns
TypeDescription
stringThe result of the helper output.
methodpublic__construct(array $config = array()) : void

Constructor

Register Zend_View_Stream stream wrapper if short tags are disabled.

Parameters
NameTypeDescription
$configarray
methodpublic__get(string $key) : null
inherited

Prevent E_NOTICE for nonexistent values

Inherited from: \Zend_View_Abstract::__get()

If strictVars() is on, raises a notice.

Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
null
methodpublic__isset(string $key) : boolean
inherited

Allows testing with empty() and isset() to work inside templates.

Inherited from: \Zend_View_Abstract::__isset()
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
boolean
methodpublic__set(string $key, mixed $val) : void
inherited

Directly assigns a variable to the view script.

Inherited from: \Zend_View_Abstract::__set()

Checks first to ensure that the caller is not attempting to set a protected or private member (by checking for a prefixed underscore); if not, the public member is set; otherwise, an exception is raised.

Parameters
NameTypeDescription
$keystring

The variable name.

$valmixed

The variable value.

Throws
ExceptionDescription
\Zend_View_Exceptionif an attempt to set a private or protected member is detected
methodpublic__unset(string $key) : void
inherited

Allows unset() on object properties to work

Inherited from: \Zend_View_Abstract::__unset()
Parameters
NameTypeDescription
$keystring
methodprivate_addPath(string $type, string | array $path, string $prefix = null) : void
inherited

Adds paths to the path stack in LIFO order.

Inherited from: \Zend_View_Abstract::_addPath()

Zend_View::_addPath($type, 'dirname') adds one directory to the path stack.

Zend_View::_addPath($type, $array) adds one directory for each array element value.

In the case of filter and helper paths, $prefix should be used to specify what class prefix to use with the given path.

Parameters
NameTypeDescription
$typestring

The path type ('script', 'helper', or 'filter').

$pathstring | array

The path specification.

$prefixstring

Class prefix to use with path (helpers and filters only)

methodprivate_addPluginPath(string $type, string $classPrefix, array $paths) : \Zend_View_Abstract
inherited

Add a prefixPath for a plugin type

Inherited from: \Zend_View_Abstract::_addPluginPath()
Parameters
NameTypeDescription
$typestring
$classPrefixstring
$pathsarray
Returns
TypeDescription
\Zend_View_Abstract
methodprivate_filter(string $buffer) : string
inherited

Applies the filter callback to a buffer.

Inherited from: \Zend_View_Abstract::_filter()
Parameters
NameTypeDescription
$bufferstring

The buffer contents.

Returns
TypeDescription
stringThe filtered buffer.
methodprivate_getPaths(string $type) : array
inherited

Return all paths for a given path type

Inherited from: \Zend_View_Abstract::_getPaths()
Parameters
NameTypeDescription
$typestring

The path type ('helper', 'filter', 'script')

Returns
TypeDescription
array
methodprivate_getPlugin(string $type, string $name) : object
inherited

Retrieve a plugin object

Inherited from: \Zend_View_Abstract::_getPlugin()
Parameters
NameTypeDescription
$typestring
$namestring
Returns
TypeDescription
object
methodprivate_getPluginPath(string $type, string $name) : string | false
inherited

Get a path to a given plugin class of a given type

Inherited from: \Zend_View_Abstract::_getPluginPath()
Parameters
NameTypeDescription
$typestring
$namestring
Returns
TypeDescription
string | false
methodprotected_run() : mixed

Includes the view script in a scope with only public $this variables.

Returns
TypeDescription
mixed
methodprotected_script(string $name) : void
inherited

Finds a view script from the available directories.

Inherited from: \Zend_View_Abstract::_script()
Parameters
NameTypeDescription
$namestring

The base name of the script.

methodprivate_setFilterClass(string $name, string $class, string $file) : void
inherited

Register filter class as loaded

Inherited from: \Zend_View_Abstract::_setFilterClass()
Parameters
NameTypeDescription
$namestring
$classstring
$filestring

path to class file

methodprivate_setHelperClass(string $name, string $class, string $file) : void
inherited

Register helper class as loaded

Inherited from: \Zend_View_Abstract::_setHelperClass()
Parameters
NameTypeDescription
$namestring
$classstring
$filestring

path to class file

methodprivate_setPath(string $type, string | array $path, string $classPrefix = null) : void
inherited

Resets the path stack for helpers and filters.

Inherited from: \Zend_View_Abstract::_setPath()
Parameters
NameTypeDescription
$typestring

The path type ('helper' or 'filter').

$pathstring | array

The directory (-ies) to set as the path.

$classPrefixstring

Class prefix to apply to elements of $path

methodpublicaddBasePath(string $path,  $classPrefix = 'Zend_View') : \Zend_View_Abstract
inherited

Given a base path, add script, helper, and filter paths relative to it

Inherited from: \Zend_View_Abstract::addBasePath()

Assumes a directory structure of:

basePath/
    scripts/
    helpers/
    filters/
Parameters
NameTypeDescription
$pathstring
$classPrefix
Returns
TypeDescription
\Zend_View_Abstract
methodpublicaddFilter(string | array $name) : \Zend_View_Abstract
inherited

Add one or more filters to the stack in FIFO order.

Inherited from: \Zend_View_Abstract::addFilter()
Parameters
NameTypeDescription
$namestring | array

One or more filters to add.

Returns
TypeDescription
\Zend_View_Abstract
methodpublicaddFilterPath(string | array $path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_Abstract
inherited

Adds to the stack of filter paths in LIFO order.

Inherited from: \Zend_View_Abstract::addFilterPath()
Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to add.

$classPrefixstring

Class prefix to use with classes in this directory; defaults to Zend_View_Filter

Returns
TypeDescription
\Zend_View_Abstract
methodpublicaddHelperPath(string | array $path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_Abstract
inherited

Adds to the stack of helper paths in LIFO order.

Inherited from: \Zend_View_Abstract::addHelperPath()
Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to add.

$classPrefixstring

Class prefix to use with classes in this directory; defaults to Zend_View_Helper

Returns
TypeDescription
\Zend_View_Abstract
methodpublicaddScriptPath(string | array $path) : \Zend_View_Abstract
inherited

Adds to the stack of view script paths in LIFO order.

Inherited from: \Zend_View_Abstract::addScriptPath()
Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to add.

Returns
TypeDescription
\Zend_View_Abstract
methodpublicassign(string | array $spec, mixed $value = null) : \Zend_View_Abstract
inherited

Assigns variables to the view script via differing strategies.

Inherited from: \Zend_View_Abstract::assign()

Zend_View::assign('name', $value) assigns a variable called 'name' with the corresponding $value.

Zend_View::assign($array) assigns the array keys as variable names (with the corresponding array values).

Parameters
NameTypeDescription
$specstring | array

The assignment strategy to use.

$valuemixed

(Optional) If assigning a named variable, use this as the value.

Returns
TypeDescription
\Zend_View_AbstractFluent interface
Throws
ExceptionDescription
\Zend_View_Exceptionif $spec is neither a string nor an array, or if an attempt to set a private or protected member is detected
Details
See
\__set()  
methodpublicclearVars() : void
inherited

Clear all assigned variables

Inherited from: \Zend_View_Abstract::clearVars()

Clears all variables assigned to Zend_View either via assign() or property overloading (__set()).

methodpublicescape(mixed $var) : mixed
inherited

Escapes a value for output in a view script.

Inherited from: \Zend_View_Abstract::escape()

If escaping mechanism is one of htmlspecialchars or htmlentities, uses $_encoding setting.

Parameters
NameTypeDescription
$varmixed

The output to escape.

Returns
TypeDescription
mixedThe escaped value.
methodpublicgetAllPaths() : array
inherited

Return associative array of path types => paths

Inherited from: \Zend_View_Abstract::getAllPaths()
Returns
TypeDescription
array
methodpublicgetEncoding() : string
inherited

Return current escape encoding

Inherited from: \Zend_View_Abstract::getEncoding()
Returns
TypeDescription
string
methodpublicgetEngine() : \Zend_View_Abstract
inherited

Return the template engine object

Inherited from: \Zend_View_Abstract::getEngine()

Returns the object instance, as it is its own template engine

Returns
TypeDescription
\Zend_View_Abstract
methodpublicgetFilter(string $name) : object
inherited

Get a filter object by name

Inherited from: \Zend_View_Abstract::getFilter()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
object
methodpublicgetFilterPath(string $name) : string | false
inherited

Get full path to a filter class file specified by $name

Inherited from: \Zend_View_Abstract::getFilterPath()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
string | falseFalse on failure, path on success
methodpublicgetFilterPaths() : array
inherited

Returns an array of all currently set filter paths

Inherited from: \Zend_View_Abstract::getFilterPaths()
Returns
TypeDescription
array
methodpublicgetFilters() : array
inherited

Return array of all currently active filters

Inherited from: \Zend_View_Abstract::getFilters()

Only returns those that have already been instantiated.

Returns
TypeDescription
array
methodpublicgetHelper(string $name) : object
inherited

Get a helper by name

Inherited from: \Zend_View_Abstract::getHelper()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
object
methodpublicgetHelperPath(string $name) : string | false
inherited

Get full path to a helper class file specified by $name

Inherited from: \Zend_View_Abstract::getHelperPath()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
string | falseFalse on failure, path on success
methodpublicgetHelperPaths() : array
inherited

Returns an array of all currently set helper paths

Inherited from: \Zend_View_Abstract::getHelperPaths()
Returns
TypeDescription
array
methodpublicgetHelpers() : array
inherited

Get array of all active helpers

Inherited from: \Zend_View_Abstract::getHelpers()

Only returns those that have already been instantiated.

Returns
TypeDescription
array
methodpublicgetPluginLoader(string $type) : \Zend_Loader_PluginLoader
inherited

Retrieve plugin loader for a specific plugin type

Inherited from: \Zend_View_Abstract::getPluginLoader()
Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Loader_PluginLoader
methodpublicgetScriptPath(string $name) : false | string
inherited

Return full path to a view script specified by $name

Inherited from: \Zend_View_Abstract::getScriptPath()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
false | stringFalse if script not found
Throws
ExceptionDescription
\Zend_View_Exceptionif no script directory set
methodpublicgetScriptPaths() : array
inherited

Returns an array of all currently set script paths

Inherited from: \Zend_View_Abstract::getScriptPaths()
Returns
TypeDescription
array
methodpublicgetVars() : array
inherited

Return list of all assigned variables

Inherited from: \Zend_View_Abstract::getVars()

Returns all public properties of the object. Reflection is not used here as testing reflection properties for visibility is buggy.

Returns
TypeDescription
array
methodpublicinit() : void
inherited

Allow custom object initialization when extending Zend_View_Abstract or Zend_View

Inherited from: \Zend_View_Abstract::init()

Triggered by the constructor as its final action.

methodpublicisLfiProtectionOn() : bool
inherited

Return status of LFI protection flag

Inherited from: \Zend_View_Abstract::isLfiProtectionOn()
Returns
TypeDescription
bool
methodpublicregisterHelper(\Zend_View_Helper_Abstract | object $helper, string $name) : \Zend_View_Abstract
inherited

Registers a helper object, bypassing plugin loader

Inherited from: \Zend_View_Abstract::registerHelper()
Parameters
NameTypeDescription
$helper\Zend_View_Helper_Abstract | object
$namestring
Returns
TypeDescription
\Zend_View_Abstract
Throws
ExceptionDescription
\Zend_View_Exception
methodpublicrender(string $name) : string
inherited

Processes a view script and returns the output.

Inherited from: \Zend_View_Abstract::render()
Parameters
NameTypeDescription
$namestring

The script name to process.

Returns
TypeDescription
stringThe script output.
methodpublicsetBasePath(string $path,  $classPrefix = 'Zend_View') : \Zend_View_Abstract
inherited

Given a base path, sets the script, helper, and filter paths relative to it

Inherited from: \Zend_View_Abstract::setBasePath()

Assumes a directory structure of:

basePath/
    scripts/
    helpers/
    filters/
Parameters
NameTypeDescription
$pathstring
$classPrefix
Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetEncoding(string $encoding) : \Zend_View_Abstract
inherited

Set encoding to use with htmlentities() and htmlspecialchars()

Inherited from: \Zend_View_Abstract::setEncoding()
Parameters
NameTypeDescription
$encodingstring
Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetEscape(mixed $spec) : \Zend_View_Abstract
inherited

Sets the _escape() callback.

Inherited from: \Zend_View_Abstract::setEscape()
Parameters
NameTypeDescription
$specmixed

The callback for _escape() to use.

Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetFilter(string | array $name) : \Zend_View_Abstract
inherited

Resets the filter stack.

Inherited from: \Zend_View_Abstract::setFilter()

To clear all filters, use Zend_View::setFilter(null).

Parameters
NameTypeDescription
$namestring | array

One or more filters to set.

Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetFilterPath(string | array $path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_Abstract
inherited

Resets the stack of filter paths.

Inherited from: \Zend_View_Abstract::setFilterPath()

To clear all paths, use Zend_View::setFilterPath(null).

Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to set as the path.

$classPrefixstring

The class prefix to apply to all elements in $path; defaults to Zend_View_Filter

Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetHelperPath(string | array $path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_Abstract
inherited

Resets the stack of helper paths.

Inherited from: \Zend_View_Abstract::setHelperPath()

To clear all paths, use Zend_View::setHelperPath(null).

Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to set as the path.

$classPrefixstring

The class prefix to apply to all elements in $path; defaults to Zend_View_Helper

Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetLfiProtection(bool $flag) : \Zend_View_Abstract
inherited

Set LFI protection flag

Inherited from: \Zend_View_Abstract::setLfiProtection()
Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader $loader, string $type) : \Zend_View_Abstract
inherited

Set plugin loader for a particular plugin type

Inherited from: \Zend_View_Abstract::setPluginLoader()
Parameters
NameTypeDescription
$loader\Zend_Loader_PluginLoader
$typestring
Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetScriptPath(string | array $path) : \Zend_View_Abstract
inherited

Resets the stack of view script paths.

Inherited from: \Zend_View_Abstract::setScriptPath()

To clear all paths, use Zend_View::setScriptPath(null).

Parameters
NameTypeDescription
$pathstring | array

The directory (-ies) to set as the path.

Returns
TypeDescription
\Zend_View_Abstract
methodpublicsetUseStreamWrapper(bool $flag) : \Zend_View

Set flag indicating if stream wrapper should be used if short_open_tag is off

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View
methodpublicstrictVars(boolean $flag = true) : \Zend_View_Abstract
inherited

Enable or disable strict vars

Inherited from: \Zend_View_Abstract::strictVars()

If strict variables are enabled, __get() will raise a notice when a variable is not defined.

Use in conjunction with the declareVars() helper to enforce strict variable handling in your view scripts.

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
\Zend_View_Abstract
methodpublicuseStreamWrapper() : bool

Should the stream wrapper be used if short_open_tag is off?

Returns
TypeDescription
bool
Documentation was generated by phpDocumentor 2.0.0a12.