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


PHP LogFormatter类代码示例

本文整理汇总了PHP中LogFormatter的典型用法代码示例。如果您正苦于以下问题:PHP LogFormatter类的具体用法?PHP LogFormatter怎么用?PHP LogFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LogFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例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);
     $params[4] = $this->context->getLanguage()->userTimeAndDate($params[4], $this->context->getUser());
     return $params;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:MergeLogFormatter.php

示例15: 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


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