[Pinterest] Cleanup code
This commit is contained in:
parent
1819943451
commit
c1cc4da8ef
1 changed files with 78 additions and 80 deletions
|
@ -25,7 +25,6 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = $this->getSimpleHTMLDOM($this->getURI());
|
$html = $this->getSimpleHTMLDOM($this->getURI());
|
||||||
if(!$html){
|
if(!$html){
|
||||||
|
@ -37,24 +36,21 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($html->find('div.pinWrapper') as $div)
|
foreach($html->find('div.pinWrapper') as $div){
|
||||||
{
|
|
||||||
$a = $div->find('a.pinImageWrapper', 0);
|
$a = $div->find('a.pinImageWrapper', 0);
|
||||||
|
|
||||||
$img = $a->find('img', 0);
|
$img = $a->find('img', 0);
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = $this->getURI() . $a->getAttribute('href');
|
$item['uri'] = $this->getURI() . $a->getAttribute('href');
|
||||||
$item['content'] = '<img src="' . htmlentities(str_replace('/236x/', '/736x/', $img->getAttribute('src'))) . '" alt="" />';
|
$item['content'] = '<img src="'
|
||||||
|
. htmlentities(str_replace('/236x/', '/736x/', $img->getAttribute('src')))
|
||||||
|
. '" alt="" />';
|
||||||
|
|
||||||
|
if($this->queriedContext === 'From search'){
|
||||||
if ($this->queriedContext==='From search')
|
|
||||||
{
|
|
||||||
$avatar = $div->find('div.creditImg', 0)->find('img', 0);
|
$avatar = $div->find('div.creditImg', 0)->find('img', 0);
|
||||||
$avatar = $avatar->getAttribute('data-src');
|
$avatar = $avatar->getAttribute('data-src');
|
||||||
$avatar = str_replace("\\", "", $avatar);
|
$avatar = str_replace("\\", "", $avatar);
|
||||||
|
|
||||||
|
|
||||||
$username = $div->find('div.creditName', 0);
|
$username = $div->find('div.creditName', 0);
|
||||||
$board = $div->find('div.creditTitle', 0);
|
$board = $div->find('div.creditTitle', 0);
|
||||||
|
|
||||||
|
@ -62,15 +58,18 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
$item['fullname'] = $board->innertext;
|
$item['fullname'] = $board->innertext;
|
||||||
$item['avatar'] = $avatar;
|
$item['avatar'] = $avatar;
|
||||||
|
|
||||||
$item['content'] .= '<br /><img align="left" style="margin: 2px 4px;" src="'.htmlentities($item['avatar']).'" /> <strong>'.$item['username'].'</strong>';
|
$item['content'] .= '<br /><img align="left" style="margin: 2px 4px;" src="'
|
||||||
$item['content'] .= '<br />'.$item['fullname'];
|
. htmlentities($item['avatar'])
|
||||||
|
. '" /> <strong>'
|
||||||
|
. $item['username']
|
||||||
|
. '</strong>'
|
||||||
|
. '<br />'
|
||||||
|
. $item['fullname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['title'] = $img->getAttribute('alt');
|
$item['title'] = $img->getAttribute('alt');
|
||||||
|
|
||||||
//$item['timestamp'] = $media->created_time;
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +82,6 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
$uri = self::URI . 'search/?q=' . urlencode($this->getInput('q'));
|
$uri = self::URI . 'search/?q=' . urlencode($this->getInput('q'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue