Skip to content

Commit

Permalink
Use utf8 encoding when running $dom->loadHTML() to avoid problems wit…
Browse files Browse the repository at this point in the history
  • Loading branch information
gordielachance authored and gordielachance committed Sep 12, 2016
1 parent 2a7e216 commit 01601ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bbpress-pencil-unread.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: bbPress Pencil Unread
Plugin URI: http://wordpress.org/extend/plugins/bbpress-pencil-unread
Description: Display which bbPress forums/topics have already been read by the user.
Version: 1.2.3
Version: 1.2.4
Author: G.Breant
Author URI: https://profiles.wordpress.org/grosbouff/
Text Domain: bbppu
Expand All @@ -16,7 +16,7 @@ class bbP_Pencil_Unread {
/**
* @public string plugin version
*/
public $version = '1.2.3';
public $version = '1.2.4';

/**
* @public string plugin DB version
Expand Down Expand Up @@ -925,7 +925,7 @@ function list_forums_class($output,$args){
//get forums list nodes
$dom = new DOMDocument;
$internalErrors = libxml_use_internal_errors(true); // set error level
$dom->loadHTML($output);
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $output); // use utf8 encoding to avoid problems with foreign languages (http://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly)
$finder = new DomXPath($dom);
$classname="bbp-forum-link";
$forum_link_nodes = $finder->query("//*[contains(@class, '$classname')]");
Expand Down
3 changes: 2 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ Have a look at the file /bbppu-template.php, which contains functions you could
If it hasn't been done already, you can translate the plugin and send me the translation. I recommand [Loco Translate](https://fr.wordpress.org/plugins/loco-translate/) to work on your translations within Wordpress.

== Changelog ==

= 1.2.4 =
* Use utf8 encoding when running $dom->loadHTML() to avoid problems with foreign languages (http://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly)
= 1.2.3 =
* No faking anymore ! Now the plugin **really** checks if a forum has its topics all read; while before, it was checking if the forum had been **opened**.
* Allow to filter queries to get topics by read/unread status (see FAQ)
Expand Down

0 comments on commit 01601ff

Please sign in to comment.