public function cidReplace($text, $callback, $charset = 'UTF-8')
    {
        $dom = ($text instanceof Horde_Domhtml)
            ? $text
            : new Horde_Domhtml($text, $charset);

        foreach ($dom as $node) {
            if ($node instanceof DOMElement) {
                switch (Horde_String::lower($node->tagName)) {
                case 'body':
                case 'td':
                    $this->_cidReplace($node, 'background', $callback);
                    break;

                case 'img':
                    $this->_cidReplace($node, 'src', $callback);
                    break;
                }
            }
        }

        return $dom;
    }
public function cidReplace($text, $callback, $charset = 'UTF-8')
    {
        $dom = ($text instanceof Horde_Domhtml)
            ? $text
            : new Horde_Domhtml($text, $charset);

        foreach ($dom as $node) {
            if ($node instanceof DOMElement) {
                switch (Horde_String::lower($node->tagName)) {
                case 'body':
                case 'td':
                    $this->_cidReplace($node, 'background', $callback);
                    break;

                case 'img':
                    $this->_cidReplace($node, 'src', $callback);
                    break;
                }
            }
        }

        return $dom;
    }
public function cidReplace ( $ text , $ callback , $ charset = 'UTF-8' ) { $ dom = ( $ text instanceof Horde_Domhtml ) ? $ text : new Horde_Domhtml ( $ text , $ charset ) ; foreach ( $ dom as $ node ) { if ( $ node instanceof DOMElement ) { switch ( Horde_String :: lower ( $ node -> tagName ) ) { case 'body' : case 'td' : $ this -> _cidReplace ( $ node , 'background' , $ callback ) ; break ; case 'img' : $ this -> _cidReplace ( $ node , 'src' , $ callback ) ; break ; } } } return $ dom ; }
Scan for CID strings in HTML data and replace with data returned from
a callback method.

@param mixed $text         The HTML text (can be Horde_Domhtml object).
@param callback $callback  Callback method. Receives three arguments:
MIME ID, the attribute name containing the
content ID, and the node object. Expects
return value of URL to display the data.
@param string $charset     HTML data charset.

@return Horde_Domhtml  A Horde_Domhtml object.
Scan for CID strings in HTML data and replace with data returned from a callback method .