Allow HTML in description fields?
WebKat
![]()
Joined: 2002-11-22
Posts: 182 |
![]() |
I'm running Gallery version 2.3.1 core 1.3.0.1. I was wondering if it was possible either natively or through a plugin or through a (simple for non-programmers like me) hack to allow html (specifically links) in photo and album descriptions? This would be extremely helpful to me. Right now it just shows the html code rather than rendering it. -- |
|
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
Site admin:Embedded Markup Dave |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
Even though you can choose HTML as an option, gallery still filters it. function htmlSafe($html, $decode=false) { list($ret, $isAnon) = GalleryCoreApi::isAnonymousUser(); if(!$ret && !$isAnon){ return $html; } GalleryCoreApi::requireOnce('lib/pear/Safe.php'); static $parser; if (!isset($parser)) { $tmp = new HTML_Safe(); $parser =& $tmp; } if ($decode) { GalleryUtilities::unsanitizeInputValues($html, false); } $html = $parser->parse($html); if ($decode) { GalleryUtilities::sanitizeInputValues($html, false); } return $html; } This will allow any registered user to submit unfiltered html especially helpful if you allow anonymous comments. function htmlSafe($html, $decode=false) { list ($ret, $isAdmin) = GalleryCoreApi::isUserInSiteAdminGroup(); if(!$ret && $isAdmin){ return $html; } GalleryCoreApi::requireOnce('lib/pear/Safe.php'); static $parser; if (!isset($parser)) { $tmp = new HTML_Safe(); $parser =& $tmp; } if ($decode) { GalleryUtilities::unsanitizeInputValues($html, false); } $html = $parser->parse($html); if ($decode) { GalleryUtilities::sanitizeInputValues($html, false); } return $html; }
-s |
|
WebKat
![]()
Joined: 2002-11-22
Posts: 182 |
![]() |
Thanks, I'll try that out. I don't allow user registration OR comments in my gallery, so that stuff won't matter. -- |
|
WebKat
![]()
Joined: 2002-11-22
Posts: 182 |
![]() |
I set it to BBCode because apparently I'd already done BBCode for a bunch of my pieces; also, html mode required that I add <br/> for every line break which is a PITA. However, it isn't rendering the BBCode... see here: http://katherinehowardartist.com/gallery/v/paintings/being_art.jpg.html -- |
|
WebKat
![]()
Joined: 2002-11-22
Posts: 182 |
![]() |
Apologies for the bump, I almost never do such a thing, but I'd really like help with this one. I've done the changes and it's set to parse BBcode, but the links aren't working, as in the example in the previous post... help? -- |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
try removing the quotes around the url -s |
|
WebKat
![]()
Joined: 2002-11-22
Posts: 182 |
![]() |
That worked! thank you! :D:D:D -- |
|