GelbooruBridge.php 890 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require_once('DanbooruBridge.php');
  3. class GelbooruBridge extends DanbooruBridge {
  4. const MAINTAINER = 'mitsukarenai';
  5. const NAME = 'Gelbooru';
  6. const URI = 'http://gelbooru.com/';
  7. const DESCRIPTION = 'Returns images from given page';
  8. const PATHTODATA = '.thumb';
  9. const IDATTRIBUTE = 'id';
  10. const TAGATTRIBUTE = 'title';
  11. const PIDBYPAGE = 63;
  12. protected function getFullURI(){
  13. return $this->getURI()
  14. . 'index.php?page=post&s=list&pid='
  15. . ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
  16. . '&tags=' . urlencode($this->getInput('t'));
  17. }
  18. protected function getTags($element){
  19. $tags = parent::getTags($element);
  20. $tags = explode(' ', $tags);
  21. // Remove statistics from the tags list (identified by colon)
  22. foreach($tags as $key => $tag) {
  23. if(strpos($tag, ':') !== false) unset($tags[$key]);
  24. }
  25. return implode(' ', $tags);
  26. }
  27. }