API Documentation

View/Abstract.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
version
$Id: Abstract.php 22447 2010-06-18 12:16:43Z matthew $
Classes
Zend_View_Abstract

Description

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.

Zend_View_Abstract

Implements
Zend_View_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
Properties
$_path
$_file
$_helper
$_helperLoaded
$_helperLoadedDir
$_filter
$_filterClass
$_filterLoaded
$_filterLoadedDir
$_escape
$_encoding
$_lfiProtectionOn
$_loaders
$_loaderTypes
$_strictVars
Methods
__construct
getEngine
init
__get
__isset
__set
__unset
__call
setBasePath
addBasePath
addScriptPath
setScriptPath
getScriptPath
getScriptPaths
setPluginLoader
getPluginLoader
addHelperPath
setHelperPath
getHelperPath
getHelperPaths
registerHelper
getHelper
getHelpers
addFilterPath
setFilterPath
getFilterPath
getFilter
getFilters
getFilterPaths
getAllPaths
addFilter
setFilter
setEscape
setLfiProtection
isLfiProtectionOn
assign
getVars
clearVars
render
escape
setEncoding
getEncoding
strictVars
_script
_filter
_addPath
_setPath
_getPaths
_setHelperClass
_setFilterClass
_addPluginPath
_getPluginPath
_getPlugin
_run

Description

Abstract class for Zend_View to help enforce private constructs.

Properties

$_encoding

string $_encoding = 'UTF-8'

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

Details

$_encoding
string
visibility
private
default
UTF-8
final
false
static
false

$_escape

string $_escape = 'htmlspecialchars'

Callback for escaping.

Details

$_escape
string
visibility
private
default
htmlspecialchars
final
false
static
false

$_file

string $_file = 'null'

Script file name to execute

Details

$_file
string
visibility
private
default
null
final
false
static
false

$_filter

array $_filter = 'array'

Stack of Zend_View_Filter names to apply as filters.

Details

$_filter
array
visibility
private
default
array
final
false
static
false

$_filterClass

array $_filterClass = 'array'

Stack of Zend_View_Filter objects that have been loaded

Details

$_filterClass
array
visibility
private
default
array
final
false
static
false

$_filterLoaded

array $_filterLoaded = 'array'

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

Details

$_filterLoaded
array
visibility
private
default
array
final
false
static
false

$_filterLoadedDir

array $_filterLoadedDir = 'array'

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

Details

$_filterLoadedDir
array
visibility
private
default
array
final
false
static
false

$_helper

array $_helper = 'array'

Instances of helper objects.

Details

$_helper
array
visibility
private
default
array
final
false
static
false

$_helperLoaded

array $_helperLoaded = 'array'

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

Details

$_helperLoaded
array
visibility
private
default
array
final
false
static
false

$_helperLoadedDir

array $_helperLoadedDir = 'array'

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

Details

$_helperLoadedDir
array
visibility
private
default
array
final
false
static
false

$_lfiProtectionOn

bool $_lfiProtectionOn = 'true'

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

Details

$_lfiProtectionOn
bool
visibility
private
default
true
final
false
static
false

$_loaderTypes

array $_loaderTypes = 'array'

Plugin types

Details

$_loaderTypes
array
visibility
private
default
array
final
false
static
false

$_loaders

array $_loaders = 'array'

Plugin loaders

Details

$_loaders
array
visibility
private
default
array
final
false
static
false

$_path

array $_path = 'array'

Path stack for script, helper, and filter directories.

Details

$_path
array
visibility
private
default
array
final
false
static
false

$_strictVars

boolean $_strictVars = 'false'

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

Details

$_strictVars
boolean
visibility
private
default
false
final
false
static
false

Methods

__call

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

Accesses a helper object from within a script.

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

Arguments
$name
string
The helper name.
$args
array
The parameters for the helper.
Output
string
The result of the helper output.
Details
visibility
public
final
false
static
false

__construct

__construct( array $config = array ) :

Constructor.

Arguments
$config
array
Configuration key-value pairs.
Details
visibility
public
final
false
static
false

__get

__get( string $key ) : null

Prevent E_NOTICE for nonexistent values

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

Arguments
$key
string
Output
null
Details
visibility
public
final
false
static
false

__isset

__isset( string $key ) : boolean

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

Arguments
$key
string
Output
boolean
Details
visibility
public
final
false
static
false

__set

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

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

