MediaWiki  1.23.15
RightsLogFormatter.php
Go to the documentation of this file.
1 <?php
32  protected function makePageLink( Title $title = null, $parameters = array() ) {
33  global $wgContLang, $wgUserrightsInterwikiDelimiter;
34 
35  if ( !$this->plaintext ) {
36  $text = $wgContLang->ucfirst( $title->getText() );
37  $parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
38 
39  if ( count( $parts ) === 2 ) {
40  $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0],
41  htmlspecialchars( $title->getPrefixedText() ) );
42 
43  if ( $titleLink !== false ) {
44  return $titleLink;
45  }
46  }
47  }
48 
49  return parent::makePageLink( $title, $parameters );
50  }
51 
52  protected function getMessageKey() {
53  $key = parent::getMessageKey();
54  $params = $this->getMessageParameters();
55  if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
56  $key .= '-legacy';
57  }
58 
59  return $key;
60  }
61 
62  protected function getMessageParameters() {
63  $params = parent::getMessageParameters();
64 
65  // Really old entries
66  if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
67  return $params;
68  }
69 
70  $oldGroups = $params[3];
71  $newGroups = $params[4];
72 
73  // Less old entries
74  if ( $oldGroups === '' ) {
75  $oldGroups = array();
76  } elseif ( is_string( $oldGroups ) ) {
77  $oldGroups = array_map( 'trim', explode( ',', $oldGroups ) );
78  }
79  if ( $newGroups === '' ) {
80  $newGroups = array();
81  } elseif ( is_string( $newGroups ) ) {
82  $newGroups = array_map( 'trim', explode( ',', $newGroups ) );
83  }
84 
85  $userName = $this->entry->getTarget()->getText();
86  if ( !$this->plaintext && count( $oldGroups ) ) {
87  foreach ( $oldGroups as &$group ) {
88  $group = User::getGroupMember( $group, $userName );
89  }
90  }
91  if ( !$this->plaintext && count( $newGroups ) ) {
92  foreach ( $newGroups as &$group ) {
93  $group = User::getGroupMember( $group, $userName );
94  }
95  }
96 
97  $lang = $this->context->getLanguage();
98  if ( count( $oldGroups ) ) {
99  $params[3] = $lang->listToText( $oldGroups );
100  } else {
101  $params[3] = $this->msg( 'rightsnone' )->text();
102  }
103  if ( count( $newGroups ) ) {
104  // Array_values is used here because of bug 42211
105  // see use of array_unique in UserrightsPage::doSaveUserGroups on $newGroups.
106  $params[4] = $lang->listToText( array_values( $newGroups ) );
107  } else {
108  $params[4] = $this->msg( 'rightsnone' )->text();
109  }
110 
111  return $params;
112  }
113 }
WikiMap\foreignUserLink
static foreignUserLink( $wikiID, $user, $text=null)
Convenience to get a link to a user page on a foreign wiki.
Definition: WikiMap.php:81
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
RightsLogFormatter\makePageLink
makePageLink(Title $title=null, $parameters=array())
Helper to make a link to the page, taking the plaintext value in consideration.
Definition: RightsLogFormatter.php:32
$params
$params
Definition: styleTest.css.php:40
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
LogFormatter\msg
msg( $key)
Shortcut for wfMessage which honors local context.
Definition: LogFormatter.php:624
RightsLogFormatter
This class formats rights log entries.
Definition: RightsLogFormatter.php:31
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
RightsLogFormatter\getMessageKey
getMessageKey()
Returns a key to be used for formatting the action sentence.
Definition: RightsLogFormatter.php:52
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
RightsLogFormatter\getMessageParameters
getMessageParameters()
Formats parameters intented for action message from array of all parameters.
Definition: RightsLogFormatter.php:62
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
User\getGroupMember
static getGroupMember( $group, $username='#')
Get the localized descriptive name for a member of a group, if it exists.
Definition: User.php:4230
LogFormatter
Implements the default log formatting.
Definition: LogFormatter.php:33
Title
Represents a title within MediaWiki.
Definition: Title.php:35
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9