1 | <?php |
||
5 | class InstagramAccount extends DataObject |
||
|
|||
6 | { |
||
7 | /** |
||
8 | * @config |
||
9 | * @var string |
||
10 | */ |
||
11 | private static $client_id; |
||
12 | |||
13 | /** |
||
14 | * @config |
||
15 | * @var string |
||
16 | */ |
||
17 | private static $client_secret; |
||
18 | |||
19 | /** |
||
20 | * @config |
||
21 | * @var string |
||
22 | */ |
||
23 | private static $redirect_path; |
||
24 | |||
25 | /** |
||
26 | * @config |
||
27 | */ |
||
28 | private static $items_per_page = 9; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private static $db = [ |
||
34 | 'Title' => 'Varchar', |
||
35 | 'AccessToken' => 'Text', |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * @return FieldList |
||
40 | */ |
||
41 | public function getCMSFields() |
||
82 | |||
83 | /** |
||
84 | * @return FieldList |
||
85 | */ |
||
86 | public function getCMSActions() |
||
113 | |||
114 | /** |
||
115 | * @return RequiredFields |
||
116 | */ |
||
117 | public function getCMSValidator() |
||
121 | |||
122 | /** |
||
123 | * Ensures the person to authorising the account is logged into Instagram as the correct user |
||
124 | * before setting the token. |
||
125 | * |
||
126 | * For example if the user is logged into Instagram as 'FooUser' and they attempt to set a token |
||
127 | * for the InstagramAccount record 'InstagramAccount', the token will contain data relating to |
||
128 | * the 'FooUser' account. So if this happen we display a message telling the user they need to |
||
129 | * log out of Instagram before they can authorise another account. |
||
130 | * |
||
131 | * @param string $token |
||
132 | */ |
||
133 | 1 | public function updateAccessToken($token, $state) |
|
155 | |||
156 | /** |
||
157 | * Create a configured Instagram API interface. |
||
158 | * |
||
159 | * @param string $token |
||
160 | * @return MetzWeb\Instagram\Instagram |
||
161 | */ |
||
162 | public static function getNewInstagramClient($token = null) |
||
189 | |||
190 | /** |
||
191 | * Gets the 'state' value from an OAuth login URL. |
||
192 | * |
||
193 | * @param string $loginURL |
||
194 | * @return string|null |
||
195 | */ |
||
196 | 1 | public function getOAuthStateValueFromLoginURL($loginURL = null) |
|
209 | |||
210 | /** |
||
211 | * Gets the InstsgramAccount's OAuth state from Session. |
||
212 | * |
||
213 | * @return string|null |
||
214 | */ |
||
215 | public function getSessionOAuthState() |
||
225 | |||
226 | /** |
||
227 | * Gets the authorised user's Instagram ID from the AccessToken. |
||
228 | * |
||
229 | * @return string|null |
||
230 | */ |
||
231 | public function getInstagramID() |
||
239 | |||
240 | /** |
||
241 | * Checks if the passed ID is a valid pattern. |
||
242 | * |
||
243 | * @param string $mediaID |
||
244 | * @return boolean |
||
245 | */ |
||
246 | 1 | public function isValidMediaID($mediaID = null) |
|
256 | |||
257 | /** |
||
258 | * Sets a Session variable which is used to keep track of |
||
259 | * the InstagramAccount through the OAuth flow. |
||
260 | * |
||
261 | * @param string $state |
||
262 | */ |
||
263 | private function setSessionOAuthState($state = null) |
||
276 | |||
277 | /** |
||
278 | * Gets a list of media from the user's Instagram. |
||
279 | * |
||
280 | * @param string $maxID Return media earlier than this ID |
||
281 | * @return Larabros\Elogram\Http\Response|null |
||
282 | */ |
||
283 | public function getMedia($maxID = null) |
||
297 | } |
||
298 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.