[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/logging/ -> LogFormatter.php (summary)

Contains classes for formatting log entries This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Niklas Laxström
License: http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
File Size: 834 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

LogFormatter:: (26 methods):
  newFromEntry()
  newFromRow()
  __construct()
  setContext()
  setAudience()
  canView()
  setShowUserToolLinks()
  getPlainActionText()
  getIRCActionComment()
  getIRCActionText()
  getActionText()
  getActionMessage()
  getMessageKey()
  getActionLinks()
  extractParameters()
  getMessageParameters()
  formatParameterValue()
  makePageLink()
  getPerformerElement()
  getComment()
  getRestrictedElement()
  styleRestricedElement()
  msg()
  makeUserLink()
  getPreloadTitles()
  getMessageParametersForTesting()

LegacyLogFormatter:: (3 methods):
  getComment()
  getActionMessage()
  getActionLinks()


Class: LogFormatter  - X-Ref

Implements the default log formatting.
Can be overridden by subclassing and setting
$wgLogActionsHandlers['type/subtype'] = 'class'; or
$wgLogActionsHandlers['type/*'] = 'class';

newFromEntry( LogEntry $entry )   X-Ref
Constructs a new formatter suitable for given entry.

param: LogEntry $entry
return: LogFormatter

newFromRow( $row )   X-Ref
Handy shortcut for constructing a formatter directly from
database row.

param: object $row
return: LogFormatter

__construct( LogEntry $entry )   X-Ref
No description

setContext( IContextSource $context )   X-Ref
Replace the default context

param: IContextSource $context

setAudience( $audience )   X-Ref
Set the visibility restrictions for displaying content.
If set to public, and an item is deleted, then it will be replaced
with a placeholder even if the context user is allowed to view it.

param: int $audience Const self::FOR_THIS_USER or self::FOR_PUBLIC

canView( $field )   X-Ref
Check if a log item can be displayed

param: int $field LogPage::DELETED_* constant
return: bool

setShowUserToolLinks( $value )   X-Ref
If set to true, will produce user tool links after
the user name. This should be replaced with generic
CSS/JS solution.

param: bool $value

getPlainActionText()   X-Ref
Ugly hack to produce plaintext version of the message.
Usually you also want to set extraneous request context
to avoid formatting for any particular user.

return: string Plain text

getIRCActionComment()   X-Ref
Even uglier hack to maintain backwards compatibilty with IRC bots
(bug 34508).

return: string Text

getIRCActionText()   X-Ref
Even uglier hack to maintain backwards compatibilty with IRC bots
(bug 34508).

return: string Text

getActionText()   X-Ref
Gets the log action, including username.

return: string HTML

getActionMessage()   X-Ref
Returns a sentence describing the log action. Usually
a Message object is returned, but old style log types
and entries might return pre-escaped HTML string.

return: Message|string Pre-escaped HTML

getMessageKey()   X-Ref
Returns a key to be used for formatting the action sentence.
Default is logentry-TYPE-SUBTYPE for modern logs. Legacy log
types will use custom keys, and subclasses can also alter the
key depending on the entry itself.

return: string Message key

getActionLinks()   X-Ref
Returns extra links that comes after the action text, like "revert", etc.

return: string

extractParameters()   X-Ref
Extracts the optional extra parameters for use in action messages.
The array indexes start from number 3.

return: array

getMessageParameters()   X-Ref
Formats parameters intented for action message from
array of all parameters. There are three hardcoded
parameters (array is zero-indexed, this list not):
- 1: user name with premade link
- 2: usable for gender magic function
- 3: target page with premade link

return: array

formatParameterValue( $type, $value )   X-Ref
Formats parameters values dependent to their type

param: string $type The type of the value.
param: string $value The parameter value that should
return: string|array Formated value

makePageLink( Title $title = null, $parameters = array()   X-Ref
Helper to make a link to the page, taking the plaintext
value in consideration.

param: Title $title The page
param: array $parameters Query parameters
return: string

getPerformerElement()   X-Ref
Provides the name of the user who performed the log action.
Used as part of log action message or standalone, depending
which parts of the log entry has been hidden.

return: string

getComment()   X-Ref
Gets the user provided comment

return: string HTML

getRestrictedElement( $message )   X-Ref
Helper method for displaying restricted element.

param: string $message
return: string HTML or wiki text

styleRestricedElement( $content )   X-Ref
Helper method for styling restricted element.

param: string $content
return: string HTML or wiki text

msg( $key )   X-Ref
Shortcut for wfMessage which honors local context.

param: string $key
return: Message

makeUserLink( User $user )   X-Ref
No description

getPreloadTitles()   X-Ref

return: array Array of titles that should be preloaded with LinkBatch

getMessageParametersForTesting()   X-Ref

return: array Output of getMessageParameters() for testing

Class: LegacyLogFormatter  - X-Ref

This class formats all log entries for log types
which have not been converted to the new system.
This is not about old log entries which store
parameters in a different format - the new
LogFormatter classes have code to support formatting
those too.

getComment()   X-Ref
Cache for the result of getActionLinks() so that it does not need to
run multiple times depending on the order that getComment() and
getActionLinks() are called.


getActionMessage()   X-Ref
No description

getActionLinks()   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1