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
This commit is contained in:
rvelices
2006-02-28 01:13:16 +00:00
parent d4646f39d2
commit 4cd5b05d40
18 changed files with 1760 additions and 3415 deletions
+10 -1
View File
@@ -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" )