mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-36669 Filters: Remove the last ref to the UFO library.
This commit is contained in:
parent
b49de5d930
commit
8045696b37
@ -2764,21 +2764,17 @@ function file_modify_html_header($text) {
|
||||
global $CFG;
|
||||
|
||||
$stylesheetshtml = '';
|
||||
/* foreach ($CFG->stylesheets as $stylesheet) {
|
||||
/*
|
||||
foreach ($CFG->stylesheets as $stylesheet) {
|
||||
//TODO: MDL-21120
|
||||
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
|
||||
}*/
|
||||
|
||||
$ufo = '';
|
||||
if (filter_is_enabled('mediaplugin')) {
|
||||
// this script is needed by most media filter plugins.
|
||||
$attributes = array('type'=>'text/javascript', 'src'=>$CFG->httpswwwroot . '/lib/ufo.js');
|
||||
$ufo = html_writer::tag('script', '', $attributes) . "\n";
|
||||
}
|
||||
*/
|
||||
// TODO The code below is actually a waste of CPU. When MDL-29738 will be implemented it should be re-evaluated too.
|
||||
|
||||
preg_match('/\<head\>|\<HEAD\>/', $text, $matches);
|
||||
if ($matches) {
|
||||
$replacement = '<head>'.$ufo.$stylesheetshtml;
|
||||
$replacement = '<head>'.$stylesheetshtml;
|
||||
$text = preg_replace('/\<head\>|\<HEAD\>/', $replacement, $text, 1);
|
||||
return $text;
|
||||
}
|
||||
@ -2787,7 +2783,7 @@ function file_modify_html_header($text) {
|
||||
preg_match('/\<html\>|\<HTML\>/', $text, $matches);
|
||||
if ($matches) {
|
||||
// replace <html> tag with <html><head>includes</head>
|
||||
$replacement = '<html>'."\n".'<head>'.$ufo.$stylesheetshtml.'</head>';
|
||||
$replacement = '<html>'."\n".'<head>'.$stylesheetshtml.'</head>';
|
||||
$text = preg_replace('/\<html\>|\<HTML\>/', $replacement, $text, 1);
|
||||
return $text;
|
||||
}
|
||||
@ -2795,13 +2791,13 @@ function file_modify_html_header($text) {
|
||||
// if not, look for <body> tag, and stick <head> before body
|
||||
preg_match('/\<body\>|\<BODY\>/', $text, $matches);
|
||||
if ($matches) {
|
||||
$replacement = '<head>'.$ufo.$stylesheetshtml.'</head>'."\n".'<body>';
|
||||
$replacement = '<head>'.$stylesheetshtml.'</head>'."\n".'<body>';
|
||||
$text = preg_replace('/\<body\>|\<BODY\>/', $replacement, $text, 1);
|
||||
return $text;
|
||||
}
|
||||
|
||||
// if not, just stick a <head> tag at the beginning
|
||||
$text = '<head>'.$ufo.$stylesheetshtml.'</head>'."\n".$text;
|
||||
$text = '<head>'.$stylesheetshtml.'</head>'."\n".$text;
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user