Permalink
Browse files

[MDL-23140]

Adding some format_text and format_string everywhere in pagelib
  • Loading branch information...
1 parent d13864e commit 110f4c933197e29d216c7bf95838653ba945f211 Jordi Piguillem committed Sep 10, 2010
Showing with 19 additions and 18 deletions.
  1. +19 −18 mod/wiki/pagelib.php
View
@@ -108,7 +108,7 @@ function __construct($wiki, $subwiki, $cm) {
function print_header() {
global $OUTPUT, $PAGE, $CFG, $USER, $SESSION;
- $PAGE->set_heading($PAGE->course->fullname);
+ $PAGE->set_heading(format_string($PAGE->course->fullname));
$this->set_url();
@@ -138,7 +138,7 @@ protected function print_pagetitle() {
$html = '';
$html .= $OUTPUT->container_start();
- $html .= $OUTPUT->heading($this->title, 2, 'wiki_headingtitle');
+ $html .= $OUTPUT->heading(format_string($this->title), 2, 'wiki_headingtitle');
$html .= $OUTPUT->container_end();
echo $html;
}
@@ -230,7 +230,7 @@ protected function set_url() {
protected function create_navbar() {
global $PAGE, $CFG;
- $PAGE->navbar->add($this->title, $CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $this->page->id);
+ $PAGE->navbar->add(format_string($this->title), $CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $this->page->id);
}
/**
@@ -339,7 +339,7 @@ function set_coursemodule($id) {
protected function create_navbar() {
global $PAGE, $CFG;
- $PAGE->navbar->add($this->title);
+ $PAGE->navbar->add(format_string($this->title));
$PAGE->navbar->add(get_string('view', 'wiki'));
}
}
@@ -380,7 +380,7 @@ protected function print_pagetitle() {
$title .= ' : ' . $this->section;
}
echo $OUTPUT->container_start('wiki_clear');
- echo $OUTPUT->heading($title, 2, 'wiki_headingtitle');
+ echo $OUTPUT->heading(format_string($title), 2, 'wiki_headingtitle');
echo $OUTPUT->container_end();
}
@@ -668,7 +668,7 @@ function print_content() {
$cell4->text = html_entity_decode($parsedcontent['parsed_text']);
} else {
- $cell4->text = $comment->content;
+ $cell4->text = format_text($comment->content, FORMAT_HTML);
}
$row2->cells[] = $cell4;
@@ -1011,7 +1011,8 @@ protected function print_preview() {
$parseroutput = wiki_parse_content($format, $this->newcontent, $options);
echo $OUTPUT->notification(get_string('previewwarning', 'wiki'), 'notifyproblem wiki_info');
- echo $OUTPUT->box($parseroutput['parsed_text'], 'generalbox wiki_previewbox');
+ $content = format_text($parseroutput['parsed_text'], FORMAT_HTML);
+ echo $OUTPUT->box($content, 'generalbox wiki_previewbox');
$content = $this->newcontent;
$this->print_edit($content);
@@ -1503,7 +1504,7 @@ private function print_contributions_content() {
$user = $users[$version->userid];
}
- $link = wiki_parser_link(wiki_trim_string($page->title), array('swid' => $swid));
+ $link = wiki_parser_link(format_string($page->title), array('swid' => $swid));
$class = ($link['new']) ? 'class="wiki_newentry"' : '';
$linkpage = '<a href="' . $link['url'] . '"' . $class . '>' . $link['content'] . '</a>';
@@ -1543,7 +1544,7 @@ private function print_navigation_content() {
foreach ($fromlinks as $link) {
$lpage = wiki_get_page($link->frompageid);
$link = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
- $table->data[] = array(html_writer::link($link->out(false), $lpage->title));
+ $table->data[] = array(html_writer::link($link->out(false), format_string($lpage->title)));
$table->rowclasses[] = 'mdl-align';
}
@@ -1557,11 +1558,11 @@ private function print_navigation_content() {
foreach ($tolinks as $link) {
if ($link->tomissingpage) {
$viewlink = new moodle_url('/mod/wiki/create.php', array('swid' => $page->subwikiid, 'title' => $link->tomissingpage, 'action' => 'new'));
- $table->data[] = array(html_writer::link($viewlink->out(false), $link->tomissingpage, array('class' => 'wiki_newentry')));
+ $table->data[] = array(html_writer::link($viewlink->out(false), format_string($link)->tomissingpage, array('class' => 'wiki_newentry')));
} else {
$lpage = wiki_get_page($link->topageid);
$viewlink = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
- $table->data[] = array(html_writer::link($viewlink->out(false), $lpage->title));
+ $table->data[] = array(html_writer::link($viewlink->out(false), format_string($lpage->title)));
}
$table->rowclasses[] = 'mdl-align';
}
@@ -1665,9 +1666,9 @@ private function print_orphaned_content() {
if ($orphanedpages = wiki_get_orphaned_pages($swid)) {
foreach ($orphanedpages as $page) {
- $link = wiki_parser_link(wiki_trim_string($page->title), array('swid' => $swid));
+ $link = wiki_parser_link($page->title, array('swid' => $swid));
$class = ($link['new']) ? 'class="wiki_newentry"' : '';
- $table->data[] = array('<a href="' . $link['url'] . '"' . $class . '>' . $link['content'] . '</a>');
+ $table->data[] = array('<a href="' . $link['url'] . '"' . $class . '>' . format_string($link['content']) . '</a>');
}
} else {
$table->data[] = array(get_string('noorphanedpages', 'wiki'));
@@ -1708,10 +1709,10 @@ private function print_updated_content() {
$table->data[] = array($OUTPUT->heading($strdata, 4));
$strdataux = $strdata;
}
- $link = wiki_parser_link(wiki_trim_string($page->title), array('swid' => $swid));
+ $link = wiki_parser_link($page->title, array('swid' => $swid));
$class = ($link['new']) ? 'class="wiki_newentry"' : '';
- $linkpage = '<a href="' . $link['url'] . '"' . $class . '>' . $link['content'] . '</a>';
+ $linkpage = '<a href="' . $link['url'] . '"' . $class . '>' . format_string($link['content']) . '</a>';
$icon = $OUTPUT->user_picture($user, array($COURSE->id));
$table->data[] = array("$icon&nbsp;$linkpage");
}
@@ -2054,7 +2055,7 @@ private function print_version_view() {
print_container($heading, false, 'mdl-align wiki_modifieduser wiki_headingtime');
$options = array('swid' => $this->subwiki->id, 'pretty_print' => true, 'pageid' => $this->page->id);
$parseroutput = wiki_parse_content($pageversion->contentformat, $pageversion->content, $options);
- $content = print_container($parseroutput['parsed_text'], false, '', '', true);
+ $content = print_container(format_text($parseroutput['parsed_text'], FORMAT_HTML), false, '', '', true);
echo $OUTPUT->box($content, 'generalbox wiki_contentbox');
} else {
@@ -2103,7 +2104,7 @@ function print_header() {
echo '</head>';
echo '<body>';
- echo '<h1 id="wiki_printable_title">' . $this->title . '</h1>';
+ echo '<h1 id="wiki_printable_title">' . format_string($this->title) . '</h1>';
}
function print_content() {
@@ -2132,7 +2133,7 @@ private function print_pretty_view() {
$content = wiki_parse_content($version->contentformat, $version->content, array('printable' => true, 'swid' => $this->subwiki->id, 'pageid' => $this->page->id, 'pretty_print' => true));
echo '<div id="wiki_printable_content">';
- echo $content['parsed_text'];
+ echo format_text($content['parsed_text'], FORMAT_HTML);
echo '</div>';
}
}

0 comments on commit 110f4c9

Please sign in to comment.