Merge branch 'w36_MDL-29014_m22_str' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk 2011-09-13 12:45:34 +12:00
commit 62b214d9a6
10 changed files with 22 additions and 22 deletions

View file

@ -136,8 +136,8 @@ class hub_selector_form extends moodleform {
$options = array();
foreach ($hubs as $hub) {
//to not display a name longer than 100 character (too big)
if (strlen($hub['name']) > 100) {
$hubname = substr($hub['name'], 0, 100);
if (textlib::strlen($hub['name']) > 100) {
$hubname = textlib::substr($hub['name'], 0, 100);
$hubname = $hubname . "...";
} else {
$hubname = $hub['name'];

View file

@ -252,7 +252,7 @@ class block_navigation extends block_base {
// Truncate the text to $long characters
$node->text = $this->trim_left($textlib, $node->text, $long);
}
if (is_string($node->shorttext) && strlen($node->shorttext)>($short+3)) {
if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
$node->shorttext = $this->trim_left($textlib, $node->shorttext, $short);
}
@ -262,7 +262,7 @@ class block_navigation extends block_base {
// Truncate the text to $long characters
$node->text = $this->trim_center($textlib, $node->text, $long);
}
if (is_string($node->shorttext) && strlen($node->shorttext)>($short+3)) {
if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
$node->shorttext = $this->trim_center($textlib, $node->shorttext, $short);
}

View file

@ -223,7 +223,7 @@
if(empty($title)){
// no title present, use portion of description
$title = substr(strip_tags($description), 0, 20) . '...';
$title = textlib::substr(strip_tags($description), 0, 20) . '...';
}else{
$title = break_up_long_words($title, 30);
}

View file

@ -3264,11 +3264,11 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
function course_format_name ($course,$max=100) {
$str = $course->shortname.': '. $course->fullname;
if (strlen($str) <= $max) {
if (textlib::strlen($str) <= $max) {
return $str;
}
else {
return substr($str,0,$max-3).'...';
return textlib::substr($str,0,$max-3).'...';
}
}

View file

@ -181,8 +181,8 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
}
$section = $mod->section;
$mod->name = strip_tags(format_string($mod->name, true));
if (strlen($mod->name) > 55) {
$mod->name = substr($mod->name, 0, 50)."...";
if (textlib::strlen($mod->name) > 55) {
$mod->name = textlib::substr($mod->name, 0, 50)."...";
}
if (!$mod->visible) {
$mod->name = "(".$mod->name.")";
@ -394,8 +394,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
}
$section = $mod->section;
$mod->name = strip_tags(format_string($mod->name, true));
if (strlen($mod->name) > 55) {
$mod->name = substr($mod->name, 0, 50)."...";
if (textlib::strlen($mod->name) > 55) {
$mod->name = textlib::substr($mod->name, 0, 50)."...";
}
if (!$mod->visible) {
$mod->name = "(".$mod->name.")";

View file

@ -2233,10 +2233,10 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid
if ($course->format == 'weeks' or empty($thissection->summary)) {
$item = $strsection ." ". $mod->sectionnum;
} else {
if (strlen($thissection->summary) < ($width-3)) {
if (textlib::strlen($thissection->summary) < ($width-3)) {
$item = $thissection->summary;
} else {
$item = substr($thissection->summary, 0, $width).'...';
$item = textlib::substr($thissection->summary, 0, $width).'...';
}
}
$menu[] = '<li class="section"><span>'.$item.'</span>';
@ -2252,8 +2252,8 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid
$url = $mod->modname .'/view.php?id='. $mod->id;
$mod->name = strip_tags(format_string($mod->name ,true));
if (strlen($mod->name) > ($width+5)) {
$mod->name = substr($mod->name, 0, $width).'...';
if (textlib::strlen($mod->name) > ($width+5)) {
$mod->name = textlib::substr($mod->name, 0, $width).'...';
}
if (!$mod->visible) {
$mod->name = '('.$mod->name.')';

View file

@ -157,7 +157,7 @@ if ($type == "ods") {
/// Sending HTTP headers
$workbook->send($downloadfilename);
/// Creating the first worksheet
$myxls =& $workbook->add_worksheet(substr(strip_tags(format_string($survey->name,true)), 0, 31));
$myxls =& $workbook->add_worksheet(textlib::substr(strip_tags(format_string($survey->name,true)), 0, 31));
$header = array("surveyid","surveyname","userid","firstname","lastname","email","idnumber","time", "notes");
$col=0;
@ -232,7 +232,7 @@ if ($type == "xls") {
/// Sending HTTP headers
$workbook->send($downloadfilename);
/// Creating the first worksheet
$myxls =& $workbook->add_worksheet(substr(strip_tags(format_string($survey->name,true)), 0, 31));
$myxls =& $workbook->add_worksheet(textlib::substr(strip_tags(format_string($survey->name,true)), 0, 31));
$header = array("surveyid","surveyname","userid","firstname","lastname","email","idnumber","time", "notes");
$col=0;

View file

@ -1300,8 +1300,8 @@ function wiki_print_page_content($page, $context, $subwikiid) {
*/
function wiki_trim_string($text, $limit = 25) {
if (strlen($text) > $limit) {
$text = substr($text, 0, $limit) . '...';
if (textlib::strlen($text) > $limit) {
$text = textlib::substr($text, 0, $limit) . '...';
}
return $text;

View file

@ -1606,7 +1606,7 @@ class page_wiki_map extends page_wiki {
$strspecial = get_string('special', 'wiki');
foreach ($pages as $page) {
$letter = strtoupper(substr($page->title, 0, 1));
$letter = textlib::strtoupper(textlib::substr($page->title, 0, 1));
if (preg_match('/[A-Z]/', $letter)) {
$stdaux->{
$letter}

View file

@ -1773,8 +1773,8 @@ abstract class repository {
}
public function get_short_filename($str, $maxlength) {
if (strlen($str) >= $maxlength) {
return trim(substr($str, 0, $maxlength)).'...';
if (textlib::strlen($str) >= $maxlength) {
return trim(textlib::substr($str, 0, $maxlength)).'...';
} else {
return $str;
}