Skip to content

Commit

Permalink
Merge pull request BOINC#1806 from drshawnkwang/drupal_fix-usermodlin…
Browse files Browse the repository at this point in the history
…ks-utf8

Drupal: Added UTF-8 encoding for loadHTML.
  • Loading branch information
tristanolive authored Mar 9, 2017
2 parents c6fe7c8 + 4ceda50 commit eb6d5e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drupal/sites/default/boinc/themes/boinc/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ function _boinc_create_moderator_links(&$links, &$moderator_links) {
// Create an array of HTML elements from the $links string, keys
// are the class attribute for the <li> tags.
$dom = new DOMDocument;
$dom->loadHTML($links);
$dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
foreach($dom->getElementsByTagName('li') as $node) {
$key = $node->getAttribute("class");
$alllinks[$key] = $dom->saveHTML($node);
Expand Down Expand Up @@ -754,7 +754,7 @@ function _boinc_create_moderator_links(&$links, &$moderator_links) {
function _boinc_firstlink(&$alink) {
if (!empty($alink)) {
$dom = new DomDocument;
$dom->loadHTML($alink);
$dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8'));

$myli = $dom->getElementsByTagName('li');
if ($myli->length>0) {
Expand Down

0 comments on commit eb6d5e1

Please sign in to comment.