$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);
$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);
$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);
//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);
return true;
}
- $textlib = new textlib();
+ $textlib = textlib_get_instance();
$errmsg = '';
if ($textlib->strlen($password) < $CFG->minpasswordlength) {
$errmsg = get_string('errorminpasswordlength', 'auth', $CFG->minpasswordlength);
/// 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();
$paging = NULL;
}
- $textlib = new textlib();
+ $textlib = textlib_get_instance();
if ($textlib->strlen($search) < 2) {
$search = '';
}
if( empty($CFG->keeptagnamecase) ) {
//this is the normalized tag name
- $textlib = new textlib();
+ $textlib = textlib_get_instance();
return $textlib->strtotitle($tag_object->name);
}
else {