当前位置: 首页>>代码示例>>PHP>>正文


PHP Revision::setTitle方法代码示例

本文整理汇总了PHP中Revision::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Revision::setTitle方法的具体用法?PHP Revision::setTitle怎么用?PHP Revision::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Revision的用法示例。


在下文中一共展示了Revision::setTitle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: historyLine

 /**
  * Returns a row from the history printout.
  *
  * @todo document some more, and maybe clean up the code (some params redundant?)
  *
  * @param stdClass $row The database row corresponding to the previous line.
  * @param mixed $next The database row corresponding to the next line
  *   (chronologically previous)
  * @param bool|string $notificationtimestamp
  * @param bool $latest Whether this row corresponds to the page's latest revision.
  * @param bool $firstInList Whether this row corresponds to the first
  *   displayed on this history page.
  * @return string HTML output for the row
  */
 function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false)
 {
     $rev = new Revision($row);
     $rev->setTitle($this->getTitle());
     if (is_object($next)) {
         $prevRev = new Revision($next);
         $prevRev->setTitle($this->getTitle());
     } else {
         $prevRev = null;
     }
     $curlink = $this->curLink($rev, $latest);
     $lastlink = $this->lastLink($rev, $next);
     $curLastlinks = $curlink . $this->historyPage->message['pipe-separator'] . $lastlink;
     $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), $this->msg('parentheses')->rawParams($curLastlinks)->escaped());
     $diffButtons = $this->diffButtons($rev, $firstInList);
     $s = $histLinks . $diffButtons;
     $link = $this->revLink($rev);
     $classes = array();
     $del = '';
     $user = $this->getUser();
     // Show checkboxes for each revision
     if ($user->isAllowed('deleterevision')) {
         $this->preventClickjacking();
         // If revision was hidden from sysops, disable the checkbox
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
             // Otherwise, enable the checkbox...
         } else {
             $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']'));
         }
         // User can only view deleted revisions...
     } elseif ($rev->getVisibility() && $user->isAllowed('deletedhistory')) {
         // If revision was hidden from sysops, disable the link
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Linker::revDeleteLinkDisabled(false);
             // Otherwise, show the link...
         } else {
             $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDBkey(), 'ids' => $rev->getId());
             $del .= Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false);
         }
     }
     if ($del) {
         $s .= " {$del} ";
     }
     $lang = $this->getLanguage();
     $dirmark = $lang->getDirMark();
     $s .= " {$link}";
     $s .= $dirmark;
     $s .= " <span class='history-user'>" . Linker::revUserTools($rev, true) . "</span>";
     $s .= $dirmark;
     if ($rev->isMinor()) {
         $s .= ' ' . ChangesList::flag('minor');
     }
     # Sometimes rev_len isn't populated
     if ($rev->getSize() !== null) {
         # Size is always public data
         $prevSize = isset($this->parentLens[$row->rev_parent_id]) ? $this->parentLens[$row->rev_parent_id] : 0;
         $sDiff = ChangesList::showCharacterDifference($prevSize, $rev->getSize());
         $fSize = Linker::formatRevisionSize($rev->getSize());
         $s .= ' <span class="mw-changeslist-separator">. .</span> ' . "{$fSize} {$sDiff}";
     }
     # Text following the character difference is added just before running hooks
     $s2 = Linker::revComment($rev, false, true);
     if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) {
         $s2 .= ' <span class="updatedmarker">' . $this->msg('updatedmarker')->escaped() . '</span>';
         $classes[] = 'mw-history-line-updated';
     }
     $tools = array();
     # Rollback and undo links
     if ($prevRev && $this->getTitle()->quickUserCan('edit', $user)) {
         if ($latest && $this->getTitle()->quickUserCan('rollback', $user)) {
             // Get a rollback link without the brackets
             $rollbackLink = Linker::generateRollback($rev, $this->getContext(), array('verify', 'noBrackets'));
             if ($rollbackLink) {
                 $this->preventClickjacking();
                 $tools[] = $rollbackLink;
             }
         }
         if (!$rev->isDeleted(Revision::DELETED_TEXT) && !$prevRev->isDeleted(Revision::DELETED_TEXT)) {
             # Create undo tooltip for the first (=latest) line only
             $undoTooltip = $latest ? array('title' => $this->msg('tooltip-undo')->text()) : array();
             $undolink = Linker::linkKnown($this->getTitle(), $this->msg('editundo')->escaped(), $undoTooltip, array('action' => 'edit', 'undoafter' => $prevRev->getId(), 'undo' => $rev->getId()));
             $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
         }
     }
     // Allow extension to add their own links here
