summaryrefslogtreecommitdiff
path: root/inc/Sitemapper.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-30 12:30:40 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-30 12:30:40 +0100
commitd14415e37072dbe16077efd700aee5bd33707b54 (patch)
tree062c3c190039ac9490f56598b0ee116de18c2480 /inc/Sitemapper.php
parent2ed38036a53a489d2fcadc46ce601f8c876fca31 (diff)
parent38479cbba628ee76a92ff5f3c974cfa8e6ce9e61 (diff)
downloadrpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.gz
rpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.bz2
Merge branch 'master' into subscription
* master: (175 commits) some coding style improvements added .idea project folder to gitignore use correct setUp method and parent calls. Correct German plugin manager translation (download != install) correct return in sendDigest() Fix case-insensitive match in ACL checking GeSHi update to 1.0.8.11 ignore empty header on mail sending remove empty BCC/CC mail headers Galician language update some welcome page changes Combine subsequent calls to strtr into a single transformation changed semicolon to colon in link to welcome page to make it less confusing fixed wrong sidebar showing in namespaces when sidebar is disabled Typo fix for TL;DR removed a bunch of outdated and irrelevant networking acronyms added another place to look for logo to make it more consistent (FS#2656) French language update Czech language update compat js findPosX/y more closely mimic historical function ... Conflicts: inc/auth.php inc/common.php inc/subscription.php lib/exe/indexer.php
Diffstat (limited to 'inc/Sitemapper.php')
-rw-r--r--inc/Sitemapper.php23
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