MediaWiki  master
UppercaseCollation.php
Go to the documentation of this file.
1 <?php
24 
26 
27  private $lang;
28 
29  public function __construct() {
30  // Get a language object so that we can use the generic UTF-8 uppercase
31  // function there
32  $this->lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
33  }
34 
35  public function getSortKey( $string ) {
36  return $this->lang->uc( $string );
37  }
38 
39  public function getFirstLetter( $string ) {
40  if ( $string[0] == "\0" ) {
41  $string = substr( $string, 1 );
42  }
43  return $this->lang->ucfirst( $this->lang->firstChar( $string ) );
44  }
45 
46 }
UppercaseCollation\getFirstLetter
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
Definition: UppercaseCollation.php:39
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:154
UppercaseCollation
Definition: UppercaseCollation.php:25
Collation
Definition: Collation.php:30
UppercaseCollation\__construct
__construct()
Definition: UppercaseCollation.php:29
UppercaseCollation\$lang
$lang
Definition: UppercaseCollation.php:27
UppercaseCollation\getSortKey
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
Definition: UppercaseCollation.php:35