//.........这里部分代码省略.........
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:101,代码来源:HistoryAction.php

示例2: insertRollback

 /** Inserts a rollback link
  *
  * @param $s string
  * @param $rc RecentChange
  */
 public function insertRollback(&$s, &$rc)
 {
     if (!$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id']) {
         $page = $rc->getTitle();
         /** Check for rollback and edit permissions, disallow special pages, and only
          * show a link on the top-most revision */
         if ($this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']) {
             $rev = new Revision(array('id' => $rc->mAttribs['rc_this_oldid'], 'user' => $rc->mAttribs['rc_user'], 'user_text' => $rc->mAttribs['rc_user_text'], 'deleted' => $rc->mAttribs['rc_deleted']));
             $rev->setTitle($page);
             $s .= ' ' . Linker::generateRollback($rev, $this->getContext());
         }
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:18,代码来源:ChangesList.php

示例3: formatRow

 /**
  * Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
  *
  * @param $result Result row
  * @return String
  */
 public function formatRow($result)
 {
     $title = Title::newFromRow($result);
     # Revision deletion works on revisions, so we should cast one
     $row = array('comment' => $result->rc_comment, 'deleted' => $result->rc_deleted, 'user_text' => $result->rc_user_text, 'user' => $result->rc_user);
     $rev = new Revision($row);
     $rev->setTitle($title);
     $classes = array();
     $lang = $this->getLanguage();
     $dm = $lang->getDirMark();
     $spanTime = Html::element('span', array('class' => 'mw-newpages-time'), $lang->userTimeAndDate($result->rc_timestamp, $this->getUser()));
     $time = Linker::linkKnown($title, $spanTime, array(), array('oldid' => $result->rc_this_oldid), array());
     $query = array('redirect' => 'no');
     if ($this->patrollable($result)) {
         $query['rcid'] = $result->rc_id;
     }
     // Linker::linkKnown() uses 'known' and 'noclasses' options. This breaks the colouration for stubs.
     $plink = Linker::link($title, null, array('class' => 'mw-newpages-pagename'), $query, array('known'));
     $histLink = Linker::linkKnown($title, $this->msg('hist')->escaped(), array(), array('action' => 'history'));
     $hist = Html::rawElement('span', array('class' => 'mw-newpages-history'), $this->msg('parentheses')->rawParams($histLink)->escaped());
     $length = Html::element('span', array('class' => 'mw-newpages-length'), $this->msg('brackets')->params($this->msg('nbytes')->numParams($result->length)->text()));
     $ulink = Linker::revUserTools($rev);
     $comment = Linker::revComment($rev);
     if ($this->patrollable($result)) {
         $classes[] = 'not-patrolled';
     }
     # Add a class for zero byte pages
     if ($result->length == 0) {
         $classes[] = 'mw-newpages-zero-byte-page';
     }
     # Tags, if any.
     if (isset($result->ts_tags)) {
         list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow($result->ts_tags, 'newpages');
         $classes = array_merge($classes, $newClasses);
     } else {
         $tagDisplay = '';
     }
     $css = count($classes) ? ' class="' . implode(' ', $classes) . '"' : '';
     # Display the old title if the namespace/title has been changed
     $oldTitleText = '';
     $oldTitle = Title::makeTitle($result->rc_namespace, $result->rc_title);
     if (!$title->equals($oldTitle)) {
         $oldTitleText = $this->msg('rc-old-title')->params($oldTitle->getPrefixedText())->escaped();
     }
     return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:52,代码来源:SpecialNewpages.php

示例4: revisionInsertComplete

 /**
  * revisionInsertComplete
  *
  * static method called as hook
  *
  * @static
  * @access public
  *
  * @param Revision	$revision	revision object
  * @param string	$url		url to external object
  * @param string	$flags		flags for this revision
  *
  * @return true means process other hooks
  */
 public static function revisionInsertComplete(&$revision, $url, $flags)
 {
     global $wgUser, $wgCityId, $wgCommandLineMode, $wgSharedDB, $wgErrorLog, $wgMemc, $wgRequest;
     wfProfileIn(__METHOD__);
     /**
      * Do not create task when DB is locked (rt#12229)
      * Do not create task when we are in $wgCommandLineMode
      */
     $oldValue = $wgErrorLog;
     $wgErrorLog = true;
     if (!wfReadOnly() && !$wgCommandLineMode) {
         /**
          * Revision has valid Title field but sometimes not filled
          */
         $Title = $revision->getTitle();
         if (!$Title) {
             $Title = Title::newFromId($revision->getPage(), Title::GAID_FOR_UPDATE);
             $revision->setTitle($Title);
         }
         /**
          * get groups for user rt#12215
          */
         $groups = $wgUser->getEffectiveGroups();
         $invalid = array("bot" => true, "bot-global" => true, "staff" => true, "helper" => true, "sysop" => true, "bureaucrat" => true, "vstf" => true);
         $canWelcome = true;
         foreach ($groups as $group) {
             if (isset($invalid[$group]) && $invalid[$group]) {
                 $canWelcome = false;
                 Wikia::log(__METHOD__, $wgUser->getId(), "Skip welcome, user is at least in group: " . $group);
                 break;
             }
         }
         /**
          * put possible welcomer into memcached, RT#14067
          */
         if ($wgUser->getId() && self::isWelcomer($wgUser)) {
             // BugId:41817 - if ( 1 == $wgUser->getId() ) { notify Mix }
             if (1 == $wgUser->getId()) {
                 $oTo = $oFrom = new MailAddress('mix@wikia-inc.com');
                 UserMailer::send($oTo, $oFrom, 'BugId:41817 Occurrence Report', sprintf("File: %s\nLine: %s, Date: %s\nOutput: %s", __FILE__, __LINE__, date('Y-m-d H:i:s'), var_export($wgUser->getId(), true)));
             }
             $wgMemc->set(wfMemcKey("last-sysop-id"), $wgUser->getId(), 86400);
             Wikia::log(__METHOD__, $wgUser->getId(), "Store possible welcomer in memcached");
         }
         if ($Title && $canWelcome && !empty($wgSharedDB)) {
             Wikia::log(__METHOD__, "title", $Title->getFullURL());
             $welcomer = trim(wfMsgForContent("welcome-user"));
             Wikia::log(__METHOD__, "welcomer", $welcomer);
             if ($welcomer !== "@disabled" && $welcomer !== "-") {
                 /**
                  * check if talk page for wgUser exists
                  *
                  * @todo check editcount for user
                  */
                 Wikia::log(__METHOD__, "user", $wgUser->getName());
                 $talkPage = $wgUser->getUserPage()->getTalkPage();
                 if ($talkPage) {
                     $talkArticle = new Article($talkPage, 0);
                     if (!self::isPosted($talkArticle, $wgUser)) {
                         $welcomeJob = new HAWelcomeJob($Title, array("is_anon" => $wgUser->isAnon(), "user_id" => $wgUser->getId(), "user_ip" => $wgRequest->getIP(), "user_name" => $wgUser->getName()));
                         $welcomeJob->insert();
                         Wikia::log(__METHOD__, "job");
                         /**
                          * inform task manager
                          */
                         $Task = new HAWelcomeTask();
                         $taskId = $Task->createTask(array("city_id" => $wgCityId), TASK_QUEUED);
                         Wikia::log(__METHOD__, "task", $taskId);
                     } else {
                         Wikia::log(__METHOD__, "exists", sprintf("Talk page for user %s already exits", $wgUser->getName()));
                     }
                 }
             } else {
                 Wikia::log(__METHOD__, "disabled");
             }
         }
     }
     $wgErrorLog = $oldValue;
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:95,代码来源:HAWelcome.php

示例5: newNullRevision

 /**
  * Create a new null-revision for insertion into a page's
  * history. This will not re-save the text, but simply refer
  * to the text from the previous version.
  *
  * Such revisions can for instance identify page rename
  * operations and other such meta-modifications.
  *
  * @param $dbw DatabaseBase
  * @param $pageId Integer: ID number of the page to read from
  * @param string $summary revision's summary
  * @param $minor Boolean: whether the revision should be considered as minor
  * @return Revision|null on error
  */
 public static function newNullRevision($dbw, $pageId, $summary, $minor)
 {
     global $wgContentHandlerUseDB;
     wfProfileIn(__METHOD__);
     $fields = array('page_latest', 'page_namespace', 'page_title', 'rev_text_id', 'rev_len', 'rev_sha1');
     if ($wgContentHandlerUseDB) {
         $fields[] = 'rev_content_model';
         $fields[] = 'rev_content_format';
     }
     $current = $dbw->selectRow(array('page', 'revision'), $fields, array('page_id' => $pageId, 'page_latest=rev_id'), __METHOD__);
     if ($current) {
         $row = array('page' => $pageId, 'comment' => $summary, 'minor_edit' => $minor, 'text_id' => $current->rev_text_id, 'parent_id' => $current->page_latest, 'len' => $current->rev_len, 'sha1' => $current->rev_sha1);
         if ($wgContentHandlerUseDB) {
             $row['content_model'] = $current->rev_content_model;
             $row['content_format'] = $current->rev_content_format;
         }
         $revision = new Revision($row);
         $revision->setTitle(Title::makeTitle($current->page_namespace, $current->page_title));
     } else {
         $revision = null;
     }
     wfProfileOut(__METHOD__);
     return $revision;
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:38,代码来源:Revision.php

示例6: feedItem

 /**
  * Generate a FeedItem object from a given revision table row
  * Borrows Recent Changes' feed generation functions for formatting;
  * includes a diff to the previous revision (if any).
  *
  * @param $row
  * @return FeedItem
  */
 function feedItem($row)
 {
     $rev = new Revision($row);
     $rev->setTitle($this->mTitle);
     $text = rcFormatDiffRow($this->mTitle, $this->mTitle->getPreviousRevisionID($rev->getId()), $rev->getId(), $rev->getTimestamp(), $rev->getComment());
     if ($rev->getComment() == '') {
         global $wgContLang;
         $title = wfMsgForContent('history-feed-item-nocomment', $rev->getUserText(), $wgContLang->timeanddate($rev->getTimestamp()));
     } else {
         $title = $rev->getUserText() . ": " . $this->stripComment($rev->getComment());
     }
     return new FeedItem($title, $text, $this->mTitle->getFullUrl('diff=' . $rev->getId() . '&oldid=prev'), $rev->getTimestamp(), $rev->getUserText(), $this->mTitle->getTalkPage()->getFullUrl());
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:21,代码来源:PageHistory.php

示例7: historyLine

 /**
  * Returns a row from the history printout.
  *
  * @todo document some more, and maybe clean up the code (some params redundant?)
  *
  * @param $row Object: the database row corresponding to the previous line.
  * @param $next Mixed: the database row corresponding to the next line.
  * @param $notificationtimestamp
  * @param $latest Boolean: whether this row corresponds to the page's latest revision.
  * @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page.
  * @return String: HTML output for the row
  */
 function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false)
 {
     global $wgUser, $wgLang;
     $rev = new Revision($row);
     $rev->setTitle($this->title);
     $curlink = $this->curLink($rev, $latest);
     $lastlink = $this->lastLink($rev, $next);
     $diffButtons = $this->diffButtons($rev, $firstInList);
     $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') ');
     $s = $histLinks . $diffButtons;
     $link = $this->revLink($rev);
     $classes = array();
     $del = '';
     // Show checkboxes for each revision
     if ($wgUser->isAllowed('deleterevision')) {
         $this->preventClickjacking();
         // If revision was hidden from sysops, disable the checkbox
         if (!$rev->userCan(Revision::DELETED_RESTRICTED)) {
             $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
             // Otherwise, enable the checkbox...
         } else {
             $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']'));
         }
         // User can only view deleted revisions...
     } else {
         if ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) {
             // If revision was hidden from sysops, disable the link
             if (!$rev->userCan(Revision::DELETED_RESTRICTED)) {
                 $cdel = $this->getSkin()->revDeleteLinkDisabled(false);
                 // Otherwise, show the link...
             } else {
                 $query = array('type' => 'revision', 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId());
                 $del .= $this->getSkin()->revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false);
             }
         }
     }
     if ($del) {
         $s .= " {$del} ";
     }
     $s .= " {$link}";
     $s .= " <span class='history-user'>" . $this->getSkin()->revUserTools($rev, true) . "</span>";
     if ($rev->isMinor()) {
         $s .= ' ' . ChangesList::flag('minor');
     }
     if (!is_null($size = $rev->getSize()) && !$rev->isDeleted(Revision::DELETED_TEXT)) {
         $s .= ' ' . $this->getSkin()->formatRevisionSize($size);
     }
     $s .= $this->getSkin()->revComment($rev, false, true);
     if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) {
         $s .= ' <span class="updatedmarker">' . wfMsgHtml('updatedmarker') . '</span>';
     }
     $tools = array();
     # Rollback and undo links
     if (!is_null($next) && is_object($next)) {
         if ($latest && $this->title->userCan('rollback') && $this->title->userCan('edit')) {
             $this->preventClickjacking();
             $tools[] = '<span class="mw-rollback-link">' . $this->getSkin()->buildRollbackLink($rev) . '</span>';
         }
         if ($this->title->quickUserCan('edit') && !$rev->isDeleted(Revision::DELETED_TEXT) && !$next->rev_deleted & Revision::DELETED_TEXT) {
             # Create undo tooltip for the first (=latest) line only
             $undoTooltip = $latest ? array('title' => wfMsg('tooltip-undo')) : array();
             $undolink = $this->getSkin()->link($this->title, wfMsgHtml('editundo'), $undoTooltip, array('action' => 'edit', 'undoafter' => $next->rev_id, 'undo' => $rev->getId()), array('known', 'noclasses'));
             $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
         }
     }
     if ($tools) {
         $s .= ' (' . $wgLang->pipeList($tools) . ')';
     }
     # Tags
     list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'history');
     $classes = array_merge($classes, $newClasses);
     $s .= " {$tagSummary}";
     wfRunHooks('PageHistoryLineEnding', array($this, &$row, &$s, &$classes));
     $attribs = array();
     if ($classes) {
         $attribs['class'] = implode(' ', $classes);
     }
     return Xml::tags('li', $attribs, $s) . "\n";
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:91,代码来源:HistoryPage.php

