# HG changeset patch # User Dan # Date 1243317495 14400 # Node ID d2584c5a075c71aedbd9a3b6468c66fd6b579c1f # Parent 1978f8d29beaef6723046250190756e6ce84f267 Added tag in trigger diff -r 1978f8d29bea -r d2584c5a075c LightboxGallery.php --- a/LightboxGallery.php Tue May 26 01:50:16 2009 -0400 +++ b/LightboxGallery.php Tue May 26 01:58:15 2009 -0400 @@ -12,7 +12,7 @@ // Hook into wikitext render flow $plugins->attachHook('render_wikiformat_pre', 'lbgallery_process_tags($text);'); -$plugins->attachHook('html_attribute_whitelist', '$whitelist["lightboxgallery"] = array("maxwidth"); $whitelist["trigger"] = array();'); +$plugins->attachHook('html_attribute_whitelist', '$whitelist["lightboxgallery"] = array("maxwidth"); $whitelist["trigger"] = array(); $whitelist["randomimage"] = array("/");'); function lbgallery_process_tags(&$text) { @@ -112,14 +112,19 @@ if ( $text ) { - $trigger = str_replace('', $firstimagetag, trim($text)); + $trigger = trim($text); } else { - list($image, $alt) = $imagelist[ array_rand($imagelist) ]; - $trigger = $firstimagetag . '' . htmlspecialchars($alt) . '' . ''; + $trigger = ''; } + $trigger = str_replace('', $firstimagetag, $trigger); + + list($image, $alt) = $imagelist[ array_rand($imagelist) ]; + $randomimage = '' . htmlspecialchars($alt) . ''; + $trigger = str_replace(array('', '', ''), $randomimage, $trigger); + return "$trigger
$inner