Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Instagram PHP |
---|
5 | * @author Galen Grover <galenjr@gmail.com> |
---|
6 | * @license http://opensource.org/licenses/mit-license.php The MIT License |
---|
7 | */ |
---|
8 | |
---|
9 | |
---|
10 | include_once(INSTAGRAM_ROOT.'/Core/Proxy.php'); |
---|
11 | include_once(INSTAGRAM_ROOT.'/Core/BaseObjectAbstract.php'); |
---|
12 | include_once(INSTAGRAM_ROOT.'/Collection/TagMediaCollection.php'); |
---|
13 | |
---|
14 | |
---|
15 | /** |
---|
16 | * Tag class |
---|
17 | * |
---|
18 | * @see Instagram->getTag() |
---|
19 | * {@link https://github.com/galen/PHP-Instagram-API/blob/master/Examples/tag.php} |
---|
20 | * {@link http://galengrover.com/projects/PHP-Instagram-API/Examples/?example=tag.php} |
---|
21 | */ |
---|
22 | class Instagram_Tag extends Instagram_Core_BaseObjectAbstract { |
---|
23 | |
---|
24 | /** |
---|
25 | * Get tag media |
---|
26 | * |
---|
27 | * Retrieve the recent media posted with this tag |
---|
28 | * |
---|
29 | * This can be paginated with the next_max_id param obtained from Instagram_Collection_MediaCollection->getNext() |
---|
30 | * |
---|
31 | * @param array $params Optional params to pass to the endpoint |
---|
32 | * @return Instagram_Collection_MediaCollection |
---|
33 | * @access public |
---|
34 | */ |
---|
35 | public function getMedia( array $params = null ) { |
---|
36 | return new Instagram_Collection_TagMediaCollection( $this->proxy->getTagMedia( $this->getApiId(), $params ), $this->proxy ); |
---|
37 | } |
---|
38 | |
---|
39 | /** |
---|
40 | * Get media count |
---|
41 | * |
---|
42 | * @return int |
---|
43 | * @access public |
---|
44 | */ |
---|
45 | public function getMediaCount() { |
---|
46 | return (int)$this->data->media_count; |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * Get tag name |
---|
51 | * |
---|
52 | * @return string |
---|
53 | * @access public |
---|
54 | */ |
---|
55 | public function getName() { |
---|
56 | return $this->data->name; |
---|
57 | } |
---|
58 | |
---|
59 | /** |
---|
60 | * Get ID |
---|
61 | * |
---|
62 | * The ID for a tag is it's name, so return the name |
---|
63 | * |
---|
64 | * @return string |
---|
65 | * @access public |
---|
66 | */ |
---|
67 | public function getId() { |
---|
68 | return $this->getName(); |
---|
69 | } |
---|
70 | |
---|
71 | /** |
---|
72 | * Magic toString method |
---|
73 | * |
---|
74 | * Return the tag name |
---|
75 | * |
---|
76 | * @return string |
---|
77 | * @access public |
---|
78 | */ |
---|
79 | public function __toString() { |
---|
80 | return $this->getName(); |
---|
81 | } |
---|
82 | |
---|
83 | } |
---|
84 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.