|
@@ -5,7 +5,7 @@
|
|
// Yellow main class
|
|
// Yellow main class
|
|
class Yellow
|
|
class Yellow
|
|
{
|
|
{
|
|
- const Version = "0.4.18";
|
|
|
|
|
|
+ const Version = "0.4.19";
|
|
var $page; //current page
|
|
var $page; //current page
|
|
var $pages; //pages from file system
|
|
var $pages; //pages from file system
|
|
var $config; //configuration
|
|
var $config; //configuration
|
|
@@ -168,6 +168,10 @@ class Yellow
|
|
{
|
|
{
|
|
$this->page->error(500, "Theme '".$this->page->get("theme")."' does not exist!");
|
|
$this->page->error(500, "Theme '".$this->page->get("theme")."' does not exist!");
|
|
}
|
|
}
|
|
|
|
+ if(!$this->text->isLanguage($this->page->get("language")))
|
|
|
|
+ {
|
|
|
|
+ $this->page->error(500, "Language '".$this->page->get("language")."' does not exist!");
|
|
|
|
+ }
|
|
if(!is_object($this->page->parser))
|
|
if(!is_object($this->page->parser))
|
|
{
|
|
{
|
|
$this->page->error(500, "Parser '".$this->page->get("parser")."' does not exist!");
|
|
$this->page->error(500, "Parser '".$this->page->get("parser")."' does not exist!");
|
|
@@ -1238,7 +1242,7 @@ class YellowText
|
|
// Return text string for specific language
|
|
// Return text string for specific language
|
|
function getText($key, $language)
|
|
function getText($key, $language)
|
|
{
|
|
{
|
|
- return ($this->isText($key, $language)) ? $this->text[$language][$key] : "[$key]";
|
|
|
|
|
|
+ return $this->isExisting($key, $language) ? $this->text[$language][$key] : "[$key]";
|
|
}
|
|
}
|
|
|
|
|
|
// Return text string for specific language, HTML encoded
|
|
// Return text string for specific language, HTML encoded
|
|
@@ -1250,13 +1254,13 @@ class YellowText
|
|
// Return text string
|
|
// Return text string
|
|
function get($key)
|
|
function get($key)
|
|
{
|
|
{
|
|
- return $this->isExisting($key) ? $this->text[$this->language][$key] : "[$key]";
|
|
|
|
|
|
+ return $this->getText($key, $this->language);
|
|
}
|
|
}
|
|
|
|
|
|
// Return text string, HTML encoded
|
|
// Return text string, HTML encoded
|
|
function getHtml($key)
|
|
function getHtml($key)
|
|
{
|
|
{
|
|
- return htmlspecialchars($this->get($key));
|
|
|
|
|
|
+ return htmlspecialchars($this->getText($key, $this->language));
|
|
}
|
|
}
|
|
|
|
|
|
// Return text strings
|
|
// Return text strings
|
|
@@ -1264,7 +1268,7 @@ class YellowText
|
|
{
|
|
{
|
|
$text = array();
|
|
$text = array();
|
|
if(empty($language)) $language = $this->language;
|
|
if(empty($language)) $language = $this->language;
|
|
- if(!is_null($this->text[$language]))
|
|
|
|
|
|
+ if($this->isLanguage($language))
|
|
{
|
|
{
|
|
if(empty($filterStart))
|
|
if(empty($filterStart))
|
|
{
|
|
{
|
|
@@ -1285,17 +1289,18 @@ class YellowText
|
|
{
|
|
{
|
|
return $httpFormat ? $this->yellow->toolbox->getHttpTimeFormatted($this->modified) : $this->modified;
|
|
return $httpFormat ? $this->yellow->toolbox->getHttpTimeFormatted($this->modified) : $this->modified;
|
|
}
|
|
}
|
|
-
|
|
|
|
- // Check if text string for specific language exists
|
|
|
|
- function isText($key, $language)
|
|
|
|
|
|
+
|
|
|
|
+ // Check if language exists
|
|
|
|
+ function isLanguage($language)
|
|
{
|
|
{
|
|
- return !is_null($this->text[$language]) && !is_null($this->text[$language][$key]);
|
|
|
|
|
|
+ return !is_null($this->text[$language]);
|
|
}
|
|
}
|
|
|
|
|
|
// Check if text string exists
|
|
// Check if text string exists
|
|
- function isExisting($key)
|
|
|
|
|
|
+ function isExisting($key, $language = "")
|
|
{
|
|
{
|
|
- return !is_null($this->text[$this->language]) && !is_null($this->text[$this->language][$key]);
|
|
|
|
|
|
+ if(empty($language)) $language = $this->language;
|
|
|
|
+ return !is_null($this->text[$language]) && !is_null($this->text[$language][$key]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|