From: Ciaran Gultnieks Date: Fri, 9 Mar 2012 15:16:47 +0000 (+0000) Subject: Link license abbreviations on the web site to real descriptions X-Git-Tag: 0.1~855 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c1bf88a8a8d8b94928fa6eadab01bd4745aaaa65;p=fdroidserver.git Link license abbreviations on the web site to real descriptions --- diff --git a/wp-fdroid/wp-fdroid.php b/wp-fdroid/wp-fdroid.php index 21bc3e8c..94225694 100644 --- a/wp-fdroid/wp-fdroid.php +++ b/wp-fdroid/wp-fdroid.php @@ -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) { global $permissions_data; $permissions_object = new AndroidPermissions($this->site_path.'/wp-content/plugins/wp-fdroid/AndroidManifest.xml', @@ -231,7 +256,14 @@ class FDroid } $out.="

"; - $out.="License: ".$license; + $licenseurl=$this->getlicenseurl($license); + $out.="License: "; + if($licenseurl) + $out.=''; + $out.=$license; + if($licenseurl) + $out.=''; + if(isset($requirements)) { $out.='
Additional requirements: '.$requirements; }