Adapted the transliteration to use Joomla API
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Language\Language;
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
@ -20,7 +20,13 @@ use Joomla\Utilities\ArrayHelper;
|
||||
* Componentbuilder component helper
|
||||
*/
|
||||
abstract class ComponentbuilderHelper
|
||||
{
|
||||
{
|
||||
/**
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $langTag;
|
||||
|
||||
/**
|
||||
* The Global Site Event Method.
|
||||
@ -6597,6 +6603,8 @@ abstract class ComponentbuilderHelper
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
// Transliterate string
|
||||
$string = self::transliterate($string);
|
||||
// remove all and keep only characters
|
||||
if ($keepOnlyCharacters)
|
||||
{
|
||||
@ -6665,6 +6673,19 @@ abstract class ComponentbuilderHelper
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function transliterate($string)
|
||||
{
|
||||
// set tag only once
|
||||
if (!self::checkString(self::$langTag))
|
||||
{
|
||||
// get global value
|
||||
self::$langTag = JComponentHelper::getParams('com_componentbuilder')->get('language', 'en-GB');
|
||||
}
|
||||
// Transliterate on the language requested
|
||||
$lang = Language::getInstance(self::$langTag);
|
||||
return $lang->transliterate($string);
|
||||
}
|
||||
|
||||
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
||||
{
|
||||
if (self::checkString($var))
|
||||
|
Reference in New Issue
Block a user