| 1 |
<?php |
<?php |
| 2 |
// $Id: transliteration.module,v 1.1.6.2 2009/06/07 19:06:01 smk Exp $ |
// $Id: transliteration.module,v 1.1.6.3 2009/09/24 19:19:15 smk Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 10 |
*/ |
*/ |
| 11 |
|
|
| 12 |
/** |
/** |
| 13 |
* Transliterate UTF-8 input to plain ASCII. |
* Transliterate UTF-8 text to ASCII. |
| 14 |
* |
* |
| 15 |
* This function loads the required include file and returns the result of the |
* Takes an input string in any language and character set, and tries to |
| 16 |
* main function, transliteration_process(). |
* represent it in ASCII characters by conveying, in Roman letters, the |
| 17 |
|
* pronunciation expressed by the text in some other writing system. |
| 18 |
* |
* |
| 19 |
* @param string $input |
* @param $input |
| 20 |
* UTF-8 text input. |
* UTF-8 text input. |
| 21 |
* @param string $unknown |
* @param $unknown |
| 22 |
* Replacement for unknown characters and illegal UTF-8 sequences. |
* Replacement string for characters that do not have a suitable ASCII |
| 23 |
* @param string $locale |
* equivalent. |
| 24 |
* Optional ISO 639 language code used to import language specific |
* @param $locale |
| 25 |
* replacements. See data/x00.php for an example. Defaults to the |
* Optional ISO 639 language code that denotes the language of the input. |
| 26 |
* current locale. |
* Used to apply language-specific variations and defaults to the current |
| 27 |
* |
* display language. If transliteration takes place during output (instead |
| 28 |
* @return string |
* of creation) and the source language is not known at that time, it is |
| 29 |
* Plain ASCII output. |
* recommended to set this argument to 'en' to produce consistent results |
| 30 |
* @see transliteration_process() |
* for all enabled languages. |
| 31 |
|
* @return |
| 32 |
|
* Transliterated text. |
| 33 |
*/ |
*/ |
| 34 |
function transliteration_get($input, $unknown = '?', $locale = NULL) { |
function transliteration_get($input, $unknown = '?', $locale = NULL) { |
| 35 |
require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc'); |
require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc'); |
| 39 |
/** |
/** |
| 40 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
| 41 |
* |
* |
| 42 |
* Transliterate and clean the names of new uploaded files. |
* Transliterate and clean the names of files currently being uploaded. |
| 43 |
*/ |
*/ |
| 44 |
function transliteration_menu($may_cache) { |
function transliteration_menu($may_cache) { |
| 45 |
if (!$may_cache && !empty($_FILES['files'])) { |
if (!$may_cache && !empty($_FILES['files'])) { |