当前位置: 首页>>代码示例>>PHP>>正文


PHP transliterate函数代码示例

本文整理汇总了PHP中transliterate函数的典型用法代码示例。如果您正苦于以下问题:PHP transliterate函数的具体用法?PHP transliterate怎么用?PHP transliterate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了transliterate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forceDownload

/**
 * Return file as response
 * @param $filePath path of file to return
 * @param $fileName name of file to return
 */
function forceDownload($filePath, $fileName)
{
    header("Cache-Control: private");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=" . makeSafe(transliterate($fileName)));
    header("Content-Type: audio/mpeg");
    header("Content-length: " . filesize($filePath));
    readfile($filePath);
}
开发者ID:hbcbh1999,项目名称:music,代码行数:14,代码来源:download.php

示例2: filter

 /**
  * Transform value into machine readable
  * 
  * @param string $value
  * @return string
  */
 function filter($value)
 {
     if ($value == '' && isset($this->element->form->elements->name)) {
         $value = transliterate($this->element->form->elements->name->value);
     } else {
         $value = transliterate($value);
     }
     $value = strtolower($value);
     return $value;
 }
开发者ID:brussens,项目名称:cogear2,代码行数:16,代码来源:MachineName.php

示例3: CinemaNameByID

function CinemaNameByID($kinoid)
{
    global $tbl_cinemas;
    $q = "SELECT * FROM {$tbl_cinemas} WHERE ID={$kinoid}";
    $sqlres = mysql_query($q) or die(mysql_error() . " in SQL: {$q}");
    if (mysql_num_rows($sqlres) == 0) {
        return "";
    }
    $r = mysql_fetch_assoc($sqlres);
    mysql_free_result($sqlres);
    return stripslashes(transliterate($r['Cinema']));
}
开发者ID:kktsvetkov,项目名称:1double.com,代码行数:12,代码来源:kino-commons.php

