/**
  * Test replace()
  */
 function test_replace()
 {
     $base = 'http://thisshouldntbetheurl.bob.com/';
     $html = '<A href=http://shouldbethislink.com>Test URL</A>';
     $replacer = new rcube_base_replacer($base);
     $response = $replacer->replace($html);
     $this->assertSame('<A href="http://shouldbethislink.com">Test URL</A>', $response);
 }
 /**
  * Convert all relative URLs according to a <base> in HTML
  */
 public static function resolve_base($body)
 {
     // check for <base href=...>
     if (preg_match('!(<base.*href=["\']?)([hftps]{3,5}://[a-z0-9/.%-]+)!i', $body, $regs)) {
         $replacer = new rcube_base_replacer($regs[2]);
         $body = $replacer->replace($body);
     }
     return $body;
 }