Abstract class for Zend_View to help enforce private constructs.

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

 Methods

Accesses a helper object from within a script.

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

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

Parameters

$name

string

The helper name.

$args

array

The parameters for the helper.

Returns

stringThe result of the helper output.

Constructor.

__construct(array $config = array()

Parameters

$config

array

Configuration key-value pairs.

Prevent E_NOTICE for nonexistent values

__get(string $key) : null

If \strictVars() is on, raises a notice.

Parameters

$key

string

Returns

null

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

__isset(string $key) : boolean
inherited_from \Zend_View_Interface::__isset()

Parameters

$key

string

Returns

boolean

Directly assigns a variable to the view script.

__set(string $key, mixed $val) : void

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.

inherited_from \Zend_View_Interface::__set()

Parameters

$key

string

The variable name.

$val

mixed

The variable value.

Exceptions

\Zend_View_Exception if an attempt to set a private or protected member is detected

Allows unset() on object properties to work

__unset(string $key) : void
inherited_from \Zend_View_Interface::__unset()

Parameters

$key

string

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

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

Assumes a directory structure of: basePath/ scripts/ helpers/ filters/

inherited_from \Zend_View_Interface::addBasePath()

Parameters

$path

string

$classPrefix

Returns

\Zend_View_Abstract

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

addFilter($name) : \Zend_View_Abstract

Parameters

$name

Returns

\Zend_View_Abstract

Adds to the stack of filter paths in LIFO order.

addFilterPath($path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_Abstract

Parameters

$path

$classPrefix

string

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

Returns

\Zend_View_Abstract

Adds to the stack of helper paths in LIFO order.

addHelperPath($path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_Abstract

Parameters

$path

$classPrefix

string

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

Returns

\Zend_View_Abstract

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

addScriptPath($path) : \Zend_View_Abstract

Parameters

$path

Returns

\Zend_View_Abstract

Assigns variables to the view script via differing strategies.

assign(string|array $spec, mixed $value = null) : \Zend_View_Abstract

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).

see
inherited_from \Zend_View_Interface::assign()

Parameters

$spec

$value

Exceptions

\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

Returns

\Zend_View_AbstractFluent interface

Clear all assigned variables

clearVars() : void

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

inherited_from \Zend_View_Interface::clearVars()

Escapes a value for output in a view script.

escape(mixed $var) : mixed

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

Parameters

$var

mixed

The output to escape.

Returns

mixedThe escaped value.

Return associative array of path types => paths

getAllPaths() : array

Returns

array

Return current escape encoding

getEncoding() : string

Returns

string

Return the template engine object

getEngine() : \Zend_View_Abstract

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

inherited_from \Zend_View_Interface::getEngine()

Returns

\Zend_View_Abstract

Get a filter object by name

getFilter(string $name) : object

Parameters

$name

string

Returns

object

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

getFilterPath(string $name) : string | false

Parameters

$name

string

Returns

stringfalseFalse on failure, path on success

Returns an array of all currently set filter paths

getFilterPaths() : array

Returns

array

Return array of all currently active filters

getFilters() : array

Only returns those that have already been instantiated.

Returns

array

Get a helper by name

getHelper(string $name) : object

Parameters

$name

string

Returns

object

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

getHelperPath(string $name) : string | false

Parameters

$name

string

Returns

stringfalseFalse on failure, path on success

Returns an array of all currently set helper paths

getHelperPaths() : array

Returns

array

Get array of all active helpers

getHelpers() : array

Only returns those that have already been instantiated.

Returns

array

Retrieve plugin loader for a specific plugin type

getPluginLoader(string $type) : \Zend_Loader_PluginLoader

Parameters

$type

string

Returns

\Zend_Loader_PluginLoader

Return full path to a view script specified by $name

getScriptPath(string $name) : false | string

Parameters

$name

string

Exceptions

\Zend_View_Exception if no script directory set

Returns

falsestringFalse if script not found

Returns an array of all currently set script paths

getScriptPaths() : array
inherited_from \Zend_View_Interface::getScriptPaths()

Returns

array

Return list of all assigned variables

getVars() : array

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

Returns

array

Allow custom object initialization when extending Zend_View_Abstract or Zend_View

init() : void

Triggered by __construct() as its final action.

Return status of LFI protection flag

isLfiProtectionOn() : boolean

Returns

boolean

Registers a helper object, bypassing plugin loader

registerHelper(\Zend_View_Helper_Abstract|object $helper, string $name) : \Zend_View_Abstract

Parameters

$helper

\Zend_View_Helper_Abstractobject

$name

string

Exceptions

\Zend_View_Exception

Returns

\Zend_View_Abstract

Processes a view script and returns the output.

render(string $name) : string
inherited_from \Zend_View_Interface::render()

Parameters

$name

string

The script name to process.

Returns

stringThe script output.

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

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

Assumes a directory structure of: basePath/ scripts/ helpers/ filters/

inherited_from \Zend_View_Interface::setBasePath()

Parameters

$path

string

$classPrefix

Returns

\Zend_View_Abstract

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

setEncoding(string $encoding) : \Zend_View_Abstract

Parameters

$encoding

string

Returns

\Zend_View_Abstract

Sets the _escape() callback.

setEscape(mixed $spec) : \Zend_View_Abstract

Parameters

$spec

mixed

The callback for _escape() to use.

Returns

\Zend_View_Abstract

Resets the filter stack.

setFilter($name) : \Zend_View_Abstract

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

Parameters

$name

Returns

\Zend_View_Abstract

Resets the stack of filter paths.

setFilterPath($path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_Abstract

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

Parameters

$path

$classPrefix

string

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

Returns

\Zend_View_Abstract

Resets the stack of helper paths.

setHelperPath(string|array $path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_Abstract

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

Parameters

$path

stringarray

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

\Zend_View_Abstract

Set LFI protection flag

setLfiProtection(boolean $flag) : \Zend_View_Abstract

Parameters

$flag

boolean

Returns

\Zend_View_Abstract

Set plugin loader for a particular plugin type

setPluginLoader(\Zend_Loader_PluginLoader $loader, string $type) : \Zend_View_Abstract

Parameters

$loader

\Zend_Loader_PluginLoader

$type

string

Returns

\Zend_View_Abstract

Resets the stack of view script paths.

setScriptPath($path) : \Zend_View_Abstract

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

inherited_from \Zend_View_Interface::setScriptPath()

Parameters

$path

Returns

\Zend_View_Abstract

Enable or disable strict vars

strictVars(boolean $flag = true) : \Zend_View_Abstract

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

$flag

boolean

Returns

\Zend_View_Abstract

Use to include the view script in a scope that only allows public members.

_run() : mixed

Returns

mixed

Finds a view script from the available directories.

_script(string $name) : void

Parameters

$name

string

The base name of the script.

Adds paths to the path stack in LIFO order.

_addPath(string $type, string|array $path, string $prefix = null) : void

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

$type

string

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

$path

stringarray

The path specification.

$prefix

string

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

Add a prefixPath for a plugin type

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

Parameters

$type

string

$classPrefix

string

$paths

array

Returns

\Zend_View_Abstract

Applies the filter callback to a buffer.

_filter(string $buffer) : string

Parameters

$buffer

string

The buffer contents.

Returns

stringThe filtered buffer.

Return all paths for a given path type

_getPaths(string $type) : array

Parameters

$type

string

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

Returns

array

Retrieve a plugin object

_getPlugin(string $type, string $name) : object

Parameters

$type

string

$name

string

Returns

object

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

_getPluginPath(string $type, string $name) : string | false

Parameters

$type

string

$name

string

Returns

stringfalse

Register filter class as loaded

_setFilterClass(string $name, string $class, string $file) : void

Parameters

$name

string

$class

string

$file

string

path to class file

Register helper class as loaded

_setHelperClass(string $name, string $class, string $file) : void

Parameters

$name

string

$class

string

$file

string

path to class file

Resets the path stack for helpers and filters.

_setPath(string $type, string|array $path, string $classPrefix = null

Parameters

$type

string

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

$path

stringarray

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

$classPrefix

string

Class prefix to apply to elements of $path

 Properties

 

Encoding to use in escaping mechanisms; defaults to utf-8

$_encoding : string

Default

'UTF-8'
 

Callback for escaping.

$_escape : string

Default

'htmlspecialchars'
 

Script file name to execute

$_file : string

Default

null
 

Stack of Zend_View_Filter names to apply as filters.

$_filter : array

Default

array()
 

Stack of Zend_View_Filter objects that have been loaded

$_filterClass : array

Default

array()
 

Map of filter => class pairs to help in determining filter class from name

$_filterLoaded : array

Default

array()
 

Map of filter => classfile pairs to aid in determining filter classfile

$_filterLoadedDir : array

Default

array()
 

Instances of helper objects.

$_helper : array

Default

array()
 

Map of helper => class pairs to help in determining helper class from name

$_helperLoaded : array

Default

array()
 

Map of helper => classfile pairs to aid in determining helper classfile

$_helperLoadedDir : array

Default

array()
 

Flag indicating whether or not LFI protection for rendering view scripts is enabled

$_lfiProtectionOn : boolean

Default

true
 

Plugin types

$_loaderTypes : array

Default

array('filter', 'helper')
 

Plugin loaders

$_loaders : array

Default

array()
 

Path stack for script, helper, and filter directories.

$_path : array

Default

array('script' => array(), 'helper' => array(), 'filter' => array())
 

Strict variables flag; when on, undefined variables accessed in the view scripts will trigger notices

$_strictVars : boolean

Default

false