From c3d327b4c385e99bd1d5fa8b984abecda2e6d32d Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 15 Mar 2007 04:08:40 +0000 Subject: [PATCH] MDL-8904: Used a numerical index for the navigation elements array instead of string index. MDL-8713: Added $CFG->formatstring temporary variable --- lib/weblib.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index f2b0b8848f..20b26aa512 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1444,7 +1444,12 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) { //Store to cache $strcache[$md5] = $string; - + + if (!empty($CFG->filterall)) { + $CFG->formatstring = true; // new + $string = filter_text($string, $courseid); + unset($CFG->formatstring); + } return $string; } @@ -2831,10 +2836,10 @@ function print_navigation ($navigation, $separator=0, $return=false) { foreach ($ar as $a) { if (strpos($a, '') === false) { - $navigation[trim(format_string($a))] = ''; + $navigation[] = array('title' => trim(format_string($a)), 'url' => ''); } else { if (preg_match('/(.*)<\/a>/', $a, $matches)) { - $navigation[trim(format_string($matches[2]))] = $matches[1]; + $navigation[] = array('title' => trim(format_string($matches[2])), 'url' => $matches[1]); } } } @@ -2855,7 +2860,8 @@ function print_navigation ($navigation, $separator=0, $return=false) { ? '/my' : '') .'/">'. format_string($site->shortname) ."\n"; - foreach ($navigation as $title=>$url) { + foreach ($navigation as $navitem) { + extract($navitem); $title = strip_tags(format_string($title)); if (empty($url)) { $output .= '
  • '."$separator $title
  • \n"; @@ -4328,17 +4334,17 @@ function navmenu($course, $cm=NULL, $targetwindow='self') { } if ($backmod) { $backtext= get_string('activityprev', 'access'); - $backmod = '
  • frametarget.'>
    '. + $backmod = '
  • frametarget.'>
    '. ''. '
  • '; + ''.$backtext.''; } if ($nextmod) { $nexttext= get_string('activitynext', 'access'); - $nextmod = '
  • frametarget.'>
    '. + $nextmod = '
  • frametarget.'>
    '. ''. '
  • '; + ''.$nexttext.''; } return '