summaryrefslogtreecommitdiff
path: root/it_text.class
diff options
context:
space:
mode:
authorChristian Weber2008-05-06 15:32:26 +0000
committerChristian Weber2008-05-06 15:32:26 +0000
commit0df388c5566e315d5701aabc4e45e32f50a6ffdb (patch)
treef8e887fd509df54d9bb7d7d1ae46330e4a5a77c6 /it_text.class
parent6df42208f46913a65e3b4e099d678407b4f77bca (diff)
downloaditools-0df388c5566e315d5701aabc4e45e32f50a6ffdb.tar.gz
itools-0df388c5566e315d5701aabc4e45e32f50a6ffdb.tar.bz2
itools-0df388c5566e315d5701aabc4e45e32f50a6ffdb.zip
Never process the same texts.php twice
Diffstat (limited to 'it_text.class')
-rw-r--r--it_text.class12
1 files changed, 6 insertions, 6 deletions
diff --git a/it_text.class b/it_text.class
index e8e2c57..a8a4ad7 100644
--- a/it_text.class
+++ b/it_text.class
@@ -2,7 +2,7 @@
/*
** $Id$
**
-** Copyright (C) 1995-2007 by the ITools Authors.
+** Copyright (C) 1995-2008 by the ITools Authors.
** This file is part of ITools - the Internet Tools Library
**
** ITools is free software; you can redistribute it and/or modify
@@ -40,8 +40,8 @@ function it_text($p = array())
{
if (!$p['phpfile'])
{
- # Find texts.php in path (abs path in case we need to save)
- foreach (explode(PATH_SEPARATOR, ini_get('include_path')) as $dir)
+ # Find all texts.php in path (abs path in case we need to save)
+ foreach (array_unique(explode(PATH_SEPARATOR, ini_get('include_path'))) as $dir)
if (file_exists($phpfile = "$dir/texts.php"))
$p['phpfile'][] = $phpfile;
}
@@ -60,7 +60,7 @@ function it_text($p = array())
# Get array of supported languages and their names
$this->languages_available = (array)$this->statictext['_'];
- foreach($this->languages_available as $code => $languagename)
+ foreach ($this->languages_available as $code => $languagename)
{
# Only use a language in browser detection below if it's not disabled by a leading '-'
if (substr($languagename, 0, 1) != '-')
@@ -74,7 +74,7 @@ function it_text($p = array())
# Set our default language according to browser preference
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
- foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $code)
+ foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $code)
if ($this->initlang($code, "setting language from browser") || $this->initlang(substr($code, 0, 2), "setting language family from browser"))
break;
}
@@ -233,7 +233,7 @@ function dump_php()
# Special sorting: natural, but _ is the first entry
$keys = array_keys($this->statictext);
natsort($keys);
- foreach($keys as $key)
+ foreach ($keys as $key)
$text[$key] = $this->statictext[$key];
$this->statictext = array_merge(array('_' => $text['_']), $text);