diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 5c2bbb13..d0a73612 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -305,7 +305,6 @@ class Api * artists * This takes a collection of inputs and returns * artist objects. This function is deprecated! - * //DEPRECATED * @param array $input */ public static function artists($input) @@ -332,7 +331,6 @@ class Api /** * artist * This returns a single artist based on the UID of said artist - * //DEPRECATED * @param array $input */ public static function artist($input) diff --git a/lib/class/xml_data.class.php b/lib/class/xml_data.class.php index 804895dc..b35e09ee 100644 --- a/lib/class/xml_data.class.php +++ b/lib/class/xml_data.class.php @@ -72,8 +72,11 @@ class XML_Data return false; } - $limit = intval($limit); - self::$limit = $limit; + if (strtolower($limit) == "none") { + self::$limit = null; + } else { + self::$limit = intval($limit); + } } // set_limit /** @@ -257,11 +260,15 @@ class XML_Data */ public static function tags($tags) { - if (count($tags) > self::$limit or self::$offset > 0) { - $tags = array_splice($tags, self::$offset, self::$limit); - } + $string = '' . count($tags) . '\n'; - $string = ''; + if (count($tags) > self::$limit or self::$offset > 0) { + if (null !== self::$limit) { + $tags = array_splice($tags, self::$offset, self::$limit); + } else { + $tags = array_splice($tags, self::$offset); + } + } foreach ($tags as $tag_id) { $tag = new Tag($tag_id); @@ -293,11 +300,18 @@ class XML_Data */ public static function artists($artists, $include=[], $full_xml=true) { - if (count($artists) > self::$limit or self::$offset > 0) { - $artists = array_splice($artists, self::$offset, self::$limit); + if (null == $include) { + $include = array(); } + $string = '' . count($artists) . '\n'; - $string = ''; + if (count($artists) > self::$limit or self::$offset > 0) { + if (null !== self::$limit) { + $artists = array_splice($artists, self::$offset, self::$limit); + } else { + $artists = array_splice($artists, self::$offset); + } + } Rating::build_cache('artist', $artists); @@ -354,13 +368,21 @@ class XML_Data */ public static function albums($albums, $include=[], $full_xml=true) { + if (null == $include) { + $include = array(); + } + $string = '' . count($albums) . '\n'; + if (count($albums) > self::$limit or self::$offset > 0) { - $albums = array_splice($albums, self::$offset, self::$limit); + if (null !== self::$limit) { + $albums = array_splice($albums, self::$offset, self::$limit); + } else { + $albums = array_splice($albums, self::$offset); + } } Rating::build_cache('album', $albums); - $string = ""; foreach ($albums as $album_id) { $album = new Album($album_id); $album->format(); @@ -412,11 +434,15 @@ class XML_Data */ public static function playlists($playlists) { - if (count($playlists) > self::$limit or self::$offset > 0) { - $playlists = array_slice($playlists, self::$offset, self::$limit); - } + $string = '' . count($playlists) . '\n'; - $string = ''; + if (count($playlists) > self::$limit or self::$offset > 0) { + if (null !== self::$limit) { + $playlists = array_slice($playlists, self::$offset, self::$limit); + } else { + $playlists = array_slice($playlists, self::$offset); + } + } // Foreach the playlist ids foreach ($playlists as $playlist_id) { @@ -444,14 +470,19 @@ class XML_Data */ public static function songs($songs, $playlist_data='', $full_xml=true) { + $string = '' . count($songs) . '\n'; + if (count($songs) > self::$limit or self::$offset > 0) { - $songs = array_slice($songs, self::$offset, self::$limit); + if (null !== self::$limit) { + $songs = array_slice($songs, self::$offset, self::$limit); + } else { + $songs = array_slice($songs, self::$offset); + } } Song::build_cache($songs); Stream::set_session($_REQUEST['auth']); - $string = ""; // Foreach the ids! foreach ($songs as $song_id) { $song = new Song($song_id); @@ -531,11 +562,16 @@ class XML_Data */ public static function videos($videos) { + $string = '' . count($videos) . '\n'; + if (count($videos) > self::$limit or self::$offset > 0) { - $videos = array_slice($videos, self::$offset, self::$limit); + if (null !== self::$limit) { + $videos = array_slice($videos, self::$offset, self::$limit); + } else { + $videos = array_slice($videos, self::$offset); + } } - $string = ''; foreach ($videos as $video_id) { $video = new Video($video_id); $video->format();