|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
<?php // wcf imports require_once(WCF_DIR.'lib/page/AbstractPage.class.php'); /** * Prints a sitemap * * @author Torben Brodt * @package de.easy-coding.wcf.sitemaps * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html> */ class SitemapsPage extends AbstractPage { protected $type; public $index = false; /** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (intval(count($_GET)) == intval(1)) { $this->index = true; } } /** * * @param type */ public function setType($type) { $this->type = $type; } /** * @see Page::assignVariables() */ public function readData() { parent::readData(); // send header @header('Content-Type: application/xml; charset='.CHARSET); echo '<?xml version="1.0" encoding="'.CHARSET.'"?>'; switch($this->type) { case 'sitemapindex': echo '<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">'; break; case 'urlset': echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">'; break; } } /** * @see Page::show() */ public function show() { parent::show(); switch($this->type) { case 'sitemapindex': echo '</sitemapindex>'; break; case 'urlset': echo '</urlset>'; break; } } } ?> |
This post has been edited 1 times, last edit by "panicmaker" (Dec 6th 2011, 10:32pm)
This post has been edited 1 times, last edit by "panicmaker" (Dec 10th 2011, 12:24am)