mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'w36_MDL-29014_m22_str' of git://github.com/skodak/moodle
This commit is contained in:
commit
62b214d9a6
10 changed files with 22 additions and 22 deletions
|
@ -136,8 +136,8 @@ class hub_selector_form extends moodleform {
|
||||||
$options = array();
|
$options = array();
|
||||||
foreach ($hubs as $hub) {
|
foreach ($hubs as $hub) {
|
||||||
//to not display a name longer than 100 character (too big)
|
//to not display a name longer than 100 character (too big)
|
||||||
if (strlen($hub['name']) > 100) {
|
if (textlib::strlen($hub['name']) > 100) {
|
||||||
$hubname = substr($hub['name'], 0, 100);
|
$hubname = textlib::substr($hub['name'], 0, 100);
|
||||||
$hubname = $hubname . "...";
|
$hubname = $hubname . "...";
|
||||||
} else {
|
} else {
|
||||||
$hubname = $hub['name'];
|
$hubname = $hub['name'];
|
||||||
|
|
|
@ -252,7 +252,7 @@ class block_navigation extends block_base {
|
||||||
// Truncate the text to $long characters
|
// Truncate the text to $long characters
|
||||||
$node->text = $this->trim_left($textlib, $node->text, $long);
|
$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
|
// Truncate the shorttext
|
||||||
$node->shorttext = $this->trim_left($textlib, $node->shorttext, $short);
|
$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
|
// Truncate the text to $long characters
|
||||||
$node->text = $this->trim_center($textlib, $node->text, $long);
|
$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
|
// Truncate the shorttext
|
||||||
$node->shorttext = $this->trim_center($textlib, $node->shorttext, $short);
|
$node->shorttext = $this->trim_center($textlib, $node->shorttext, $short);
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@
|
||||||
|
|
||||||
if(empty($title)){
|
if(empty($title)){
|
||||||
// no title present, use portion of description
|
// no title present, use portion of description
|
||||||
$title = substr(strip_tags($description), 0, 20) . '...';
|
$title = textlib::substr(strip_tags($description), 0, 20) . '...';
|
||||||
}else{
|
}else{
|
||||||
$title = break_up_long_words($title, 30);
|
$title = break_up_long_words($title, 30);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3264,11 +3264,11 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
|
||||||
function course_format_name ($course,$max=100) {
|
function course_format_name ($course,$max=100) {
|
||||||
|
|
||||||
$str = $course->shortname.': '. $course->fullname;
|
$str = $course->shortname.': '. $course->fullname;
|
||||||
if (strlen($str) <= $max) {
|
if (textlib::strlen($str) <= $max) {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return substr($str,0,$max-3).'...';
|
return textlib::substr($str,0,$max-3).'...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,8 +181,8 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
||||||
}
|
}
|
||||||
$section = $mod->section;
|
$section = $mod->section;
|
||||||
$mod->name = strip_tags(format_string($mod->name, true));
|
$mod->name = strip_tags(format_string($mod->name, true));
|
||||||
if (strlen($mod->name) > 55) {
|
if (textlib::strlen($mod->name) > 55) {
|
||||||
$mod->name = substr($mod->name, 0, 50)."...";
|
$mod->name = textlib::substr($mod->name, 0, 50)."...";
|
||||||
}
|
}
|
||||||
if (!$mod->visible) {
|
if (!$mod->visible) {
|
||||||
$mod->name = "(".$mod->name.")";
|
$mod->name = "(".$mod->name.")";
|
||||||
|
@ -394,8 +394,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
|
||||||
}
|
}
|
||||||
$section = $mod->section;
|
$section = $mod->section;
|
||||||
$mod->name = strip_tags(format_string($mod->name, true));
|
$mod->name = strip_tags(format_string($mod->name, true));
|
||||||
if (strlen($mod->name) > 55) {
|
if (textlib::strlen($mod->name) > 55) {
|
||||||
$mod->name = substr($mod->name, 0, 50)."...";
|
$mod->name = textlib::substr($mod->name, 0, 50)."...";
|
||||||
}
|
}
|
||||||
if (!$mod->visible) {
|
if (!$mod->visible) {
|
||||||
$mod->name = "(".$mod->name.")";
|
$mod->name = "(".$mod->name.")";
|
||||||
|
|
|
@ -2233,10 +2233,10 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid
|
||||||
if ($course->format == 'weeks' or empty($thissection->summary)) {
|
if ($course->format == 'weeks' or empty($thissection->summary)) {
|
||||||
$item = $strsection ." ". $mod->sectionnum;
|
$item = $strsection ." ". $mod->sectionnum;
|
||||||
} else {
|
} else {
|
||||||
if (strlen($thissection->summary) < ($width-3)) {
|
if (textlib::strlen($thissection->summary) < ($width-3)) {
|
||||||
$item = $thissection->summary;
|
$item = $thissection->summary;
|
||||||
} else {
|
} else {
|
||||||
$item = substr($thissection->summary, 0, $width).'...';
|
$item = textlib::substr($thissection->summary, 0, $width).'...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$menu[] = '<li class="section"><span>'.$item.'</span>';
|
$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;
|
$url = $mod->modname .'/view.php?id='. $mod->id;
|
||||||
$mod->name = strip_tags(format_string($mod->name ,true));
|
$mod->name = strip_tags(format_string($mod->name ,true));
|
||||||
if (strlen($mod->name) > ($width+5)) {
|
if (textlib::strlen($mod->name) > ($width+5)) {
|
||||||
$mod->name = substr($mod->name, 0, $width).'...';
|
$mod->name = textlib::substr($mod->name, 0, $width).'...';
|
||||||
}
|
}
|
||||||
if (!$mod->visible) {
|
if (!$mod->visible) {
|
||||||
$mod->name = '('.$mod->name.')';
|
$mod->name = '('.$mod->name.')';
|
||||||
|
|
|
@ -157,7 +157,7 @@ if ($type == "ods") {
|
||||||
/// Sending HTTP headers
|
/// Sending HTTP headers
|
||||||
$workbook->send($downloadfilename);
|
$workbook->send($downloadfilename);
|
||||||
/// Creating the first worksheet
|
/// 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");
|
$header = array("surveyid","surveyname","userid","firstname","lastname","email","idnumber","time", "notes");
|
||||||
$col=0;
|
$col=0;
|
||||||
|
@ -232,7 +232,7 @@ if ($type == "xls") {
|
||||||
/// Sending HTTP headers
|
/// Sending HTTP headers
|
||||||
$workbook->send($downloadfilename);
|
$workbook->send($downloadfilename);
|
||||||
/// Creating the first worksheet
|
/// 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");
|
$header = array("surveyid","surveyname","userid","firstname","lastname","email","idnumber","time", "notes");
|
||||||
$col=0;
|
$col=0;
|
||||||
|
|
|
@ -1300,8 +1300,8 @@ function wiki_print_page_content($page, $context, $subwikiid) {
|
||||||
*/
|
*/
|
||||||
function wiki_trim_string($text, $limit = 25) {
|
function wiki_trim_string($text, $limit = 25) {
|
||||||
|
|
||||||
if (strlen($text) > $limit) {
|
if (textlib::strlen($text) > $limit) {
|
||||||
$text = substr($text, 0, $limit) . '...';
|
$text = textlib::substr($text, 0, $limit) . '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
|
|
@ -1606,7 +1606,7 @@ class page_wiki_map extends page_wiki {
|
||||||
$strspecial = get_string('special', 'wiki');
|
$strspecial = get_string('special', 'wiki');
|
||||||
|
|
||||||
foreach ($pages as $page) {
|
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)) {
|
if (preg_match('/[A-Z]/', $letter)) {
|
||||||
$stdaux->{
|
$stdaux->{
|
||||||
$letter}
|
$letter}
|
||||||
|
|
|
@ -1773,8 +1773,8 @@ abstract class repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_short_filename($str, $maxlength) {
|
public function get_short_filename($str, $maxlength) {
|
||||||
if (strlen($str) >= $maxlength) {
|
if (textlib::strlen($str) >= $maxlength) {
|
||||||
return trim(substr($str, 0, $maxlength)).'...';
|
return trim(textlib::substr($str, 0, $maxlength)).'...';
|
||||||
} else {
|
} else {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue