diff options
author | Urban Müller | 2009-11-02 14:39:08 +0000 |
---|---|---|
committer | Urban Müller | 2009-11-02 14:39:08 +0000 |
commit | d8da0d3bca055c67ca0824fb0ed76bbae7cc10dc (patch) | |
tree | 6a5abd12f9fa6844261e498abe9775724552a20d | |
parent | ae41ee060447e76a2774ca718ddf91adbac7be4a (diff) | |
download | itools-d8da0d3bca055c67ca0824fb0ed76bbae7cc10dc.tar.gz itools-d8da0d3bca055c67ca0824fb0ed76bbae7cc10dc.tar.bz2 itools-d8da0d3bca055c67ca0824fb0ed76bbae7cc10dc.zip |
sample usage of labels
-rw-r--r-- | it_text.class | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/it_text.class b/it_text.class index c82c750..1334c88 100644 --- a/it_text.class +++ b/it_text.class @@ -87,6 +87,10 @@ function it_text($p = array()) $this->initlang(it::match('\.([a-z]{2})\.[^./]+$', $_SERVER['PHP_SELF']), "setting language from url override"); $this->initlang($p['forcelanguage'], "setting language from programmer override"); + # Sample usage of text labels + if (!it::is_live() || rand(1, 100) == 1) + $GLOBALS['it_text_sampling'] = array(); + # Make this object available under $GLOBALS['it_text'], or add my texts to $GLOBALS['it_text'] if it exists if ($p['global']) { @@ -141,6 +145,9 @@ function text($label, $language = null) if ($GLOBALS['debug_texts'] && !preg_match('/submit|reset|button|_search$|service|claim/i', $label)) $text = "<span style='background:#8F8' title='$label (" . it_debug::backtrace(array('levels'=>1, 'skipfiles'=>"text|auto_prepend")) . ")'>" . ($text ? $text : $label) . "</span>"; + if (isset($GLOBALS['it_text_sampling'])) + $GLOBALS['it_text_sampling'][$label] = true; + return $text; } |