cvs: pear /File_IMC/File/IMC Build.php Parse.php

From: Date: Tue, 31 May 2005 16:58:58 +0000
Subject: cvs: pear /File_IMC/File/IMC Build.php Parse.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32274@lists.php.net to get a copy of this message
pmjones Tue May 31 12:58:58 2005 EDT Modified files: /pear/File_IMC/File/IMC Build.php Parse.php Log: combined replacement commands in Build/escape() and Parse/unescape() per related dev notes on Contact_Vcard from Daniel Convissor http://cvs.php.net/diff.php/pear/File_IMC/File/IMC/Build.php?r1=1.5&r2=1.6&ty=u Index: pear/File_IMC/File/IMC/Build.php diff -u pear/File_IMC/File/IMC/Build.php:1.5 pear/File_IMC/File/IMC/Build.php:1.6 --- pear/File_IMC/File/IMC/Build.php:1.5 Sat May 28 11:12:44 2005 +++ pear/File_IMC/File/IMC/Build.php Tue May 31 12:58:57 2005 @@ -16,7 +16,7 @@ // | Authors: Paul M. Jones <pmjones@ciaweb.net> | // +----------------------------------------------------------------------+ // -// $Id: Build.php,v 1.5 2005/05/28 15:12:44 pmjones Exp $ +// $Id: Build.php,v 1.6 2005/05/31 16:58:57 pmjones Exp $ require_once 'PEAR.php'; @@ -189,7 +189,7 @@ } else { - // this is a text value. + /* // escape colons not led by a backslash $regex = '(?<!\\\\)(\:)'; $text = preg_replace("/$regex/i", "\\:", $text); @@ -205,6 +205,11 @@ // escape newlines $regex = '\\n'; $text = preg_replace("/$regex/i", "\\n", $text); + */ + + // combined (per note from Daniel Convissor) + $regex = '(?<!\\\\)([\:\;\,\\n])'; + $text = preg_replace("/$regex/", '\\\$1', $text); } } http://cvs.php.net/diff.php/pear/File_IMC/File/IMC/Parse.php?r1=1.10&r2=1.11&ty=u Index: pear/File_IMC/File/IMC/Parse.php diff -u pear/File_IMC/File/IMC/Parse.php:1.10 pear/File_IMC/File/IMC/Parse.php:1.11 --- pear/File_IMC/File/IMC/Parse.php:1.10 Sat May 28 11:45:54 2005 +++ pear/File_IMC/File/IMC/Parse.php Tue May 31 12:58:57 2005 @@ -16,7 +16,7 @@ // | Authors: Paul M. Jones <pjones@ciaweb.net> | // +----------------------------------------------------------------------+ // -// $Id: Parse.php,v 1.10 2005/05/28 15:45:54 pmjones Exp $ +// $Id: Parse.php,v 1.11 2005/05/31 16:58:57 pmjones Exp $ /** @@ -350,10 +350,16 @@ $text[$key] = $val; } } else { + /* $text = str_replace('\:', ':', $text); $text = str_replace('\;', ';', $text); $text = str_replace('\,', ',', $text); $text = str_replace('\n', "\n", $text); + */ + // combined + $find = array('\:', '\;', '\,', '\n'); + $replace = array(':', ';', ',', "\n"); + $text = str_replace($find, $replace, $text); } }

« previous php.pear.cvs (#32274) next »