/** * Do clean */ function _do($text = '', $params = []) { if (!strlen($text)) { return ''; } $text = utf8_strip_ascii_ctrl($text); if ((SEARCH_COUNTRY == 'ru' || $params['country'] == 'ru' || SEARCH_COUNTRY == 'ua' || $params['country'] == 'ua') && preg_match('/[а-яА-Я]/', $text)) { $text = $this->_utf8_bad_for_rus_clean($text); } else { $text = $this->_utf8_strip_non_ascii($text); } if ($params['simple_chars']) { $allowed_symbols = implode('', array_keys($this->UTF8_LOWER_ACCENTS)) . implode('', array_keys($this->UTF8_UPPER_ACCENTS)); if (SEARCH_COUNTRY == 'ru' || $params['country'] == 'ru' || SEARCH_COUNTRY == 'ua' || $params['country'] == 'ua') { $allowed_symbols .= 'а-яА-Я'; } $text = preg_replace('/[^a-z0-9' . $allowed_symbols . ' ]/', '', $text); } return $text; }
/** * Replace bad bytes with an alternative character - ASCII character * @param $str string input string * @return string */ static function utf8_strip_ascii_ctrl($str) { require_once './lib/pkp/lib/phputf8/utils/ascii.php'; return utf8_strip_ascii_ctrl($str); }
/** * Replace bad bytes with an alternative character - ASCII character * @param $str string input string * @return string */ function utf8_strip_ascii_ctrl($str) { require_once 'utils/ascii.php'; return utf8_strip_ascii_ctrl($str); }