]> git.mxchange.org Git - friendica.git/commitdiff
improved linkification of naked text urls
authorFriendika <info@friendika.com>
Thu, 2 Dec 2010 05:13:09 +0000 (21:13 -0800)
committerFriendika <info@friendika.com>
Thu, 2 Dec 2010 05:13:09 +0000 (21:13 -0800)
boot.php
include/bbcode.php
view/en/profile.php

index d1e570d3bc0a83b0b920da7c40e2672e90f0dcdb..66236f39d6be68e95e87ba976cdf2be433002d08 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1567,4 +1567,10 @@ function aes_encrypt($val,$ky)
     $enc=MCRYPT_RIJNDAEL_128;
     $val=str_pad($val, (16*(floor(strlen($val) / 16)+(strlen($val) % 16==0?2:1))), chr(16-(strlen($val) % 16)));
     return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
-}} 
\ No newline at end of file
+}} 
+
+if(! function_exists('linkify')) {
+function linkify($s) {
+       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $s);
+       return($s);
+}}
\ No newline at end of file
index 52ca86bc1f3c7584f7437a8a62d937f217453127..fbae7bc327299416d39ea709558290799f63b007 100644 (file)
@@ -18,8 +18,7 @@ function bbcode($Text) {
 
        // Perform URL Search
 
-       $Text = preg_replace("/[^\]\=](http\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $Text);
-       $Text = preg_replace("/[^\]\=](https\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $Text);
+       $Text = preg_replace("/[^\]\=](https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $Text);
 
        $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" >$1</a>', $Text);
        $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" >$2</a>', $Text);
index b59a12b715d4281af9901aa887f222af221448ac..190a3e2974ca5bd2ddb6fcd2cb3ea4c074dc39c5 100644 (file)
@@ -56,7 +56,7 @@
 <div class="marital"><span class="marital-label"><span class="heart">&hearts;</span> Status: </span><span class="marital-text"><?php echo $profile['marital']; ?></span></div>\r
 <?php } ?>\r
 <?php if(strlen($profile['homepage'])) { ?>\r
-<div class="homepage"><span class="homepage-label">Homepage: </span><span class="homepage-url"><?php echo $profile['homepage']; ?></span></div>\r
+<div class="homepage"><span class="homepage-label">Homepage: </span><span class="homepage-url"><?php echo linkify($profile['homepage']); ?></span></div>\r
 <?php } ?>\r
 <?php if(x($page,'aside')) echo $page['aside'] ?>\r
 </aside>\r