Browse Source

Support for newer milestone URLs

widget
Lee Willis 8 years ago
parent
commit
16ab9719b6
  1. 2
      github-api.php
  2. 5
      github-embed.php

2
github-api.php

@ -150,7 +150,7 @@ class github_api {
$this->log( "get_repo_milestone_summary( $owner, $repository, $milestone )", GEDEBUG_CALL ); $this->log( "get_repo_milestone_summary( $owner, $repository, $milestone )", GEDEBUG_CALL );
$owner = trim( $owner, '/' ); $owner = trim( $owner, '/' );
$repo = trim( $repo, '/' ); $repo = trim( $repository, '/' );
$results = $this->call_api( "https://api.github.com/repos/$owner/$repository/milestones/$milestone" ); $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/milestones/$milestone" );

5
github-embed.php

@ -207,6 +207,11 @@ class github_embed {
$this->oembed_github_repo_milestone_summary ( $matches[1], $matches[2], $milestone ); $this->oembed_github_repo_milestone_summary ( $matches[1], $matches[2], $milestone );
} }
// New style milestone URL, e.g. https://github.com/example/example/milestone/1
} elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/milestone/([0-9]*)$#i', $url, $matches ) ) {
$this->oembed_github_repo_milestone_summary( $matches[1], $matches[2], $matches[3] );
// Repository // Repository
} elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/?$#i', $url, $matches ) && ! empty ( $matches[2] ) ) { } elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/?$#i', $url, $matches ) && ! empty ( $matches[2] ) ) {

Loading…
Cancel
Save