You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.6 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./locales/core.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/locales/core.php $
  12. // Author(s): Jochen Wendebaum <mailto:wendebaum@users.sourceforge.net>
  13. //
  14. // Created: 01-Oct-04, 12:00
  15. // Modified: $Date: 2007-02-17 01:10:14 +0000 (Sat, 17 Feb 2007) $
  16. // $Author: msteffens $
  17. // $Revision: 894 $
  18. // Get filename:
  19. if ($contentTypeCharset == "UTF-8") // variable '$contentTypeCharset' is defined in 'ini.inc.php'
  20. $f = "locales/".$locale."/common_utf8.inc";
  21. else
  22. $f = "locales/".$locale."/common.inc";
  23. // Get locales:
  24. ob_start();
  25. readfile( $f ); // read the file contents
  26. $s = "\$loc=array(".ob_get_contents().");";
  27. eval( $s ); // ...and store everything into $loc
  28. ob_end_clean();
  29. // HTML encode higher ASCII characters in locales:
  30. foreach ($loc as $locKey => $locValue)
  31. {
  32. $loc[$locKey] = encodeHTML($locValue); // function 'encodeHTML()' is defined in 'include.inc.php'
  33. if (preg_match("/&lt;a href=&quot;.+?&quot;&gt;.+?&lt;\/a&gt;/", $loc[$locKey])) // dirty hack to allow URLs within (otherwise HTML encoded) locales
  34. $loc[$locKey] = preg_replace("/&lt;a href=&quot;(.+?)&quot;&gt;(.+?)&lt;\/a&gt;/", "<a href=\"\\1\">\\2</a>", $loc[$locKey]);
  35. }
  36. ?>