note 76008 added to function.tidy-clean-repair
| From: | david dot thalmann at gmail dot com | Date: | Tue, 26 Jun 2007 14:17:11 +0000 |
| Subject: | note 76008 added to function.tidy-clean-repair | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127990@lists.php.net to get a copy of this message | ||
I use the tidy extension in my board, but i wanted to restric some html-tags and attributes for my
users... I found out, that if you use cleanRepair(), the object will be the string... sounds
strange, watch that:
<?php
class myTidy extends tidy {
public function __construct($string, $config = array(), $encoding = "utf8") {
if(!is_array($config) || empty($config)) // default config
$config = array(
"doctype" => "omit",
"logical-emphasis" => true,
"show-body-only" => true,
"char-encoding" => "utf8",
"ident" => true,
"wrap" => 0
);
if(!is_string($encoding)) // default encoding
$encoding = "utf8";
parent::parseString($string, $config, $encoding);
parent::cleanRepair();
return parent; // !!! Return the object !!!
}
}
?>
And now with "myFunctions" (e.g. restrict attributes / tags via regEx):
<?php
class myTidy extends tidy {
public function __construct($string, $config = array(), $encoding = "utf8") {
if(!is_array($config) || empty($config))
$config = array(
"doctype" => "omit",
"logical-emphasis" => true,
"show-body-only" => true,
"char-encoding" => "utf8",
"ident" => true,
"wrap" => 0
);
if(!is_string($encoding))
$encoding = "utf8";
parent::parseString($string, $config, $encoding);
parent::cleanRepair();
$string = myFunctions(parent);
return $string;
}
}
?>
----
Server IP: 194.153.94.10
Probable Submitter: 84.72.101.249
----
Manual Page -- http://www.php.net/manual/en/function.tidy-clean-repair.php
Edit -- https://master.php.net/note/edit/76008
Del: integrated -- https://master.php.net/note/delete/76008/integrated
Del: useless -- https://master.php.net/note/delete/76008/useless
Del: bad code -- https://master.php.net/note/delete/76008/bad+code
Del: spam -- https://master.php.net/note/delete/76008/spam
Del: non-english -- https://master.php.net/note/delete/76008/non-english
Del: in docs -- https://master.php.net/note/delete/76008/in+docs
Del: other reasons-- https://master.php.net/note/delete/76008
Reject -- https://master.php.net/note/reject/76008
Search -- https://master.php.net/manage/user-notes.php