class InstagramUser in Drupagram 6
Same name and namespace in other branches
- 7 drupagram.lib.php \InstagramUser
Class for containing an individual Instagram user.
Hierarchy
- class \InstagramUser
Expanded class hierarchy of InstagramUser
1 string reference to 'InstagramUser'
- Instagram::fetch in ./
drupagram.lib.php - Get an array of Instagram objects from an API endpoint
File
- ./
drupagram.lib.php, line 564 - Classes to implement the full Instagram API
View source
class InstagramUser {
public $id;
public $username;
public $first_name;
public $last_name;
public $full_name;
public $profile_picture;
public $bio;
public $website;
public $media_count;
public $follows_count;
public $followed_by_count;
public $follows;
public $followed_by;
public $url;
protected $password;
protected $oauth_token;
protected $oauth_token_secret;
/**
* Constructor for InstagramUser
*/
public function __construct($values = array()) {
if (!isset($values) || empty($values)) {
return FALSE;
}
if (!is_array($values)) {
$values = (array) $values;
}
$values = array_filter($values);
foreach ($values as $key => $value) {
switch ($key) {
case 'counts':
if (is_array($values['counts']) && !empty($values['counts'])) {
$this->media_count = isset($values['counts']['media']) ? (int) $values['counts']['media'] : 0;
$this->follows_count = isset($values['counts']['follows']) ? (int) $values['counts']['follows'] : 0;
$this->followed_by_count = isset($values['counts']['followed_by']) ? (int) $values['counts']['followed_by'] : 0;
}
break;
default:
$this->{$key} = $value;
break;
}
}
}
public function get_auth() {
return array(
'password' => $this->password,
'oauth_token' => $this->oauth_token,
'oauth_token_secret' => $this->oauth_token_secret,
);
}
public function set_auth($values) {
$this->oauth_token = isset($values['oauth_token']) ? $values['oauth_token'] : NULL;
$this->oauth_token_secret = isset($values['oauth_token_secret']) ? $values['oauth_token_secret'] : NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
protected | property | ||
InstagramUser:: |
protected | property | ||
InstagramUser:: |
protected | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | property | ||
InstagramUser:: |
public | function | ||
InstagramUser:: |
public | function | ||
InstagramUser:: |
public | function | Constructor for InstagramUser |