示例4: filter

 public function filter($value)
 {
     if (function_exists('transliterate') && isset($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] == '192.168.0.10') {
         $filter[] = 'cyrillic_transliterate_bulgarian';
         $value = transliterate($value, $filter, 'utf-8', 'utf-8');
     }
     $value = strtolower(htmlentities($value, ENT_COMPAT, 'utf-8'));
     $value = preg_replace('/ß/', 'ss', $value);
     $value = preg_replace('/&(.)(uml);/', '$1e', $value);
     $value = preg_replace('/&(.)(acute|breve|caron|cedil|circ|dblac|die|dot|grave|macr|ogon|ring|tilde|uml);/', '$1', $value);
     $value = preg_replace('/([^a-z0-9\\-]+)/', '_', html_entity_decode($value));
     $value = trim($value, '_');
     return $value;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:14,代码来源:Ascii.php

示例5: filter

 /**
  * Filter
  *
  * @value
  */
 public function filter($value, $length = NULL)
 {
     // If field is empty
     if (!$value) {
         $value = cogear()->input->post('name');
     }
     // If even $_POST['name'] doesn't exist
     if (!$value) {
         return;
     }
     $value = transliterate($value);
     // Filter for all unsafe chars
     $value = preg_replace('#([^' . config('form.filter.uri.pattern', '\\w\\._-') . '])#', '-', $value);
     // Replace ----- with single - and trim - by sides
     $value = trim(preg_replace('#([-]{2,})#', '-', $value), '-');
     $length or $length = config('form.filter.uri.maxlength', 15);
     if ($length) {
         $value = substr($value, 0, $length);
     }
     return $value;
 }
开发者ID:brussens,项目名称:cogear2,代码行数:26,代码来源:Uri.php

示例6: transliterate

<?php

# транслитерация строк, можно поугарать с выводом
function transliterate($st)
{
    $st = strtr($st, "абвгдежзийклмнопрстуфыэАБВГДЕЖЗИЙКЛМНОПРСТУФЫЭ", "abvgdegziyklmnoprstufieABVGDEGZIYKLMNOPRSTUFIE");
    $st = strtr($st, array('ё' => "yo", 'х' => "h", 'ц' => "ts", 'ч' => "ch", 'ш' => "sh", 'щ' => "shch", 'ъ' => "", 'ь' => "", 'ю' => "yu", 'я' => "ya", 'Ё' => "Yo", 'Х' => "H", 'Ц' => "Ts", 'Ч' => "Ch", 'Ш' => "Sh", 'Щ' => "Shch", 'Ъ' => "", 'Ь' => "", 'Ю' => "Yu", 'Я' => "Ya"));
    return $st;
}
echo transliterate("Шмисечка!!! Я тебя люблю!!!");
开发者ID:ashikov,项目名称:book,代码行数:10,代码来源:translit.php

示例7: file_get_html

$html = file_get_html("http://dynamo.kiev.ua/comp/ukraine/table/");
//Ищем названия клубов + общее количество очков.Сохраняем в массив
foreach ($html->find("tbody tr") as $tr) {
    //Текущие очки
    $point = $tr->find("td", 7)->plaintext;
    //Название клуба
    foreach ($tr->find(".table-championship__link strong") as $i) {
        $teams[transliterate($i->plaintext)]["name"] = $i->plaintext;
        $teams[transliterate($i->plaintext)]["point"] = $point;
    }
}
//Ищем превью.Сохраняем файлы и ссылки.
foreach ($html->find(".table-championship__img img") as $i) {
    $path = "img/" . transliterate($i->alt) . ".png";
    $url = "http://dynamo.kiev.ua/" . $i->src;
    file_put_contents($path, file_get_contents($url));
    $links_for_teams_preview[transliterate($i->alt)] = $path;
}
//Результаты последнего тура
for ($i = 0; $i < 7; $i++) {
    //Парсим "хозяев","гостей" и итоговый счет.
    $master = $html->find(".tour ul li .left strong", $i);
    $guest = $html->find(".tour ul li .right strong", $i);
    $count = $html->find(".tour ul li .count", $i);
    $last_tour_results[$i]["master"] = transliterate($master->plaintext);
    $last_tour_results[$i]["guest"] = transliterate($guest->plaintext);
    $last_tour_results[$i]["count"] = trim($count->plaintext);
}
//Очищаем память
$html->clear();
unset($html);
开发者ID:HungryJunior,项目名称:Parser_FPL_Ukraine,代码行数:31,代码来源:parser.inc.php

示例8: create_menu

 /**
  * Создание меню
  * @param $data array - $_POST массив с параметрами
  * @return string
  */
 public function create_menu($data)
 {
     //Создание имени шаблона
     $tpl_name = strtolower(transliterate($data['menu_name']));
     $tpl_name = str_replace(array(' ', '-', ',', '.'), '_', $tpl_name);
     $tpl_file = 'application/views/templates/menus/' . $tpl_name . '.tpl';
     if (file_exists($tpl_file)) {
         $tpl_file = 'application/views/templates/menus/' . $tpl_name . '_' . time() . '.tpl';
     }
     switch ($data['typeMenu']) {
         case "1":
             $type_menu = 'tabs';
             //     $menu_content = $this->create_tab_menu_tpl($data, $tpl_name, $tpl_file);
             $menu_content = $this->create_tab_menu_tpl($data, $tpl_name);
             break;
         case "2":
             $type_menu = 'pills';
             //     $menu_content = $this->create_pills_menu_tpl($data, $tpl_name, $tpl_file);
             $menu_content = $this->create_pills_menu_tpl($data, $tpl_name);
             break;
         default:
             exit("Не определен тип меню");
     }
     $handle = fopen($tpl_file, "w");
     fwrite($handle, $menu_content);
     fclose($handle);
     //Запись в БД
     $params = array('name_menu' => $data['menu_name'], 'type_menu' => $type_menu, 'class_menu' => $data['menu_class'], 'tpl_file' => $tpl_file);
     $menu_id = $this->db->sql_execute($this->sql_create_menu, $params);
     if (!$menu_id) {
         exit('Не удалось создать меню');
     }
     foreach ($data['sections'] as $item) {
         $params = array('fid_menu' => $menu_id, 'name_section' => $item['section_name'], 'fid_record' => $item['fid_record'], 'sort_section' => $item['section_sort'], 'fid_rt' => $item['request_type'], 'html_id' => $item['html_id']);
         $result = $this->db->sql_execute($this->sql_create_section, $params);
         if (!$result) {
             exit('Не удалось создать раздел');
         }
     }
     return true;
 }
开发者ID:iScepsis,项目名称:flippy,代码行数:46,代码来源:model_admintools.php

示例9: setGlobal

        }
    }
}
if ($user['LINKED_OBJECT'] && !$location_found) {
    setGlobal($user['LINKED_OBJECT'] . '.seenAt', '');
}
$sqlQuery = "SELECT *, DATE_FORMAT(ADDED, '%H:%i') as DAT\n               FROM shouts\n              ORDER BY ADDED DESC\n              LIMIT 1";
$tmp = SQLSelectOne($sqlQuery);
if (!headers_sent()) {
    header("HTTP/1.0: 200 OK\n");
    header('Content-Type: text/html; charset=utf-8');
}
if (defined('BTRACED')) {
    echo "OK";
} elseif ($tmp['MESSAGE'] != '') {
    echo ' ' . $tmp['DAT'] . ' ' . transliterate($tmp['MESSAGE']);
}
// closing database connection
$db->Disconnect();
endMeasure('TOTAL');
// end calculation of execution time
/**
 * Calculate distance between two GPS coordinates
 * @param mixed $latA First coord latitude
 * @param mixed $lonA First coord longitude
 * @param mixed $latB Second coord latitude
 * @param mixed $lonB Second coord longitude
 * @return double
 */
