From 9116e062a035b5b0b93c1fd88af2dabfd43e3e72 Mon Sep 17 00:00:00 2001 From: ThomasBolander Date: Thu, 9 Jun 2016 14:21:38 +0200 Subject: [PATCH] update --- src/Instagram.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Instagram.php b/src/Instagram.php index 5102083..285e9b9 100644 --- a/src/Instagram.php +++ b/src/Instagram.php @@ -2,7 +2,7 @@ namespace Bolandish; class Instagram { - public static function getMediaByHashtag($hashtag = null, $count = 16, $return_type = "object") + public static function getMediaByHashtag($hashtag = null, $count = 16, $assoc = false) { if ( empty($hashtag) || !is_string($hashtag) ) { @@ -11,12 +11,12 @@ public static function getMediaByHashtag($hashtag = null, $count = 16, $return_t $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), ($return_type == "array")); + $media = json_decode(file_get_contents($url), ($assoc || $assoc == "array")); $media = $media->media->nodes; return $media; } - public static function getMediaByUserID($user = null, $count = 16, $return_type = "object") + public static function getMediaByUserID($user = null, $count = 16, $assoc = false) { if ( empty($user) || !(is_string($user) || is_int($user)) ) { @@ -24,12 +24,12 @@ public static function getMediaByUserID($user = null, $count = 16, $return_type } $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),($return_type == "array")); + $media = json_decode(file_get_contents($url),($assoc || $assoc == "array")); $media = $media->media->nodes; return $media; } - public static function getMediaAfterByUserID($user = null,$min_id, $count = 16, $return_type = "object") + public static function getMediaAfterByUserID($user = null, $min_id, $count = 16, $assoc = false) { if ( empty($user) || !(is_string($user) || is_int($user)) ) { @@ -37,7 +37,7 @@ public static function getMediaAfterByUserID($user = null,$min_id, $count = 16, } $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),($return_type == "array")); + $media = json_decode(file_get_contents($url),($assoc || $assoc == "array")); $media = $media->media->nodes; return $media; }