]> git.mxchange.org Git - friendica.git/commitdiff
some dspr fixes
authorFriendika <info@friendika.com>
Wed, 26 Oct 2011 02:59:57 +0000 (19:59 -0700)
committerFriendika <info@friendika.com>
Wed, 26 Oct 2011 02:59:57 +0000 (19:59 -0700)
include/bb2diaspora.php
include/bbcode.php
include/diaspora.php
include/text.php

index e2711755b77e1c26b2fb7ea770e3adf7881476fd..f7398067b9f0f2527e584bc7c1c56b1e680e73a6 100644 (file)
@@ -11,8 +11,12 @@ function diaspora2bb($s) {
        $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
        $s = Markdown($s);
        $s = html2bbcode($s);
+       $s = str_replace('&#42;','*',$s);
     $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s); 
+    $s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s); 
        $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s); 
+       $s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s); 
+       $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s);
 
        return $s;
 }
index e20b2478d3012927a491f47b465a21ee2c2d5a0f..a60d09ce8b1fdab2bd32e5e1d2fd7d50ca6eeda7 100644 (file)
@@ -57,6 +57,7 @@ function bbcode($Text,$preserve_nl = false) {
 
 
        // Perform URL Search
+
        $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="external-link">$2</a>', $Text);
        
        $Text = preg_replace_callback("/\[bookmark\=([^\]]*)\].*?\[\/bookmark\]/ism",'tryoembed',$Text);
index 2379ae8e3ec5a262afe7cd129555c6fa8e3b85dc..ad5e2adb2a4d10f601111875348e30af64178c13 100644 (file)
@@ -92,12 +92,14 @@ function find_diaspora_person_by_handle($handle) {
                dbesc($handle)
        );
        if(count($r)) {
+               logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DEBUG);
                // update record occasionally so it doesn't get stale
                $d = strtotime($r[0]['updated'] . ' +00:00');
                if($d > strtotime('now - 14 days'))
                        return $r[0];
                $update = true;
        }
+       logger('find_diaspora_person_by_handle: refresh',LOGGER_DEBUG);
        require_once('include/Scrape.php');
        $r = probe_url($handle, PROBE_DIASPORA);
        if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) {
@@ -947,7 +949,10 @@ function diaspora_comment($importer,$xml,$msg) {
        $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
        $datarray['body'] = $body;
        $datarray['tag'] = $str_tags;
-       $datarray['app']  = 'Diaspora';
+
+       // We can't be certain what the original app is if the message is relayed.
+       if(($parent_item['origin']) && (! $parent_author_signature)) 
+               $datarray['app']  = 'Diaspora';
 
        $message_id = item_store($datarray);
 
index a9763fd2112e212bea547ca441d871309b978224..e0f38a3a0d4b8bf9ec53610459d7e0ca797f28b8 100644 (file)
@@ -481,7 +481,7 @@ function get_tags($s) {
        // Otherwise pull out single word tags. These can be @nickname, @first_last
        // and #hash tags.
 
-       if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
+       if(preg_match_all('/([@#][^ \x0D\x0A,;:?]+)([ \x0D\x0A,;:?]|$)/',$s,$match)) {
                foreach($match[1] as $mtch) {
                        if(strstr($mtch,"]")) {
                                // we might be inside a bbcode color tag - leave it alone