Problem with embedded images (patch)
Adam Yearout <[email protected]> Sun, 21 Mar 2004 05:33:57 -0800
| Newsgroups | gmane.comp.horde.wicked |
|---|---|
| Message-ID | <[email protected]> |
While playing around with the sample wiki page provided with Text_Wiki, I noticed that embedded images weren't working properly. I was able to track it down to wicked/lib/Text_Wiki/url.php. The class extension here breaks the URLs for embedded images by turning them into Horde external links. I took existing code from Text_Wiki's url.php and applied it here so that URLs are only translated if they are not images. -- Adam Yearout [email protected] -- wicked mailing list - Join the hunt: http://horde.org/bounties/#wicked Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]
url.php.patch
(text/plain, 766 B)
--- url.php.orig 2004-03-21 04:26:11.000000000 -0800
+++ url.php 2004-03-21 05:21:30.000000000 -0800
@@ -29,8 +29,16 @@
*/
function renderXhtml($options)
{
- $options['href'] = Horde::externalUrl($options['href']);
- return parent::renderXhtml($options);
+ // determine the filename extension
+ $pos = strrpos($options['href'], '.');
+ $ext = strtolower(substr($options['href'], $pos));
+
+ // does the filename extension indicate an image file?
+ // if not, translate the URI into a Horde external link.
+ if (!in_array($ext, $this->img_ext)) {
+ $options['href'] = Horde::externalUrl($options['href']);
+ }
+ return parent::renderXhtml($options);
}
}