/**
 * Places album and all of its album pages on one sitemap
 *
 * Gets links to all albums incl. pagination and if the Google image video extension is enabled for images using this as well.
 * This is independent from the images fetched by getSitemapImages().
 *
 * NOTE: Using the Google extension is currently NOT recommended if you have a huge gallery.
 *
 * @return string
 */
function getSitemapAlbums()
{
    global $_zp_gallery, $sitemap_number;
    $data = '';
    $sitemap_locales = generateLanguageList();
    $albumchangefreq = getOption('sitemap_changefreq_albums');
    $imagechangefreq = getOption('sitemap_changefreq_images');
    $albumlastmod = getOption('sitemap_lastmod_albums');
    $albumlastmod = sanitize($albumlastmod);
    $imagelastmod = getOption('sitemap_lastmod_images');
    $albums = array();
    getSitemapAlbumList($_zp_gallery, $albums, 'passAlbums');
    $offset = $sitemap_number - 1;
    $albums = array_slice($albums, $offset, SITEMAP_CHUNK);
    if (!empty($albums)) {
        $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
        $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
        foreach ($albums as $album) {
            $albumobj = newAlbum($album['folder']);
            set_context(ZP_ALBUM);
            makeAlbumCurrent($albumobj);
            $pageCount = getTotalPages();
            //$imageCount = getNumImages();
            //$images = $albumobj->getImages();
            $date = sitemap_getDateformat($albumobj, $albumlastmod);
            switch (SITEMAP_LOCALE_TYPE) {
                case 1:
                    foreach ($sitemap_locales as $locale) {
                        $url = seo_locale::localePath(true, $locale) . '/' . pathurlencode($albumobj->name);
                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                        $data .= sitemap_echonl("\t</url>");
                    }
                    break;
                case 2:
                    foreach ($sitemap_locales as $locale) {
                        $url = rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), dynamic_locale::fullHostPath($locale));
                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                        $data .= sitemap_echonl("\t</url>");
                    }
                    break;
                default:
                    $url = rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), FULLWEBPATH);
                    $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                    $data .= sitemap_echonl("\t</url>");
                    break;
            }
            // print album pages if avaiable
            if ($pageCount > 1) {
                for ($x = 2; $x <= $pageCount; $x++) {
                    switch (SITEMAP_LOCALE_TYPE) {
                        case 1:
                            foreach ($sitemap_locales as $locale) {
                                $url = seo_locale::localePath(true, $locale) . '/' . pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x;
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                                $data .= sitemap_echonl("\t</url>");
                            }
                            break;
                        case 2:
                            foreach ($sitemap_locales as $locale) {
                                $url = rewrite_path(pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x, '?album=' . pathurlencode($albumobj->name) . '&amp;page=' . $x, dynamic_locale::fullHostPath($locale));
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                                $data .= sitemap_echonl("\t</url>");
                            }
                            break;
                        default:
                            $url = rewrite_path(pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x, '?album=' . pathurlencode($albumobj->name) . '&amp;page=' . $x, FULLWEBPATH);
                            $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                            $data .= sitemap_echonl("\t</url>");
                            break;
                    }
                }
            }
        }
        $data .= sitemap_echonl('</urlset>');
        // End off the <urlset> tag
    }
    restore_context();
    return $data;
}
Example #2
0
        case "latest-mtime":
            echo gettext('Latest Images');
            $minigalstat = true;
            break;
        case "mostrated":
            echo gettext('Most Rated Images');
            $minigalstat = true;
            break;
        case "toprated":
            echo gettext('Top Rated Images');
            $minigalstat = true;
            break;
        case "specific":
            save_context();
            $album = new Album($_zp_gallery, $zpgal_minigalspecified);
            makeAlbumCurrent($album);
            echo getAlbumTitle();
            break;
    }
    ?>
			</div>
			<div id="homegal-wrap">
				<div class="container" id="home-right">
					<div class="content">
						<div class="slideshow-container">
							<div id="loading" class="loader"></div>
							<div id="slideshow" class="slideshow"></div>
						</div>
						<div id="caption" class="caption-container">

						</div>
