public function fromArray($data) { parent::fromArray($data); if (!empty($data['url'])) { $this->url = $data['url']; } if (!empty($data['title'])) { $this->title = $data['title']; } if (!empty($data['caption'])) { $this->caption = $data['caption']; } if (!empty($data['description'])) { $this->description = $data['description']; } if (!empty($data['is_external'])) { $this->is_external = intval($data['is_external']); } if (!empty($data['preview_page'])) { $this->preview_page = intval($data['preview_page']); } if (!empty($data['preview_url'])) { $this->preview_url = $data['preview_url']; } if (!empty($data['photo']) && is_array($data['photo'])) { $photo = new View_Photo(); $photo->fromArray($data['photo']); $this->photo = $photo; } }
/** * @param int $owner_id * @param int $album_id * @param null $photo_ids * @param null $rev * @param null $extended * @param null $feed_type * @param null $feed * @param null $photo_sizes * @param int $offset * @param int $count * * @return View_List */ public function get($owner_id, $album_id, $photo_ids = null, $rev = null, $extended = null, $feed_type = null, $feed = null, $photo_sizes = null, $offset = 0, $count = 20) { $result = new View_List(); $params = array('owner_id' => $owner_id, 'album_id' => $album_id, 'offset' => $offset, 'count' => $count); if (null !== $photo_ids) { $params['photo_ids'] = $photo_ids; } if (null !== $rev) { $params['rev'] = $rev; } if (null !== $extended) { $params['extended'] = $extended; } if (null !== $feed_type) { $params['feed_type'] = $feed_type; } if (null !== $feed) { $params['feed'] = $feed; } if (null !== $photo_sizes) { $params['photo_sizes'] = $photo_sizes; } $recs = $this->call('photos.get', $params); foreach ($recs['response']['items'] as $rec) { $photo = new View_Photo(); $photo->fromArray($rec); $result->items[$photo->id] = $photo; $result->count++; } return $result; }