MediaWiki REL1_31
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}
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.