Arguments
$key
string
The variable name.
$val
mixed
The variable value.
Details
visibility
public
final
false
static
false
throws
if an attempt to set a private or protected member is detected

__unset

__unset( string $key ) : void

Allows unset() on object properties to work

Arguments
$key
string
Details
visibility
public
final
false
static
false

_addPath

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

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

Arguments
$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)
Details
visibility
private
final
false
static
false

_addPluginPath

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

Add a prefixPath for a plugin type

Arguments
$type
string
$classPrefix
string
$paths
array
Details
visibility
private
final
false
static
false

_filter

_filter( string $buffer ) : string

Applies the filter callback to a buffer.

Arguments
$buffer
string
The buffer contents.
Output
string
The filtered buffer.
Details
visibility
private
final
false
static
false

_getPaths

_getPaths( string $type ) : array

Return all paths for a given path type

Arguments
$type
string
The path type ('helper', 'filter', 'script')
Output
array
Details
visibility
private
final
false
static
false

_getPlugin

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

Retrieve a plugin object

Arguments
$type
string
$name
string
Output
object
Details
visibility
private
final
false
static
false

_getPluginPath

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

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

Arguments
$type
string
$name
string
Output
string|false
Details
visibility
private
final
false
static
false

_run

_run( ) : mixed

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

Output
mixed
Details
visibility
protected
final
false
static
false

_script

_script( $name $name ) : void

Finds a view script from the available directories.

Arguments
$name
$name
string The base name of the script.
Details
visibility
protected
final
false
static
false

_setFilterClass

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

Register filter class as loaded

Arguments
$name
string
$class
string
$file
string
path to class file
Details
visibility
private
final
false
static
false

_setHelperClass

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

Register helper class as loaded

Arguments
$name
string
$class
string
$file
string
path to class file
Details
visibility
private
final
false
static
false

_setPath

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

Resets the path stack for helpers and filters.

Arguments
$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
Details
visibility
private
final
false
static
false

addBasePath

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

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

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

Arguments
$path
string
$classPrefix
Details
visibility
public
final
false
static
false

addFilter

addFilter( string|array $name ) : Zend_View_Abstract

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

Arguments
$name
stringarray
One or more filters to add.
Details
visibility
public
final
false
static
false

addFilterPath

addFilterPath( string|array $path, string $classPrefix = Zend_View_Filter_ ) : Zend_View_Abstract

Adds to the stack of filter paths in LIFO order.

Arguments
$path
stringarray
The directory (-ies) to add.
$classPrefix
string
Class prefix to use with classes in this directory; defaults to Zend_View_Filter
Details
visibility
public
final
false
static
false

addHelperPath

addHelperPath( string|array $path, string $classPrefix = Zend_View_Helper_ ) : Zend_View_Abstract

Adds to the stack of helper paths in LIFO order.

Arguments
$path
stringarray
The directory (-ies) to add.
$classPrefix
string
Class prefix to use with classes in this directory; defaults to Zend_View_Helper
Details
visibility
public
final
false
static
false

addScriptPath

addScriptPath( string|array $path ) : Zend_View_Abstract

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

Arguments
$path
stringarray
The directory (-ies) to add.
Details
visibility
public
final
false
static
false

assign

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

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

Arguments
$spec
stringarray
The assignment strategy to use.
$value
mixed
(Optional) If assigning a named variable, use this as the value.
Output
Zend_View_Abstract
Fluent interface
Details
visibility
public
final
false
static
false
see
__set()
throws
if $spec is neither a string nor an array, or if an attempt to set a private or protected member is detected

clearVars

clearVars( ) : void

Clear all assigned variables

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

Details
visibility
public
final
false
static
false

escape

escape( mixed $var ) : mixed

Escapes a value for output in a view script.

If escaping mechanism is one of htmlspecialchars or htmlentities, uses {@link $_encoding} setting.

Arguments
$var
mixed
The output to escape.
Output
mixed
The escaped value.
Details
visibility
public
final
false
static
false

getAllPaths

getAllPaths( ) : array

Return associative array of path types => paths

Output
array
Details
visibility
public
final
false
static
false

getEncoding

getEncoding( ) : string

Return current escape encoding

Output
string
Details
visibility
public
final
false
static
false

getEngine

getEngine( ) : Zend_View_Abstract

Return the template engine object

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

Details
visibility
public
final
false
static
false

