mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-11298 use textlib_get_instance() instead of new textlib()
This commit is contained in:
parent
4eb718d801
commit
8e1ec6be58
@ -333,7 +333,7 @@ if (($formdata = data_submitted()) && !empty($formdata->map)) {
|
||||
|
||||
$text = my_file_get_contents($filename);
|
||||
// trim utf-8 bom
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
/// normalize line endings and do the encoding conversion
|
||||
$text = $textlib->convert($text, $formdata->encoding);
|
||||
$text = $textlib->trim_utf8_bom($text);
|
||||
|
@ -13,7 +13,7 @@ class grade_import_form extends moodleform {
|
||||
$mform->addElement('file', 'userfile', get_string('file'));
|
||||
$mform->setType('userfile', PARAM_FILE);
|
||||
$mform->addRule('userfile', null, 'required');
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
$encodings = $textlib->get_encodings();
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
|
||||
|
||||
|
@ -49,7 +49,7 @@ if ( $formdata = $mform->get_data()) {
|
||||
$text = my_file_get_contents($filename);
|
||||
|
||||
// trim utf-8 bom
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
// converts to propert unicode
|
||||
$text = $textlib->convert($text, $formdata->encoding);
|
||||
$text = $textlib->trim_utf8_bom($text);
|
||||
|
@ -561,7 +561,7 @@ function clean_param($param, $type) {
|
||||
//cleanup the spaces
|
||||
$param = preg_replace('/ +/', ' ', $param);
|
||||
$param = trim($param);
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
return $textlib->substr($param, 0, TAG_MAX_LENGTH);
|
||||
|
||||
|
||||
@ -3081,7 +3081,7 @@ function check_password_policy($password, &$errmsg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
$errmsg = '';
|
||||
if ($textlib->strlen($password) < $CFG->minpasswordlength) {
|
||||
$errmsg = get_string('errorminpasswordlength', 'auth', $CFG->minpasswordlength);
|
||||
|
@ -70,7 +70,7 @@
|
||||
/// its capabilities so, don't forget to make the conversion
|
||||
/// from every wrapper function!
|
||||
|
||||
function textlib_get_instance () {
|
||||
function textlib_get_instance() {
|
||||
static $instance;
|
||||
if (!is_object($instance)) {
|
||||
$instance = new textlib();
|
||||
|
@ -191,7 +191,7 @@
|
||||
$paging = NULL;
|
||||
}
|
||||
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
if ($textlib->strlen($search) < 2) {
|
||||
$search = '';
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ function tag_display_name($tag_object){
|
||||
|
||||
if( empty($CFG->keeptagnamecase) ) {
|
||||
//this is the normalized tag name
|
||||
$textlib = new textlib();
|
||||
$textlib = textlib_get_instance();
|
||||
return $textlib->strtotitle($tag_object->name);
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user