mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-20 08:33:03 +02:00
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:
@@ -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" )
|
||||
|
||||
Reference in New Issue
Block a user