getFilter

getFilter( string $name ) : object

Get a filter object by name

Arguments
$name
string
Output
object
Details
visibility
public
final
false
static
false

getFilterPath

getFilterPath( string $name ) : string|false

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

Arguments
$name
string
Output
string|false
False on failure, path on success
Details
visibility
public
final
false
static
false

getFilterPaths

getFilterPaths( ) : array

Returns an array of all currently set filter paths

Output
array
Details
visibility
public
final
false
static
false

getFilters

getFilters( ) : array

Return array of all currently active filters

Only returns those that have already been instantiated.

Output
array
Details
visibility
public
final
false
static
false

getHelper

getHelper( string $name ) : object

Get a helper by name

Arguments
$name
string
Output
object
Details
visibility
public
final
false
static
false

getHelperPath

getHelperPath( string $name ) : string|false

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

Arguments
$name
string
Output
string|false
False on failure, path on success
Details
visibility
public
final
false
static
false

getHelperPaths

getHelperPaths( ) : array

Returns an array of all currently set helper paths

Output
array
Details
visibility
public
final
false
static
false

getHelpers

getHelpers( ) : array

Get array of all active helpers

Only returns those that have already been instantiated.

Output
array
Details
visibility
public
final
false
static
false

getPluginLoader

getPluginLoader( string $type ) : Zend_Loader_PluginLoader

Retrieve plugin loader for a specific plugin type

Arguments
$type
string
Details
visibility
public
final
false
static
false

getScriptPath

getScriptPath( string $name ) : false|string

Return full path to a view script specified by $name

Arguments
$name
string
Output
false|string
False if script not found
Details
visibility
public
final
false
static
false
throws
if no script directory set

getScriptPaths

getScriptPaths( ) : array

Returns an array of all currently set script paths

Output
array
Details
visibility
public
final
false
static
false

getVars

getVars( ) : array

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

Output
array
Details
visibility
public
final
false
static
false

init

init( ) : void

Allow custom object initialization when extending Zend_View_Abstract or Zend_View

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

Details
visibility
public
final
false
static
false

isLfiProtectionOn

isLfiProtectionOn( ) : bool

Return status of LFI protection flag

Output
bool
Details
visibility
public
final
false
static
false

registerHelper

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

Registers a helper object, bypassing plugin loader

Arguments
$helper
Zend_View_Helper_Abstractobject
$name
string
Details
visibility
public
final
false
static
false
throws

render

render( string $name ) : string

Processes a view script and returns the output.

Arguments
$name
string
The script name to process.
Output
string
The script output.
Details
visibility
public
final
false
static
false

setBasePath

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

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

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

Arguments
$path
string
$classPrefix
Details
visibility
public
final
false
static
false

setEncoding

setEncoding( string $encoding ) : Zend_View_Abstract

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

Arguments
$encoding
string
Details
visibility
public
final
false
static
false

setEscape

setEscape( mixed $spec ) : Zend_View_Abstract

Sets the _escape() callback.

Arguments
$spec
mixed
The callback for _escape() to use.
Details
visibility
public
final
false
static
false

setFilter

setFilter( string|array $name ) : Zend_View_Abstract

Resets the filter stack.

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

Arguments
$name
stringarray
One or more filters to set.
Details
visibility
public
final
false
static
false

setFilterPath

setFilterPath( string|array $path, string $classPrefix = Zend_View_Filter_ ) : Zend_View_Abstract

Resets the stack of filter paths.

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

Arguments
$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_Filter
Details
visibility
public
final
false
static
false

setHelperPath

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

Resets the stack of helper paths.

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

Arguments
$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
Details
visibility
public
final
false
static
false

setLfiProtection

setLfiProtection( bool $flag ) : Zend_View_Abstract

Set LFI protection flag

Arguments
$flag
bool
Details
visibility
public
final
false
static
false

setPluginLoader

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

Set plugin loader for a particular plugin type

Arguments
$loader
Zend_Loader_PluginLoader
$type
string
Details
visibility
public
final
false
static
false

setScriptPath

setScriptPath( string|array $path ) : Zend_View_Abstract

Resets the stack of view script paths.

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

Arguments
$path
stringarray
The directory (-ies) to set as the path.
Details
visibility
public
final
false
static
false

strictVars

strictVars( boolean $flag = true ) : Zend_View_Abstract

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

Arguments
$flag
boolean
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.