]> git.mxchange.org Git - friendica.git/commitdiff
Rplace spaces with undercores in tags
authorDomovoy <domovoy@errlock.org>
Tue, 24 Jul 2012 15:22:56 +0000 (17:22 +0200)
committerDomovoy <domovoy@errlock.org>
Tue, 24 Jul 2012 15:22:56 +0000 (17:22 +0200)
include/diaspora.php

index af9a91f02888c3496610167dc4dc82de66738911..a3473a8b738831af549314ac696b230734944402 100755 (executable)
@@ -2120,6 +2120,11 @@ function diaspora_unshare($me,$contact) {
 }
 
 
+function diaspora_replace_tags_callback($matches) {
+       $result = '#'. str_replace(' ', '_', $matches[2]);
+       return $result;
+}
+
 
 function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
 
@@ -2154,8 +2159,12 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
                }
        }
 */
-       // Removal of tags
-       $body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body);
+       /**
+        * Transform #tags, strip off the [url] and replace spaces with underscore
+        */
+       $body = preg_replace_callback('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', function($match) {
+               return '#'. str_replace(' ', '_', $match[2]);
+       }, $body);
 
        //if(strlen($title))
        //      $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;