aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-12-01 21:13:09 -0800
committerFriendika <info@friendika.com>2010-12-01 21:13:09 -0800
commit42d66874bed88753cbcf08a060c89f789f41a3ae (patch)
treef8d79a930522b934797f83a3c10c0daf9b1262c9
parent1adf69a04967a3829749b99c8ce663d5068748dd (diff)
downloadvolse-hubzilla-42d66874bed88753cbcf08a060c89f789f41a3ae.tar.gz
volse-hubzilla-42d66874bed88753cbcf08a060c89f789f41a3ae.tar.bz2
volse-hubzilla-42d66874bed88753cbcf08a060c89f789f41a3ae.zip
improved linkification of naked text urls
-rw-r--r--boot.php8
-rw-r--r--include/bbcode.php3
-rw-r--r--view/en/profile.php2
3 files changed, 9 insertions, 4 deletions
diff --git a/boot.php b/boot.php
index d1e570d3b..66236f39d 100644
--- 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
diff --git a/include/bbcode.php b/include/bbcode.php
index 52ca86bc1..fbae7bc32 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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);
diff --git a/view/en/profile.php b/view/en/profile.php
index b59a12b71..190a3e297 100644
--- a/view/en/profile.php
+++ b/view/en/profile.php
@@ -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>
<?php } ?>
<?php if(strlen($profile['homepage'])) { ?>
-<div class="homepage"><span class="homepage-label">Homepage: </span><span class="homepage-url"><?php echo $profile['homepage']; ?></span></div>
+<div class="homepage"><span class="homepage-label">Homepage: </span><span class="homepage-url"><?php echo linkify($profile['homepage']); ?></span></div>
<?php } ?>
<?php if(x($page,'aside')) echo $page['aside'] ?>
</aside>