forked from joomla/Component-Builder
Adapted the transliteration to use Joomla API
This commit is contained in:
parent
4fb4069d64
commit
39b276ac4b
@ -150,7 +150,7 @@ TODO
|
||||
+ *Version*: 2.10.1
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **253705**
|
||||
+ *Line count*: **253747**
|
||||
+ *Field count*: **1347**
|
||||
+ *File count*: **1618**
|
||||
+ *Folder count*: **261**
|
||||
|
@ -150,7 +150,7 @@ TODO
|
||||
+ *Version*: 2.10.1
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **253705**
|
||||
+ *Line count*: **253747**
|
||||
+ *Field count*: **1347**
|
||||
+ *File count*: **1618**
|
||||
+ *Folder count*: **261**
|
||||
|
@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
// 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;
|
||||
|
||||
@ -25,7 +25,13 @@ use Joomla\Utilities\ArrayHelper;
|
||||
* ###Component### component helper.
|
||||
*/
|
||||
abstract class ###Component###Helper
|
||||
{###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
{
|
||||
/**
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
@ -1068,6 +1074,8 @@ abstract class ###Component###Helper
|
||||
$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)
|
||||
{
|
||||
@ -1136,6 +1144,19 @@ abstract class ###Component###Helper
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function transliterate($string)
|
||||
{
|
||||
// set tag only once
|
||||
if (!self::checkString(self::$langTag))
|
||||
{
|
||||
// get global value
|
||||
self::$langTag = JComponentHelper::getParams('com_###component###')->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))
|
||||
|
@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
// 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;
|
||||
|
||||
@ -25,7 +25,13 @@ use Joomla\Utilities\ArrayHelper;
|
||||
* ###Component### component helper
|
||||
*/
|
||||
abstract class ###Component###Helper
|
||||
{###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
{
|
||||
/**
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
@ -1057,6 +1063,8 @@ abstract class ###Component###Helper
|
||||
$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)
|
||||
{
|
||||
@ -1125,6 +1133,19 @@ abstract class ###Component###Helper
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function transliterate($string)
|
||||
{
|
||||
// set tag only once
|
||||
if (!self::checkString(self::$langTag))
|
||||
{
|
||||
// get global value
|
||||
self::$langTag = JComponentHelper::getParams('com_###component###')->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))
|
||||
|
@ -805,8 +805,8 @@ class Get
|
||||
$this->minify = (isset($config['minify']) && $config['minify'] != 2) ? $config['minify'] : $this->params->get('minify', 0);
|
||||
// set the global language
|
||||
$this->langTag = $this->params->get('language', $this->langTag);
|
||||
// also set the helper calss langTag (for safe string)
|
||||
|
||||
// also set the helper class langTag (for safeStrings)
|
||||
ComponentbuilderHelper::$langTag = $this->langTag;
|
||||
// setup the main language array
|
||||
$this->languages[$this->langTag] = array();
|
||||
// check if we have Tidy enabled
|
||||
|
@ -6067,7 +6067,7 @@ class Interpretation extends Fields
|
||||
$fixUniqe[] = $this->_t(4) . "}";
|
||||
$fixUniqe[] = $this->_t(3) . "}";
|
||||
$fixUniqe[] = $this->_t(2) . "}";
|
||||
|
||||
|
||||
// $fixUniqe[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Update alias if still empty at this point";
|
||||
// $fixUniqe[] = $this->_t(2) . "if (\$data['" . $alias . "'] == null || empty(\$data['" . $alias . "']))";
|
||||
// $fixUniqe[] = $this->_t(2) . "{";
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user