Skip to content

Commit

Permalink
Added return type
Browse files Browse the repository at this point in the history
  • Loading branch information
Bolandish committed Jun 9, 2016
1 parent 6257824 commit 51a7705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "[email protected]"
}
],
"version": "1.0.1",
"version": "1.0.2",
"autoload": {
"psr-4": {"Bolandish\\": "src/"}
}
Expand Down
12 changes: 6 additions & 6 deletions src/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Bolandish;

class Instagram {
public static function getMediaByHashtag($hashtag = null, $count = 16)
public static function getMediaByHashtag($hashtag = null, $count = 16, $return_type = "object")
{
if ( empty($hashtag) || !is_string($hashtag) )
{
Expand All @@ -11,33 +11,33 @@ public static function getMediaByHashtag($hashtag = null, $count = 16)
$hashtag = strtolower($hashtag);
$parameters = urlencode("ig_hashtag($hashtag) { media.first($count) { count, nodes { caption, code, comments { count }, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username }, thumbnail_src, video_views, video_url }, page_info } }");
$url = "https://www.instagram.com/query/?q=$parameters&ref=tags%3A%3Ashow";
$media = json_decode(file_get_contents($url));
$media = json_decode(file_get_contents($url), ($return_type == "array"));
$media = $media->media->nodes;
return $media;
}

public static function getMediaByUserID($user = null, $count = 16)
public static function getMediaByUserID($user = null, $count = 16, $return_type = "object")
{
if ( empty($user) || !(is_string($user) || is_int($user)) )
{
return false;
}
$parameters = urlencode("ig_user($user) { media.first($count) { count, nodes { caption, code, comments { count }, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username }, thumbnail_src, video_views, video_url }, page_info } }");
$url = "https://www.instagram.com/query/?q=$parameters&ref=tags%3A%3Ashow";
$media = json_decode(file_get_contents($url));
$media = json_decode(file_get_contents($url),($return_type == "array"));
$media = $media->media->nodes;
return $media;
}

public static function getMediaAfterByUserID($user = null,$min_id, $count = 16)
public static function getMediaAfterByUserID($user = null,$min_id, $count = 16, $return_type = "object")
{
if ( empty($user) || !(is_string($user) || is_int($user)) )
{
return false;
}
$parameters = urlencode("ig_user($user) { media.after($min_id,$count) { count, nodes { caption, code, comments { count }, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username }, thumbnail_src, video_views, video_url }, page_info } }");
$url = "https://www.instagram.com/query/?q=$parameters&ref=tags%3A%3Ashow";
$media = json_decode(file_get_contents($url));
$media = json_decode(file_get_contents($url),($return_type == "array"));
$media = $media->media->nodes;
return $media;
}
Expand Down

0 comments on commit 51a7705

Please sign in to comment.