forked from blallo/rss-bridge
[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:
parent
e125e9aba1
commit
9599f921a5
1 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,7 @@ class DanbooruBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const PATHTODATA = 'article';
|
const PATHTODATA = 'article';
|
||||||
const IDATTRIBUTE = 'data-id';
|
const IDATTRIBUTE = 'data-id';
|
||||||
|
const TAGATTRIBUTE = 'alt';
|
||||||
|
|
||||||
protected function getFullURI(){
|
protected function getFullURI(){
|
||||||
return $this->getURI()
|
return $this->getURI()
|
||||||
|
@ -30,6 +31,10 @@ class DanbooruBridge extends BridgeAbstract {
|
||||||
. '&tags=' . urlencode($this->getInput('t'));
|
. '&tags=' . urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getTags($element){
|
||||||
|
return $element->find('img', 0)->getAttribute(static::TAGATTRIBUTE);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getItemFromElement($element){
|
protected function getItemFromElement($element){
|
||||||
// Fix links
|
// Fix links
|
||||||
defaultLinkTo($element, $this->getURI());
|
defaultLinkTo($element, $this->getURI());
|
||||||
|
@ -39,7 +44,7 @@ class DanbooruBridge extends BridgeAbstract {
|
||||||
$item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
|
$item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$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['title'] = $this->getName() . ' | ' . $item['postid'];
|
||||||
$item['content'] = '<a href="'
|
$item['content'] = '<a href="'
|
||||||
. $item['uri']
|
. $item['uri']
|
||||||
|
|
Loading…
Reference in a new issue