Skip to content

Commit

Permalink
Export: OU wiki, OU blog, and ForumNG export fail with Unicode #3743
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou committed May 15, 2012
1 parent 3bb9534 commit aed9568
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions portfoliolib.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ static function get_page_html($pageversion, $attachments,
'date' => userdate($pageversion->timecreated),
'userlink' => ouwiki_display_user($user, $course->id)));
$output .= html_writer::tag('p', html_writer::tag('small',
html_writer::tag('i', $lastchange)));
html_writer::tag('i', $lastchange)));

// Main text
$output .= $formattedtext;
$output .= html_writer::tag('div', $formattedtext);

// Word count
if ($ouwiki->enablewordcount) {
$wordcount = get_string('numwords', 'ouwiki', $pageversion->wordcount);
$output .= html_writer::empty_tag('br');
$output .= html_writer::tag('div', html_writer::empty_tag('br'));
$output .= html_writer::tag('p',
html_writer::tag('small', $wordcount),
array('class' => 'ouw_wordcount'));
Expand Down Expand Up @@ -299,7 +299,18 @@ public function get_navigation() {
public function prepare_package() {
global $CFG;

$pagehtml = $this->prepare_page($this->pageversion);
$pagehtml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' .
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' .
html_writer::start_tag('html', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$pagehtml .= html_writer::tag('head',
html_writer::empty_tag('meta',
array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8')) .
html_writer::tag('title', get_string('export', 'forumngfeature_export')));
$pagehtml .= html_writer::start_tag('body') . "\n";

$pagehtml .= $this->prepare_page($this->pageversion);

$pagehtml .= html_writer::end_tag('body') . html_writer::end_tag('html');

$content = $pagehtml;
$name = $this->make_filename_safe($this->pageversion->title === '' ?
Expand Down Expand Up @@ -368,12 +379,22 @@ public function get_return_url() {
public function prepare_package() {
global $CFG;

$pagehtml = html_writer::tag('h1', s($this->ouwiki->name));
$pagehtml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' .
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' .
html_writer::start_tag('html', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$pagehtml .= html_writer::tag('head',
html_writer::empty_tag('meta',
array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8')) .
html_writer::tag('title', get_string('export', 'forumngfeature_export')));
$pagehtml .= html_writer::start_tag('body') . "\n";
$pagehtml .= html_writer::tag('h1', s($this->ouwiki->name));

foreach ($this->pageversions as $pageversion) {
$pagehtml .= $this->prepare_page($pageversion);
}

$pagehtml .= html_writer::end_tag('body') . html_writer::end_tag('html');

$content = $pagehtml;
$name = $this->make_filename_safe($this->ouwiki->name) . '.html';
$manifest = ($this->exporter->get('format') instanceof PORTFOLIO_FORMAT_RICH);
Expand Down

0 comments on commit aed9568

Please sign in to comment.