forked from blallo/rss-bridge
[Mangareader] Fix coding styles
This commit is contained in:
parent
4c96aab832
commit
6c51eaa4d7
1 changed files with 83 additions and 83 deletions
|
@ -1,94 +1,94 @@
|
|||
<?php
|
||||
class MangareaderBridge extends BridgeAbstract{
|
||||
class MangareaderBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = "logmanoriginal";
|
||||
const NAME = "Mangareader Bridge";
|
||||
const URI = "http://www.mangareader.net/";
|
||||
const DESCRIPTION = "Returns the latest updates, popular mangas or manga updates (new chapters)";
|
||||
const MAINTAINER = "logmanoriginal";
|
||||
const NAME = "Mangareader Bridge";
|
||||
const URI = "http://www.mangareader.net/";
|
||||
const DESCRIPTION = "Returns the latest updates, popular mangas or manga updates (new chapters)";
|
||||
|
||||
const PARAMETERS = array(
|
||||
'Get latest updates' => array(),
|
||||
'Get popular mangas' => array(
|
||||
'category'=>array(
|
||||
'name'=>'Category',
|
||||
'type'=>'list',
|
||||
'required'=>true,
|
||||
'values'=>array(
|
||||
'All'=>'all',
|
||||
'Action'=>'action',
|
||||
'Adventure'=>'adventure',
|
||||
'Comedy'=>'comedy',
|
||||
'Demons'=>'demons',
|
||||
'Drama'=>'drama',
|
||||
'Ecchi'=>'ecchi',
|
||||
'Fantasy'=>'fantasy',
|
||||
'Gender Bender'=>'gender-bender',
|
||||
'Harem'=>'harem',
|
||||
'Historical'=>'historical',
|
||||
'Horror'=>'horror',
|
||||
'Josei'=>'josei',
|
||||
'Magic'=>'magic',
|
||||
'Martial Arts'=>'martial-arts',
|
||||
'Mature'=>'mature',
|
||||
'Mecha'=>'mecha',
|
||||
'Military'=>'military',
|
||||
'Mystery'=>'mystery',
|
||||
'One Shot'=>'one-shot',
|
||||
'Psychological'=>'psychological',
|
||||
'Romance'=>'romance',
|
||||
'School Life'=>'school-life',
|
||||
'Sci-Fi'=>'sci-fi',
|
||||
'Seinen'=>'seinen',
|
||||
'Shoujo'=>'shoujo',
|
||||
'Shoujoai'=>'shoujoai',
|
||||
'Shounen'=>'shounen',
|
||||
'Shounenai'=>'shounenai',
|
||||
'Slice of Life'=>'slice-of-life',
|
||||
'Smut'=>'smut',
|
||||
'Sports'=>'sports',
|
||||
'Super Power'=>'super-power',
|
||||
'Supernatural'=>'supernatural',
|
||||
'Tragedy'=>'tragedy',
|
||||
'Vampire'=>'vampire',
|
||||
'Yaoi'=>'yaoi',
|
||||
'Yuri'=>'yuri'
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'All' => 'all',
|
||||
'Action' => 'action',
|
||||
'Adventure' => 'adventure',
|
||||
'Comedy' => 'comedy',
|
||||
'Demons' => 'demons',
|
||||
'Drama' => 'drama',
|
||||
'Ecchi' => 'ecchi',
|
||||
'Fantasy' => 'fantasy',
|
||||
'Gender Bender' => 'gender-bender',
|
||||
'Harem' => 'harem',
|
||||
'Historical' => 'historical',
|
||||
'Horror' => 'horror',
|
||||
'Josei' => 'josei',
|
||||
'Magic' => 'magic',
|
||||
'Martial Arts' => 'martial-arts',
|
||||
'Mature' => 'mature',
|
||||
'Mecha' => 'mecha',
|
||||
'Military' => 'military',
|
||||
'Mystery' => 'mystery',
|
||||
'One Shot' => 'one-shot',
|
||||
'Psychological' => 'psychological',
|
||||
'Romance' => 'romance',
|
||||
'School Life' => 'school-life',
|
||||
'Sci-Fi' => 'sci-fi',
|
||||
'Seinen' => 'seinen',
|
||||
'Shoujo' => 'shoujo',
|
||||
'Shoujoai' => 'shoujoai',
|
||||
'Shounen' => 'shounen',
|
||||
'Shounenai' => 'shounenai',
|
||||
'Slice of Life' => 'slice-of-life',
|
||||
'Smut' => 'smut',
|
||||
'Sports' => 'sports',
|
||||
'Super Power' => 'super-power',
|
||||
'Supernatural' => 'supernatural',
|
||||
'Tragedy' => 'tragedy',
|
||||
'Vampire' => 'vampire',
|
||||
'Yaoi' => 'yaoi',
|
||||
'Yuri' => 'yuri'
|
||||
),
|
||||
'exampleValue'=>'All',
|
||||
'title'=>'Select your category'
|
||||
'exampleValue' => 'All',
|
||||
'title' => 'Select your category'
|
||||
)
|
||||
),
|
||||
'Get manga updates' => array(
|
||||
'path'=>array(
|
||||
'name'=>'Path',
|
||||
'required'=>true,
|
||||
'pattern'=>'[a-zA-Z0-9-_]*',
|
||||
'exampleValue'=>'bleach, umi-no-kishidan',
|
||||
'title'=>'URL part of desired manga'
|
||||
'path' => array(
|
||||
'name' => 'Path',
|
||||
'required' => true,
|
||||
'pattern' => '[a-zA-Z0-9-_]*',
|
||||
'exampleValue' => 'bleach, umi-no-kishidan',
|
||||
'title' => 'URL part of desired manga'
|
||||
),
|
||||
'limit'=>array(
|
||||
'name'=>'Limit',
|
||||
'type'=>'number',
|
||||
'defaultValue'=>10,
|
||||
'title'=>'Number of items to return [-1 returns all]'
|
||||
'limit' => array(
|
||||
'name' => 'Limit',
|
||||
'type' => 'number',
|
||||
'defaultValue' => 10,
|
||||
'title' => 'Number of items to return [-1 returns all]'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
private $request='';
|
||||
private $request = '';
|
||||
|
||||
public function collectData(){
|
||||
// We'll use the DOM parser for this as it makes navigation easier
|
||||
$html = $this->getContents($this->getURI());
|
||||
public function collectData(){
|
||||
// We'll use the DOM parser for this as it makes navigation easier
|
||||
$html = $this->getContents($this->getURI());
|
||||
if(!$html){
|
||||
$this->returnClientError('Could not receive data for ' . $path . '!');
|
||||
}
|
||||
libxml_use_internal_errors(true);
|
||||
$doc = new DomDocument;
|
||||
@$doc->loadHTML($html);
|
||||
@$doc->loadHTML($html);
|
||||
libxml_clear_errors();
|
||||
|
||||
// Navigate via XPath
|
||||
$xpath = new DomXPath($doc);
|
||||
// Navigate via XPath
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
$this->request = '';
|
||||
switch($this->queriedContext){
|
||||
|
@ -107,7 +107,7 @@ class MangareaderBridge extends BridgeAbstract{
|
|||
|
||||
if (isset($manga) && $chapters->length >= 1){
|
||||
$item = array();
|
||||
$item['uri'] = self::URI. htmlspecialchars($manga->getAttribute('href'));
|
||||
$item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href'));
|
||||
$item['title'] = htmlspecialchars($manga->nodeValue);
|
||||
|
||||
// Add each chapter to the feed
|
||||
|
@ -117,7 +117,7 @@ class MangareaderBridge extends BridgeAbstract{
|
|||
if($item['content'] <> ""){
|
||||
$item['content'] .= "<br>";
|
||||
}
|
||||
$item['content'] .= "<a href='" .self::URI. htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>";
|
||||
$item['content'] .= "<a href='" . self::URI . htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>";
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
|
@ -176,14 +176,14 @@ class MangareaderBridge extends BridgeAbstract{
|
|||
break;
|
||||
}
|
||||
|
||||
// Return some dummy-data if no content available
|
||||
if(empty($this->items)){
|
||||
$item = array();
|
||||
$item['content'] = "<p>No updates available</p>";
|
||||
// Return some dummy-data if no content available
|
||||
if(empty($this->items)){
|
||||
$item = array();
|
||||
$item['content'] = "<p>No updates available</p>";
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext){
|
||||
|
@ -204,12 +204,12 @@ class MangareaderBridge extends BridgeAbstract{
|
|||
}
|
||||
|
||||
|
||||
public function getName(){
|
||||
return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
|
||||
}
|
||||
public function getName(){
|
||||
return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 10800; // 3 hours
|
||||
}
|
||||
public function getCacheDuration(){
|
||||
return 10800; // 3 hours
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue