2014-05-26 02:30:46 +04:00
|
|
|
<?php
|
2022-03-29 23:42:09 +03:00
|
|
|
require_once('DanbooruBridge.php');
|
2016-09-04 02:19:54 +03:00
|
|
|
|
2022-03-29 23:42:09 +03:00
|
|
|
class BooruprojectBridge extends DanbooruBridge {
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2017-02-11 18:16:56 +03:00
|
|
|
const MAINTAINER = 'mitsukarenai';
|
|
|
|
const NAME = 'Booruproject';
|
2022-03-24 13:59:34 +03:00
|
|
|
const URI = 'https://booru.org/';
|
2017-02-11 18:16:56 +03:00
|
|
|
const DESCRIPTION = 'Returns images from given page of booruproject';
|
|
|
|
const PARAMETERS = array(
|
|
|
|
'global' => array(
|
|
|
|
'p' => array(
|
|
|
|
'name' => 'page',
|
2022-03-29 23:42:09 +03:00
|
|
|
'defaultValue' => 0,
|
2017-02-11 18:16:56 +03:00
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
't' => array(
|
2022-03-24 13:59:34 +03:00
|
|
|
'name' => 'tags',
|
|
|
|
'required' => true,
|
|
|
|
'exampleValue' => 'tagme',
|
|
|
|
'title' => 'Use "all" to get all posts'
|
2017-02-11 18:16:56 +03:00
|
|
|
)
|
|
|
|
),
|
|
|
|
'Booru subdomain (subdomain.booru.org)' => array(
|
|
|
|
'i' => array(
|
|
|
|
'name' => 'Subdomain',
|
2022-03-24 13:59:34 +03:00
|
|
|
'required' => true,
|
|
|
|
'exampleValue' => 'rm'
|
2017-02-11 18:16:56 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2016-08-28 13:14:36 +03:00
|
|
|
|
2022-03-29 23:42:09 +03:00
|
|
|
const PATHTODATA = '.thumb';
|
|
|
|
const IDATTRIBUTE = 'id';
|
|
|
|
const TAGATTRIBUTE = 'title';
|
2017-02-11 18:16:56 +03:00
|
|
|
const PIDBYPAGE = 20;
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2022-03-29 23:42:09 +03:00
|
|
|
protected function getFullURI(){
|
|
|
|
return $this->getURI()
|
|
|
|
. 'index.php?page=post&s=list&pid='
|
|
|
|
. ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
|
|
|
|
. '&tags=' . urlencode($this->getInput('t'));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTags($element){
|
|
|
|
$tags = parent::getTags($element);
|
|
|
|
$tags = explode(' ', $tags);
|
|
|
|
|
|
|
|
// Remove statistics from the tags list (identified by colon)
|
|
|
|
foreach($tags as $key => $tag) {
|
|
|
|
if(strpos($tag, ':') !== false) unset($tags[$key]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return implode(' ', $tags);
|
|
|
|
}
|
|
|
|
|
2017-02-11 18:16:56 +03:00
|
|
|
public function getURI(){
|
2017-07-29 20:28:00 +03:00
|
|
|
if(!is_null($this->getInput('i'))) {
|
2022-03-24 13:59:34 +03:00
|
|
|
return 'https://' . $this->getInput('i') . '.booru.org/';
|
2017-02-15 00:36:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getURI();
|
2017-02-11 18:16:56 +03:00
|
|
|
}
|
2014-05-26 02:30:46 +04:00
|
|
|
|
2017-02-11 18:16:56 +03:00
|
|
|
public function getName(){
|
2017-07-29 20:28:00 +03:00
|
|
|
if(!is_null($this->getInput('i'))) {
|
2017-02-15 00:20:55 +03:00
|
|
|
return static::NAME . ' ' . $this->getInput('i');
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getName();
|
2017-02-11 18:16:56 +03:00
|
|
|
}
|
2014-05-26 02:30:46 +04:00
|
|
|
}
|