r67838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67837‎ | r67838 | r67839 >
Date:02:57, 11 June 2010
Author:liangent
Status:deferred
Tags:
Comment:
Replace 4 continuous spaces with a tab
Modified paths:
  • /trunk/extensions/CategoryMultisortChinese/CategoryMultisortChinese.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryMultisortChinese/CategoryMultisortChinese.hooks.php
@@ -100,66 +100,66 @@
101101 }
102102
103103 function onCategoryMultisortSortkeys_splitString( $str ) {
104 - global $wgContLang;
105 -
106 - $result = array();
107 - while ( $str ) {
108 - $fc = $wgContLang->firstChar( $str );
109 - $result[] = $fc;
110 - $str = substr( $str, strlen( $fc ) );
111 - }
112 - return $result;
 104+ global $wgContLang;
 105+
 106+ $result = array();
 107+ while ( $str ) {
 108+ $fc = $wgContLang->firstChar( $str );
 109+ $result[] = $fc;
 110+ $str = substr( $str, strlen( $fc ) );
 111+ }
 112+ return $result;
113113 }
114114
115115 function onCategoryMultisortSortkeys_buildMandarinSortkey( $data, $str ) {
116 - $result = '';
117 - foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
118 - # One UTF-8 character can have 4 bytes max.
119 - $c = str_pad( $ch, 4 );
120 - $chcp = utf8ToCodepoint( $ch );
121 - # One Mandarin entry can have 7 bytes max.
122 - $md = str_pad( array_key_exists( $chcp, $data->mandarin ) ? $data->mandarin[$chcp] : '', 7 );
123 - $result .= $md . $c;
124 - }
125 - return $result;
 116+ $result = '';
 117+ foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
 118+ # One UTF-8 character can have 4 bytes max.
 119+ $c = str_pad( $ch, 4 );
 120+ $chcp = utf8ToCodepoint( $ch );
 121+ # One Mandarin entry can have 7 bytes max.
 122+ $md = str_pad( array_key_exists( $chcp, $data->mandarin ) ? $data->mandarin[$chcp] : '', 7 );
 123+ $result .= $md . $c;
 124+ }
 125+ return $result;
126126 }
127127
128128 function onCategoryMultisortSortkeys_buildCantoneseSortkey( $data, $str ) {
129 - $result = '';
130 - foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
131 - # One UTF-8 character can have 4 bytes max.
132 - $c = str_pad( $ch, 4 );
133 - $chcp = utf8ToCodepoint( $ch );
134 - # One Cantonese entry can have 7 bytes max ([a-z]{1,6}[1-6]).
135 - $md = str_pad( array_key_exists( $chcp, $data->cantonese ) ? $data->cantonese[$chcp] : '', 7 );
136 - $result .= $md . $c;
137 - }
138 - return $result;
 129+ $result = '';
 130+ foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
 131+ # One UTF-8 character can have 4 bytes max.
 132+ $c = str_pad( $ch, 4 );
 133+ $chcp = utf8ToCodepoint( $ch );
 134+ # One Cantonese entry can have 7 bytes max ([a-z]{1,6}[1-6]).
 135+ $md = str_pad( array_key_exists( $chcp, $data->cantonese ) ? $data->cantonese[$chcp] : '', 7 );
 136+ $result .= $md . $c;
 137+ }
 138+ return $result;
139139 }
140140
141141 function onCategoryMultisortSortkeys_buildStrokeSortkey( $data, $str ) {
142 - $result = '';
143 - foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
144 - # One UTF-8 character can have 4 bytes max.
145 - $c = str_pad( $ch, 4 );
146 - $chcp = utf8ToCodepoint( $ch );
147 - # One stroke entry always has 3 bytes, or blank if unavailable.
148 - $s = str_pad( $this->onCategoryMultisortSortkeys_getStroke( $data, $chcp ), 3 );
149 - $result .= $s . $c;
150 - }
151 - return $result;
 142+ $result = '';
 143+ foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
 144+ # One UTF-8 character can have 4 bytes max.
 145+ $c = str_pad( $ch, 4 );
 146+ $chcp = utf8ToCodepoint( $ch );
 147+ # One stroke entry always has 3 bytes, or blank if unavailable.
 148+ $s = str_pad( $this->onCategoryMultisortSortkeys_getStroke( $data, $chcp ), 3 );
 149+ $result .= $s . $c;
 150+ }
 151+ return $result;
152152 }
153153
154154 function onCategoryMultisortSortkeys_buildRadicalSortkey( $data, $str ) {
155 - $result = '';
156 - foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
157 - # One UTF-8 character can have 4 bytes max.
158 - $c = str_pad( $ch, 4 );
159 - $chcp = utf8ToCodepoint( $ch );
160 - # One radical-stroke entry always has 3 (radical) + 3 (stroke) = 6 bytes, or blank if unavailable.
161 - $r = str_pad( $this->onCategoryMultisortSortkeys_getRadical( $data, $chcp ), 6 );
162 - $result .= $r . $c;
163 - }
164 - return $result;
 155+ $result = '';
 156+ foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
 157+ # One UTF-8 character can have 4 bytes max.
 158+ $c = str_pad( $ch, 4 );
 159+ $chcp = utf8ToCodepoint( $ch );
 160+ # One radical-stroke entry always has 3 (radical) + 3 (stroke) = 6 bytes, or blank if unavailable.
 161+ $r = str_pad( $this->onCategoryMultisortSortkeys_getRadical( $data, $chcp ), 6 );
 162+ $result .= $r . $c;
 163+ }
 164+ return $result;
165165 }
166166 }

Status & tagging log