Created
January 12, 2012 21:16
-
-
Save emodric/1603175 to your computer and use it in GitHub Desktop.
xrowmetadata / fetchMetaData function with corrected empty keyword bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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