MDL-8904 please no extract()s, fixed double string filtering; merged from MOODLE_18_STABLE

This commit is contained in:
skodak
2007-03-19 10:37:44 +00:00
parent b95cbfe995
commit e683263f7f
+8 -7
View File
@@ -2834,7 +2834,7 @@ function check_theme_arrows() {
* Prints breadcrumb trail of links, called in theme/-/header.html
*
* @uses $CFG
* @param string $navigation The breadcrumb navigation string to be printed
* @param mixed $navigation The breadcrumb navigation string to be printed
* @param string $separator The breadcrumb trail separator. The default 0 leads to the use
* of $THEME->rarrow, themes could use '→', '/', or '' for a style-sheet solution.
* @param boolean $return False to echo the breadcrumb string (default), true to return it.
@@ -2859,10 +2859,10 @@ function print_navigation ($navigation, $separator=0, $return=false) {
foreach ($ar as $a) {
if (strpos($a, '</a>') === false) {
$navigation[] = array('title' => trim(format_string($a)), 'url' => '');
$navigation[] = array('title' => $a, 'url' => '');
} else {
if (preg_match('/<a.*href="([^"]*)">(.*)<\/a>/', $a, $matches)) {
$navigation[] = array('title' => trim(format_string($matches[2])), 'url' => $matches[1]);
$navigation[] = array('title' => $matches[2], 'url' => $matches[1]);
}
}
}
@@ -2878,18 +2878,19 @@ function print_navigation ($navigation, $separator=0, $return=false) {
$output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
$output .= '<li class="first"><a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))
&& !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
? '/my' : '') .'/">'. format_string($site->shortname) ."</a></li>\n";
foreach ($navigation as $navitem) {
extract($navitem);
$title = strip_tags(format_string($title));
$title = trim(strip_tags(format_string($navitem['title'], false)));
$url = $navitem['url'];
if (empty($url)) {
$output .= '<li class="first">'."$separator $title</li>\n";
} else {
$output .= '<li class="first">' . $separator . ' <a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
$output .= '<li class="first">'.$separator.' <a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
.$url.'">'."$title</a></li>\n";
}
}