/** * @param string $name * * @return string */ public function field($name) { if (property_exists($this, $name)) { return Crypt::request((new \ReflectionClass($this))->getShortName()) . '[' . Crypt::request($name) . ']'; } return Crypt::request($name); }
/** * @return string */ public function generateId() { return implode('-', str_split(strtoupper(Crypt::create(12)), 4)); }
/** * @param string $name * @param mixed $default * * @return mixed */ public function post($name, $default = null) { $parsed = explode('.', $name); $result = $_POST; while ($parsed) { $next = array_shift($parsed); $next_crypted = Crypt::request($next); if (isset($result[$next])) { $result = $result[$next]; } elseif ($next_crypted != $next && isset($result[$next_crypted])) { $result = $result[$next_crypted]; } else { return $default; } } return $result; }
/** * @param string $id * @param string $data * * @return bool */ public function write($id, $data) { return parent::write($id, mcrypt_encrypt(MCRYPT_3DES, Crypt::pad($this->_key), $data, MCRYPT_MODE_ECB)); }