Пример #1
0
 /**
  * Prepare the content for the 'last edited' message, e.g. 'Last edited on 30 August
  * 2013, at 23:31'. This message is different for the main page since main page
  * content is typically transcuded rather than edited directly.
  * @param Title $title The Title object of the page being viewed
  * @return array
  */
 protected function getHistoryLink(Title $title)
 {
     $user = $this->getUser();
     $isMainPage = $title->isMainPage();
     $mp = new Page($this->getTitle(), false);
     $timestamp = $mp->getLatestTimestamp();
     // Main pages tend to include transclusions (see bug 51924)
     if ($isMainPage) {
         $lastModified = $this->msg('mobile-frontend-history')->plain();
     } else {
         $lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse();
     }
     $historyUrl = $title->getFullURL('action=history');
     if ($this->mobileContext) {
         $historyUrl = $this->mobileContext->getMobileUrl($historyUrl);
     }
     $edit = $mp->getLatestEdit();
     $link = array('data-timestamp' => $isMainPage ? '' : $edit['timestamp'], 'href' => $historyUrl, 'text' => $lastModified, 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']);
     $link['href'] = SpecialPage::getTitleFor('History', $title)->getLocalURL();
     return $link;
 }