]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
log the D* publc messages
[friendica.git] / include / text.php
index 66447069e455ad6c53a9cd90a9514d14bd0361ba..501121c80227418a21f641d363754be8a5112ce4 100644 (file)
@@ -482,13 +482,12 @@ function get_tags($s) {
                                // we might be inside a bbcode color tag - leave it alone
                                continue;
                        }
+                       if(substr($mtch,-1,1) === '.')
+                               $mtch = substr($mtch,0,-1);
                        // ignore strictly numeric tags like #1
                        if((strpos($mtch,'#') === 0) && ctype_digit(substr($mtch,1)))
                                continue;
-                       if(substr($mtch,-1,1) === '.')
-                               $ret[] = substr($mtch,0,-1);
-                       else
-                               $ret[] = $mtch;
+                       $ret[] = $mtch;
                }
        }
        return $ret;
@@ -571,11 +570,13 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
 
        $url = $contact['url'];
        $sparkle = '';
+       $redir = false;
 
        if($redirect) {
                $a = get_app();
                $redirect_url = $a->get_baseurl() . '/redir/' . $contact['id'];
                if(local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === 'dfrn')) {
+                       $redir = true;
                        $url = $redirect_url;
                        $sparkle = ' sparkle';
                }
@@ -586,6 +587,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
        if($textmode) {
                return '<div class="contact-block-textdiv' . $class . '"><a class="contact-block-link' . $class . $sparkle 
                        . (($click) ? ' fakelink' : '') . '" '
+                       . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click
                        . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] 
                        . '" >'. $contact['name'] . '</a></div>' . "\r\n";
@@ -593,6 +595,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
        else {
                return '<div class="contact-block-div' . $class . '"><a class="contact-block-link' . $class . $sparkle 
                        . (($click) ? ' fakelink' : '') . '" '
+                       . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="' 
                        . $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] 
                        . '" /></a></div>' . "\r\n";
@@ -602,12 +605,14 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
 
 
 if(! function_exists('search')) {
-function search($s,$id='search-box',$url='/search') {
+function search($s,$id='search-box',$url='/search',$save = false) {
        $a = get_app();
        $o  = '<div id="' . $id . '">';
        $o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >';
        $o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />';
        $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; 
+       if($save)
+               $o .= '<input type="submit" name="save" id="search-save" value="' . t('Save') . '" />'; 
        $o .= '</form></div>';
        return $o;
 }}
@@ -630,7 +635,8 @@ function valid_email($x){
 
 if(! function_exists('linkify')) {
 function linkify($s) {
-       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+       $s = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$s);
        return($s);
 }}
 
@@ -651,7 +657,7 @@ if(! function_exists('smilies')) {
 function smilies($s) {
        $a = get_app();
 
-       return str_replace(
+       $s = str_replace(
        array( '&lt;3', '&lt;/3', '&lt;\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', 
                '~friendika', 'Diaspora*' ),
        array(
@@ -675,6 +681,10 @@ function smilies($s) {
                '<a href="http://joindiaspora.com">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
 
        ), $s);
+
+       call_hooks('smilie', $s);
+       return $s;
+
 }}