diff options
Diffstat (limited to 'it_text.class')
-rw-r--r-- | it_text.class | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/it_text.class b/it_text.class index e45b7d4..1ff7a51 100644 --- a/it_text.class +++ b/it_text.class @@ -24,6 +24,7 @@ class it_text var $languages = array(); # Active languages var $languages_available = array(); # Available languages var $statictext = array(); # Text array, read from php file on init + var $label_to_service = array(); # which label belongs to which service - only used for debug parameter texts /** * Constructor @@ -55,7 +56,14 @@ function it_text($p = array()) { $oldtext = $this->statictext; if (is_array($ret = include($phpfile))) + { $this->statictext += $ret; + if ($GLOBALS['debug_texts']) + { + $service = strpos($phpfile, $GLOBALS['ULTRAHOME']) !== false ? '' : it::match('/www/([^/.]+)', $phpfile); + $this->label_to_service += array_combine(array_keys($ret), array_fill(0, count($ret), $service)); + } + } else $this->statictext = $oldtext + $this->statictext; # FIXME: compatibility mode } @@ -125,7 +133,7 @@ static function init() * INTERNAL function for T(): : Return translated text in the selected language */ function text($label, $language = null) -{ +{ if (!$language) $language = $this->actlanguage; @@ -141,7 +149,13 @@ function text($label, $language = null) } if ($GLOBALS['debug_texts'] && !preg_match('/submit|button|servicedomain/i', $label) && (!$_GET['it_texts_mark'] || $label == $_GET['it_texts_mark'])) - $text = "<span style='background:#8F8' title='$label (" . it_debug::backtrace(array('levels'=>1, 'skipfiles'=>"text|auto_prepend")) . ")'>" . ($text ? $text : $label) . "</span><a href='/admin.html?edit=$label'>.</a>"; + { + $host = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . preg_replace('/\.texts/', '', $_SERVER['HTTP_HOST']); + if ($service = $this->label_to_service[$label]) + $host = preg_replace('#//(admin\.)?[^.]*\.#', "//$service.", $host); + + $text = "<span style='background:#8F8' title='$label (" . it_debug::backtrace(array('levels'=>1, 'skipfiles'=>"text|auto_prepend")) . ")'>" . ($text ? $text : $label) . "</span><a href='$host/admin.html?edit=$label'>.</a>"; + } if (isset($GLOBALS['it_text_sampling'])) $GLOBALS['it_text_sampling'][$label] = true; |