API Documentation

View.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  
version
$Id: View.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_View

Concrete class for handling view scripts.

Extends from
\Zend_View_Abstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  

Properties

Propertyprivatebool  $_useStreamWrapper= 'false'

Whether or not to use stream wrapper if short_open_tag is false

Default valuefalseDetails
Type
bool
Propertyprivatebool  $_useViewStream= 'false'

Whether or not to use streams to mimic short tags

Default valuefalseDetails
Type
bool

Methods

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

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
Name Type Description
$name string The helper name.
$args array The parameters for the helper.
Returns
Type Description
string The result of the helper output.
methodpublic__construct( array $config = array ) : void

Constructor

Register Zend_View_Stream stream wrapper if short tags are disabled.

Parameters
Name Type Description
$config array
methodpublic__get( string $key ) : null

Prevent E_NOTICE for nonexistent values

Inherited from: \Zend_View_Abstract::__get()

If {@link strictVars()} is on, raises a notice.

Parameters
Name Type Description
$key string
Returns
Type Description
null
methodpublic__isset( string $key ) : boolean

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

Inherited from: \Zend_View_Abstract::__isset()
Parameters
Name Type Description
$key string
Returns
Type Description
boolean
methodpublic__set( string $key, mixed $val ) : void

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
Name Type Description
$key string The variable name.
$val mixed The variable value.
Throws
Exception Description
\Zend_View_Exception if an attempt to set a private or protected member is detected
methodpublic__unset( string $key ) : void

Allows unset() on object properties to work

Inherited from: \Zend_View_Abstract::__unset()
Parameters
Name Type Description
$key string
methodprivate_addPath( string $type, string|array $path, string $prefix = null ) : void

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
Name Type Description
$type string

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

$path string|array The path specification.
$prefix string

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

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

Add a prefixPath for a plugin type

Inherited from: \Zend_View_Abstract::_addPluginPath()
Parameters
Name Type Description
$type string
$classPrefix string
$paths array
Returns
Type Description
\Zend_View_Abstract
methodprivate_filter( string $buffer ) : string

Applies the filter callback to a buffer.

Inherited from: \Zend_View_Abstract::_filter()
Parameters
Name Type Description
$buffer string The buffer contents.
Returns
Type Description
string The filtered buffer.
methodprivate_getPaths( string $type ) : array

Return all paths for a given path type

Inherited from: \Zend_View_Abstract::_getPaths()
Parameters
Name Type Description
$type string

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

Returns
Type Description
array
methodprivate_getPlugin( string $type, string $name ) : object

Retrieve a plugin object

Inherited from: \Zend_View_Abstract::_getPlugin()
Parameters
Name Type Description
$type string
$name string
Returns
Type Description
object
methodprivate_getPluginPath( string $type, string $name ) : string|false

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

Inherited from: \Zend_View_Abstract::_getPluginPath()
Parameters
Name Type Description
$type string
$name string
Returns
Type Description
stringfalse
methodprotected_run( ) : mixed

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

Returns
Type Description
mixed
methodprotected_script( string $name ) : void

Finds a view script from the available directories.

Inherited from: \Zend_View_Abstract::_script()
Parameters
Name Type Description
$name string The base name of the script.
methodprivate_setFilterClass( string $name, string $class, string $file ) : void

Register filter class as loaded

Inherited from: \Zend_View_Abstract::_setFilterClass()
Parameters
Name Type Description
$name string
$class string
$file string path to class file
methodprivate_setHelperClass( string $name, string $class, string $file ) : void

Register helper class as loaded

Inherited from: \Zend_View_Abstract::_setHelperClass()
Parameters
Name Type Description
$name string
$class string
$file string path to class file
methodprivate_setPath( string $type, string|array $path, string $classPrefix = null ) : void

Resets the path stack for helpers and filters.

Inherited from: \Zend_View_Abstract::_setPath()
Parameters
Name Type Description
$type string

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

$path string|array

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

$classPrefix string

Class prefix to apply to elements of $path

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

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
Name Type Description
$path string
$classPrefix
Returns
Type Description
\Zend_View_Abstract
methodpublicaddFilter( string|array $name ) : \Zend_View_Abstract

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

Inherited from: \Zend_View_Abstract::addFilter()
Parameters
Name Type Description
$name string|array One or more filters to add.
Returns
Type Description
\Zend_View_Abstract
methodpublicaddFilterPath( string|array $path, string $classPrefix = Zend_View_Filter_ ) : \Zend_View_Abstract

