transliterate.php
34 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikWP - Libraries |
| 4 | * @subpackage adapter.language |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | /** |
| 15 | * Class to transliterate strings. |
| 16 | * |
| 17 | * @since 10.0 |
| 18 | */ |
| 19 | class Transliterate |
| 20 | { |
| 21 | /** |
| 22 | * Returns strings transliterated from UTF-8 to Latin. |
| 23 | * |
| 24 | * @param string $string String to transliterate. |
| 25 | * @param integer $case Optionally specify upper or lower case. Default to null. |
| 26 | * |
| 27 | * @return string Transliterated string. |
| 28 | */ |
| 29 | public static function utf8_latin_to_ascii($string, $case = 0) |
| 30 | { |
| 31 | return sanitize_title($string); |
| 32 | } |
| 33 | } |
| 34 |