summaryrefslogtreecommitdiff
path: root/it_text.class
diff options
context:
space:
mode:
authorUrban Müller2007-11-12 15:36:44 +0000
committerUrban Müller2007-11-12 15:36:44 +0000
commit0405634b4f18c0fe195a777b8b8706a2c865026f (patch)
tree44f349c5afdeee9e7b97749e6b0f215296148e2a /it_text.class
parent6236f2bd5dad4ced5038eadb83eac9692cf1f7b5 (diff)
downloaditools-0405634b4f18c0fe195a777b8b8706a2c865026f.tar.gz
itools-0405634b4f18c0fe195a777b8b8706a2c865026f.tar.bz2
itools-0405634b4f18c0fe195a777b8b8706a2c865026f.zip
use first it_texts in path, remove third text() param
Diffstat (limited to 'it_text.class')
-rw-r--r--it_text.class15
1 files changed, 9 insertions, 6 deletions
diff --git a/it_text.class b/it_text.class
index bab512e..2167f4e 100644
--- a/it_text.class
+++ b/it_text.class
@@ -29,15 +29,21 @@ class it_text
/**
* Constructor
+ * Example it_texts.php: <?php return array('_' => array('en'=>"English", 'de'=>"Deutsch"), 'edit'=>array('en'=>"Edit", 'de'=>("Editieren")));
* @param $p['cookiename'] optional cookie name (default: 'LANGUAGE')
* @param $p['debug'] optional debug mode: display label of unknown texts, set to 'label' to always display labels instead of actual text
* @param $p['fallbacklanguage'] optional language to use for undefined texts (useful for partially translated projects)
* @param $p['forcelanguage'] optional language to use instead of user's preferred language
- * @param $p['phpfile'] optional texts file, defaults to service's phpinclude/texts.php
+ * @param $p['phpfile'] optional texts file, defaults to first it_texts.php in include path
*/
function it_text($p = null)
{
- $this->p = (array)$p + array('cookiename' => 'LANGUAGE', 'debug' => false, 'phpfile' => $GLOBALS['ULTRAHOME'] . '/phpinclude/texts.php');
+ # Find it_texts.php in path (abs path in case we need to save)
+ foreach (explode(":", ini_get('include_path')) as $dir)
+ if (file_exists($phpfile = "$dir/it_texts.php") || file_exists($phpfile = "$dir/texts.php"))
+ break;
+
+ $this->p = (array)$p + array('cookiename' => 'LANGUAGE', 'phpfile' => $phpfile, 'debug' => (EDC('label') ? "label" : ""));
# Read $this->statictext from php file if it's not defined yet
if (!$this->statictext)
@@ -102,11 +108,8 @@ function init()
/**
* INTERNAL function for T(): : Return translated text in the selected language
*/
-function text($label, $language = null, $buggy = false)
+function text($label, $language = null)
{
- if ($buggy || (isset($language) && !is_string($language)))
- it::error('deprecated usage of it_text::text()');
-
if ($this->p['debug'] === 'label')
return $label;