From 0df388c5566e315d5701aabc4e45e32f50a6ffdb Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Tue, 6 May 2008 15:32:26 +0000 Subject: Never process the same texts.php twice --- it_text.class | 12 ++++++------ 1 file 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); -- cgit v1.2.3