Changeset 2041


Ignore:
Timestamp:
02/22/10 14:08:57 (14 years ago)
Author:
rodsouza
Message:

Ticket #859 - Refinamento da expressão regular que busca por URLs no corpo do e-mail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r2039 r2041  
    809809                        if ( strtolower( $msg -> structure[ $msg_number ] -> subtype ) == 'plain' ) 
    810810                        { 
    811                                 $content = str_replace( array( '<', '>' ), array( '#$<$# ', ' #$>$#' ), $content ); 
     811                                $content = str_replace( array( '<', '>' ), array( ' #$<$# ', ' #$>$# ' ), $content ); 
    812812                                $content = nl2br( htmlentities( $content ) ); 
     813                                $content = $this -> replace_links( $content ); 
     814                                $content = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $content ); 
    813815                                $content = '<span style="font-family: monospace">' . $content . '</span>'; 
    814                                 $content = $this -> replace_links( $content ); 
    815                                 $content = str_replace( array( '#$&lt;$# ', ' #$&gt;$#' ), array( '&lt;', '&gt;' ), $content ); 
    816816 
    817817                                $return[ 'body' ] = $content; 
     
    11761176 
    11771177                // Url found in the text and which is not a link yet should be replaced by one. 
    1178                 $pattern = '/(^|[\w"]>|[ \(\[])((http(s)?:\/\/)?([\w\d_\-@]{2,}(\.[\w\d~?\/_=&#;\-:@$]+)+))/im'; 
     1178                $pattern = '/(^| |[\w"]>|[ \(\[])((http(s)?:\/\/)?([\w\d_\-@]{2,}(\.[\w\d~?\/_=&#;\-:@$]+)+))/im'; 
    11791179                $replacement = '$1<a href="http$4://$5" target="_blank">$2</a>'; 
    11801180                $body = preg_replace( $pattern, $replacement, $body ); 
Note: See TracChangeset for help on using the changeset viewer.