getElementsByTagName("title")->item(0)->firstChild->data; $y["link"] = $item->getElementsByTagName("link")->item(0)->firstChild->data; $y["description"] = $item->getElementsByTagName("description")->item(0)->firstChild->data; $tnl = $item->getElementsByTagName("pubDate"); if($tnl->length == 0) { $tnl = $item->getElementsByTagName("lastBuildDate"); } if($tnl->length != 0) { $tnl =$tnl->item(0)->firstChild->data; } else $tnl = false; $y["updated"] = $tnl; $y["type"] = $type; array_push($this->Common_Content, $y); } function RSS_Channel($channel) { $items = $channel->getElementsByTagName("item"); // Processing channel $this->RSS_Tags($channel, 0); // get description of channel, type 0 // Processing articles foreach($items as $item) { $this->RSS_Tags($item, 1); // get description of article, type 1 } } function RSS_Retrieve($url) { $doc = new DOMDocument(); $ret = $doc->load($url); if ($ret===false) { $page=getUrl($url,'','','',false,'','',3); $this->codeErreurHtml=$page['code']; if ($this->codeErreurHttp==302) { $url=$page['header']['Location']; $ret = $doc->load($url); } } $channels = $doc->getElementsByTagName("channel"); $this->Common_Content = array(); foreach($channels as $channel) { $this->RSS_Channel($channel); } return ( count($this->Common_Content) > 0); } function Atom_Tags($item) { $y = array(); $y["title"] = $item->getElementsByTagName("title")->item(0)->firstChild->data; $y["link"] = $item->getElementsByTagName("link")->item(0)->getAttribute("href"); $y["description"] = $item->getElementsByTagName("summary")->item(0)->firstChild->data; $y["updated"] = $item->getElementsByTagName("updated")->item(0)->firstChild->data; $y["type"] = 1; array_push($this->Common_Content, $y); } function Atom_Feed($doc) { $entries = $doc->getElementsByTagName("entry"); if($entries->length == 0) return false; // Processing feed $y = array(); $y["title"] = $doc->getElementsByTagName("title")->item(0)->firstChild->data; $y["link"] = $doc->getElementsByTagName("link")->item(0)->getAttribute("href"); $y["description"] = $doc->getElementsByTagName("subtitle")->item(0)->firstChild->data; $y["updated"] = $doc->getElementsByTagName("updated")->item(0)->firstChild->data; $y["type"] = 0; array_push($this->Common_Content, $y); // Processing articles foreach($entries as $entry) { $this->Atom_Tags($entry); // get description of article, type 1 } return true; } function Atom_Retrieve($url) { $doc = new DOMDocument(); $doc->load($url); $this->Common_Content = array(); return $this->Atom_Feed($doc); } function loadRss($url, $size=200, $chanopt=true, $descopt=true, $dateopt=true) { $opened = false; $page = ""; if($this->Atom_Retrieve($url) === false) { if($this->RSS_Retrieve($url) === false) { return false; } } if($size > 0) { $size += 1; // add one for the channel $recents = array_slice($this->Common_Content, 0, $size); } //$tabFlux=array(); return $recents; /* foreach($recents as $article) { $type = $article["type"]; if($type == 0) { if($chanopt != true) continue; if($opened == true) { $page .="\n"; $opened = false; } //$page .=""; } else { if($opened == false && $chanopt == true) { $page .= "\n"; } return $page."\n"; */ } } ?>