\n"; } /** * Add the javascript required to enable PicLens/CoolIris support */ function add_piclens_javascript() { echo "\n" . ''; if (is_ssl()) echo "\n" . ''; else echo "\n" . ''; echo "\n" . ''; } /** * Get the URL of the general media RSS */ function get_mrss_url() { return NGGALLERY_URLPATH . 'xml/media-rss.php'; } /** * Get the URL of a gallery media RSS */ function get_gallery_mrss_url($gid, $prev_next = false) { return nggMediaRss::get_mrss_url() . '?' . ('gid=' . $gid . ($prev_next ? '&prev_next=true' : '') . '&mode=gallery'); } /** * Get the URL of an album media RSS */ function get_album_mrss_url($aid) { return nggMediaRss::get_mrss_url() . '?' . ('aid=' . $aid . '&mode=album'); } /** * Get the URL of the media RSS for last pictures */ function get_last_pictures_mrss_url($page = 0, $show = 30) { return nggMediaRss::get_mrss_url() . '?' . ('show=' . $show . '&page=' . $page . '&mode=last_pictures'); } /** * Get the XML node corresponding to the last pictures registered * * @param page The current page (defaults to 0) * @param show The number of pictures to include in one field (default 30) */ function get_last_pictures_mrss($page = 0, $show = 30) { $images = nggdb::find_last_images($page, $show); $title = stripslashes(get_option('blogname')); $description = stripslashes(get_option('blogdescription')); $link = site_url(); $prev_link = ($page > 0) ? nggMediaRss::get_last_pictures_mrss_url($page-1, $show) : ''; $next_link = count($images)!=0 ? nggMediaRss::get_last_pictures_mrss_url($page+1, $show) : ''; return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images); } /** * Get the XML node corresponding to a gallery * * @param $gallery (object) The gallery to include in RSS * @param $prev_gallery (object) The previous gallery to link in RSS (null if none) * @param $next_gallery (object) The next gallery to link in RSS (null if none) */ function get_gallery_mrss($gallery, $prev_gallery = null, $next_gallery = null) { $ngg_options = nggGallery::get_option('ngg_options'); //Set sort order value, if not used (upgrade issue) $ngg_options['galSort'] = ($ngg_options['galSort']) ? $ngg_options['galSort'] : 'pid'; $ngg_options['galSortDir'] = ($ngg_options['galSortDir'] == 'DESC') ? 'DESC' : 'ASC'; $title = stripslashes(nggGallery::i18n($gallery->title)); $description = stripslashes(nggGallery::i18n($gallery->galdesc)); $link = nggMediaRss::get_permalink($gallery->pageid); $prev_link = ( $prev_gallery != null) ? nggMediaRss::get_gallery_mrss_url($prev_gallery->gid, true) : ''; $next_link = ( $next_gallery != null) ? nggMediaRss::get_gallery_mrss_url($next_gallery->gid, true) : ''; $images = nggdb::get_gallery($gallery->gid, $ngg_options['galSort'], $ngg_options['galSortDir']); return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images); } /** * Get the XML node corresponding to an album * * @param $album The album to include in RSS */ function get_album_mrss($album) { $title = stripslashes(nggGallery::i18n($album->name)); $description = ''; $link = nggMediaRss::get_permalink(0); $prev_link = ''; $next_link = ''; $images = nggdb::find_images_in_album($album->id); return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images); } /** * Get the XML node */ function get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images) { if ($prev_link != '' || $next_link != '') $out = "\n" ; else $out = "\n"; $out .= "\t\n"; $out .= nggMediaRss::get_generator_mrss_node(); $out .= nggMediaRss::get_title_mrss_node($title); $out .= nggMediaRss::get_description_mrss_node($description); $out .= nggMediaRss::get_link_mrss_node($link); if ($prev_link != '' || $next_link != '') $out .= nggMediaRss::get_self_node(nggMediaRss::get_mrss_url()); if ($prev_link!='') { $out .= nggMediaRss::get_previous_link_mrss_node($prev_link); } if ($next_link!='') { $out .= nggMediaRss::get_next_link_mrss_node($next_link); } foreach ($images as $image) { $out .= nggMediaRss::get_image_mrss_node($image); } $out .= "\t\n"; $out .= "\n"; return $out; } /** * Get the XML node */ function get_generator_mrss_node($indent = "\t\t") { return $indent . "\n"; } /** * Get the XML node */ function get_title_mrss_node($title, $indent = "\t\t") { return $indent . "<title>" . $title . "\n"; } /** * Get the XML node */ function get_description_mrss_node($description, $indent = "\t\t") { return $indent . "" . $description . "\n"; } /** * Get the XML node */ function get_link_mrss_node($link, $indent = "\t\t") { return $indent . "\n"; } /** * Get the XML node */ function get_self_node($link, $indent = "\t\t") { return $indent . "\n"; } /** * Get the XML node */ function get_previous_link_mrss_node($link, $indent = "\t\t") { return $indent . "\n"; } /** * Get the XML node */ function get_next_link_mrss_node($link, $indent = "\t\t") { return $indent . "