Changeset 34596
- Timestamp:
- 07/24/09 11:06:23 (4 years ago)
- Files:
-
- 1 modified
-
platform/mysql/mprofile.php/trunk/mpfilter.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/mysql/mprofile.php/trunk/mpfilter.php
r34577 r34596 4 4 $replacement = array( 5 5 '/\r?\n/' => ' ', 6 '/((?<=\W)-?(?:0x[0-9a-f]+))/i' => '?', 6 7 '/(\"([^\"]+)\")/' => '?', 7 8 '/(\'([^\']+)\')/' => '?', 8 9 '/\s{2,}/' => ' ' 9 10 10 ); 11 11 $replacepattern = array_keys($replacement); 12 12 $replace = array_values($replacement); 13 14 function __replace_place_folder__($matches){ 15 $buf = $matches[2]; 16 $buf = preg_replace('/(([^\,\s\(\)\?]+))+/', '?', $buf); 17 return $matches[1] . ' ' . $buf; 18 } 13 19 14 20 $stdin = fopen('php://stdin', 'r'); … … 23 29 } 24 30 foreach($rows as $row){ 25 $returnValue[] = preg_replace($replacepattern, $replace, $row->Info); 31 if(!isset($row->Info)){ 32 continue; 33 } 34 $info = $row->Info; 35 $info = preg_replace($replacepattern, $replace, $info); 36 $info = preg_replace_callback('/(VALUES|IN)\s*(\(.*\))/i', '__replace_place_folder__', $info); 37 $returnValue[] = $info; 26 38 } 27 39 echo json_encode($returnValue), PHP_EOL;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)