MediaWiki
REL1_19
|
Implements the default log formatting. More...
Public Member Functions | |
getActionText () | |
Gets the log action, including username. | |
getComment () | |
Gets the luser provided comment. | |
getIRCActionText () | |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508). | |
getPerformerElement () | |
Provides the name of the user who performed the log action. | |
getPlainActionText () | |
Ugly hack to produce plaintext version of the message. | |
getPreloadTitles () | |
setAudience ($audience) | |
Set the visibility restrictions for displaying content. | |
setContext (IContextSource $context) | |
Replace the default context. | |
setShowUserToolLinks ($value) | |
If set to true, will produce user tool links after the user name. | |
Static Public Member Functions | |
static | newFromEntry (LogEntry $entry) |
Constructs a new formatter suitable for given entry. | |
static | newFromRow ($row) |
Handy shortcut for constructing a formatter directly from database row. | |
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. | |
extractParameters () | |
Extracts the optional extra parameters for use in action messages. | |
getActionMessage () | |
Returns a sentence describing the log action. | |
getMessageKey () | |
Returns a key to be used for formatting the action sentence. | |
getMessageParameters () | |
Formats parameters intented for action message from array of all parameters. | |
getRestrictedElement ($message) | |
Helper method for displaying restricted element. | |
makePageLink (Title $title=null, $parameters=array()) | |
Helper to make a link to the page, taking the plaintext value in consideration. | |
makeUserLink (User $user) | |
msg ($key) | |
Shortcut for wfMessage which honors local context. | |
styleRestricedElement ($content) | |
Helper method for styling restricted element. | |
Protected Attributes | |
$audience = self::FOR_PUBLIC | |
Integer constant for handling log_deleted. | |
$entry | |
$irctext = false | |
$linkFlood = false | |
Whether to output user tool links. | |
$plaintext = false |
Implements the default log formatting.
Can be overridden by subclassing and setting $wgLogActionsHandlers['type/subtype'] = 'class'; or $wgLogActionsHandlers['type/*'] = 'class';
Definition at line 18 of file LogFormatter.php.
LogFormatter::__construct | ( | LogEntry $ | entry | ) | [protected] |
Definition at line 82 of file LogFormatter.php.
References $entry, and RequestContext\getMain().
LogFormatter::canView | ( | $ | field | ) | [protected] |
Check if a log item can be displayed.
$field | integer LogPage::DELETED_* constant |
Definition at line 112 of file LogFormatter.php.
References LogEventsList\userCanBitfield().
Referenced by getActionText(), getComment(), and getPerformerElement().
LogFormatter::extractParameters | ( | ) | [protected] |
Extracts the optional extra parameters for use in action messages.
The array indexes start from number 3.
Definition at line 296 of file LogFormatter.php.
Referenced by getMessageParameters(), and MoveLogFormatter\getPreloadTitles().
LogFormatter::getActionMessage | ( | ) | [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 271 of file LogFormatter.php.
References getMessageKey(), getMessageParameters(), and msg().
Referenced by getActionText().
Gets the log action, including username.
Definition at line 248 of file LogFormatter.php.
References canView(), LogPage\DELETED_ACTION, getActionMessage(), getPerformerElement(), getRestrictedElement(), msg(), and styleRestricedElement().
Referenced by getIRCActionText(), and getPlainActionText().
Gets the luser provided comment.
Reimplemented in NewUsersLogFormatter.
Definition at line 395 of file LogFormatter.php.
References $comment, canView(), Linker\commentBlock(), LogPage\DELETED_COMMENT, getRestrictedElement(), and styleRestricedElement().
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508).
Definition at line 151 of file LogFormatter.php.
References $entry, getActionText(), getPlainActionText(), wfMsgExt(), and wfMsgForContent().
LogFormatter::getMessageKey | ( | ) | [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 PatrolLogFormatter, DeleteLogFormatter, and MoveLogFormatter.
Definition at line 284 of file LogFormatter.php.
Referenced by getActionMessage().
LogFormatter::getMessageParameters | ( | ) | [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 NewUsersLogFormatter, PatrolLogFormatter, DeleteLogFormatter, and MoveLogFormatter.
Definition at line 337 of file LogFormatter.php.
References $entry, extractParameters(), getPerformerElement(), makePageLink(), and Message\rawParam().
Referenced by getActionMessage().
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 377 of file LogFormatter.php.
References canView(), LogPage\DELETED_USER, getRestrictedElement(), makeUserLink(), and styleRestricedElement().
Referenced by LegacyLogFormatter\getActionMessage(), getActionText(), and getMessageParameters().
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 138 of file LogFormatter.php.
References getActionText().
Referenced by getIRCActionText().
Reimplemented in MoveLogFormatter.
Definition at line 475 of file LogFormatter.php.
LogFormatter::getRestrictedElement | ( | $ | message | ) | [protected] |
Helper method for displaying restricted element.
$message | string |
Definition at line 415 of file LogFormatter.php.
References msg(), and Html\rawElement().
Referenced by getActionText(), getComment(), and getPerformerElement().
LogFormatter::makePageLink | ( | Title $ | title = null , |
$ | parameters = array() |
||
) | [protected] |
Helper to make a link to the page, taking the plaintext value in consideration.
$title | Title the page |
$parameters | array query parameters |
Definition at line 360 of file LogFormatter.php.
References $title, and Linker\link().
Referenced by getMessageParameters(), and MoveLogFormatter\getMessageParameters().
LogFormatter::makeUserLink | ( | User $ | user | ) | [protected] |
Definition at line 450 of file LogFormatter.php.
References User\getEditCount(), User\getId(), User\getName(), Linker\userLink(), and Linker\userToolLinks().
Referenced by NewUsersLogFormatter\getMessageParameters(), and getPerformerElement().
LogFormatter::msg | ( | $ | key | ) | [protected] |
Shortcut for wfMessage which honors local context.
$key | string |
Definition at line 444 of file LogFormatter.php.
References wfMessage().
Referenced by getActionMessage(), LegacyLogFormatter\getActionMessage(), getActionText(), DeleteLogFormatter\getMessageParameters(), and getRestrictedElement().
static LogFormatter::newFromEntry | ( | LogEntry $ | entry | ) | [static] |
Constructs a new formatter suitable for given entry.
$entry | LogEntry |
Definition at line 30 of file LogFormatter.php.
References $wgLogActionsHandlers, LogEntry\getFullType(), and LogEntry\getType().
Referenced by LogPage\addEntry(), LogEventsList\logLine(), Title\moveToInternal(), newFromRow(), and ManualLogEntry\publish().
static LogFormatter::newFromRow | ( | $ | row | ) | [static] |
Handy shortcut for constructing a formatter directly from database row.
$row |
Definition at line 56 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.
$audience | integer self::FOR_THIS_USER or self::FOR_PUBLIC |
Definition at line 101 of file LogFormatter.php.
References $audience, and FOR_THIS_USER.
LogFormatter::setContext | ( | IContextSource $ | context | ) |
Replace the default context.
$context | IContextSource |
Definition at line 91 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.
$value | boolean |
Definition at line 127 of file LogFormatter.php.
LogFormatter::styleRestricedElement | ( | $ | content | ) | [protected] |
Helper method for styling restricted element.
$content | string |
Definition at line 430 of file LogFormatter.php.
References Html\rawElement().
Referenced by getActionText(), getComment(), and getPerformerElement().
LogFormatter::$audience = self::FOR_PUBLIC [protected] |
Integer constant for handling log_deleted.
Definition at line 66 of file LogFormatter.php.
Referenced by setAudience().
LogFormatter::$entry [protected] |
Definition at line 63 of file LogFormatter.php.
Referenced by __construct(), extractParameters(), LegacyLogFormatter\getActionMessage(), getIRCActionText(), and getMessageParameters().
LogFormatter::$irctext = false [protected] |
Definition at line 80 of file LogFormatter.php.
LogFormatter::$linkFlood = false [protected] |
Whether to output user tool links.
Definition at line 69 of file LogFormatter.php.
LogFormatter::$plaintext = false [protected] |
Definition at line 78 of file LogFormatter.php.
const LogFormatter::FOR_PUBLIC = 1 |
Definition at line 20 of file LogFormatter.php.
const LogFormatter::FOR_THIS_USER = 2 |
Definition at line 21 of file LogFormatter.php.
Referenced by RevDel_LogItem\getHTML(), and setAudience().