I get the error "Parse error: syntax error, unexpected T_VARIABLE in /usr/local/www/data-dist/scouts/secure/wiki/liberty/plugins/filter.htmlpurifier.php on line 57"
The script for the filter.htmlpurifier.php is as follows.
<?php
2 /
3 @version $Header: /cvsroot/bitweaver/_bit_liberty/plugins/filter.htmlpurifier.php,v 1.18 2008/02/20 14:39:50 nickpalmer Exp $
4 @package liberty
5 @subpackage plugins_filter
6 /
7
8 /
9 definitions ( guid character limit is 16 chars )
10 /
11 define( 'PLUGIN_GUID_FILTERHTMLPURIFIER', 'filterhtmlpure' );
12
13 global $gLibertySystem;
14
15 $pluginParams = array (
16 // plugin title
17 'title' => 'HTMLPurifier',
18 // help page on bitweaver org that explains this plugin
19 'help_page' => 'HTMLPurifier',
20 // brief description of the plugin
21 'description' => 'Uses <a href="http://htmlpurifier.org">HTMLPurifier</a> to cleanup the HTML submitted to your site and ensure th
at it is standards compliant and does not contain anything malicious. It is also used to ensure that the various places that input is split for previews does n
ot cause bad markup to break the page. This filter is <strong>highly</strong> recommended if you are allowing HTML but is still good for sites that are not usi
ng thse formats for the ability to cleanup markup which has been split for preview properly though this may disable certain plugins that insert non standards c
ompliant code.',
22 // should this plugin be active or not when loaded for the first time
23 'auto_activate' => FALSE,
24 // absolute path to this plugin
25 'path' => LIBERTY_PKG_PATH.'plugins/filter.htmlpurifier.php',
26 // type of plugin
27 'plugin_type' => FILTER_PLUGIN,
28 // url to page with options for this plugin
29 'plugin_settings_url' => LIBERTY_PKG_URL.'admin/filter_htmlpurifier.php',
30
31 // various filter functions and when they are called
32 // called before the data is parsed
33 // 'pre_function' => 'htmlpure_filter',
34 // called after the data has been parsed
35 'preparse_function' => 'htmlpure_filter',
36 // called before the data is parsed if there is a split
37 // 'presplit_function' => 'htmlpure_filter',
38 // called after the data has been parsed if there is a split
39 'postsplit_function' => 'htmlpure_filter',
40 );
41 $gLibertySystem->registerPlugin( PLUGIN_GUID_FILTERHTMLPURIFIER, $pluginParams );
42
43 function htmlpure_filter( &$pString, &$pFilterHash ) {
44 global $gHtmlPurifier, $gBitSystem;
45
46 if (!isset($gHtmlPurifier)) {
47 $blacklistedTags = $gBitSystem->
48 getConfig('blacklisted_html_tags', '');
49
50 $pear_version = false;
51 if (@include_once("PEAR.php")) {
52 if (@include_once("HTMLPurifier.php")) {
53
54 $config = HTMLPurifier_Config::CreateDefault()
55
56 // Set the cache path
57 $config->set('Cache', 'SerializerPath', STORAGE_PKG_PATH);
58
59 if ($gBitSystem->getConfig('htmlpure_escape_bad', 'y') == 'y') {
60 $config->set('Core', 'EscapeInvalidTags', true);
61 $config->set('Core', 'EscapeInvalidChildren', true);
62 }
63 if ($gBitSystem->getConfig('htmlpure_disable_extern') == 'y') {
64 $config->set('URI', 'DisableExternal', true);
65 }
66 if ($gBitSystem->getConfig('htmlpure_disable_extern_res', 'y') == 'y') {
67 $config->set('URI', 'DisableExternalResources', true);
68 }
69 if ($gBitSystem->getConfig('htmlpure_disable_res') == 'y') {
70 $config->set('URI', 'DisableResources', true);
71 }
72 if ($gBitSystem->getConfig('htmlpure_disable_uri') == 'y') {
73 $config->set('URI', 'Disable', true);
74 }
75 if ($gBitSystem->getConfig('htmlpure_use_redirect') == 'y') {
76 $config->set('URI', 'Munge', LIBERTY_PKG_URL.'redirect.php?q=%s');
77 }
78 if ($gBitSystem->getConfig('htmlpure_strict_html', 'y') == 'y') {
79 $config->set('HTML', 'Strict', true);
80 }
81 if ($gBitSystem->getConfig('htmlpure_xhtml', 'n') == 'n') {
82 $config->set('Core', 'XHTML', true);
83 }
84
85 // Set that we are using a div to wrap things.
86 $config->set('HTML', 'BlockWrapper', 'div');
87
88 $def =& $config->getHTMLDefinition();
89 // HTMLPurifier doesn't have a blacklist feature. Duh guys!
90 // Note that this has to come last since the other configs
91 // may tweak the def.
92 foreach (explode(',',$blacklistedTags) as $tag) {
93 unset($def->info[$tag]);
94 }
95
96 if ($gBitSystem->getConfig('htmlpure_force_nofollow', 'y') == 'y') {
97 class HTMLPurifier_AttrTransform_ForceValue extends HTMLPurifier_AttrTransform
98 {
99 var $name, $value;
100 function HTMLPurifier_AttrTransform_ForceValue($name, $value) {
101 $this->name = $name;
102 $this->value = $value;
103 }
104 function transform($attr, $config, &$context) {
105 $attr[$this->name] = $this->value;
106 return $attr;
107 }
108 }
109 $def->info['a']->attr_transform_post['rel'] = new HTMLPurifier_AttrTransform_ForceValue('rel', 'nofollow');
110 }
the script goes to line 183 but it was to long.
Any help is appreciated!