[DanbooruBridge] Allow descendant classes to override tag collection

Add protected function 'getTags' that receives the current element
and returns a string containing all tags.

References #560
This commit is contained in:
logmanoriginal 2017-08-05 22:24:48 +02:00
parent e125e9aba1
commit 9599f921a5
1 changed files with 6 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class DanbooruBridge extends BridgeAbstract {
const PATHTODATA = 'article';
const IDATTRIBUTE = 'data-id';
const TAGATTRIBUTE = 'alt';
protected function getFullURI(){
return $this->getURI()
@ -30,6 +31,10 @@ class DanbooruBridge extends BridgeAbstract {
. '&tags=' . urlencode($this->getInput('t'));
}
protected function getTags($element){
return $element->find('img', 0)->getAttribute(static::TAGATTRIBUTE);
}
protected function getItemFromElement($element){
// Fix links
defaultLinkTo($element, $this->getURI());
@ -39,7 +44,7 @@ class DanbooruBridge extends BridgeAbstract {
$item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
$item['tags'] = $this->getTags($element);
$item['title'] = $this->getName() . ' | ' . $item['postid'];
$item['content'] = '<a href="'
. $item['uri']