diff --git a/admin/blocks.php b/admin/blocks.php
index 2ad0a0eced4..6a2d31efd6e 100644
--- a/admin/blocks.php
+++ b/admin/blocks.php
@@ -115,7 +115,7 @@
$blocknames[$blockid] = $blockname;
}
}
- collatorlib::asort($blocknames);
+ core_collator::asort($blocknames);
foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
diff --git a/admin/localplugins.php b/admin/localplugins.php
index 145f65ae20e..be09151a5a3 100644
--- a/admin/localplugins.php
+++ b/admin/localplugins.php
@@ -55,7 +55,7 @@ foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
foreach ($plugins as $plugin => $name) {
$uninstall = '';
diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php
index 1c0470e18f7..79c744c9c6d 100644
--- a/admin/mnet/access_control.php
+++ b/admin/mnet/access_control.php
@@ -103,7 +103,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
$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') {
diff --git a/admin/registration/forms.php b/admin/registration/forms.php
index 1f868d00e4e..8eff8411bb4 100644
--- a/admin/registration/forms.php
+++ b/admin/registration/forms.php
@@ -137,8 +137,8 @@ class hub_selector_form extends moodleform {
$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'];
@@ -287,7 +287,7 @@ class site_registration_form extends moodleform {
$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);
diff --git a/admin/reports.php b/admin/reports.php
index 70ec9525d84..0a73d226db9 100644
--- a/admin/reports.php
+++ b/admin/reports.php
@@ -57,7 +57,7 @@ foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('report|_%');
diff --git a/admin/roles/classes/define_role_table_advanced.php b/admin/roles/classes/define_role_table_advanced.php
index 496df3ed57c..cd7741cc614 100644
--- a/admin/roles/classes/define_role_table_advanced.php
+++ b/admin/roles/classes/define_role_table_advanced.php
@@ -99,8 +99,8 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
$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');
}
diff --git a/admin/tool/uploadcourse/classes/helper.php b/admin/tool/uploadcourse/classes/helper.php
index 11ff373f5d7..ebd0b75b5f6 100644
--- a/admin/tool/uploadcourse/classes/helper.php
+++ b/admin/tool/uploadcourse/classes/helper.php
@@ -117,18 +117,18 @@ class tool_uploadcourse_helper {
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;
diff --git a/admin/tool/uploadcourse/classes/step1_form.php b/admin/tool/uploadcourse/classes/step1_form.php
index cd0abc0b6c8..189ff9eb68f 100644
--- a/admin/tool/uploadcourse/classes/step1_form.php
+++ b/admin/tool/uploadcourse/classes/step1_form.php
@@ -57,7 +57,7 @@ class tool_uploadcourse_step1_form extends tool_uploadcourse_base_form {
$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');
diff --git a/admin/tool/uploadcourse/cli/uploadcourse.php b/admin/tool/uploadcourse/cli/uploadcourse.php
index 1aa46135035..511d6029828 100644
--- a/admin/tool/uploadcourse/cli/uploadcourse.php
+++ b/admin/tool/uploadcourse/cli/uploadcourse.php
@@ -145,7 +145,7 @@ if (!file_exists($options['file'])) {
}
// Encoding.
-$encodings = textlib::get_encodings();
+$encodings = core_text::get_encodings();
if (!isset($encodings[$options['encoding']])) {
echo get_string('invalidencoding', 'tool_uploadcourse')."\n";
echo $help;
diff --git a/admin/tool/uploaduser/locallib.php b/admin/tool/uploaduser/locallib.php
index a050e803c61..01863f9858c 100644
--- a/admin/tool/uploaduser/locallib.php
+++ b/admin/tool/uploaduser/locallib.php
@@ -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;
@@ -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;
diff --git a/admin/tool/uploaduser/user_form.php b/admin/tool/uploaduser/user_form.php
index b377a9b2568..ce32ea260d5 100644
--- a/admin/tool/uploaduser/user_form.php
+++ b/admin/tool/uploaduser/user_form.php
@@ -53,7 +53,7 @@ class admin_uploaduser_form1 extends moodleform {
$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');
diff --git a/admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php b/admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
index 80416727a51..f2128b11acc 100644
--- a/admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
+++ b/admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
@@ -75,8 +75,8 @@ class check_oracle_semantics extends XMLDBCheckAction {
// 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
diff --git a/admin/tools.php b/admin/tools.php
index 491e4511cc1..5f6a4686f49 100644
--- a/admin/tools.php
+++ b/admin/tools.php
@@ -57,7 +57,7 @@ foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('tool|_%');
diff --git a/auth/cas/auth.php b/auth/cas/auth.php
index 95ab72523d9..6d1d5820ed1 100644
--- a/auth/cas/auth.php
+++ b/auth/cas/auth.php
@@ -61,7 +61,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
*/
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);
}
/**
@@ -381,15 +381,15 @@ class auth_plugin_cas extends auth_plugin_ldap {
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);
@@ -409,7 +409,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
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)) {
diff --git a/auth/db/auth.php b/auth/db/auth.php
index f245d60febb..de5061da32a 100644
--- a/auth/db/auth.php
+++ b/auth/db/auth.php
@@ -58,8 +58,8 @@ class auth_plugin_db extends auth_plugin_base {
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
@@ -176,7 +176,7 @@ class auth_plugin_db extends auth_plugin_base {
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();
@@ -199,7 +199,7 @@ class auth_plugin_db extends auth_plugin_base {
$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();
@@ -426,7 +426,7 @@ class auth_plugin_db extends auth_plugin_base {
// 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();
@@ -501,7 +501,7 @@ class auth_plugin_db extends auth_plugin_base {
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));
@@ -569,7 +569,7 @@ class auth_plugin_db extends auth_plugin_base {
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();
@@ -586,7 +586,7 @@ class auth_plugin_db extends auth_plugin_base {
}
$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)) {
diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php
index dae99230a66..a1a96451475 100644
--- a/auth/ldap/auth.php
+++ b/auth/ldap/auth.php
@@ -168,8 +168,8 @@ class auth_plugin_ldap extends auth_plugin_base {
return false;
}
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
- $extpassword = textlib::convert($password, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = core_text::convert($password, 'utf-8', $this->config->ldapencoding);
// Before we connect to LDAP, check if this is an AD SSO login
// if we succeed in this block, we'll return success early.
@@ -250,7 +250,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @return mixed array with no magic quotes or false on error
*/
function get_userinfo($username) {
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
if(!($user_dn = $this->ldap_find_userdn($ldapconnection, $extusername))) {
@@ -298,9 +298,9 @@ class auth_plugin_ldap extends auth_plugin_base {
continue; // wrong data mapping!
}
if (is_array($entry[$value])) {
- $newval = textlib::convert($entry[$value][0], $this->config->ldapencoding, 'utf-8');
+ $newval = core_text::convert($entry[$value][0], $this->config->ldapencoding, 'utf-8');
} else {
- $newval = textlib::convert($entry[$value], $this->config->ldapencoding, 'utf-8');
+ $newval = core_text::convert($entry[$value], $this->config->ldapencoding, 'utf-8');
}
if (!empty($newval)) { // favour ldap entries that are set
$ldapval = $newval;
@@ -351,7 +351,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @param string $username
*/
function user_exists($username) {
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
// Returns true if given username exists on ldap
$users = $this->ldap_get_userlist('('.$this->config->user_attribute.'='.ldap_filter_addslashes($extusername).')');
@@ -367,8 +367,8 @@ class auth_plugin_ldap extends auth_plugin_base {
* @param mixed $plainpass Plaintext password
*/
function user_create($userobject, $plainpass) {
- $extusername = textlib::convert($userobject->username, 'utf-8', $this->config->ldapencoding);
- $extpassword = textlib::convert($plainpass, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($userobject->username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = core_text::convert($plainpass, 'utf-8', $this->config->ldapencoding);
switch ($this->config->passtype) {
case 'md5':
@@ -393,7 +393,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
foreach ($values as $value) {
if (!empty($userobject->$key) ) {
- $newuser[$value] = textlib::convert($userobject->$key, 'utf-8', $this->config->ldapencoding);
+ $newuser[$value] = core_text::convert($userobject->$key, 'utf-8', $this->config->ldapencoding);
}
}
}
@@ -637,7 +637,7 @@ class auth_plugin_ldap extends auth_plugin_base {
function password_expire($username) {
$result = 0;
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
$user_dn = $this->ldap_find_userdn($ldapconnection, $extusername);
@@ -735,7 +735,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if ($entry = @ldap_first_entry($ldapconnection, $ldap_result)) {
do {
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
- $value = textlib::convert($value[0], $this->config->ldapencoding, 'utf-8');
+ $value = core_text::convert($value[0], $this->config->ldapencoding, 'utf-8');
$this->ldap_bulk_insert($value);
} while ($entry = ldap_next_entry($ldapconnection, $entry));
}
@@ -945,7 +945,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$user->mnethostid = $CFG->mnet_localhost_id;
// get_userinfo_asobj() might have replaced $user->username with the value
// from the LDAP server (which can be mixed-case). Make sure it's lowercase
- $user->username = trim(textlib::strtolower($user->username));
+ $user->username = trim(core_text::strtolower($user->username));
if (empty($user->lang)) {
$user->lang = $CFG->lang;
}
@@ -991,7 +991,7 @@ class auth_plugin_ldap extends auth_plugin_base {
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));
@@ -1040,7 +1040,7 @@ class auth_plugin_ldap extends auth_plugin_base {
function ldap_bulk_insert($username) {
global $DB, $CFG;
- $username = textlib::strtolower($username); // usernames are __always__ lowercase.
+ $username = core_text::strtolower($username); // usernames are __always__ lowercase.
$DB->insert_record_raw('tmp_extuser', array('username'=>$username,
'mnethostid'=>$CFG->mnet_localhost_id), false, true);
echo '.';
@@ -1053,7 +1053,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @return boolean result
*/
function user_activate($username) {
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -1103,7 +1103,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return null;
}
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -1161,7 +1161,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return true;
}
- $extoldusername = textlib::convert($olduser->username, 'utf-8', $this->config->ldapencoding);
+ $extoldusername = core_text::convert($olduser->username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -1223,9 +1223,9 @@ class auth_plugin_ldap extends auth_plugin_base {
$ambiguous = false;
}
- $nuvalue = textlib::convert($newuser->$profilefield, 'utf-8', $this->config->ldapencoding);
+ $nuvalue = core_text::convert($newuser->$profilefield, 'utf-8', $this->config->ldapencoding);
empty($nuvalue) ? $nuvalue = array() : $nuvalue;
- $ouvalue = textlib::convert($olduser->$profilefield, 'utf-8', $this->config->ldapencoding);
+ $ouvalue = core_text::convert($olduser->$profilefield, 'utf-8', $this->config->ldapencoding);
foreach ($ldapkeys as $ldapkey) {
$ldapkey = $ldapkey;
@@ -1321,8 +1321,8 @@ class auth_plugin_ldap extends auth_plugin_base {
$result = false;
$username = $user->username;
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
- $extpassword = textlib::convert($newpassword, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = core_text::convert($newpassword, 'utf-8', $this->config->ldapencoding);
switch ($this->config->passtype) {
case 'md5':
@@ -1498,13 +1498,13 @@ class auth_plugin_ldap extends auth_plugin_base {
foreach ($userfields as $field) {
if (!empty($this->config->{"field_map_$field"})) {
- $moodleattributes[$field] = textlib::strtolower(trim($this->config->{"field_map_$field"}));
+ $moodleattributes[$field] = core_text::strtolower(trim($this->config->{"field_map_$field"}));
if (preg_match('/,/', $moodleattributes[$field])) {
$moodleattributes[$field] = explode(',', $moodleattributes[$field]); // split ?
}
}
}
- $moodleattributes['username'] = textlib::strtolower(trim($this->config->user_attribute));
+ $moodleattributes['username'] = core_text::strtolower(trim($this->config->user_attribute));
return $moodleattributes;
}
@@ -1555,7 +1555,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$users = ldap_get_entries_moodle($ldapconnection, $ldap_result);
// Add found users to list.
for ($i = 0; $i < count($users); $i++) {
- $extuser = textlib::convert($users[$i][$this->config->user_attribute][0],
+ $extuser = core_text::convert($users[$i][$this->config->user_attribute][0],
$this->config->ldapencoding, 'utf-8');
array_push($fresult, $extuser);
}
@@ -1696,7 +1696,7 @@ class auth_plugin_ldap extends auth_plugin_base {
// (according to my reading of RFC-1945, RFC-2616 and RFC-2617 and
// my local tests), so we need to convert the REMOTE_USER value
// (i.e., what we got from the HTTP WWW-Authenticate header) into UTF-8
- $username = textlib::convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8');
+ $username = core_text::convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8');
switch ($this->config->ntlmsso_type) {
case 'ntlm':
@@ -1715,7 +1715,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return false; // Should never happen!
}
- $username = textlib::strtolower($username); // Compatibility hack
+ $username = core_text::strtolower($username); // Compatibility hack
set_cache_flag($this->pluginconfig.'/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT);
return true;
}
@@ -1924,7 +1924,7 @@ class auth_plugin_ldap extends auth_plugin_base {
// Try to remove duplicates before storing the contexts (to avoid problems in sync_users()).
$config->contexts = explode(';', $config->contexts);
- $config->contexts = array_map(create_function('$x', 'return textlib::strtolower(trim($x));'),
+ $config->contexts = array_map(create_function('$x', 'return core_text::strtolower(trim($x));'),
$config->contexts);
$config->contexts = implode(';', array_unique($config->contexts));
@@ -1934,8 +1934,8 @@ class auth_plugin_ldap extends auth_plugin_base {
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('pagesize', (int)trim($config->pagesize), $this->pluginconfig);
set_config('contexts', $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('preventpassindb', $config->preventpassindb, $this->pluginconfig);
@@ -1943,15 +1943,15 @@ class auth_plugin_ldap extends auth_plugin_base {
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('creators', trim($config->creators), $this->pluginconfig);
set_config('create_context', trim($config->create_context), $this->pluginconfig);
set_config('expiration', $config->expiration, $this->pluginconfig);
set_config('expiration_warning', trim($config->expiration_warning), $this->pluginconfig);
- set_config('expireattr', textlib::strtolower(trim($config->expireattr)), $this->pluginconfig);
+ set_config('expireattr', core_text::strtolower(trim($config->expireattr)), $this->pluginconfig);
set_config('gracelogins', $config->gracelogins, $this->pluginconfig);
- set_config('graceattr', textlib::strtolower(trim($config->graceattr)), $this->pluginconfig);
+ set_config('graceattr', core_text::strtolower(trim($config->graceattr)), $this->pluginconfig);
set_config('auth_user_create', $config->auth_user_create, $this->pluginconfig);
set_config('forcechangepassword', $config->forcechangepassword, $this->pluginconfig);
set_config('stdchangepassword', $config->stdchangepassword, $this->pluginconfig);
diff --git a/backup/converter/moodle1/handlerlib.php b/backup/converter/moodle1/handlerlib.php
index 539d804974f..c3df06bec7d 100644
--- a/backup/converter/moodle1/handlerlib.php
+++ b/backup/converter/moodle1/handlerlib.php
@@ -1222,7 +1222,7 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
// replay the upgrade step 2010080901 - updating question image
if (!empty($data['image'])) {
- if (textlib::substr(textlib::strtolower($data['image']), 0, 7) == 'http://') {
+ if (core_text::substr(core_text::strtolower($data['image']), 0, 7) == 'http://') {
// it is a link, appending to existing question text
$data['questiontext'] .= ' ';
diff --git a/backup/converter/moodle1/lib.php b/backup/converter/moodle1/lib.php
index 8f7ec304f60..fb9b9e14622 100644
--- a/backup/converter/moodle1/lib.php
+++ b/backup/converter/moodle1/lib.php
@@ -1233,7 +1233,7 @@ class moodle1_file_manager implements loggable {
}
$filepath = clean_param($filepath, PARAM_PATH);
- if (textlib::strlen($filepath) > 255) {
+ if (core_text::strlen($filepath) > 255) {
throw new moodle1_convert_exception('file_path_longer_than_255_chars');
}
diff --git a/backup/util/dbops/backup_plan_dbops.class.php b/backup/util/dbops/backup_plan_dbops.class.php
index 2e2faaeb05e..530763752be 100644
--- a/backup/util/dbops/backup_plan_dbops.class.php
+++ b/backup/util/dbops/backup_plan_dbops.class.php
@@ -204,7 +204,7 @@ abstract class backup_plan_dbops extends backup_dbops {
global $DB;
// Calculate backup word
- $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
+ $backupword = str_replace(' ', '_', core_text::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
// Not $useidonly, lets fetch the name
@@ -228,7 +228,7 @@ abstract class backup_plan_dbops extends backup_dbops {
break;
}
$shortname = str_replace(' ', '_', $shortname);
- $shortname = textlib::strtolower(trim(clean_filename($shortname), '_'));
+ $shortname = core_text::strtolower(trim(clean_filename($shortname), '_'));
}
// The name will always contain the ID, but we append the course short name if requested.
@@ -240,7 +240,7 @@ abstract class backup_plan_dbops extends backup_dbops {
// Calculate date
$backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig'));
$date = userdate(time(), $backupdateformat, 99, false);
- $date = textlib::strtolower(trim(clean_filename($date), '_'));
+ $date = core_text::strtolower(trim(clean_filename($date), '_'));
// Calculate info
$info = '';
diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php
index e90125d1bcc..59133246018 100644
--- a/backup/util/helper/backup_cron_helper.class.php
+++ b/backup/util/helper/backup_cron_helper.class.php
@@ -554,7 +554,7 @@ abstract class backup_cron_automated_helper {
return true;
}
- $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
+ $backupword = str_replace(' ', '_', core_text::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
diff --git a/blocks/activity_modules/block_activity_modules.php b/blocks/activity_modules/block_activity_modules.php
index 7383658d7ba..6dc2f9b1055 100644
--- a/blocks/activity_modules/block_activity_modules.php
+++ b/blocks/activity_modules/block_activity_modules.php
@@ -49,7 +49,7 @@ class block_activity_modules extends block_list {
}
}
- collatorlib::asort($modfullnames);
+ core_collator::asort($modfullnames);
foreach ($modfullnames as $modname => $modfullname) {
if ($modname === 'resources') {
diff --git a/blocks/community/forms.php b/blocks/community/forms.php
index cb8d7d3e188..3a017167370 100644
--- a/blocks/community/forms.php
+++ b/blocks/community/forms.php
@@ -272,7 +272,7 @@ class community_hub_search_form extends moodleform {
$mform->setDefault('licence', $licence);
$languages = get_string_manager()->get_list_of_languages();
- collatorlib::asort($languages);
+ core_collator::asort($languages);
$languages = array_merge(array('all' => get_string('any')), $languages);
$mform->addElement('select', 'language', get_string('language'), $languages);
diff --git a/blocks/completionstatus/details.php b/blocks/completionstatus/details.php
index b842fb4bc4c..be4cd2fd4c0 100644
--- a/blocks/completionstatus/details.php
+++ b/blocks/completionstatus/details.php
@@ -210,12 +210,12 @@ if (empty($completions)) {
$agg = $info->get_aggregation_method($row['type']);
echo '('. html_writer::start_tag('i');
if ($agg == COMPLETION_AGGREGATION_ALL) {
- echo textlib::strtolower(get_string('all', 'completion'));
+ echo core_text::strtolower(get_string('all', 'completion'));
} else {
- echo textlib::strtolower(get_string('any', 'completion'));
+ echo core_text::strtolower(get_string('any', 'completion'));
}
- echo html_writer::end_tag('i') .textlib::strtolower(get_string('required')).')';
+ echo html_writer::end_tag('i') .core_text::strtolower(get_string('required')).')';
$agg_type = false;
}
}
diff --git a/blocks/navigation/block_navigation.php b/blocks/navigation/block_navigation.php
index 2252e85a45b..9b2613baeeb 100644
--- a/blocks/navigation/block_navigation.php
+++ b/blocks/navigation/block_navigation.php
@@ -255,31 +255,31 @@ class block_navigation extends block_base {
public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
switch ($mode) {
case self::TRIM_RIGHT :
- if (textlib::strlen($node->text)>($long+3)) {
+ if (core_text::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
$node->text = $this->trim_right($node->text, $long);
}
- if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
$node->shorttext = $this->trim_right($node->shorttext, $short);
}
break;
case self::TRIM_LEFT :
- if (textlib::strlen($node->text)>($long+3)) {
+ if (core_text::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
$node->text = $this->trim_left($node->text, $long);
}
- if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
$node->shorttext = $this->trim_left($node->shorttext, $short);
}
break;
case self::TRIM_CENTER :
- if (textlib::strlen($node->text)>($long+3)) {
+ if (core_text::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
$node->text = $this->trim_center($node->text, $long);
}
- if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
$node->shorttext = $this->trim_center($node->shorttext, $short);
}
@@ -298,7 +298,7 @@ class block_navigation extends block_base {
* @return string The truncated string
*/
protected function trim_left($string, $length) {
- return '...'.textlib::substr($string, textlib::strlen($string)-$length, $length);
+ return '...'.core_text::substr($string, core_text::strlen($string)-$length, $length);
}
/**
* Truncate a string from the right
@@ -307,7 +307,7 @@ class block_navigation extends block_base {
* @return string The truncated string
*/
protected function trim_right($string, $length) {
- return textlib::substr($string, 0, $length).'...';
+ return core_text::substr($string, 0, $length).'...';
}
/**
* Truncate a string in the center
@@ -317,8 +317,8 @@ class block_navigation extends block_base {
*/
protected function trim_center($string, $length) {
$trimlength = ceil($length/2);
- $start = textlib::substr($string, 0, $trimlength);
- $end = textlib::substr($string, textlib::strlen($string)-$trimlength);
+ $start = core_text::substr($string, 0, $trimlength);
+ $end = core_text::substr($string, core_text::strlen($string)-$trimlength);
$string = $start.'...'.$end;
return $string;
}
diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php
index 4b861a84924..e2ab922083b 100644
--- a/blocks/rss_client/block_rss_client.php
+++ b/blocks/rss_client/block_rss_client.php
@@ -223,7 +223,7 @@
if(empty($title)){
// no title present, use portion of description
- $title = textlib::substr(strip_tags($description), 0, 20) . '...';
+ $title = core_text::substr(strip_tags($description), 0, 20) . '...';
}else{
$title = break_up_long_words($title, 30);
}
@@ -272,10 +272,10 @@
*/
function format_title($title,$max=64) {
- if (textlib::strlen($title) <= $max) {
+ if (core_text::strlen($title) <= $max) {
return s($title);
} else {
- return s(textlib::substr($title,0,$max-3).'...');
+ return s(core_text::substr($title,0,$max-3).'...');
}
}
diff --git a/blog/lib.php b/blog/lib.php
index cfe8771afeb..c7ee5bd9a2e 100644
--- a/blog/lib.php
+++ b/blog/lib.php
@@ -205,8 +205,8 @@ function blog_sync_external_entries($externalblog) {
$newentry->subject = clean_param($entry->get_title(), PARAM_TEXT);
// Observe 128 max chars in DB
// TODO: +1 to raise this to 255
- if (textlib::strlen($newentry->subject) > 128) {
- $newentry->subject = textlib::substr($newentry->subject, 0, 125) . '...';
+ if (core_text::strlen($newentry->subject) > 128) {
+ $newentry->subject = core_text::substr($newentry->subject, 0, 125) . '...';
}
$newentry->summary = $entry->get_description();
@@ -241,7 +241,7 @@ function blog_sync_external_entries($externalblog) {
$oldesttimestamp = $timestamp;
}
- if (textlib::strlen($newentry->uniquehash) > 255) {
+ if (core_text::strlen($newentry->uniquehash) > 255) {
// The URL for this item is too long for the field. Rather than add
// the entry without the link we will skip straight over it.
// RSS spec says recommended length 500, we use 255.
diff --git a/course/dnduploadlib.php b/course/dnduploadlib.php
index fee7ec0a645..917d67051f6 100644
--- a/course/dnduploadlib.php
+++ b/course/dnduploadlib.php
@@ -588,9 +588,9 @@ class dndupload_ajax_processor {
* @return string the display name to use
*/
protected function display_name_from_file($filename) {
- $pos = textlib::strrpos($filename, '.');
+ $pos = core_text::strrpos($filename, '.');
if ($pos) { // Want to skip if $pos === 0 OR $pos === false.
- $filename = textlib::substr($filename, 0, $pos);
+ $filename = core_text::substr($filename, 0, $pos);
}
return str_replace('_', ' ', $filename);
}
diff --git a/course/lib.php b/course/lib.php
index 670e6d2aea7..609235060ae 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -405,7 +405,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
// If $log->url has been trimmed short by the db size restriction
// code in add_to_log, keep a note so we don't add a link to a broken url
- $brokenurl=(textlib::strlen($log->url)==100 && textlib::substr($log->url,97)=='...');
+ $brokenurl=(core_text::strlen($log->url)==100 && core_text::substr($log->url,97)=='...');
$row = array();
if ($course->id == SITEID) {
@@ -1039,8 +1039,8 @@ function get_module_types_names($plural = false) {
$modnames[1][$mod->name] = get_string("modulenameplural", "$mod->name");
}
}
- collatorlib::asort($modnames[0]);
- collatorlib::asort($modnames[1]);
+ core_collator::asort($modnames[0]);
+ core_collator::asort($modnames[1]);
}
}
return $modnames[(int)$plural];
@@ -1966,11 +1966,11 @@ function course_format_name ($course,$max=100) {
$shortname = format_string($course->shortname, true, array('context' => $context));
$fullname = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
$str = $shortname.': '. $fullname;
- if (textlib::strlen($str) <= $max) {
+ if (core_text::strlen($str) <= $max) {
return $str;
}
else {
- return textlib::substr($str,0,$max-3).'...';
+ return core_text::substr($str,0,$max-3).'...';
}
}
diff --git a/course/manage.php b/course/manage.php
index df8c5f473ef..d4a905455cd 100644
--- a/course/manage.php
+++ b/course/manage.php
@@ -194,7 +194,7 @@ if ((!empty($moveupcat) or !empty($movedowncat)) and confirm_sesskey()) {
if ($coursecat->id && $canmanage && $resort && confirm_sesskey()) {
// Resort the category.
if ($courses = get_courses($coursecat->id, '', 'c.id,c.fullname,c.sortorder')) {
- collatorlib::asort_objects_by_property($courses, 'fullname', collatorlib::SORT_NATURAL);
+ core_collator::asort_objects_by_property($courses, 'fullname', core_collator::SORT_NATURAL);
$i = 1;
foreach ($courses as $course) {
$DB->set_field('course', 'sortorder', $coursecat->sortorder + $i, array('id' => $course->id));
diff --git a/course/publish/forms.php b/course/publish/forms.php
index ceb6b10b2b9..898c5ac4598 100644
--- a/course/publish/forms.php
+++ b/course/publish/forms.php
@@ -248,7 +248,7 @@ class course_publication_form extends moodleform {
$mform->addHelpButton('description', 'description', 'hub');
$languages = get_string_manager()->get_list_of_languages();
- collatorlib::asort($languages);
+ core_collator::asort($languages);
$mform->addElement('select', 'language', get_string('language'), $languages);
$mform->setDefault('language', $defaultlanguage);
$mform->addHelpButton('language', 'language', 'hub');
diff --git a/course/renderer.php b/course/renderer.php
index 608ba698286..8096fd60385 100644
--- a/course/renderer.php
+++ b/course/renderer.php
@@ -708,8 +708,8 @@ class core_course_renderer extends plugin_renderer_base {
// Avoid unnecessary duplication: if e.g. a forum name already
// includes the word forum (or Forum, etc) then it is unhelpful
// to include that in the accessible description that is added.
- if (false !== strpos(textlib::strtolower($instancename),
- textlib::strtolower($altname))) {
+ if (false !== strpos(core_text::strtolower($instancename),
+ core_text::strtolower($altname))) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
diff --git a/enrol/database/lib.php b/enrol/database/lib.php
index fc57b58358c..052458a1e05 100644
--- a/enrol/database/lib.php
+++ b/enrol/database/lib.php
@@ -855,7 +855,7 @@ class enrol_database_plugin extends enrol_plugin {
}
return $text;
} else {
- return textlib::convert($text, 'utf-8', $dbenc);
+ return core_text::convert($text, 'utf-8', $dbenc);
}
}
@@ -870,7 +870,7 @@ class enrol_database_plugin extends enrol_plugin {
}
return $text;
} else {
- return textlib::convert($text, $dbenc, 'utf-8');
+ return core_text::convert($text, $dbenc, 'utf-8');
}
}
diff --git a/enrol/flatfile/lib.php b/enrol/flatfile/lib.php
index f3a0908a7a8..4add14e4b25 100644
--- a/enrol/flatfile/lib.php
+++ b/enrol/flatfile/lib.php
@@ -252,7 +252,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$rolemap = $this->get_role_map($trace);
- $content = textlib::convert($content, $this->get_config('encoding', 'utf-8'), 'utf-8');
+ $content = core_text::convert($content, $this->get_config('encoding', 'utf-8'), 'utf-8');
$content = str_replace("\r", '', $content);
$content = explode("\n", $content);
@@ -278,8 +278,8 @@ class enrol_flatfile_plugin extends enrol_plugin {
continue;
}
- $fields[0] = trim(textlib::strtolower($fields[0]));
- $fields[1] = trim(textlib::strtolower($fields[1]));
+ $fields[0] = trim(core_text::strtolower($fields[0]));
+ $fields[1] = trim(core_text::strtolower($fields[1]));
$fields[2] = trim($fields[2]);
$fields[3] = trim($fields[3]);
$fields[4] = isset($fields[4]) ? (int)trim($fields[4]) : 0;
@@ -664,7 +664,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$roles = $DB->get_records('role', null, '', 'id, name, shortname');
foreach ($roles as $id=>$role) {
$alias = $this->get_config('map_'.$id, $role->shortname, '');
- $alias = trim(textlib::strtolower($alias));
+ $alias = trim(core_text::strtolower($alias));
if ($alias === '') {
// Either not configured yet or somebody wants to skip these intentionally.
continue;
diff --git a/enrol/flatfile/settings.php b/enrol/flatfile/settings.php
index 379568e5dd7..5b7d345a757 100644
--- a/enrol/flatfile/settings.php
+++ b/enrol/flatfile/settings.php
@@ -34,7 +34,7 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configfile('enrol_flatfile/location', get_string('location', 'enrol_flatfile'), get_string('location_desc', 'enrol_flatfile'), ''));
- $options = textlib::get_encodings();
+ $options = core_text::get_encodings();
$settings->add(new admin_setting_configselect('enrol_flatfile/encoding', get_string('encoding', 'enrol_flatfile'), '', 'UTF-8', $options));
$settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailstudents', get_string('notifyenrolled', 'enrol_flatfile'), '', 0));
diff --git a/enrol/flatfile/tests/flatfile_test.php b/enrol/flatfile/tests/flatfile_test.php
index 976d109d466..93ed0ef7845 100644
--- a/enrol/flatfile/tests/flatfile_test.php
+++ b/enrol/flatfile/tests/flatfile_test.php
@@ -167,7 +167,7 @@ class enrol_flatfile_testcase extends advanced_testcase {
// Test encoding.
$data = "add;student;čtvrtý;c3";
- $data = textlib::convert($data, 'utf-8', 'iso-8859-2');
+ $data = core_text::convert($data, 'utf-8', 'iso-8859-2');
file_put_contents($file, $data);
$flatfileplugin->set_config('encoding', 'iso-8859-2');
diff --git a/enrol/guest/locallib.php b/enrol/guest/locallib.php
index 14e13a92fb4..2fecf89ab67 100644
--- a/enrol/guest/locallib.php
+++ b/enrol/guest/locallib.php
@@ -61,7 +61,7 @@ class enrol_guest_enrol_form extends moodleform {
if ($data['guestpassword'] !== $instance->password) {
$plugin = enrol_get_plugin('guest');
if ($plugin->get_config('showhint')) {
- $hint = textlib::substr($instance->password, 0, 1);
+ $hint = core_text::substr($instance->password, 0, 1);
$errors['guestpassword'] = get_string('passwordinvalidhint', 'enrol_guest', $hint);
} else {
$errors['guestpassword'] = get_string('passwordinvalid', 'enrol_guest');
diff --git a/enrol/ldap/lib.php b/enrol/ldap/lib.php
index a4448c76544..9ebacb8be24 100644
--- a/enrol/ldap/lib.php
+++ b/enrol/ldap/lib.php
@@ -327,7 +327,7 @@ class enrol_ldap_plugin extends enrol_plugin {
$trace->finished();
return;
}
- $oneidnumber = ldap_filter_addslashes(textlib::convert($course->idnumber, 'utf-8', $this->get_config('ldapencoding')));
+ $oneidnumber = ldap_filter_addslashes(core_text::convert($course->idnumber, 'utf-8', $this->get_config('ldapencoding')));
}
// Get enrolments for each type of role.
@@ -689,7 +689,7 @@ class enrol_ldap_plugin extends enrol_plugin {
return array();
}
- $extmemberuid = textlib::convert($memberuid, 'utf-8', $this->get_config('ldapencoding'));
+ $extmemberuid = core_text::convert($memberuid, 'utf-8', $this->get_config('ldapencoding'));
if($this->get_config('memberattribute_isdn')) {
if (!($extmemberuid = $this->ldap_find_userdn($extmemberuid))) {
diff --git a/enrol/ldap/settingslib.php b/enrol/ldap/settingslib.php
index c090c2c8d53..7b943ab9477 100644
--- a/enrol/ldap/settingslib.php
+++ b/enrol/ldap/settingslib.php
@@ -63,7 +63,7 @@ class admin_setting_configtext_trim_lower extends admin_setting_configtext {
return $validated;
}
if ($this->lowercase) {
- $data = textlib::strtolower($data);
+ $data = core_text::strtolower($data);
}
if (!$this->enabled) {
return '';
@@ -134,7 +134,7 @@ class admin_setting_ldap_rolemapping extends admin_setting {
if (!$this->config_write('contexts_role'.$roleid, trim($data['contexts']))) {
$return = get_string('errorsetting', 'admin');
}
- if (!$this->config_write('memberattribute_role'.$roleid, textlib::strtolower(trim($data['memberattribute'])))) {
+ if (!$this->config_write('memberattribute_role'.$roleid, core_text::strtolower(trim($data['memberattribute'])))) {
$return = get_string('errorsetting', 'admin');
}
}
diff --git a/enrol/paypal/ipn.php b/enrol/paypal/ipn.php
index 4a09dc54baf..32c67ca0409 100644
--- a/enrol/paypal/ipn.php
+++ b/enrol/paypal/ipn.php
@@ -171,7 +171,7 @@ if (strlen($result) > 0) {
}
- if (textlib::strtolower($data->business) !== textlib::strtolower($plugin->get_config('paypalbusiness'))) { // Check that the email is the one we want it to be
+ if (core_text::strtolower($data->business) !== core_text::strtolower($plugin->get_config('paypalbusiness'))) { // Check that the email is the one we want it to be
message_paypal_error_to_admin("Business email is {$data->business} (not ".
$plugin->get_config('paypalbusiness').")", $data);
die;
diff --git a/enrol/self/locallib.php b/enrol/self/locallib.php
index 7d6a917a632..cd010eb3fd5 100644
--- a/enrol/self/locallib.php
+++ b/enrol/self/locallib.php
@@ -101,7 +101,7 @@ class enrol_self_enrol_form extends moodleform {
} else {
$plugin = enrol_get_plugin('self');
if ($plugin->get_config('showhint')) {
- $hint = textlib::substr($instance->password, 0, 1);
+ $hint = core_text::substr($instance->password, 0, 1);
$errors['enrolpassword'] = get_string('passwordinvalidhint', 'enrol_self', $hint);
} else {
$errors['enrolpassword'] = get_string('passwordinvalid', 'enrol_self');
diff --git a/grade/edit/scale/edit_form.php b/grade/edit/scale/edit_form.php
index 8cd7d0ddad2..848cc4b3b0d 100644
--- a/grade/edit/scale/edit_form.php
+++ b/grade/edit/scale/edit_form.php
@@ -141,7 +141,7 @@ class edit_scale_form extends moodleform {
$thescale = implode(',',$scalearray);
//this check strips out whitespace from the scale we're validating but not from those already in the DB
- $count = $DB->count_records_select('scale', "courseid=:courseid AND ".$DB->sql_compare_text('scale', textlib::strlen($thescale)).'=:scale',
+ $count = $DB->count_records_select('scale', "courseid=:courseid AND ".$DB->sql_compare_text('scale', core_text::strlen($thescale)).'=:scale',
array('courseid'=>$courseid, 'scale'=>$thescale));
if ($count) {
diff --git a/grade/import/grade_import_form.php b/grade/import/grade_import_form.php
index 9f86e483e3b..73ff6803d7e 100644
--- a/grade/import/grade_import_form.php
+++ b/grade/import/grade_import_form.php
@@ -41,7 +41,7 @@ class grade_import_form extends moodleform {
// file upload
$mform->addElement('filepicker', 'userfile', get_string('file'));
$mform->addRule('userfile', null, 'required');
- $encodings = textlib::get_encodings();
+ $encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
if (!empty($features['includeseparator'])) {
diff --git a/group/group_form.php b/group/group_form.php
index 46f01377a1d..6818ca2b1e8 100644
--- a/group/group_form.php
+++ b/group/group_form.php
@@ -101,7 +101,7 @@ class group_form extends moodleform {
$idnumber = '';
}
if ($data['id'] and $group = $DB->get_record('groups', array('id'=>$data['id']))) {
- if (textlib::strtolower($group->name) != textlib::strtolower($name)) {
+ if (core_text::strtolower($group->name) != core_text::strtolower($name)) {
if (groups_get_group_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupnameexists', 'group', $name);
}
diff --git a/group/grouping_form.php b/group/grouping_form.php
index 1f15bc78b5f..d44444be2db 100644
--- a/group/grouping_form.php
+++ b/group/grouping_form.php
@@ -93,7 +93,7 @@ class grouping_form extends moodleform {
$idnumber = '';
}
if ($data['id'] and $grouping = $DB->get_record('groupings', array('id'=>$data['id']))) {
- if (textlib::strtolower($grouping->name) != textlib::strtolower($name)) {
+ if (core_text::strtolower($grouping->name) != core_text::strtolower($name)) {
if (groups_get_grouping_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupingnameexists', 'group', $name);
}
diff --git a/index.php b/index.php
index b5dc3218dd4..54defb495e9 100644
--- a/index.php
+++ b/index.php
@@ -176,7 +176,7 @@
$newsforumcontext = context_module::instance($newsforumcm->id, MUST_EXIST);
$forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
- echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
+ echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
// wraps site news forum in div container.
echo html_writer::start_tag('div', array('id'=>'site-news-forum'));
@@ -210,7 +210,7 @@
case FRONTPAGEENROLLEDCOURSELIST:
$mycourseshtml = $courserenderer->frontpage_my_courses();
if (!empty($mycourseshtml)) {
- echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
+ echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
//wrap frontpage course list in div container
echo html_writer::start_tag('div', array('id'=>'frontpage-course-list'));
@@ -229,7 +229,7 @@
case FRONTPAGEALLCOURSELIST:
$availablecourseshtml = $courserenderer->frontpage_available_courses();
if (!empty($availablecourseshtml)) {
- echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block'));
+ echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block'));
//wrap frontpage course list in div container
echo html_writer::start_tag('div', array('id'=>'frontpage-course-list'));
@@ -245,7 +245,7 @@
break;
case FRONTPAGECATEGORYNAMES:
- echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));
+ echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));
//wrap frontpage category names in div container
echo html_writer::start_tag('div', array('id'=>'frontpage-category-names'));
@@ -260,7 +260,7 @@
break;
case FRONTPAGECATEGORYCOMBO:
- echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
+ echo html_writer::tag('a', get_string('skipa', 'access', core_text::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
//wrap frontpage category combo in div container
echo html_writer::start_tag('div', array('id'=>'frontpage-category-combo'));
diff --git a/iplookup/lib.php b/iplookup/lib.php
index 5ca07d2dde5..da07be6ffdf 100644
--- a/iplookup/lib.php
+++ b/iplookup/lib.php
@@ -48,7 +48,7 @@ function iplookup_find_location($ip) {
return $info;
}
if (!empty($location->city)) {
- $info['city'] = textlib::convert($location->city, 'iso-8859-1', 'utf-8');
+ $info['city'] = core_text::convert($location->city, 'iso-8859-1', 'utf-8');
$info['title'][] = $info['city'];
}
diff --git a/lib/adminlib.php b/lib/adminlib.php
index 3b37521e03d..25ae3d0cae1 100644
--- a/lib/adminlib.php
+++ b/lib/adminlib.php
@@ -1235,7 +1235,7 @@ class admin_externalpage implements part_of_admin_tree {
$found = false;
if (strpos(strtolower($this->name), $query) !== false) {
$found = true;
- } else if (strpos(textlib::strtolower($this->visiblename), $query) !== false) {
+ } else if (strpos(core_text::strtolower($this->visiblename), $query) !== false) {
$found = true;
}
if ($found) {
@@ -1382,7 +1382,7 @@ class admin_settingpage implements part_of_admin_tree {
$found = false;
if (strpos(strtolower($this->name), $query) !== false) {
$found = true;
- } else if (strpos(textlib::strtolower($this->visiblename), $query) !== false) {
+ } else if (strpos(core_text::strtolower($this->visiblename), $query) !== false) {
$found = true;
}
if ($found) {
@@ -1827,16 +1827,16 @@ abstract class admin_setting {
if (strpos(strtolower($this->name), $query) !== false) {
return true;
}
- if (strpos(textlib::strtolower($this->visiblename), $query) !== false) {
+ if (strpos(core_text::strtolower($this->visiblename), $query) !== false) {
return true;
}
- if (strpos(textlib::strtolower($this->description), $query) !== false) {
+ if (strpos(core_text::strtolower($this->description), $query) !== false) {
return true;
}
$current = $this->get_setting();
if (!is_null($current)) {
if (is_string($current)) {
- if (strpos(textlib::strtolower($current), $query) !== false) {
+ if (strpos(core_text::strtolower($current), $query) !== false) {
return true;
}
}
@@ -1844,7 +1844,7 @@ abstract class admin_setting {
$default = $this->get_defaultsetting();
if (!is_null($default)) {
if (is_string($default)) {
- if (strpos(textlib::strtolower($default), $query) !== false) {
+ if (strpos(core_text::strtolower($default), $query) !== false) {
return true;
}
}
@@ -2602,7 +2602,7 @@ class admin_setting_configmulticheckbox extends admin_setting {
}
foreach ($this->choices as $desc) {
- if (strpos(textlib::strtolower($desc), $query) !== false) {
+ if (strpos(core_text::strtolower($desc), $query) !== false) {
return true;
}
}
@@ -2831,10 +2831,10 @@ class admin_setting_configselect extends admin_setting {
return false;
}
foreach ($this->choices as $key=>$value) {
- if (strpos(textlib::strtolower($key), $query) !== false) {
+ if (strpos(core_text::strtolower($key), $query) !== false) {
return true;
}
- if (strpos(textlib::strtolower($value), $query) !== false) {
+ if (strpos(core_text::strtolower($value), $query) !== false) {
return true;
}
}
@@ -3014,7 +3014,7 @@ class admin_setting_configmultiselect extends admin_setting_configselect {
}
foreach ($this->choices as $desc) {
- if (strpos(textlib::strtolower($desc), $query) !== false) {
+ if (strpos(core_text::strtolower($desc), $query) !== false) {
return true;
}
}
@@ -5027,7 +5027,7 @@ class admin_page_managemods extends admin_externalpage {
break;
}
$strmodulename = get_string('modulename', $module->name);
- if (strpos(textlib::strtolower($strmodulename), $query) !== false) {
+ if (strpos(core_text::strtolower($strmodulename), $query) !== false) {
$found = true;
break;
}
@@ -5099,14 +5099,14 @@ class admin_setting_manageenrols extends admin_setting {
return true;
}
- $query = textlib::strtolower($query);
+ $query = core_text::strtolower($query);
$enrols = enrol_get_plugins(false);
foreach ($enrols as $name=>$enrol) {
$localised = get_string('pluginname', 'enrol_'.$name);
- if (strpos(textlib::strtolower($name), $query) !== false) {
+ if (strpos(core_text::strtolower($name), $query) !== false) {
return true;
}
- if (strpos(textlib::strtolower($localised), $query) !== false) {
+ if (strpos(core_text::strtolower($localised), $query) !== false) {
return true;
}
}
@@ -5295,7 +5295,7 @@ class admin_page_manageblocks extends admin_externalpage {
break;
}
$strblockname = get_string('pluginname', 'block_'.$block->name);
- if (strpos(textlib::strtolower($strblockname), $query) !== false) {
+ if (strpos(core_text::strtolower($strblockname), $query) !== false) {
$found = true;
break;
}
@@ -5349,7 +5349,7 @@ class admin_page_managemessageoutputs extends admin_externalpage {
break;
}
$strprocessorname = get_string('pluginname', 'message_'.$processor->name);
- if (strpos(textlib::strtolower($strprocessorname), $query) !== false) {
+ if (strpos(core_text::strtolower($strprocessorname), $query) !== false) {
$found = true;
break;
}
@@ -5413,7 +5413,7 @@ class admin_page_manageqbehaviours extends admin_externalpage {
$found = false;
require_once($CFG->dirroot . '/question/engine/lib.php');
foreach (core_component::get_plugin_list('qbehaviour') as $behaviour => $notused) {
- if (strpos(textlib::strtolower(question_engine::get_behaviour_name($behaviour)),
+ if (strpos(core_text::strtolower(question_engine::get_behaviour_name($behaviour)),
$query) !== false) {
$found = true;
break;
@@ -5461,7 +5461,7 @@ class admin_page_manageqtypes extends admin_externalpage {
$found = false;
require_once($CFG->dirroot . '/question/engine/bank.php');
foreach (question_bank::get_all_qtypes() as $qtype) {
- if (strpos(textlib::strtolower($qtype->local_name()), $query) !== false) {
+ if (strpos(core_text::strtolower($qtype->local_name()), $query) !== false) {
$found = true;
break;
}
@@ -5510,7 +5510,7 @@ class admin_page_manageportfolios extends admin_externalpage {
if (!$found) {
foreach (portfolio_instances(false, false) as $instance) {
$title = $instance->get('name');
- if (strpos(textlib::strtolower($title), $query) !== false) {
+ if (strpos(core_text::strtolower($title), $query) !== false) {
$found = true;
break;
}
@@ -5561,7 +5561,7 @@ class admin_page_managerepositories extends admin_externalpage {
if (!$found) {
foreach (repository::get_types() as $instance) {
$title = $instance->get_typename();
- if (strpos(textlib::strtolower($title), $query) !== false) {
+ if (strpos(core_text::strtolower($title), $query) !== false) {
$found = true;
break;
}
@@ -5640,7 +5640,7 @@ class admin_setting_manageauths extends admin_setting {
}
$authplugin = get_auth_plugin($auth);
$authtitle = $authplugin->get_title();
- if (strpos(textlib::strtolower($authtitle), $query) !== false) {
+ if (strpos(core_text::strtolower($authtitle), $query) !== false) {
return true;
}
}
@@ -5841,7 +5841,7 @@ class admin_setting_manageeditors extends admin_setting {
if (strpos($editor, $query) !== false) {
return true;
}
- if (strpos(textlib::strtolower($editorstr), $query) !== false) {
+ if (strpos(core_text::strtolower($editorstr), $query) !== false) {
return true;
}
}
@@ -6107,7 +6107,7 @@ class admin_setting_manageformats extends admin_setting {
$formats = plugin_manager::instance()->get_plugins_of_type('format');
foreach ($formats as $format) {
if (strpos($format->component, $query) !== false ||
- strpos(textlib::strtolower($format->displayname), $query) !== false) {
+ strpos(core_text::strtolower($format->displayname), $query) !== false) {
return true;
}
}
@@ -6222,7 +6222,7 @@ class admin_page_managefilters extends admin_externalpage {
$found = false;
$filternames = filter_get_all_installed();
foreach ($filternames as $path => $strfiltername) {
- if (strpos(textlib::strtolower($strfiltername), $query) !== false) {
+ if (strpos(core_text::strtolower($strfiltername), $query) !== false) {
$found = true;
break;
}
@@ -6536,10 +6536,10 @@ function admin_find_write_settings($node, $data) {
function admin_search_settings_html($query) {
global $CFG, $OUTPUT;
- if (textlib::strlen($query) < 2) {
+ if (core_text::strlen($query) < 2) {
return '';
}
- $query = textlib::strtolower($query);
+ $query = core_text::strtolower($query);
$adminroot = admin_get_root();
$findings = $adminroot->search($query);
@@ -6884,7 +6884,7 @@ class admin_setting_managerepository extends admin_setting {
}
foreach (repository::get_types() as $instance) {
$title = $instance->get_typename();
- if (strpos(textlib::strtolower($title), $query) !== false) {
+ if (strpos(core_text::strtolower($title), $query) !== false) {
return true;
}
}
@@ -7319,7 +7319,7 @@ class admin_setting_manageexternalservices extends admin_setting {
$services = $DB->get_records('external_services', array(), 'id, name');
foreach ($services as $service) {
- if (strpos(textlib::strtolower($service->name), $query) !== false) {
+ if (strpos(core_text::strtolower($service->name), $query) !== false) {
return true;
}
}
@@ -7791,7 +7791,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting {
return true;
}
$protocolstr = get_string('pluginname', 'webservice_'.$protocol);
- if (strpos(textlib::strtolower($protocolstr), $query) !== false) {
+ if (strpos(core_text::strtolower($protocolstr), $query) !== false) {
return true;
}
}
diff --git a/lib/bennu/iCalendar_rfc2445.php b/lib/bennu/iCalendar_rfc2445.php
index a84f370a5c2..d221217c610 100644
--- a/lib/bennu/iCalendar_rfc2445.php
+++ b/lib/bennu/iCalendar_rfc2445.php
@@ -56,7 +56,7 @@ define('RFC2445_TYPE_UTC_OFFSET', 13);
function rfc2445_fold($string) {
- if(textlib::strlen($string, 'utf-8') <= RFC2445_FOLDED_LINE_LENGTH) {
+ if(core_text::strlen($string, 'utf-8') <= RFC2445_FOLDED_LINE_LENGTH) {
return $string;
}
@@ -66,15 +66,15 @@ function rfc2445_fold($string) {
$len_count=0;
//multi-byte string, get the correct length
- $section_len = textlib::strlen($string, 'utf-8');
+ $section_len = core_text::strlen($string, 'utf-8');
while($len_count<$section_len) {
//get the current portion of the line
- $section = textlib::substr($string, ($i * RFC2445_FOLDED_LINE_LENGTH), (RFC2445_FOLDED_LINE_LENGTH), 'utf-8');
+ $section = core_text::substr($string, ($i * RFC2445_FOLDED_LINE_LENGTH), (RFC2445_FOLDED_LINE_LENGTH), 'utf-8');
//increment the length we've processed by the length of the new portion
- $len_count += textlib::strlen($section, 'utf-8');
+ $len_count += core_text::strlen($section, 'utf-8');
/* Add the portion to the return value, terminating with CRLF.HTAB
As per RFC 2445, CRLF.HTAB will be replaced by the processor of the
diff --git a/lib/bennu/readme_moodle.txt b/lib/bennu/readme_moodle.txt
index 582b265fde7..ce650557c26 100644
--- a/lib/bennu/readme_moodle.txt
+++ b/lib/bennu/readme_moodle.txt
@@ -2,5 +2,5 @@ Description of Bennu library import - customised library by author, this version
modifications:
1/ removed ereg functions deprecated as of php 5.3 (18 Nov 2009)
-2/ replaced mbstring functions with moodle textlib (28 Nov 2011)
+2/ replaced mbstring functions with moodle core_text (28 Nov 2011)
3/ replaced explode in iCalendar_component::unserialize() with preg_split to support various line breaks (20 Nov 2012)
\ No newline at end of file
diff --git a/lib/blocklib.php b/lib/blocklib.php
index 8d687b2f9ff..f14b8926f27 100644
--- a/lib/blocklib.php
+++ b/lib/blocklib.php
@@ -1902,7 +1902,7 @@ function block_add_block_ui($page, $output) {
$menu[$block->name] = $blockobject->get_title();
}
}
- collatorlib::asort($menu);
+ core_collator::asort($menu);
$actionurl = new moodle_url($page->url, array('sesskey'=>sesskey()));
$select = new single_select($actionurl, 'bui_addblock', $menu, null, array(''=>get_string('adddots')), 'add_block');
diff --git a/lib/classes/collator.php b/lib/classes/collator.php
index b3341b4418e..fa1931ce1dd 100644
--- a/lib/classes/collator.php
+++ b/lib/classes/collator.php
@@ -141,7 +141,7 @@ class core_collator {
* @return string string with normalised numbers
*/
protected static function naturalise($string) {
- return preg_replace_callback('/[0-9]+/', array('collatorlib', 'callback_naturalise'), $string);
+ return preg_replace_callback('/[0-9]+/', array('core_collator', 'callback_naturalise'), $string);
}
/**
@@ -158,11 +158,11 @@ class core_collator {
* Locale aware sorting, the key associations are kept, values are sorted alphabetically.
*
* @param array $arr array to be sorted (reference)
- * @param int $sortflag One of collatorlib::SORT_NUMERIC, collatorlib::SORT_STRING, collatorlib::SORT_NATURAL, collatorlib::SORT_REGULAR
- * optionally "|" collatorlib::CASE_SENSITIVE
+ * @param int $sortflag One of core_collator::SORT_NUMERIC, core_collator::SORT_STRING, core_collator::SORT_NATURAL, core_collator::SORT_REGULAR
+ * optionally "|" core_collator::CASE_SENSITIVE
* @return bool True on success
*/
- public static function asort(array &$arr, $sortflag = collatorlib::SORT_STRING) {
+ public static function asort(array &$arr, $sortflag = core_collator::SORT_STRING) {
if (empty($arr)) {
// nothing to do
return true;
@@ -170,26 +170,26 @@ class core_collator {
$original = null;
- $casesensitive = (bool)($sortflag & collatorlib::CASE_SENSITIVE);
- $sortflag = ($sortflag & ~collatorlib::CASE_SENSITIVE);
- if ($sortflag != collatorlib::SORT_NATURAL and $sortflag != collatorlib::SORT_STRING) {
+ $casesensitive = (bool)($sortflag & core_collator::CASE_SENSITIVE);
+ $sortflag = ($sortflag & ~core_collator::CASE_SENSITIVE);
+ if ($sortflag != core_collator::SORT_NATURAL and $sortflag != core_collator::SORT_STRING) {
$casesensitive = false;
}
if (self::ensure_collator_available()) {
- if ($sortflag == collatorlib::SORT_NUMERIC) {
+ if ($sortflag == core_collator::SORT_NUMERIC) {
$flag = Collator::SORT_NUMERIC;
- } else if ($sortflag == collatorlib::SORT_REGULAR) {
+ } else if ($sortflag == core_collator::SORT_REGULAR) {
$flag = Collator::SORT_REGULAR;
} else {
$flag = Collator::SORT_STRING;
}
- if ($sortflag == collatorlib::SORT_NATURAL) {
+ if ($sortflag == core_collator::SORT_NATURAL) {
$original = $arr;
- if ($sortflag == collatorlib::SORT_NATURAL) {
+ if ($sortflag == core_collator::SORT_NATURAL) {
foreach ($arr as $key => $value) {
$arr[$key] = self::naturalise((string)$value);
}
@@ -209,21 +209,21 @@ class core_collator {
// try some fallback that works at least for English
- if ($sortflag == collatorlib::SORT_NUMERIC) {
+ if ($sortflag == core_collator::SORT_NUMERIC) {
return asort($arr, SORT_NUMERIC);
- } else if ($sortflag == collatorlib::SORT_REGULAR) {
+ } else if ($sortflag == core_collator::SORT_REGULAR) {
return asort($arr, SORT_REGULAR);
}
if (!$casesensitive) {
$original = $arr;
foreach ($arr as $key => $value) {
- $arr[$key] = textlib::strtolower($value);
+ $arr[$key] = core_text::strtolower($value);
}
}
- if ($sortflag == collatorlib::SORT_NATURAL) {
+ if ($sortflag == core_collator::SORT_NATURAL) {
$result = natsort($arr);
} else {
@@ -242,11 +242,11 @@ class core_collator {
*
* @param array $objects An array of objects to sort (handled by reference)
* @param string $property The property to use for comparison
- * @param int $sortflag One of collatorlib::SORT_NUMERIC, collatorlib::SORT_STRING, collatorlib::SORT_NATURAL, collatorlib::SORT_REGULAR
- * optionally "|" collatorlib::CASE_SENSITIVE
+ * @param int $sortflag One of core_collator::SORT_NUMERIC, core_collator::SORT_STRING, core_collator::SORT_NATURAL, core_collator::SORT_REGULAR
+ * optionally "|" core_collator::CASE_SENSITIVE
* @return bool True on success
*/
- public static function asort_objects_by_property(array &$objects, $property, $sortflag = collatorlib::SORT_STRING) {
+ public static function asort_objects_by_property(array &$objects, $property, $sortflag = core_collator::SORT_STRING) {
$original = $objects;
foreach ($objects as $key => $object) {
$objects[$key] = $object->$property;
@@ -261,11 +261,11 @@ class core_collator {
*
* @param array $objects An array of objects to sort (handled by reference)
* @param string $method The method to call to generate a value for comparison
- * @param int $sortflag One of collatorlib::SORT_NUMERIC, collatorlib::SORT_STRING, collatorlib::SORT_NATURAL, collatorlib::SORT_REGULAR
- * optionally "|" collatorlib::CASE_SENSITIVE
+ * @param int $sortflag One of core_collator::SORT_NUMERIC, core_collator::SORT_STRING, core_collator::SORT_NATURAL, core_collator::SORT_REGULAR
+ * optionally "|" core_collator::CASE_SENSITIVE
* @return bool True on success
*/
- public static function asort_objects_by_method(array &$objects, $method, $sortflag = collatorlib::SORT_STRING) {
+ public static function asort_objects_by_method(array &$objects, $method, $sortflag = core_collator::SORT_STRING) {
$original = $objects;
foreach ($objects as $key => $object) {
$objects[$key] = $object->{$method}();
@@ -279,11 +279,11 @@ class core_collator {
* Locale aware sorting, the key associations are kept, keys are sorted alphabetically.
*
* @param array $arr array to be sorted (reference)
- * @param int $sortflag One of collatorlib::SORT_NUMERIC, collatorlib::SORT_STRING, collatorlib::SORT_NATURAL, collatorlib::SORT_REGULAR
- * optionally "|" collatorlib::CASE_SENSITIVE
+ * @param int $sortflag One of core_collator::SORT_NUMERIC, core_collator::SORT_STRING, core_collator::SORT_NATURAL, core_collator::SORT_REGULAR
+ * optionally "|" core_collator::CASE_SENSITIVE
* @return bool True on success
*/
- public static function ksort(array &$arr, $sortflag = collatorlib::SORT_STRING) {
+ public static function ksort(array &$arr, $sortflag = core_collator::SORT_STRING) {
$keys = array_keys($arr);
if (!self::asort($keys, $sortflag)) {
return false;
diff --git a/lib/coursecatlib.php b/lib/coursecatlib.php
index 05bbc6ba592..b33cc90cd05 100644
--- a/lib/coursecatlib.php
+++ b/lib/coursecatlib.php
@@ -310,14 +310,14 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
if (empty($data->name)) {
throw new moodle_exception('categorynamerequired');
}
- if (textlib::strlen($data->name) > 255) {
+ if (core_text::strlen($data->name) > 255) {
throw new moodle_exception('categorytoolong');
}
$newcategory->name = $data->name;
// validate and set idnumber
if (!empty($data->idnumber)) {
- if (textlib::strlen($data->idnumber) > 100) {
+ if (core_text::strlen($data->idnumber) > 100) {
throw new moodle_exception('idnumbertoolong');
}
if ($DB->record_exists('course_categories', array('idnumber' => $data->idnumber))) {
@@ -427,14 +427,14 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
}
if (!empty($data->name) && $data->name !== $this->name) {
- if (textlib::strlen($data->name) > 255) {
+ if (core_text::strlen($data->name) > 255) {
throw new moodle_exception('categorytoolong');
}
$newcategory->name = $data->name;
}
if (isset($data->idnumber) && $data->idnumber != $this->idnumber) {
- if (textlib::strlen($data->idnumber) > 100) {
+ if (core_text::strlen($data->idnumber) > 100) {
throw new moodle_exception('idnumbertoolong');
}
if ($DB->record_exists('course_categories', array('idnumber' => $data->idnumber))) {
@@ -921,17 +921,17 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
}
}
}
- // sorting by one field - use collatorlib
+ // sorting by one field - use core_collator
if (count($sortfields) == 1) {
$property = key($sortfields);
if (in_array($property, array('sortorder', 'id', 'visible', 'parent', 'depth'))) {
- $sortflag = collatorlib::SORT_NUMERIC;
+ $sortflag = core_collator::SORT_NUMERIC;
} else if (in_array($property, array('idnumber', 'displayname', 'name', 'shortname', 'fullname'))) {
- $sortflag = collatorlib::SORT_STRING;
+ $sortflag = core_collator::SORT_STRING;
} else {
- $sortflag = collatorlib::SORT_REGULAR;
+ $sortflag = core_collator::SORT_REGULAR;
}
- collatorlib::asort_objects_by_property($records, $property, $sortflag);
+ core_collator::asort_objects_by_property($records, $property, $sortflag);
if ($sortfields[$property] < 0) {
$records = array_reverse($records, true);
}
diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php
index 25bcdcc9052..1df60c4014f 100644
--- a/lib/csvlib.class.php
+++ b/lib/csvlib.class.php
@@ -85,9 +85,9 @@ class csv_import_reader {
$this->close();
$this->_error = null;
- $content = textlib::convert($content, $encoding, 'utf-8');
+ $content = core_text::convert($content, $encoding, 'utf-8');
// remove Unicode BOM from first line
- $content = textlib::trim_utf8_bom($content);
+ $content = core_text::trim_utf8_bom($content);
// Fix mac/dos newlines
$content = preg_replace('!\r\n?!', "\n", $content);
// Remove any spaces or new lines at the end of the file.
diff --git a/lib/datalib.php b/lib/datalib.php
index fada22966d0..c7ef03ca556 100644
--- a/lib/datalib.php
+++ b/lib/datalib.php
@@ -1642,14 +1642,14 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
// database so that it doesn't cause a DB error. Log a warning so that
// developers can avoid doing things which are likely to cause this on a
// routine basis.
- if(!empty($info) && textlib::strlen($info)>255) {
- $info = textlib::substr($info,0,252).'...';
+ if(!empty($info) && core_text::strlen($info)>255) {
+ $info = core_text::substr($info,0,252).'...';
debugging('Warning: logged very long info',DEBUG_DEVELOPER);
}
// If the 100 field size is changed, also need to alter print_log in course/lib.php
- if(!empty($url) && textlib::strlen($url)>100) {
- $url = textlib::substr($url,0,97).'...';
+ if(!empty($url) && core_text::strlen($url)>100) {
+ $url = core_text::substr($url,0,97).'...';
debugging('Warning: logged very long URL',DEBUG_DEVELOPER);
}
diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php
index 33a9c0a9b75..796efaf69a9 100644
--- a/lib/deprecatedlib.php
+++ b/lib/deprecatedlib.php
@@ -2028,23 +2028,23 @@ function show_event($event) {
}
/**
- * @deprecated Use textlib::strtolower($text) instead.
+ * @deprecated Use core_text::strtolower($text) instead.
*/
function moodle_strtolower($string, $encoding='') {
- throw new coding_exception('moodle_strtolower() cannot be used any more. Please use textlib::strtolower() instead.');
+ throw new coding_exception('moodle_strtolower() cannot be used any more. Please use core_text::strtolower() instead.');
}
/**
* Original singleton helper function, please use static methods instead,
- * ex: textlib::convert()
+ * ex: core_text::convert()
*
- * @deprecated since Moodle 2.2 use textlib::xxxx() instead
+ * @deprecated since Moodle 2.2 use core_text::xxxx() instead
* @see textlib
* @return textlib instance
*/
function textlib_get_instance() {
- debugging('textlib_get_instance() is deprecated. Please use static calling textlib::functioname() instead.', DEBUG_DEVELOPER);
+ debugging('textlib_get_instance() is deprecated. Please use static calling core_text::functioname() instead.', DEBUG_DEVELOPER);
return new textlib();
}
diff --git a/lib/editor/tinymce/adminlib.php b/lib/editor/tinymce/adminlib.php
index 882e387f390..d30f3bf5689 100644
--- a/lib/editor/tinymce/adminlib.php
+++ b/lib/editor/tinymce/adminlib.php
@@ -142,7 +142,7 @@ class tiynce_subplugins_settings extends admin_setting {
}
$namestr = get_string('pluginname', 'tinymce_'.$name);
- if (strpos(textlib::strtolower($namestr), textlib::strtolower($query)) !== false) {
+ if (strpos(core_text::strtolower($namestr), core_text::strtolower($query)) !== false) {
return true;
}
}
diff --git a/lib/editor/tinymce/plugins/spellchecker/classes/GoogleSpell.php b/lib/editor/tinymce/plugins/spellchecker/classes/GoogleSpell.php
index 5edf76a1059..6665d69b854 100644
--- a/lib/editor/tinymce/plugins/spellchecker/classes/GoogleSpell.php
+++ b/lib/editor/tinymce/plugins/spellchecker/classes/GoogleSpell.php
@@ -4,7 +4,7 @@
*
* @package MCManager.includes
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
class GoogleSpell extends SpellChecker {
@@ -128,7 +128,7 @@ class GoogleSpell extends SpellChecker {
}
function _unhtmlentities($string) {
- return textlib::entities_to_utf8($string); // Moodle hack
+ return core_text::entities_to_utf8($string); // Moodle hack
$string = preg_replace('~([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~([0-9]+);~e', 'chr(\\1)', $string);
diff --git a/lib/excellib.class.php b/lib/excellib.class.php
index 3103885bd93..1e1355db0c2 100644
--- a/lib/excellib.class.php
+++ b/lib/excellib.class.php
@@ -166,7 +166,7 @@ class MoodleExcelWorksheet {
// Replace any characters in the name that Excel cannot cope with.
$name = strtr($name, '[]*/\?:', ' ');
// Shorten the title if necessary.
- $name = textlib::substr($name, 0, 31);
+ $name = core_text::substr($name, 0, 31);
if ($name === '') {
// Name is required!
diff --git a/lib/filebrowser/file_info.php b/lib/filebrowser/file_info.php
index a6af3f78b47..b7dcc46b47c 100644
--- a/lib/filebrowser/file_info.php
+++ b/lib/filebrowser/file_info.php
@@ -143,7 +143,7 @@ abstract class file_info {
$nonemptylist[] = $fileinfo;
} else {
$filename = $fileinfo->get_visible_name();
- $extension = textlib::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+ $extension = core_text::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if (!empty($extension) && in_array('.' . $extension, $extensions)) {
$nonemptylist[] = $fileinfo;
}
@@ -177,7 +177,7 @@ abstract class file_info {
if (!$fileinfo->is_directory()) {
if ($extensions !== '*') {
$filename = $fileinfo->get_visible_name();
- $extension = textlib::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+ $extension = core_text::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if (empty($extension) || !in_array('.' . $extension, $extensions)) {
continue;
}
diff --git a/lib/filebrowser/file_info_context_course.php b/lib/filebrowser/file_info_context_course.php
index 84fd4e6da99..cd636e7c604 100644
--- a/lib/filebrowser/file_info_context_course.php
+++ b/lib/filebrowser/file_info_context_course.php
@@ -566,7 +566,7 @@ class file_info_area_course_legacy extends file_info_stored {
$storedfiles = $fs->get_directory_files($this->context->id, 'course', 'legacy', 0,
$this->lf->get_filepath(), false, true, "filepath, filename");
foreach ($storedfiles as $file) {
- $extension = textlib::strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
+ $extension = core_text::strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
if ($file->is_directory() || $extensions === '*' || (!empty($extension) && in_array('.'.$extension, $extensions))) {
$fileinfo = new file_info_area_course_legacy($this->browser, $this->context, $file, $this->urlbase, $this->topvisiblename,
$this->itemidused, $this->readaccess, $this->writeaccess, false);
diff --git a/lib/filebrowser/file_info_stored.php b/lib/filebrowser/file_info_stored.php
index e9caf4cab03..8c1069b65e0 100644
--- a/lib/filebrowser/file_info_stored.php
+++ b/lib/filebrowser/file_info_stored.php
@@ -368,7 +368,7 @@ class file_info_stored extends file_info {
$storedfiles = $fs->get_directory_files($this->context->id, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(),
$this->lf->get_filepath(), false, true, "filepath, filename");
foreach ($storedfiles as $file) {
- $extension = textlib::strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
+ $extension = core_text::strtolower(pathinfo($file->get_filename(), PATHINFO_EXTENSION));
if ($file->is_directory() || $extensions === '*' || (!empty($extension) && in_array('.'.$extension, $extensions))) {
$fileinfo = new file_info_stored($this->browser, $this->context, $file, $this->urlbase, $this->topvisiblename,
$this->itemidused, $this->readaccess, $this->writeaccess, false);
@@ -396,7 +396,7 @@ class file_info_stored extends file_info {
}
$filepath = $this->lf->get_filepath();
- $length = textlib::strlen($filepath);
+ $length = core_text::strlen($filepath);
$sql = "SELECT filepath, filename
FROM {files} f
WHERE f.contextid = :contextid AND f.component = :component AND f.filearea = :filearea AND f.itemid = :itemid
@@ -415,7 +415,7 @@ class file_info_stored extends file_info {
if ($record->filepath === $filepath) {
$children[] = $record->filename;
} else {
- $path = explode('/', textlib::substr($record->filepath, $length));
+ $path = explode('/', core_text::substr($record->filepath, $length));
if (!in_array($path[0], $children)) {
$children[] = $path[0];
}
diff --git a/lib/filestorage/file_archive.php b/lib/filestorage/file_archive.php
index 1aa688d6f0e..8d9ab818c89 100644
--- a/lib/filestorage/file_archive.php
+++ b/lib/filestorage/file_archive.php
@@ -131,17 +131,17 @@ abstract class file_archive implements Iterator {
return $localname;
}
- $converted = textlib::convert($localname, 'utf-8', $this->encoding);
- $original = textlib::convert($converted, $this->encoding, 'utf-8');
+ $converted = core_text::convert($localname, 'utf-8', $this->encoding);
+ $original = core_text::convert($converted, $this->encoding, 'utf-8');
if ($original === $localname) {
$result = $converted;
} else {
// try ascii conversion
- $converted2 = textlib::specialtoascii($localname);
- $converted2 = textlib::convert($converted2, 'utf-8', $this->encoding);
- $original2 = textlib::convert($converted, $this->encoding, 'utf-8');
+ $converted2 = core_text::specialtoascii($localname);
+ $converted2 = core_text::convert($converted2, 'utf-8', $this->encoding);
+ $original2 = core_text::convert($converted, $this->encoding, 'utf-8');
if ($original2 === $localname) {
//this looks much better
@@ -175,7 +175,7 @@ abstract class file_archive implements Iterator {
$result = ltrim($result, '/'); // no leading /
if ($this->encoding !== 'utf-8') {
- $result = textlib::convert($result, $this->encoding, 'utf-8');
+ $result = core_text::convert($result, $this->encoding, 'utf-8');
}
return clean_param($result, PARAM_PATH);
diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php
index 31fd1fbf93c..3012ec5a3d0 100644
--- a/lib/filestorage/file_storage.php
+++ b/lib/filestorage/file_storage.php
@@ -648,9 +648,9 @@ class file_storage {
foreach ($tree as $key => &$value) {
if ($key == 'subdirs') {
$value = $this->sort_area_tree($value);
- collatorlib::ksort($value, collatorlib::SORT_NATURAL);
+ core_collator::ksort($value, core_collator::SORT_NATURAL);
} else if ($key == 'files') {
- collatorlib::ksort($value, collatorlib::SORT_NATURAL);
+ core_collator::ksort($value, core_collator::SORT_NATURAL);
}
}
return $tree;
@@ -681,7 +681,7 @@ class file_storage {
if ($recursive) {
$dirs = $includedirs ? "" : "AND filename <> '.'";
- $length = textlib::strlen($filepath);
+ $length = core_text::strlen($filepath);
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
@@ -710,7 +710,7 @@ class file_storage {
$result = array();
$params = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'filepath'=>$filepath, 'dirid'=>$directory->get_id());
- $length = textlib::strlen($filepath);
+ $length = core_text::strlen($filepath);
if ($includedirs) {
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
diff --git a/lib/filestorage/zip_archive.php b/lib/filestorage/zip_archive.php
index 4304c6ea618..1ef485e1b80 100644
--- a/lib/filestorage/zip_archive.php
+++ b/lib/filestorage/zip_archive.php
@@ -170,7 +170,7 @@ class zip_archive extends file_archive {
$name = $localname;
// This should not happen.
if (!empty($this->encoding) and $this->encoding !== 'utf-8') {
- $name = @textlib::convert($name, $this->encoding, 'utf-8');
+ $name = @core_text::convert($name, $this->encoding, 'utf-8');
}
$name = str_replace('\\', '/', $name); // no MS \ separators
$name = clean_param($name, PARAM_PATH); // only safe chars
@@ -596,8 +596,8 @@ class zip_archive extends file_archive {
}
if (!$found and !empty($this->encoding) and $this->encoding !== 'utf-8') {
// Try the encoding from open().
- $newname = @textlib::convert($name, $this->encoding, 'utf-8');
- $original = textlib::convert($newname, 'utf-8', $this->encoding);
+ $newname = @core_text::convert($name, $this->encoding, 'utf-8');
+ $original = core_text::convert($newname, 'utf-8', $this->encoding);
if ($original === $name) {
$found = true;
$name = $newname;
@@ -649,8 +649,8 @@ class zip_archive extends file_archive {
break;
}
}
- $newname = @textlib::convert($name, $encoding, 'utf-8');
- $original = textlib::convert($newname, 'utf-8', $encoding);
+ $newname = @core_text::convert($name, $encoding, 'utf-8');
+ $original = core_text::convert($newname, 'utf-8', $encoding);
if ($original === $name) {
$name = $newname;
diff --git a/lib/filterlib.php b/lib/filterlib.php
index fb674fffc91..0438c21978b 100644
--- a/lib/filterlib.php
+++ b/lib/filterlib.php
@@ -518,7 +518,7 @@ function filter_get_all_installed() {
$filternames[$filter] = filter_get_name($filter);
}
}
- collatorlib::asort($filternames);
+ core_collator::asort($filternames);
return $filternames;
}
@@ -636,11 +636,11 @@ function filter_set_global_state($filtername, $state, $move = 0) {
}
}
- collatorlib::asort_objects_by_property($on, 'newsortorder', collatorlib::SORT_NUMERIC);
+ core_collator::asort_objects_by_property($on, 'newsortorder', core_collator::SORT_NUMERIC);
}
// Inactive are sorted by filter name.
- collatorlib::asort_objects_by_property($off, 'filter', collatorlib::SORT_NATURAL);
+ core_collator::asort_objects_by_property($off, 'filter', core_collator::SORT_NATURAL);
// Update records if necessary.
$i = 1;
@@ -1379,13 +1379,13 @@ function filter_remove_duplicates($linkarray) {
if ($filterobject->casesensitive) {
$exists = in_array($filterobject->phrase, $concepts);
} else {
- $exists = in_array(textlib::strtolower($filterobject->phrase), $lconcepts);
+ $exists = in_array(core_text::strtolower($filterobject->phrase), $lconcepts);
}
if (!$exists) {
$cleanlinks[] = $filterobject;
$concepts[] = $filterobject->phrase;
- $lconcepts[] = textlib::strtolower($filterobject->phrase);
+ $lconcepts[] = core_text::strtolower($filterobject->phrase);
}
}
diff --git a/lib/gradelib.php b/lib/gradelib.php
index fc026170614..28bb4a70a1e 100644
--- a/lib/gradelib.php
+++ b/lib/gradelib.php
@@ -808,7 +808,7 @@ function grade_get_categories_menu($courseid, $includenew=false) {
foreach ($categories as $category) {
$cats[$category->id] = $category->get_name();
}
- collatorlib::asort($cats);
+ core_collator::asort($cats);
return ($result+$cats);
}
diff --git a/lib/graphlib.php b/lib/graphlib.php
index c712fad514b..0fa5eef9593 100644
--- a/lib/graphlib.php
+++ b/lib/graphlib.php
@@ -1247,7 +1247,7 @@ class graph {
break;
}
// start of Moodle addition
- $text = textlib::utf8_to_entities($text, true, true); //does not work with hex entities!
+ $text = core_text::utf8_to_entities($text, true, true); //does not work with hex entities!
// end of Moodle addition
ImageTTFText($this->image, $points, $angle, $x, $y, $colour, $font, $text);
}
@@ -1352,7 +1352,7 @@ class graph {
// get boundary box and offsets for printing at an angle
// start of Moodle addition
- $text = textlib::utf8_to_entities($text, true, true); //gd does not work with hex entities!
+ $text = core_text::utf8_to_entities($text, true, true); //gd does not work with hex entities!
// end of Moodle addition
$bounds = ImageTTFBBox($points, $angle, $font, $text);
diff --git a/lib/html2text.php b/lib/html2text.php
index b78b0ae1b9b..f01ce8f8dd9 100644
--- a/lib/html2text.php
+++ b/lib/html2text.php
@@ -731,8 +731,8 @@ class html2text
{
$str = html_entity_decode($str, ENT_COMPAT, RCMAIL_CHARSET);
- if (class_exists('textlib'))
- $str = textlib::strtoupper($str);
+ if (class_exists('core_text'))
+ $str = core_text::strtoupper($str);
else if (function_exists('mb_strtoupper'))
$str = mb_strtoupper($str);
else
diff --git a/lib/html2text_readme.txt b/lib/html2text_readme.txt
index c92fe84b0b3..2cdc2aaf664 100644
--- a/lib/html2text_readme.txt
+++ b/lib/html2text_readme.txt
@@ -9,7 +9,7 @@ Modifications
1. Don't just strip images, replace them with their alt text. (Tim Hunt 2010-08-04)
2. No strip slashes, we do not use magic quotes any more in Moodle 2.0 or later
-3. Use textlib, not crappy functions that break UTF-8, in the _strtoupper method. (Tim Hunt 2010-11-02)
+3. Use core_text, not crappy functions that break UTF-8, in the _strtoupper method. (Tim Hunt 2010-11-02)
4. Make sure html2text does not destroy '0'. (Tim Hunt 2011-09-21)
5. define missing mail charset
6. Fixed the links list enumeration (MDL-35206).
diff --git a/lib/medialib.php b/lib/medialib.php
index e75e07743be..2dff8f29763 100644
--- a/lib/medialib.php
+++ b/lib/medialib.php
@@ -156,7 +156,7 @@ abstract class core_media {
* @param moodle_url $url URL
*/
public static function get_extension(moodle_url $url) {
- // Note: Does not use textlib (. is UTF8-safe).
+ // Note: Does not use core_text (. is UTF8-safe).
$filename = self::get_filename($url);
$dot = strrpos($filename, '.');
if ($dot === false) {
diff --git a/lib/modinfolib.php b/lib/modinfolib.php
index a163d38179a..990fc6a45f9 100644
--- a/lib/modinfolib.php
+++ b/lib/modinfolib.php
@@ -172,7 +172,7 @@ class course_modinfo extends stdClass {
$modnamesused[$mod->modname] = $modnames[$mod->modname];
}
}
- collatorlib::asort($modnamesused);
+ core_collator::asort($modnamesused);
return $modnamesused;
}
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 5b43636b9f8..9c1bae11665 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1094,7 +1094,7 @@ function clean_param($param, $type) {
$param = preg_replace('~[[:cntrl:]]|[<>`]~u', '', $param);
// Convert many whitespace chars into one.
$param = preg_replace('/\s+/', ' ', $param);
- $param = textlib::substr(trim($param), 0, TAG_MAX_LENGTH);
+ $param = core_text::substr(trim($param), 0, TAG_MAX_LENGTH);
return $param;
case PARAM_TAGLIST:
@@ -1164,7 +1164,7 @@ function clean_param($param, $type) {
$param = fix_utf8($param);
$param = str_replace(" " , "", $param);
// Convert uppercase to lowercase MDL-16919.
- $param = textlib::strtolower($param);
+ $param = core_text::strtolower($param);
if (empty($CFG->extendedusernamechars)) {
// Regular expression, eliminate all chars EXCEPT:
// alphanum, dash (-), underscore (_), at sign (@) and period (.) characters.
@@ -1586,7 +1586,7 @@ function purge_all_caches() {
js_reset_all_caches();
theme_reset_all_caches();
get_string_manager()->reset_caches();
- textlib::reset_caches();
+ core_text::reset_caches();
cache_helper::purge_all();
@@ -1825,7 +1825,7 @@ function set_user_preference($name, $value, $user = null) {
}
// Value column maximum length is 1333 characters.
$value = (string)$value;
- if (textlib::strlen($value) > 1333) {
+ if (core_text::strlen($value) > 1333) {
throw new coding_exception('Invalid value in set_user_preference() call, value is is too long for the value column');
}
@@ -2243,17 +2243,17 @@ function date_format_string($date, $format, $tz = 99) {
global $CFG;
if (abs($tz) > 13) {
if ($CFG->ostype == 'WINDOWS' and $localewincharset = get_string('localewincharset', 'langconfig')) {
- $format = textlib::convert($format, 'utf-8', $localewincharset);
+ $format = core_text::convert($format, 'utf-8', $localewincharset);
$datestring = strftime($format, $date);
- $datestring = textlib::convert($datestring, $localewincharset, 'utf-8');
+ $datestring = core_text::convert($datestring, $localewincharset, 'utf-8');
} else {
$datestring = strftime($format, $date);
}
} else {
if ($CFG->ostype == 'WINDOWS' and $localewincharset = get_string('localewincharset', 'langconfig')) {
- $format = textlib::convert($format, 'utf-8', $localewincharset);
+ $format = core_text::convert($format, 'utf-8', $localewincharset);
$datestring = gmstrftime($format, $date);
- $datestring = textlib::convert($datestring, $localewincharset, 'utf-8');
+ $datestring = core_text::convert($datestring, $localewincharset, 'utf-8');
} else {
$datestring = gmstrftime($format, $date);
}
@@ -3967,7 +3967,7 @@ function create_user_record($username, $password, $auth = 'manual') {
global $CFG, $DB;
require_once($CFG->dirroot."/user/profile/lib.php");
// Just in case check text case.
- $username = trim(textlib::strtolower($username));
+ $username = trim(core_text::strtolower($username));
$authplugin = get_auth_plugin($auth);
$customfields = $authplugin->get_custom_user_profile_fields();
@@ -4035,7 +4035,7 @@ function update_user_record($username) {
global $DB, $CFG;
require_once($CFG->dirroot."/user/profile/lib.php");
// Just in case check text case.
- $username = trim(textlib::strtolower($username));
+ $username = trim(core_text::strtolower($username));
$oldinfo = $DB->get_record('user', array('username' => $username, 'mnethostid' => $CFG->mnet_localhost_id), '*', MUST_EXIST);
$newuser = array();
@@ -4118,7 +4118,7 @@ function truncate_userinfo(array $info) {
// Apply where needed.
foreach (array_keys($info) as $key) {
if (!empty($limit[$key])) {
- $info[$key] = trim(textlib::substr($info[$key], 0, $limit[$key]));
+ $info[$key] = trim(core_text::substr($info[$key], 0, $limit[$key]));
}
}
@@ -4775,7 +4775,7 @@ function check_password_policy($password, &$errmsg) {
}
$errmsg = '';
- if (textlib::strlen($password) < $CFG->minpasswordlength) {
+ if (core_text::strlen($password) < $CFG->minpasswordlength) {
$errmsg .= '