summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Helbling2015-02-12 17:09:24 +0100
committerChristian Helbling2015-02-12 17:13:56 +0100
commit892620f635ce205f36aa40fa6d8860f6032ab3d7 (patch)
treebc897d7d14f6065e1daa365866d9315f8bed03f6
parent8e585d427b62ed1ec4c128550de0e0b6e7b3a5fa (diff)
downloaditools-892620f635ce205f36aa40fa6d8860f6032ab3d7.tar.gz
itools-892620f635ce205f36aa40fa6d8860f6032ab3d7.tar.bz2
itools-892620f635ce205f36aa40fa6d8860f6032ab3d7.zip
make sure links to text-editor (using debug param texts) point to lib for labels defined in lib
-rw-r--r--it_text.class18
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;