Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-40438 migrate all collatorlib:: and textlib:: uses

  • Loading branch information...
commit 2f1e464a88c3783928470349a027a93c96c24442 1 parent e7c21ac
@skodak skodak authored
Showing with 423 additions and 425 deletions.
  1. +1 −1  admin/blocks.php
  2. +1 −1  admin/localplugins.php
  3. +1 −1  admin/mnet/access_control.php
  4. +3 −3 admin/registration/forms.php
  5. +1 −1  admin/reports.php
  6. +2 −2 admin/roles/classes/define_role_table_advanced.php
  7. +4 −4 admin/tool/uploadcourse/classes/helper.php
  8. +1 −1  admin/tool/uploadcourse/classes/step1_form.php
  9. +1 −1  admin/tool/uploadcourse/cli/uploadcourse.php
  10. +5 −5 admin/tool/uploaduser/locallib.php
  11. +1 −1  admin/tool/uploaduser/user_form.php
  12. +2 −2 admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
  13. +1 −1  admin/tools.php
  14. +5 −5 auth/cas/auth.php
  15. +8 −8 auth/db/auth.php
  16. +32 −32 auth/ldap/auth.php
  17. +1 −1  backup/converter/moodle1/handlerlib.php
  18. +1 −1  backup/converter/moodle1/lib.php
  19. +3 −3 backup/util/dbops/backup_plan_dbops.class.php
  20. +1 −1  backup/util/helper/backup_cron_helper.class.php
  21. +1 −1  blocks/activity_modules/block_activity_modules.php
  22. +1 −1  blocks/community/forms.php
  23. +3 −3 blocks/completionstatus/details.php
  24. +10 −10 blocks/navigation/block_navigation.php
  25. +3 −3 blocks/rss_client/block_rss_client.php
  26. +3 −3 blog/lib.php
  27. +2 −2 course/dnduploadlib.php
  28. +5 −5 course/lib.php
  29. +1 −1  course/manage.php
  30. +1 −1  course/publish/forms.php
  31. +2 −2 course/renderer.php
  32. +2 −2 enrol/database/lib.php
  33. +4 −4 enrol/flatfile/lib.php
  34. +1 −1  enrol/flatfile/settings.php
  35. +1 −1  enrol/flatfile/tests/flatfile_test.php
  36. +1 −1  enrol/guest/locallib.php
  37. +2 −2 enrol/ldap/lib.php
  38. +2 −2 enrol/ldap/settingslib.php
  39. +1 −1  enrol/paypal/ipn.php
  40. +1 −1  enrol/self/locallib.php
  41. +1 −1  grade/edit/scale/edit_form.php
  42. +1 −1  grade/import/grade_import_form.php
  43. +1 −1  group/group_form.php
  44. +1 −1  group/grouping_form.php
  45. +5 −5 index.php
  46. +1 −1  iplookup/lib.php
  47. +29 −29 lib/adminlib.php
  48. +4 −4 lib/bennu/iCalendar_rfc2445.php
  49. +1 −1  lib/bennu/readme_moodle.txt
  50. +1 −1  lib/blocklib.php
  51. +24 −24 lib/classes/collator.php
  52. +9 −9 lib/coursecatlib.php
  53. +2 −2 lib/csvlib.class.php
  54. +4 −4 lib/datalib.php
  55. +5 −5 lib/deprecatedlib.php
  56. +1 −1  lib/editor/tinymce/adminlib.php
  57. +2 −2 lib/editor/tinymce/plugins/spellchecker/classes/GoogleSpell.php
  58. +1 −1  lib/excellib.class.php
  59. +2 −2 lib/filebrowser/file_info.php
  60. +1 −1  lib/filebrowser/file_info_context_course.php
  61. +3 −3 lib/filebrowser/file_info_stored.php
  62. +6 −6 lib/filestorage/file_archive.php
  63. +4 −4 lib/filestorage/file_storage.php
  64. +5 −5 lib/filestorage/zip_archive.php
  65. +5 −5 lib/filterlib.php
  66. +1 −1  lib/gradelib.php
  67. +2 −2 lib/graphlib.php
  68. +2 −2 lib/html2text.php
  69. +1 −1  lib/html2text_readme.txt
  70. +1 −1  lib/medialib.php
  71. +1 −1  lib/modinfolib.php
  72. +35 −36 lib/moodlelib.php
  73. +2 −2 lib/phpmailer/moodle_phpmailer.php
  74. +1 −1  lib/phpunit/classes/util.php
  75. +1 −1  lib/questionlib.php
  76. +1 −1  lib/simplepie/moodle_simplepie.php
  77. +2 −2 lib/tests/html2text_test.php
  78. +5 −5 lib/tests/moodlelib_test.php
  79. +7 −7 lib/tokeniserlib.php
  80. +3 −3 lib/upgradelib.php
  81. +12 −12 lib/weblib.php
  82. +1 −1  login/forgot_password.php
  83. +1 −1  login/index.php
  84. +1 −1  login/signup_form.php
  85. +1 −1  login/token.php
  86. +4 −4 message/lib.php
  87. +1 −2  mod/assign/adminlib.php
  88. +1 −1  mod/book/db/upgradelib.php
  89. +5 −5 mod/book/tool/importhtml/locallib.php
  90. +1 −1  mod/data/import_form.php
  91. +1 −1  mod/data/view.php
  92. +1 −1  mod/feedback/import.php
  93. +1 −1  mod/forum/mod_form.php
  94. +2 −2 mod/glossary/edit_form.php
  95. +1 −1  mod/glossary/editcategories.php
  96. +1 −1  mod/glossary/exportentry.php
  97. +1 −1  mod/glossary/import.php
  98. +3 −3 mod/glossary/lib.php
  99. +4 −4 mod/glossary/print.php
  100. +9 −9 mod/glossary/sql.php
  101. +4 −4 mod/glossary/view.php
  102. +2 −2 mod/label/lib.php
  103. +3 −3 mod/lesson/format.php
  104. +3 −3 mod/lti/locallib.php
  105. +2 −2 mod/quiz/settings.php
  106. +2 −2 mod/survey/download.php
  107. +1 −1  mod/upgrade.txt
  108. +2 −2 mod/wiki/locallib.php
  109. +2 −2 mod/wiki/pagelib.php
  110. +1 −1  question/engine/bank.php
  111. +2 −2 question/engine/datalib.php
  112. +2 −2 question/engine/upgrade/upgradelib.php
  113. +4 −4 question/format.php
  114. +4 −4 question/format/learnwise/format.php
  115. +2 −2 question/type/multianswer/renderer.php
  116. +1 −1  report/completion/index.php
  117. +4 −4 report/log/locallib.php
  118. +2 −2 report/progress/index.php
  119. +2 −2 repository/filesystem/lib.php
  120. +2 −2 repository/googledocs/lib.php
  121. +2 −2 repository/lib.php
  122. +1 −1  repository/local/lib.php
  123. +1 −1  tag/coursetagslib.php
  124. +9 −9 tag/lib.php
  125. +2 −2 tag/locallib.php
  126. +1 −1  user/editadvanced_form.php
  127. +2 −2 user/lib.php
View
2  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];
View
2  admin/localplugins.php
@@ -55,7 +55,7 @@
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
foreach ($plugins as $plugin => $name) {
$uninstall = '';
View
2  admin/mnet/access_control.php
@@ -103,7 +103,7 @@
$usernames = explode(',', $form->username);
foreach ($usernames as $username) {
- $username = trim(textlib::strtolower($username));
+ $username = trim(core_text::strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
View
6 admin/registration/forms.php
@@ -137,8 +137,8 @@ public function definition() {
$options = array();
foreach ($hubs as $hub) {
//to not display a name longer than 100 character (too big)
- if (textlib::strlen($hub['name']) > 100) {
- $hubname = textlib::substr($hub['name'], 0, 100);
+ if (core_text::strlen($hub['name']) > 100) {
+ $hubname = core_text::substr($hub['name'], 0, 100);
$hubname = $hubname . "...";
} else {
$hubname = $hub['name'];
@@ -287,7 +287,7 @@ public function definition() {
$mform->addHelpButton('description', 'sitedesc', 'hub');
$languages = get_string_manager()->get_list_of_languages();
- collatorlib::asort($languages);
+ core_collator::asort($languages);
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
$languages);
$mform->setType('language', PARAM_ALPHANUMEXT);
View
2  admin/reports.php
@@ -57,7 +57,7 @@
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('report|_%');
View
4 admin/roles/classes/define_role_table_advanced.php
@@ -99,8 +99,8 @@ public function read_submitted_permissions() {
$shortname = optional_param('shortname', null, PARAM_RAW);
if (!is_null($shortname)) {
$this->role->shortname = $shortname;
- $this->role->shortname = textlib::specialtoascii($this->role->shortname);
- $this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
+ $this->role->shortname = core_text::specialtoascii($this->role->shortname);
+ $this->role->shortname = core_text::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
if (empty($this->role->shortname)) {
$this->errors['shortname'] = get_string('errorbadroleshortname', 'core_role');
}
View
8 admin/tool/uploadcourse/classes/helper.php
@@ -117,18 +117,18 @@ public static function generate_shortname_callback($fullname, $idnumber, $block)
switch ($block[1]) {
case '+':
- $repl = textlib::strtoupper($repl);
+ $repl = core_text::strtoupper($repl);
break;
case '-':
- $repl = textlib::strtolower($repl);
+ $repl = core_text::strtolower($repl);
break;
case '~':
- $repl = textlib::strtotitle($repl);
+ $repl = core_text::strtotitle($repl);
break;
}
if (!empty($block[2])) {
- $repl = textlib::substr($repl, 0, $block[2]);
+ $repl = core_text::substr($repl, 0, $block[2]);
}
return $repl;
View
2  admin/tool/uploadcourse/classes/step1_form.php
@@ -57,7 +57,7 @@ public function definition () {
$mform->setDefault('delimiter_name', 'comma');
}
- $choices = textlib::get_encodings();
+ $choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploadcourse'), $choices);
$mform->setDefault('encoding', 'UTF-8');
View
2  admin/tool/uploadcourse/cli/uploadcourse.php
@@ -145,7 +145,7 @@
}
// Encoding.
-$encodings = textlib::get_encodings();
+$encodings = core_text::get_encodings();
if (!isset($encodings[$options['encoding']])) {
echo get_string('invalidencoding', 'tool_uploadcourse')."\n";
echo $help;
View
10 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;
View
2  admin/tool/uploaduser/user_form.php
@@ -53,7 +53,7 @@ function definition () {
$mform->setDefault('delimiter_name', 'comma');
}
- $choices = textlib::get_encodings();
+ $choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
View
4 admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
@@ -75,8 +75,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
// Get current semantic from dictionary, we only will process B (BYTE) ones
// suplying the SQL code to change them to C (CHAR) semantic
$params = array(
- 'table_name' => textlib::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
- 'column_name' => textlib::strtoupper($xmldb_field->getName()),
+ 'table_name' => core_text::strtoupper($DB->get_prefix() . $xmldb_table->getName()),
+ 'column_name' => core_text::strtoupper($xmldb_field->getName()),
'data_type' => 'VARCHAR2');
$currentsemantic = $DB->get_field_sql('
SELECT char_used
View
2  admin/tools.php
@@ -57,7 +57,7 @@
}
$plugins[$plugin] = $strpluginname;
}
-collatorlib::asort($plugins);
+core_collator::asort($plugins);
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('tool|_%');
View
10 auth/cas/auth.php
@@ -61,7 +61,7 @@ function prevent_local_passwords() {
*/
function user_login ($username, $password) {
$this->connectCAS();
- return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username);
+ return phpCAS::isAuthenticated() && (trim(core_text::strtolower(phpCAS::getUser())) == $username);
}
/**
@@ -381,15 +381,15 @@ function process_config($config) {
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('pagesize', (int)trim($config->pagesize), $this->pluginconfig);
set_config('contexts', trim($config->contexts), $this->pluginconfig);
- set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
- set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
+ set_config('user_type', core_text::strtolower(trim($config->user_type)), $this->pluginconfig);
+ set_config('user_attribute', core_text::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig);
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
- set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
+ set_config('memberattribute', core_text::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
set_config('attrcreators', trim($config->attrcreators), $this->pluginconfig);
set_config('groupecreators', trim($config->groupecreators), $this->pluginconfig);
@@ -409,7 +409,7 @@ function iscreator($username) {
return false;
}
- $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->ldapencoding);
// Test for group creator
if (!empty($this->config->groupecreators)) {
View
16 auth/db/auth.php
@@ -58,8 +58,8 @@ function __construct() {
function user_login($username, $password) {
global $CFG, $DB;
- $extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
- $extpassword = textlib::convert($password, 'utf-8', $this->config->extencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
+ $extpassword = core_text::convert($password, 'utf-8', $this->config->extencoding);
if ($this->is_internal()) {
// Lookup username externally, but resolve
@@ -176,7 +176,7 @@ function db_attributes() {
function get_userinfo($username) {
global $CFG;
- $extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
@@ -199,7 +199,7 @@ function get_userinfo($username) {
$fields_obj = $rs->FetchObj();
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
foreach ($selectfields as $localname=>$externalname) {
- $result[$localname] = textlib::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
+ $result[$localname] = core_text::convert($fields_obj->{$localname}, $this->config->extencoding, 'utf-8');
}
}
$rs->Close();
@@ -426,7 +426,7 @@ function user_exists($username) {
// Init result value.
$result = false;
- $extusername = textlib::convert($username, 'utf-8', $this->config->extencoding);
+ $extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
@@ -501,7 +501,7 @@ function update_user_record($username, $updatekeys=false) {
global $CFG, $DB;
//just in case check text case
- $username = trim(textlib::strtolower($username));
+ $username = trim(core_text::strtolower($username));
// get the current user record
$user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id));
@@ -569,7 +569,7 @@ function user_update($olduser, $newuser) {
return false;
}
- $extusername = textlib::convert($olduser->username, 'utf-8', $this->config->extencoding);
+ $extusername = core_text::convert($olduser->username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
@@ -586,7 +586,7 @@ function user_update($olduser, $newuser) {
}
$nuvalue = $newuser->$key;
if ($nuvalue != $value) {
- $update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(textlib::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
+ $update[] = $this->config->{"field_map_$key"}."='".$this->ext_addslashes(core_text::convert($nuvalue, 'utf-8', $this->config->extencoding))."'";
}
}
if (!empty($update)) {
View
64 auth/ldap/auth.php
@@ -168,8 +168,8 @@ function user_login($username, $password) {
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 @@ function user_login($username, $password) {
* @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 @@ function get_userinfo($username) {
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 @@ function get_userlist() {
* @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 @@ function user_exists($username) {
* @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 @@ function user_create($userobject, $plainpass) {
}
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 @@ function user_confirm($username, $confirmsecret) {
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 @@ function sync_users($do_updates=true) {
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 @@ function sync_users($do_updates=true) {
$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 @@ function update_user_record($username, $updatekeys = false) {
global $CFG, $DB;
// Just in case check text case
- $username = trim(textlib::strtolower($username));
+ $username = trim(core_text::strtolower($username));
// Get the current user record
$user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id));
@@ -1040,7 +1040,7 @@ function update_user_record($username, $updatekeys = false) {
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 @@ function ldap_bulk_insert($username) {
* @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 @@ function iscreator($username) {
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 @@ function user_update($olduser, $newuser) {
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 @@ function user_update($olduser, $newuser) {
$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 @@ function user_update_password($user, $newpassword) {
$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 @@ function ldap_attributes () {
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 @@ function ldap_get_userlist($filter='*') {
$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 @@ function ntlmsso_magic($sesskey) {
// (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 @@ function ntlmsso_magic($sesskey) {
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 @@ function process_config($config) {
// 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 @@ function process_config($config) {
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 @@ function process_config($config) {
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);
View
2  backup/converter/moodle1/handlerlib.php
@@ -1222,7 +1222,7 @@ public function process_question(array $data, array $raw) {
// 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'] .= ' <img src="' . $data['image'] . '" />';
View
2  backup/converter/moodle1/lib.php
@@ -1233,7 +1233,7 @@ public function migrate_file($sourcepath, $filepath = '/', $filename = null, $so
}
$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');
}
View
6 backup/util/dbops/backup_plan_dbops.class.php
@@ -204,7 +204,7 @@ public static function get_default_backup_filename($format, $type, $id, $users,
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 @@ public static function get_default_backup_filename($format, $type, $id, $users,
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 @@ public static function get_default_backup_filename($format, $type, $id, $users,
// 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 = '';
View
2  backup/util/helper/backup_cron_helper.class.php
@@ -554,7 +554,7 @@ public static function remove_excess_backups($course) {
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)) {
View
2  blocks/activity_modules/block_activity_modules.php
@@ -49,7 +49,7 @@ function get_content() {
}
}
- collatorlib::asort($modfullnames);
+ core_collator::asort($modfullnames);
foreach ($modfullnames as $modname => $modfullname) {
if ($modname === 'resources') {
View
2  blocks/community/forms.php
@@ -272,7 +272,7 @@ public function definition() {
$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);
View
6 blocks/completionstatus/details.php
@@ -210,12 +210,12 @@
$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;
}
}
View
20 blocks/navigation/block_navigation.php
@@ -255,31 +255,31 @@ public function html_attributes() {
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 @@ public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recur
* @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 @@ protected function trim_left($string, $length) {
* @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 @@ protected function trim_right($string, $length) {
*/
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;
}
View
6 blocks/rss_client/block_rss_client.php
@@ -223,7 +223,7 @@ function get_item_html($item){
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 get_item_html($item){
*/
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).'...');
}
}
View
6 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.
View
4 course/dnduploadlib.php
@@ -588,9 +588,9 @@ protected function handle_other_upload($content) {
* @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);
}
View
10 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).'...';
}
}
View
2  course/manage.php
@@ -194,7 +194,7 @@
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));
View
2  course/publish/forms.php
@@ -248,7 +248,7 @@ public function definition() {
$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');
View
4 course/renderer.php
@@ -708,8 +708,8 @@ public function course_section_cm_name(cm_info $mod, $displayoptions = array())
// 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).
View
4 enrol/database/lib.php
@@ -855,7 +855,7 @@ protected function db_encode($text) {
}
return $text;
} else {
- return textlib::convert($text, 'utf-8', $dbenc);
+ return core_text::convert($text, 'utf-8', $dbenc);
}
}
@@ -870,7 +870,7 @@ protected function db_decode($text) {
}
return $text;
} else {
- return textlib::convert($text, $dbenc, 'utf-8');
+ return core_text::convert($text, $dbenc, 'utf-8');
}
}
View
8 enrol/flatfile/lib.php
@@ -252,7 +252,7 @@ protected function process_file(progress_trace $trace) {
$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 @@ protected function process_file(progress_trace $trace) {
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 @@ protected function get_role_map(progress_trace $trace) {
$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;
View
2  enrol/flatfile/settings.php
@@ -34,7 +34,7 @@
$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));
View
2  enrol/flatfile/tests/flatfile_test.php
@@ -167,7 +167,7 @@ public function test_sync() {
// 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');
View
2  enrol/guest/locallib.php
@@ -61,7 +61,7 @@ public function validation($data, $files) {
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');
View
4 enrol/ldap/lib.php
@@ -327,7 +327,7 @@ public function sync_enrolments(progress_trace $trace, $onecourse = null) {
$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 @@ protected function find_ext_enrolments($memberuid, $role) {
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))) {
View
4 enrol/ldap/settingslib.php
@@ -63,7 +63,7 @@ public function write_setting($data) {
return $validated;
}
if ($this->lowercase) {
- $data = textlib::strtolower($data);
+ $data = core_text::strtolower($data);
}
if (!$this->enabled) {
return '';
@@ -134,7 +134,7 @@ public function write_setting($data) {
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');
}
}
View
2  enrol/paypal/ipn.php
@@ -171,7 +171,7 @@
}
- 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;
View
2  enrol/self/locallib.php
@@ -101,7 +101,7 @@ public function validation($data, $files) {
} 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');
View
2  grade/edit/scale/edit_form.php
@@ -141,7 +141,7 @@ function validation($data, $files) {
$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) {
View
2  grade/import/grade_import_form.php
@@ -41,7 +41,7 @@ function definition (){
// 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'])) {
View
2  group/group_form.php
@@ -101,7 +101,7 @@ function validation($data, $files) {
$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);
}
View
2  group/grouping_form.php
@@ -93,7 +93,7 @@ function validation($data, $files) {
$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);
}
View
10 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'));
View
2  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'];
}
View
58 lib/adminlib.php
@@ -1235,7 +1235,7 @@ public function search($query) {
$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 @@ public function search($query) {
$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 @@ public function is_related($query) {
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 @@ public function is_related($query) {
$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 @@ public function is_related($query) {
}
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 @@ public function is_related($query) {
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 @@ public function is_related($query) {
}
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 @@ public function search($query) {
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 @@ public function is_related($query) {
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 @@ public function search($query) {
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 @@ public function search($query) {
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 @@ public function search($query) {
$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 @@ public function search($query) {
$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 @@ public function search($query) {
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 @@ public function search($query) {
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 @@ public function is_related($query) {
}
$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 @@ public function is_related($query) {
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 @@ public function is_related($query) {
$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 @@ public function search($query) {
$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 @@ public function is_related($query) {
}
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 @@ public function is_related($query) {
$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 @@ public function is_related($query) {
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;
}
}
View
8 lib/bennu/iCalendar_rfc2445.php
@@ -56,7 +56,7 @@
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
View
2  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)
View
2  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');
View
48 lib/classes/collator.php
@@ -141,7 +141,7 @@ protected static function restore_array(array &$arr, array &$original) {
* @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 @@ public static function callback_naturalise($matches) {
* 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 @@ public static function asort(array &$arr, $sortflag = collatorlib::SORT_STRING)
$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 @@ public static function asort(array &$arr, $sortflag = collatorlib::SORT_STRING)
// try some fallback that works at least for English
- if ($sortflag == collatorlib::SORT_NUMERIC) {
+ if ($sortflag == core_collator::SORT_NUMERIC) {