Exemple #1
0
 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)));
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 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));
 }
Exemple #4
0
 public function locale($category = '', $locale = '')
 {
     return setlocale(Convert::toConstant($category, 'LC_'), $locale);
 }
Exemple #5
0
 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_'));
 }
Exemple #6
0
 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_'));
 }
Exemple #7
0
 protected function _filterConstant($const)
 {
     return Convert::toConstant($const, 'FILTER_');
 }
Exemple #8
0
 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);
 }
Exemple #9
0
 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;
 }
Exemple #10
0
 public function option($options = 0, $value = '')
 {
     $this->options[Convert::toConstant($options, 'CURLOPT_')] = $value;
     return $this;
 }
Exemple #11
0
 public function layerEffect($effect = 'normal')
 {
     imagelayereffect($this->canvas, Convert::toConstant($effect, 'IMG_EFFECT_'));
     return $this;
 }