root/trunk/gregarius/plugins/tidy.php

Revision 1181, 2.0 kB (checked in by mbonetti, 3 years ago)

Copyright (C) 2003 - 2006
(and s'more stuff thrown in)

Line 
1<?php
2###############################################################################
3# Gregarius - A PHP based RSS aggregator.
4# Copyright (C) 2003 - 2006 Marco Bonetti
5#
6###############################################################################
7# This program is free software and open source software; you can redistribute
8# it and/or modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of the License,
10# or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15# more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
20# http://www.gnu.org/licenses/gpl.html
21#
22###############################################################################
23# E-mail:      mbonetti at gmail dot com
24# Web page:    http://gregarius.net/
25#
26###############################################################################
27
28
29
30/// Name: Tidy HTML filter
31/// Author: Marco Bonetti
32/// Description: Cleans content using the tidy php extension (required!)
33/// Version: 1.4
34
35
36function __tidy_Tidy($in) {
37        // Specify configuration
38        $config = array(
39                                  'indent'        => true,
40                                  'output-xhtml'  => true,
41                                  'alt-text' => "-",
42                                  'doctype' => 'omit',
43                                  'show-body-only' => true,
44                                  'wrap' => 0
45        );
46
47        if (function_exists('tidy_parse_string')) {
48        if (phpversion('tidy') > 1.0) {
49                $tidy = tidy_parse_string($in, $config, 'utf8');
50                tidy_clean_repair($tidy);
51                return $tidy;
52                } 
53        } elseif (class_exists('tidy')) {
54                $tidy = new tidy();
55                $tidy -> cleanRepair($in, $config, 'utf8');
56                return $tidy;
57        }
58        return $in;
59}
60rss_set_hook('rss.plugins.import.description','__tidy_Tidy');
61?>
Note: See TracBrowser for help on using the browser.