mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +00:00
Truncate alt text from src if it's too long.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
parent
dc90e8e85b
commit
baa477ac08
7
TODO
7
TODO
@ -11,18 +11,11 @@ If no interest is expressed for a feature that may require a considerable
|
|||||||
amount of effort to implement, it may get endlessly delayed. Do not be
|
amount of effort to implement, it may get endlessly delayed. Do not be
|
||||||
afraid to cast your vote for the next feature to be implemented!
|
afraid to cast your vote for the next feature to be implemented!
|
||||||
|
|
||||||
Standing patches:
|
|
||||||
|
|
||||||
- Incorporate download and resize support as implemented here:
|
|
||||||
http://htmlpurifier.org/phorum/read.php?3,2795,3628
|
|
||||||
|
|
||||||
Things to do as soon as possible:
|
Things to do as soon as possible:
|
||||||
|
|
||||||
- Fix ImgRequired to handle data correctly
|
|
||||||
- Think about allowing explicit order of operations hooks for transforms
|
- Think about allowing explicit order of operations hooks for transforms
|
||||||
- Inputs don't do the right thing with submit
|
- Inputs don't do the right thing with submit
|
||||||
- Fix "<.<" bug (trailing < is removed if not EOD)
|
- Fix "<.<" bug (trailing < is removed if not EOD)
|
||||||
- http://htmlpurifier.org/phorum/read.php?5,2267,4308#msg-4308
|
|
||||||
- Build in better internal state dumps and debugging tools for remote
|
- Build in better internal state dumps and debugging tools for remote
|
||||||
debugging
|
debugging
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
|
|||||||
if ($src) {
|
if ($src) {
|
||||||
$alt = $config->get('Attr.DefaultImageAlt');
|
$alt = $config->get('Attr.DefaultImageAlt');
|
||||||
if ($alt === null) {
|
if ($alt === null) {
|
||||||
$attr['alt'] = basename($attr['src']);
|
// truncate if the alt is too long
|
||||||
|
$attr['alt'] = substr(basename($attr['src']),0,40);
|
||||||
} else {
|
} else {
|
||||||
$attr['alt'] = $alt;
|
$attr['alt'] = $alt;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user