MediaWiki  1.34.0
UppercaseCollation.php
Go to the documentation of this file.
1 <?php
24 
25  private $lang;
26 
27  public function __construct() {
28  // Get a language object so that we can use the generic UTF-8 uppercase
29  // function there
30  $this->lang = Language::factory( 'en' );
31  }
32 
33  public function getSortKey( $string ) {
34  return $this->lang->uc( $string );
35  }
36 
37  public function getFirstLetter( $string ) {
38  if ( $string[0] == "\0" ) {
39  $string = substr( $string, 1 );
40  }
41  return $this->lang->ucfirst( $this->lang->firstChar( $string ) );
42  }
43 
44 }
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:37
UppercaseCollation
Definition: UppercaseCollation.php:23
Collation
Definition: Collation.php:29
UppercaseCollation\__construct
__construct()
Definition: UppercaseCollation.php:27
UppercaseCollation\$lang
$lang
Definition: UppercaseCollation.php:25
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:217
UppercaseCollation\getSortKey
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
Definition: UppercaseCollation.php:33