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
$_config
Translate config
protected
Mage_Core_Model_Translate_Config|null
$_config
= \null
$_layout
Layout model object
protected
Mage_Core_Model_Layout
$_layout
$_moduleName
Helper module name
protected
string
$_moduleName
= 'Mage_Adminhtml'
$_request
Request object
protected
Mage_Core_Controller_Request_Http
$_request
$_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
stringaddTranslateData()
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=
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
stringescapeSpecial()
Remove `\t`,`\n`,`\r`,`\0`,`\x0B:` symbols from the string.
public
escapeSpecial(string $data) : string
Parameters
- $data : string
Return values
stringescapeUrl()
Escape html entities in url
public
escapeUrl(string $data) : string
Parameters
- $data : string
Return values
stringgetConfirmSetLocationJs()
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
Return values
stringgetDeleteConfirmJs()
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
Return values
stringgetJsSkinUrl()
Retrieve skin JS file url
public
getJsSkinUrl(string $file) : string
Parameters
- $file : string
Return values
stringgetJsUrl()
Retrieve JS file url
public
getJsUrl(string $file) : string
Parameters
- $file : string
Return values
stringgetLayout()
Retrieve layout model object
public
getLayout() : Mage_Core_Model_Layout
Return values
Mage_Core_Model_LayoutgetSaveAndContinueEditJs()
Helper for "onclick.saveAndContinueEdit"
public
getSaveAndContinueEditJs(string $url) : string
Parameters
- $url : string
Return values
stringgetScript()
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
stringgetTranslateJson()
Retrieve JSON of JS sentences translation
public
getTranslateJson() : string
Return values
stringgetTranslatorScript()
Retrieve JS translator initialization javascript
public
getTranslatorScript() : string
Return values
stringhasTags()
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
boolincludeScript()
Retrieve javascript include code
public
includeScript(string $file) : string
Parameters
- $file : string
Return values
stringincludeSkinScript()
Retrieve
public
includeSkinScript(string $file) : string
Parameters
- $file : string
Return values
stringisModuleEnabled()
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
boolisModuleOutputEnabled()
Check whether the module output is enabled in Configuration
public
isModuleOutputEnabled([string $moduleName = null ]) : bool
Parameters
- $moduleName : string = null
-
Full module name
Return values
booljsQuoteEscape()
Escape quotes in java script
public
jsQuoteEscape(string|array<string|int, string> $data[, string $quote = '\'' ]) : ($data is array ? string[] : string)
Parameters
- $data : string|array<string|int, string>
- $quote : string = '\''
Tags
Return values
($data is array ? string[] : string)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
stringremoveTags()
Remove html tags, but leave "<" and ">" signs
public
removeTags(string $html) : string
Parameters
- $html : string
Return values
stringsetLayout()
Declare layout
public
setLayout(Mage_Core_Model_Layout $layout) : Mage_Core_Helper_Abstract
Parameters
- $layout : Mage_Core_Model_Layout
Return values
Mage_Core_Helper_AbstractstripTags()
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
stringtranslateArray()
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
stringurlDecodeAndEscape()
base64_decode() and escape quotes in url
public
urlDecodeAndEscape(mixed $url) : string
@param string $url
Parameters
- $url : mixed
Return values
stringurlEncode()
base64_encode() for URLs encoding
public
urlEncode(mixed $url) : string
@param string $url
Parameters
- $url : mixed
Return values
string_cleanCache()
Cleaning cache
protected
_cleanCache([array<string|int, mixed> $tags = [] ]) : Mage_Core_Helper_Abstract
Parameters
- $tags : array<string|int, mixed> = []
Return values
Mage_Core_Helper_Abstract_getModuleName()
Retrieve helper module name
protected
_getModuleName() : string
Return values
string_getRequest()
Retrieve request object
protected
_getRequest() : Mage_Core_Controller_Request_Http
Return values
Mage_Core_Controller_Request_Http_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
_removeCache()
Removing cache
protected
_removeCache(string $id) : Mage_Core_Helper_Abstract
Parameters
- $id : string
Return values
Mage_Core_Helper_Abstract_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