For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > May 2004 > cvs: livedocs / livedoc_funcs.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: livedocs / livedoc_funcs.php
Ilia Alshanetsky

2004-05-26, 1:36 pm

iliaa Wed May 26 11:57:29 2004 EDT

Modified files:
/livedocs livedoc_funcs.php
Log:
More tuneup.


http://cvs.php.net/diff.php/livedoc...1.7&r2=1.8&ty=u
Index: livedocs/livedoc_funcs.php
diff -u livedocs/livedoc_funcs.php:1.7 livedocs/livedoc_funcs.php:1.8
--- livedocs/livedoc_funcs.php:1.7 Wed May 26 10:24:55 2004
+++ livedocs/livedoc_funcs.php Wed May 26 11:57:28 2004
@@ -155,26 +155,19 @@
function bind_entities($data) {

global $idx;
-
- static $entity_cache = array();
-
- $entities = array();
+
$sanity = 0;

while (($ent_count = preg_match_all('/&([a-zA-Z0-9.-]+);/sm', $data, $matches)) && $sanity++ < 5) {
- $q = sqlite_query($idx, "SELECT entid, value from ents where is_file=0 and entid in ('" . implode("','", $matches[1]) . "') GROUP BY entid");
- if (!$q) {
+ $r = sqlite_array_query($idx, "SELECT '&'||entid||';', value from ents where is_file=0 and entid in ('" . implode("','", $matches[1]) . "') GROUP BY entid", SQLITE_NUM);
+ if (empty($r)) {
break;
}
$src = $dst = array();

- while ($r = sqlite_fetch_array($q, SQLITE_NUM)) {
- $src[] = '&' . $r[0] . ';';
- $dst[] = $r[1];
- }
-
- if (empty($src)) {
- break;
+ foreach ($r as $row) {
+ $src[] = $row[0];
+ $dst[] = $row[1];
}

$data = str_replace($src, $dst, $data);
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com