Skip to content
Snippets Groups Projects
Commit 47251657 authored by Michael Hamann's avatar Michael Hamann
Browse files

Make Sitemapper functions static as they were used as static functions

All calls to the Sitemapper were static function calls, this caused
notices because they weren't static, with this commit they are marked as
static. Furthermore two FIXME comments were removed as dbglog now checks
if debugging is enabled.
parent fbb51550
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ class Sitemapper { ...@@ -25,7 +25,7 @@ class Sitemapper {
* @link https://www.google.com/webmasters/sitemaps/docs/en/about.html * @link https://www.google.com/webmasters/sitemaps/docs/en/about.html
* @link http://www.sitemaps.org/ * @link http://www.sitemaps.org/
*/ */
public function generate(){ public static function generate(){
global $conf; global $conf;
if($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) return false; if($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) return false;
...@@ -39,11 +39,11 @@ class Sitemapper { ...@@ -39,11 +39,11 @@ class Sitemapper {
if(@filesize($sitemap) && if(@filesize($sitemap) &&
@filemtime($sitemap) > (time()-($conf['sitemap']*86400))){ // 60*60*24=86400 @filemtime($sitemap) > (time()-($conf['sitemap']*86400))){ // 60*60*24=86400
dbglog('Sitemapper::generate(): Sitemap up to date'); // FIXME: only in debug mode dbglog('Sitemapper::generate(): Sitemap up to date');
return false; return false;
} }
dbglog("Sitemapper::generate(): using $sitemap"); // FIXME: Only in debug mode dbglog("Sitemapper::generate(): using $sitemap");
$pages = idx_get_indexer()->getPages(); $pages = idx_get_indexer()->getPages();
dbglog('Sitemapper::generate(): creating sitemap using '.count($pages).' pages'); dbglog('Sitemapper::generate(): creating sitemap using '.count($pages).' pages');
...@@ -77,7 +77,7 @@ class Sitemapper { ...@@ -77,7 +77,7 @@ class Sitemapper {
* @return string The sitemap XML. * @return string The sitemap XML.
* @author Michael Hamann * @author Michael Hamann
*/ */
private function getXML($items) { private static function getXML($items) {
ob_start(); ob_start();
echo '<?xml version="1.0" encoding="UTF-8"?>'.NL; echo '<?xml version="1.0" encoding="UTF-8"?>'.NL;
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.NL; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.NL;
...@@ -96,7 +96,7 @@ class Sitemapper { ...@@ -96,7 +96,7 @@ class Sitemapper {
* @return The path to the sitemap file. * @return The path to the sitemap file.
* @author Michael Hamann * @author Michael Hamann
*/ */
public function getFilePath() { public static function getFilePath() {
global $conf; global $conf;
$sitemap = $conf['cachedir'].'/sitemap.xml'; $sitemap = $conf['cachedir'].'/sitemap.xml';
...@@ -113,7 +113,7 @@ class Sitemapper { ...@@ -113,7 +113,7 @@ class Sitemapper {
* *
* @author Michael Hamann * @author Michael Hamann
*/ */
public function pingSearchEngines() { public static function pingSearchEngines() {
//ping search engines... //ping search engines...
$http = new DokuHTTPClient(); $http = new DokuHTTPClient();
$http->timeout = 8; $http->timeout = 8;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment