/** * @param string $message * @param array $args * @return string */ protected function replaceMessageToken($message, $args) { $n = count($args); $tokens = array(); for ($i = 0; $i < $n; ++$i) { $tokens['{' . $i . '}'] = (string) $args[$i]; } return strTr($message, $tokens); }
function gs_utf8_decompose_to_ascii($str) { static $map = null; if (!is_array($map)) { $map = _gs_utf8_get_map(); } $str = UtfNormal::toNFD(strTr($str, $map)); # return "safe" ASCII without control chars, newlines etc. //$str = preg_replace('/[^a-z0-9\-_. *#\'"!$()\/]/i', '', $str); $str = preg_replace('/[^\\x20-\\x7E]/', '', $str); return $str; }
function username_prep($user_name) { return strTr(trim($user_name), array('^' => '', '\\' => '', '>' => '', '<' => '', '\\`' => '', '\'' => '', '"' => '')); }
function converterCaracterPM($string) { $texto = ucwords(strtolower($string)); $filtro = array('Da ' => 'da ', 'Das ' => 'das ', 'De ' => 'de ', 'Dos ' => 'dos '); $txt_final = strTr($texto, $filtro); return $txt_final; }