本文整理匯總了PHP中dmString::transliterate方法的典型用法代碼示例。如果您正苦於以下問題:PHP dmString::transliterate方法的具體用法?PHP dmString::transliterate怎麽用?PHP dmString::transliterate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dmString
的用法示例。
在下文中一共展示了dmString::transliterate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sanitizeDirName
public static function sanitizeDirName($dirName)
{
return trim(preg_replace('/[^\w\._-]+/i', '-', dmString::transliterate($dirName)), '-');
}
示例2: cleanText
public static function cleanText($text)
{
return trim(preg_replace('|\\s{2,}|', ' ', preg_replace('|\\W|', ' ', dmString::strtolower(dmString::transliterate(strip_tags(str_replace(array("\n", '<'), array(' ', ' <'), $text)))))));
}
示例3: dirname
<?php
require_once dirname(__FILE__) . '/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot();
$t = new lime_test(21);
$helper->get('i18n')->loadTransliterationStrings(array('en', 'ru'));
$tests = array('en' => array('test' => 'test', 'tèst' => 'test', 'test... /[)=' => 'test... /[)=', 'tèst' => 'test', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ð' => 'D', 'œÐú' => 'oeDu', 'ж' => 'zh'), 'ru' => array('test' => 'test', 'tèst' => 'test', 'test... /[)=' => 'test... /[)=', 'tèst' => 'test', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ð' => 'D', 'œÐú' => 'oeDu', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y'));
foreach ($tests as $culture => $strings) {
$helper->get('user')->setCulture($culture);
$t->comment('Current culture is ' . $culture);
foreach ($strings as $source => $target) {
$t->is(dmString::transliterate($source), $target, 'dmString::transliterate("' . $source . '") -> ' . $target);
}
}