Fix indentation and remove unnecessary lines
This commit is contained in:
parent
1e33b7c2ec
commit
01bdda5e19
1 changed files with 41 additions and 46 deletions
|
@ -1,70 +1,65 @@
|
||||||
<?php
|
<?php
|
||||||
class CADBridge extends BridgeAbstract{
|
class CADBridge extends BridgeAbstract{
|
||||||
|
public function loadMetadatas() {
|
||||||
|
$this->maintainer = "nyutag";
|
||||||
|
$this->name = "CAD Bridge";
|
||||||
|
$this->uri = "http://www.cad-comic.com/";
|
||||||
|
$this->description = "Returns the newest articles.";
|
||||||
|
$this->update = "2016-08-02";
|
||||||
|
}
|
||||||
|
|
||||||
public function loadMetadatas() {
|
function CADExtractContent($url) {
|
||||||
|
|
||||||
$this->maintainer = "nyutag";
|
|
||||||
$this->name = "CAD Bridge";
|
|
||||||
$this->uri = "http://www.cad-comic.com/";
|
|
||||||
$this->description = "Returns the newest articles.";
|
|
||||||
$this->update = "2016-08-02";
|
|
||||||
|
|
||||||
}
|
|
||||||
function CADExtractContent($url) {
|
|
||||||
$html3 = $this->file_get_html($url);
|
$html3 = $this->file_get_html($url);
|
||||||
$htmlpart = explode("/", $url);
|
$htmlpart = explode("/", $url);
|
||||||
if ($htmlpart[3] == 'cad')
|
if ($htmlpart[3] == 'cad')
|
||||||
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2);
|
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2);
|
||||||
if ($htmlpart[3] == 'sillies')
|
if ($htmlpart[3] == 'sillies')
|
||||||
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/", $html3, $url2);
|
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/", $html3, $url2);
|
||||||
$img = implode ($url2[0]);
|
$img = implode ($url2[0]);
|
||||||
$html3->clear();
|
$html3->clear();
|
||||||
unset ($html3);
|
unset ($html3);
|
||||||
if ($img == '')
|
if ($img == '')
|
||||||
return 'Daily comic not realease yet';
|
return 'Daily comic not realease yet';
|
||||||
return '<img src="'.$img.'"/>';
|
return '<img src="'.$img.'"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
|
||||||
|
|
||||||
|
public function collectData(array $param){
|
||||||
function CADUrl($string) {
|
function CADUrl($string) {
|
||||||
$html2 = explode("\"", $string);
|
$html2 = explode("\"", $string);
|
||||||
$string = $html2[1];
|
$string = $html2[1];
|
||||||
if (substr($string,0,4) != 'http')
|
if (substr($string,0,4) != 'http')
|
||||||
return 'notanurl';
|
return 'notanurl';
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnError('Could not request CAD.', 404);
|
$html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnError('Could not request CAD.', 404);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
if($limit < 5) {
|
if($limit < 5) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->title = $element->find('title', 0)->innertext;
|
$item->title = $element->find('title', 0)->innertext;
|
||||||
$item->uri = CADUrl($element->find('description', 0)->innertext);
|
$item->uri = CADUrl($element->find('description', 0)->innertext);
|
||||||
if ($item->uri != 'notanurl') {
|
if ($item->uri != 'notanurl') {
|
||||||
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
||||||
$item->content = $this->CADExtractContent($item->uri);
|
$item->content = $this->CADExtractContent($item->uri);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
public function getName(){
|
||||||
|
return 'CAD Bridge';
|
||||||
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getURI(){
|
||||||
return 'CAD Bridge';
|
return 'http://www.cad-comic.com/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getCacheDuration(){
|
||||||
return 'http://www.cad-comic.com/';
|
return 3600*2; // 2 hours
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
|
||||||
return 3600*2; // 2 hours
|
|
||||||
// return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
?>
|
Loading…
Reference in a new issue