Guest User

Untitled

a guest
Apr 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. preg_match_all(self::$urlRegex, $this->content, $match,PREG_SET_ORDER);
  2.    
  3.     foreach($match as $url) {      
  4.       $url = array_shift($url);
  5.       $shortResponse = $this->shortUrl($url);      
  6.       if(!empty($shortResponse->shorturl)) {        
  7.         $shorted = sprintf('<a href="%s" target="_blank" rel="tooltip">%s</a>',$shortResponse->shorturl,$shortResponse->shorturl);
  8.         $this->content = str_replace($url, $shorted, $this->content);
  9.       }
  10.     }
  11.    
  12.     print $this->content;
Add Comment
Please, Sign In to add comment