public function encrypt($data = '', $settings = array()) { $cipher = isset($settings['cipher']) ? $settings['cipher'] : 'sha256'; $key = isset($settings['key']) ? $settings['key'] : Config::get('Encode', 'projectKey'); // MHASH_ ön eki ilave ediliyor. $cipher = Convert::toConstant($cipher, 'MHASH_'); return base64_encode(trim(mhash($cipher, $data, $key))); }
public function dnsRecords($host = '', $type = 'any', $raw = false) { if (!is_string($host)) { return Error::set('Error', 'stringParameter', '1.(host)'); } $dns = dns_get_record($this->cleanHttp($host), Convert::toConstant($type, 'DNS_'), $auth, $add, $raw); return (object) array('records' => $dns, 'authns' => $auth, 'addtl' => $add); }
public function decrypt($data = '', $settings = array()) { $cipher = isset($settings['cipher']) ? $settings['cipher'] : 'des'; $cipher = str_replace('-', '_', $cipher); $key = isset($settings['key']) ? $settings['key'] : $this->keySize($cipher); $mode = isset($settings['mode']) ? $settings['mode'] : 'cbc'; $iv = isset($settings['vector']) ? $settings['vector'] : $this->vectorSize($mode, $cipher); // MCRYPT_ ön eki ilave ediliyor. $cipher = Convert::toConstant($cipher, 'MCRYPT_'); // MCRYPT_MODE_ ön eki ilave ediliyor. $mode = Convert::toConstant($mode, 'MCRYPT_MODE_'); $data = base64_decode($data); return trim(mcrypt_decrypt($cipher, $key, trim($data), $mode, $iv)); }
public function locale($category = '', $locale = '') { return setlocale(Convert::toConstant($category, 'LC_'), $locale); }
public function translationTable($table = HTML_SPECIALCHARS, $quote = ENT_COMPAT) { if (!is_scalar($table) || !is_scalar($quote)) { return Error::set('Error', 'scalarParameter', '1.(table) & 2.(quote)'); } return get_html_translation_table(Convert::toConstant($table, 'HTML_'), Convert::toConstant($quote, 'ENT_')); }
public function deleteRecurrent($array = array(), $flags = 'string') { if (!is_array($array)) { return Error::set('Error', 'arrayParameter', '1.(array)'); } return array_unique($array, Convert::toConstant($flags, 'SORT_')); }
protected function _filterConstant($const) { return Convert::toConstant($const, 'FILTER_'); }
public function casing($string = '', $flag = 'upper', $encoding = 'UTF-8') { if (!is_string($string)) { return Error::set('Error', 'stringParameter', '1.(string)'); } if (!isCharset($encoding)) { return Error::set('Error', 'charsetParameter', '3.($encoding)'); } return mb_convert_case($string, Convert::toConstant($flag, 'MB_CASE_'), $encoding); }
public static function tokenFileInfo($fileName = '', $type = T_FUNCTION) { if (!is_file($fileName)) { return false; } // Dosya içeriğini al ve tarama yap. $tokens = token_get_all(file_get_contents($fileName)); $info = array(); $i = 0; $type = Convert::toConstant($type, 'T_'); foreach ($tokens as $token) { // ------------------------------------------------------------------------------------------- // Fonksiyon ismi yakalanıyor // ------------------------------------------------------------------------------------------- if ($token[0] === $type) { // Sınıf bilgisi oluşturuluyor... $info[] = isset($tokens[$i + 2][1]) ? $tokens[$i + 2][1] : NULL; } // ------------------------------------------------------------------------------------------- $i++; } return $info; }
public function option($options = 0, $value = '') { $this->options[Convert::toConstant($options, 'CURLOPT_')] = $value; return $this; }
public function layerEffect($effect = 'normal') { imagelayereffect($this->canvas, Convert::toConstant($effect, 'IMG_EFFECT_')); return $this; }