Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
d329a1ea
Commit
d329a1ea
authored
Mar 02, 2016
by
Juan Leyva
Browse files
MDL-53175 filter: Fix text formatting for the book and page modules
parent
296ab1e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
mod/book/lib.php
View file @
d329a1ea
...
...
@@ -429,8 +429,21 @@ function book_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
if
(
$args
[
0
]
==
'index.html'
)
{
$filename
=
"index.html"
;
// We need to rewrite the pluginfile URLs so the media filters can work.
$content
=
file_rewrite_pluginfile_urls
(
$chapter
->
content
,
'webservice/pluginfile.php'
,
$context
->
id
,
'mod_book'
,
'chapter'
,
$chapter
->
id
);
$formatoptions
=
new
stdClass
;
$formatoptions
->
noclean
=
true
;
$formatoptions
->
overflowdiv
=
true
;
$formatoptions
->
context
=
$context
;
$content
=
format_text
(
$content
,
$chapter
->
contentformat
,
$formatoptions
);
// Remove @@PLUGINFILE@@/.
$content
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$chapter
->
content
);
$options
=
array
(
'reverse'
=>
true
);
$content
=
file_rewrite_pluginfile_urls
(
$content
,
'webservice/pluginfile.php'
,
$context
->
id
,
'mod_book'
,
'chapter'
,
$chapter
->
id
,
$options
);
$content
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$content
);
$titles
=
""
;
// Format the chapter titles.
...
...
@@ -451,12 +464,7 @@ function book_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
}
}
$formatoptions
=
new
stdClass
;
$formatoptions
->
noclean
=
true
;
$formatoptions
->
overflowdiv
=
true
;
$formatoptions
->
context
=
$context
;
$content
=
$titles
.
format_text
(
$content
,
$chapter
->
contentformat
,
$formatoptions
);
$content
=
$titles
.
$content
;
send_file
(
$content
,
$filename
,
0
,
0
,
true
,
true
);
}
else
{
...
...
mod/book/tool/exportimscp/locallib.php
View file @
d329a1ea
...
...
@@ -231,9 +231,17 @@ function booktool_exportimscp_chapter_content($chapter, $context) {
$options
->
noclean
=
true
;
$options
->
context
=
$context
;
$chaptercontent
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$chapter
->
content
);
// We need to rewrite the pluginfile URLs so the media filters can work.
$chaptercontent
=
file_rewrite_pluginfile_urls
(
$chapter
->
content
,
'pluginfile.php'
,
$context
->
id
,
'mod_book'
,
'chapter'
,
$chapter
->
id
);
$chaptercontent
=
format_text
(
$chaptercontent
,
$chapter
->
contentformat
,
$options
);
// Now remove again the full pluginfile URLs.
$options
=
array
(
'reverse'
=>
true
);
$chaptercontent
=
file_rewrite_pluginfile_urls
(
$chaptercontent
,
'pluginfile.php'
,
$context
->
id
,
'mod_book'
,
'chapter'
,
$chapter
->
id
,
$options
);
$chaptercontent
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$chaptercontent
);
$chaptertitle
=
format_string
(
$chapter
->
title
,
true
,
array
(
'context'
=>
$context
));
$content
=
''
;
...
...
mod/page/lib.php
View file @
d329a1ea
...
...
@@ -338,15 +338,21 @@ function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
return
false
;
}
//
remove @@PLUGINFILE@@/
$content
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$page
->
content
);
//
We need to rewrite the pluginfile URLs so the media filters can work.
$content
=
file_rewrite_pluginfile_urls
(
$page
->
content
,
'webservice/pluginfile.php'
,
$context
->
id
,
'mod_page'
,
'
content
'
,
$page
->
revision
);
$formatoptions
=
new
stdClass
;
$formatoptions
->
noclean
=
true
;
$formatoptions
->
overflowdiv
=
true
;
$formatoptions
->
context
=
$context
;
$content
=
format_text
(
$content
,
$page
->
contentformat
,
$formatoptions
);
// Remove @@PLUGINFILE@@/.
$options
=
array
(
'reverse'
=>
true
);
$content
=
file_rewrite_pluginfile_urls
(
$content
,
'webservice/pluginfile.php'
,
$context
->
id
,
'mod_page'
,
'content'
,
$page
->
revision
,
$options
);
$content
=
str_replace
(
'@@PLUGINFILE@@/'
,
''
,
$content
);
send_file
(
$content
,
$filename
,
0
,
0
,
true
,
true
);
}
else
{
$fs
=
get_file_storage
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment