Skip to content

Instantly share code, notes, and snippets.

@emodric
Created January 12, 2012 21:16
Show Gist options
  • Save emodric/1603175 to your computer and use it in GitHub Desktop.
Save emodric/1603175 to your computer and use it in GitHub Desktop.
xrowmetadata / fetchMetaData function with corrected empty keyword bug
function fetchMetaData( $attribute )
{
try
{
$xml = new SimpleXMLElement( $attribute->attribute( 'data_text' ) );
$keywords = htmlspecialchars_decode( (string) $xml->keywords, ENT_QUOTES );
$keywords = !empty( $keywords ) ? explode( ",", $keywords ) : array();
$meta = new xrowMetaData( htmlspecialchars_decode( (string)$xml->title, ENT_QUOTES ),
$keywords,
htmlspecialchars_decode( (string)$xml->description, ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->priority, ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->change, ENT_QUOTES ),
htmlspecialchars_decode( (string)$xml->sitemap_use , ENT_QUOTES ) );
return $meta;
}
catch ( Exception $e )
{
return new xrowMetaData();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment