improved linkification of naked text urls

This commit is contained in:
Friendika 2010-12-01 21:13:09 -08:00
parent 1adf69a049
commit 42d66874be
3 changed files with 9 additions and 4 deletions

View File

@ -1567,4 +1567,10 @@ function aes_encrypt($val,$ky)
$enc=MCRYPT_RIJNDAEL_128; $enc=MCRYPT_RIJNDAEL_128;
$val=str_pad($val, (16*(floor(strlen($val) / 16)+(strlen($val) % 16==0?2:1))), chr(16-(strlen($val) % 16))); $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)); return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
}} }}
if(! function_exists('linkify')) {
function linkify($s) {
$s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $s);
return($s);
}}

View File

@ -18,8 +18,7 @@ function bbcode($Text) {
// Perform URL Search // 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" >$1</a>', $Text);
$Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" >$2</a>', $Text); $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" >$2</a>', $Text);

View 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> <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 } ?>
<?php if(strlen($profile['homepage'])) { ?> <?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 } ?>
<?php if(x($page,'aside')) echo $page['aside'] ?> <?php if(x($page,'aside')) echo $page['aside'] ?>
</aside> </aside>