diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-20 05:32:08 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-20 05:32:08 +0000 |
commit | c1829308f4207eda5fbfff668ad0fcd6e1f16143 (patch) | |
tree | 265c61d8ef168a20fb938d7c17f934d2c4fd1819 /lib/class/xmldata.class.php | |
parent | b28c8ea49f75add9b2b97f9077ea8a6695f95a9a (diff) | |
download | ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.tar.gz ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.tar.bz2 ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.zip |
more changes for the amarok hotness
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r-- | lib/class/xmldata.class.php | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 2fea98db..de71fbc8 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -46,11 +46,72 @@ class xmlData { */ public static function error($string) { - $string = "<root>\n\t<error><![CDATA[$string]]></error>\n</root>"; + $string = self::_header() . "\t<error><![CDATA[$string]]></error>" . self::_footer(); return $string; } // error + /** + * artists + * This takes an array of artists and then returns a pretty xml document with the information + * we want + */ + public static function artists($artists) { + + foreach ($artists as $artist_id) { + $artist = new Artist($artist_id); + $artist->format(); + + $string .= "<artist id="$artist->id">\n" . + "\t<name>$artist->f_full_name</name>\n"; + "</artist>\n"; + } // end foreach artists + + $final = self::_header() . $string . self::_footer(); + return $final; + + } // artists + + /** + * _header + * this returns a standard header, there are a few types + * so we allow them to pass a type if they want to + */ + private static function _header($type='') { + + switch ($type) { + case 'xspf': + + break; + case 'itunes': + + break; + default: + $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<root>\n"; + break; + } // end switch + + return $header; + + } // _header + + /** + * _footer + * this returns the footer for this document, these are pretty boring + */ + private static function _footer($type='') { + + switch ($type) { + default: + $footer = "\n</root>\n"; + break; + } // end switch on type + + + return $footer; + + } // _footer + } // xmlData ?> |