From 4cd5b05d406a9820a0523ac26f254f4ce4fd5147 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 28 Feb 2006 01:13:16 +0000 Subject: remake of Remote sites and synchronize: final integration and old code cleanup fix: xml getAttribute always decodes html entities and added encodeAttribute function git-svn-id: http://piwigo.org/svn/trunk@1058 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_xml.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/functions_xml.inc.php b/include/functions_xml.inc.php index d37537fa1..64df545ce 100644 --- a/include/functions_xml.inc.php +++ b/include/functions_xml.inc.php @@ -53,9 +53,18 @@ function getAttribute( $element, $attribute ) { // echo htmlentities($element).'

'; $regex = '/^<\w+[^>]*'.$attribute.'\s*=\s*"('.VAL_REG.')"/i'; - if ( preg_match( $regex, $element, $out ) ) return $out[1]; + if ( preg_match( $regex, $element, $out ) ) + { + return html_entity_decode($out[1], ENT_QUOTES); + } else return ''; } + +// The function encode Attribute returns the xml attribute $attribute="$value" +function encodeAttribute( $attribute, $value ) +{ + return $attribute.'="'.htmlspecialchars($value, ENT_QUOTES).'" '; +} // The function getChild returns the first child // exemple : getChild( "XXXYYY
", "tr" ) -- cgit v1.2.3