mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 05:37:49 +02:00
Remove trailing whitespace.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
@@ -10,26 +10,26 @@
|
||||
*/
|
||||
class HTMLPurifier_ConfigSchema_Validator
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Easy to access global objects.
|
||||
*/
|
||||
protected $interchange, $aliases;
|
||||
|
||||
|
||||
/**
|
||||
* Context-stack to provide easy to read error messages.
|
||||
*/
|
||||
protected $context = array();
|
||||
|
||||
|
||||
/**
|
||||
* HTMLPurifier_VarParser to test default's type.
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
$this->parser = new HTMLPurifier_VarParser();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a fully-formed interchange object. Throws an
|
||||
* HTMLPurifier_ConfigSchema_Exception if there's a problem.
|
||||
@@ -50,7 +50,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a HTMLPurifier_ConfigSchema_Interchange_Namespace object.
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
->assertIsString(); // handled by InterchangeBuilder
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
->assertAlnum(); // implicit assertIsString handled by InterchangeBuilder
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
|
||||
*/
|
||||
@@ -91,10 +91,10 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
$id = $d->id->toString();
|
||||
$this->context[] = "directive '$id'";
|
||||
$this->validateId($d->id);
|
||||
|
||||
|
||||
$this->with($d, 'description')
|
||||
->assertNotEmpty();
|
||||
|
||||
|
||||
// BEGIN - handled by InterchangeBuilder
|
||||
$this->with($d, 'type')
|
||||
->assertNotEmpty();
|
||||
@@ -107,7 +107,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
$this->error('default', 'had error: ' . $e->getMessage());
|
||||
}
|
||||
// END - handled by InterchangeBuilder
|
||||
|
||||
|
||||
if (!is_null($d->allowed) || !empty($d->valueAliases)) {
|
||||
// allowed and valueAliases require that we be dealing with
|
||||
// strings, so check for that early.
|
||||
@@ -116,14 +116,14 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
$this->error('type', 'must be a string type when used with allowed or value aliases');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->validateDirectiveAllowed($d);
|
||||
$this->validateDirectiveValueAliases($d);
|
||||
$this->validateDirectiveAliases($d);
|
||||
|
||||
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extra validation if $allowed member variable of
|
||||
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
|
||||
@@ -142,7 +142,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
}
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extra validation if $valueAliases member variable of
|
||||
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
|
||||
@@ -170,7 +170,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
}
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extra validation if $aliases member variable of
|
||||
* HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
|
||||
@@ -193,9 +193,9 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
}
|
||||
array_pop($this->context);
|
||||
}
|
||||
|
||||
|
||||
// protected helper functions
|
||||
|
||||
|
||||
/**
|
||||
* Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
|
||||
* for validating simple member variables of objects.
|
||||
@@ -203,7 +203,7 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
protected function with($obj, $member) {
|
||||
return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emits an error, providing helpful context.
|
||||
*/
|
||||
@@ -212,12 +212,12 @@ class HTMLPurifier_ConfigSchema_Validator
|
||||
else $prefix = ucfirst($this->getFormattedContext());
|
||||
throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a formatted context string.
|
||||
*/
|
||||
protected function getFormattedContext() {
|
||||
return implode(' in ', array_reverse($this->context));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user