Refbase update_2021-01-28_15_58
This commit is contained in:
41
locales/core.php
Normal file
41
locales/core.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// Project: Web Reference Database (refbase) <http://www.refbase.net>
|
||||
// Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
|
||||
// original author(s).
|
||||
//
|
||||
// This code is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY. Please see the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// File: ./locales/core.php
|
||||
// Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/locales/core.php $
|
||||
// Author(s): Jochen Wendebaum <mailto:wendebaum@users.sourceforge.net>
|
||||
//
|
||||
// Created: 01-Oct-04, 12:00
|
||||
// Modified: $Date: 2007-02-17 01:10:14 +0000 (Sat, 17 Feb 2007) $
|
||||
// $Author: msteffens $
|
||||
// $Revision: 894 $
|
||||
|
||||
|
||||
// Get filename:
|
||||
if ($contentTypeCharset == "UTF-8") // variable '$contentTypeCharset' is defined in 'ini.inc.php'
|
||||
$f = "locales/".$locale."/common_utf8.inc";
|
||||
else
|
||||
$f = "locales/".$locale."/common.inc";
|
||||
|
||||
// Get locales:
|
||||
ob_start();
|
||||
readfile( $f ); // read the file contents
|
||||
$s = "\$loc=array(".ob_get_contents().");";
|
||||
eval( $s ); // ...and store everything into $loc
|
||||
ob_end_clean();
|
||||
|
||||
// HTML encode higher ASCII characters in locales:
|
||||
foreach ($loc as $locKey => $locValue)
|
||||
{
|
||||
$loc[$locKey] = encodeHTML($locValue); // function 'encodeHTML()' is defined in 'include.inc.php'
|
||||
|
||||
if (preg_match("/<a href=".+?">.+?<\/a>/", $loc[$locKey])) // dirty hack to allow URLs within (otherwise HTML encoded) locales
|
||||
$loc[$locKey] = preg_replace("/<a href="(.+?)">(.+?)<\/a>/", "<a href=\"\\1\">\\2</a>", $loc[$locKey]);
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user