Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. $toData = $datum['to']['data'];
  2. $toArray = [];
  3. $tagArray = [];
  4.  
  5. foreach ($toData as $toUser) {
  6. array_push($toArray, $toUser['id']);
  7. }
  8.  
  9. if (isset($datum['message_tags'])) {
  10. foreach($datum['message_tags'] as $tag) {
  11. if (array_search($tag['id'], $toArray) !== false) {
  12. $toArray[$tag['id']] = null;
  13. }
  14. }
  15. }
  16. $toArray = array_filter($toArray);
  17.  
  18. // if $toArray is empty, then this post was a self post, e.g the poster posted on their own wall and tagged a bunch of people
  19. // otherwise the post has a definite recipient
  20. if(!empty($rekeyedToData)) {
  21. // should never be more than one element in the array
  22. if(count($rekeyedToData) > 1){
  23. Logger::log("More than one element in recipient array.");
  24. }
  25. $recipient = end($rekeyedToData); // could have used reset, instead of end() to get the first element. Assumption is there would only by one element in the array
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement