Public Member Functions | |
__ () | |
htmlEscape ($data, $allowedTags=null) | |
urlEscape ($data) | |
jsQuoteEscape ($data, $quote='\'') | |
setLayout ($layout) | |
getLayout () | |
urlEncode ($url) | |
urlDecode ($url) | |
translateArray ($arr=array()) | |
Protected Member Functions | |
_getRequest () | |
_loadCache ($id) | |
_saveCache ($data, $id, $tags=array(), $lifeTime=false) | |
_removeCache ($id) | |
_cleanCache ($tags=array()) | |
_getModuleName () | |
_getUrl ($route, $params=array()) | |
Protected Attributes | |
$_moduleName | |
$_request | |
$_layout |
Definition at line 32 of file Abstract.php.
__ | ( | ) |
Translate
Definition at line 136 of file Abstract.php.
00137 { 00138 $args = func_get_args(); 00139 $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getModuleName()); 00140 array_unshift($args, $expr); 00141 return Mage::app()->getTranslator()->translate($args); 00142 }
_cleanCache | ( | $ | tags = array() |
) | [protected] |
Cleaning cache
array | $tags |
Definition at line 111 of file Abstract.php.
00112 { 00113 Mage::app()->cleanCache($tags); 00114 return $this; 00115 }
_getModuleName | ( | ) | [protected] |
Retrieve helper module name
Definition at line 122 of file Abstract.php.
00123 { 00124 if (!$this->_moduleName) { 00125 $class = get_class($this); 00126 $this->_moduleName = substr($class, 0, strpos($class, '_Helper')); 00127 } 00128 return $this->_moduleName; 00129 }
_getRequest | ( | ) | [protected] |
Retrieve request object
Definition at line 60 of file Abstract.php.
00061 { 00062 if (!$this->_request) { 00063 $this->_request = Mage::app()->getRequest(); 00064 } 00065 return $this->_request; 00066 }
_getUrl | ( | $ | route, | |
$ | params = array() | |||
) | [protected] |
Retrieve url
string | $route | |
array | $params |
Definition at line 213 of file Abstract.php.
00214 { 00215 return Mage::getUrl($route, $params); 00216 }
_loadCache | ( | $ | id | ) | [protected] |
Loading cache data
string | $id |
Definition at line 74 of file Abstract.php.
00075 { 00076 return Mage::app()->loadCache($id); 00077 }
_removeCache | ( | $ | id | ) | [protected] |
Removing cache
string | $id |
Definition at line 99 of file Abstract.php.
00100 { 00101 Mage::app()->removeCache($id); 00102 return $this; 00103 }
_saveCache | ( | $ | data, | |
$ | id, | |||
$ | tags = array() , |
|||
$ | lifeTime = false | |||
) | [protected] |
Saving cache
mixed | $data | |
string | $id | |
array | $tags |
Definition at line 87 of file Abstract.php.
getLayout | ( | ) |
Retrieve layout model object
Definition at line 235 of file Abstract.php.
htmlEscape | ( | $ | data, | |
$ | allowedTags = null | |||
) |
Escape html entities
mixed | $data | |
array | $allowedTags |
Definition at line 151 of file Abstract.php.
00152 { 00153 if (is_array($data)) { 00154 $result = array(); 00155 foreach ($data as $item) { 00156 $result[] = $this->htmlEscape($item); 00157 } 00158 } else { 00159 // process single item 00160 if (strlen($data)) { 00161 if (is_array($allowedTags) and !empty($allowedTags)) { 00162 $allowed = implode('|', $allowedTags); 00163 $result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data); 00164 $result = htmlspecialchars($result); 00165 $result = preg_replace('/##([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)##/si', '<$1$2$3>', $result); 00166 } else { 00167 $result = htmlspecialchars($data); 00168 } 00169 } else { 00170 $result = $data; 00171 } 00172 } 00173 return $result; 00174 }
jsQuoteEscape | ( | $ | data, | |
$ | quote = '\'' | |||
) |
Escape quotes in java script
moxed | $data | |
string | $quote |
Definition at line 194 of file Abstract.php.
00195 { 00196 if (is_array($data)) { 00197 $result = array(); 00198 foreach ($data as $item) { 00199 $result[] = str_replace($quote, '\\'.$quote, $item); 00200 } 00201 return $result; 00202 } 00203 return str_replace($quote, '\\'.$quote, $data); 00204 }
setLayout | ( | $ | layout | ) |
Declare layout
Mage_Core_Model_Layout | $layout |
Definition at line 224 of file Abstract.php.
translateArray | ( | $ | arr = array() |
) |
Translate array
array | $arr |
Definition at line 269 of file Abstract.php.
00270 { 00271 foreach ($arr as $k => $v) { 00272 if (is_array($v)) { 00273 $v = self::translateArray($v); 00274 } elseif ($k === 'label') { 00275 $v = self::__($v); 00276 } 00277 $arr[$k] = $v; 00278 } 00279 return $arr; 00280 }
urlDecode | ( | $ | url | ) |
base64_dencode() for URLs dencoding
string | $url |
Definition at line 257 of file Abstract.php.
00258 { 00259 $url = base64_decode(strtr($url, '-_,', '+/=')); 00260 return Mage::getSingleton('core/url')->sessionUrlVar($url); 00261 }
urlEncode | ( | $ | url | ) |
base64_encode() for URLs encoding
string | $url |
Definition at line 246 of file Abstract.php.
urlEscape | ( | $ | data | ) |
Escape html entities in url
string | $data |
Definition at line 182 of file Abstract.php.
00183 { 00184 return htmlspecialchars($data); 00185 }
$_layout [protected] |
Definition at line 53 of file Abstract.php.
$_moduleName [protected] |
Definition at line 39 of file Abstract.php.
$_request [protected] |
Definition at line 46 of file Abstract.php.