/**
  * Returns the URL to the Facebook JavaScript SDK. If $wgFbScript contains
  * a %LOCALE% token, it will be replaced with the current user's language.
  * Additionally, the URL is appended with a fragment containing the app ID
  * and an option to render XFBML tags.
  */
 private static function getFbScript()
 {
     global $wgFbScript, $wgLang, $wgFbAppId, $wgFbSocialPlugins;
     static $fbScript = '';
     // In MW <= 1.17 this runs from two different hooks
     if ($fbScript === '') {
         $fbScript = $wgFbScript;
         // Check to see if we should localize the JS SDK
         if (strpos($fbScript, FACEBOOK_LOCALE) !== false) {
             wfProfileIn(__METHOD__ . '::fb-locale-by-mediawiki-lang');
             // NOTE: Can't use $wgLanguageCode here because the same Facebook config
             // can run for many $wgLanguageCode's on one site (such as Wikia).
             $locale = FacebookLanguage::getFbLocaleForLangCode($wgLang->getCode());
             $fbScript = str_replace(FACEBOOK_LOCALE, $locale, $fbScript);
             wfProfileOut(__METHOD__ . '::fb-locale-by-mediawiki-lang');
         }
         // Give Facebook some hints. Commented out because they don't affect anything...
         #$fbScript .= '#appId=' . $wgFbAppId .
         #             '&xfbml=' . (!empty( $wgFbSocialPlugins ) ? '1' : '0');
     }
     return $fbScript;
 }
 function __construct($file)
 {
     $title = $file->getTitle();
     // og:type
     $this->properties['og:type'] = $this->translateType($this->defaultType);
     // og:url
     $this->properties['og:url'] = $title->getFullURL();
     // og:updated_time
     $article = new Article($title, 0);
     $timestamp = $article->getTimestamp(TS_UNIX, $article->getTimestamp());
     $this->properties['og:updated_time'] = $timestamp;
     // og:locale
     global $wgVersion;
     if (version_compare($wgVersion, '1.18', '>=')) {
         // Title::getPageLanguage() is since 1.18
         $langCode = $title->getPageLanguage()->getCode();
     } else {
         global $wgContLang;
         $langCode = $wgContLang->getCode();
     }
     $this->properties['og:locale'] = FacebookLanguage::getFbLocaleForLangCode($langCode);
     // og:title
     $this->properties['og:title'] = $file->getName();
     // og:image
     if ($file->getMediaType() == MEDIATYPE_BITMAP) {
         $this->properties['og:image'] = $file->getCanonicalUrl();
     } else {
         global $wgServer;
         $this->properties['og:image'] = $wgServer . $file->iconThumb()->url;
     }
     // og:description
     // TODO: This crashes MediaWiki because messages cannot be loaded or some bullshit
     // The problem is that message decoding calls MessageCache::parse(), which calls
     // message decoding, which again calls MessageCache::parse(). To provide reentrancy,
     // MessageCache::parse() violates its signature by returning a string instead of an
     // object. You dirty little bastard, you.
     //$this->properties['og:description'] = $file->getLongDesc();
     parent::__construct();
 }