From 8f91fe381b141afe1e0cb3466372ca8713abefed Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Sat, 9 Feb 2013 17:32:46 +0000 Subject: [PATCH] Add stylesheet --- css/github-embed.css | 3 +++ github-embed.php | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 css/github-embed.css diff --git a/css/github-embed.css b/css/github-embed.css new file mode 100644 index 0000000..78a0bba --- /dev/null +++ b/css/github-embed.css @@ -0,0 +1,3 @@ +.github-embed { + padding: 0.5em 2em 0.5em 4em; +} diff --git a/github-embed.php b/github-embed.php index 84bcd90..2925d34 100644 --- a/github-embed.php +++ b/github-embed.php @@ -42,13 +42,28 @@ class github_embed { add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); - + add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); + // @TODO i18n } + /** + * Enqueue the frontend CSS + * @return void + */ + function enqueue_styles() { + + error_log ( __FUNCTION__ ); + wp_register_style ( 'github-embed', plugins_url(basename(dirname(__FILE__)).'/css/github-embed.css' ) ); + wp_enqueue_style ( 'github-embed' ); + + } + + + /** * Register the oEmbed provider, and point it at a local endpoint since github * doesn't directly support oEmbed yet. Our local endpoint will use the github @@ -181,7 +196,8 @@ class github_embed { $response->title = $repo->description; // @TODO This should all be templated - $response->html = '

'.esc_html($repo->description)."
"; + $response->html = '

'; + $response->html .= '

'.esc_html($repo->description)."
"; $response->html .= esc_html($repo->html_url)."
"; $response->html .= esc_html($repo->forks_count)." forks.
"; $response->html .= esc_html($repo->open_issues_count)." open issues.
"; @@ -210,6 +226,7 @@ class github_embed { } $response->html .= '

'; + $response->html .= '
'; header ( 'Content-Type: application/json' ); echo json_encode ( $response );