View/Helper/HeadScript.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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_View  
Subpackage
Helper  
Version
$Id$  

\Zend_View_Helper_HeadScript

Package: Zend_View\Helper
Helper for setting and retrieving script elements for HTML head section
Parent(s)
\Zend_View_Helper_Placeholder_Container_Standalone < \Zend_View_Helper_Abstract
Children
\Zend_View_Helper_InlineScript
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
 

Constants

>VConstant  FILE = 'FILE'
>VConstant  SCRIPT = 'SCRIPT'

Properties

>VPropertyprotectedbool $_arbitraryAttributes = false
Are arbitrary attributes allowed?
Default valuefalseDetails
Type
bool
>VPropertyprotected$_captureLock
Details
Type
n/a
>VPropertyprotected$_captureScriptAttrs = null
Default valuenullDetails
Type
n/a
>VPropertyprotected$_captureScriptType = null
Default valuenullDetails
Type
n/a
>VPropertyprotected$_captureType
Details
Type
n/a
>VPropertyprotectedarray $_optionalAttributes = array('charset', 'defer', 'language', 'src')
Optional allowed attributes for script tag
Default valuearray('charset', 'defer', 'language', 'src')Details
Type
array
>VPropertyprotectedstring $_regKey = 'Zend_View_Helper_HeadScript'
Registry key for placeholder
Default value'Zend_View_Helper_HeadScript'Details
Type
string
>VPropertyprotectedstring $_requiredAttributes = array('type')
Required attributes for script tag
Default valuearray('type')Details
Type
string
>VPropertypublicbool $useCdata = false
Whether or not to format scripts using CDATA; used only if doctype helper is not accessible
Default valuefalseDetails
Type
bool

Methods

methodpublic__call(string $method, array $args) : \Zend_View_Helper_HeadScript

Overload method access

Allows the following method calls: - appendFile($src, $type = 'text/javascript', $attrs = array()) - offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array()) - prependFile($src, $type = 'text/javascript', $attrs = array()) - setFile($src, $type = 'text/javascript', $attrs = array()) - appendScript($script, $type = 'text/javascript', $attrs = array()) - offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array()) - prependScript($script, $type = 'text/javascript', $attrs = array()) - setScript($script, $type = 'text/javascript', $attrs = array())
Parameters
NameTypeDescription
$methodstring
$argsarray
Returns
TypeDescription
\Zend_View_Helper_HeadScript
Throws
ExceptionDescription
\Zend_View_Exceptionif too few arguments or invalid method
methodpublic__construct() : void

Constructor

Set separator to PHP_EOL.
methodprotected_isDuplicate(string $file) : bool

Is the file specified a duplicate?

Parameters
NameTypeDescription
$filestring
Returns
TypeDescription
bool
methodprotected_isValid(mixed $value) : bool

Is the script provided valid?

Parameters
NameTypeDescription
$valuemixed
Returns
TypeDescription
bool
methodpublicappend(string $value) : void

Override append

Parameters
NameTypeDescription
$valuestring
methodpublicarbitraryAttributesAllowed() : bool

Are arbitrary attributes allowed?

Returns
TypeDescription
bool
methodpubliccaptureEnd() : void

End capture action and store

methodpubliccaptureStart(mixed $captureType = \Zend_View_Helper_Placeholder_Container_Abstract::APPEND,  $type = 'text/javascript',  $attrs = array()) : void

Start capture action

Parameters
NameTypeDescription
$captureTypemixed
$type
$attrs
methodpubliccreateData(string $type, array $attributes, string $content = null) : \stdClass

Create data item containing all necessary components of script

Parameters
NameTypeDescription
$typestring
$attributesarray
$contentstring
Returns
TypeDescription
\stdClass
methodpublicheadScript(string $mode = \Zend_View_Helper_HeadScript::FILE, string $spec = null, string $placement = 'APPEND', array $attrs = array(), string $type = 'text/javascript') : \Zend_View_Helper_HeadScript

Return headScript object

Returns headScript helper object; optionally, allows specifying a script or script file to include.
Parameters
NameTypeDescription
$modestring

Script or file

$specstring

Script/url

$placementstring

Append, prepend, or set

$attrsarray

Array of script attributes

$typestring

Script type and/or array of script attributes

Returns
TypeDescription
\Zend_View_Helper_HeadScript
methodpublicitemToString( $item, string | int $indent,  $escapeStart,  $escapeEnd) : string

Create script HTML

Parameters
NameTypeDescription
$item
$indentstring | int
$escapeStart
$escapeEnd
Returns
TypeDescription
string
methodpublicoffsetSet(string | int $index, mixed $value) : void

Override offsetSet

Parameters
NameTypeDescription
$indexstring | int
$valuemixed
methodpublicprepend(string $value) : void

Override prepend

Parameters
NameTypeDescription
$valuestring
methodpublicset(string $value) : void

Override set

Parameters
NameTypeDescription
$valuestring
methodpublicsetAllowArbitraryAttributes(bool $flag) : \Zend_View_Helper_HeadScript

Set flag indicating if arbitrary attributes are allowed

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View_Helper_HeadScript
methodpublictoString(string | int $indent = null) : string

Retrieve string representation

Parameters
NameTypeDescription
$indentstring | int
Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .