Guest User

Untitled

a guest
May 27th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. <?php
  2.  
  3. $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
  4.  
  5. $text = $this->utility->safe($action['value']);
  6.  
  7. if(preg_match($reg_exUrl, $text, $url)) {
  8.  
  9.        echo preg_replace($reg_exUrl, "<a href="{$url[0]}">{$url[0]}</a> ", $text);
  10. } else {
  11.  
  12.        echo $text;
  13. }
  14. ?>
Add Comment
Please, Sign In to add comment