MediaWiki
1.23.2
|
Implements the default log formatting. More...
Public Member Functions | |
getActionLinks () | |
Returns extra links that comes after the action text, like "revert", etc. More... | |
getActionText () | |
Gets the log action, including username. More... | |
getComment () | |
Gets the user provided comment. More... | |
getIRCActionComment () | |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508). More... | |
getIRCActionText () | |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508). More... | |
getMessageParametersForTesting () | |
getPerformerElement () | |
Provides the name of the user who performed the log action. More... | |
getPlainActionText () | |
Ugly hack to produce plaintext version of the message. More... | |
getPreloadTitles () | |
setAudience ( $audience) | |
Set the visibility restrictions for displaying content. More... | |
setContext (IContextSource $context) | |
Replace the default context. More... | |
setShowUserToolLinks ( $value) | |
If set to true, will produce user tool links after the user name. More... | |
Static Public Member Functions | |
static | newFromEntry (LogEntry $entry) |
Constructs a new formatter suitable for given entry. More... | |
static | newFromRow ( $row) |
Handy shortcut for constructing a formatter directly from database row. More... | |
Public Attributes | |
const | FOR_PUBLIC = 1 |
const | FOR_THIS_USER = 2 |
Protected Member Functions | |
__construct (LogEntry $entry) | |
canView ( $field) | |
Check if a log item can be displayed. More... | |
extractParameters () | |
Extracts the optional extra parameters for use in action messages. More... | |
formatParameterValue ( $type, $value) | |
Formats parameters values dependent to their type. More... | |
getActionMessage () | |
Returns a sentence describing the log action. More... | |
getMessageKey () | |
Returns a key to be used for formatting the action sentence. More... | |
getMessageParameters () | |
Formats parameters intented for action message from array of all parameters. More... | |
getRestrictedElement ( $message) | |
Helper method for displaying restricted element. More... | |
makePageLink (Title $title=null, $parameters=array()) | |
Helper to make a link to the page, taking the plaintext value in consideration. More... | |
makeUserLink (User $user) | |
msg ( $key) | |
Shortcut for wfMessage which honors local context. More... | |
styleRestricedElement ( $content) | |
Helper method for styling restricted element. More... | |
Protected Attributes | |
Integer | $audience = self::FOR_PUBLIC |
Constant for handling log_deleted *. More... | |
LogEntryBase | $entry |
string | $irctext = false |
bool | $linkFlood = false |
Whether to output user tool links *. More... | |
string | $plaintext = false |
Set to true if we are constructing a message text that is going to be included in page history or send to IRC feed. More... | |
Implements the default log formatting.
Can be overridden by subclassing and setting $wgLogActionsHandlers['type/subtype'] = 'class'; or $wgLogActionsHandlers['type/*'] = 'class';
Definition at line 33 of file LogFormatter.php.
|
protected |
Definition at line 93 of file LogFormatter.php.
References $entry, and RequestContext\getMain().
|
protected |
Check if a log item can be displayed.
int | $field | LogPage::DELETED_* constant |
Definition at line 123 of file LogFormatter.php.
References LogEventsList\userCanBitfield().
Referenced by getActionText(), getComment(), getMessageParameters(), and getPerformerElement().
|
protected |
Extracts the optional extra parameters for use in action messages.
The array indexes start from number 3.
Definition at line 395 of file LogFormatter.php.
References $entry, $params, $type, $value, array(), as, false, formatParameterValue(), LogEntry\getParameters(), LogEntryBase\isLegacy(), and list.
Referenced by MoveLogFormatter\getActionLinks(), DeleteLogFormatter\getActionLinks(), LegacyLogFormatter\getActionLinks(), getMessageParameters(), and MoveLogFormatter\getPreloadTitles().
|
protected |
Formats parameters values dependent to their type.
string | $type | The type of the value. Valid are currently:
|
string | $value | The parameter value that should be formated |
Definition at line 484 of file LogFormatter.php.
References $linkFlood, $title, $type, $user, $value, makePageLink(), makeUserLink(), msg(), User\newFromName(), Title\newFromText(), and setShowUserToolLinks().
Referenced by extractParameters().
LogFormatter::getActionLinks | ( | ) |
Returns extra links that comes after the action text, like "revert", etc.
Reimplemented in LegacyLogFormatter, DeleteLogFormatter, and MoveLogFormatter.
Definition at line 386 of file LogFormatter.php.
|
protected |
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.
Reimplemented in LegacyLogFormatter.
Definition at line 360 of file LogFormatter.php.
References getMessageKey(), getMessageParameters(), and msg().
Referenced by getActionText().
LogFormatter::getActionText | ( | ) |
Gets the log action, including username.
Definition at line 337 of file LogFormatter.php.
References canView(), LogPage\DELETED_ACTION, getActionMessage(), getPerformerElement(), getRestrictedElement(), msg(), and styleRestricedElement().
Referenced by getPlainActionText().
LogFormatter::getComment | ( | ) |
Gets the user provided comment.
Reimplemented in LegacyLogFormatter, and NewUsersLogFormatter.
Definition at line 574 of file LogFormatter.php.
References $comment, canView(), Linker\commentBlock(), LogPage\DELETED_COMMENT, getRestrictedElement(), and styleRestricedElement().
LogFormatter::getIRCActionComment | ( | ) |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508).
Definition at line 163 of file LogFormatter.php.
References $comment, getIRCActionText(), and wfMessage().
LogFormatter::getIRCActionText | ( | ) |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508).
Definition at line 184 of file LogFormatter.php.
References $entry, LogEntry\getParameters(), getPlainActionText(), LogEntry\getSubtype(), LogEntry\getTarget(), LogEntry\getType(), text, and wfMessage().
Referenced by getIRCActionComment().
|
protected |
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.
Reimplemented in RightsLogFormatter, MoveLogFormatter, DeleteLogFormatter, and PatrolLogFormatter.
Definition at line 374 of file LogFormatter.php.
References $type.
Referenced by getActionMessage().
|
protected |
Formats parameters intented for action message from array of all parameters.
There are three hardcoded parameters (array is zero-indexed, this list not):
Reimplemented in RightsLogFormatter, MoveLogFormatter, DeleteLogFormatter, PatrolLogFormatter, and NewUsersLogFormatter.
Definition at line 439 of file LogFormatter.php.
References $entry, $params, canView(), LogPage\DELETED_USER, extractParameters(), LogEntry\getPerformer(), getPerformerElement(), LogEntry\getTarget(), and makePageLink().
Referenced by getActionMessage(), and getMessageParametersForTesting().
LogFormatter::getMessageParametersForTesting | ( | ) |
Definition at line 659 of file LogFormatter.php.
References getMessageParameters().
LogFormatter::getPerformerElement | ( | ) |
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.
Definition at line 556 of file LogFormatter.php.
References canView(), LogPage\DELETED_USER, getRestrictedElement(), makeUserLink(), and styleRestricedElement().
Referenced by LegacyLogFormatter\getActionMessage(), getActionText(), and getMessageParameters().
LogFormatter::getPlainActionText | ( | ) |
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.
Definition at line 149 of file LogFormatter.php.
References getActionText().
Referenced by getIRCActionText().
LogFormatter::getPreloadTitles | ( | ) |
Reimplemented in NewUsersLogFormatter, and MoveLogFormatter.
Definition at line 652 of file LogFormatter.php.
References array().
|
protected |
Helper method for displaying restricted element.
string | $message |
Definition at line 594 of file LogFormatter.php.
References $attribs, array(), msg(), and Html\rawElement().
Referenced by getActionText(), getComment(), and getPerformerElement().
Helper to make a link to the page, taking the plaintext value in consideration.
Title | $title | The page |
array | $parameters | Query parameters |
MWException |
Reimplemented in RightsLogFormatter.
Definition at line 537 of file LogFormatter.php.
References $link, $title, array(), and Linker\link().
Referenced by formatParameterValue(), MoveLogFormatter\getMessageParameters(), and getMessageParameters().
|
protected |
Definition at line 628 of file LogFormatter.php.
References $user, Linker\userLink(), and Linker\userToolLinksRedContribs().
Referenced by formatParameterValue(), NewUsersLogFormatter\getMessageParameters(), and getPerformerElement().
|
protected |
Shortcut for wfMessage which honors local context.
string | $key |
Definition at line 624 of file LogFormatter.php.
Referenced by formatParameterValue(), MoveLogFormatter\getActionLinks(), DeleteLogFormatter\getActionLinks(), LegacyLogFormatter\getActionLinks(), getActionMessage(), LegacyLogFormatter\getActionMessage(), getActionText(), DeleteLogFormatter\getMessageParameters(), RightsLogFormatter\getMessageParameters(), and getRestrictedElement().
|
static |
Constructs a new formatter suitable for given entry.
LogEntry | $entry |
Definition at line 45 of file LogFormatter.php.
References $entry, LogEntryBase\getFullType(), LogEntry\getType(), and global.
Referenced by LogPage\addEntry(), RecentChangeTest\assertIRCComment(), ManualLogEntry\getRecentChange(), LogEventsList\logLine(), Title\moveToInternal(), newFromRow(), LocalFile\recordUpload2(), LogFormatterTest\testLogComment(), LogFormatterTest\testLogParamsTypeMsg(), LogFormatterTest\testLogParamsTypeMsgContent(), LogFormatterTest\testLogParamsTypeNumber(), LogFormatterTest\testLogParamsTypePlain(), LogFormatterTest\testLogParamsTypeRaw(), LogFormatterTest\testLogParamsTypeTitleLink(), LogFormatterTest\testLogParamsTypeUserLink(), and LogFormatterTest\testNormalLogParams().
|
static |
Handy shortcut for constructing a formatter directly from database row.
$row |
Definition at line 71 of file LogFormatter.php.
References newFromEntry(), and DatabaseLogEntry\newFromRow().
Referenced by FeedUtils\formatDiff(), RevDel_LogItem\getHTML(), LogPager\getStartBody(), and ChangesList\insertLogEntry().
LogFormatter::setAudience | ( | $audience | ) |
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.
int | $audience | self::FOR_THIS_USER or self::FOR_PUBLIC |
Definition at line 112 of file LogFormatter.php.
References $audience, and FOR_THIS_USER.
LogFormatter::setContext | ( | IContextSource | $context | ) |
Replace the default context.
IContextSource | $context |
Definition at line 102 of file LogFormatter.php.
LogFormatter::setShowUserToolLinks | ( | $value | ) |
If set to true, will produce user tool links after the user name.
This should be replaced with generic CSS/JS solution.
bool | $value |
Definition at line 138 of file LogFormatter.php.
References $value.
Referenced by formatParameterValue().
|
protected |
Helper method for styling restricted element.
string | $content |
Definition at line 610 of file LogFormatter.php.
References $attribs, array(), and Html\rawElement().
Referenced by getActionText(), getComment(), and getPerformerElement().
|
protected |
Constant for handling log_deleted *.
Definition at line 79 of file LogFormatter.php.
Referenced by setAudience().
|
protected |
Definition at line 77 of file LogFormatter.php.
Referenced by __construct(), extractParameters(), LegacyLogFormatter\getActionMessage(), getIRCActionText(), getMessageParameters(), and newFromEntry().
|
protected |
Definition at line 91 of file LogFormatter.php.
|
protected |
Whether to output user tool links *.
Definition at line 81 of file LogFormatter.php.
Referenced by formatParameterValue().
|
protected |
Set to true if we are constructing a message text that is going to be included in page history or send to IRC feed.
Links are replaced with plaintext or with [[pagename]] kind of syntax, that is parsed by page histories and IRC feeds.
Definition at line 89 of file LogFormatter.php.
const LogFormatter::FOR_PUBLIC = 1 |
Definition at line 35 of file LogFormatter.php.
const LogFormatter::FOR_THIS_USER = 2 |
Definition at line 36 of file LogFormatter.php.
Referenced by RevDel_LogItem\getHTML(), and setAudience().