mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-10 01:06:20 +02:00
Convert to PHP 5 only codebase, adding visibility modifiers to all members and methods in the main library area (function only for test methods)
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1458 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@ -39,6 +39,7 @@ directive has been available since 2.0.0.
|
||||
/**
|
||||
* Abstract class for a set of proprietary modules that clean up (tidy)
|
||||
* poorly written HTML.
|
||||
* @todo Figure out how to protect some of these methods/properties
|
||||
*/
|
||||
class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
@ -47,18 +48,18 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* List of supported levels. Index zero is a special case "no fixes"
|
||||
* level.
|
||||
*/
|
||||
var $levels = array(0 => 'none', 'light', 'medium', 'heavy');
|
||||
public $levels = array(0 => 'none', 'light', 'medium', 'heavy');
|
||||
|
||||
/**
|
||||
* Default level to place all fixes in. Disabled by default
|
||||
*/
|
||||
var $defaultLevel = null;
|
||||
public $defaultLevel = null;
|
||||
|
||||
/**
|
||||
* Lists of fixes used by getFixesForLevel(). Format is:
|
||||
* HTMLModule_Tidy->fixesForLevel[$level] = array('fix-1', 'fix-2');
|
||||
*/
|
||||
var $fixesForLevel = array(
|
||||
public $fixesForLevel = array(
|
||||
'light' => array(),
|
||||
'medium' => array(),
|
||||
'heavy' => array()
|
||||
@ -70,7 +71,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* @todo Wildcard matching and error reporting when an added or
|
||||
* subtracted fix has no effect.
|
||||
*/
|
||||
function construct($config) {
|
||||
public function construct($config) {
|
||||
|
||||
// create fixes, initialize fixesForLevel
|
||||
$fixes = $this->makeFixes();
|
||||
@ -105,7 +106,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* @param $level String level identifier, see $levels for valid values
|
||||
* @return Lookup up table of fixes
|
||||
*/
|
||||
function getFixesForLevel($level) {
|
||||
public function getFixesForLevel($level) {
|
||||
if ($level == $this->levels[0]) {
|
||||
return array();
|
||||
}
|
||||
@ -135,7 +136,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* the fixes array. It may be custom overloaded, used in conjunction
|
||||
* with $defaultLevel, or not used at all.
|
||||
*/
|
||||
function makeFixesForLevel($fixes) {
|
||||
public function makeFixesForLevel($fixes) {
|
||||
if (!isset($this->defaultLevel)) return;
|
||||
if (!isset($this->fixesForLevel[$this->defaultLevel])) {
|
||||
trigger_error(
|
||||
@ -152,7 +153,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* based on a list of fixes passed to it
|
||||
* @param $lookup Lookup table of fixes to activate
|
||||
*/
|
||||
function populate($fixes) {
|
||||
public function populate($fixes) {
|
||||
foreach ($fixes as $name => $fix) {
|
||||
// determine what the fix is for
|
||||
list($type, $params) = $this->getFixType($name);
|
||||
@ -202,7 +203,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
* @note $fix_parameters is type dependant, see populate() for usage
|
||||
* of these parameters
|
||||
*/
|
||||
function getFixType($name) {
|
||||
public function getFixType($name) {
|
||||
// parse it
|
||||
$property = $attr = null;
|
||||
if (strpos($name, '#') !== false) list($name, $property) = explode('#', $name);
|
||||
@ -232,9 +233,8 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
||||
/**
|
||||
* Defines all fixes the module will perform in a compact
|
||||
* associative array of fix name to fix implementation.
|
||||
* @abstract
|
||||
*/
|
||||
function makeFixes() {}
|
||||
public function makeFixes() {}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user