Remove horde/Core dependency in HTML Mime Viewer
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 6 Oct 2010 16:48:45 +0000 (10:48 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 6 Oct 2010 17:28:55 +0000 (11:28 -0600)
framework/Core/lib/Horde/Core/Factory/MimeViewer.php
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php

index 2c5d7ea..a8d6dc1 100644 (file)
@@ -115,6 +115,7 @@ class Horde_Core_Factory_MimeViewer
 
         case 'Html':
             $params['browser'] = $GLOBALS['browser'];
+            $params['external_callback'] = array('Horde', 'externalUrl');
             break;
 
         case 'Ooo':
index b44c405..177f668 100644 (file)
@@ -57,7 +57,11 @@ class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Base
      *                                    rendered.
      * @param array $conf                 Configuration:
      * <pre>
-     * 'browser' - (Horde_Browser) A browser object.
+     * browser - (Horde_Browser) A browser object.
+     * external_callback - (callback) A callback function that a href URL is
+     *                     passed through. The function must take the original
+     *                     URL as the first parameter.
+     *                     DEFAULT: No callback
      * </pre>
      *
      * @throws InvalidArgumentException
@@ -204,8 +208,10 @@ class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Base
                                 $child->setAttribute('style', ($child->hasAttribute('style') ? rtrim($child->getAttribute('style'), '; ') . ';' : '') . $this->_phishCss);
                             }
 
-                            /* Try to derefer all external references. */
-                            $child->setAttribute('href', Horde::externalUrl($val->value));
+                            if (isset($this->_params['external_callback'])) {
+                                /* Try to derefer all external references. */
+                                $child->setAttribute('href', call_user_func($this->_params['external_callback'], $val->value));
+                            }
                         }
                     }
                 }