Skip to content

Commit

Permalink
Make Sitemapper functions static as they were used as static functions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michitux committed Jan 15, 2012
1 parent fbb5155 commit 4725165
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions inc/Sitemapper.php
Expand Up @@ -25,7 +25,7 @@ class Sitemapper {
* @link https://www.google.com/webmasters/sitemaps/docs/en/about.html
* @link http://www.sitemaps.org/
*/
public function generate(){
public static function generate(){
global $conf;
if($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) return false;

Expand All @@ -39,11 +39,11 @@ public function generate(){

if(@filesize($sitemap) &&
@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;
}

dbglog("Sitemapper::generate(): using $sitemap"); // FIXME: Only in debug mode
dbglog("Sitemapper::generate(): using $sitemap");

$pages = idx_get_indexer()->getPages();
dbglog('Sitemapper::generate(): creating sitemap using '.count($pages).' pages');
Expand Down Expand Up @@ -77,7 +77,7 @@ public function generate(){
* @return string The sitemap XML.
* @author Michael Hamann
*/
private function getXML($items) {
private static function getXML($items) {
ob_start();
echo '<?xml version="1.0" encoding="UTF-8"?>'.NL;
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.NL;
Expand All @@ -96,7 +96,7 @@ private function getXML($items) {
* @return The path to the sitemap file.
* @author Michael Hamann
*/
public function getFilePath() {
public static function getFilePath() {
global $conf;

$sitemap = $conf['cachedir'].'/sitemap.xml';
Expand All @@ -113,7 +113,7 @@ public function getFilePath() {
*
* @author Michael Hamann
*/
public function pingSearchEngines() {
public static function pingSearchEngines() {
//ping search engines...
$http = new DokuHTTPClient();
$http->timeout = 8;
Expand Down

0 comments on commit 4725165

Please sign in to comment.