PluginProbe
Github Embed / 1.5
Github Embed v1.5
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-embed.php +171 -94 1.71.5 View file →
@@ -1,19 +1,20 @@
1 1 <?php
2 +
2 3 /*
3 4 Plugin Name: Github Embed
4 5 Plugin URI: http://www.leewillis.co.uk/wordpress-plugins
5 6 Description: Paste the URL to a Github project into your posts or pages, and have the project information pulled in and displayed automatically
6 -Version: 1.7
7 +Version: 1.5
7 8 Author: Lee Willis
8 9 Author URI: http://www.leewillis.co.uk/
9 10 */
10 11
11 12 /**
12 - * Copyright (c) 2013-2019 Lee Willis. All rights reserved.
13 + * Copyright (c) 2013 Lee Willis. All rights reserved.
13 14 *
14 - * Released under the GPL license v2
15 - * https://www.gnu.org/licenses/gpl-2.0.en.html
15 + * Released under the GPL license
16 + * http://www.opensource.org/licenses/gpl-license.php
16 17 *
17 18 * This is an add-on for WordPress
18 19 * http://wordpress.org/
19 20 *
@@ -35,38 +36,51 @@
35 36 * we can embed, and handling the actual oEmbed calls. It relies on the github_api
36 37 * class to retrieve the information from the GitHub API.
37 38 * @uses class github_api
38 39 */
40 +class github_embed {
39 41
40 -class github_embed {
41 42
43 +
42 44 private $api;
43 45
46 +
47 +
44 48 /**
45 49 * Constructor. Registers hooks and filters
46 50 * @param class $api An instance of the github_api classs
47 51 */
48 - public function __construct( $api ) {
52 + public function __construct ( $api ) {
53 +
49 54 $this->api = $api;
50 - add_action( 'init', array( $this, 'register_oembed_handler' ) );
55 +
56 + add_action( 'init', array ( $this, 'register_oembed_handler' ) );
51 57 add_action( 'init', array( $this, 'maybe_handle_oembed' ) );
52 58 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
53 59 add_action( 'admin_init', array( $this, 'schedule_expiry' ) );
54 60 add_action( 'github_embed_cron', array( $this, 'cron' ) );
61 +
55 62 // @TODO i18n
63 +
56 64 }
57 65
66 +
67 +
58 68 /**
59 69 * Make sure we have a scheduled event set to clear down the oEmbed cache until
60 70 * WordPress supports cache_age in oEmbed responses.
61 71 */
62 72 function schedule_expiry() {
63 - if ( ! wp_next_scheduled( 'github_embed_cron' ) ) {
64 - $frequency = apply_filters( 'github_embed_cache_frequency', 'daily' );
65 - wp_schedule_event( time(), $frequency, 'github_embed_cron' );
73 +
74 + if( ! wp_next_scheduled( 'github_embed_cron' ) ) {
75 + $frequency = apply_filters ( 'github_embed_cache_frequency', 'daily' );
76 + wp_schedule_event( time(), $frequency, 'github_embed_cron' );
66 77 }
78 +
67 79 }
68 80
81 +
82 +
69 83 /**
70 84 * Expire old oEmbeds.
71 85 * Note: This is a bit sledgehammer-to-crack-a-nut hence why I'm only running it
72 86 * daily. Ideally WP should honour cache_age in oEmbed responses properly
@@ -71,24 +85,34 @@
71 85 * Note: This is a bit sledgehammer-to-crack-a-nut hence why I'm only running it
72 86 * daily. Ideally WP should honour cache_age in oEmbed responses properly
73 87 */
74 88 function cron() {
89 +
75 90 global $wpdb, $table_prefix;
91 +
76 92 $sql = "DELETE
77 93 FROM {$table_prefix}postmeta
78 94 WHERE meta_key LIKE '_oembed_%'";
79 - $results = $wpdb->get_results( $sql );
95 +
96 + $results = $wpdb->get_results ( $sql );
97 +
80 98 }
81 99
100 +
101 +
82 102 /**
83 103 * Enqueue the frontend CSS
84 104 * @return void
85 105 */
86 106 function enqueue_styles() {
87 - wp_register_style( 'github-embed', plugins_url( basename( dirname( __FILE__ ) ) . '/css/github-embed.css' ) );
88 - wp_enqueue_style( 'github-embed' );
107 +
108 + wp_register_style ( 'github-embed', plugins_url(basename(dirname(__FILE__)).'/css/github-embed.css' ) );
109 + wp_enqueue_style ( 'github-embed' );
110 +
89 111 }
90 112
113 +
114 +
91 115 /**
92 116 * Register the oEmbed provider, and point it at a local endpoint since github
93 117 * doesn't directly support oEmbed yet. Our local endpoint will use the github
94 118 * API to fulfil the request.
@@ -95,14 +119,18 @@
95 119 * @param array $providers The current list of providers
96 120 * @return array The list, with our new provider added
97 121 */
98 122 public function register_oembed_handler() {
123 +
99 124 $oembed_url = home_url();
100 125 $key = $this->get_key();
101 126 $oembed_url = add_query_arg( array( 'github_oembed' => $key ), $oembed_url );
102 127 wp_oembed_add_provider( '#https?://github.com/.*#i', $oembed_url, true );
128 +
103 129 }
104 130
131 +
132 +
105 133 /**
106 134 * Generate a unique key that can be used on our requests to stop others
107 135 * hijacking our internal oEmbed API
108 136 * @return string The site key
@@ -107,16 +135,22 @@
107 135 * hijacking our internal oEmbed API
108 136 * @return string The site key
109 137 */
110 138 private function get_key() {
111 - $key = get_option( 'github_oembed_key' );
139 +
140 + $key = get_option ( 'github_oembed_key' );
141 +
112 142 if ( ! $key ) {
113 - $key = md5( time() . rand( 0, 65535 ) );
114 - add_option( 'github_oembed_key', $key, '', 'yes' );
143 + $key = md5 ( time() . rand ( 0,65535 ) );
144 + add_option ( 'github_oembed_key', $key, '', 'yes' );
115 145 }
146 +
116 147 return $key;
148 +
117 149 }
118 150
151 +
152 +
119 153 /**
120 154 * Check whether this is an oembed request, handle if it is
121 155 * Ignore it if not.
122 156 * Insert rant here about WP's lack of a front-end AJAX handler.
@@ -121,70 +155,90 @@
121 155 * Ignore it if not.
122 156 * Insert rant here about WP's lack of a front-end AJAX handler.
123 157 */
124 158 public function maybe_handle_oembed() {
125 - if ( isset( $_GET['github_oembed'] ) ) {
159 +
160 + if ( isset ( $_GET['github_oembed'] ) ) {
126 161 return $this->handle_oembed();
127 162 }
163 +
128 164 }
129 165
166 +
167 +
130 168 /**
131 169 * Handle an oembed request
132 170 */
133 171 public function handle_oembed() {
172 +
134 173 // Check this request is valid
135 - if ( $_GET['github_oembed'] !== $this->get_key() ) {
136 - header( 'HTTP/1.0 403 Forbidden' );
137 - die( 'Sad Octocat is sad.' );
174 + if ( $_GET['github_oembed'] != $this->get_key() ) {
175 + header ( 'HTTP/1.0 403 Forbidden' );
176 + die ( 'Sad Octocat is sad.' );
138 177 }
139 178
140 179 // Check we have the required information
141 - $url = isset( $_REQUEST['url'] ) ? $_REQUEST['url'] : null;
142 - $format = isset( $_REQUEST['format'] ) ? $_REQUEST['format'] : null;
180 + $url = isset ( $_REQUEST['url'] ) ? $_REQUEST['url'] : null;
181 + $format = isset ( $_REQUEST['format'] ) ? $_REQUEST['format'] : null;
143 182
144 - if ( ! empty( $format ) && 'json' !== $format ) {
145 - header( 'HTTP/1.0 501 Not implemented' );
146 - die( 'This octocat only does json' );
183 + if ( ! empty ( $format ) && $format != 'json' ) {
184 + header ( 'HTTP/1.0 501 Not implemented' );
185 + die ( 'This octocat only does json' );
147 186 }
148 187
149 188 if ( ! $url ) {
150 - header( 'HTTP/1.0 404 Not Found' );
151 - die( 'Octocat is lost, and afraid' );
189 + header ( 'HTTP/1.0 404 Not Found' );
190 + die ( 'Octocat is lost, and afraid' );
152 191 }
153 192
154 193 // Issues / Milestones
155 - if ( preg_match( '#https?://github.com/([^/]*)/([^/]*)/graphs/contributors/?$#i', $url, $matches ) && ! empty( $matches[2] ) ) {
156 - $this->oembed_github_repo_contributors( $matches[1], $matches[2] );
157 - } elseif ( preg_match( '#https?://github.com/([^/]*)/([^/]*)/issues.*$#i', $url, $matches ) && ! empty( $matches[2] ) ) {
158 - if ( preg_match( '#issues.?milestone=([0-9]*)#i', $url, $milestones ) ) {
194 + if ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/graphs/contributors/?$#i', $url, $matches ) && ! empty ( $matches[2] ) ) {
195 +
196 + $this->oembed_github_repo_contributors ( $matches[1], $matches[2] );
197 +
198 + } elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/issues.*$#i', $url, $matches ) && ! empty ( $matches[2] ) ) {
199 +
200 + if ( preg_match ( '#issues.?milestone=([0-9]*)#i', $url, $milestones ) ) {
159 201 $milestone = $milestones[1];
160 202 } else {
161 203 $milestone = null;
162 204 }
205 +
163 206 if ( $milestone ) {
164 - $this->oembed_github_repo_milestone_summary( $matches[1], $matches[2], $milestone );
207 + $this->oembed_github_repo_milestone_summary ( $matches[1], $matches[2], $milestone );
165 208 }
166 - } elseif ( preg_match( '#https?://github.com/([^/]*)/([^/]*)/milestone/([0-9]*)$#i', $url, $matches ) ) {
167 - // New style milestone URL, e.g. https://github.com/example/example/milestone/1.
209 +
210 + // New style milestone URL, e.g. https://github.com/example/example/milestone/1
211 + } elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/milestone/([0-9]*)$#i', $url, $matches ) ) {
212 +
168 213 $this->oembed_github_repo_milestone_summary( $matches[1], $matches[2], $matches[3] );
169 - } elseif ( preg_match( '#https?://github.com/([^/]*)/([^/]*)/?$#i', $url, $matches ) && ! empty( $matches[2] ) ) {
170 - // Repository.
171 - $this->oembed_github_repo( $matches[1], $matches[2] );
172 - } elseif ( preg_match( '#https?://github.com/([^/]*)/?$#i', $url, $matches ) ) {
173 - // User.
174 - $this->oembed_github_author( $matches[1] );
214 +
215 + // Repository
216 + } elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/?$#i', $url, $matches ) && ! empty ( $matches[2] ) ) {
217 +
218 + $this->oembed_github_repo ( $matches[1], $matches[2] );
219 +
220 + // User
221 + } elseif ( preg_match ( '#https?://github.com/([^/]*)/?$#i', $url, $matches ) ) {
222 +
223 + $this->oembed_github_author ( $matches[1] );
224 +
175 225 }
226 +
176 227 }
177 228
229 +
230 +
178 231 /**
179 232 * Retrieve a list of contributors for a project
180 233 * @param string $owner The owner of the repository
181 234 * @param string $repository The repository name
182 235 */
183 - private function oembed_github_repo_contributors( $owner, $repository ) {
184 - $repo = $this->api->get_repo( $owner, $repository );
185 - $contributors = $this->api->get_repo_contributors( $owner, $repository );
236 + private function oembed_github_repo_contributors ( $owner, $repository ) {
186 237
238 + $repo = $this->api->get_repo ( $owner, $repository );
239 + $contributors = $this->api->get_repo_contributors ( $owner, $repository );
240 +
187 241 $response = new stdClass();
188 242 $response->type = 'rich';
189 243 $response->width = '10';
190 244 $response->height = '10';
@@ -190,41 +244,49 @@
190 244 $response->height = '10';
191 245 $response->version = '1.0';
192 246 $response->title = $repo->description;
193 247
194 - $gravatar_size = apply_filters( 'github_oembed_gravatar_size', 64 );
248 + $gravatar_size = apply_filters ( 'github_oembed_gravatar_size', 64 );
195 249
196 250 // @TODO This should all be templated
197 - $logo_class = apply_filters( 'wp_github_oembed_logo_class', 'github-logo-octocat' );
198 - $response->html = '<div class="github-embed github-embed-repo-contributors ' . $logo_class . '">';
199 - $response->html .= '<p><a href="' . esc_attr( $repo->html_url ) . '" target="_blank">';
200 - $response->html .= '<strong>' . esc_html( $repo->description ) . '</strong></a><br/>';
251 + $response->html = '<div class="github-embed github-embed-repo-contributors">';
252 + $response->html .= '<p><a href="'.esc_attr($repo->html_url).'" target="_blank"><strong>'.esc_html($repo->description)."</strong></a><br/>";
253 +
201 254 $response->html .= '<span class="github-heading">Contributors: </span>';
255 +
202 256 $response->html .= '<ul class="github-repo-contributors">';
257 +
203 258 foreach ( $contributors as $contributor ) {
259 +
204 260 $response->html .= '<li class="github-repo-contributor">';
205 261 $response->html .= '<img class="github-repo-contributor-avatar" src="';
206 - $response->html .= esc_url( add_query_arg( array( 's' => $gravatar_size ), $contributor->author->avatar_url ) );
207 - $response->html .= '" alt="Picture of ' . esc_attr( $contributor->author->login ) . '">';
262 + $response->html .= esc_url(add_query_arg(array('s'=>$gravatar_size), $contributor->author->avatar_url));
263 + $response->html .= '" alt="Picture of '.esc_attr($contributor->author->login).'">';
208 264 $response->html .= '<span class="github-repo-contributor-login">';
209 - $response->html .= '<a href="https://github.com/' . esc_attr( $contributor->author->login ) . '">' . esc_attr( $contributor->author->login ) . '</a></span>';
265 + $response->html .= '<a href="https://github.com/'.esc_attr($contributor->author->login).'">'.esc_attr($contributor->author->login).'</a></span>';
210 266 }
267 +
211 268 $response->html .= '</ul>';
212 269 $response->html .= '<div style="clear: both;"></div>';
213 270 $response->html .= '</div>';
214 - header( 'Content-Type: application/json' );
215 - echo json_encode( $response );
271 +
272 + header ( 'Content-Type: application/json' );
273 + echo json_encode ( $response );
216 274 die();
275 +
217 276 }
218 277
278 +
279 +
219 280 /**
220 281 * Retrieve the summary information for a repo's milestone, and
221 282 * output it as an oembed response
222 283 */
223 - private function oembed_github_repo_milestone_summary( $owner, $repository, $milestone ) {
224 - $repo = $this->api->get_repo( $owner, $repository );
225 - $summary = $this->api->get_repo_milestone_summary( $owner, $repository, $milestone );
284 + private function oembed_github_repo_milestone_summary ( $owner, $repository, $milestone ) {
226 285
286 + $repo = $this->api->get_repo ( $owner, $repository );
287 + $summary = $this->api->get_repo_milestone_summary ( $owner, $repository, $milestone );
288 +
227 289 $response = new stdClass();
228 290 $response->type = 'rich';
229 291 $response->width = '10';
230 292 $response->height = '10';
@@ -231,43 +293,46 @@
231 293 $response->version = '1.0';
232 294 $response->title = $repo->description;
233 295
234 296 // @TODO This should all be templated
235 - $logo_class = apply_filters( 'wp_github_oembed_logo_class', 'github-logo-octocat' );
236 - $response->html = '<div class="github-embed github-embed-milestone-summary ' . $logo_class . '">';
237 - $response->html .= '<p><a href="' . esc_attr( $repo->html_url ) . '" target="_blank"><strong>' . esc_html( $repo->description ) . '</strong></a><br/>';
297 + $response->html = '<div class="github-embed github-embed-milestone-summary">';
298 + $response->html .= '<p><a href="'.esc_attr($repo->html_url).'" target="_blank"><strong>'.esc_html($repo->description)."</strong></a><br/>";
238 299
239 300 $response->html .= '<span class="github-heading">Milestone: </span>';
240 - $response->html .= '<span class="github-milestone-title">' . esc_html( $summary->title ) . '</span><br>';
301 + $response->html .= '<span class="github-milestone-title">'.esc_html($summary->title)."</span><br>";
241 302
242 303 $response->html .= '<span class="github-heading">Issues: </span>';
243 304 $response->html .= '<span class="github-milestone-issues">';
244 - $response->html .= esc_html( number_format_i18n( $summary->open_issues ) ) . ' open, ';
245 - $response->html .= esc_html( number_format_i18n( $summary->closed_issues ) ) . ' closed.</span><br>';
305 + $response->html .= esc_html ( number_format_i18n ( $summary->open_issues ) )." open, ";
306 + $response->html .= esc_html ( number_format_i18n ( $summary->closed_issues ) )." closed.</span><br>";
246 307
247 - if ( ! empty( $summary->due_on ) ) {
308 + if ( ! empty ( $summary->due_on ) ) {
248 309 $response->html .= '<span class="github-heading">Due: </span>';
249 - $due_date = date_format( date_create( $summary->due_on ), 'jS F Y' );
250 - $response->html .= '<span class="github-milestone-due-date">' . esc_html( $due_date ) . '</span><br>';
310 + $due_date = date_format ( date_create ( $summary->due_on ), 'jS F Y' );
311 + $response->html .= '<span class="github-milestone-due-date">'.esc_html($due_date).'</span><br>';
251 312 }
252 313
253 - $response->html .= '<p class="github-milestone-description">' . nl2br( esc_html( $summary->description ) ) . '</p><br>';
314 + $response->html .= '<p class="github-milestone-description">'.nl2br(esc_html($summary->description))."</p><br>";
254 315 $response->html .= '</div>';
255 316
256 - header( 'Content-Type: application/json' );
257 - echo json_encode( $response );
317 + error_log( basename( __FILE__ ) . ': (' . __LINE__ . ') : response is ' . print_r( $response, 1 ) );
318 + header ( 'Content-Type: application/json' );
319 + echo json_encode ( $response );
258 320 die();
259 321
260 322 }
261 323
324 +
325 +
262 326 /**
263 327 * Retrieve the information from github for a repo, and
264 328 * output it as an oembed response
265 329 */
266 330 private function oembed_github_repo ( $owner, $repository ) {
267 - $repo = $this->api->get_repo( $owner, $repository );
268 - $commits =$this->api->get_repo_commits( $owner, $repository );
269 331
332 + $repo = $this->api->get_repo ( $owner, $repository );
333 + $commits =$this->api->get_repo_commits ( $owner, $repository );
334 +
270 335 $response = new stdClass();
271 336 $response->type = 'rich';
272 337 $response->width = '10';
273 338 $response->height = '10';
@@ -274,39 +339,49 @@
274 339 $response->version = '1.0';
275 340 $response->title = $repo->description;
276 341
277 342 // @TODO This should all be templated
278 - $logo_class = apply_filters( 'wp_github_oembed_logo_class', 'github-logo-mark' );
279 - $response->html = '<div class="github-embed github-embed-repository ' . $logo_class . '">';
280 - $response->html .= '<p><a href="' . esc_attr( $repo->html_url ) . '" target="_blank"><strong>' . esc_html( $repo->description ) . '</strong></a><br/>';
281 - $response->html .= '<a href="' . esc_attr( $repo->html_url ) . '" target="_blank">' . esc_html( $repo->html_url ) . '</a><br/>';
282 - $response->html .= '<a href="' . esc_attr( $repo->html_url . '/network' ) . '" target="_blank">' . esc_html( number_format_i18n( $repo->forks_count ) ) . '</a> forks.<br/>';
283 - $response->html .= '<a href="' . esc_attr( $repo->html_url . '/stargazers' ) . '" target="_blank">' . esc_html( number_format_i18n( $repo->stargazers_count ) ) . '</a> stars.<br/>';
284 - $response->html .= '<a href="' . esc_attr( $repo->html_url . '/issues' ) . '" target="_blank">' . esc_html( number_format_i18n( $repo->open_issues_count ) ) . '</a> open issues.<br/>';
343 + $response->html = '<div class="github-embed github-embed-repository">';
344 + $response->html .= '<p><a href="'.esc_attr($repo->html_url).'" target="_blank"><strong>'.esc_html($repo->description)."</strong></a><br/>";
345 + $response->html .= '<a href="'.esc_attr($repo->html_url).'" target="_blank">'.esc_html($repo->html_url)."</a><br/>";
346 + $response->html .= '<a href="'.esc_attr($repo->html_url . '/network') . '" target="_blank">'.esc_html ( number_format_i18n ( $repo->forks_count ) ) . "</a> forks.<br/>";
347 + $response->html .= '<a href="'.esc_attr($repo->html_url . '/stargazers') . '" target="_blank">'.esc_html ( number_format_i18n ( $repo->stargazers_count ) ) . "</a> stars.<br/>";
348 + $response->html .= '<a href="'.esc_attr($repo->html_url . '/issues') . '" target="_blank">'.esc_html ( number_format_i18n ( $repo->open_issues_count ) ) . "</a> open issues.<br/>";
285 349
286 - if ( count( $commits ) ) {
350 + if ( count ( $commits ) ) {
351 +
287 352 $cnt = 0;
288 353 $response->html .= 'Recent commits:';
289 354 $response->html .= '<ul class="github_commits">';
355 +
290 356 foreach ( $commits as $commit ) {
291 - if ( $cnt > 4 ) {
357 +
358 + if ($cnt > 4)
292 359 break;
293 - }
360 +
294 361 $response->html .= '<li class="github_commit">';
295 - $response->html .= '<a href="https://github.com/' . $owner . '/' . $repository . '/commit/' . esc_attr( $commit->sha ) . '" target="_blank">' . esc_html( $commit->commit->message ) . '</a>, ';
296 - $response->html .= esc_html( $commit->commit->committer->name );
362 + $response->html .= '<a href="https://github.com/'.$owner.'/'.$repository.'/commit/'.esc_attr($commit->sha).'" target="_blank">'.esc_html($commit->commit->message)."</a>, ";
363 + $response->html .= esc_html($commit->commit->committer->name);
297 364 $response->html .= '</li>';
365 +
298 366 $cnt++;
367 +
299 368 }
369 +
300 370 $response->html .= '</ul>';
371 +
301 372 }
302 373 $response->html .= '</p>';
303 374 $response->html .= '</div>';
304 - header( 'Content-Type: application/json' );
305 - echo json_encode( $response );
375 +
376 + header ( 'Content-Type: application/json' );
377 + echo json_encode ( $response );
306 378 die();
379 +
307 380 }
308 381
382 +
383 +
309 384 /**
310 385 * Retrieve the information from github for an author, and output
311 386 * it as an oembed response
312 387 */
@@ -311,9 +386,9 @@
311 386 * it as an oembed response
312 387 */
313 388 private function oembed_github_author ( $owner ) {
314 389
315 - $owner_info = $this->api->get_user( $owner );
390 + $owner_info = $this->api->get_user ( $owner );
316 391
317 392 $response = new stdClass();
318 393 $response->type = 'rich';
319 394 $response->width = '10';
@@ -321,20 +396,22 @@
321 396 $response->version = '1.0';
322 397 $response->title = $owner_info->name;
323 398
324 399 // @TODO This should all be templated
325 - $logo_class = apply_filters( 'wp_github_oembed_logo_class', 'github-logo-octocat' );
326 - $response->html = '<div class="github-embed github-embed-user ' . $logo_class . '">';
327 - $response->html .= '<p><a href="https://github.com/' . esc_attr( $owner ) . '" target="_blank"><strong>' . esc_html( $owner ) . '</strong></a><br/>';
328 - $response->html .= esc_html( number_format_i18n( $owner_info->public_repos ) ) . ' repositories, ';
329 - $response->html .= esc_html( number_format_i18n( $owner_info->followers ) ) . ' followers.</p>';
400 + $response->html = '<div class="github-embed github-embed-user">';
401 + $response->html .= '<p><a href="https://github.com/'.esc_attr($owner).'" target="_blank"><strong>'.esc_html($owner)."</strong></a><br/>";
402 + $response->html .= esc_html ( number_format_i18n ( $owner_info->public_repos ) ).' repositories, ';
403 + $response->html .= esc_html ( number_format_i18n ( $owner_info->followers ) ).' followers.</p>';
330 404 $response->html .= '</div>';
331 - header( 'Content-Type: application/json' );
332 - echo json_encode( $response );
405 +
406 + header ( 'Content-Type: application/json' );
407 + echo json_encode ( $response );
333 408 die();
409 +
334 410 }
411 +
335 412 }
336 413
337 -require_once( 'github-api.php' );
414 +require_once ( 'github-api.php' );
338 415
339 416 $github_api = new github_api();
340 -$github_embed = new github_embed( $github_api );
417 +$github_embed = new github_embed ( $github_api );