Changeset 1535

Show
Ignore:
Timestamp:
03/01/08 13:26:32 (2 months ago)
Author:
Neal
Message:

Changed db_update.php to use a callback function rather than calling create_function many times.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/punbb-1.3-dev/extras/db_update.php

    r1533 r1535  
    235235 
    236236        // Replace numeric entities 
    237         $str = preg_replace_callback('/&#([0-9]+);/', create_function('$s', 'return dcr2utf8($s[1]);'), $str); 
    238         $str = preg_replace_callback('/&#x([a-f0-9]+);/i', create_function('$s', 'return dcr2utf8(hexdec($s[1]));'), $str); 
     237        $str = preg_replace_callback('/&#([0-9]+);/', 'utf8_callback_1', $str); 
     238        $str = preg_replace_callback('/&#x([a-f0-9]+);/i', 'utf8_callback_2', $str); 
    239239 
    240240        return ($save != $str); 
     241} 
     242 
     243 
     244function utf8_callback_1($matches) 
     245{ 
     246        return dcr2utf8($matches[1]); 
     247} 
     248 
     249 
     250function utf8_callback_2($matches) 
     251{ 
     252        return dcr2utf8(hexdec($matches[1])); 
    241253} 
    242254