示例8: historyLine

 /**
  * Returns a row from the history printout.
  *
  * @todo document some more, and maybe clean up the code (some params redundant?)
  *
  * @param $row Object: the database row corresponding to the previous line.
  * @param $next Mixed: the database row corresponding to the next line. (chronologically previous)
  * @param $notificationtimestamp
  * @param $latest Boolean: whether this row corresponds to the page's latest revision.
  * @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page.
  * @return String: HTML output for the row
  */
 function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false)
 {
     $rev = new Revision($row);
     $rev->setTitle($this->getTitle());
     if (is_object($next)) {
         $prevRev = new Revision($next);
         $prevRev->setTitle($this->getTitle());
     } else {
         $prevRev = null;
     }
     $curlink = $this->curLink($rev, $latest);
     $lastlink = $this->lastLink($rev, $next);
     $diffButtons = $this->diffButtons($rev, $firstInList);
     $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') ');
     $s = $histLinks . $diffButtons;
     $link = $this->revLink($rev);
     $classes = array();
     $del = '';
     $user = $this->getUser();
     // Show checkboxes for each revision
     if ($user->isAllowed('deleterevision')) {
         $this->preventClickjacking();
         // If revision was hidden from sysops, disable the checkbox
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
             // Otherwise, enable the checkbox...
         } else {
             $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']'));
         }
         // User can only view deleted revisions...
     } elseif ($rev->getVisibility() && $user->isAllowed('deletedhistory')) {
         // If revision was hidden from sysops, disable the link
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $cdel = Linker::revDeleteLinkDisabled(false);
             // Otherwise, show the link...
         } else {
             $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDbkey(), 'ids' => $rev->getId());
             $del .= Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false);
         }
     }
     if ($del) {
         $s .= " {$del} ";
     }
     $lang = $this->getLanguage();
     $dirmark = $lang->getDirMark();
     $s .= " {$link}";
     $s .= $dirmark;
     $s .= " <span class='history-user'>" . Linker::revUserTools($rev, true) . "</span>";
     $s .= $dirmark;
     if ($rev->isMinor()) {
         $s .= ' ' . ChangesList::flag('minor');
     }
     # Size is always public data
     $prevSize = $prevRev ? $prevRev->getSize() : 0;
     $sDiff = ChangesList::showCharacterDifference($prevSize, $rev->getSize());
     $fSize = Linker::formatRevisionSize($rev->getSize());
     $s .= " . . {$fSize} {$sDiff} . . ";
     $s .= Linker::revComment($rev, false, true);
     if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) {
         $s .= ' <span class="updatedmarker">' . $this->msg('updatedmarker')->escaped() . '</span>';
     }
     $tools = array();
     # Rollback and undo links
     if ($prevRev && !count($this->getTitle()->getUserPermissionsErrors('edit', $this->getUser()))) {
         if ($latest && !count($this->getTitle()->getUserPermissionsErrors('rollback', $this->getUser()))) {
             $this->preventClickjacking();
             $tools[] = '<span class="mw-rollback-link">' . Linker::buildRollbackLink($rev) . '</span>';
         }
         if (!$rev->isDeleted(Revision::DELETED_TEXT) && !$prevRev->isDeleted(Revision::DELETED_TEXT)) {
             # Create undo tooltip for the first (=latest) line only
             $undoTooltip = $latest ? array('title' => $this->msg('tooltip-undo')->text()) : array();
             $undolink = Linker::linkKnown($this->getTitle(), $this->msg('editundo')->escaped(), $undoTooltip, array('action' => 'edit', 'undoafter' => $prevRev->getId(), 'undo' => $rev->getId()));
             $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
         }
     }
     if ($tools) {
         $s .= ' (' . $lang->pipeList($tools) . ')';
     }
     # Tags
     list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'history');
     $classes = array_merge($classes, $newClasses);
     $s .= " {$tagSummary}";
     wfRunHooks('PageHistoryLineEnding', array($this, &$row, &$s, &$classes));
     $attribs = array();
     if ($classes) {
         $attribs['class'] = implode(' ', $classes);
     }
     return Xml::tags('li', $attribs, $s) . "\n";
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:HistoryAction.php

