cvs: pear /XML_Query2XML/XML Query2XML.php

From: Date: Sun, 26 Aug 2007 06:59:36 +0000
Subject: cvs: pear /XML_Query2XML/XML Query2XML.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-48500@lists.php.net to get a copy of this message
lukasfeiler Sun Aug 26 06:59:36 2007 UTC Modified files: /pear/XML_Query2XML/XML Query2XML.php Log: new dynamicRowTag option, new BASE64 ENCODE prefix, new CDATA SECTION prefix http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/XML/Query2XML.php?r1=1.21&r2=1.22&diff_format=u Index: pear/XML_Query2XML/XML/Query2XML.php diff -u pear/XML_Query2XML/XML/Query2XML.php:1.21 pear/XML_Query2XML/XML/Query2XML.php:1.22 --- pear/XML_Query2XML/XML/Query2XML.php:1.21 Sat May 26 10:54:26 2007 +++ pear/XML_Query2XML/XML/Query2XML.php Sun Aug 26 06:59:36 2007 @@ -15,7 +15,7 @@ * @license http://www.gnu.org/copyleft/lesser.html LGPL Version 2.1 * @author Lukas Feiler <lukas.feiler@lukasfeiler.com> * @package XML_Query2XML -* @version $Id: Query2XML.php,v 1.21 2007/05/26 10:54:26 lukasfeiler Exp $ +* @version $Id: Query2XML.php,v 1.22 2007/08/26 06:59:36 lukasfeiler Exp $ */ /**PEAR_Exception is used as the parent for XML_Query2XML_Exception. @@ -704,7 +704,9 @@ //the default row tag name is 'row' - if (isset($options['rowTag'])) { + if (isset($options['dynamicRowTag'])) { + $rowTagName = $this->_applyColumnStringToRecord($options['dynamicRowTag'], $record, 'dynamicRowTag'); + } elseif (isset($options['rowTag'])) { $rowTagName = $options['rowTag']; } else { $rowTagName = 'row'; @@ -1514,6 +1516,8 @@ } $unserialize = false; + $cdata = false; + $base64 = false; if (strpos($columnStr, '&') === 0) { /* * unserialization is performed after processing the @@ -1521,6 +1525,24 @@ */ $unserialize = true; $columnStr = substr($columnStr, 1); + } else { + if (strpos($columnStr, '=') === 0) { + /* + * if a CDATA section prefix is used it has to be placed + * before the prefixes "^", ":" or "#" + */ + $cdata = true; + $columnStr = substr($columnStr, 1); + } + + if (strpos($columnStr, '^') === 0) { + /* + * base64 data encoding is performed after processing the + * ':' prefix, the '#' prefix or the plain column name. + */ + $base64 = true; + $columnStr = substr($columnStr, 1); + } } if (strpos($columnStr, ':') === 0) { @@ -1616,6 +1638,23 @@ */ $ret = null; } + } else { + if ($base64) { + $ret = base64_encode($ret); + } + + if ($cdata) { + if (strlen($ret) > 0) { + /* + * only create a CDATA section if $ret is + * a string with a length greater than 0 + */ + $doc = new DOMDocument(); + $ret = $doc->createCDATASection($ret); + } else { + $ret = null; + } + } } return $ret; } @@ -1642,8 +1681,6 @@ * $value is null or is a string with a length of zero. */ return !(is_null($value) || (is_string($value) && strlen($value) == 0)); - } elseif (strpos($spec, '&') === 0) { - //return $value instanceof DOMNode || is_array($value); } return true; }

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