Skip to content

Commit

Permalink
MDL-40438 migrate all collatorlib:: and textlib:: uses
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 6, 2013
1 parent e7c21ac commit 2f1e464
Show file tree
Hide file tree
Showing 127 changed files with 423 additions and 425 deletions.
2 changes: 1 addition & 1 deletion admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
$blocknames[$blockid] = $blockname;
}
}
collatorlib::asort($blocknames);
core_collator::asort($blocknames);

foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
Expand Down
2 changes: 1 addition & 1 deletion admin/localplugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
$plugins[$plugin] = $strpluginname;
}
collatorlib::asort($plugins);
core_collator::asort($plugins);

foreach ($plugins as $plugin => $name) {
$uninstall = '';
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/access_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
$usernames = explode(',', $form->username);

foreach ($usernames as $username) {
$username = trim(textlib::strtolower($username));
$username = trim(core_text::strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
Expand Down
6 changes: 3 additions & 3 deletions admin/registration/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ public function definition() {
$options = array();
foreach ($hubs as $hub) {
//to not display a name longer than 100 character (too big)
if (textlib::strlen($hub['name']) > 100) {
$hubname = textlib::substr($hub['name'], 0, 100);
if (core_text::strlen($hub['name']) > 100) {
$hubname = core_text::substr($hub['name'], 0, 100);
$hubname = $hubname . "...";
} else {
$hubname = $hub['name'];
Expand Down Expand Up @@ -287,7 +287,7 @@ public function definition() {
$mform->addHelpButton('description', 'sitedesc', 'hub');

$languages = get_string_manager()->get_list_of_languages();
collatorlib::asort($languages);
core_collator::asort($languages);
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
$languages);
$mform->setType('language', PARAM_ALPHANUMEXT);
Expand Down
2 changes: 1 addition & 1 deletion admin/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
$plugins[$plugin] = $strpluginname;
}
collatorlib::asort($plugins);
core_collator::asort($plugins);

$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('report|_%');
Expand Down
4 changes: 2 additions & 2 deletions admin/roles/classes/define_role_table_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function read_submitted_permissions() {
$shortname = optional_param('shortname', null, PARAM_RAW);
if (!is_null($shortname)) {
$this->role->shortname = $shortname;
$this->role->shortname = textlib::specialtoascii($this->role->shortname);
$this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
$this->role->shortname = core_text::specialtoascii($this->role->shortname);
$this->role->shortname = core_text::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
if (empty($this->role->shortname)) {
$this->errors['shortname'] = get_string('errorbadroleshortname', 'core_role');
}
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/uploadcourse/classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@ public static function generate_shortname_callback($fullname, $idnumber, $block)

switch ($block[1]) {
case '+':
$repl = textlib::strtoupper($repl);
$repl = core_text::strtoupper($repl);
break;
case '-':
$repl = textlib::strtolower($repl);
$repl = core_text::strtolower($repl);
break;
case '~':
$repl = textlib::strtotitle($repl);
$repl = core_text::strtotitle($repl);
break;
}

if (!empty($block[2])) {
$repl = textlib::substr($repl, 0, $block[2]);
$repl = core_text::substr($repl, 0, $block[2]);
}

return $repl;
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploadcourse/classes/step1_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function definition () {
$mform->setDefault('delimiter_name', 'comma');
}

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

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploadcourse/cli/uploadcourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}

// Encoding.
$encodings = textlib::get_encodings();
$encodings = core_text::get_encodings();
if (!isset($encodings[$options['encoding']])) {
echo get_string('invalidencoding', 'tool_uploadcourse')."\n";
echo $help;
Expand Down
10 changes: 5 additions & 5 deletions admin/tool/uploaduser/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
$processed = array();
foreach ($columns as $key=>$unused) {
$field = $columns[$key];
$lcfield = textlib::strtolower($field);
$lcfield = core_text::strtolower($field);
if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) {
// standard fields are only lowercase
$newfield = $lcfield;
Expand Down Expand Up @@ -295,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block)

switch ($block[1]) {
case '+':
$repl = textlib::strtoupper($repl);
$repl = core_text::strtoupper($repl);
break;
case '-':
$repl = textlib::strtolower($repl);
$repl = core_text::strtolower($repl);
break;
case '~':
$repl = textlib::strtotitle($repl);
$repl = core_text::strtotitle($repl);
break;
}

if (!empty($block[2])) {
$repl = textlib::substr($repl, 0 , $block[2]);
$repl = core_text::substr($repl, 0 , $block[2]);
}

return $repl;
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploaduser/user_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function definition () {
$mform->setDefault('delimiter_name', 'comma');
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
// Get current semantic from dictionary, we only will process B (BYTE) ones
// suplying the SQL code to change them to C (CHAR) semantic
$params = array(
'table_name' => textlib::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
'column_name' => textlib::strtoupper($xmldb_field->getName()),
'table_name' => core_text::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
'column_name' => core_text::strtoupper($xmldb_field->getName()),
'data_type' => 'VARCHAR2');
$currentsemantic = $DB->get_field_sql('
SELECT char_used
Expand Down
2 changes: 1 addition & 1 deletion admin/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
$plugins[$plugin] = $strpluginname;
}
collatorlib::asort($plugins);
core_collator::asort($plugins);

$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('tool|_%');
Expand Down
10 changes: 5 additions & 5 deletions auth/cas/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function prevent_local_passwords() {
*/
function user_login ($username, $password) {
$this->connectCAS();
return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username);
return phpCAS::isAuthenticated() && (trim(core_text::strtolower(phpCAS::getUser())) == $username);
}

/**
Expand Down Expand Up @@ -381,15 +381,15 @@ function process_config($config) {
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('pagesize', (int)trim($config->pagesize), $this->pluginconfig);
set_config('contexts', trim($config->contexts), $this->pluginconfig);
set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('user_type', core_text::strtolower(trim($config->user_type)), $this->pluginconfig);
set_config('user_attribute', core_text::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig);
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute', core_text::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
set_config('attrcreators', trim($config->attrcreators), $this->pluginconfig);
set_config('groupecreators', trim($config->groupecreators), $this->pluginconfig);
Expand All @@ -409,7 +409,7 @@ function iscreator($username) {
return false;
}

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

// Test for group creator
if (!empty($this->config->groupecreators)) {
Expand Down
16 changes: 8 additions & 8 deletions auth/db/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function __construct() {
function user_login($username, $password) {
global $CFG, $DB;

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

if ($this->is_internal()) {
// Lookup username externally, but resolve
Expand Down Expand Up @@ -176,7 +176,7 @@ function db_attributes() {
function get_userinfo($username) {
global $CFG;

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

$authdb = $this->db_init();

Expand All @@ -199,7 +199,7 @@ function get_userinfo($username) {
$fields_obj = $rs->FetchObj();
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
foreach ($selectfields as $localname=>$externalname) {
$result[$localname] = textlib::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
$result[$localname] = core_text::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
}
}
$rs->Close();
Expand Down Expand Up @@ -426,7 +426,7 @@ function user_exists($username) {
// Init result value.
$result = false;

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

$authdb = $this->db_init();

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

//just in case check text case
$username = trim(textlib::strtolower($username));
$username = trim(core_text::strtolower($username));

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

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

$authdb = $this->db_init();

Expand All @@ -586,7 +586,7 @@ function user_update($olduser, $newuser) {
}
$nuvalue = $newuser->$key;
if ($nuvalue != $value) {
$update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(textlib::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
$update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(core_text::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
}
}
if (!empty($update)) {
Expand Down
Loading

0 comments on commit 2f1e464

Please sign in to comment.