Documentation

Mage_Adminhtml_Helper_Js extends Mage_Core_Helper_Js
in package

Table of Contents

Constants

JAVASCRIPT_TRANSLATE_CONFIG_FILENAME  : mixed = 'jstranslator.xml'
Translate file name
JAVASCRIPT_TRANSLATE_CONFIG_KEY  : mixed = 'javascript_translate_config'
Key for cache

Properties

$_config  : Mage_Core_Model_Translate_Config|null
Translate config
$_layout  : Mage_Core_Model_Layout
Layout model object
$_moduleName  : string
Helper module name
$_request  : Mage_Core_Controller_Request_Http
Request object
$_translateData  : array<string|int, mixed>
Array of sentences of JS translations
$modulesDisabled  : array<string|int, mixed>

Methods

__()  : string
Translate
addTranslateData()  : void
Add messages to the JS translation array
decodeGridSerializedInput()  : array<string|int, mixed>
Decode serialized grid data
escapeHtml()  : ($data is array ? ?string[] : ?string)
Escape html entities
escapeScriptIdentifiers()  : string
Remove `javascript:`, `vbscript:`, `data:` words from the string.
escapeSpecial()  : string
Remove `\t`,`\n`,`\r`,`\0`,`\x0B:` symbols from the string.
escapeUrl()  : string
Escape html entities in url
getConfirmSetLocationJs()  : string
Helper for "onclick.confirmSetLocation"
getDeleteConfirmJs()  : string
Helper for "onclick.deleteConfirm"
getJsSkinUrl()  : string
Retrieve skin JS file url
getJsUrl()  : string
Retrieve JS file url
getLayout()  : Mage_Core_Model_Layout
Retrieve layout model object
getSaveAndContinueEditJs()  : string
Helper for "onclick.saveAndContinueEdit"
getScript()  : string
Retrieve framed javascript
getSetLocationJs()  : string
Helper for "onclick.setLocation"
getTranslateJson()  : string
Retrieve JSON of JS sentences translation
getTranslatorScript()  : string
Retrieve JS translator initialization javascript
hasTags()  : bool
Check for tags in multidimensional arrays
includeScript()  : string
Retrieve javascript include code
includeSkinScript()  : string
Retrieve
isModuleEnabled()  : bool
Check is module exists and enabled in global config.
isModuleOutputEnabled()  : bool
Check whether the module output is enabled in Configuration
jsQuoteEscape()  : ($data is array ? string[] : string)
Escape quotes in java script
quoteEscape()  : string
Escape quotes inside html attributes Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc)
removeTags()  : string
Remove html tags, but leave "<" and ">" signs
setLayout()  : Mage_Core_Helper_Abstract
Declare layout
stripTags()  : string
Wrapper for standard strip_tags() function with extra functionality for html entities
translateArray()  : array<string|int, mixed>
Translate array
urlDecode()  : string
base64_decode() for URLs decoding
urlDecodeAndEscape()  : string
base64_decode() and escape quotes in url
urlEncode()  : string
base64_encode() for URLs encoding
_cleanCache()  : Mage_Core_Helper_Abstract
Cleaning cache
_getModuleName()  : string
Retrieve helper module name
_getRequest()  : Mage_Core_Controller_Request_Http
Retrieve request object
_getTranslateData()  : array<string|int, mixed>
Retrieve JS translation array
_getUrl()  : string
Retrieve url
_getXmlConfig()  : Config
Load config from files and try to cache it
_loadCache()  : mixed
Loading cache data
_removeCache()  : Mage_Core_Helper_Abstract
Removing cache
_saveCache()  : Mage_Core_Helper_Abstract
Saving cache

Constants

JAVASCRIPT_TRANSLATE_CONFIG_FILENAME

Translate file name

public mixed JAVASCRIPT_TRANSLATE_CONFIG_FILENAME = 'jstranslator.xml'

JAVASCRIPT_TRANSLATE_CONFIG_KEY

Key for cache

public mixed JAVASCRIPT_TRANSLATE_CONFIG_KEY = 'javascript_translate_config'

Properties

$_moduleName

Helper module name

protected string $_moduleName = 'Mage_Adminhtml'

$_translateData

Array of sentences of JS translations

protected array<string|int, mixed> $_translateData = []

$modulesDisabled

protected array<string|int, mixed> $modulesDisabled = []

Methods

__()

Translate

public __() : string
Return values
string

addTranslateData()

Add messages to the JS translation array

public addTranslateData(string|array<string|int, mixed> $messageText, string|null $module) : void
Parameters
$messageText : string|array<string|int, mixed>

a single or array of messages to translate

$module : string|null

the helper module to use for translating, defaults to 'core'

decodeGridSerializedInput()

Decode serialized grid data

public decodeGridSerializedInput(string $encoded) : array<string|int, mixed>

Ignores non-numeric array keys

'1&2&3&4' will be decoded into [1, 2, 3, 4];

otherwise the following format is anticipated: 1=&2=: [ 1 => [...], 2 => [...], ]

Parameters
$encoded : string
Return values
array<string|int, mixed>

escapeHtml()

Escape html entities

public escapeHtml(null|string|array<string|int, string> $data[, null|array<string|int, string> $allowedTags = null ]) : ($data is array ? ?string[] : ?string)
Parameters
$data : null|string|array<string|int, string>
$allowedTags : null|array<string|int, string> = null
Return values
($data is array ? ?string[] : ?string)