Adds to the stack of filter paths in LIFO order.

Inherited from: \Zend_View_Abstract::addFilterPath()
Parameters
Name Type Description
$path string|array

The directory (-ies) to add.

$classPrefix string Class prefix to use with classes in this directory; defaults to Zend_View_Filter
Returns
Type Description
\Zend_View_Abstract
methodpublicaddHelperPath( string|array $path, string $classPrefix = Zend_View_Helper_ ) : \Zend_View_Abstract

Adds to the stack of helper paths in LIFO order.

Inherited from: \Zend_View_Abstract::addHelperPath()
Parameters
Name Type Description
$path string|array

The directory (-ies) to add.

$classPrefix string Class prefix to use with classes in this directory; defaults to Zend_View_Helper
Returns
Type Description
\Zend_View_Abstract
methodpublicaddScriptPath( string|array $path ) : \Zend_View_Abstract

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

Inherited from: \Zend_View_Abstract::addScriptPath()
Parameters
Name Type Description
$path string|array

The directory (-ies) to add.

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

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
Name Type Description
$spec string|array The assignment strategy to use.
$value mixed

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

Returns
Type Description
\Zend_View_Abstract Fluent interface
Throws
Exception Description
\Zend_View_Exception if $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

Clear all assigned variables

Inherited from: \Zend_View_Abstract::clearVars()

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

methodpublicescape( mixed $var ) : mixed

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 {@link $_encoding} setting.

Parameters
Name Type Description
$var mixed The output to escape.
Returns
Type Description
mixed The escaped value.
methodpublicgetAllPaths( ) : array

Return associative array of path types => paths

Inherited from: \Zend_View_Abstract::getAllPaths()
Returns
Type Description
array
methodpublicgetEncoding( ) : string

Return current escape encoding

Inherited from: \Zend_View_Abstract::getEncoding()
Returns
Type Description
string
methodpublicgetEngine( ) : \Zend_View_Abstract

Return the template engine object

Inherited from: \Zend_View_Abstract::getEngine()

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

Returns
Type Description
\Zend_View_Abstract
methodpublicgetFilter( string $name ) : object

Get a filter object by name

Inherited from: \Zend_View_Abstract::getFilter()
Parameters
Name Type Description
$name string
Returns
Type Description
object
methodpublicgetFilterPath( string $name ) : string|false

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

Inherited from: \Zend_View_Abstract::getFilterPath()
Parameters
Name Type Description
$name string
Returns
Type Description
stringfalse False on failure, path on success
methodpublicgetFilterPaths( ) : array

Returns an array of all currently set filter paths

Inherited from: \Zend_View_Abstract::getFilterPaths()
Returns
Type Description
array
methodpublicgetFilters( ) : array

Return array of all currently active filters

Inherited from: \Zend_View_Abstract::getFilters()

Only returns those that have already been instantiated.

Returns
Type Description
array
methodpublicgetHelper( string $name ) : object

Get a helper by name

Inherited from: \Zend_View_Abstract::getHelper()
Parameters
Name Type Description
$name string
Returns
Type Description
object
methodpublicgetHelperPath( string $name ) : string|false

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

Inherited from: \Zend_View_Abstract::getHelperPath()
Parameters
Name Type Description
$name string
Returns
Type Description
stringfalse False on failure, path on success
methodpublicgetHelperPaths( ) : array

Returns an array of all currently set helper paths

Inherited from: \Zend_View_Abstract::getHelperPaths()
Returns
Type Description
array
methodpublicgetHelpers( ) : array

Get array of all active helpers

Inherited from: \Zend_View_Abstract::getHelpers()

Only returns those that have already been instantiated.

Returns
Type Description
array
methodpublicgetPluginLoader( string $type ) : \Zend_Loader_PluginLoader

Retrieve plugin loader for a specific plugin type

Inherited from: \Zend_View_Abstract::getPluginLoader()
Parameters
Name Type Description
$type string
Returns
Type Description
\Zend_Loader_PluginLoader
methodpublicgetScriptPath( string $name ) : false|string

Return full path to a view script specified by $name

Inherited from: \Zend_View_Abstract::getScriptPath()
Parameters
Name Type Description
$name string
Returns
Type Description
falsestring False if script not found
Throws
Exception Description
\Zend_View_Exception if no script directory set
methodpublicgetScriptPaths( ) : array

