Browse Source

Fix Contributor embeds to use correct API call

widget
Lee Willis 12 years ago
parent
commit
4437af5e91
  1. 2
      github-api.php
  2. 10
      github-embed.php

2
github-api.php

@ -167,7 +167,7 @@ class github_api {
$owner = trim( $owner, '/' ); $owner = trim( $owner, '/' );
$repo = trim( $repository, '/' ); $repo = trim( $repository, '/' );
$results = $this->call_api( "https://api.github.com/repos/$owner/$repository/collaborators" ); $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/stats/contributors" );
return json_decode( $results['body'] ); return json_decode( $results['body'] );

10
github-embed.php

@ -252,16 +252,12 @@ class github_embed {
foreach ( $contributors as $contributor ) { foreach ( $contributors as $contributor ) {
$details = $this->api->get_user ($contributor->login);
$response->html .= '<li class="github-repo-contributor">'; $response->html .= '<li class="github-repo-contributor">';
$response->html .= '<img class="github-repo-contributor-avatar" src="'; $response->html .= '<img class="github-repo-contributor-avatar" src="';
$response->html .= esc_url(add_query_arg(array('s'=>$gravatar_size), $contributor->avatar_url)); $response->html .= esc_url(add_query_arg(array('s'=>$gravatar_size), $contributor->author->avatar_url));
$response->html .= '" alt="Picture of '.esc_attr($contributor->login).'">'; $response->html .= '" alt="Picture of '.esc_attr($contributor->author->login).'">';
if ( ! empty ( $details->name ) ) {
$response->html .= '<span class="github-repo-contributor-name">'.esc_html($details->name)."</span><br>";
}
$response->html .= '<span class="github-repo-contributor-login">'; $response->html .= '<span class="github-repo-contributor-login">';
$response->html .= '<a href="https://github.com/'.esc_attr($contributor->login).'">'.esc_attr($contributor->login).'</a></span>'; $response->html .= '<a href="https://github.com/'.esc_attr($contributor->author->login).'">'.esc_attr($contributor->author->login).'</a></span>';
} }
$response->html .= '</ul>'; $response->html .= '</ul>';

Loading…
Cancel
Save