cvs: pear /Contact_Vcard_Build Contact_Vcard_Build.php

From: Date: Tue, 31 May 2005 16:47:41 +0000
Subject: cvs: pear /Contact_Vcard_Build Contact_Vcard_Build.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32273@lists.php.net to get a copy of this message
pmjones Tue May 31 12:47:41 2005 EDT Modified files: /pear/Contact_Vcard_Build Contact_Vcard_Build.php Log: combined escape reges per dev note from Daniel Convissor http://cvs.php.net/diff.php/pear/Contact_Vcard_Build/Contact_Vcard_Build.php?r1=1.2&r2=1.3&ty=u Index: pear/Contact_Vcard_Build/Contact_Vcard_Build.php diff -u pear/Contact_Vcard_Build/Contact_Vcard_Build.php:1.2 pear/Contact_Vcard_Build/Contact_Vcard_Build.php:1.3 --- pear/Contact_Vcard_Build/Contact_Vcard_Build.php:1.2 Sat May 28 10:49:56 2005 +++ pear/Contact_Vcard_Build/Contact_Vcard_Build.php Tue May 31 12:47:39 2005 @@ -16,7 +16,7 @@ // | Authors: Paul M. Jones <pjones@ciaweb.net> | // +----------------------------------------------------------------------+ // -// $Id: Contact_Vcard_Build.php,v 1.2 2005/05/28 14:49:56 pmjones Exp $ +// $Id: Contact_Vcard_Build.php,v 1.3 2005/05/31 16:47:39 pmjones Exp $ /** * @@ -140,6 +140,7 @@ * does not return a value. Recursively descends into arrays. * * Escapes a string so that... + * : => \; * ; => \; * , => \, * newline => literal \n @@ -167,6 +168,7 @@ } else { + /* // escape colons not led by a backslash $regex = '(?<!\\\\)(\:)'; $text = preg_replace("/$regex/i", "\\:", $text); @@ -182,6 +184,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); } }

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