Extension:Kw bread crumbs/Source

';    }  $output .= ' ';

// Hack to display the titles on top: // - only if monobook // - piggy-back after the site notice (wgSiteNotice) // - remove border if <= 1.3.0 beta, alpha, etc.

if ($on_top_hack) {   $user_skin_name = $wgUser->getOption('skin'); if ($user_skin_name == "monobook") {     global $wgSiteNotice, $wgVersion; if (!$wgSiteNotice || !strpos($wgSiteNotice, $class)) {       if (preg_match("/^(\d+)\.(\d+)\.(\d+)(\w*)$/", $wgVersion, $ver)) {         $new_notice = NULL; if ($ver[1] == 1 && $ver[2] == 3 && $ver[3] == 0 && isset($ver[4])) {           $new_notice .= ' '; }         $new_notice .= ' '. $output; if ($wgSiteNotice) {           $new_notice .= ' '. $wgSiteNotice; }         else {           $new_notice .= ' '; }         $wgSiteNotice = $new_notice; }       }      }    return ''; }

return $output; }

// function kwBreadCrumbsError($msg) { return "[kw_bread_crumbs] Error: ". htmlspecialchars($msg); }

// function kwBreadCrumbsNoCache { global $wgTitle, $wgOut; if (!isset($wgTitle) || !isset($wgOut)) {   return; }

/*   Let's 'touch' the page to invalidate its cache. The code below is slightly identical to Title::invalidateCache. Even though invalidateCache sets cur_touched to 'now', we are still in the process of creating and rendering the page itself and the page will be cached only once it is done. At the end of the day the cache would always end up newer than cur_touched, defeating the whole purpose of calling invalidateCache. The trick here is to set cur_touched in the future, something not too intrusive, say 'now' + 120 seconds, provided that we expect the cached page to be created within 120 secs after this extension code has been executed. That way, cur_touched remains 'fresher' than the cache, and the page is always re-created dynamically. */

$ts = mktime; $now = gmdate("YmdHis", $ts + 120); $ns = $wgTitle->getNamespace; $ti = wfStrencode($wgTitle->getDBkey); $sql = "UPDATE page SET page_touched='$now' WHERE page_namespace=$ns AND page_title='$ti'"; wfQuery($sql, DB_WRITE, "kwBreadCrumbsNoCache");

// This does not seem to do anything. I assume once it's called here // in the extension, it's already too late.

$wgOut->enableClientCache(false);

// The followings should prevent browsers to cache too long

/* $wgOut->addMeta("http:Pragma", "no-cache"); $wgOut->addMeta("http:no-cache", NULL); $wgOut->addMeta("http:EXPIRES", "TUES, 31 DEC 1996 12:00:00 GMT"); */

// HTTP_IF_MODIFIED_SINCE ? // see OutputPage: checkLastModified }

// function kwBreadCrumbsTAL { return kwBreadCrumbs(''); }