本文整理汇总了PHP中LogFormatter类的典型用法代码示例。如果您正苦于以下问题:PHP LogFormatter类的具体用法?PHP LogFormatter怎么用?PHP LogFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogFormatter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _formatVar
function _formatVar(&$value)
{
if (is_null($value)) {
return LogFormatter::_formatNull($value);
}
if (is_bool($value)) {
return LogFormatter::_formatBool($value);
}
if (is_int($value) || is_float($value)) {
return $value;
}
if (is_object($value)) {
return LogFormatter::_formatObject($value);
}
// is_callable should be placed before is_string and is_array:
if (is_callable($value)) {
return LogFormatter::_formatCallback($value);
}
if (is_string($value)) {
return LogFormatter::_formatString($value);
}
if (is_array($value)) {
return LogFormatter::_formatArray($value);
}
return gettype($value) . ' { ... }';
}
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:26,代码来源:LogFormatter.php
示例2: execute
/**
* Main execution point
*
* @param string $subpage
*/
public function execute($subpage)
{
$this->rcSubpage = $subpage;
$this->setHeaders();
$this->outputHeader();
$this->addModules();
$rows = $this->getRows();
$opts = $this->getOptions();
if ($rows === false) {
if (!$this->including()) {
$this->doHeader($opts, 0);
$this->getOutput()->setStatusCode(404);
}
return;
}
$batch = new LinkBatch();
foreach ($rows as $row) {
$batch->add(NS_USER, $row->rc_user_text);
$batch->add(NS_USER_TALK, $row->rc_user_text);
$batch->add($row->rc_namespace, $row->rc_title);
if ($row->rc_source === RecentChange::SRC_LOG) {
$formatter = LogFormatter::newFromRow($row);
foreach ($formatter->getPreloadTitles() as $title) {
$batch->addObj($title);
}
}
}
$batch->execute();
$this->webOutput($rows, $opts);
$rows->free();
}
开发者ID:paladox,项目名称:mediawiki,代码行数:36,代码来源:ChangesListSpecialPage.php
示例3: getHTML
/**
* @return string A HTML <li> element representing this revision, showing
* change tags and everything
*/
public function getHTML()
{
$date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->row->log_timestamp, $this->list->getUser()));
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
$formatter = LogFormatter::newFromRow($this->row);
$formatter->setContext($this->list->getContext());
$formatter->setAudience(LogFormatter::FOR_THIS_USER);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), $this->list->msg('log')->escaped(), array(), array('page' => $title->getPrefixedText()));
$loglink = $this->list->msg('parentheses')->rawParams($loglink)->escaped();
// User links and action text
$action = $formatter->getActionText();
// Comment
$comment = $this->list->getLanguage()->getDirMark() . $formatter->getComment();
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
$content = "{$loglink} {$date} {$action} {$comment}";
$attribs = array();
$tags = $this->getTags();
if ($tags) {
list($tagSummary, $classes) = ChangeTags::formatSummaryRow($tags, 'edittags', $this->list->getContext());
$content .= " {$tagSummary}";
$attribs['class'] = implode(' ', $classes);
}
return Xml::tags('li', $attribs, $content);
}
开发者ID:OrBin,项目名称:mediawiki,代码行数:31,代码来源:ChangeTagsLogItem.php
示例4: 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) = IP::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);
$context = RequestContext::newExtraneousContext($target);
$formatter = LogFormatter::newFromRow($rc->mAttribs);
$formatter->setContext($context);
$actionText = $formatter->getPlainActionText();
} 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;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:39,代码来源:CheckUser.hooks.php
示例5: doTestLogFormatter
public function doTestLogFormatter($row, $extra)
{
RequestContext::resetMain();
$row = $this->expandDatabaseRow($row, $this->isLegacy($extra));
$formatter = LogFormatter::newFromRow($row);
$this->assertEquals($extra['text'], self::removeSomeHtml($formatter->getActionText()), 'Action text is equal to expected text');
$this->assertSame($extra['api'], self::removeApiMetaData($formatter->formatParametersForApi()), 'Api log params is equal to expected array');
}
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:LogFormatterTestCase.php
示例6: formatDiff
/**
* Format a diff for the newsfeed
*
* @param $row Object: row from the recentchanges table
* @return String
*/
public static function formatDiff($row)
{
$titleObj = Title::makeTitle($row->rc_namespace, $row->rc_title);
$timestamp = wfTimestamp(TS_MW, $row->rc_timestamp);
$actiontext = '';
if ($row->rc_type == RC_LOG) {
$rcRow = (array) $row;
// newFromRow() only accepts arrays for RC rows
$actiontext = LogFormatter::newFromRow($rcRow)->getActionText();
}
return self::formatDiffRow($titleObj, $row->rc_last_oldid, $row->rc_this_oldid, $timestamp, $row->rc_deleted & Revision::DELETED_COMMENT ? wfMessage('rev-deleted-comment')->escaped() : $row->rc_comment, $actiontext);
}
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:18,代码来源:FeedUtils.php
示例7: getHTML
public function getHTML()
{
$date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->row->log_timestamp, $this->list->getUser()));
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
$formatter = LogFormatter::newFromRow($this->row);
$formatter->setContext($this->list->getContext());
$formatter->setAudience(LogFormatter::FOR_THIS_USER);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), $this->list->msg('log')->escaped(), array(), array('page' => $title->getPrefixedText()));
$loglink = $this->list->msg('parentheses')->rawParams($loglink)->escaped();
// User links and action text
$action = $formatter->getActionText();
// Comment
$comment = $this->list->getLanguage()->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} {$action} {$comment}</li>";
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:RevDelLogItem.php
示例8: getMessageParameters
protected function getMessageParameters()
{
// First call the main function to load the other values
parent::getMessageParameters();
$params = $this->extractParameters();
// Backwards compat for older log entries
if (!isset($params[3])) {
return $this->parsedParameters;
}
// This will be localized with Linker::link
// @todo Somehow localize for plaintext messages
$title = Title::newFromText('Special:Permalink/' . $params[3]);
// Our simple version of LogFormatter::makeLink
if ($this->plaintext) {
$this->parsedParameters[2] = '[[' . $title->getPrefixedText() . ']]';
} else {
$this->parsedParameters[2] = Message::rawParam(Linker::link($title, htmlspecialchars($this->entry->getTarget())));
}
ksort($this->parsedParameters);
return $this->parsedParameters;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:21,代码来源:MassMessageSendLogFormatter.php
示例9: getStartBody
public function getStartBody()
{
# Do a link batch query
if ($this->getNumRows() > 0) {
$lb = new LinkBatch();
foreach ($this->mResult as $row) {
$lb->add($row->log_namespace, $row->log_title);
$lb->addObj(Title::makeTitleSafe(NS_USER, $row->user_name));
$lb->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->user_name));
$formatter = LogFormatter::newFromRow($row);
foreach ($formatter->getPreloadTitles() as $title) {
$lb->addObj($title);
}
}
$lb->execute();
$this->mResult->seek(0);
}
return '';
}
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:19,代码来源:LogPager.php
示例10: extractRowInfo
//.........这里部分代码省略.........
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_USER, $user)) {
if ($this->fld_user) {
$vals['user'] = $row->rc_user_text;
}
if ($this->fld_userid) {
$vals['userid'] = $row->rc_user;
}
if (!$row->rc_user) {
$vals['anon'] = true;
}
}
}
/* Add flags, such as new, minor, bot. */
if ($this->fld_flags) {
$vals['bot'] = (bool) $row->rc_bot;
$vals['new'] = $row->rc_type == RC_NEW;
$vals['minor'] = (bool) $row->rc_minor;
}
/* Add sizes of each revision. (Only available on 1.10+) */
if ($this->fld_sizes) {
$vals['oldlen'] = intval($row->rc_old_len);
$vals['newlen'] = intval($row->rc_new_len);
}
/* Add the timestamp. */
if ($this->fld_timestamp) {
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rc_timestamp);
}
/* Add edit summary / log summary. */
if ($this->fld_comment || $this->fld_parsedcomment) {
if ($row->rc_deleted & Revision::DELETED_COMMENT) {
$vals['commenthidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_COMMENT, $user)) {
if ($this->fld_comment && isset($row->rc_comment)) {
$vals['comment'] = $row->rc_comment;
}
if ($this->fld_parsedcomment && isset($row->rc_comment)) {
$vals['parsedcomment'] = Linker::formatComment($row->rc_comment, $title);
}
}
}
if ($this->fld_redirect) {
$vals['redirect'] = (bool) $row->page_is_redirect;
}
/* Add the patrolled flag */
if ($this->fld_patrolled) {
$vals['patrolled'] = $row->rc_patrolled == 1;
$vals['unpatrolled'] = ChangesList::isUnpatrolled($row, $user);
}
if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = true;
$anyHidden = true;
}
if (LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
$vals['logid'] = intval($row->rc_logid);
$vals['logtype'] = $row->rc_log_type;
$vals['logaction'] = $row->rc_log_action;
$vals['logparams'] = LogFormatter::newFromRow($row)->formatParametersForApi();
}
}
if ($this->fld_tags) {
if ($row->ts_tags) {
$tags = explode(',', $row->ts_tags);
ApiResult::setIndexedTagName($tags, 'tag');
$vals['tags'] = $tags;
} else {
$vals['tags'] = array();
}
}
if ($this->fld_sha1 && $row->rev_sha1 !== null) {
if ($row->rev_deleted & Revision::DELETED_TEXT) {
$vals['sha1hidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rev_deleted, Revision::DELETED_TEXT, $user)) {
if ($row->rev_sha1 !== '') {
$vals['sha1'] = wfBaseConvert($row->rev_sha1, 36, 16, 40);
} else {
$vals['sha1'] = '';
}
}
}
if (!is_null($this->token)) {
$tokenFunctions = $this->getTokenFunctions();
foreach ($this->token as $t) {
$val = call_user_func($tokenFunctions[$t], $row->rc_cur_id, $title, RecentChange::newFromRow($row));
if ($val === false) {
$this->setWarning("Action '{$t}' is not allowed for the current user");
} else {
$vals[$t . 'token'] = $val;
}
}
}
if ($anyHidden && $row->rc_deleted & Revision::DELETED_RESTRICTED) {
$vals['suppressed'] = true;
}
return $vals;
}
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:101,代码来源:ApiQueryRecentChanges.php
示例11: getMessageParameters
public function getMessageParameters()
{
$params = parent::getMessageParameters();
$type = $this->entry->getSubtype();
$entry_params = $this->entry->getParameters();
if ($type === 'approve') {
$revid = $entry_params['revid'];
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[4] = Message::rawParam($link);
} elseif ($type === 'reject') {
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$userlink = Linker::userLink($entry_params['user'], $entry_params['user_text']);
$params[5] = Message::rawParam($userlink);
} elseif ($type === 'merge') {
$revid = $entry_params['revid'];
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[5] = Message::rawParam($link);
} elseif ($type === 'approveall' || $type === 'rejectall' || $type === 'block' || $type === 'unblock') {
$title = $this->entry->getTarget();
$user_id = User::idFromName($title->getText());
$link = Linker::userLink($user_id, $title->getText());
$params[2] = Message::rawParam($link);
}
return $params;
}
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:30,代码来源:ModerationLogFormatter.php
示例12: getMessageParameters
public function getMessageParameters()
{
$params = parent::getMessageParameters();
$type = $this->entry->getFullType();
if ($type === 'translationreview/message') {
$targetPage = $this->makePageLink($this->entry->getTarget(), array('oldid' => $params[3]));
$params[2] = Message::rawParam($targetPage);
} elseif ($type === 'translationreview/group') {
/*
* - 3: language code
* - 4: label of the message group
* - 5: old state
* - 6: new state
*/
$uiLanguage = $this->context->getLanguage();
$language = $params[3];
$targetPage = $this->makePageLinkWithText($this->entry->getTarget(), $params[4], array('language' => $language));
$params[2] = Message::rawParam($targetPage);
$params[3] = TranslateUtils::getLanguageName($language, $uiLanguage->getCode());
$params[5] = $this->formatStateMessage($params[5]);
$params[6] = $this->formatStateMessage($params[6]);
} elseif ($type === 'translatorsandbox/rejected') {
// No point linking to the user page which cannot have existed
$params[2] = $this->entry->getTarget()->getText();
} elseif ($type === 'translatorsandbox/promoted') {
// Gender for the target
$params[3] = User::newFromId($params[3])->getName();
}
return $params;
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:TranslateLogFormatter.php
示例13: getMessageParameters
/**
* @return array
*/
protected function getMessageParameters()
{
$entry = $this->entry->getParameters();
$params = parent::getMessageParameters();
$filter_title = SpecialPage::getTitleFor('AbuseFilter', $entry['filter']);
$filter_caption = $this->msg('abusefilter-log-detailedentry-local')->params($entry['filter']);
$log_title = SpecialPage::getTitleFor('AbuseLog', $entry['log']);
$log_caption = $this->msg('abusefilter-log-detailslink');
$params[4] = $entry['action'];
if ($this->plaintext) {
$params[3] = '[[' . $filter_title->getPrefixedText() . '|' . $filter_caption . ']]';
$params[8] = '[[' . $log_title->getPrefixedText() . '|' . $log_caption . ']]';
} else {
$params[3] = Message::rawParam(Linker::link($filter_title, htmlspecialchars($filter_caption)));
$params[8] = Message::rawParam(Linker::link($log_title, htmlspecialchars($log_caption)));
}
$actions_taken = $entry['actions'];
if (!strlen(trim($actions_taken))) {
$actions_taken = $this->msg('abusefilter-log-noactions');
} else {
$actions = explode(',', $actions_taken);
$displayActions = array();
foreach ($actions as $action) {
$displayActions[] = AbuseFilter::getActionDisplay($action);
}
$actions_taken = $this->context->getLanguage()->commaList($displayActions);
}
$params[5] = $actions_taken;
// Bad things happen if the numbers are not in correct order
ksort($params);
return $params;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:35,代码来源:AbuseLogHitFormatter.php
示例14: getMessageParameters
protected function getMessageParameters() {
$params = parent::getMessageParameters();
$oldname = $this->makePageLink( $this->entry->getTarget(), array( 'redirect' => 'no' ) );
$newname = $this->makePageLink( Title::newFromText( $params[3] ) );
$params[2] = Message::rawParam( $oldname );
$params[3] = Message::rawParam( $newname );
return $params;
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:8,代码来源:MoveLogFormatter.php
示例15: getMessageParameters
protected function getMessageParameters()
{
$lang = $this->context->getLanguage();
$params = parent::getMessageParameters();
$params[3] = ContentHandler::getLocalizedName($params[3], $lang);
$params[4] = ContentHandler::getLocalizedName($params[4], $lang);
return $params;
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:8,代码来源:ContentModelLogFormatter.php
示例16: getComment
public function getComment() {
$timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
if ( $timestamp < '20080129000000' ) {
# Suppress $comment from old entries (before 2008-01-29),
# not needed and can contain incorrect links
return '';
}
return parent::getComment();
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:9,代码来源:NewUsersLogFormatter.php
示例17: getMessageParameters
protected function getMessageParameters()
{
parent::getMessageParameters();
$params = $this->extractParameters();
$lang = $this->context->getLanguage();
$this->parsedParameters[3] = Message::rawParam($lang->commaList(array_map(array($this, 'getCentralAuthLink'), explode('|', $params[3]))));
$this->parsedParameters[4] = Message::rawParam($this->getCentralAuthLink($params[4]));
ksort($this->parsedParameters);
return $this->parsedParameters;
}
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:10,代码来源:GlobalUserMergeLogFormatter.php
示例18: getMessageParameters
protected function getMessageParameters()
{
$params = parent::getMessageParameters();
$oldname = $this->makePageLink($this->entry->getTarget(), array('redirect' => 'no'));
$newname = $this->makePageLink(Title::newFromText($params[3]));
$params[2] = Message::rawParam($oldname);
$params[3] = Message::rawParam($newname);
$params[4] = $this->context->getLanguage()->userTimeAndDate($params[4], $this->context->getUser());
return $params;
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:MergeLogFormatter.php
示例19: getMessageParameters
protected function getMessageParameters()
{
$params = parent::getMessageParameters();
$subtype = $this->entry->getSubtype();
if ($subtype === 'requestwiki') {
$params[6] = str_replace('#', '', $params[6]);
$params[6] = Message::rawParam(Linker::linkKnown(Title::newFromText(SpecialPage::getTitleFor('RequestWikiQueue') . '/' . $params[6]), '#' . $params[6]));
return $params;
}
}
开发者ID:reviforks,项目名称:miraheze-cw,代码行数:10,代码来源:CreateWikiLogFormatter.php
示例20: getMessageParameters
protected function getMessageParameters()
{
$params = parent::getMessageParameters();
$subtype = $this->entry->getSubtype();
if ($subtype === 'move_prot') {
$oldname = $this->makePageLink(Title::newFromText($params[3]), array('redirect' => 'no'));
$params[3] = Message::rawParam($oldname);
}
return $params;
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:ProtectLogFormatter.php
注:本文中的LogFormatter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论