Guest User

Untitled

a guest
Jun 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public function getMany($messages = array(), $start = null)
  2. {
  3. if (!empty($start) && is_numeric($start))
  4. {
  5. $start = ($start * 20)-1;
  6. if (count($messages) > 20)
  7. {
  8. $length = count($messages);
  9. $length = (($length-20)>$start)?$length-20:$length-$start;
  10. $messages = array_slice($messages,$start,$length);
  11. }
  12. else
  13. {
  14. return array();
  15. }
  16. }
  17. $return = array();
  18. $threading = false;
  19. if ($this->userData && $this->userData['threading'] == 1)
  20. {
  21. $threading = true;
  22. }
  23. if (($messages) AND (is_array($messages))) {
  24. foreach ($messages as $message)
  25. {
  26. if ($message)
  27. {
  28. $return[] = $this->getOne($message);
  29. if ($threading && !empty($message['reply_to']))
  30. {
  31. foreach($this->getMany($this->prefixReplies($message['reply_to'])) as $replyid)
  32. {
  33. $return[]['replies'][] = $this->getOne($replyid);
  34. }
  35.  
  36. }
  37. }
  38. }
  39. }
  40. return $return;
  41. }
Add Comment
Please, Sign In to add comment