public function uncompress($data = '', $small = 0) { if (!isValue($data)) { return Error::set(lang('Error', 'valueParameter', '1.(data)')); } return lzf_decompress($data); }
public function word($string = '', $badWords = '', $changeChar = '[badwords]') { if (!isValue($string)) { return Error::set(lang('Error', 'valueParameter', 'string')); } if (!is_array($badWords)) { if (empty($badWords)) { return $string; } return $string = Regex::replace($badWords, $changeChar, $string, 'xi'); } $ch = ''; $i = 0; if (!empty($badWords)) { foreach ($badWords as $value) { if (!is_array($changeChar)) { $ch = $changeChar; } else { if (isset($changeChar[$i])) { $ch = $changeChar[$i]; $i++; } } $string = Regex::replace($value, $ch, $string, 'xi'); } } return $string; }
public function data($searchData = '', $cleanWord = '') { if (!is_array($searchData)) { if (!isValue($cleanWord)) { $cleanWord = ''; } $result = str_replace($cleanWord, '', $searchData); } else { if (!is_array($cleanWord)) { $cleanWordArray[] = $cleanWord; } else { $cleanWordArray = $cleanWord; } $result = array_diff($searchData, $cleanWordArray); } return $result; }
public function translateY($y = 0) { if (!isValue($y)) { Error::set(lang('Error', 'valueParameter', 'y')); return $this; } if (is_numeric($y)) { $y = $y . "px"; } $this->transforms['translatey'] = "translateY(" . $this->_params($y) . ")"; return $this; }
public function recurrentCount($str = '', $char = '') { if (!is_string($str) || empty($str)) { return Error::set(lang('Error', 'stringParameter', '1.(str)')); } if (!isValue($char)) { return $str; } return count(explode($char, $str)) - 1; }
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; } }
public function duration($duration = '') { if (isValue($duration)) { $this->easing['duration'] = $duration; } else { Error::set(lang('Error', 'valueParameter', 'duration')); } return $this; }
protected function _mediaContent($src, $content, $_attributes, $type) { if (!is_string($src)) { $src = ''; } if (!isValue($content)) { $content = ''; } return '<' . $type . 'src="' . $src . '"' . Html::attributes($_attributes) . '>' . $content . "</{$type}>" . eol(); }
public function __construct() { $this->name = strtolower(basename(get_class($this), '.php')); $this->ajax = isValue('ajax'); $this->init(); }
public function rename($oldName = '', $newName = 0) { // Parametre kontrolü yapılıyor. if (!isValue($oldName) || !isValue($newName)) { Error::set(lang('Error', 'valueParameter', 'oldName')); Error::set(lang('Error', 'valueParameter', 'newName')); return false; } if (!file_exists($oldName)) { $this->error = getMessage('File', 'notFoundError', $file); return Error::set($this->error); } return rename($oldName, $newName); }
public function delete($name = '') { if (!isValue($name)) { return Error::set(lang('Error', 'valueParameter', 'name')); } return Session::delete('OB_DATAS_' . $name); }
public function data($searchData = '', $searchWord = '', $output = 'bool') { if (!is_string($output)) { $output = 'bool'; } if (!is_array($searchData)) { if (!isValue($searchWord)) { return Error::set(lang('Error', 'valueParameter', 'searchWord')); } if ($output === 'str' || $output === 'string') { return strstr($searchData, $searchWord); } elseif ($output === 'pos' || $output === 'position') { return strpos($searchData, $searchWord); } elseif ($output === 'bool' || $output === 'boolean') { $result = strpos($searchData, $searchWord); if ($result > -1) { return true; } else { return false; } } else { return false; } } else { $result = array_search($searchWord, $searchData); if ($output === 'pos' || $output === 'position') { if (!empty($result)) { return $result; } else { return -1; } } elseif ($output === 'bool' || $output === 'boolean') { if (!empty($result)) { return true; } else { return false; } } elseif ($output === 'str' || $output === 'string') { if (!empty($result)) { return $searchWord; } else { return false; } } else { return false; } } }
public function easing($easing = '') { if (!isValue($easing)) { Error::set(lang('Error', 'valueParameter', 'easing')); return $this; } $this->transitions .= $this->_transitions("transition-timing-function:{$easing};" . eol()); return $this; }
public function row($where = 'first') { if (!empty($this->where)) { $where = $this->where; $this->where = NULL; } if (!isValue($where)) { return Error::set(lang('Error', 'valueParameter', '1.(where)')); } if ($where === 'first') { $return = $this->resultArray[1]; } elseif ($where === 'last') { $return = end($this->resultArray); } else { $return = $this->resultArray[$where]; } // tek bir satır veri üretiliyor. return (object) $return; }
public function inflate($data = '', $length = 0) { if (!isValue($data)) { return Error::set(lang('Error', 'valueParameter', '1.(data)')); } if (!is_numeric($length)) { return Error::set(lang('Error', 'numericParameter', '2.(length)')); } return gzinflate($data, $length); }
public function uncompress($data = '', $small = 0) { if (!isValue($data)) { return Error::set(lang('Error', 'valueParameter', '1.(data)')); } if (!is_numeric($small)) { return Error::set(lang('Error', 'numericParameter', '2.(small)')); } return bzdecompress($data, $small); }
public function delete($name = '', $path = '') { if (!isValue($name) || empty($name)) { return Error::set(lang('Error', 'valueParameter', 'name')); } $cookieConfig = $this->config; if (!empty($path)) { $this->path = $path; } if (empty($this->path)) { $this->path = $cookieConfig["path"]; } if (isset($this->encode['name'])) { if (isHash($this->encode['name'])) { $name = hash($this->encode['name'], $name); $this->encode = array(); } } else { if ($cookieConfig["encode"] === true) { $name = md5($name); } } if (isset($_COOKIE[$name])) { setcookie($name, '', time() - 1, $this->path); $this->path = NULL; } else { return false; } }
public function select($name = '', $options = array(), $selected = '', $_attributes = '', $multiple = false) { if (!is_string($name)) { $name = ''; } if (!isValue($selected)) { $selected = ''; } // Herhangi bir id değeri tanımlanmamışsa // Id değeri olarak isim bilgisini kullan. $id = isset($_attributes["id"]) ? $_attributes["id"] : $name; // Id değer tanımlanmışsa // Id değeri olarak tanımalanan değeri kullan. $id_txt = isset($_attributes["id"]) ? '' : "id=\"{$id}\""; // Son parametrenin durumuna multiple olması belirleniyor. // Ancak bu parametrenin kullanımı gerekmez. // Bunun için multiple() yöntemi oluşturulmuştur. if ($multiple === true) { $multiple = 'multiple="multiple"'; } else { $multiple = ''; } $selectbox = '<select ' . $multiple . ' name="' . $name . '" ' . $id_txt . Html::attributes($_attributes) . '>'; if (is_array($options)) { foreach ($options as $key => $value) { if ($selected == $key) { $select = 'selected="selected"'; } else { $select = ""; } $selectbox .= '<option value="' . $key . '" ' . $select . '>' . $value . '</option>' . eol(); } } $selectbox .= '</select>' . eol(); return $selectbox; }
public function size($width = '', $height = '') { if (!isValue($height) || !isValue($width)) { Error::set(lang('Error', 'valueParameter', 'width & height')); return $this; } if (!empty($width)) { $this->attr['width'] = $width; } if (!empty($height)) { $this->attr['height'] = $height; } return $this; }
function divide($str = '', $seperator = "|", $index = 0) { if (!is_string($str)) { return false; } if (!is_string($seperator) || empty($seperator)) { $seperator = "|"; } if (!isValue($index)) { $index = 0; } $arrayEx = explode($seperator, $str); if ($index < 0) { $ind = count($arrayEx) + $index; } elseif ($index === 'last') { $ind = count($arrayEx) - 1; } elseif ($index === 'first') { $ind = 0; } else { $ind = $index; } if (isset($arrayEx[$ind])) { return $arrayEx[$ind]; } else { return false; } }
public function meta($name = '', $content = '', $type = 'name') { if (!is_string($type)) { $type = 'name'; } if (!isValue($content)) { $content = ''; } if (!is_array($name)) { if ($type === 'name' && $name !== '') { $name = ' name="' . $name . '"'; } elseif ($type === 'http' && $name !== '') { $name = ' http-equiv="' . $name . '"'; } else { $name = ''; } if ($content !== '') { $content = ' content="' . $content . '"'; } else { $content = ''; } return '<meta' . $name . $content . ' />' . "\n"; } else { $metas = ''; foreach ($name as $val) { if (!isset($val['name'])) { $val['name'] = ''; } if (!isset($val['content'])) { $val['content'] = ''; } if (!isset($val['type'])) { $val['type'] = 'name'; } if ($val['type'] !== '' && $val['type'] === 'http') { $type = ' http-equiv="' . $val['name'] . '"'; } if ($val['type'] !== '' && $val['type'] === 'name') { $type = ' name="' . $val['name'] . '"'; } if ($val['content'] !== '') { $content = ' content="' . $val['content'] . '"'; } else { $content = ''; } $metas .= '<meta' . $type . $content . ' />' . "\n"; } return $metas; } }
public function color($val = '') { if (!isValue($val)) { Error::set(lang('Error', 'valueParameter', 'val')); return $this; } if (is_numeric($val)) { $val = "#" . $val; } $this->params['color'] = $val; return $this; }
public function having($column = '', $value = '', $logical = '') { // Parametrelerin string kontrolü yapılıyor. if (!is_string($column) || !isValue($value) || !is_string($logical)) { Error::set(lang('Error', 'stringParameter', 'column, value, logical')); } else { $value = presuffix($this->db->realEscapeString($value), "'"); $this->having .= ' ' . $column . ' ' . $value . ' ' . $logical . ' '; } return $this; }
public function globals($globals = true) { if (!isValue($globals)) { Error::set(lang('Error', 'valueParameter', 'globals')); return $this; } $globals = $this->_boolToStr($globals); $this->sets['globals'] = "\tglobal:{$globals}," . eol(); return $this; }
public function login($un = 'username', $pw = 'password', $rememberMe = false) { if (!is_string($un)) { return Error::set(lang('Error', 'stringParameter', 'un')); } if (!is_string($pw)) { return Error::set(lang('Error', 'stringParameter', 'pw')); } if (!isValue($rememberMe)) { $rememberMe = false; } $username = $un; $password = Encode::super($pw); // ------------------------------------------------------------------------------ // CONFIG/USER.PHP AYARLARI // Config/User.php dosyasında belirtilmiş ayarlar alınıyor. // ------------------------------------------------------------------------------ $userConfig = $this->config; $passwordColumn = $userConfig['passwordColumn']; $usernameColumn = $userConfig['usernameColumn']; $emailColumn = $userConfig['emailColumn']; $tableName = $userConfig['tableName']; $bannedColumn = $userConfig['bannedColumn']; $activeColumn = $userConfig['activeColumn']; $activationColumn = $userConfig['activationColumn']; // ------------------------------------------------------------------------------ $db = uselib('DB'); $r = $db->where($usernameColumn . ' =', $username)->get($tableName)->row(); if (empty($r)) { $this->error = lang('User', 'loginError'); return Error::set($this->error); } if (!isset($r->{$passwordColumn})) { $this->error = lang('User', 'loginError'); return Error::set($this->error); } $passwordControl = $r->{$passwordColumn}; $bannedControl = ''; $activationControl = ''; if (!empty($bannedColumn)) { $banned = $bannedColumn; $bannedControl = $r->{$banned}; } if (!empty($activationColumn)) { $activationControl = $r->{$activationColumn}; } if (!empty($r->{$usernameColumn}) && $passwordControl == $password) { if (!empty($bannedColumn) && !empty($bannedControl)) { $this->error = lang('User', 'bannedError'); return Error::set($this->error); } if (!empty($activationColumn) && empty($activationControl)) { $this->error = lang('User', 'activationError'); return Error::set($this->error); } if (!isset($_SESSION)) { session_start(); } $_SESSION[md5($usernameColumn)] = $username; session_regenerate_id(); if (Method::post($rememberMe) || !empty($rememberMe)) { if (Cookie::select(md5($usernameColumn)) != $username) { Cookie::insert(md5($usernameColumn), $username); Cookie::insert(md5($passwordColumn), $password); } } if (!empty($activeColumn)) { $db->where($usernameColumn . ' =', $username)->update($tableName, array($activeColumn => 1)); } $this->error = false; $this->success = lang('User', 'loginSuccess'); return true; } else { $this->error = lang('User', 'loginError'); return Error::set($this->error); } }
public function toConstant($var = NULL, $prefix = '', $suffix = '') { if (!isValue($var)) { return Error::set(lang('Error', 'valueParameter', '1.(var)')); } if (!is_string($prefix) || !is_string($suffix)) { return Error::set(lang('Error', 'stringParameter', '2.(prefix) & 2.(suffix)')); } if (defined(strtoupper($prefix . $var . $suffix))) { return constant(strtoupper($prefix . $var . $suffix)); } elseif (defined($var)) { return constant($var); } else { return $var; } }
public function process($roleId = '', $process = '', $object = '') { // Parametrelerin kontrolleri yapılıyor. if (!is_numeric($roleId)) { return Error::set(lang('Error', 'numericParameter', 'roleId')); } if (!isValue($process)) { $process = ''; } if (!isValue($object)) { $object = ''; } $this->permission = $this->config['process']; if (isset($this->permission[$roleId])) { $rules = $this->permission[$roleId]; } else { return false; } $currentUrl = $process; switch ($rules) { case 'all': return $object; break; case 'any': return false; break; } if (strpos($rules, "|") > -1) { $pages = explode("|", $rules); foreach ($pages as $page) { $page = trim($page); if ($page[0] === "!") { $rule = substr(trim($page), 1); } else { $rule = trim($page); } if ($pages[0] === "perm->") { if (strpos($currentUrl, $rule) > -1) { return $object; } else { $this->result = false; } } else { if (strpos($currentUrl, $rule) > -1) { return false; } else { $this->result = $object; } } } return $this->result; } else { // tek bir yetki varsa if ($rules[0] === "!") { $page = substr(trim($rules), 1); } else { $page = trim($rules); } if (strpos($currentUrl, $page) > -1) { if ($rules[0] !== "!") { return $object; } else { return false; } } else { return $object; } } }
public function super($data = '') { if (!isValue($data) || empty($data)) { return Error::set(lang('Error', 'valueParameter', 'data')); } $projectKey = $this->config['projectKey']; $algo = $this->config['type']; if (!isHash($algo)) { $algo = 'md5'; } // Proje Anahatarı belirtizme bu veri yerine // Proje anahtarı olarak sitenin host adresi // eklenecek ek veri kabul edilir. if (empty($projectKey)) { $additional = hash($algo, host()); } else { $additional = hash($algo, $projectKey); } // Veri şifreleniyor. $data = hash($algo, $data); // Veri ve ek yeniden şifreleniyor. return hash($algo, $data . $additional); }