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 ncEncode($string = '', $badWords = '', $changeChar = '[badchars]') { if (!is_string($string)) { return Error::set(lang('Error', 'stringParameter', 'string')); } // 2. Parametre boş ise varsayılan olarak Config/Security.php dosya ayarlarını kullan. if (empty($badWords)) { $secnc = $this->config['ncEncode']; $badWords = $secnc['bad_chars']; $changeChar = $secnc['change_bad_chars']; } if (!is_array($badWords)) { return $string = Regex::replace($badWords, $changeChar, $string, 'xi'); } $ch = ''; $i = 0; 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; }
function internalRouteURI(string $requestUri = '') : string { $config = Config::get('Services', 'route'); if ($config['openPage']) { $internalDir = NULL; if (defined('_CURRENT_PROJECT')) { $configAppdir = PROJECTS_CONFIG['directory']['others']; if (is_array($configAppdir)) { $internalDir = !empty($configAppdir[$requestUri]) ? $requestUri : _CURRENT_PROJECT; } else { $internalDir = _CURRENT_PROJECT; } } if ($requestUri === DIRECTORY_INDEX || $requestUri === getLang() || $requestUri === $internalDir || empty($requestUri)) { $requestUri = $config['openPage']; } } $uriChange = $config['changeUri']; $patternType = $config['patternType']; if (!empty($uriChange)) { foreach ($uriChange as $key => $val) { if ($patternType === 'classic') { $requestUri = preg_replace(presuffix($key) . 'xi', $val, $requestUri); } else { $requestUri = Regex::replace($key, $val, $requestUri, 'xi'); } } } return $requestUri; }
private static function getController($location) { $location = strtolower($location); $pattern = '/controller/'; $match = Regex::match($pattern, $location); if ($match > 0) { $location = Regex::replace($pattern, '', $location); } return $location; }
/** * @Invocable */ protected function find() { if ($this->request->hasKey('friend')) { $name = Regex::replace('/[^A-Za-z0-9]/', '', $this->request->valueOf('friend')); Navigator::redirectTo($this->url->getParametersPath($name)); } $name = $this->url->getParameter(0); if ($name == null) { return; } $this->getUsers($name); }
function routeUri($requestUri = '') { if (Config::get('Route', 'openPage')) { if ($requestUri === 'index.php' || empty($requestUri) || $requestUri === getLang()) { $requestUri = Config::get('Route', 'openPage'); } } $config = Config::get('Route'); $uriChange = $config['changeUri']; $patternType = $config['patternType']; if (!empty($uriChange)) { foreach ($uriChange as $key => $val) { if ($patternType === 'classic') { $requestUri = preg_replace(presuffix($key) . 'xi', $val, $requestUri); } else { $requestUri = Regex::replace($key, $val, $requestUri, 'xi'); } } } return $requestUri; }