Link license abbreviations on the web site to real descriptions

This commit is contained in:
Ciaran Gultnieks 2012-03-09 15:16:47 +00:00
parent 2f7e662922
commit c1bf88a8a8

View file

@ -112,6 +112,31 @@ class FDroid
} }
// Get a URL for a full description of a license, as given by one of our
// pre-defined license abbreviations. This is a temporary function, as this
// needs to be data-driven so the same information can be used by the client,
// the web site and the documentation.
function getlicenseurl($license) {
switch($license) {
case 'MIT':
return 'http://www.gnu.org/licenses/license-list.html#X11';
case 'BSD':
return 'http://www.gnu.org/licenses/license-list.html#ModifiedBSD';
case 'GPLv3':
case 'GPLv3+':
return 'http://www.gnu.org/licenses/license-list.html#GNUGPL';
case 'GPLv2':
case 'GPLv2+':
return 'http://www.gnu.org/licenses/license-list.html#GPLv2';
case 'LGPL':
return 'http://www.gnu.org/licenses/license-list.html#LGPL';
case 'Apache2':
return 'http://www.gnu.org/licenses/license-list.html#apache2';
default:
return null;
}
}
function get_app($query_vars) { function get_app($query_vars) {
global $permissions_data; global $permissions_data;
$permissions_object = new AndroidPermissions($this->site_path.'/wp-content/plugins/wp-fdroid/AndroidManifest.xml', $permissions_object = new AndroidPermissions($this->site_path.'/wp-content/plugins/wp-fdroid/AndroidManifest.xml',
@ -231,7 +256,14 @@ class FDroid
} }
$out.="<p>"; $out.="<p>";
$out.="<b>License:</b> ".$license; $licenseurl=$this->getlicenseurl($license);
$out.="<b>License:</b> ";
if($licenseurl)
$out.='<a href="'.$licenseurl.'" target="_blank">';
$out.=$license;
if($licenseurl)
$out.='</a>';
if(isset($requirements)) { if(isset($requirements)) {
$out.='<br /><b>Additional requirements:</b> '.$requirements; $out.='<br /><b>Additional requirements:</b> '.$requirements;
} }