function _buildViewWhere() { $db = MFactory::getDBO(); $search = $this->mainframe->getUserStateFromRequest($this->option . '.queries.search', 'search', '', 'string'); $search = MString::strtolower($search); $where = array(); if ($search) { $where[] = 'LOWER(title) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false); } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; return $where; }
public static function stringURLUnicodeSlug($string) { // Replace double byte whitespaces by single byte (East Asian languages) $str = preg_replace('/\\xE3\\x80\\x80/', ' ', $string); // Remove any '-' from the string as they will be used as concatenator. // Would be great to let the spaces in but only Firefox is friendly with this $str = str_replace('-', ' ', $str); // Replace forbidden characters by whitespaces $str = preg_replace('#[:\\#\\*"@+=;!><&\\.%()\\]\\/\'\\\\|\\[]#', " ", $str); // Delete all '?' $str = str_replace('?', '', $str); // Trim white spaces at beginning and end of alias and make lowercase $str = trim(MString::strtolower($str)); // Remove any duplicate whitespace and replace whitespaces by hyphens $str = preg_replace('#\\x20+#', '-', $str); return $str; }
public function transliterate($string) { include_once dirname(__FILE__) . '/latin_transliterate.php'; if ($this->transliterator !== null) { return call_user_func($this->transliterator, $string); } $string = MLanguageTransliterate::utf8_latin_to_ascii($string); $string = MString::strtolower($string); return $string; }