class InstagramPost in Instagram Block 7
InstagramPost implementation class
Hierarchy
- class \InstagramPost
Expanded class hierarchy of InstagramPost
File
- ./instagram_block.lib.php, line 159 
- Instagram classes to integrate with the Instagram API.
View source
class InstagramPost {
  /**
   * @var string $id.
   */
  protected $id;
  /**
   * @var InstagramUser $user.
   */
  public $user;
  /**
   * @var string $created.
   */
  public $created;
  /**
   * @var string $type.
   */
  public $type;
  /**
   * @var string $link.
   */
  public $link;
  /**
   * @var InstagramLocation $location.
   */
  public $location;
  /**
   * @var InstagramComment $caption.
   */
  public $caption;
  /**
   * @var array $comments
   *   Array of InstagramComments.
   */
  public $comments;
  /**
   * @var integer $comment_count.
   */
  public $comment_count;
  /**
   * @var array $likes
   *   Array of InstagramLikes.
   */
  public $likes;
  /**
   * @var array $images
   *   Array of Image links.
   */
  public $images;
  /**
   * @var integer $like_count.
   */
  public $like_count;
  /**
   * Constructor for the InstagramPost class
   */
  public function __construct($instagram_post) {
    $this->id = $instagram_post->id;
    $this->user = new InstagramUser($instagram_post->user);
    $this->created = $instagram_post->created_time;
    $this->type = $instagram_post->type;
    $this->link = $instagram_post->link;
    $this->images = $instagram_post->images;
    if (!empty($instagram_post->location)) {
      $this->location = new InstagramLocation($instagram_post->location);
    }
    if (!empty($instagram_post->caption)) {
      $this->caption = new InstagramComment($instagram_post->caption);
    }
    if ($instagram_post->comments->count && !empty($instagram_post->comments->data)) {
      $this->comment_count = $instagram_post->comments->count;
      $this->comments = $this
        ->get_comments($instagram_post->comments->data);
    }
    if ($instagram_post->likes->count && !empty($instagram_post->likes->data)) {
      $this->like_count = $instagram_post->likes->count;
      $this->likes = $this
        ->get_likes($instagram_post->likes->data);
    }
  }
  /**
   * Builds an InstagramComment.
   */
  protected function get_comments($data) {
    $comments = array();
    foreach ($data as $comment) {
      $comments[] = new InstagramComment($comment);
    }
    return $comments;
  }
  /**
   * Builds an InstagramLike.
   */
  protected function get_likes($data) {
    $likes = array();
    foreach ($data as $like) {
      $likes[] = new InstagramLike($like);
    }
    return $likes;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | Array of InstagramComments. | |
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | ||
| InstagramPost:: | protected | property | ||
| InstagramPost:: | public | property | Array of Image links. | |
| InstagramPost:: | public | property | Array of InstagramLikes. | |
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | ||
| InstagramPost:: | public | property | ||
| InstagramPost:: | protected | function | Builds an InstagramComment. | |
| InstagramPost:: | protected | function | Builds an InstagramLike. | |
| InstagramPost:: | public | function | Constructor for the InstagramPost class | 