示例9: newNullRevision

 /**
  * Create a new null-revision for insertion into a page's
  * history. This will not re-save the text, but simply refer
  * to the text from the previous version.
  *
  * Such revisions can for instance identify page rename
  * operations and other such meta-modifications.
  *
  * @param DatabaseBase $dbw
  * @param int $pageId ID number of the page to read from
  * @param string $summary Revision's summary
  * @param bool $minor Whether the revision should be considered as minor
  * @param User|null $user User object to use or null for $wgUser
  * @return Revision|null Revision or null on error
  */
 public static function newNullRevision($dbw, $pageId, $summary, $minor, $user = null)
 {
     global $wgContentHandlerUseDB, $wgContLang;
     $fields = array('page_latest', 'page_namespace', 'page_title', 'rev_text_id', 'rev_len', 'rev_sha1');
     if ($wgContentHandlerUseDB) {
         $fields[] = 'rev_content_model';
         $fields[] = 'rev_content_format';
     }
     $current = $dbw->selectRow(array('page', 'revision'), $fields, array('page_id' => $pageId, 'page_latest=rev_id'), __METHOD__);
     if ($current) {
         if (!$user) {
             global $wgUser;
             $user = $wgUser;
         }
         // Truncate for whole multibyte characters
         $summary = $wgContLang->truncate($summary, 255);
         $row = array('page' => $pageId, 'user_text' => $user->getName(), 'user' => $user->getId(), 'comment' => $summary, 'minor_edit' => $minor, 'text_id' => $current->rev_text_id, 'parent_id' => $current->page_latest, 'len' => $current->rev_len, 'sha1' => $current->rev_sha1);
         if ($wgContentHandlerUseDB) {
             $row['content_model'] = $current->rev_content_model;
             $row['content_format'] = $current->rev_content_format;
         }
         $revision = new Revision($row);
         $revision->setTitle(Title::makeTitle($current->page_namespace, $current->page_title));
     } else {
         $revision = null;
     }
     return $revision;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:43,代码来源:Revision.php

示例10: revisionInsertComplete

 /**
  * revisionInsertComplete
  *
  * static method called as hook
  *
  * @static
  * @access public
  *
  * @param Revision	$revision	revision object
  * @param string	$url		url to external object
  * @param string	$flags		flags for this revision
  *
  * @return true means process other hooks
  */
 public static function revisionInsertComplete(&$revision, $url, $flags)
 {
     global $wgUser, $wgCityId, $wgCommandLineMode, $wgSharedDB, $wgErrorLog, $wgMemc, $wgRequest;
     //do nothing if the user clicked 'undo'
     if ($wgRequest->getVal('wpUndoEdit')) {
         return true;
     }
     wfProfileIn(__METHOD__);
     /* first edit? */
     //if (User::edits($wgUser->getID()) == 1) {
     /**
      * Do not create task when DB is locked (rt#12229)
      * Do not create task when we are in $wgCommandLineMode
      */
     $oldValue = $wgErrorLog;
     $wgErrorLog = true;
     if (!wfReadOnly() && !$wgCommandLineMode) {
         wfLoadExtensionMessages("HAWelcome");
         /**
          * Revision has valid Title field but sometimes not filled
          */
         $Title = $revision->getTitle();
         if (!$Title) {
             $Title = Title::newFromId($revision->getPage(), GAID_FOR_UPDATE);
             $revision->setTitle($Title);
         }
         /**
          * get groups for user rt#12215
          */
         $groups = $wgUser->getEffectiveGroups();
         $invalid = array("bot" => true, "staff" => true, "helper" => true, "sysop" => true, "bureaucrat" => true, "vstf" => true);
         $canWelcome = true;
         foreach ($groups as $group) {
             if (isset($invalid[$group]) && $invalid[$group]) {
                 $canWelcome = false;
                 break;
             }
         }
         /**
          * put possible welcomer into memcached, RT#14067
          */
         if ($wgUser->getId() && self::isWelcomer($wgUser)) {
             //$wgMemc->set( wfMemcKey( "last-sysop-id" ), $wgUser->getId(), 86400 );
             $wgMemc->set(wfMemcKey("last-sysop-id"), $wgUser->getId(), 3600);
         }
         if ($Title && $canWelcome && !empty($wgSharedDB)) {
             $welcomer = trim(wfMsgForContent("welcome-user"));
             if ($welcomer !== "@disabled" && $welcomer !== "-") {
                 /**
                  * check if talk page for wgUser exists
                  *
                  * @todo check editcount for user
                  */
                 $talkPage = $wgUser->getUserPage()->getTalkPage();
                 if ($talkPage) {
                     $talkArticle = new Article($talkPage, 0);
                     if (!$talkArticle->exists()) {
                         //run the talk page stuff
                         self::runEditThanks($Title);
                     }
                 }
             }
         }
     }
     //}
     $wgErrorLog = $oldValue;
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:83,代码来源:HAWelcome.php

示例11: showDiff

	/**
	 * @param $revision REvision
	 * @return mixed
	 */
	function showDiff( $revision ){
		global $wgOut;

		$dbr = wfGetDB( DB_SLAVE );
		$result = $this->getRevisions( $dbr, array( 'hidden_rev_id' => $revision ) );

		foreach ( $result as $row ) {
			$info = $this->listRow( $row );
			$list = $this->revisionInfo( $row );
			$rev = new Revision( $row );
			$title = Title::makeTitle( $row->page_namespace, $row->page_title );
			$rev->setTitle( $title );
			$prevId = $title->getPreviousRevisionID( $row->rev_id );
			if ( $prevId ) {
				$prev = Revision::newFromTitle( $title, $prevId );
				if( $prev ) {
					$otext = strval( $prev->getText( Revision::FOR_THIS_USER ) );
				} else {
					$otext = '';
				}
			} else {
				$wgOut->addHTML(
				"<ul>" .
				$info .
				"</ul>\n" .
				$list );
				$wgOut->addWikiText( wfMsgNoTrans( 'oversight-nodiff' ) );
				return;
			}
			$ntext = strval( $rev->getText( Revision::FOR_THIS_USER ) );

			$diffEngine = new DifferenceEngine( $title );
			$diffEngine->showDiffStyle();
			$wgOut->addHTML(
				"<ul>" .
				$info .
				"</ul>\n" .
				$list .
				"<p><strong>" .
				wfMsgHTML('oversight-difference') .
				"</strong>" .
				"</p>" .
				"<div>" .
				"<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" .
				"<col class='diff-marker' />" .
				"<col class='diff-content' />" .
				"<col class='diff-marker' />" .
				"<col class='diff-content' />" .
				"<tr>" .
					"<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#$prevId)" . "</td>" .
					"<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" .
				"</tr>" .
				$diffEngine->generateDiffBody( $otext, $ntext ) .
				"</table>" .
				"</div>\n" );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:61,代码来源:HideRevision_body.php

示例12: insertRollback

 /** Inserts a rollback link
  *
  * @param $s string
  * @param $rc RecentChange
  */
 public function insertRollback(&$s, &$rc)
 {
     if (!$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id']) {
         $page = $rc->getTitle();
         /** Check for rollback and edit permissions, disallow special pages, and only
          * show a link on the top-most revision */
         if ($this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']) {
             $rev = new Revision(array('id' => $rc->mAttribs['rc_this_oldid'], 'user' => $rc->mAttribs['rc_user'], 'user_text' => $rc->mAttribs['rc_user_text'], 'deleted' => $rc->mAttribs['rc_deleted']));
             $rev->setTitle($page);
             /** Start of Wikia change @author nAndy */
             $rollbackLink = Linker::generateRollback($rev, $this->getContext());
             wfRunHooks('ChangesListInsertRollback', array($this, &$s, &$rollbackLink, $rc));
             $s .= ' ' . $rollbackLink;
             /*End of Wikia change*/
         }
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:22,代码来源:ChangesList.php

示例13: newNullRevision

 /**
  * Create a new null-revision for insertion into a page's
  * history. This will not re-save the text, but simply refer
  * to the text from the previous version.
  *
  * Such revisions can for instance identify page rename
  * operations and other such meta-modifications.
  *
  * @param $dbw DatabaseBase
  * @param $pageId Integer: ID number of the page to read from
  * @param $summary String: revision's summary
  * @param $minor Boolean: whether the revision should be considered as minor
  * @return Revision|null on error
  */
 public static function newNullRevision($dbw, $pageId, $summary, $minor)
 {
     wfProfileIn(__METHOD__);
     $current = $dbw->selectRow(array('page', 'revision'), array('page_latest', 'page_namespace', 'page_title', 'rev_text_id', 'rev_len', 'rev_sha1'), array('page_id' => $pageId, 'page_latest=rev_id'), __METHOD__);
     if ($current) {
         $revision = new Revision(array('page' => $pageId, 'comment' => $summary, 'minor_edit' => $minor, 'text_id' => $current->rev_text_id, 'parent_id' => $current->page_latest, 'len' => $current->rev_len, 'sha1' => $current->rev_sha1));
         $revision->setTitle(Title::makeTitle($current->page_namespace, $current->page_title));
     } else {
         $revision = null;
     }
     wfProfileOut(__METHOD__);
     return $revision;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:27,代码来源:Revision.php


注:本文中的Revision::setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。