From 50a0654cf6863e9e8e3c664723943ab20aa75b55 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Sep 2014 23:13:12 +0200 Subject: [PATCH] Make the download url method more re-usable/overloadable --- includes/Wpup/UpdateServer.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/Wpup/UpdateServer.php b/includes/Wpup/UpdateServer.php index ea6d333..fceceb4 100644 --- a/includes/Wpup/UpdateServer.php +++ b/includes/Wpup/UpdateServer.php @@ -224,15 +224,25 @@ protected function checkAuthorization($request) { } /** - * Create a download URL for a plugin. + * Create a download URL for a plugin based on a package object. * * @param Wpup_Package $package * @return string URL */ protected function generateDownloadUrl(Wpup_Package $package) { + return $this->getDownloadUrl($package->slug); + } + + /** + * Create a download URL for a plugin based on a slug. + * + * @param string $slug + * @return string URL + */ + public function getDownloadUrl($slug) { $query = array( 'action' => 'download', - 'slug' => $package->slug, + 'slug' => $slug, ); return self::addQueryArg($query, $this->serverUrl); }