aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_xml.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-02-28 01:13:16 +0000
committerrvelices <rv-github@modusoptimus.com>2006-02-28 01:13:16 +0000
commit4cd5b05d406a9820a0523ac26f254f4ce4fd5147 (patch)
treeb47f717b8fe3bc3e8a3357b112e22cea96bf9188 /include/functions_xml.inc.php
parentd4646f39d2259d4b4ba619b8f2b8aa61f9be74b5 (diff)
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
Diffstat (limited to 'include/functions_xml.inc.php')
-rw-r--r--include/functions_xml.inc.php11
1 files changed, 10 insertions, 1 deletions
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).'<br /><br />';
$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( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )