summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-02 13:15:29 +0200
committerAleksander Machniak <alec@alec.pl>2013-10-02 13:15:29 +0200
commitbfd24fcc04aec6cc9b6893e0754f98fac293ebb0 (patch)
treedfb3adf8e87d72d1f6ff3bd743aa94945dba2851
parent444e977d4f48712a05fee4fa43bb7d543dc7191d (diff)
Use DOMDocument LIBXML_PARSEHUGE and LIBXML_COMPACT options if possible (#1489302)
-rw-r--r--CHANGELOG1
-rw-r--r--program/lib/Roundcube/rcube_washtml.php9
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 01eac7aca..1564b98fe 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Use DOMDocument LIBXML_PARSEHUGE and LIBXML_COMPACT options if possible (#1489302)
- Support HTTP_HOST, SERVER_NAME and SERVER_ADDR values in include_host_config feature
- Hide Delivery Status Notification option when smtp_server is unset (#1489336)
- Make default font size for HTML messages configurable (request #118)
diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php
index 8f7fe9749..a42b61aac 100644
--- a/program/lib/Roundcube/rcube_washtml.php
+++ b/program/lib/Roundcube/rcube_washtml.php
@@ -377,7 +377,14 @@ class rcube_washtml
// Detect max nesting level (for dumpHTML) (#1489110)
$this->max_nesting_level = (int) @ini_get('xdebug.max_nesting_level');
- @$node->loadHTML($html);
+ // Use optimizations if supported
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ @$node->loadHTML($html, LIBXML_PARSEHUGE | LIBXML_COMPACT);
+ }
+ else {
+ @$node->loadHTML($html);
+ }
+
return $this->dumpHtml($node);
}