public function getParam($key, $default = null, $type = self::TYPE_STRING, $post = false) { $data = $this->_data; if ($post === true) { $data = $this->getPostData(); } if (isset($data[$key])) { switch ($type) { case self::TYPE_HTML: if ($this->autoCleanHtml() === true) { return Ajde_Component_String::clean($data[$key]); } else { return $data[$key]; } break; case self::TYPE_INTEGER: return (int) $data[$key]; break; case self::TYPE_FLOAT: return (double) $data[$key]; break; case self::TYPE_RAW: return $data[$key]; break; case self::TYPE_STRING: default: if ($this->autoEscapeString() === true) { if (is_array($data[$key])) { array_walk($data[$key], ['Ajde_Component_String', 'escape']); return $data[$key]; } else { return Ajde_Component_String::escape($data[$key]); } } else { return $data[$key]; } } } else { if (isset($default)) { return $default; } else { // TODO: throw new Ajde_Exception("Parameter '{$key}' not present in request and no default value given"); } } }
function _c($var) { return Ajde_Component_String::clean($var); }