[wp-trac] [WordPress Trac] #17048: URLs delivered to the browser should be root-relative

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 11 05:29:25 UTC 2011


#17048: URLs delivered to the browser should be root-relative
--------------------------+-------------------------
 Reporter:  dmole         |       Owner:  edwardw
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  3.1
 Severity:  normal        |  Resolution:  maybelater
 Keywords:  dev-feedback  |
--------------------------+-------------------------

Comment (by dmole):

 Replying to [comment:11 dmole]:
 Realizing ob_start is a PHP function that rewrites the whole page, that is
 not a usable solution for anyone who wants external links. (unless they
 use a preset list of known domains in the callback function)
 {{{
  /** Hack to make URLs root relative */
  ob_start( 'make_url_root_relative' );
  function make_url_root_relative( $string ) {
       return  preg_replace(
 '/https?...(myblog.com|127.0.0.1|nat.whatever.tld)\//i', '/', $string );
  }
 }}}
 I'm guessing the function should check if it's output is an email, ideas?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17048#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list