function calculateTheDistance($latA, $lonA, $latB, $lonB)
{
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:gps.php

示例10: unset

        }
        if ($_SESSION['tgt'] == "oriya") {
            unset($_SESSION['yayya']);
            unset($_SESSION['wava']);
        }
        if ($_SESSION['tgt'] == "assamese") {
            unset($_SESSION['aconyab']);
        }
    }
}
$op = "";
// Echo output is buffered into this variable
// do missing case scenarious
require "./diCrunch/diCrunch_charsets.php";
require "./diCrunch/diCrunch_preprocess.php";
$text = transliterate($text, $_SESSION['src'], $_SESSION['tgt']);
// Transliterate the Inputbox Text
$langtag = array('tamil' => 'dtamil', 'iast' => 'unicode', 'iso' => 'unicode2', 'harvard-kyoto' => 'hk');
foreach ($langtag as $collang => $syslang) {
    if ($_SESSION['src'] == $syslang) {
        $_SESSION['src'] = $collang;
    }
    if ($_SESSION['tgt'] == $syslang) {
        $_SESSION['tgt'] = $collang;
    }
}
$XML = <<<CWS
<?xml version="1.0" encoding="utf-8" ?>
<data>
<source script="{$_SESSION['src']}">{$tmp}</source>
<target script="{$_SESSION['tgt']}">{$text}</target>
开发者ID:jiva-institute,项目名称:aksharamukha,代码行数:31,代码来源:apioutput.php

示例11: to_ascii

/**
 * Transliterates non ASCII chars to ASCII.
 * This is an approximation.
 *
 * Note: Performance and accuracy is gained if the pecl translit extension is available.
 * @see http://pecl.php.net/package/translit
 *
 * @param	string String to transliterate
 * @return	string
 */
