本文整理汇总了PHP中ChangesList::insertComment方法的典型用法代码示例。如果您正苦于以下问题:PHP ChangesList::insertComment方法的具体用法?PHP ChangesList::insertComment怎么用?PHP ChangesList::insertComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChangesList
的用法示例。
在下文中一共展示了ChangesList::insertComment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onChangesListInsertLogEntry
/**
* @brief Adjusting recent changes for Wall
*
* @desc This method creates comment about revision deletion of a message on message wall
*
* @param ChangesList $list
* @param RecentChange $rc
* @param String $s
* @param Formatter $formatter
* @param string $mark
*
* @return true because this is a hook
*
* @author Andrzej 'nAndy' Lukaszewski
*/
public function onChangesListInsertLogEntry($list, $rc, &$s, $formatter, &$mark)
{
$app = F::app();
if ($rc->getAttribute('rc_type') == RC_LOG && in_array(MWNamespace::getSubject($rc->getAttribute('rc_namespace')), $app->wg->WallNS) && in_array($rc->getAttribute('rc_log_action'), $this->rcWallActionTypes)) {
$actionText = '';
$wfMsgOptsBase = $this->getMessageOptions($rc);
$wfMsgOpts = array($wfMsgOptsBase['articleUrl'], $wfMsgOptsBase['articleTitleTxt'], $wfMsgOptsBase['wallPageUrl'], $wfMsgOptsBase['wallPageName'], $wfMsgOptsBase['actionUser']);
$msgType = $wfMsgOptsBase['isThread'] ? 'thread' : 'reply';
//created in WallHooksHelper::getMessageOptions()
//and there is not needed to be passed to wfMsg()
unset($wfMsgOpts['isThread'], $wfMsgOpts['isNew']);
switch ($rc->getAttribute('rc_log_action')) {
case 'wall_remove':
$actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-removed-' . $msgType, array('parseinline'), $wfMsgOpts);
break;
case 'wall_restore':
$actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-restored-' . $msgType, array('parseinline'), $wfMsgOpts);
break;
case 'wall_admindelete':
$actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-deleted-' . $msgType, array('parseinline'), $wfMsgOpts);
break;
case 'wall_archive':
$actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-closed-thread', array('parseinline'), $wfMsgOpts);
break;
case 'wall_reopen':
$actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-reopened-thread', array('parseinline'), $wfMsgOpts);
break;
default:
$actionText = wfMsg($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-unrecognized-log-action', $wfMsgOpts);
break;
}
$s = '';
$list->insertUserRelatedLinks($s, $rc);
$s .= ' ' . $actionText . ' ' . $list->insertComment($rc);
}
return true;
}
示例2: recentChangesBlockGroup
//.........这里部分代码省略.........
} else {
$r .= $this->skin->makeKnownLinkObj($block[0]->getTitle(), $nchanges[$n], $curIdEq . "&diff={$currentRevision}&oldid={$oldid}");
}
}
}
# History
if ($allLogs) {
// don't show history link for logs
} else {
if ($namehidden || !$block[0]->getTitle()->exists()) {
$r .= $this->message['semicolon-separator'] . $this->message['hist'] . ')';
} else {
$r .= $this->message['semicolon-separator'] . $this->skin->makeKnownLinkObj($block[0]->getTitle(), $this->message['hist'], $curIdEq . '&action=history') . ')';
}
}
$r .= ' . . ';
# Character difference (does not apply if only log items)
if ($wgRCShowChangedSize && !$allLogs) {
$last = 0;
$first = count($block) - 1;
# Some events (like logs) have an "empty" size, so we need to skip those...
while ($last < $first && $block[$last]->mAttribs['rc_new_len'] === NULL) {
$last++;
}
while ($first > $last && $block[$first]->mAttribs['rc_old_len'] === NULL) {
$first--;
}
# Get net change
$chardiff = $rcObj->getCharacterDifference($block[$first]->mAttribs['rc_old_len'], $block[$last]->mAttribs['rc_new_len']);
if ($chardiff == '') {
$r .= ' ';
} else {
$r .= ' ' . $chardiff . ' . . ';
}
}
$r .= $users;
$r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
$r .= "</td></tr></table>\n";
# Sub-entries
$r .= '<div id="mw-rc-subentries-' . $jsid . '" class="mw-changeslist-hidden">';
$r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">';
foreach ($block as $rcObj) {
# Extract fields from DB into the function scope (rc_xxxx variables)
// FIXME: Would be good to replace this extract() call with something
// that explicitly initializes variables.
extract($rcObj->mAttribs);
#$r .= '<tr><td valign="top">'.$this->spacerArrow();
$r .= '<tr><td valign="top">';
$r .= '<tt>' . $this->spacerIndent() . $this->spacerIndent();
$r .= $this->recentChangesFlags($rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot);
$r .= ' </tt></td><td valign="top">';
$o = '';
if ($rc_this_oldid != 0) {
$o = 'oldid=' . $rc_this_oldid;
}
# Log timestamp
if ($rc_type == RC_LOG) {
$link = '<tt>' . $rcObj->timestamp . '</tt> ';
# Revision link
} else {
if (!ChangesList::userCan($rcObj, Revision::DELETED_TEXT)) {
$link = '<span class="history-deleted"><tt>' . $rcObj->timestamp . '</tt></span> ';
} else {
$rcIdEq = $rcObj->unpatrolled && $rc_type == RC_NEW ? '&rcid=' . $rcObj->mAttribs['rc_id'] : '';
$link = '<tt>' . $this->skin->makeKnownLinkObj($rcObj->getTitle(), $rcObj->timestamp, $curIdEq . '&' . $o . $rcIdEq) . '</tt>';
if ($this->isDeleted($rcObj, Revision::DELETED_TEXT)) {
$link = '<span class="history-deleted">' . $link . '</span> ';
}
}
}
$r .= $link;
if (!$rc_type == RC_LOG || $rc_type == RC_NEW) {
$r .= ' (';
$r .= $rcObj->curlink;
$r .= $this->message['semicolon-separator'];
$r .= $rcObj->lastlink;
$r .= ')';
}
$r .= ' . . ';
# Character diff
if ($wgRCShowChangedSize) {
$r .= $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ';
}
# User links
$r .= $rcObj->userlink;
$r .= $rcObj->usertalklink;
// log action
parent::insertAction($r, $rcObj);
// log comment
parent::insertComment($r, $rcObj);
# Mark revision as deleted
if (!$rc_log_type && $this->isDeleted($rcObj, Revision::DELETED_TEXT)) {
$r .= ' <tt>' . wfMsgHtml('deletedrev') . '</tt>';
}
$r .= "</td></tr>\n";
}
$r .= "</table></div>\n";
$this->rcCacheIndex++;
return $r;
}