Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. $string = $text;
  2. $returnString = '';
  3.  
  4. $pattern = '/((?:\\u[dA-F]{4}){2})/i';
  5. preg_match_all ( $pattern , $string , $mtchs);
  6. $patternSplit = '/((?:\\u[dA-F]{4}){2})(\\u)/i';
  7. $formattedData = preg_replace($patternSplit, ' $1 $2', $string);
  8.  
  9. $wordArray = explode(" ", $formattedData);
  10. if(count($wordArray) > 0)
  11. {
  12. foreach($wordArray as $wa)
  13. {
  14. $this->db->where("emoticon_code",$wa);
  15. $returnCode = $this->db->get("emoticon");
  16. if($returnCode->num_rows()>0)
  17. {
  18. $returnArray = $returnCode->result_array();
  19. $retImage = base_url(). 'uploads/emoticon/'. $returnArray[0]['emoticon_image'];
  20. if($from == 'admin')
  21. $wa = "<img src='$retImage' width='20px' height='20px'/>";
  22. else
  23. $wa = $retImage;
  24. }
  25. $returnString .= " ".$wa;
  26. }
  27. }
  28. else
  29. {
  30. $returnString = '';
  31. }
  32. return $returnString;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement