From 16ab9719b652d0ebd04c004af3d98f1375d1aa88 Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Wed, 22 Feb 2017 21:37:06 +0000 Subject: [PATCH] Support for newer milestone URLs --- github-api.php | 2 +- github-embed.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/github-api.php b/github-api.php index 92a3b43..92e894b 100644 --- a/github-api.php +++ b/github-api.php @@ -150,7 +150,7 @@ class github_api { $this->log( "get_repo_milestone_summary( $owner, $repository, $milestone )", GEDEBUG_CALL ); $owner = trim( $owner, '/' ); - $repo = trim( $repo, '/' ); + $repo = trim( $repository, '/' ); $results = $this->call_api( "https://api.github.com/repos/$owner/$repository/milestones/$milestone" ); diff --git a/github-embed.php b/github-embed.php index d2ba291..2b37c88 100644 --- a/github-embed.php +++ b/github-embed.php @@ -207,6 +207,11 @@ class github_embed { $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 } elseif ( preg_match ( '#https?://github.com/([^/]*)/([^/]*)/?$#i', $url, $matches ) && ! empty ( $matches[2] ) ) {