$this->rules[DF_NONE][DF_ISO2] = DF_ISO1;
}
+ /**
+ * @static
+ */
+ function &getInstance() {
+ global $wgDBname, $wgMemc;
+ static $dateFormatter = false;
+ if ( !$dateFormatter ) {
+ $dateFormatter = $wgMemc->get( "$wgDBname:dateformatter" );
+ if ( !$dateFormatter ) {
+ $dateFormatter = new DateFormatter;
+ $wgMemc->set( "$wgDBname:dateformatter", $dateFormatter, 3600 );
+ }
+ }
+ return $dateFormatter;
+ }
+
/**
* @param $preference
* @param $text
* @todo document
*/
function wfMainDateReplace( $matches ) {
- global $wgDateFormatter;
- return $wgDateFormatter->replace( $matches );
+ $df =& DateFormatter::getInstance();
+ return $df->replace( $matches );
}
+
?>
* performs brace substitution on MediaWiki messages
*
* Globals used:
- * objects: $wgLang, $wgDateFormatter, $wgLinkCache
+ * objects: $wgLang, $wgLinkCache
*
* NOT $wgArticle, $wgUser or $wgTitle. Keep them away!
*
$text = $this->doHeadings( $text );
if($this->mOptions->getUseDynamicDates()) {
- global $wgDateFormatter;
- $text = $wgDateFormatter->reformat( $this->mOptions->getDateFormat(), $text );
+ $df =& DateFormatter::getInstance();
+ $text = $df->reformat( $this->mOptions->getDateFormat(), $text );
}
$text = $this->doAllQuotes( $text );
$text = $this->replaceInternalLinks( $text );
{
# All variables are private
var $mUseTeX; # Use texvc to expand <math> tags
- var $mUseDynamicDates; # Use $wgDateFormatter to format dates
+ var $mUseDynamicDates; # Use DateFormatter to format dates
var $mInterwikiMagic; # Interlanguage links are removed and returned in an array
var $mAllowExternalImages; # Allow external images inline
var $mSkin; # Reference to the preferred skin
require_once( 'ProxyTools.php' );
require_once( 'ObjectCache.php' );
+if ( $wgUseDynamicDates ) {
+ require_once( 'DateFormatter.php' );
+}
+
wfProfileOut( $fname.'-includes' );
wfProfileIn( $fname.'-misc1' );
$wgOut = new OutputPage();
wfProfileOut( $fname.'-OutputPage' );
-wfProfileIn( $fname.'-DateFormatter' );
-
-if ( $wgUseDynamicDates ) {
- require_once( 'DateFormatter.php' );
- $wgDateFormatter = new DateFormatter;
-}
-
-wfProfileOut( $fname.'-DateFormatter' );
wfProfileIn( $fname.'-BlockCache' );
$wgBlockCache = new BlockCache( true );