getURIs(); foreach ($uris as $uri) { if ($uri->getIsDisabled()) { continue; } if ($uri->getEffectiveIoType() == PhabricatorRepositoryURI::IO_MIRROR && strpos($uri->getDisplayURI(), 'github') !== false) { return $uri; } } return false; } static function AddActionLinksToTop($repository, $identifier) { global $github_download_zip_button, $github_download_tar_button; $uri = self::getMirrorURI($repository); if (!$uri) { return; } $uri = $uri->getURI(); $github_download_zip_button = id(new PHUIButtonView()) ->setTag('a') ->setText(pht('Download zip (from Github)')) ->setColor(PHUIButtonView::GREEN) ->setIcon('fa-download') ->setHref($uri.'/archive/'.$identifier.'.zip'); $github_download_tar_button = id(new PHUIButtonView()) ->setTag('a') ->setText(pht('Download gz (from Github)')) ->setColor(PHUIButtonView::GREEN) ->setIcon('fa-download') ->setHref($uri.'/archive/'.$identifier.'.tar.gz'); } static function addActionsToTop($drequest) { $repository = $drequest->getRepository(); try { if ($drequest->getSymbolicType() == 'tag') { $download = $drequest->getSymbolicCommit(); } elseif ($drequest->getSymbolicType() == 'commit') { $download = $drequest->getStableCommit(); } else { $download = $drequest->getBranch(); } } catch(Exception $e) { return ''; } return self::AddActionLinksToTop($repository, $download); } }