PluginProbe
Github Embed / 1.7
Github Embed v1.7
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.0.1 2.0.2 2.1.0 2.2.0 2.2.1
← All changes | github-api.php +18 -0 1.91.7 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +
4 +
3 5 // 0 - none.
4 6 define( 'GEDEBUG_NONE', 0 );
5 7
6 8 // 1 - call logging only.
@@ -54,10 +56,12 @@
54 56 * with GitHub(http://developer.github.com/v3/oauth/) use the filters here to
55 57 * provide the credentials.
56 58 */
57 59 public function set_credentials() {
60 +
58 61 $this->client_id = apply_filters( 'github-embed-client-id', $this->client_id );
59 62 $this->client_secret = apply_filters( 'github-embed-client-secret', $this->client_secret );
63 +
60 64 }
61 65
62 66
63 67
@@ -103,8 +107,11 @@
103 107 public function get_repo( $owner, $repository ) {
104 108
105 109 $this->log( "get_repo( $owner, $repository )", GEDEBUG_CALL );
106 110
111 + $owner = trim( $owner, '/' );
112 + $repository = trim( $repository, '/' );
113 +
107 114 $results = $this->call_api( "https://api.github.com/repos/$owner/$repository" );
108 115
109 116 return json_decode( $results['body'] );
110 117
@@ -121,8 +128,11 @@
121 128 public function get_repo_commits( $owner, $repository ) {
122 129
123 130 $this->log( "get_repo_commits( $owner, $repository )", GEDEBUG_CALL );
124 131
132 + $owner = trim( $owner, '/' );
133 + $repository = trim( $repository, '/' );
134 +
125 135 $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/commits" );
126 136
127 137 return json_decode( $results['body'] );
128 138
@@ -140,8 +150,11 @@
140 150 public function get_repo_milestone_summary( $owner, $repository, $milestone ) {
141 151
142 152 $this->log( "get_repo_milestone_summary( $owner, $repository, $milestone )", GEDEBUG_CALL );
143 153
154 + $owner = trim( $owner, '/' );
155 + $repo = trim( $repository, '/' );
156 +
144 157 $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/milestones/$milestone" );
145 158
146 159 return json_decode( $results['body'] );
147 160
@@ -152,8 +165,11 @@
152 165 public function get_repo_contributors( $owner, $repository ) {
153 166
154 167 $this->log( "get_repo_contributors( $owner, $repository )", GEDEBUG_CALL );
155 168
169 + $owner = trim( $owner, '/' );
170 + $repo = trim( $repository, '/' );
171 +
156 172 $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/stats/contributors" );
157 173
158 174 return json_decode( $results['body'] );
159 175
@@ -168,8 +184,10 @@
168 184 */
169 185 public function get_user( $user ) {
170 186
171 187 $this->log( "get_user( $user )", GEDEBUG_CALL );
188 +
189 + $user = trim( $user, '/' );
172 190
173 191 $results = $this->call_api( "https://api.github.com/users/$user" );
174 192
175 193 return json_decode( $results['body'] );