aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authornicosomb <nicolas@loeuillet.org>2013-04-23 16:03:52 +0200
committernicosomb <nicolas@loeuillet.org>2013-04-23 16:03:52 +0200
commit494e21b4da955912b9e521787650e269818b1147 (patch)
tree2cf34c7fc442a084b9c589f33d81adc8de958835 /inc
parent0ace6cab0b934b7b8e4d4de4acca16294b7b12df (diff)
downloadwallabag-494e21b4da955912b9e521787650e269818b1147.tar.gz
wallabag-494e21b4da955912b9e521787650e269818b1147.tar.zst
wallabag-494e21b4da955912b9e521787650e269818b1147.zip
add tidy call to clean html output
Diffstat (limited to 'inc')
-rw-r--r--inc/functions.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 7db9e909..c2a149c6 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -127,6 +127,12 @@ function prepare_url($url)
127 $html = Encoding::toUTF8(get_external_file($url,15)); 127 $html = Encoding::toUTF8(get_external_file($url,15));
128 } 128 }
129 129
130 if (function_exists('tidy_parse_string')) {
131 $tidy = tidy_parse_string($html, array(), 'UTF8');
132 $tidy->cleanRepair();
133 $html = $tidy->value;
134 }
135
130 if (isset($html) and strlen($html) > 0) 136 if (isset($html) and strlen($html) > 0)
131 { 137 {
132 $r = new Readability($html, $url); 138 $r = new Readability($html, $url);
@@ -279,7 +285,13 @@ function display_view($view, $id = 0, $full_head = 'yes')
279 $tpl->assign('id', $entry['id']); 285 $tpl->assign('id', $entry['id']);
280 $tpl->assign('url', $entry['url']); 286 $tpl->assign('url', $entry['url']);
281 $tpl->assign('title', $entry['title']); 287 $tpl->assign('title', $entry['title']);
282 $tpl->assign('content', $entry['content']); 288 $content = $entry['content'];
289 if (function_exists('tidy_parse_string')) {
290 $tidy = tidy_parse_string($content, array('indent'=>true, 'show-body-only' => true), 'UTF8');
291 $tidy->cleanRepair();
292 $content = $tidy->value;
293 }
294 $tpl->assign('content', $content);
283 $tpl->assign('is_fav', $entry['is_fav']); 295 $tpl->assign('is_fav', $entry['is_fav']);
284 $tpl->assign('is_read', $entry['is_read']); 296 $tpl->assign('is_read', $entry['is_read']);
285 $tpl->assign('load_all_js', 0); 297 $tpl->assign('load_all_js', 0);