Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-26404 messages - move textlib instance out from loop

  • Loading branch information...
commit a8ccca532536e0407e2c5d04e50b07b234686f67 1 parent 77e4bb7
@stronk7 stronk7 authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  message/lib.php
View
2  message/lib.php
@@ -448,6 +448,7 @@ function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $
*/
function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $countunreadtotal, $countblocked, $strunreadmessages) {
$options = array();
+ $textlib = textlib_get_instance(); // going to use textlib services
if ($countunreadtotal>0) { //if there are unread messages
$options[VIEW_UNREAD_MESSAGES] = $strunreadmessages;
@@ -465,7 +466,6 @@ function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $
foreach($courses as $course) {
if (has_capability('moodle/course:viewparticipants', $coursecontexts[$course->id])) {
//Not using short_text() as we want the end of the course name. Not the beginning.
- $textlib = textlib_get_instance();
if ($textlib->strlen($course->shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) {
$courses_options[VIEW_COURSE.$course->id] = '...'.$textlib->substr($course->shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH);
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.