Exemplo n.º 1
0
 /**
  * get_xml
  * This returns the xmldocument for the current rss type, it calls a sub function that gathers the data
  * and then uses the xmlDATA class to build the document
  * @return string
  */
 public function get_xml($params = null)
 {
     if ($this->type === "podcast") {
         if ($params != null && is_array($params)) {
             $object_type = $params['object_type'];
             $object_id = $params['object_id'];
             if (Core::is_library_item($object_type)) {
                 $libitem = new $object_type($object_id);
                 if ($libitem->id) {
                     $libitem->format();
                     return XML_Data::podcast($libitem);
                 }
             }
         }
     } else {
         // Function call name
         $data_function = 'load_' . $this->type;
         $pub_date_function = 'pubdate_' . $this->type;
         $data = call_user_func(array('Ampache_RSS', $data_function));
         $pub_date = null;
         if (method_exists('Ampache_RSS', $data_function)) {
             $pub_date = call_user_func(array('Ampache_RSS', $pub_date_function));
         }
         XML_Data::set_type('rss');
         $xml_document = XML_Data::rss_feed($data, $this->get_title(), $this->get_description(), $pub_date);
         return $xml_document;
     }
     return null;
 }