File tree 10 files changed +108
-20
lines changed
10 files changed +108
-20
lines changed Original file line number Diff line number Diff line change @@ -139,10 +139,24 @@ function comment($id)
139
139
return $ comment ;
140
140
}
141
141
142
+ /**
143
+ * Messages wrapper
144
+ * @return Message
145
+ */
142
146
function message ()
143
147
{
144
148
$ msg = new Message ($ this ->conn , $ this ->api_endpoint );
145
149
return $ msg ;
146
150
}
147
151
152
+ /**
153
+ * Notifications wrapper
154
+ * @return mixed
155
+ */
156
+ function notification ()
157
+ {
158
+ $ notification = new Notification ($ this ->conn , $ this ->api_endpoint );
159
+ return $ notification ;
160
+ }
161
+
148
162
}
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ class Authorize
21
21
*/
22
22
protected $ conn ;
23
23
/**
24
- * @var
24
+ * @var string
25
25
*/
26
26
protected $ access_token ;
27
27
/**
28
- * @var
28
+ * @var string
29
29
*/
30
30
protected $ refresh_token ;
31
31
/**
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ class Comment
20
20
protected $ id ;
21
21
22
22
/**
23
- * @param $id
23
+ * @param string $id
24
24
* @param $connection
25
- * @param $endpoint
25
+ * @param string $endpoint
26
26
*/
27
27
function __construct ($ id , $ connection , $ endpoint )
28
28
{
Original file line number Diff line number Diff line change @@ -12,27 +12,27 @@ class Connect
12
12
{
13
13
14
14
/**
15
- * @var
15
+ * @var array
16
16
*/
17
17
protected $ options ;
18
18
/**
19
- * @var
19
+ * @var string
20
20
*/
21
21
protected $ api_key ;
22
22
/**
23
- * @var
23
+ * @var string
24
24
*/
25
25
protected $ api_secret ;
26
26
/**
27
- * @var
27
+ * @var string
28
28
*/
29
29
protected $ api_endpoint ;
30
30
/**
31
- * @var
31
+ * @var string
32
32
*/
33
33
protected $ access_token ;
34
34
/**
35
- * @var
35
+ * @var string
36
36
*/
37
37
protected $ refresh_token ;
38
38
/**
@@ -42,8 +42,8 @@ class Connect
42
42
43
43
/**
44
44
* Constructor
45
- * @param $api_key
46
- * @param $api_secret
45
+ * @param string $api_key
46
+ * @param string $api_secret
47
47
*/
48
48
function __construct ($ api_key , $ api_secret )
49
49
{
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class Gallery
18
18
/**
19
19
* Cosntructor
20
20
* @param $connection
21
- * @param $endpoint
21
+ * @param string $endpoint
22
22
*/
23
23
function __construct ($ connection , $ endpoint )
24
24
{
@@ -174,7 +174,7 @@ function votes($id, $type = "image")
174
174
175
175
/**
176
176
* Vote on Image | ALbum. Votes can be either up or down.
177
- * @param $id
177
+ * @param string $id
178
178
* @param string $type
179
179
* @param string $vote
180
180
* @return mixed
@@ -200,6 +200,7 @@ function comments($id, $type)
200
200
}
201
201
202
202
/**
203
+ * Get a comment to an image in gallery
203
204
* @param $image_id
204
205
* @param $type
205
206
* @param $comment_id
Original file line number Diff line number Diff line change @@ -15,18 +15,18 @@ class Image
15
15
*/
16
16
protected $ conn ;
17
17
/**
18
- * @var
18
+ * @var string
19
19
*/
20
20
protected $ endpoint ;
21
21
/**
22
- * @var
22
+ * @var string
23
23
*/
24
24
protected $ id ;
25
25
26
26
/**
27
- * @param $id
27
+ * @param string $id
28
28
* @param $connection
29
- * @param $endpoint
29
+ * @param string $endpoint
30
30
*/
31
31
function __construct ($ id , $ connection , $ endpoint )
32
32
{
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ function get_thread($id)
91
91
92
92
/**
93
93
* Create a new mesage
94
- * @param $options
94
+ * @param array $options
95
95
* @return mixed
96
96
*/
97
97
function create ($ options )
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * PHP Imgur wrapper 0.1
4
+ * Imgur API wrapper for easy use.
5
+ * @author Vadim Kr.
6
+ * @copyright (c) 2013 bndr
7
+ * @license http://creativecommons.org/licenses/by-sa/3.0/legalcode
8
+ */
9
+ class Notification
10
+ {
11
+
12
+ /**
13
+ * @var
14
+ */
15
+ protected $ conn ;
16
+
17
+ /**
18
+ * @param $connection
19
+ * @param $endpoint
20
+ */
21
+ function __construct ($ connection , $ endpoint )
22
+ {
23
+ $ this ->conn = $ connection ;
24
+ $ this ->endpoint = $ endpoint ;
25
+ }
26
+
27
+ /**
28
+ * Get all notifications. Either new or all notifications.
29
+ * @param boolean $new
30
+ * @return mixed
31
+ */
32
+ function all ($ new )
33
+ {
34
+ $ uri = $ this ->endpoint . "/notification?new= " . ($ new == true ) ? "true " : "false " ;
35
+
36
+ return $ this ->conn ->request ($ uri );
37
+ }
38
+
39
+ /**
40
+ * Get single notification data
41
+ * @param string $id
42
+ * @return mixed
43
+ */
44
+ function single ($ id )
45
+ {
46
+ $ uri = $ this ->endpoint . "/notification/ " . $ id ;
47
+
48
+ return $ this ->conn ->request ($ uri );
49
+ }
50
+
51
+ /**
52
+ * Mark notification as read by id
53
+ * @param string $id
54
+ * @return mixed
55
+ */
56
+ function mark_as_read ($ id )
57
+ {
58
+ $ uri = $ this ->endpoint . "/notification " ;
59
+
60
+ return $ this ->conn ->request ($ uri , array ("mark_as_read " => true ), "PUT " );
61
+ }
62
+
63
+
64
+ }
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class Upload
12
12
{
13
13
14
14
/**
15
- * @var Connection $conn;
15
+ * @var Connect $conn;
16
16
*/
17
17
protected $ conn ;
18
18
/**
Original file line number Diff line number Diff line change 93
93
$ imgur ->upload ()->file ("/path/to/file " , $ postfields ); //Postfields look in http://api.imgur.com/endpoints/image#image-upload
94
94
$ imgur ->upload ()->string ("base64encodedstring, $ postfields " );
95
95
$ imgur ->upload ()->url ("http://urlofimage.com " , $ postfields );
96
+
97
+
98
+ /*-----------------------------------------------------------------------------------*/
99
+ /* Notifications
100
+ /*-----------------------------------------------------------------------------------*/
101
+
102
+ $ imgur ->notification ()->all ();
103
+ $ imgur ->notification ()->single ($ id );
104
+ $ imgur ->notification ()->mark_as_read ($ id );
You can’t perform that action at this time.
0 commit comments