* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Self explanatory
*/
class RSS_Images extends Extension {
public function onPostListBuilding(PostListBuildingEvent $event) {
global $config, $page;
$title = $config->get_string('title');
if(count($event->search_terms) > 0) {
$search = html_escape(implode(' ', $event->search_terms));
$page->add_html_header("");
}
else {
$page->add_html_header("");
}
}
public function onPageRequest(PageRequestEvent $event) {
if($event->page_matches("rss/images")) {
$search_terms = $event->get_search_terms();
$page_number = $event->get_page_number();
$page_size = $event->get_page_size();
$images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms);
$this->do_rss($images, $search_terms, $page_number);
}
}
/**
* @param array $images
* @param array $search_terms
* @param int $page_number
*/
private function do_rss($images, $search_terms, /*int*/ $page_number) {
global $page;
global $config;
$page->set_mode("data");
$page->set_type("application/rss+xml");
$data = "";
foreach($images as $image) {
$data .= $this->thumb($image);
}
$title = $config->get_string('title');
$base_href = make_http(get_base_href());
$search = "";
if(count($search_terms) > 0) {
$search = url_escape(implode(" ", $search_terms)) . "/";
}
if($page_number > 1) {
$prev_url = make_link("rss/images/$search".($page_number-1));
$prev_link = "
" . $this->theme->build_thumb_html($image) . "
" . "Uploaded by " . html_escape($owner->name) . "
" ); $data = "