function to_ascii($str)
{
	if (!$str)
    {
    	return;
    }

    if (function_exists('transliterate'))
    {
    	return transliterate($str, array('normalize_ligature'), 'ISO-8859-1', 'ISO-8859-1');
    }

	static $lookup = array(
		'&Agrave;' => 'A',
		'&Aacute;' => 'A',
		'&Acirc;' => 'A',
		'&Atilde;' => 'A',
		'&Auml;' => 'AE',
		'&Aring;' => 'A',
		'&AElig;' => 'AE',
		'&Ccedil;' => 'C',
		'&Egrave;' => 'E',
		'&Eacute;' => 'E',
		'&Ecirc;' => 'E',
		'&Euml;' => 'E',
		'&Igrave;' => 'I',
		'&Iacute;' => 'I',
		'&Icirc;' => 'I',
		'&Iuml;' => 'I',
		'&ETH;' => 'Dj',
		'&Ntilde;' => 'N',
		'&Ograve;' => 'O',
		'&Oacute;' => 'O',
		'&Ocirc;' => 'O',
		'&Otilde;' => 'O',
		'&Ouml;' => 'OE',
		'&Oslash;' => 'U',
		'&Ugrave;' => 'U',
		'&Uacute;' => 'U',
		'&Ucirc;' => 'U',
		'&Uuml;' => 'UE',
		'&Yacute;' => 'Y',
		'&THORN;' => 'Th',
		'&szlig;' => 'ss',
		'&agrave;' => 'a',
		'&aacute;' => 'a',
		'&acirc;' => 'a',
		'&atilde;' => 'a',
		'&auml;' => 'ae',
		'&aring;' => 'a',
		'&aelig;' => 'ae',
		'&ccedil;' => 'c',
		'&egrave;' => 'e',
		'&eacute;' => 'e',
		'&ecirc;' => 'e',
		'&euml;' => 'e',
		'&igrave;' => 'i',
		'&iacute;' => 'i',
		'&icirc;' => 'i',
		'&iuml;' => 'i',
		'&eth;' => 'dj',
		'&ntilde;' => 'n',
		'&ograve;' => 'o',
		'&oacute;' => 'o',
		'&ocirc;' => 'o',
		'&otilde;' => 'o',
		'&ouml;' => 'oe',
		'&oslash;' => 'o',
		'&ugrave;' => 'u',
		'&uacute;' => 'u',
		'&ucirc;' => 'u',
		'&uuml;' => 'ue',
		'&yacute;' => 'y',
		'&thorn;' => 'th',
		'&yuml;' => 'y'
	);

    $str = htmlentities($str);
    $str = str_replace(array_keys($lookup), array_values($lookup), $str);
    $str = html_entity_decode($str);
    $str = preg_replace('#[^a-z0-9]+#i', '-', $str);

    return $str;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:94,代码来源:functions.php

示例12: get_available_tags

$template->assign('display_mode', $page['display_mode']);
// find all tags available for the current user
$tags = get_available_tags();
// +-----------------------------------------------------------------------+
// |                       letter groups construction                      |
// +-----------------------------------------------------------------------+
if ($page['display_mode'] == 'letters') {
    // we want tags diplayed in alphabetic order
    usort($tags, 'tag_alpha_compare');
    $current_letter = null;
    $nb_tags = count($tags);
    $current_column = 1;
    $current_tag_idx = 0;
    $letter = array('tags' => array());
    foreach ($tags as $tag) {
        $tag_letter = mb_strtoupper(mb_substr(transliterate($tag['name']), 0, 1, PWG_CHARSET), PWG_CHARSET);
        if ($current_tag_idx == 0) {
            $current_letter = $tag_letter;
            $letter['TITLE'] = $tag_letter;
        }
        //lettre precedente differente de la lettre suivante
        if ($tag_letter !== $current_letter) {
            if ($current_column < $conf['tag_letters_column_number'] and $current_tag_idx > $current_column * $nb_tags / $conf['tag_letters_column_number']) {
                $letter['CHANGE_COLUMN'] = true;
                $current_column++;
            }
            $letter['TITLE'] = $current_letter;
            $template->append('letters', $letter);
            $current_letter = $tag_letter;
            $letter = array('tags' => array());
        }
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:tags.php

示例13: setcookie

        exit;
    }
    //*/
}
setcookie("kinobg-grad", $grad);
setcookie("kinobg-izbrangrad", "");
setcookie("kinobg-kino", "");
$_SESSION['grad'] = $grad;
$sqlres = mysql_query("SELECT * FROM {$tbl_cinemas} WHERE CityID={$grad} ORDER BY Priority ") or die(mysql_error());
echo "<?xml version=\"1.0\"?>\n<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";
echo "<wml>\n";
$gradname = CityNameByID($grad);
echo "<template>Izbor na kino</template>\n";
echo "<card id=\"kina\" title=\"{$gradname}\">\n";
////echo '<do type="accept" label="izberi"><go href="filmi.php"><postfield name="kino" value="$(kino)"/></go></do>';
echo "<p>{$template_header} <br/>\n <a href=\"{$page_grad}?grad={$grad}\">promiana grad</a></p>\n";
echo "<p>\n";
echo "<b>Izberete kino:</b>\n";
echo "<select name=\"kino\" ivalue=\"0\">\n";
//echo "<postfield name=\"kino\" value=$(kino)/>\n";
while ($r = mysql_fetch_assoc($sqlres)) {
    $kinoid = $r['ID'];
    if (NumberOfMovies($kinoid) > 0) {
        echo "<option value=\"" . $kinoid . "\" onpick=\"filmi.php?kino=\$(kino)\">" . stripslashes(transliterate($r['Cinema'])) . "</option>\n";
    }
}
echo "</select>\n";
//*/
echo "</p>\n";
echo "</card>\n";
echo "</wml>";
开发者ID:kktsvetkov,项目名称:1double.com,代码行数:31,代码来源:kino.php

示例14: transliterate

 /**
  * Transliterates characters in a given string where possible.
  *
  * @param string $string      String containing characters to
  *        transliterate
  * @param string $charsetFrom Optional character set of the string,
  *        defaults to UTF-8
  * @param string $charsetTo   Optional character set to which the string
  *        should be converted, defaults to ISO-8859-1
  *
  * @return string String with characters transliterated or the original
  *         string if transliteration was not possible
  */
 public function transliterate($string, $charsetFrom = 'UTF-8', $charsetTo = 'ISO-8859-1')
 {
     // @link http://pecl.php.net/package/translit
     if (function_exists('transliterate')) {
         $string = transliterate($string, array('han_transliterate', 'diacritical_remove'), $charsetFrom, $charsetTo);
     } elseif (function_exists('iconv')) {
         $string = iconv($charsetFrom, $charsetTo . '//TRANSLIT', $string);
     } else {
         // @link http://stackoverflow.com/questions/1284535/php-transliteration/1285491#1285491
         $string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_COMPAT, $charsetFrom));
     }
     return $string;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:26,代码来源:Encoding.php

