#110 Images with title

XOOPS_2.4
open
Jan Pedersen
5
2014-08-23
2005-05-27
No

This little hack ads title tag with the value of
image's name. Also fixed the center align function.

imagemanager.php :

$lcode = '[img align=left
title=\\''.$images[$i]
->getVar('image_nicename').'\\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$code = '[img align=center
title=\\''.$images[$i]
->getVar('image_nicename').'\\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';
$rcode = '[img align=right
title=\\''.$images[$i]
->getVar('image_nicename').'\\']'.XOOPS_UPLOAD_URL.'/'.$images[$i]->getVar('image_name').'[/img]';

and

module.textsanitizer.php :
I added one more pattern with the title attribute

$patterns[] = "/[img
align=(['\"]?)(left|center|right)\1]([^\"()'<>])[\/img]/sU";
$patterns[] = "/[img]([^\"()'<>]
)[\/img]/sU";
$patterns[] = "/[img
align=(['\"]?)(left|center|right)\1
id=(['\"]?)([0-9])\3]([^\"()'<>])[\/img]/sU";
$patterns[] = "/[img
id=(['\"]?)([0-9])\1]([^\"()'<>])[\/img]/sU";
$patterns[] = "/[img
align=(['\"]?)(left|center|right)\1
title=(['\"]?)([^\"()'<>])\3]([^\"()'<>])[\/img]/sU";

$replacements[] = '

';
//$replacements[] = '';
$replacements[] = '';
$replacements[] = '
';
//$replacements[] = '';
$replacements[] = '';
$replacements[] = '
';

I know its not very clean but it works .
It also has one bug. If the name of the image has ' or
" then the imagemanager can't paste the code.
Thats all.

link:
http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=35006&forum=14&post_id=151782#forumpost151782

Discussion

  • Jan Pedersen
    Jan Pedersen
    2005-06-25

    Logged In: YES
    user_id=841117

    OK, I'll take care of this one personally.