/**
  *
  * @param Title $oTitle
  * @return false|\ViewStateBarTopElement
  */
 private function makeStateBarTopLastEdited($oTitle)
 {
     wfProfileIn('BS::' . __METHOD__);
     $oLastEditView = new ViewStateBarTopElement();
     $oArticle = Article::newFromID($oTitle->getArticleID());
     $iOldId = $this->getRequest()->getInt('oldid', 0);
     if ($oArticle instanceof Article == false) {
         return false;
     }
     if ($iOldId != 0) {
         $sTimestamp = Revision::getTimestampFromId($oArticle->getTitle(), $iOldId);
     } else {
         $sTimestamp = $oArticle->getTimestamp();
     }
     $sFormattedTimestamp = BsFormatConverter::mwTimestampToAgeString($sTimestamp, true);
     $sArticleHistoryPageLink = $oArticle->getTitle()->getLinkURL(array('diff' => 0, 'action' => 'historysubmit'));
     $oLastEditView->setKey('LastEdited');
     $oLastEditView->setIconSrc($this->getImagePath(true) . BsConfig::get('MW::ArticleInfo::ImageLastEdited'));
     $oLastEditView->setIconAlt(wfMessage('bs-articleinfo-last-edited')->plain());
     $oLastEditView->setText($sFormattedTimestamp);
     $oLastEditView->setTextLink($sArticleHistoryPageLink);
     $oLastEditView->setTextLinkTitle(wfMessage('bs-articleinfo-last-edited-tooltip')->plain());
     $oLastEditView->setDataAttribute('timestamp', wfTimestamp(TS_UNIX, $sTimestamp));
     wfRunHooks('BSArticleInfoBeforeAddLastEditView', array($this, &$oLastEditView));
     wfProfileOut('BS::' . __METHOD__);
     return $oLastEditView;
 }
 /**
  * Delivers a rendered list of shouts for the current page to be displayed in the shoutbox.
  * This function is called remotely via AJAX-Handler.
  * @param string $sOutput contains the rendered list
  * @return bool allow other hooked methods to be executed. Always true
  */
 public static function getShouts($iArticleId, $iLimit)
 {
     if (BsCore::checkAccessAdmission('readshoutbox') === false) {
         return "";
     }
     // do not allow negative page ids and pages that have 0 as id (e.g. special pages)
     if ($iArticleId <= 0) {
         return true;
     }
     if ($iLimit <= 0) {
         $iLimit = BsConfig::get('MW::ShoutBox::NumberOfShouts');
     }
     $sKey = BsCacheHelper::getCacheKey('BlueSpice', 'ShoutBox', $iArticleId, $iLimit);
     $aData = BsCacheHelper::get($sKey);
     $aData = false;
     if ($aData !== false) {
         wfDebugLog('BsMemcached', __CLASS__ . ': Fetching shouts from cache');
         $sOutput = $aData;
     } else {
         wfDebugLog('BsMemcached', __CLASS__ . ': Fetching shouts from DB');
         $sOutput = '';
         //return false on hook handler to break here
         $aTables = array('bs_shoutbox');
         $aFields = array('*');
         $aConditions = array('sb_page_id' => $iArticleId, 'sb_archived' => '0', 'sb_parent_id' => '0', 'sb_title' => '');
         $aOptions = array('ORDER BY' => 'sb_timestamp DESC', 'LIMIT' => $iLimit + 1);
         if (!wfRunHooks('BSShoutBoxGetShoutsBeforeQuery', array(&$sOutput, $iArticleId, &$iLimit, &$aTables, &$aFields, &$aConditions, &$aOptions))) {
             return $sOutput;
         }
         $dbr = wfGetDB(DB_SLAVE);
         $res = $dbr->select($aTables, $aFields, $aConditions, __METHOD__, $aOptions);
         $oShoutBoxMessageListView = new ViewShoutBoxMessageList();
         if ($dbr->numRows($res) > $iLimit) {
             $oShoutBoxMessageListView->setMoreLimit($iLimit + BsConfig::get('MW::ShoutBox::NumberOfShouts'));
         }
         $bShowAge = BsConfig::get('MW::ShoutBox::ShowAge');
         $bShowUser = BsConfig::get('MW::ShoutBox::ShowUser');
         $iCount = 0;
         while ($row = $dbr->fetchRow($res)) {
             $oUser = User::newFromId($row['sb_user_id']);
             $oProfile = BsCore::getInstance()->getUserMiniProfile($oUser);
             $sMessage = preg_replace_callback("#@(\\S*)#", "self::replaceUsernameInMessage", $row['sb_message']);
             $oShoutBoxMessageView = new ViewShoutBoxMessage();
             if ($bShowAge) {
                 $oShoutBoxMessageView->setDate(BsFormatConverter::mwTimestampToAgeString($row['sb_timestamp'], true));
             }
             if ($bShowUser) {
                 $oShoutBoxMessageView->setUsername($row['sb_user_name']);
             }
             $oShoutBoxMessageView->setUser($oUser);
             $oShoutBoxMessageView->setMiniProfile($oProfile);
             $oShoutBoxMessageView->setMessage($sMessage);
             $oShoutBoxMessageView->setShoutID($row['sb_id']);
             $oShoutBoxMessageListView->addItem($oShoutBoxMessageView);
             // Since we have one more shout than iLimit, we need to count :)
             $iCount++;
             if ($iCount >= $iLimit) {
                 break;
             }
         }
         $sOutput .= $oShoutBoxMessageListView->execute();
         $iTotelShouts = self::getTotalShouts($iArticleId);
         $sOutput .= "<div id='bs-sb-count-all' style='display:none'>" . $iTotelShouts . "</div>";
         //expire after 5 minutes in order to keep time tracking somewhat up-to-date
         BsCacheHelper::set($sKey, $sOutput, 60 * 5);
         $dbr->freeResult($res);
     }
     return $sOutput;
 }