* License: GPLv2 * Description: Self explanitory */ class RSS_Images extends SimpleExtension { public function onPostListBuilding($event) { global $config, $page; $title = $config->get_string('title'); if(count($event->search_terms) > 0) { $search = implode(' ', $event->search_terms); $page->add_header(""); } else { $page->add_header(""); } } public function onPageRequest($event) { if($event->page_matches("rss/images")) { $page_number = 0; $search_terms = array(); if($event->count_args() == 1) { $page_number = int_escape($event->get_arg(0)); // compat hack, deprecate this later if($page_number == 0) { $search_terms = explode(' ', $event->get_arg(0)); $page_number = 1; } } else if($event->count_args() == 2) { $search_terms = explode(' ', $event->get_arg(0)); $page_number = int_escape($event->get_arg(1)); } $images = Image::find_images(($page_number-1)*10, 10, $search_terms); $this->do_rss($images, $search_terms, $page_number); } } private function do_rss($images, $search_terms, $page_number) { global $page; global $config; $page->set_mode("data"); $page->set_type("application/rss+xml"); $data = ""; foreach($images as $image) { $link = make_http(make_link("post/view/{$image->id}")); $tags = $image->get_tag_list(); $owner = $image->get_owner(); $thumb_url = $image->get_thumb_link(); $image_url = $image->get_image_link(); $posted = date(DATE_RSS, $image->posted_timestamp); $content = html_escape( "
" . Themelet::build_thumb_html($image) . "
" . "Uploaded by " . $owner->name . "
" ); $data .= "