]> git.mxchange.org Git - friendica.git/commitdiff
more multiline regex fixes
authorFriendika <info@friendika.com>
Tue, 20 Sep 2011 11:07:24 +0000 (04:07 -0700)
committerFriendika <info@friendika.com>
Tue, 20 Sep 2011 11:07:24 +0000 (04:07 -0700)
include/bbcode.php
mod/item.php

index cbe19de54a2c2bf7ba4cf1395a22cf5e2cb1e98f..9abc7c439615e437ba4085c0385caf4c1a8bd482 100644 (file)
@@ -43,11 +43,11 @@ function bbcode($Text,$preserve_nl = false) {
        // Perform URL Search
 
 
-       $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
+       $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="external-link">$2</a>', $Text);
 
-       $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/m", '<a href="$1" target="external-link">$1</a>', $Text);
-       $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/m", '<a href="$1" target="external-link">$2</a>', $Text);
-       //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/m", '<a href="$1" target="_blank">$2</a>', $Text);
+       $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="external-link">$1</a>', $Text);
+       $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="external-link">$2</a>', $Text);
+       //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
 
 
        // Perform MAIL Search
@@ -95,7 +95,7 @@ function bbcode($Text,$preserve_nl = false) {
 //     $Text = str_replace("[*]", "<li>", $Text);
 
        // Check for font change text
-       $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/m","<span style=\"font-family: $1;\">$2</span>",$Text);
+       $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm","<span style=\"font-family: $1;\">$2</span>",$Text);
 
        // Declare the format for [code] layout
 
index cad72122b8c00c51dea6d843f98b9eea75c50944..e5d4eea8208ba4a68f5dfc0057d5d8246df571b5 100644 (file)
@@ -336,9 +336,9 @@ function item_post(&$a) {
        // embedded bookmark in post? convert to regular url and set bookmark flag
 
        $bookmark = 0;
-       if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) {
+       if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match)) {
                $bookmark = 1;
-               $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
+               $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$body);
        }
 
 
@@ -346,7 +346,7 @@ function item_post(&$a) {
         * Fold multi-line [code] sequences
         */
 
-       $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body); 
+       $body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body); 
 
        /**
         * Look for any tags and linkify them