示例15: mysql_free_result

    //$film = $agendaid;
}
mysql_free_result($sqlFilm);
//$film = transliterate($r['Cinema']);
echo "<card title='Kino: {$kinoname}'>";
echo "<p>{$template_header} <br/> <a href='kino.php?grad={$grad}'>izbor kina</a></p>";
echo "<p>";
if (!isset($sqlres) || mysql_num_rows($sqlres) == 0) {
    //no movies this week :)
    var_dump($_REQUEST);
    echo "Niama informacia za filma v momenta. Molia, opitajte po-kysno.";
} else {
    echo "Film: {$film}</p><p>";
    echo "Ot data: {$from}</p><p>";
    $r = mysql_fetch_assoc($sqlres);
    echo transliterate($r['Agenda']);
    /*echo '<do type="accept" label="izberi">';
       echo '<go href="film.php"><postfield name="" value="$(film)"/></go>';
       echo '</do>';
    
       echo "Izberete film:";
       echo "<select name=\"film\" ivalue=\"0\">";
    
       echo "<option value='0' selected='selected'>-Izbor kina-</option>";
       
       while( $r = mysql_fetch_assoc($sqlres) )
       {
          //var_dump($r);
          if($r['Type']=='list')
          {
             //var_dump($r);
开发者ID:kktsvetkov,项目名称:1double.com,代码行数:31,代码来源:film.php


注:本文中的transliterate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。