public function get($get = 1, $index = 1, bool $while = false) : string { // Parametre kontrolleri yapılıyor. --------------------------------------------------- if (!isChar($index)) { $index = 1; } if (!is_scalar($while)) { $while = false; } // ------------------------------------------------------------------------------------ $segArr = $this->segmentArray(); $segVal = ''; if (is_numeric($get)) { return $this->getByIndex($get, $index); } if (in_array($get, $segArr)) { $segVal = array_search($get, $segArr); // 3. parametrenin boş olmama durumu ve // 2. parametrenin sayısal olmama durumu if (!empty($while) && !is_numeric($index)) { return $this->getByName($get, $index); } // 2. parametrenin all olma durumu // 1. parametreden itibaren bütün // segmentleri verir. if ($index === 'all') { return $this->getNameAll($get); } // 3. parametrenin boş olmaması durumu if (!empty($while)) { $return = ''; $countSegArr = count($segArr) - 1; if ($index > $countSegArr) { $index = $countSegArr; } if ($index < 0) { $index = $countSegArr + $index + 1; } for ($i = 1; $i <= $index; $i++) { $return .= $segArr[$segVal + $i] . "/"; } $return = substr($return, 0, -1); return $return; } // 2. parametrenin count olma durumu // 1. parametrede belirtilen segmentten // itibaren kalan bölüm sayısını verir. if ($index === "count") { return $this->getNameCount($get); } if (isset($segArr[$segVal + $index])) { return $segArr[$segVal + $index]; } else { return false; } } else { return false; } }
public function selector($selector = '') { if (!isChar($selector)) { Error::set(lang('Error', 'valueParameter', 'selector')); return $this; } $this->selector = $selector; return $this; }
public function name($name = '') { if (!isChar($name)) { Error::set('Error', 'valueParameter', 'name'); return $this; } $this->name = $name; return $this; }
public function selector($selector = '') { if (!isChar($selector)) { Error::set(lang('Error', 'valueParameter', 'selector')); return $this; } if ($this->_isKeySelector($selector)) { $code = $selector; } else { $code = "\"{$selector}\""; } return "\$({$code})"; }
public static function set($errorMessage = '', $output = false, $object = '') { //------------------------------------------------------------------------------------------------ // 2. Parametre metinsel değer alırsa lang() yönteminden verinin çağrılmasını sağlar. //------------------------------------------------------------------------------------------------ if (isChar($output)) { $errorMessage = lang($errorMessage, $output, $object); } $info = debug_backtrace(); $className = isset($info[1]['class']) ? str_ireplace(STATIC_ACCESS, '', $info[1]['class']) : (isset($info[5]['class']) ? $info[5]['class'] : false); $methodName = isset($info[1]['function']) ? $info[1]['function'] : (isset($info[5]['function']) ? $info[5]['function'] : false); $line = isset($info[1]['line']) ? $info[1]['line'] : (isset($info[5]['line']) ? $info[5]['line'] : false); $file = isset($info[1]['file']) ? $info[1]['file'] : (isset($info[5]['file']) ? $info[5]['file'] : false); self::$errors[strtolower($className)][strtolower($methodName)]['message'][] = $errorMessage; self::$errors[strtolower($className)][strtolower($methodName)]['line'][] = $line; self::$errors[strtolower($className)][strtolower($methodName)]['file'][] = $file; report(ucfirst($className . 'Error'), $errorMessage, ucfirst($className) . 'Library'); return $output === true ? $errorMessage : false; }
public function insert($name = '', $value = '') { if (!empty($name)) { if (!isChar($name)) { Error::set('Error', 'valueParameter', 'name'); return false; } $this->name($name); } if (!empty($value)) { $this->value($value); } if (!empty($this->encode)) { if (isset($this->encode['name'])) { if (isHash($this->encode['name'])) { $this->name = hash($this->encode['name'], $this->name); } } if (isset($this->encode['value'])) { if (isHash($this->encode['value'])) { $this->value = hash($this->encode['value'], $this->value); } } } $sessionConfig = $this->config; if (!isset($this->encode['name'])) { if ($sessionConfig["encode"] === true) { $this->name = md5($this->name); } } $_SESSION[$this->name] = $this->value; if ($_SESSION[$this->name]) { if ($this->regenerate === true) { session_regenerate_id(); } $this->defaultVariable(); return true; } else { return false; } }
public function prefix($prefix = '') { if (isChar($prefix)) { $this->settings['prefix'] = $prefix; } else { Error::set(lang('Error', 'valueParameter', 'prefix')); } return $this; }
public static function isSymbol($s) { $__tmp = strlen($s); if ($__tmp == 0) { return false; } $ch = $s[0]; if (isDigit($ch)) { return false; } for ($i = 0; $i < $__tmp; $i++) { $ch = $s[$i]; if (!(isChar($ch) || isDigit($ch) || $ch == '_')) { return false; } } return true; }
public function get($get = '', $index = 1, $while = false) { // Parametre kontrolleri yapılıyor. --------------------------------------------------- if (!isChar($index)) { $index = 1; } if (!is_scalar($while)) { $while = false; } // ------------------------------------------------------------------------------------ $segArr = $this->segmentArray(); $segVal = ''; if (is_numeric($get)) { if ($get == 0) { $get = 1; } $get -= 1; $uri = ''; if ($index === 'all') { $index = -1; } $countSegArr = count($segArr); if ($index < 0) { $index = $countSegArr + $index + 1; } if ($index > 0) { $index = $get + $index; } if (abs($index) > $countSegArr) { $index = $countSegArr; } for ($i = $get; $i < $index; $i++) { $uri .= $segArr[$i] . '/'; } return rtrim($uri, '/'); } if (in_array($get, $segArr)) { $segVal = array_search($get, $segArr); // 3. parametrenin boş olmama durumu ve // 2. parametrenin sayısal olmama durumu if (!empty($while) && !is_numeric($index)) { $getVal = array_search($get, $segArr); $indexVal = array_search($index, $segArr); $return = ''; for ($i = $getVal; $i <= $indexVal; $i++) { $return .= htmlspecialchars($segArr[$i], ENT_QUOTES, "utf-8") . "/"; } return substr($return, 0, -1); } // 2. parametrenin all olma durumu // 1. parametreden itibaren bütün // segmentleri verir. if ($index === 'all') { $return = ''; for ($i = 1; $i < count($segArr) - $segVal; $i++) { $return .= htmlspecialchars($segArr[$segVal + $i], ENT_QUOTES, "utf-8") . "/"; } $return = substr($return, 0, -1); return $return; } // 3. parametrenin boş olmaması durumu if (!empty($while)) { $return = ''; for ($i = 1; $i <= $index; $i++) { $return .= htmlspecialchars($segArr[$segVal + $i], ENT_QUOTES, "utf-8") . "/"; } $return = substr($return, 0, -1); return $return; } // 2. parametrenin count olma durumu // 1. parametrede belirtilen segmentten // itibaren kalan bölüm sayısını verir. if ($index === "count") { return count($segArr) - 1 - $segVal; } if (isset($segArr[$segVal + $index])) { return htmlspecialchars($segArr[$segVal + $index], ENT_QUOTES, "utf-8"); } else { return false; } } else { return false; } }
public function insert($name = '', $value = '', $time = '', $path = '', $domain = '', $secure = '', $httpOnly = '') { if (!empty($name)) { if (!isChar($name)) { return Error::set(lang('Error', 'valueParameter', 'name')); } $this->name($name); } if (!empty($value)) { $this->value($value); } if (!empty($time)) { $this->time($time); } if (!empty($path)) { $this->path($path); } if (!empty($domain)) { $this->domain($domain); } if (!empty($secure)) { $this->secure($domain); } if (!empty($httpOnly)) { $this->httpOnly($httpOnly); } if (!empty($this->encode)) { if (isset($this->encode['name'])) { if (isHash($this->encode['name'])) { $this->name = hash($this->encode['name'], $this->name); } } if (isset($this->encode['value'])) { if (isHash($this->encode['value'])) { $this->value = hash($this->encode['value'], $this->value); } } } $cookieConfig = $this->config; if (empty($this->time)) { $this->time = $cookieConfig['time']; } if (empty($this->path)) { $this->path = $cookieConfig['path']; } if (empty($this->domain)) { $this->domain = $cookieConfig['domain']; } if (empty($this->secure)) { $this->secure = $cookieConfig['secure']; } if (empty($this->httpOnly)) { $this->httpOnly = $cookieConfig['httpOnly']; } if (!isset($this->encode['name'])) { if ($cookieConfig["encode"] === true) { $this->name = md5($this->name); } } if (setcookie($this->name, $this->value, time() + $this->time, $this->path, $this->domain, $this->secure, $this->httpOnly)) { if ($this->regenerate === true) { session_regenerate_id(); } $this->_defaultVariable(); return true; } else { $this->error = getMessage('Cookie', 'setError'); return Error::set($this->error); } }
public function get($get = '', $index = 1, $while = false) { // Parametre kontrolleri yapılıyor. --------------------------------------------------- if (!is_string($get) || empty($get)) { return Error::set(lang('Error', 'stringParameter', 'get')); } if (!isChar($index)) { $index = 1; } if (!isValue($while)) { $while = false; } // ------------------------------------------------------------------------------------ $segArr = $this->segmentArray(); $segVal = ''; if (in_array($get, $segArr)) { $segVal = array_search($get, $segArr); // 3. parametrenin boş olmama durumu ve // 2. parametrenin sayısal olmama durumu if (!empty($while) && !is_numeric($index)) { $getVal = array_search($get, $segArr); $indexVal = array_search($index, $segArr); $return = ''; for ($i = $getVal; $i <= $indexVal; $i++) { $return .= htmlentities($segArr[$i]) . "/"; } return substr($return, 0, -1); } // 2. parametrenin all olma durumu // 1. parametreden itibaren bütün // segmentleri verir. if ($index === 'all') { $return = ''; for ($i = 1; $i < count($segArr) - $segVal; $i++) { $return .= htmlentities($segArr[$segVal + $i]) . "/"; } $return = substr($return, 0, -1); return $return; } // 3. parametrenin boş olmaması durumu if (!empty($while)) { $return = ''; for ($i = 1; $i <= $index; $i++) { $return .= htmlentities($segArr[$segVal + $i]) . "/"; } $return = substr($return, 0, -1); return $return; } // 2. parametrenin count olma durumu // 1. parametrede belirtilen segmentten // itibaren kalan bölüm sayısını verir. if ($index === "count") { return count($segArr) - 1 - $segVal; } if (isset($segArr[$segVal + $index])) { return htmlentities($segArr[$segVal + $index]); } else { return false; } } else { return false; } }