mirror of
https://github.com/friendica/friendica
synced 2025-04-26 09:50:15 +00:00
Replace existing autoloader with Composer-supplied
- Move Friendica namespace to `src` - Move required `ezyang/htmlpurifier` to vendor - Remove existing static autoloader - Change boot.php reference to the autoloader
This commit is contained in:
parent
cae0543629
commit
799e60aa62
419 changed files with 618 additions and 542 deletions
56
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Input.php
vendored
Normal file
56
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Input.php
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Performs miscellaneous cross attribute validation and filtering for
|
||||
* input elements. This is meant to be a post-transform.
|
||||
*/
|
||||
class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform
|
||||
{
|
||||
/**
|
||||
* @type HTMLPurifier_AttrDef_HTML_Pixels
|
||||
*/
|
||||
protected $pixels;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attr
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function transform($attr, $config, $context)
|
||||
{
|
||||
if (!isset($attr['type'])) {
|
||||
$t = 'text';
|
||||
} else {
|
||||
$t = strtolower($attr['type']);
|
||||
}
|
||||
if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
|
||||
unset($attr['checked']);
|
||||
}
|
||||
if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
|
||||
unset($attr['maxlength']);
|
||||
}
|
||||
if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
|
||||
$result = $this->pixels->validate($attr['size'], $config, $context);
|
||||
if ($result === false) {
|
||||
unset($attr['size']);
|
||||
} else {
|
||||
$attr['size'] = $result;
|
||||
}
|
||||
}
|
||||
if (isset($attr['src']) && $t !== 'image') {
|
||||
unset($attr['src']);
|
||||
}
|
||||
if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
|
||||
$attr['value'] = '';
|
||||
}
|
||||
return $attr;
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
Loading…
Add table
Add a link
Reference in a new issue