Skip to content

Commit 2f1e464

Browse files
committed
MDL-40438 migrate all collatorlib:: and textlib:: uses
1 parent e7c21ac commit 2f1e464

File tree

127 files changed

+423
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+423
-425
lines changed

admin/blocks.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
$blocknames[$blockid] = $blockname;
116116
}
117117
}
118-
collatorlib::asort($blocknames);
118+
core_collator::asort($blocknames);
119119

120120
foreach ($blocknames as $blockid=>$strblockname) {
121121
$block = $blocks[$blockid];

admin/localplugins.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
}
5656
$plugins[$plugin] = $strpluginname;
5757
}
58-
collatorlib::asort($plugins);
58+
core_collator::asort($plugins);
5959

6060
foreach ($plugins as $plugin => $name) {
6161
$uninstall = '';

admin/mnet/access_control.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
$usernames = explode(',', $form->username);
104104

105105
foreach ($usernames as $username) {
106-
$username = trim(textlib::strtolower($username));
106+
$username = trim(core_text::strtolower($username));
107107
if (!empty($username)) {
108108
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
109109
if ($form->accessctrl == 'allow') {

admin/registration/forms.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public function definition() {
137137
$options = array();
138138
foreach ($hubs as $hub) {
139139
//to not display a name longer than 100 character (too big)
140-
if (textlib::strlen($hub['name']) > 100) {
141-
$hubname = textlib::substr($hub['name'], 0, 100);
140+
if (core_text::strlen($hub['name']) > 100) {
141+
$hubname = core_text::substr($hub['name'], 0, 100);
142142
$hubname = $hubname . "...";
143143
} else {
144144
$hubname = $hub['name'];
@@ -287,7 +287,7 @@ public function definition() {
287287
$mform->addHelpButton('description', 'sitedesc', 'hub');
288288

289289
$languages = get_string_manager()->get_list_of_languages();
290-
collatorlib::asort($languages);
290+
core_collator::asort($languages);
291291
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
292292
$languages);
293293
$mform->setType('language', PARAM_ALPHANUMEXT);

admin/reports.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858
$plugins[$plugin] = $strpluginname;
5959
}
60-
collatorlib::asort($plugins);
60+
core_collator::asort($plugins);
6161

6262
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
6363
$params = array('report|_%');

admin/roles/classes/define_role_table_advanced.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public function read_submitted_permissions() {
9999
$shortname = optional_param('shortname', null, PARAM_RAW);
100100
if (!is_null($shortname)) {
101101
$this->role->shortname = $shortname;
102-
$this->role->shortname = textlib::specialtoascii($this->role->shortname);
103-
$this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
102+
$this->role->shortname = core_text::specialtoascii($this->role->shortname);
103+
$this->role->shortname = core_text::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
104104
if (empty($this->role->shortname)) {
105105
$this->errors['shortname'] = get_string('errorbadroleshortname', 'core_role');
106106
}

admin/tool/uploadcourse/classes/helper.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ public static function generate_shortname_callback($fullname, $idnumber, $block)
117117

118118
switch ($block[1]) {
119119
case '+':
120-
$repl = textlib::strtoupper($repl);
120+
$repl = core_text::strtoupper($repl);
121121
break;
122122
case '-':
123-
$repl = textlib::strtolower($repl);
123+
$repl = core_text::strtolower($repl);
124124
break;
125125
case '~':
126-
$repl = textlib::strtotitle($repl);
126+
$repl = core_text::strtotitle($repl);
127127
break;
128128
}
129129

130130
if (!empty($block[2])) {
131-
$repl = textlib::substr($repl, 0, $block[2]);
131+
$repl = core_text::substr($repl, 0, $block[2]);
132132
}
133133

134134
return $repl;

admin/tool/uploadcourse/classes/step1_form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function definition () {
5757
$mform->setDefault('delimiter_name', 'comma');
5858
}
5959

60-
$choices = textlib::get_encodings();
60+
$choices = core_text::get_encodings();
6161
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploadcourse'), $choices);
6262
$mform->setDefault('encoding', 'UTF-8');
6363

admin/tool/uploadcourse/cli/uploadcourse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
}
146146

147147
// Encoding.
148-
$encodings = textlib::get_encodings();
148+
$encodings = core_text::get_encodings();
149149
if (!isset($encodings[$options['encoding']])) {
150150
echo get_string('invalidencoding', 'tool_uploadcourse')."\n";
151151
echo $help;

admin/tool/uploaduser/locallib.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
183183
$processed = array();
184184
foreach ($columns as $key=>$unused) {
185185
$field = $columns[$key];
186-
$lcfield = textlib::strtolower($field);
186+
$lcfield = core_text::strtolower($field);
187187
if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) {
188188
// standard fields are only lowercase
189189
$newfield = $lcfield;
@@ -295,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block)
295295

296296
switch ($block[1]) {
297297
case '+':
298-
$repl = textlib::strtoupper($repl);
298+
$repl = core_text::strtoupper($repl);
299299
break;
300300
case '-':
301-
$repl = textlib::strtolower($repl);
301+
$repl = core_text::strtolower($repl);
302302
break;
303303
case '~':
304-
$repl = textlib::strtotitle($repl);
304+
$repl = core_text::strtotitle($repl);
305305
break;
306306
}
307307

308308
if (!empty($block[2])) {
309-
$repl = textlib::substr($repl, 0 , $block[2]);
309+
$repl = core_text::substr($repl, 0 , $block[2]);
310310
}
311311

312312
return $repl;

admin/tool/uploaduser/user_form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function definition () {
5353
$mform->setDefault('delimiter_name', 'comma');
5454
}
5555

56-
$choices = textlib::get_encodings();
56+
$choices = core_text::get_encodings();
5757
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
5858
$mform->setDefault('encoding', 'UTF-8');
5959

admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
7575
// Get current semantic from dictionary, we only will process B (BYTE) ones
7676
// suplying the SQL code to change them to C (CHAR) semantic
7777
$params = array(
78-
'table_name' => textlib::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
79-
'column_name' => textlib::strtoupper($xmldb_field->getName()),
78+
'table_name' => core_text::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
79+
'column_name' => core_text::strtoupper($xmldb_field->getName()),
8080
'data_type' => 'VARCHAR2');
8181
$currentsemantic = $DB->get_field_sql('
8282
SELECT char_used

admin/tools.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858
$plugins[$plugin] = $strpluginname;
5959
}
60-
collatorlib::asort($plugins);
60+
core_collator::asort($plugins);
6161

6262
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
6363
$params = array('tool|_%');

auth/cas/auth.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function prevent_local_passwords() {
6161
*/
6262
function user_login ($username, $password) {
6363
$this->connectCAS();
64-
return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username);
64+
return phpCAS::isAuthenticated() && (trim(core_text::strtolower(phpCAS::getUser())) == $username);
6565
}
6666

6767
/**
@@ -381,15 +381,15 @@ function process_config($config) {
381381
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
382382
set_config('pagesize', (int)trim($config->pagesize), $this->pluginconfig);
383383
set_config('contexts', trim($config->contexts), $this->pluginconfig);
384-
set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
385-
set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
384+
set_config('user_type', core_text::strtolower(trim($config->user_type)), $this->pluginconfig);
385+
set_config('user_attribute', core_text::strtolower(trim($config->user_attribute)), $this->pluginconfig);
386386
set_config('search_sub', $config->search_sub, $this->pluginconfig);
387387
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
388388
set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig);
389389
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
390390
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
391391
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
392-
set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
392+
set_config('memberattribute', core_text::strtolower(trim($config->memberattribute)), $this->pluginconfig);
393393
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
394394
set_config('attrcreators', trim($config->attrcreators), $this->pluginconfig);
395395
set_config('groupecreators', trim($config->groupecreators), $this->pluginconfig);
@@ -409,7 +409,7 @@ function iscreator($username) {
409409
return false;
410410
}
411411

412-
$extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
412+
$extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
413413

414414
// Test for group creator
415415
if (!empty($this->config->groupecreators)) {

auth/db/auth.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ function __construct() {
5858
function user_login($username, $password) {
5959
global $CFG, $DB;
6060

61-
$extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
62-
$extpassword = textlib::convert($password, 'utf-8', $this->config->extencoding);
61+
$extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
62+
$extpassword = core_text::convert($password, 'utf-8', $this->config->extencoding);
6363

6464
if ($this->is_internal()) {
6565
// Lookup username externally, but resolve
@@ -176,7 +176,7 @@ function db_attributes() {
176176
function get_userinfo($username) {
177177
global $CFG;
178178

179-
$extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
179+
$extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
180180

181181
$authdb = $this->db_init();
182182

@@ -199,7 +199,7 @@ function get_userinfo($username) {
199199
$fields_obj = $rs->FetchObj();
200200
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
201201
foreach ($selectfields as $localname=>$externalname) {
202-
$result[$localname] = textlib::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
202+
$result[$localname] = core_text::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
203203
}
204204
}
205205
$rs->Close();
@@ -426,7 +426,7 @@ function user_exists($username) {
426426
// Init result value.
427427
$result = false;
428428

429-
$extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
429+
$extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
430430

431431
$authdb = $this->db_init();
432432

@@ -501,7 +501,7 @@ function update_user_record($username, $updatekeys=false) {
501501
global $CFG, $DB;
502502

503503
//just in case check text case
504-
$username = trim(textlib::strtolower($username));
504+
$username = trim(core_text::strtolower($username));
505505

506506
// get the current user record
507507
$user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id));
@@ -569,7 +569,7 @@ function user_update($olduser, $newuser) {
569569
return false;
570570
}
571571

572-
$extusername = textlib::convert($olduser->username, 'utf-8', $this->config->extencoding);
572+
$extusername = core_text::convert($olduser->username, 'utf-8', $this->config->extencoding);
573573

574574
$authdb = $this->db_init();
575575

@@ -586,7 +586,7 @@ function user_update($olduser, $newuser) {
586586
}
587587
$nuvalue = $newuser->$key;
588588
if ($nuvalue != $value) {
589-
$update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(textlib::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
589+
$update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(core_text::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
590590
}
591591
}
592592
if (!empty($update)) {

0 commit comments

Comments
 (0)