Update classes/text.php
This commit is contained in:
@@ -11,7 +11,6 @@ class text {
|
|||||||
* Called when the object is created
|
* Called when the object is created
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
//get the list of languages that are available
|
|
||||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) {
|
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) {
|
||||||
include("app/translate/translate_include.php");
|
include("app/translate/translate_include.php");
|
||||||
}
|
}
|
||||||
@@ -29,27 +28,33 @@ class text {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a specific item from the cache
|
* Get a specific item from the cache
|
||||||
* @var string $path examples: app/exec or core/domains
|
* @var string $language_code examples: en-us, es-cl, fr-fr, pt-pt
|
||||||
|
* @var string $app_path examples: app/exec or core/domains
|
||||||
*/
|
*/
|
||||||
public function get($path) {
|
public function get($language_code = null, $app_path = null) {
|
||||||
//get the app_languages.php
|
//get the app_languages.php
|
||||||
if (strlen($path) > 0) {
|
if (isset($app_path)) {
|
||||||
require_once glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/".$path."/app_{languages}.php",GLOB_BRACE);
|
require_once glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/".$app_path."/app_{languages}.php",GLOB_BRACE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
require_once getcwd().'/app_languages.php';
|
require_once getcwd().'/app_languages.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
foreach($text as $key => $value) {
|
if ($language_code != 'all') {
|
||||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
foreach($text as $key => $value) {
|
||||||
|
if ($language_code == null) {
|
||||||
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$text[$key] = $value[$language_code];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the array of translations
|
//return the array of translations
|
||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user