本文整理匯總了PHP中LogPage::actionText方法的典型用法代碼示例。如果您正苦於以下問題:PHP LogPage::actionText方法的具體用法?PHP LogPage::actionText怎麽用?PHP LogPage::actionText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類LogPage
的用法示例。
在下文中一共展示了LogPage::actionText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateCheckUserData
/**
* Hook function for RecentChange_save
* Saves user data into the cu_changes table
*/
public static function updateCheckUserData(RecentChange $rc)
{
global $wgRequest;
// Extract params
extract($rc->mAttribs);
// Get IP
$ip = wfGetIP();
// Get XFF header
$xff = $wgRequest->getHeader('X-Forwarded-For');
list($xff_ip, $isSquidOnly) = self::getClientIPfromXFF($xff);
// Get agent
$agent = $wgRequest->getHeader('User-Agent');
// Store the log action text for log events
// $rc_comment should just be the log_comment
// BC: check if log_type and log_action exists
// If not, then $rc_comment is the actiontext and comment
if (isset($rc_log_type) && $rc_type == RC_LOG) {
$target = Title::makeTitle($rc_namespace, $rc_title);
$actionText = LogPage::actionText($rc_log_type, $rc_log_action, $target, null, LogPage::extractParams($rc_params));
} else {
$actionText = '';
}
$dbw = wfGetDB(DB_MASTER);
$cuc_id = $dbw->nextSequenceValue('cu_changes_cu_id_seq');
$rcRow = array('cuc_id' => $cuc_id, 'cuc_namespace' => $rc_namespace, 'cuc_title' => $rc_title, 'cuc_minor' => $rc_minor, 'cuc_user' => $rc_user, 'cuc_user_text' => $rc_user_text, 'cuc_actiontext' => $actionText, 'cuc_comment' => $rc_comment, 'cuc_this_oldid' => $rc_this_oldid, 'cuc_last_oldid' => $rc_last_oldid, 'cuc_type' => $rc_type, 'cuc_timestamp' => $rc_timestamp, 'cuc_ip' => IP::sanitizeIP($ip), 'cuc_ip_hex' => $ip ? IP::toHex($ip) : null, 'cuc_xff' => !$isSquidOnly ? $xff : '', 'cuc_xff_hex' => $xff_ip && !$isSquidOnly ? IP::toHex($xff_ip) : null, 'cuc_agent' => $agent);
# On PG, MW unsets cur_id due to schema incompatibilites. So it may not be set!
if (isset($rc_cur_id)) {
$rcRow['cuc_page_id'] = $rc_cur_id;
}
$dbw->insert('cu_changes', $rcRow, __METHOD__);
return true;
}
示例2: formatDiff
/**
* Format a diff for the newsfeed
*
* @param $row Object: row from the recentchanges table
* @return String
*/
public static function formatDiff($row)
{
global $wgUser;
$titleObj = Title::makeTitle($row->rc_namespace, $row->rc_title);
$timestamp = wfTimestamp(TS_MW, $row->rc_timestamp);
$actiontext = '';
if ($row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$actiontext = wfMsgHtml('rev-deleted-event');
} else {
$actiontext = LogPage::actionText($row->rc_log_type, $row->rc_log_action, $titleObj, $wgUser->getSkin(), LogPage::extractParams($row->rc_params, true, true));
}
}
return self::formatDiffRow($titleObj, $row->rc_last_oldid, $row->rc_this_oldid, $timestamp, $row->rc_deleted & Revision::DELETED_COMMENT ? wfMsgHtml('rev-deleted-comment') : $row->rc_comment, $actiontext);
}
示例3: efUpdateCheckUserData
/**
* Hook function for RecentChange_save
* Saves user data into the cu_changes table
*/
function efUpdateCheckUserData($rc)
{
global $wgUser;
// Extract params
extract($rc->mAttribs);
// Get IP
$ip = wfGetIP();
// Get XFF header
$xff = wfGetForwardedFor();
list($xff_ip, $trusted) = efGetClientIPfromXFF($xff);
// Our squid XFFs can flood this up sometimes
$isSquidOnly = efXFFChainIsSquid($xff);
// Get agent
$agent = wfGetAgent();
// Store the log action text for log events
// $rc_comment should just be the log_comment
// BC: check if log_type and log_action exists
// If not, then $rc_comment is the actiontext and comment
if (isset($rc_log_type) && $rc_type == RC_LOG) {
$target = Title::makeTitle($rc_namespace, $rc_title);
$actionText = LogPage::actionText($rc_log_type, $rc_log_action, $target, NULL, explode('\\n', $rc_params));
} else {
$actionText = '';
}
$dbw = wfGetDB(DB_MASTER);
$cuc_id = $dbw->nextSequenceValue('cu_changes_cu_id_seq');
$rcRow = array('cuc_id' => $cuc_id, 'cuc_namespace' => $rc_namespace, 'cuc_title' => $rc_title, 'cuc_minor' => $rc_minor, 'cuc_user' => $rc_user, 'cuc_user_text' => $rc_user_text, 'cuc_actiontext' => $actionText, 'cuc_comment' => $rc_comment, 'cuc_this_oldid' => $rc_this_oldid, 'cuc_last_oldid' => $rc_last_oldid, 'cuc_type' => $rc_type, 'cuc_timestamp' => $rc_timestamp, 'cuc_ip' => IP::sanitizeIP($ip), 'cuc_ip_hex' => $ip ? IP::toHex($ip) : null, 'cuc_xff' => !$isSquidOnly ? $xff : '', 'cuc_xff_hex' => $xff_ip && !$isSquidOnly ? IP::toHex($xff_ip) : null, 'cuc_agent' => $agent);
## On PG, MW unsets cur_id due to schema incompatibilites. So it may not be set!
if (isset($rc_cur_id)) {
$rcRow['cuc_page_id'] = $rc_cur_id;
}
$dbw->insert('cu_changes', $rcRow, __METHOD__);
# Every 100th edit, prune the checkuser changes table.
wfSeedRandom();
if (0 == mt_rand(0, 99)) {
# Periodically flush old entries from the recentchanges table.
global $wgCUDMaxAge;
$cutoff = $dbw->timestamp(time() - $wgCUDMaxAge);
$recentchanges = $dbw->tableName('cu_changes');
$sql = "DELETE FROM {$recentchanges} WHERE cuc_timestamp < '{$cutoff}'";
$dbw->query($sql);
}
return true;
}
示例4: logAction
private function logAction($row, $title, $paramArray)
{
if (self::isDeleted($row, LogPage::DELETED_ACTION)) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$action = LogPage::actionText($row->log_type, $row->log_action, $title, $this->skin, $paramArray, true);
}
return $action;
}
示例5: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if ($s->log_type == 'move' && isset($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete', $s->log_namespace)) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletebtn'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif ($s->log_action == 'protect' && $wgUser->isAllowed('protect', $s->log_namespace)) {
$revert = '(' . $skin->makeKnownLink($title->getPrefixedDBkey(), wfMsg('protect_change'), 'action=unprotect') . ')';
// show user tool links for self created users
} elseif ($s->log_action == 'create2') {
$revert = $this->skin->userToolLinksRedContribs($s->log_user, $s->log_title);
// do not show $comment for self created accounts. It includes wrong user tool links:
// 'blockip' for users w/o block allowance and broken links for very long usernames (bug 4756)
$comment = '';
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例6: getHTML
public function getHTML()
{
$date = htmlspecialchars($this->list->getLang()->timeanddate($this->row->log_timestamp));
$paramArray = LogPage::extractParams($this->row->log_params);
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), wfMsgHtml('log'), array(), array('page' => $title->getPrefixedText()));
// Action text
if (!$this->canView()) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$skin = $this->list->getUser()->getSkin();
$action = LogPage::actionText($this->row->log_type, $this->row->log_action, $title, $skin, $paramArray, true, true);
if ($this->row->log_deleted & LogPage::DELETED_ACTION) {
$action = '<span class="history-deleted">' . $action . '</span>';
}
}
// User links
$userLink = Linker::userLink($this->row->log_user, User::WhoIs($this->row->log_user));
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_USER)) {
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
$comment = $this->list->getLang()->getDirMark() . Linker::commentBlock($this->row->log_comment);
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
return "<li>({$loglink}) {$date} {$userLink} {$action} {$comment}</li>";
}
示例7: addEntry
/**
* Add a log entry
* @param string $action one of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
* @param object &$target A title object.
* @param string $comment Description associated
* @param array $params Parameters passed later to wfMsg.* functions
*/
function addEntry($action, $target, $comment, $params = array())
{
if (!is_array($params)) {
$params = array($params);
}
$this->action = $action;
$this->target = $target;
$this->comment = $comment;
$this->params = LogPage::makeParamBlob($params);
$this->actionText = LogPage::actionText($this->type, $action, $target, NULL, $params);
return $this->saveContent();
}
示例8: addEntry
/**
* Add a log entry
*
* @param $action String: one of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
* @param $target Title object
* @param $comment String: description associated
* @param $params Array: parameters passed later to wfMsg.* functions
* @param $doer User object: the user doing the action
*/
public function addEntry($action, $target, $comment, $params = array(), $doer = null)
{
if (!is_array($params)) {
$params = array($params);
}
if ($comment === null) {
$comment = '';
}
$this->action = $action;
$this->target = $target;
$this->comment = $comment;
$this->params = LogPage::makeParamBlob($params);
if ($doer === null) {
global $wgUser;
$doer = $wgUser;
} elseif (!is_object($doer)) {
$doer = User::newFromId($doer);
}
$this->doer = $doer;
$this->actionText = LogPage::actionText($this->type, $action, $target, null, $params);
return $this->saveContent();
}
示例9: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser, $wgContLang;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $wgContLang->getDirMark() . $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if (!($this->flags & self::NO_ACTION_LINK)) {
if ($s->log_type == 'move' && isset($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletebtn'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif (($s->log_action == 'protect' || $s->log_action == 'modify') && $wgUser->isAllowed('protect')) {
$revert = '(' . $skin->makeKnownLinkObj($title, wfMsg('protect_change'), 'action=unprotect') . ')';
// show user tool links for self created users
// TODO: The extension should be handling this, get it out of core!
} elseif ($s->log_action == 'create2') {
if (isset($paramArray[0])) {
$revert = $this->skin->userToolLinks($paramArray[0], $s->log_title, true);
} else {
# Fall back to a blue contributions link
$revert = $this->skin->userToolLinks(1, $s->log_title);
}
# Suppress $comment from old entries, not needed and can contain incorrect links
$comment = '';
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例10: logLine
//.........這裏部分代碼省略.........
$revert = $del = '';
// Some user can hide log items and have review links
if ($wgUser->isAllowed('deleterevision')) {
$del = $this->getShowHideLinks($row) . ' ';
}
// Add review links and such...
if ($this->flags & self::NO_ACTION_LINK || $row->log_deleted & LogPage::DELETED_ACTION) {
// Action text is suppressed...
} else {
if (self::typeAction($row, 'move', 'move', 'move') && !empty($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), $this->message['revertmove'], 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// Show undelete link
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'delete', 'delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), $this->message['undeletelink'], 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// Show unblock/change block link
} else {
if (self::typeAction($row, array('block', 'suppress'), array('block', 'reblock'), 'block')) {
$revert = '(' . $this->skin->link(SpecialPage::getTitleFor('Ipblocklist'), $this->message['unblocklink'], array(), array('action' => 'unblock', 'ip' => $row->log_title), 'known') . ' ' . $this->message['pipe-separator'] . ' ' . $this->skin->link(SpecialPage::getTitleFor('Blockip', $row->log_title), $this->message['change-blocklink'], array(), array(), 'known') . ')';
// Show change protection link
} else {
if (self::typeAction($row, 'protect', array('modify', 'protect', 'unprotect'))) {
$revert .= ' (' . $this->skin->link($title, $this->message['hist'], array(), array('action' => 'history', 'offset' => $row->log_timestamp));
if ($wgUser->isAllowed('protect')) {
$revert .= ' ' . $this->message['pipe-separator'] . ' ' . $this->skin->link($title, $this->message['protect_change'], array(), array('action' => 'protect'), 'known');
}
$revert .= ')';
// Show unmerge link
} else {
if (self::typeAction($row, 'merge', 'merge', 'mergehistory')) {
$merge = SpecialPage::getTitleFor('Mergehistory');
$revert = '(' . $this->skin->makeKnownLinkObj($merge, $this->message['revertmerge'], wfArrayToCGI(array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(), 'mergepoint' => $paramArray[1]))) . ')';
// If an edit was hidden from a page give a review link to the history
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'revision', 'deleterevision')) {
if (count($paramArray) == 2) {
$revdel = SpecialPage::getTitleFor('Revisiondelete');
// Different revision types use different URL params...
$key = $paramArray[0];
// Link to each hidden object ID, $paramArray[1] is the url param
$Ids = explode(',', $paramArray[1]);
$revParams = '';
foreach ($Ids as $n => $id) {
$revParams .= '&' . urlencode($key) . '[]=' . urlencode($id);
}
$revert = '(' . $this->skin->makeKnownLinkObj($revdel, $this->message['revdel-restore'], 'target=' . $title->getPrefixedUrl() . $revParams) . ')';
}
// Hidden log items, give review link
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'event', 'deleterevision')) {
if (count($paramArray) == 1) {
$revdel = SpecialPage::getTitleFor('Revisiondelete');
$Ids = explode(',', $paramArray[0]);
// Link to each hidden object ID, $paramArray[1] is the url param
$logParams = '';
foreach ($Ids as $n => $id) {
$logParams .= '&logid[]=' . intval($id);
}
$revert = '(' . $this->skin->makeKnownLinkObj($revdel, $this->message['revdel-restore'], 'target=' . $title->getPrefixedUrl() . $logParams) . ')';
}
// Self-created users
} else {
if (self::typeAction($row, 'newusers', 'create2')) {
if (isset($paramArray[0])) {
$revert = $this->skin->userToolLinks($paramArray[0], $title->getDBkey(), true);
} else {
# Fall back to a blue contributions link
$revert = $this->skin->userToolLinks(1, $title->getDBkey());
}
if ($time < '20080129000000') {
# Suppress $comment from old entries (before 2008-01-29),
# not needed and can contain incorrect links
$comment = '';
}
// Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
} else {
wfRunHooks('LogLine', array($row->log_type, $row->log_action, $title, $paramArray, &$comment, &$revert, $row->log_timestamp));
}
}
}
}
}
}
}
}
}
// Event description
if (self::isDeleted($row, LogPage::DELETED_ACTION)) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$action = LogPage::actionText($row->log_type, $row->log_action, $title, $this->skin, $paramArray, true);
}
if ($revert != '') {
$revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
}
return Xml::tags('li', array("class" => "mw-logline-{$row->log_type}"), $del . $time . ' ' . $userLink . ' ' . $action . ' ' . $comment . ' ' . $revert);
}
示例11: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang;
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$user = Title::makeTitleSafe(NS_USER, $s->user_name);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinks($s->log_user, $s->user_name);
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
if ($s->log_type == 'move' && isset($paramArray[0])) {
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Movepage');
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
}
// WERELATE: newuser log
global $wgUser;
if ($s->log_type == 'newuser') {
if (!$wgUser->isAllowed('block')) {
// block normal users from seeing IP addresses
$comment = '';
} else {
if (isset($paramArray[0])) {
// add a block link
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Blockip');
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsgHtml('blocklink') . ' IP', 'ip=' . urlencode($paramArray[0])) . ')';
}
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例12: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser, $wgContLang;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $wgContLang->getDirMark() . $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if (!($this->flags & self::NO_ACTION_LINK)) {
if ($s->log_type == 'move' && isset($paramArray[0]) && $wgUser->isAllowed('move')) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletelink'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif (($s->log_action == 'protect' || $s->log_action == 'modify') && $wgUser->isAllowed('protect')) {
$revert = '(' . $skin->makeKnownLinkObj($title, wfMsg('protect_change'), 'action=unprotect') . ')';
// Show unmerge link
} elseif ($s->log_action == 'merge') {
$merge = SpecialPage::getTitleFor('Mergehistory');
$revert = '(' . $this->skin->makeKnownLinkObj($merge, wfMsg('revertmerge'), wfArrayToCGI(array('target' => $paramArray[0], 'dest' => $title->getPrefixedText(), 'mergepoint' => $paramArray[1]))) . ')';
} elseif (wfRunHooks('LogLine', array($s->log_type, $s->log_action, $title, $paramArray, &$comment, &$revert, $s->log_timestamp))) {
// wfDebug( "Invoked LogLine hook for " $s->log_type . ", " . $s->log_action . "\n" );
// Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例13: recentChangesBlockLine
/**
* Enhanced RC ungrouped line.
*
* @param $rcObj RecentChange
* @return String: a HTML formated line (generated using $r)
*/
protected function recentChangesBlockLine($rcObj)
{
global $wgRCShowChangedSize;
wfProfileIn(__METHOD__);
$query['curid'] = $rcObj->mAttribs['rc_cur_id'];
$type = $rcObj->mAttribs['rc_type'];
$logType = $rcObj->mAttribs['rc_log_type'];
if ($logType) {
# Log entry
$classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-log-' . $logType . '-' . $rcObj->mAttribs['rc_title']);
} else {
$classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title']);
}
$r = Html::openElement('table', array('class' => $classes)) . Html::openElement('tr');
$r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow();
# Flag and Timestamp
if ($type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT) {
$r .= '    ';
// 4 flags -> 4 spaces
} else {
$r .= $this->recentChangesFlags(array('newpage' => $type == RC_NEW, 'minor' => $rcObj->mAttribs['rc_minor'], 'unpatrolled' => $rcObj->unpatrolled, 'bot' => $rcObj->mAttribs['rc_bot']));
}
$r .= ' ' . $rcObj->timestamp . ' </td><td>';
# Article or log link
if ($logType) {
$logtitle = SpecialPage::getTitleFor('Log', $logType);
$logname = LogPage::logName($logType);
$r .= '(' . Linker::linkKnown($logtitle, htmlspecialchars($logname)) . ')';
} else {
$this->insertArticleLink($r, $rcObj, $rcObj->unpatrolled, $rcObj->watched);
}
# Diff and hist links
if ($type != RC_LOG) {
$r .= ' (' . $rcObj->difflink . $this->message['pipe-separator'];
$query['action'] = 'history';
$r .= Linker::linkKnown($rcObj->getTitle(), $this->message['hist'], array(), $query) . ')';
}
$r .= ' . . ';
# Character diff
if ($wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference())) {
$r .= "{$cd} . . ";
}
# User/talk
$r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
# Log action (if any)
if ($logType) {
if ($this->isDeleted($rcObj, LogPage::DELETED_ACTION)) {
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$r .= ' ' . LogPage::actionText($logType, $rcObj->mAttribs['rc_log_action'], $rcObj->getTitle(), $this->getSkin(), LogPage::extractParams($rcObj->mAttribs['rc_params']), true, true);
}
}
$this->insertComment($r, $rcObj);
$this->insertRollback($r, $rcObj);
# Tags
$classes = explode(' ', $classes);
$this->insertTags($r, $rcObj, $classes);
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
$r .= "</td></tr></table>\n";
wfProfileOut(__METHOD__);
return $r;
}
示例14: logLine
/**
* @param Array $row row
* @returns string
*/
private function logLine($row)
{
global $wgLang;
$date = $wgLang->timeanddate($row->log_timestamp);
$paramArray = LogPage::extractParams($row->log_params);
$title = Title::makeTitle($row->log_namespace, $row->log_title);
$logtitle = SpecialPage::getTitleFor('Log');
$loglink = $this->skin->makeKnownLinkObj($logtitle, wfMsgHtml('log'), wfArrayToCGI(array('page' => $title->getPrefixedUrl())));
// Action text
if (!LogEventsList::userCan($row, LogPage::DELETED_ACTION)) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$action = LogPage::actionText($row->log_type, $row->log_action, $title, $this->skin, $paramArray, true, true);
if ($row->log_deleted & LogPage::DELETED_ACTION) {
$action = '<span class="history-deleted">' . $action . '</span>';
}
}
// User links
$userLink = $this->skin->userLink($row->log_user, User::WhoIs($row->log_user));
if (LogEventsList::isDeleted($row, LogPage::DELETED_USER)) {
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
$comment = $wgLang->getDirMark() . $this->skin->commentBlock($row->log_comment);
if (LogEventsList::isDeleted($row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
return "<li>({$loglink}) {$date} {$userLink} {$action} {$comment}</li>";
}
示例15: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgLinkCache;
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$user = Title::makeTitleSafe(NS_USER, $s->user_name);
$time = $wgLang->timeanddate($s->log_timestamp, true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
if ($s->page_id) {
$wgLinkCache->addGoodLinkObj($s->page_id, $title);
} else {
$wgLinkCache->addBadLinkObj($title);
}
$userLink = $this->skin->makeLinkObj($user, htmlspecialchars($s->user_name));
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
if ($s->log_type == 'move' && isset($paramArray[0])) {
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Movepage');
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}