View/Abstract.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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Version
- $Id$
Package: Zend_ViewAbstract class for Zend_View to help enforce private constructs.
- Implements
- Children
- \Zend_View
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
Methods



__call(string $name, array $args) : stringAccesses a helper object from within a script.
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. |



__construct(array $config = array()) : voidParameters| Name | Type | Description |
|---|
| $config | array | Configuration key-value pairs. |
|---|



__get(string $key) : nullPrevent E_NOTICE for nonexistent values
If {@link strictVars()} is on, raises a notice.
Parameters| Name | Type | Description |
|---|
| $key | string | |
|---|
Returns


__isset(string $key) : booleanAllows testing with empty() and isset() to work inside
templates.
Parameters| Name | Type | Description |
|---|
| $key | string | |
|---|
Returns 


__set(string $key, mixed $val) : voidDirectly assigns a variable to the view script.
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 |



__unset(string $key) : voidAllows unset() on object properties to work
Parameters| Name | Type | Description |
|---|
| $key | string | |
|---|



_addPath(string $type, string | array $path, string $prefix = null) : voidAdds paths to the path stack in LIFO order.
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) |
|---|



_addPluginPath(string $type, string $classPrefix, array $paths) : \Zend_View_AbstractAdd a prefixPath for a plugin type
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
| $classPrefix | string | |
|---|
| $paths | array | |
|---|
Returns 


_filter(string $buffer) : stringApplies the filter callback to a buffer.
Parameters| Name | Type | Description |
|---|
| $buffer | string | The buffer contents. |
|---|
Returns| Type | Description |
|---|
| string | The filtered buffer. |



_getPaths(string $type) : arrayReturn all paths for a given path type
Parameters| Name | Type | Description |
|---|
| $type | string | The path type ('helper', 'filter', 'script') |
|---|
Returns 


_getPluginPath(string $type, string $name) : string | falseGet a path to a given plugin class of a given type
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
| $name | string | |
|---|
Returns| Type | Description |
|---|
| string | false | |



_script(string $name) : voidFinds a view script from the available directories.
Parameters| Name | Type | Description |
|---|
| $name | string | The base name of the script. |
|---|



_setFilterClass(string $name, string $class, string $file) : voidRegister filter class as loaded
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
| $class | string | |
|---|
| $file | string | path to class file |
|---|



_setHelperClass(string $name, string $class, string $file) : voidRegister helper class as loaded
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
| $class | string | |
|---|
| $file | string | path to class file |
|---|



_setPath(string $type, string | array $path, string $classPrefix = null) : voidResets the path stack for helpers and filters.
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 |
|---|



addBasePath(string $path, $classPrefix = 'Zend_View') : \Zend_View_AbstractGiven a base path, add script, helper, and filter paths relative to it
Assumes a directory structure of:
basePath/
scripts/
helpers/
filters/
Parameters| Name | Type | Description |
|---|
| $path | string | |
|---|
| $classPrefix | | |
|---|
Returns


addFilterPath( $path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_AbstractAdds to the stack of filter paths in LIFO order.
Parameters| Name | Type | Description |
|---|
| $path | | |
|---|
| $classPrefix | string | Class prefix to use with classes in this
directory; defaults to Zend_View_Filter |
|---|
Returns 


addHelperPath( $path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_AbstractAdds to the stack of helper paths in LIFO order.
Parameters| Name | Type | Description |
|---|
| $path | | |
|---|
| $classPrefix | string | Class prefix to use with classes in this
directory; defaults to Zend_View_Helper |
|---|
Returns 


assign( $spec, $value = null) : \Zend_View_AbstractAssigns variables to the view script via differing strategies.
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 | | |
|---|
| $value | | |
|---|
ReturnsThrows| 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
-



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



escape(mixed $var) : mixedEscapes a value for output in a view script.
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. |



getEngine() : \Zend_View_AbstractReturn the template engine object
Returns the object instance, as it is its own template engine
Returns


getFilter(string $name) : objectGet a filter object by name
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
Returns 


getFilterPath(string $name) : string | falseGet full path to a filter class file specified by $name
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
Returns| Type | Description |
|---|
| string | false | False on failure, path on success |



getFilters() : arrayReturn array of all currently active filters
Only returns those that have already been instantiated.
Returns


getHelperPath(string $name) : string | falseGet full path to a helper class file specified by $name
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
Returns| Type | Description |
|---|
| string | false | False on failure, path on success |



getHelpers() : arrayGet array of all active helpers
Only returns those that have already been instantiated.
Returns


getPluginLoader(string $type) : \Zend_Loader_PluginLoaderRetrieve plugin loader for a specific plugin type
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
Returns 


getScriptPath(string $name) : false | stringReturn full path to a view script specified by $name
Parameters| Name | Type | Description |
|---|
| $name | string | |
|---|
Returns| Type | Description |
|---|
| false | string | False if script not found |
Throws 


getVars() : arrayReturn list of all assigned variables
Returns all public properties of the object. Reflection is not used
here as testing reflection properties for visibility is buggy.
Returns


init() : voidAllow custom object initialization when extending Zend_View_Abstract or
Zend_View
Triggered by {@link __construct() the constructor} as its final action.



render(string $name) : stringProcesses a view script and returns the output.
Parameters| Name | Type | Description |
|---|
| $name | string | The script name to process. |
|---|
Returns| Type | Description |
|---|
| string | The script output. |



setBasePath(string $path, $classPrefix = 'Zend_View') : \Zend_View_AbstractGiven a base path, sets the script, helper, and filter paths relative to it
Assumes a directory structure of:
basePath/
scripts/
helpers/
filters/
Parameters| Name | Type | Description |
|---|
| $path | string | |
|---|
| $classPrefix | | |
|---|
Returns


setEncoding(string $encoding) : \Zend_View_AbstractSet encoding to use with htmlentities() and htmlspecialchars()
Parameters| Name | Type | Description |
|---|
| $encoding | string | |
|---|
Returns 


setEscape(mixed $spec) : \Zend_View_AbstractSets the _escape() callback.
Parameters| Name | Type | Description |
|---|
| $spec | mixed | The callback for _escape() to use. |
|---|
Returns 


setFilterPath( $path, string $classPrefix = 'Zend_View_Filter_') : \Zend_View_AbstractResets the stack of filter paths.
To clear all paths, use Zend_View::setFilterPath(null).
Parameters| Name | Type | Description |
|---|
| $path | | |
|---|
| $classPrefix | string | The class prefix to apply to all elements in
$path; defaults to Zend_View_Filter |
|---|
Returns


setHelperPath(string | array $path, string $classPrefix = 'Zend_View_Helper_') : \Zend_View_AbstractResets the stack of helper paths.
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


setScriptPath( $path) : \Zend_View_AbstractResets the stack of view script paths.
To clear all paths, use Zend_View::setScriptPath(null).
ParametersReturns


strictVars(boolean $flag = true) : \Zend_View_AbstractEnable or disable strict vars
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