Advertisement
alex1rap

get_attach

Oct 23rd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.89 KB | None | 0 0
  1. function get_attach($attachments, $n = 0)
  2.         {
  3.             $count = count($attachments);
  4.             for ($i = 0; $i < $count; $i++) {
  5.                 $attach = "";
  6.                 switch ($attachments[$i]->type) {
  7.                     case "photo":
  8.                         break;
  9.                     case "video":
  10.                         break;
  11.                     case "audio":
  12.                         break;
  13.                     case "doc":
  14.                         break;
  15.                     case "wall":
  16.                         $attachment = $attachments[$i]->wall;
  17.                         $wall["id"] = $attachment->id;
  18.                         $wall["from_id"] = $attachment->from_id;
  19.                         $wall["to_id"] = $attachment->to_id;
  20.                         $wall["date"] = $attachment->date;
  21.                         $wall["post_type"] = $attachment->post_type;
  22.                         $wall["text"] = $attachment->text;
  23.                         $wall["attachments"] = $attachment->attachments;
  24.                         $wall["attach"] = $attachment_text;
  25.                         if ($wall["attachments"] != null && $n < 5) {
  26.                             $n++;
  27.                             $wall["attach"] .= "<span class='attachment'>" . get_attach($attachments[$i]->attachments, $n) . "</span>";
  28.                         }
  29.                         $attach .= $wall["attach"];
  30.                         break;
  31.                     case "wall_reply":
  32.                         break;
  33.                     case "sticker":
  34.                         break;
  35.                     case "link":
  36.                         break;
  37.                     case "gift":
  38.                         break;
  39.                     case "market":
  40.                         break;
  41.                     case "market_album":
  42.                         break;
  43.                 }
  44.             }
  45.             return $attach;
  46.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement