MDL-31301 remove all uses of moodle_strtolower() and deprecated it
This commit is contained in:
@@ -103,7 +103,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
|
||||
$usernames = explode(',', $form->username);
|
||||
|
||||
foreach ($usernames as $username) {
|
||||
$username = trim(moodle_strtolower($username));
|
||||
$username = trim(textlib::strtolower($username));
|
||||
if (!empty($username)) {
|
||||
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
|
||||
if ($form->accessctrl == 'allow') {
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ class define_role_table_advanced extends capability_table_with_risks {
|
||||
if (!is_null($shortname)) {
|
||||
$this->role->shortname = $shortname;
|
||||
$this->role->shortname = textlib::specialtoascii($this->role->shortname);
|
||||
$this->role->shortname = moodle_strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
|
||||
$this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
|
||||
if (empty($this->role->shortname)) {
|
||||
$this->errors['shortname'] = get_string('errorbadroleshortname', 'role');
|
||||
}
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
*/
|
||||
function user_login ($username, $password) {
|
||||
$this->connectCAS();
|
||||
return phpCAS::isAuthenticated() && (trim(moodle_strtolower(phpCAS::getUser())) == $username);
|
||||
return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,15 +336,15 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
set_config('host_url', trim($config->host_url), $this->pluginconfig);
|
||||
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
|
||||
set_config('contexts', trim($config->contexts), $this->pluginconfig);
|
||||
set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig);
|
||||
set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $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('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', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig);
|
||||
set_config('memberattribute', textlib::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);
|
||||
|
||||
+11
-11
@@ -839,7 +839,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(moodle_strtolower($user->username));
|
||||
$user->username = trim(textlib::strtolower($user->username));
|
||||
if (empty($user->lang)) {
|
||||
$user->lang = $CFG->lang;
|
||||
}
|
||||
@@ -883,7 +883,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Just in case check text case
|
||||
$username = trim(moodle_strtolower($username));
|
||||
$username = trim(textlib::strtolower($username));
|
||||
|
||||
// Get the current user record
|
||||
$user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id));
|
||||
@@ -928,7 +928,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
function ldap_bulk_insert($username) {
|
||||
global $DB, $CFG;
|
||||
|
||||
$username = moodle_strtolower($username); // usernames are __always__ lowercase.
|
||||
$username = textlib::strtolower($username); // usernames are __always__ lowercase.
|
||||
$DB->insert_record_raw('tmp_extuser', array('username'=>$username,
|
||||
'mnethostid'=>$CFG->mnet_localhost_id), false, true);
|
||||
echo '.';
|
||||
@@ -1370,13 +1370,13 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$moodleattributes = array();
|
||||
foreach ($this->userfields as $field) {
|
||||
if (!empty($this->config->{"field_map_$field"})) {
|
||||
$moodleattributes[$field] = moodle_strtolower(trim($this->config->{"field_map_$field"}));
|
||||
$moodleattributes[$field] = textlib::strtolower(trim($this->config->{"field_map_$field"}));
|
||||
if (preg_match('/,/', $moodleattributes[$field])) {
|
||||
$moodleattributes[$field] = explode(',', $moodleattributes[$field]); // split ?
|
||||
}
|
||||
}
|
||||
}
|
||||
$moodleattributes['username'] = moodle_strtolower(trim($this->config->user_attribute));
|
||||
$moodleattributes['username'] = textlib::strtolower(trim($this->config->user_attribute));
|
||||
return $moodleattributes;
|
||||
}
|
||||
|
||||
@@ -1580,7 +1580,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return false; // Should never happen!
|
||||
}
|
||||
|
||||
$username = moodle_strtolower($username); // Compatibility hack
|
||||
$username = textlib::strtolower($username); // Compatibility hack
|
||||
set_cache_flag($this->pluginconfig.'/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT);
|
||||
return true;
|
||||
}
|
||||
@@ -1782,8 +1782,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
set_config('host_url', trim($config->host_url), $this->pluginconfig);
|
||||
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
|
||||
set_config('contexts', trim($config->contexts), $this->pluginconfig);
|
||||
set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig);
|
||||
set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $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('search_sub', $config->search_sub, $this->pluginconfig);
|
||||
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
|
||||
set_config('preventpassindb', $config->preventpassindb, $this->pluginconfig);
|
||||
@@ -1791,15 +1791,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', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig);
|
||||
set_config('memberattribute', textlib::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', moodle_strtolower(trim($config->expireattr)), $this->pluginconfig);
|
||||
set_config('expireattr', textlib::strtolower(trim($config->expireattr)), $this->pluginconfig);
|
||||
set_config('gracelogins', $config->gracelogins, $this->pluginconfig);
|
||||
set_config('graceattr', moodle_strtolower(trim($config->graceattr)), $this->pluginconfig);
|
||||
set_config('graceattr', textlib::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);
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
//Process contacts
|
||||
if ($contactcount) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>'.moodle_strtolower(get_string('contacts','message')).'</li>';
|
||||
echo '<li>'.textlib::strtolower(get_string('contacts','message')).'</li>';
|
||||
}
|
||||
$counter = 0;
|
||||
while ($counter < $contactcount) {
|
||||
|
||||
@@ -204,7 +204,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
global $DB;
|
||||
|
||||
// Calculate backup word
|
||||
$backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
|
||||
$backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
|
||||
$backupword = trim(clean_filename($backupword), '_');
|
||||
|
||||
$shortname = '';
|
||||
@@ -228,7 +228,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
break;
|
||||
}
|
||||
$shortname = str_replace(' ', '_', $shortname);
|
||||
$shortname = moodle_strtolower(trim(clean_filename($shortname), '_'));
|
||||
$shortname = textlib::strtolower(trim(clean_filename($shortname), '_'));
|
||||
}
|
||||
|
||||
$name = empty($shortname) ? $id : $shortname;
|
||||
@@ -236,7 +236,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 = moodle_strtolower(trim(clean_filename($date), '_'));
|
||||
$date = textlib::strtolower(trim(clean_filename($date), '_'));
|
||||
|
||||
// Calculate info
|
||||
$info = '';
|
||||
|
||||
@@ -460,7 +460,7 @@ abstract class backup_cron_automated_helper {
|
||||
$storage = $config->backup_auto_storage;
|
||||
$dir = $config->backup_auto_destination;
|
||||
|
||||
$backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
|
||||
$backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
|
||||
$backupword = trim(clean_filename($backupword), '_');
|
||||
|
||||
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
|
||||
|
||||
@@ -63,7 +63,7 @@ class admin_setting_configtext_trim_lower extends admin_setting_configtext {
|
||||
return $validated;
|
||||
}
|
||||
if ($this->lowercase) {
|
||||
$data = moodle_strtolower($data);
|
||||
$data = textlib::strtolower($data);
|
||||
}
|
||||
return ($this->config_write($this->name, trim($data)) ? '' : get_string('errorsetting', 'admin'));
|
||||
}
|
||||
@@ -118,7 +118,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, moodle_strtolower(trim($data['memberattribute'])))) {
|
||||
if (!$this->config_write('memberattribute_role'.$roleid, textlib::strtolower(trim($data['memberattribute'])))) {
|
||||
$return = get_string('errorsetting', 'admin');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
$newsforumcontext = get_context_instance(CONTEXT_MODULE, $newsforumcm->id, MUST_EXIST);
|
||||
|
||||
$forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
|
||||
|
||||
if (isloggedin()) {
|
||||
$SESSION->fromdiscussion = $CFG->wwwroot;
|
||||
@@ -194,13 +194,13 @@
|
||||
|
||||
case FRONTPAGECOURSELIST:
|
||||
if (isloggedin() and !$hassiteconfig and !isguestuser() and empty($CFG->disablemycourses)) {
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
|
||||
echo $OUTPUT->heading(get_string('mycourses'), 2, 'headingblock header');
|
||||
print_my_moodle();
|
||||
echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipmycourses'));
|
||||
} else if ((!$hassiteconfig and !isguestuser()) or ($DB->count_records('course') <= FRONTPAGECOURSELIMIT)) {
|
||||
// admin should not see list of courses when there are too many of them
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block'));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block'));
|
||||
echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header');
|
||||
print_courses(0);
|
||||
echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipavailablecourses'));
|
||||
@@ -208,7 +208,7 @@
|
||||
break;
|
||||
|
||||
case FRONTPAGECATEGORYNAMES:
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));
|
||||
echo $OUTPUT->heading(get_string('categories'), 2, 'headingblock header');
|
||||
echo $OUTPUT->box_start('generalbox categorybox');
|
||||
print_whole_category_list(NULL, NULL, NULL, -1, false);
|
||||
@@ -218,7 +218,7 @@
|
||||
break;
|
||||
|
||||
case FRONTPAGECATEGORYCOMBO:
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
|
||||
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
|
||||
echo $OUTPUT->heading(get_string('courses'), 2, 'headingblock header');
|
||||
$renderer = $PAGE->get_renderer('core','course');
|
||||
// if there are too many courses, budiling course category tree could be slow,
|
||||
|
||||
@@ -4000,3 +4000,24 @@ function show_event($event) {
|
||||
$event = new calendar_event($event);
|
||||
return $event->toggle_visibility(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to lowercase using most compatible function available.
|
||||
*
|
||||
* @deprecated Use textlib::strtolower($text) instead.
|
||||
*
|
||||
* @param string $string The string to convert to all lowercase characters.
|
||||
* @param string $encoding The encoding on the string.
|
||||
* @return string
|
||||
*/
|
||||
function moodle_strtolower($string, $encoding='') {
|
||||
|
||||
debugging('moodle_strtolower() is deprecated. Please use textlib::strtolower() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
//If not specified use utf8
|
||||
if (empty($encoding)) {
|
||||
$encoding = 'UTF-8';
|
||||
}
|
||||
//Use text services
|
||||
return textlib::strtolower($string, $encoding);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1347,13 +1347,13 @@ function filter_remove_duplicates($linkarray) {
|
||||
if ($filterobject->casesensitive) {
|
||||
$exists = in_array($filterobject->phrase, $concepts);
|
||||
} else {
|
||||
$exists = in_array(moodle_strtolower($filterobject->phrase), $lconcepts);
|
||||
$exists = in_array(textlib::strtolower($filterobject->phrase), $lconcepts);
|
||||
}
|
||||
|
||||
if (!$exists) {
|
||||
$cleanlinks[] = $filterobject;
|
||||
$concepts[] = $filterobject->phrase;
|
||||
$lconcepts[] = moodle_strtolower($filterobject->phrase);
|
||||
$lconcepts[] = textlib::strtolower($filterobject->phrase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1331,7 +1331,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
|
||||
} else { //if setShowAdvanced is called without any preference
|
||||
//make the default to not show advanced elements.
|
||||
$showadvancedNow = get_user_preferences(
|
||||
moodle_strtolower($this->_formName.'_showadvanced', 0));
|
||||
textlib::strtolower($this->_formName.'_showadvanced', 0));
|
||||
}
|
||||
}
|
||||
//value of hidden element
|
||||
|
||||
+3
-24
@@ -1073,7 +1073,7 @@ function clean_param($param, $type) {
|
||||
case PARAM_USERNAME:
|
||||
$param = fix_utf8($param);
|
||||
$param = str_replace(" " , "", $param);
|
||||
$param = moodle_strtolower($param); // Convert uppercase to lowercase MDL-16919
|
||||
$param = textlib::strtolower($param); // Convert uppercase to lowercase MDL-16919
|
||||
if (empty($CFG->extendedusernamechars)) {
|
||||
// regular expression, eliminate all chars EXCEPT:
|
||||
// alphanum, dash (-), underscore (_), at sign (@) and period (.) characters.
|
||||
@@ -3652,7 +3652,7 @@ function create_user_record($username, $password, $auth = 'manual') {
|
||||
global $CFG, $DB;
|
||||
|
||||
//just in case check text case
|
||||
$username = trim(moodle_strtolower($username));
|
||||
$username = trim(textlib::strtolower($username));
|
||||
|
||||
$authplugin = get_auth_plugin($auth);
|
||||
|
||||
@@ -3714,7 +3714,7 @@ function create_user_record($username, $password, $auth = 'manual') {
|
||||
function update_user_record($username) {
|
||||
global $DB, $CFG;
|
||||
|
||||
$username = trim(moodle_strtolower($username)); /// just in case check text case
|
||||
$username = trim(textlib::strtolower($username)); /// just in case check text case
|
||||
|
||||
$oldinfo = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
|
||||
$newuser = array();
|
||||
@@ -8731,27 +8731,6 @@ function moodle_setlocale($locale='') {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to lowercase using most compatible function available.
|
||||
*
|
||||
* @deprecated since Moodle 2.0 use textlib::strtolower()
|
||||
* @todo MDL-31250 Remove this function when no longer in use
|
||||
* @see textlib::strtolower($text)
|
||||
*
|
||||
* @param string $string The string to convert to all lowercase characters.
|
||||
* @param string $encoding The encoding on the string.
|
||||
* @return string
|
||||
*/
|
||||
function moodle_strtolower ($string, $encoding='') {
|
||||
|
||||
//If not specified use utf8
|
||||
if (empty($encoding)) {
|
||||
$encoding = 'UTF-8';
|
||||
}
|
||||
//Use text services
|
||||
return textlib::strtolower($string, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count words in a string.
|
||||
*
|
||||
|
||||
+1
-1
@@ -1699,7 +1699,7 @@ function highlightfast($needle, $haystack) {
|
||||
return $haystack;
|
||||
}
|
||||
|
||||
$parts = explode(moodle_strtolower($needle), moodle_strtolower($haystack));
|
||||
$parts = explode(textlib::strtolower($needle), textlib::strtolower($haystack));
|
||||
|
||||
if (count($parts) === 1) {
|
||||
return $haystack;
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ if ($user !== false or $frm !== false or $errormsg !== '') {
|
||||
|
||||
if ($frm and isset($frm->username)) { // Login WITH cookies
|
||||
|
||||
$frm->username = trim(moodle_strtolower($frm->username));
|
||||
$frm->username = trim(textlib::strtolower($frm->username));
|
||||
|
||||
if (is_enabled_auth('none') ) {
|
||||
if ($frm->username !== clean_param($frm->username, PARAM_USERNAME)) {
|
||||
|
||||
@@ -129,7 +129,7 @@ class login_signup_form extends moodleform {
|
||||
$errors['username'] = get_string('usernameexists');
|
||||
} else {
|
||||
//check allowed characters
|
||||
if ($data['username'] !== moodle_strtolower($data['username'])) {
|
||||
if ($data['username'] !== textlib::strtolower($data['username'])) {
|
||||
$errors['username'] = get_string('usernamelowercase');
|
||||
} else {
|
||||
if ($data['username'] !== clean_param($data['username'], PARAM_USERNAME)) {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ echo $OUTPUT->header();
|
||||
if (!$CFG->enablewebservices) {
|
||||
throw new moodle_exception('enablewsdescription', 'webservice');
|
||||
}
|
||||
$username = trim(moodle_strtolower($username));
|
||||
$username = trim(textlib::strtolower($username));
|
||||
if (is_restored_user($username)) {
|
||||
throw new moodle_exception('restoredaccountresetpassword', 'webservice');
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class mod_glossary_entry_form extends moodleform {
|
||||
if ($DB->record_exists_select('glossary_entries',
|
||||
'glossaryid = :glossaryid AND LOWER(concept) = :concept AND id != :id', array(
|
||||
'glossaryid' => $glossary->id,
|
||||
'concept' => moodle_strtolower($data['concept']),
|
||||
'concept' => textlib::strtolower($data['concept']),
|
||||
'id' => $id))) {
|
||||
$errors['concept'] = get_string('errconceptalreadyexists', 'glossary');
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class mod_glossary_entry_form extends moodleform {
|
||||
if ($DB->record_exists_select('glossary_entries',
|
||||
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
|
||||
'glossaryid' => $glossary->id,
|
||||
'concept' => moodle_strtolower($data['concept'])))) {
|
||||
'concept' => textlib::strtolower($data['concept'])))) {
|
||||
$errors['concept'] = get_string('errconceptalreadyexists', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ $strglossary = get_string("modulename", "glossary");
|
||||
$PAGE->navbar->add($strglossaries, new moodle_url('/mod/glossary/index.php', array('id'=>$course->id)));
|
||||
$PAGE->navbar->add(get_string("categories","glossary"));
|
||||
if (!empty($action)) {
|
||||
$navaction = get_string($action). " " . moodle_strtolower(get_string("category","glossary"));
|
||||
$navaction = get_string($action). " " . textlib::strtolower(get_string("category","glossary"));
|
||||
$PAGE->navbar->add($navaction);
|
||||
}
|
||||
$PAGE->set_title(format_string($glossary->name));
|
||||
|
||||
@@ -72,7 +72,7 @@ if (!$mainglossary->allowduplicatedentries) {
|
||||
if ($DB->record_exists_select('glossary_entries',
|
||||
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
|
||||
'glossaryid' => $mainglossary->id,
|
||||
'concept' => moodle_strtolower($entry->concept)))) {
|
||||
'concept' => textlib::strtolower($entry->concept)))) {
|
||||
$PAGE->set_title(format_string($glossary->name));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
@@ -213,7 +213,7 @@ if ($xml = glossary_read_imported_file($result)) {
|
||||
$dupentry = $DB->record_exists_select('glossary_entries',
|
||||
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
|
||||
'glossaryid' => $glossary->id,
|
||||
'concept' => moodle_strtolower($newentry->concept)));
|
||||
'concept' => textlib::strtolower($newentry->concept)));
|
||||
}
|
||||
if ($dupentry) {
|
||||
$permissiongranted = 0;
|
||||
|
||||
@@ -871,7 +871,7 @@ function glossary_get_entries_search($concept, $courseid) {
|
||||
$bypassteacher = 0; //This means YES
|
||||
}
|
||||
|
||||
$conceptlower = moodle_strtolower(trim($concept));
|
||||
$conceptlower = textlib::strtolower(trim($concept));
|
||||
|
||||
$params = array('courseid1'=>$courseid, 'courseid2'=>$courseid, 'conceptlower'=>$conceptlower, 'concept'=>$concept);
|
||||
|
||||
@@ -1947,9 +1947,9 @@ function glossary_print_sorting_links($cm, $mode, $sortkey = '',$sortorder = '')
|
||||
*/
|
||||
function glossary_sort_entries ( $entry0, $entry1 ) {
|
||||
|
||||
if ( moodle_strtolower(ltrim($entry0->concept)) < moodle_strtolower(ltrim($entry1->concept)) ) {
|
||||
if ( textlib::strtolower(ltrim($entry0->concept)) < textlib::strtolower(ltrim($entry1->concept)) ) {
|
||||
return -1;
|
||||
} elseif ( moodle_strtolower(ltrim($entry0->concept)) > moodle_strtolower(ltrim($entry1->concept)) ) {
|
||||
} elseif ( textlib::strtolower(ltrim($entry0->concept)) > textlib::strtolower(ltrim($entry1->concept)) ) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -367,7 +367,7 @@ function coursetag_store_keywords($tags, $courseid, $userid=0, $tagtype='officia
|
||||
//add tag if does not exist
|
||||
if (!$tagid = tag_get_id($tag)) {
|
||||
$tag_id_array = tag_add(array($tag), $tagtype);
|
||||
$tagid = $tag_id_array[moodle_strtolower($tag)];
|
||||
$tagid = $tag_id_array[textlib::strtolower($tag)];
|
||||
}
|
||||
//ordering
|
||||
$ordering = 0;
|
||||
|
||||
+8
-8
@@ -286,7 +286,7 @@ function tag_get($field, $value, $returnfields='id, name, rawname') {
|
||||
global $DB;
|
||||
|
||||
if ($field == 'name') {
|
||||
$value = moodle_strtolower($value); // To cope with input that might just be wrong case
|
||||
$value = textlib::strtolower($value); // To cope with input that might just be wrong case
|
||||
}
|
||||
return $DB->get_record('tag', array($field=>$value), $returnfields);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ function tag_get_id($tags, $return_value=null) {
|
||||
|
||||
//TODO MDL-31152 test this and see if it helps performance without breaking anything
|
||||
//foreach($tags as $key => $tag) {
|
||||
// $clean_tag = moodle_strtolower($tag);
|
||||
// $clean_tag = textlib::strtolower($tag);
|
||||
// if ( array_key_exists($clean_tag), $tag_id_cache) ) {
|
||||
// $result[$clean_tag] = $tag_id_cache[$clean_tag];
|
||||
// $tags[$key] = ''; // prevent further processing for this one.
|
||||
@@ -455,8 +455,8 @@ function tag_get_id($tags, $return_value=null) {
|
||||
|
||||
$tags = array_values(tag_normalize($tags));
|
||||
foreach($tags as $key => $tag) {
|
||||
$tags[$key] = moodle_strtolower($tag);
|
||||
$result[moodle_strtolower($tag)] = null; // key must exists : no value for a key means the tag wasn't found.
|
||||
$tags[$key] = textlib::strtolower($tag);
|
||||
$result[textlib::strtolower($tag)] = null; // key must exists : no value for a key means the tag wasn't found.
|
||||
}
|
||||
|
||||
if (empty($tags)) {
|
||||
@@ -562,7 +562,7 @@ function tag_rename($tagid, $newrawname) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $newname_clean = moodle_strtolower($newrawname_clean)) {
|
||||
if (! $newname_clean = textlib::strtolower($newrawname_clean)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ function tag_add($tags, $type="default") {
|
||||
// note that the difference between rawname and name is only
|
||||
// capitalization : the rawname is NOT the same at the rawtag.
|
||||
$tag_object->rawname = $tag;
|
||||
$tag_name_lc = moodle_strtolower($tag);
|
||||
$tag_name_lc = textlib::strtolower($tag);
|
||||
$tag_object->name = $tag_name_lc;
|
||||
//var_dump($tag_object);
|
||||
$tags_ids[$tag_name_lc] = $DB->insert_record('tag', $tag_object);
|
||||
@@ -812,7 +812,7 @@ function tag_autocomplete($text) {
|
||||
global $DB;
|
||||
return $DB->get_records_sql("SELECT tg.id, tg.name, tg.rawname
|
||||
FROM {tag} tg
|
||||
WHERE tg.name LIKE ?", array(moodle_strtolower($text)."%"));
|
||||
WHERE tg.name LIKE ?", array(textlib::strtolower($text)."%"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1122,7 +1122,7 @@ function tag_normalize($rawtags, $case = TAG_CASE_LOWER) {
|
||||
continue;
|
||||
}
|
||||
if ( !array_key_exists($rawtag, $cleaned_tags_lc) ) {
|
||||
$cleaned_tags_lc[$rawtag] = moodle_strtolower( clean_param($rawtag, PARAM_TAG) );
|
||||
$cleaned_tags_lc[$rawtag] = textlib::strtolower( clean_param($rawtag, PARAM_TAG) );
|
||||
$cleaned_tags_mc[$rawtag] = clean_param($rawtag, PARAM_TAG);
|
||||
}
|
||||
if ( $case == TAG_CASE_LOWER ) {
|
||||
|
||||
@@ -169,7 +169,7 @@ class user_editadvanced_form extends moodleform {
|
||||
$err['username'] = get_string('usernameexists');
|
||||
}
|
||||
//check allowed characters
|
||||
if ($usernew->username !== moodle_strtolower($usernew->username)) {
|
||||
if ($usernew->username !== textlib::strtolower($usernew->username)) {
|
||||
$err['username'] = get_string('usernamelowercase');
|
||||
} else {
|
||||
if ($usernew->username !== clean_param($usernew->username, PARAM_USERNAME)) {
|
||||
|
||||
Reference in New Issue
Block a user