Show
Ignore:
Timestamp:
03/27/2008 05:22:57 AM (8 months ago)
Author:
Geert
Message:

Fixed bug in text::auto_p() that would not remove <p> tags around $no_p html blocks that are surrounded by spaces.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/text.php

    r2352 r2358  
    222222        public static function auto_link($text) 
    223223        { 
     224                // Auto link emails first to prevent problems with "www.domain.com@example.com" 
    224225                return text::auto_link_urls(text::auto_link_emails($text)); 
    225226        } 
     
    303304                // Some html elements should not be surrounded by <p> tags 
    304305                $no_p = '(?:p|div|h[1-6r]|[uod]l|pre|blockquote|table|form|style)'; 
    305                 $str = preg_replace('~<p>(?=<'.$no_p.'[^>]*+>)~i', '', $str); 
    306                 return preg_replace('~(</'.$no_p.'>)</p>~i', '$1', $str); 
     306                $str = preg_replace('~<p>(?=\s*+<'.$no_p.'[^>]*+>)~i', '', $str); 
     307                return preg_replace('~(</'.$no_p.'>\s*+)</p>~i', '$1', $str); 
    307308        } 
    308309