Example #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;
 }
Example #2
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
  */
 public function get_xml()
 {
     // 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 = 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;
 }
 /**
  * create_xspf
  */
 public function create_xspf()
 {
     $result = "";
     foreach ($this->urls as $url) {
         $xml = array();
         $xml['track'] = array('title' => $url->title, 'creator' => $url->author, 'duration' => $url->time * 1000, 'location' => $url->url, 'identifier' => $url->url);
         if ($url->type == 'video') {
             $xml['track']['meta'] = array('attribute' => 'rel="provider"', 'value' => 'video');
         }
         if ($url->info_url) {
             $xml['track']['info'] = $url->info_url;
         }
         if ($url->image_url) {
             $xml['track']['image'] = $url->image_url;
         }
         if ($url->album) {
             $xml['track']['album'] = $url->album;
         }
         $result .= XML_Data::keyed_array($xml, true);
     }
     // end foreach
     XML_Data::set_type('xspf');
     echo XML_Data::header();
     echo $result;
     echo XML_Data::footer();
 }