diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-22 17:44:10 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-22 17:44:10 +0000 |
commit | 67cbb218cd89ac6be9d1d55ca3799080daac1f5a (patch) | |
tree | 9aabddaed61a0bda1e477cf44c69400d1590779f /lib/class/xmldata.class.php | |
parent | d5ae71f551f0aebef1dbae518a116a1c86430ffb (diff) | |
download | ampache-67cbb218cd89ac6be9d1d55ca3799080daac1f5a.tar.gz ampache-67cbb218cd89ac6be9d1d55ca3799080daac1f5a.tar.bz2 ampache-67cbb218cd89ac6be9d1d55ca3799080daac1f5a.zip |
renamed xml-rpc acl to rpc, added default mime type of image/jpg and added config options for batch download to the fs, no garbage collection for non-completed downloads yet.
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r-- | lib/class/xmldata.class.php | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index c9d49a3f..ac776635 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -27,10 +27,9 @@ */ class xmlData { - public static $version = '340001'; - // This is added so that we don't pop any webservers public static $limit = '5000'; + private static $offset = '0'; /** * constructor @@ -43,6 +42,17 @@ class xmlData { } // constructor /** + * set_offset + * This takes an int and changes the offset + */ + public static function set_offset($offset) { + + $offset = intval($offset); + self::$offset = $offset; + + } // set_offset + + /** * error * This generates a standard XML Error message * nothing fancy here... @@ -67,6 +77,35 @@ class xmlData { } // single_string /** + * keyed_array + * This will build an xml document from a key'd array, + */ + public static function keyed_array($array,$callback='') { + + $string = ''; + + // Foreach it + foreach ($array as $key=>$value) { + // If it's an array, run again + if (is_array($value)) { + $value = self::keyed_array($value,1); + $string .= "\t<$key>$value</$key>\n"; + } + else { + $string .= "\t<$key><![CDATA[$value]]></$key>\n"; + } + + } // end foreach + + if (!$callback) { + $string = self::_header() . $string . self::_footer(); + } + + return $string; + + } // keyed_array + + /** * artists * This takes an array of artists and then returns a pretty xml document with the information * we want @@ -74,9 +113,11 @@ class xmlData { public static function artists($artists) { if (count($artists) > self::$limit) { - $artists = array_splice($artists,0,self::$limit); + $artists = array_splice($artists,self::$offset,self::$limit); } + $string = ''; + foreach ($artists as $artist_id) { $artist = new Artist($artist_id); $artist->format(); @@ -98,7 +139,7 @@ class xmlData { public static function albums($albums) { if (count($albums) > self::$limit) { - $albums = array_splice($albums,0,self::$limit); + $albums = array_splice($albums,self::$offset,self::$limit); } foreach ($albums as $album_id) { @@ -139,7 +180,7 @@ class xmlData { public static function genres($genres) { if (count($genres) > self::$limit) { - $genres = array_slice($genres,0,self::$limit); + $genres = array_slice($genres,self::$offset,self::$limit); } // Foreach the ids @@ -172,7 +213,7 @@ class xmlData { public static function songs($songs) { if (count($songs) > self::$limit) { - $songs = array_slice($songs,0,self::$limit); + $songs = array_slice($songs,self::$offset,self::$limit); } // Foreach the ids! |