cvs: docweb /include docweb_language.class.php /templates/all/www credits.tpl.php

From: Date: Wed, 26 Jan 2005 13:38:34 +0000
Subject: cvs: docweb /include docweb_language.class.php /templates/all/www credits.tpl.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-578@lists.php.net to get a copy of this message
nlopess Wed Jan 26 08:38:34 2005 EDT Modified files: /docweb/include docweb_language.class.php /docweb/templates/all/www credits.tpl.php Log: convert all entitites to UTF-8 credit: sort names and add mine http://cvs.php.net/diff.php/docweb/include/docweb_language.class.php?r1=1.5&r2=1.6&ty=u Index: docweb/include/docweb_language.class.php diff -u docweb/include/docweb_language.class.php:1.5 docweb/include/docweb_language.class.php:1.6 --- docweb/include/docweb_language.class.php:1.5 Fri Jan 21 11:40:42 2005 +++ docweb/include/docweb_language.class.php Wed Jan 26 08:38:33 2005 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: docweb_language.class.php,v 1.5 2005/01/21 16:40:42 nlopess Exp $ +$Id: docweb_language.class.php,v 1.6 2005/01/26 13:38:33 nlopess Exp $ */ /** @@ -84,25 +84,29 @@ if (!$lang) { $lang = $this->lang; } - + // use this file: $entFile = CVS_DIR ."/phpdoc-all/$lang/docweb/main.ent"; - + if (is_readable($entFile)) { // file is good; get its contents $entData = file_get_contents($entFile); - + + // try to find the encoding of the file + preg_match('/<?.*encoding\s*=\s*["\']([^"\']+)["\'].*?>/', $entData, $matches); + $charset = isset($matches[1]) ? $matches[1] : 'UTF-8'; + // find entities in the file $entMatchRegex = '/<!ENTITY ('. preg_quote(DOCWEB_ENTITIY_PREFIX) - .'\..*?) ([\'"])(.*?)(\2)>/s'; + .'\..*?) ([\'"])(.*?)\2>/s'; preg_match_all($entMatchRegex, $entData, $matches); - + // init local entities variable $entities = array(); - + // loop through matches, creating entities dataset foreach ($matches[0] as $index => $val) { - $entities[$matches[1][$index]] = $matches[3][$index]; + $entities[$matches[1][$index]] = @iconv($charset, 'UTF-8//IGNORE', $matches[3][$index]); } return $entities; } else { @@ -111,7 +115,7 @@ return array(); } } - + /** * Gives a single entity's text * http://cvs.php.net/diff.php/docweb/templates/all/www/credits.tpl.php?r1=1.1&r2=1.2&ty=u Index: docweb/templates/all/www/credits.tpl.php diff -u docweb/templates/all/www/credits.tpl.php:1.1 docweb/templates/all/www/credits.tpl.php:1.2 --- docweb/templates/all/www/credits.tpl.php:1.1 Fri Nov 12 18:13:47 2004 +++ docweb/templates/all/www/credits.tpl.php Wed Jan 26 08:38:34 2005 @@ -9,8 +9,8 @@ <dd>&docweb.credits.php-systems;</dd> <dt>&docweb.credits.section.devs;</dt> <dd> - Mehdi Achour, Vincent Gevers, Gabor Hojtsy, - Yannick Torres &docweb.common.and; Sean Coates</dd> + Mehdi Achour, Sean Coates, Vincent Gevers, Gabor Hojtsy, + Nuno Lopes &docweb.common.and; Yannick Torres</dd> </dl> <p>

« previous php.doc.web (#578) next »