/**
 * Places album and all of its album pages on one sitemap
 *
 * Gets links to all albums incl. pagination and if the Google image video extension is enabled for images using this as well.
 * This is independent from the images fetched by getSitemapImages().
 *
 * NOTE: Using the Google extension is currently NOT recommended if you have a huge gallery.
 *
 * @return string
 */
function getSitemapAlbums()
{
    global $_zp_gallery, $sitemap_number;
    $data = '';
    $sitemap_locales = generateLanguageList();
    $albumchangefreq = getOption('sitemap_changefreq_albums');
    $imagechangefreq = getOption('sitemap_changefreq_images');
    $albumlastmod = getOption('sitemap_lastmod_albums');
    $albumlastmod = sanitize($albumlastmod);
    $imagelastmod = getOption('sitemap_lastmod_images');
    $albums = array();
    getSitemapAlbumList($_zp_gallery, $albums, 'passAlbums');
    $offset = $sitemap_number - 1;
    $albums = array_slice($albums, $offset, SITEMAP_CHUNK);
    if (!empty($albums)) {
        $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
        if (getOption('sitemap_google')) {
            $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">');
        } else {
            $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
        }
        foreach ($albums as $album) {
            $albumobj = new Album($_zp_gallery, $album['folder']);
            set_context(ZP_ALBUM);
            makeAlbumCurrent($albumobj);
            //getting the album pages
            /* Custom images/albums per page taken out as it is not possible to set these now anymore. Maybe later becomes an options
            			$images_per_page = getOption('images_per_page');
            			$albums_per_page = getOption('albums_per_page');
            			if(is_array($imagesperpage)) {
            				foreach($imagesperpage as $alb=>$number) {
            					if($alb == $albumobj->name) {
            						setOption('images_per_page',$number,false);
            					} else {
            						setOption('images_per_page',$images_per_page);
            					}
            				}
            			}
            			if(is_array($albumsperpage)) {
            				foreach($albumsperpage as $alb=>$number) {
            					if($alb == $albumobj->name) {
            						setOption('albums_per_page',$number,false);
            					} else {
            						setOption('albums_per_page',$albums_per_page);
            					}
            				}
            			} */
            $pageCount = getTotalPages();
            $imageCount = getNumImages();
            $images = $albumobj->getImages();
            $loop_index = getSitemapGoogleLoopIndex($imageCount, $pageCount);
            $date = sitemap_getDateformat($albumobj, $albumlastmod);
            if (sitemap_multilingual()) {
                foreach ($sitemap_locales as $locale) {
                    $url = FULLWEBPATH . '/' . rewrite_path($locale . '/' . pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), false);
                    $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                    printSitemapGoogleImageVideoExtras(1, $loop_index, $albumobj, $images);
                    $data .= sitemap_echonl("\t</url>");
                }
            } else {
                $url = FULLWEBPATH . '/' . rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), false);
                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                $data .= getSitemapGoogleImageVideoExtras(1, $loop_index, $albumobj, $images);
                $data .= sitemap_echonl("\t</url>");
            }
            // print album pages if avaiable
            if ($pageCount > 1) {
                for ($x = 2; $x <= $pageCount; $x++) {
                    if (sitemap_multilingual()) {
                        foreach ($sitemap_locales as $locale) {
                            $url = FULLWEBPATH . '/' . rewrite_path($locale . '/' . pathurlencode($albumobj->name) . '/page/' . $x, '?album=' . pathurlencode($albumobj->name) . '&amp;page=' . $x, false);
                            $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                            $data .= getSitemapGoogleImageVideoExtras($x, $loop_index, $albumobj, $images);
                            $data .= sitemap_echonl("\t</url>");
                        }
                    } else {
                        $url = FULLWEBPATH . '/' . rewrite_path(pathurlencode($albumobj->name) . '/page/' . $x, '?album=' . pathurlencode($albumobj->name) . '&amp;page=' . $x, false);
                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n");
                        $data .= getSitemapGoogleImageVideoExtras($x, $loop_index, $albumobj, $images);
                        $data .= sitemap_echonl("\t</url>");
                    }
                }
            }
        }
        $data .= sitemap_echonl('</urlset>');
        // End off the <urlset> tag
    }
    restore_context();
    return $data;
}