Returns an array of all currently set script paths

Inherited from: \Zend_View_Abstract::getScriptPaths()
Returns
Type Description
array
methodpublicgetVars( ) : array

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
Type Description
array
methodpublicinit( ) : void

Allow custom object initialization when extending Zend_View_Abstract or Zend_View

Inherited from: \Zend_View_Abstract::init()

Triggered by {@link __construct() the constructor} as its final action.

methodpublicisLfiProtectionOn( ) : bool

Return status of LFI protection flag

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

Registers a helper object, bypassing plugin loader

Inherited from: \Zend_View_Abstract::registerHelper()
Parameters
Name Type Description
$helper \Zend_View_Helper_Abstract|object
$name string
Returns
Type Description
\Zend_View_Abstract
Throws
Exception Description
\Zend_View_Exception
methodpublicrender( string $name ) : string

Processes a view script and returns the output.

Inherited from: \Zend_View_Abstract::render()
Parameters
Name Type Description
$name string The script name to process.
Returns
Type Description
string The script output.
methodpublicsetBasePath( string $path,  $classPrefix = Zend_View ) : \Zend_View_Abstract

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
Name Type Description
$path string
$classPrefix
Returns
Type Description
\Zend_View_Abstract
methodpublicsetEncoding( string $encoding ) : \Zend_View_Abstract

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

Inherited from: \Zend_View_Abstract::setEncoding()
Parameters
Name Type Description
$encoding string
Returns
Type Description
\Zend_View_Abstract
methodpublicsetEscape( mixed $spec ) : \Zend_View_Abstract

Sets the _escape() callback.

Inherited from: \Zend_View_Abstract::setEscape()
Parameters
Name Type Description
$spec mixed

The callback for _escape() to use.

Returns
Type Description
\Zend_View_Abstract
methodpublicsetFilter( string|array $name ) : \Zend_View_Abstract

Resets the filter stack.

Inherited from: \Zend_View_Abstract::setFilter()

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

Parameters
Name Type Description
$name string|array One or more filters to set.
Returns
Type Description
\Zend_View_Abstract
methodpublicsetFilterPath( string|array $path, string $classPrefix = Zend_View_Filter_ ) : \Zend_View_Abstract

Resets the stack of filter paths.

Inherited from: \Zend_View_Abstract::setFilterPath()

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

Parameters
Name Type Description
$path string|array

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

$classPrefix string

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

Returns
Type Description
\Zend_View_Abstract
methodpublicsetHelperPath( string|array $path, string $classPrefix = Zend_View_Helper_ ) : \Zend_View_Abstract

Resets the stack of helper paths.

Inherited from: \Zend_View_Abstract::setHelperPath()

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

Parameters
Name Type Description
$path string|array

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

$classPrefix string

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

Returns
Type Description
\Zend_View_Abstract
methodpublicsetLfiProtection( bool $flag ) : \Zend_View_Abstract

Set LFI protection flag

Inherited from: \Zend_View_Abstract::setLfiProtection()
Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_View_Abstract
methodpublicsetPluginLoader( \Zend_Loader_PluginLoader $loader, string $type ) : \Zend_View_Abstract

Set plugin loader for a particular plugin type

Inherited from: \Zend_View_Abstract::setPluginLoader()
Parameters
Name Type Description
$loader \Zend_Loader_PluginLoader
$type string
Returns
Type Description
\Zend_View_Abstract
methodpublicsetScriptPath( string|array $path ) : \Zend_View_Abstract

Resets the stack of view script paths.

Inherited from: \Zend_View_Abstract::setScriptPath()

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

Parameters
Name Type Description
$path string|array

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

Returns
Type Description
\Zend_View_Abstract
methodpublicsetUseStreamWrapper( bool $flag ) : \Zend_View

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

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_View
methodpublicstrictVars( boolean $flag = true ) : \Zend_View_Abstract

Enable or disable strict vars

Inherited from: \Zend_View_Abstract::strictVars()

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

Use in conjunction with {@link Zend_View_Helper_DeclareVars the declareVars() helper} to enforce strict variable handling in your view scripts.

Parameters
Name Type Description
$flag boolean
Returns
Type Description
\Zend_View_Abstract
methodpublicuseStreamWrapper( ) : bool

Should the stream wrapper be used if short_open_tag is off?

Returns
Type Description
bool
Documentation was generated by DocBlox 0.13.3.