cvs: pearweb /include pear-database-package.php pear-format-html.php

From: Date: Sun, 13 Jan 2008 01:11:47 +0000
Subject: cvs: pearweb /include pear-database-package.php pear-format-html.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-50262@lists.php.net to get a copy of this message
dufuz Sun Jan 13 01:11:47 2008 UTC Modified files: /pearweb/include pear-database-package.php pear-format-html.php Log: Moving the license function to database-package since package-info.php is the only one using it atm http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-package.php?r1=1.7&r2=1.8&diff_format=u Index: pearweb/include/pear-database-package.php diff -u pearweb/include/pear-database-package.php:1.7 pearweb/include/pear-database-package.php:1.8 --- pearweb/include/pear-database-package.php:1.7 Tue Dec 18 17:47:16 2007 +++ pearweb/include/pear-database-package.php Sun Jan 13 01:11:47 2008 @@ -17,7 +17,7 @@ | Tomas V.V. Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-package.php,v 1.7 2007/12/18 17:47:16 wiesemann Exp $ + $Id: pear-database-package.php,v 1.8 2008/01/13 01:11:47 dufuz Exp $ */ /** @@ -897,6 +897,61 @@ { return make_link("/package/" . $name . "/", $name); } + + /** + * Get URL to license text + * + * @todo Add more licenses here + * @param string Name of the license + * @param boolean Direct link or htmled one + * @return string Link to license URL + */ + static function get_license_link($license = '', $plain = false) + { + switch ($license) { + case 'PHP License 3.01' : + case 'PHP License' : + case 'PHP 3.01' : + $link = 'http://www.php.net/license/3_01.txt'; + break; + + case 'PHP 2.02' : + $link = 'http://www.php.net/license/2_02.txt'; + break; + + case 'GPL' : + case 'GNU General Public License' : + $link = 'http://www.gnu.org/licenses/gpl.html'; + break; + + case 'LGPL' : + case 'GNU Lesser General Public License' : + $link = 'http://www.gnu.org/licenses/lgpl.html'; + break; + + case 'BSD' : + case 'BSD License' : + case 'New BSD License' : + case 'New BSD' : + $link = 'http://www.opensource.org/licenses/bsd-license.php'; + break; + + case 'MIT' : + case 'MIT License' : + $link = 'http://www.opensource.org/licenses/mit-license.php'; + break; + + default : + $link = ''; + break; + } + + if ($plain && $link != '') { + return $link; + } + + return ($link != '' ? '<a href="' . $link . '">' . $license . "</a>\n" : $license); + } } function version_compare_firstelem($a, $b) http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.246&r2=1.247&diff_format=u Index: pearweb/include/pear-format-html.php diff -u pearweb/include/pear-format-html.php:1.246 pearweb/include/pear-format-html.php:1.247 --- pearweb/include/pear-format-html.php:1.246 Sun Jan 13 00:55:16 2008 +++ pearweb/include/pear-format-html.php Sun Jan 13 01:11:47 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: pear-format-html.php,v 1.246 2008/01/13 00:55:16 dufuz Exp $ + $Id: pear-format-html.php,v 1.247 2008/01/13 01:11:47 dufuz Exp $ */ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler'); @@ -751,57 +751,6 @@ } /** - * Get URL to license text - * - * @todo Add more licenses here - * @param string Name of the license - * @return string Link to license URL - */ -function get_license_link($license = '') -{ - switch ($license) { - - case 'PHP License 3.01' : - case 'PHP License' : - case 'PHP 3.01' : - $link = 'http://www.php.net/license/3_01.txt'; - break; - - case 'PHP 2.02' : - $link = 'http://www.php.net/license/2_02.txt'; - break; - - case 'GPL' : - case 'GNU General Public License' : - $link = 'http://www.gnu.org/licenses/gpl.html'; - break; - - case 'LGPL' : - case 'GNU Lesser General Public License' : - $link = 'http://www.gnu.org/licenses/lgpl.html'; - break; - - case 'BSD' : - case 'BSD License' : - case 'New BSD License' : - case 'New BSD' : - $link = 'http://www.opensource.org/licenses/bsd-license.php'; - break; - - case 'MIT' : - case 'MIT License' : - $link = 'http://www.opensource.org/licenses/mit-license.php'; - break; - - default : - $link = ''; - break; - } - - return ($link != '' ? '<a href="' . $link . '">' . $license . "</a>\n" : $license); -} - -/** * Create link to the account information page and to the user's wishlist * * @param string User's handle

« previous php.pear.cvs (#50262) next »