| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /* |
| 4 | 4 | Plugin Name: Github Embed |
| 5 | 5 | Plugin URI: http://www.leewillis.co.uk/wordpress-plugins |
| 6 | 6 | Description: Paste the URL to a Github project into your posts or pages, and have the project information pulled in and displayed automatically |
| 7 | -Version: 1.1 | |
| 7 | +Version: 1.0 | |
| 8 | 8 | Author: Lee Willis |
| 9 | 9 | Author URI: http://www.leewillis.co.uk/ |
| 10 | 10 | */ |
| 11 | 11 | |
| @@ -41,10 +41,9 @@ | ||
| 41 | 41 | public function __construct() { |
| 42 | 42 | |
| 43 | 43 | add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); |
| 44 | 44 | add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); |
| 45 | - add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); | |
| 46 | - | |
| 45 | + | |
| 47 | 46 | // @TODO i18n |
| 48 | 47 | |
| 49 | 48 | } |
| 50 | 49 | |
| @@ -50,21 +49,8 @@ | ||
| 50 | 49 | |
| 51 | 50 | |
| 52 | 51 | |
| 53 | 52 | /** |
| 54 | - * Enqueue the frontend CSS | |
| 55 | - * @return void | |
| 56 | - */ | |
| 57 | - function enqueue_styles() { | |
| 58 | - | |
| 59 | - wp_register_style ( 'github-embed', plugins_url(basename(dirname(__FILE__)).'/css/github-embed.css' ) ); | |
| 60 | - wp_enqueue_style ( 'github-embed' ); | |
| 61 | - | |
| 62 | - } | |
| 63 | - | |
| 64 | - | |
| 65 | - | |
| 66 | - /** | |
| 67 | 53 | * Register the oEmbed provider, and point it at a local endpoint since github |
| 68 | 54 | * doesn't directly support oEmbed yet. Our local endpoint will use the github |
| 69 | 55 | * API to fulfil the request. |
| 70 | 56 | * @param array $providers The current list of providers |
| @@ -194,11 +180,10 @@ | ||
| 194 | 180 | $response->version = '1.0'; |
| 195 | 181 | $response->title = $repo->description; |
| 196 | 182 | |
| 197 | 183 | // @TODO This should all be templated |
| 198 | - $response->html = '<div class="github-embed github-embed-repository">'; | |
| 199 | - $response->html .= '<p><a href="'.esc_attr($repo->html_url).'" target="_blank"><strong>'.esc_html($repo->description)."</strong></a><br/>"; | |
| 200 | - $response->html .= '<a href="'.esc_attr($repo->html_url).'" target="_blank">'.esc_html($repo->html_url)."</a><br/>"; | |
| 184 | + $response->html = '<p><a href="'.esc_attr($repo->html_url).'" target="_blank"><strong>'.esc_html($repo->description)."</strong></a><br/>"; | |
| 185 | + $response->html .= esc_html($repo->html_url)."<br/>"; | |
| 201 | 186 | $response->html .= esc_html($repo->forks_count)." forks.<br/>"; |
| 202 | 187 | $response->html .= esc_html($repo->open_issues_count)." open issues.<br/>"; |
| 203 | 188 | |
| 204 | 189 | if ( count ( $commits ) ) { |
| @@ -224,9 +209,8 @@ | ||
| 224 | 209 | $response->html .= '</ul>'; |
| 225 | 210 | |
| 226 | 211 | } |
| 227 | 212 | $response->html .= '</p>'; |
| 228 | - $response->html .= '</div>'; | |
| 229 | 213 | |
| 230 | 214 | header ( 'Content-Type: application/json' ); |
| 231 | 215 | echo json_encode ( $response ); |
| 232 | 216 | die(); |
| @@ -262,13 +246,11 @@ | ||
| 262 | 246 | $response->version = '1.0'; |
| 263 | 247 | $response->title = $owner_info->name; |
| 264 | 248 | |
| 265 | 249 | // @TODO This should all be templated |
| 266 | - $response->html = '<div class="github-embed github-embed-user">'; | |
| 267 | - $response->html .= '<p><a href="https://github.com/'.esc_attr($owner).'" target="_blank"><strong>'.esc_html($owner)."</strong></a><br/>"; | |
| 250 | + $response->html = '<p><a href="https://github.com/'.esc_attr($owner).'" target="_blank"><strong>'.esc_html($owner)."</strong></a><br/>"; | |
| 268 | 251 | $response->html .= esc_html($owner_info->public_repos).' repositories, '; |
| 269 | 252 | $response->html .= esc_html($owner_info->followers).' followers.</p>'; |
| 270 | - $response->html .= '</div>'; | |
| 271 | 253 | |
| 272 | 254 | header ( 'Content-Type: application/json' ); |
| 273 | 255 | echo json_encode ( $response ); |
| 274 | 256 | die(); |