MediaWiki
REL1_24
|
Implements the default log formatting. More...
Public Member Functions | |
getActionLinks () | |
Returns extra links that comes after the action text, like "revert", etc. | |
getActionText () | |
Gets the log action, including username. | |
getComment () | |
Gets the user provided comment. | |
getIRCActionComment () | |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508). | |
getIRCActionText () | |
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508). | |
getMessageParametersForTesting () | |
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. | |
formatParameterValue ($type, $value) | |
Formats parameters values dependent to their type. | |
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 | |
int | $audience = self::FOR_PUBLIC |
Constant for handling log_deleted *. | |
LogEntryBase | $entry |
* | |
string | $irctext = false |
* | |
bool | $linkFlood = false |
Whether to output user tool links *. | |
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. |
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.
LogFormatter::__construct | ( | LogEntry $ | entry | ) | [protected] |
Definition at line 93 of file LogFormatter.php.
References $entry, and RequestContext\getMain().
LogFormatter::canView | ( | $ | field | ) | [protected] |
Check if a log item can be displayed.
int | $field | LogPage::DELETED_* constant |
Definition at line 123 of file LogFormatter.php.
Referenced by getActionText(), and getComment().
LogFormatter::extractParameters | ( | ) | [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.
Referenced by MoveLogFormatter\getActionLinks(), DeleteLogFormatter\getActionLinks(), and MoveLogFormatter\getPreloadTitles().
LogFormatter::formatParameterValue | ( | $ | type, |
$ | value | ||
) | [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 483 of file LogFormatter.php.
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.
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 360 of file LogFormatter.php.
Referenced by 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().
Gets the user provided comment.
Reimplemented in LegacyLogFormatter, and NewUsersLogFormatter.
Definition at line 573 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 163 of file LogFormatter.php.
Even uglier hack to maintain backwards compatibilty with IRC bots (bug 34508).
Definition at line 184 of file LogFormatter.php.
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 RightsLogFormatter, MoveLogFormatter, DeleteLogFormatter, and PatrolLogFormatter.
Definition at line 374 of file LogFormatter.php.
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 RightsLogFormatter, MoveLogFormatter, DeleteLogFormatter, PatrolLogFormatter, NewUsersLogFormatter, and PageLangLogFormatter.
Definition at line 439 of file LogFormatter.php.
Definition at line 658 of file LogFormatter.php.
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 555 of file LogFormatter.php.
Referenced by getActionText().
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.
Reimplemented in NewUsersLogFormatter, and MoveLogFormatter.
Definition at line 651 of file LogFormatter.php.
LogFormatter::getRestrictedElement | ( | $ | message | ) | [protected] |
Helper method for displaying restricted element.
string | $message |
Definition at line 593 of file LogFormatter.php.
Referenced by getActionText(), and getComment().
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 |
array | $parameters | Query parameters |
MWException |
Reimplemented in RightsLogFormatter.
Definition at line 536 of file LogFormatter.php.
Referenced by MoveLogFormatter\getMessageParameters().
LogFormatter::makeUserLink | ( | User $ | user | ) | [protected] |
Definition at line 627 of file LogFormatter.php.
Referenced by NewUsersLogFormatter\getMessageParameters().
LogFormatter::msg | ( | $ | key | ) | [protected] |
Shortcut for wfMessage which honors local context.
string | $key |
Definition at line 623 of file LogFormatter.php.
Referenced by MoveLogFormatter\getActionLinks(), DeleteLogFormatter\getActionLinks(), LegacyLogFormatter\getActionLinks(), getActionText(), PageLangLogFormatter\getMessageParameters(), DeleteLogFormatter\getMessageParameters(), and RightsLogFormatter\getMessageParameters().
static LogFormatter::newFromEntry | ( | LogEntry $ | entry | ) | [static] |
Constructs a new formatter suitable for given entry.
LogEntry | $entry |
Definition at line 45 of file LogFormatter.php.
References LogEntry\getFullType(), LogEntry\getType(), and global.
Referenced by RecentChangeTest\assertIRCComment(), and newFromRow().
static LogFormatter::newFromRow | ( | $ | row | ) | [static] |
Handy shortcut for constructing a formatter directly from database row.
object | $row |
Definition at line 71 of file LogFormatter.php.
References newFromEntry(), and DatabaseLogEntry\newFromRow().
Referenced by FeedUtils\formatDiff(), and RevDelLogItem\getHTML().
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 | Const self::FOR_THIS_USER or self::FOR_PUBLIC |
Definition at line 112 of file LogFormatter.php.
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.
LogFormatter::styleRestricedElement | ( | $ | content | ) | [protected] |
Helper method for styling restricted element.
string | $content |
Definition at line 609 of file LogFormatter.php.
Referenced by getActionText(), and getComment().
int LogFormatter::$audience = self::FOR_PUBLIC [protected] |
Constant for handling log_deleted *.
Definition at line 79 of file LogFormatter.php.
LogEntryBase LogFormatter::$entry [protected] |
string LogFormatter::$irctext = false [protected] |
*
Definition at line 91 of file LogFormatter.php.
bool LogFormatter::$linkFlood = false [protected] |
Whether to output user tool links *.
Definition at line 81 of file LogFormatter.php.
string LogFormatter::$plaintext = false [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 RevDelLogItem\getHTML().