escapeScriptIdentifiers()

Remove `javascript:`, `vbscript:`, `data:` words from the string.

public escapeScriptIdentifiers(string $data) : string
Parameters
$data : string
Return values
string

escapeSpecial()

Remove `\t`,`\n`,`\r`,`\0`,`\x0B:` symbols from the string.

public escapeSpecial(string $data) : string
Parameters
$data : string
Return values
string

escapeUrl()

Escape html entities in url

public escapeUrl(string $data) : string
Parameters
$data : string
Return values
string

getConfirmSetLocationJs()

Helper for "onclick.confirmSetLocation"

public getConfirmSetLocationJs(string $url[, string|null $message = null ]) : string
Parameters
$url : string
$message : string|null = null

null for default message, do not use jsQuoteEscape() before

Tags
uses
Mage_Core_Helper_Abstract::jsQuoteEscape()
Return values
string

getDeleteConfirmJs()

Helper for "onclick.deleteConfirm"

public getDeleteConfirmJs(string $url[, string|null $message = null ]) : string
Parameters
$url : string
$message : string|null = null

null for default message, do not use jsQuoteEscape() before

Tags
uses
Mage_Core_Helper_Abstract::jsQuoteEscape()
Return values
string

getJsSkinUrl()

Retrieve skin JS file url

public getJsSkinUrl(string $file) : string
Parameters
$file : string
Return values
string

getJsUrl()

Retrieve JS file url

public getJsUrl(string $file) : string
Parameters
$file : string
Return values
string

getSaveAndContinueEditJs()

Helper for "onclick.saveAndContinueEdit"

public getSaveAndContinueEditJs(string $url) : string
Parameters
$url : string
Return values
string

getScript()

Retrieve framed javascript

public getScript(string $script) : string
Parameters
$script : string
Return values
string

script

getSetLocationJs()

Helper for "onclick.setLocation"

public getSetLocationJs(string $url) : string
Parameters
$url : string
Return values
string

getTranslateJson()

Retrieve JSON of JS sentences translation

public getTranslateJson() : string
Return values
string

getTranslatorScript()

Retrieve JS translator initialization javascript

public getTranslatorScript() : string
Return values
string

hasTags()

Check for tags in multidimensional arrays

public hasTags(string|array<string|int, mixed> $data[, array<string|int, mixed> $arrayKeys = [] ][, bool $skipTags = true ]) : bool
Parameters
$data : string|array<string|int, mixed>
$arrayKeys : array<string|int, mixed> = []

keys of the array being checked that are excluded and included in the check

$skipTags : bool = true

skip transferred array keys, if false then check only them

Return values
bool

includeScript()

Retrieve javascript include code

public includeScript(string $file) : string
Parameters
$file : string
Return values
string

includeSkinScript()

Retrieve

public includeSkinScript(string $file) : string
Parameters
$file : string
Return values
string

isModuleEnabled()

Check is module exists and enabled in global config.

public isModuleEnabled([string $moduleName = null ]) : bool
Parameters
$moduleName : string = null

the full module name, example Mage_Core

Return values
bool

isModuleOutputEnabled()

Check whether the module output is enabled in Configuration

public isModuleOutputEnabled([string $moduleName = null ]) : bool
Parameters
$moduleName : string = null

Full module name

Return values
bool

quoteEscape()

Escape quotes inside html attributes Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc)

public quoteEscape(string $data[, bool $addSlashes = false ]) : string
Parameters
$data : string
$addSlashes : bool = false
Return values
string

removeTags()

Remove html tags, but leave "<" and ">" signs

public removeTags(string $html) : string
Parameters
$html : string
Return values
string

stripTags()

Wrapper for standard strip_tags() function with extra functionality for html entities

public stripTags(string $data[, null|string|array<string|int, string> $allowableTags = null ][, bool $escape = false ]) : string
Parameters
$data : string
$allowableTags : null|string|array<string|int, string> = null
$escape : bool = false
Return values
string

translateArray()

Translate array

public translateArray([mixed $arr = [] ]) : array<string|int, mixed>

@param array $arr

Parameters
$arr : mixed = []
Return values
array<string|int, mixed>

urlDecode()

base64_decode() for URLs decoding

public urlDecode(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

urlDecodeAndEscape()

base64_decode() and escape quotes in url

public urlDecodeAndEscape(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

urlEncode()

base64_encode() for URLs encoding

public urlEncode(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

_getModuleName()

Retrieve helper module name

protected _getModuleName() : string
Return values
string

_getTranslateData()

Retrieve JS translation array

protected _getTranslateData() : array<string|int, mixed>
Return values
array<string|int, mixed>

_getUrl()

Retrieve url

protected _getUrl(string $route[, array<string|int, mixed> $params = [] ]) : string
Parameters
$route : string
$params : array<string|int, mixed> = []
Return values
string

_getXmlConfig()

Load config from files and try to cache it

protected _getXmlConfig() : Config
Return values
Config

_loadCache()

Loading cache data

protected _loadCache(string $id) : mixed
Parameters
$id : string

_saveCache()

Saving cache

protected _saveCache(mixed $data, string $id[, array<string|int, mixed> $tags = [] ][, null|false|int $lifeTime = false ]) : Mage_Core_Helper_Abstract
Parameters
$data : mixed
$id : string
$tags : array<string|int, mixed> = []
$lifeTime : null|false|int = false
Return values
Mage_Core_Helper_Abstract
On this page

Search results