Skip to content

Commit

Permalink
[MDL-23140]
Browse files Browse the repository at this point in the history
Adding some format_text and format_string everywhere in pagelib
  • Loading branch information
Jordi Piguillem committed Sep 10, 2010
1 parent d13864e commit 110f4c9
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions mod/wiki/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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'));
}
}
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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>';
Expand Down Expand Up @@ -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';
}

Expand All @@ -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';
}
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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>';
}
}
Expand Down

0 comments on commit 110f4c9

Please sign in to comment.