Hi,
Attach is a plugin to load images from StreetViewFun rss feed.
Enjoy
Psylox
[Plugin] StreetViewFun
[Plugin] StreetViewFun
- Attachments
-
- streetviewfun.tar.gz
- (692 Bytes) Downloaded 162 times
-
- Bear Rating Trainee
- Posts: 7
- Joined: 01 Apr 2013, 19:25
Re: [Plugin] StreetViewFun
Just saw this post pop up in TTRS and thought, "I'll bet this was inspired by that Aussie bird who flashed her mams at the Google car".
Lo and behold, that story is on the front page of StreetViewFun.
Lulz.
Lo and behold, that story is on the front page of StreetViewFun.
Lulz.
Re: [Plugin] StreetViewFun
Ahaha absolutely! Or maybe the "OMG it's an alien" at the end of the home page who inspired me ![Smile :)](images/smilies/icon_smile.gif)
![Smile :)](images/smilies/icon_smile.gif)
Re: [Plugin] StreetViewFun
Hi,
Due to a bug with php-5.6.9 and DOMDocument::loadHTML, the updated script is:
Just to point out changes to those are interested in it:
Cheers
Due to a bug with php-5.6.9 and DOMDocument::loadHTML, the updated script is:
Code: Select all
<?php
class StreetViewFun extends Plugin {
private $host;
function about() {
return array(1.0,
"Fixes RSS feeds of included images",
"psylox");
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
}
function hook_article_filter($article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["link"], "Streetviewfun/") !== FALSE) {
$page = fetch_file_contents($article["link"]);
$page = str_replace("\x0", ' ', $page);
$doc = new DOMDocument();
$doc->loadHTML($page);
$basenode = false;
if ($doc) {
$xpath = new DOMXPath($doc);
$basenode = $xpath->query('(//div[@class="entry_content"])')->item(0);
if ($basenode) {
foreach($xpath->query('*[not(self::p)]', $basenode) as $node)
$basenode->removeChild($node);
$article["content"] = $doc->saveXML($basenode);
}
else
$article["content"] = "BaseNode not found<br/><br/>".$doc->saveXML();
}
else
$article["content"] = "Fetch content or load HTML failed";
}
return $article;
}
function api_version() {
return 2;
}
}
?>
Just to point out changes to those are interested in it:
Code: Select all
if (strpos($article["link"], "Streetviewfun/") !== FALSE) {
$page = fetch_file_contents($article["link"]);
$page = str_replace("\x0", ' ', $page);
$doc = new DOMDocument();
Cheers
Return to “Themes and plugins”
Who is online
Users browsing this forum: No registered users and 2 guests