73 private $localisationCache;
97 parent::__construct( $context, $linkRenderer );
98 $this->localisationCache = $localisationCache;
100 $this->mIndexField =
'am_title';
109 $this->langcode = $this->lang->
getCode();
110 $this->foreign = !$this->lang->equals( $contentLanguage );
112 $filter = $opts->
getValue(
'filter' );
113 if ( $filter ===
'all' ) {
114 $this->custom =
null;
116 $this->custom = ( $filter ===
'unmodified' );
125 $displayPrefix =
$prefix->getDBkey();
126 $this->prefix =
'/^' . preg_quote( $displayPrefix,
'/' ) .
'/i';
128 $this->prefix =
false;
133 if ( $this->foreign ) {
140 private function getAllMessages( $descending ) {
141 $messageNames = $this->localisationCache->getSubitemList(
'en',
'messages' );
144 $messageNames = array_map( [ $this->lang,
'ucfirst' ], $messageNames );
147 rsort( $messageNames );
149 asort( $messageNames );
152 return $messageNames;
179 [
'page_namespace',
'page_title' ],
182 [
'USE INDEX' =>
'page_name_title' ]
184 $xNames = array_fill_keys( $messageNames,
true );
186 $pageFlags = $talkFlags = [];
188 foreach (
$res as $s ) {
192 $titleParts = explode(
'/', $s->page_title );
193 if ( count( $titleParts ) === 2 &&
195 isset( $xNames[$titleParts[0]] )
197 $exists = $titleParts[0];
199 } elseif ( isset( $xNames[$s->page_title] ) ) {
200 $exists = $s->page_title;
203 $title = Title::newFromRow( $s );
205 $pageFlags[$exists] =
true;
207 $talkFlags[$exists] =
true;
211 return [
'pages' => $pageFlags,
'talks' => $talkFlags ];
225 $messageNames = $this->getAllMessages( $order );
235 foreach ( $messageNames as $key ) {
236 $customised = isset( $statuses[
'pages'][$key] );
237 if ( $customised !== $this->custom &&
238 ( $asc && ( $key < $offset || !$offset ) || !$asc && $key > $offset ) &&
239 ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix ===
false )
241 $actual = $this->
msg( $key )->inLanguage( $this->lang )->plain();
242 $default = $this->
msg( $key )->inLanguage( $this->lang )->useDatabase(
false )->plain();
245 'am_actual' => $actual,
246 'am_default' => $default,
247 'am_customised' => $customised,
248 'am_talk_exists' => isset( $statuses[
'talks'][$key] )
253 if ( $count === $limit ) {
264 'id' =>
'mw-allmessagestable'
268 <th rowspan=\"2\">" .
269 $this->
msg(
'allmessagesname' )->escaped() .
"
272 $this->
msg(
'allmessagesdefault' )->escaped() .
277 $this->
msg(
'allmessagescurrent' )->escaped() .
283 return Html::closeElement(
'table' );
297 $translation = Linker::makeExternalLink(
299 'title' =>
'Special:SearchTranslations',
300 'group' =>
'mediawiki',
301 'grouppath' =>
'mediawiki',
303 'query' => $value .
' ' . $this->
msg( $value )->plain()
305 $this->
msg(
'allmessages-filter-translate' )->text()
307 $talkLink = $this->
msg(
'talkpagelinktext' )->text();
309 if ( $this->mCurrentRow->am_customised ) {
312 $title = $linkRenderer->makeBrokenLink(
316 if ( $this->mCurrentRow->am_talk_exists ) {
317 $talk = $linkRenderer->makeKnownLink( $talk, $talkLink );
319 $talk = $linkRenderer->makeBrokenLink(
326 $this->
msg(
'parentheses' )->rawParams( $talk )->escaped() .
328 $this->
msg(
'parentheses' )->rawParams( $translation )->escaped();
344 $s = parent::formatRow( $row );
347 if ( $row->am_customised ) {
348 $s .= Html::openElement(
'tr', $this->
getRowAttrs( $row ) );
349 $formatted = strval( $this->
formatValue(
'am_actual', $row->am_actual ) );
351 if ( $formatted ===
'' ) {
352 $formatted =
"\u{00A0}";
355 $s .= Html::rawElement(
'td', $this->
getCellAttrs(
'am_actual', $row->am_actual ), $formatted )
356 . Html::closeElement(
'tr' );
359 return Html::rawElement(
'tbody', [], $s );
373 if ( $field ===
'am_title' ) {
374 if ( $this->mCurrentRow->am_customised ) {
375 $attr += [
'rowspan' =>
'2' ];
379 'lang' => $this->lang->getHtmlCode(),
380 'dir' => $this->lang->getDir(),
382 if ( $this->mCurrentRow->am_customised ) {
384 $attr += [
'class' => $field ];
393 'am_title' => $this->
msg(
'allmessagesname' )->text(),
394 'am_default' => $this->
msg(
'allmessagesdefault' )->text()
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Base class for language-specific code.
getCode()
Get the internal language code for this language object.
Caching for the contents of localisation files.
static escapeHtmlAllowEntities( $html)
Given HTML input, escape with htmlspecialchars but un-escape entities.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static openElement( $element, $attribs=null)
This opens an XML element.
Interface for objects which can provide a MediaWiki context on request.