diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
commit | 04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch) | |
tree | d83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /inc/Sitemapper.php | |
parent | 1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff) | |
parent | a731ed1d6736ca405b3559adfd9500affcc59412 (diff) | |
download | rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2 |
Merge branch 'master' into proxyconnect
* master: (169 commits)
added PCRE UTF-8 checks to do=check FS#2636
avoid multiple paralell update checks
fix regression bug in HTTPClient FS#2621
changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER
TarLib code cleanup
TarLib: fixed appending in non-dynamic mode
fixed third method of adding files in TarLib
fix lone zero block in TarLib created archives
fix use of constructor in TarLib
Slovak language update
Korean language update
Latvian language update
added event PAGEUTILS_ID_HIDEPAGE
added test for isHiddenPage()
removed redundant variables in tpl_include_page() (because of 3ff8773b)
added cut off points for mobile devices as parameters to style.ini
Corrected typo: ruke -> rule
Persian language update
Spanish language update
russian language update
...
Diffstat (limited to 'inc/Sitemapper.php')
-rw-r--r-- | inc/Sitemapper.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/inc/Sitemapper.php b/inc/Sitemapper.php index bbea73b52..bf89a311c 100644 --- a/inc/Sitemapper.php +++ b/inc/Sitemapper.php @@ -63,11 +63,11 @@ class Sitemapper { $event = new Doku_Event('SITEMAP_GENERATE', $eventData); if ($event->advise_before(true)) { //save the new sitemap - $result = io_saveFile($sitemap, Sitemapper::getXML($items)); + $event->result = io_saveFile($sitemap, Sitemapper::getXML($items)); } $event->advise_after(); - return $result; + return $event->result; } /** @@ -82,6 +82,7 @@ class Sitemapper { echo '<?xml version="1.0" encoding="UTF-8"?>'.NL; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.NL; foreach ($items as $item) { + /** @var SitemapItem $item */ echo $item->toXML(); } echo '</urlset>'.NL; @@ -93,14 +94,14 @@ class Sitemapper { /** * Helper function for getting the path to the sitemap file. * - * @return The path to the sitemap file. + * @return string The path to the sitemap file. * @author Michael Hamann */ public static function getFilePath() { global $conf; $sitemap = $conf['cachedir'].'/sitemap.xml'; - if($conf['compression'] === 'bz2' || $conf['compression'] === 'gz'){ + if (self::sitemapIsCompressed()) { $sitemap .= '.gz'; } @@ -108,6 +109,16 @@ class Sitemapper { } /** + * Helper function for checking if the sitemap is compressed + * + * @return bool If the sitemap file is compressed + */ + public static function sitemapIsCompressed() { + global $conf; + return $conf['compression'] === 'bz2' || $conf['compression'] === 'gz'; + } + + /** * Pings search engines with the sitemap url. Plugins can add or remove * urls to ping using the SITEMAP_PING event. * @@ -175,7 +186,7 @@ class SitemapItem { * @param $id string A wikipage id. * @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. * @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. - * @return The sitemap item. + * @return SitemapItem The sitemap item. */ public static function createFromID($id, $changefreq = null, $priority = null) { $id = trim($id); @@ -187,7 +198,7 @@ class SitemapItem { /** * Get the XML representation of the sitemap item. * - * @return The XML representation. + * @return string The XML representation. */ public function toXML() { $result = ' <url>'.NL |