0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +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:
Edward Z. Yang 2010-03-08 01:22:21 -05:00
parent dc90e8e85b
commit baa477ac08
2 changed files with 2 additions and 8 deletions

7
TODO
View File

@ -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
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:
- Fix ImgRequired to handle data correctly
- Think about allowing explicit order of operations hooks for transforms
- Inputs don't do the right thing with submit
- 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
debugging

View File

@ -24,7 +24,8 @@ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
if ($src) {
$alt = $config->get('Attr.DefaultImageAlt');
if ($alt === null) {
$attr['alt'] = basename($attr['src']);
// truncate if the alt is too long
$attr['alt'] = substr(basename($attr['src']),0,40);
} else {
$attr['alt'] = $alt;
}