You are here

class InstagramMedia in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.lib.php \InstagramMedia

Class for containing an individual Instagram posts.

Hierarchy

Expanded class hierarchy of InstagramMedia

1 string reference to 'InstagramMedia'
Instagram::fetch in ./drupagram.lib.php
Get an array of Instagram objects from an API endpoint

File

./drupagram.lib.php, line 585
Classes to implement the full Instagram API

View source
class InstagramMedia {
  public $id;
  public $user;
  public $type;
  public $images;
  public $location;
  public $comments;
  public $caption;
  public $link;
  public $likes;
  public $filter;
  public $created_time;

  /**
   * Constructor for InstagramMedia
   */
  public function __construct($values = array()) {

    // Filter out null and empty values
    $values = array_filter($values);

    // Turn values into object attributes
    foreach ($values as $key => $value) {
      switch ($key) {
        case 'user':
          $this->user = new InstagramUser($values['user']);
          break;

        // case 'caption':
        // $this->caption = $values['caption']['text'];
        // break;
        default:
          $this->{$key} = $value;
          break;
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InstagramMedia::$caption public property
InstagramMedia::$comments public property
InstagramMedia::$created_time public property
InstagramMedia::$filter public property
InstagramMedia::$id public property
InstagramMedia::$images public property
InstagramMedia::$likes public property
InstagramMedia::$link public property
InstagramMedia::$location public property
InstagramMedia::$type public property
InstagramMedia::$user public property
InstagramMedia::__construct public function Constructor for InstagramMedia