<?php
/*
Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@version $Id: info.php,v 1.3 2004/01/29 14:09:16 ordnas Exp $
@copyright Copyright © 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
@license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
*/
// display functions
function zi_info_td($label, $content) {
if(!strlen(trim($content))){
$content = ' ';
}
$result = '<tr>';
$result .= '<td class="label-left">'.$label.'</td>';
$result .= '<td>'.$content.'</td>';
$result .= '</tr>';
return($result);
}
function zi_info_table($header, $content) {
$result =
'<table class="list">
<tr>
<th colspan="2">'.$header.'</th>
</tr>
'.$content.'
</table>';
return $result;
}
// filters text for mail addresses and urls
// and make it clickable
function zi_info_text($string) {
$string = htmlspecialchars($string);
$string = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=\"_blank\">\\0</a>", $string);
$string = eregi_replace("(([[:alnum:]]|[[:punct:]]|[^[:space:]]a-z)+)@([^[:space:]]+)((([[:alnum:]]|[[:punct:]])[^[:space:]])*)", "<a href=mailto:\\1@\\3>\\1@\\3</a>", $string );
return nl2br($string);
}
function zi_info_maintainers($maintainers)
{
$maintainers_str = '';
// compose maintainer_str
if(!is_array($maintainers) || !count($maintainers)) {
return false;
} else {
foreach($maintainers as $maintainer_s) {
$maintainers_str .= $maintainer_s["name"];
if(isset($maintainer_s["role"])>0) {
$maintainers_str .= ' ('.$maintainer_s["role"].')';
}
$maintainers_str .= '<br/> <<a href="mailto:'.$maintainer_s["email"].'">'.$maintainer_s["email"].'</a>><br/>';
}
}
return $maintainers_str;
}
function zi_info_copyrights($copyrights)
{
$copyright_str = '';
// compose copyright string
if(!is_array($copyrights) || !count($copyrights)) {
if(strlen($copyrights)){
return $copyrights;
}
return false;
} else {
foreach($copyrights as $copyright){
$copyright_str_part = $copyright['#'];
if(is_array($copyright['@'])) {
// add URL and version?
if(isset($copyright['@']['url'])) {
$copyright_str_part = '<a href="'.$copyright['@']['url'].'" target="_blank">'.$copyright_str_part.'</a>';
}
if(isset($copyright['@']['year'])) {
$copyright_str_part = $copyright['@']['year'].' '.$copyright_str_part;
}
$copyright_str_part = '© '.$copyright_str_part;
}
$copyright_str .= $copyright_str_part.'<br/>';
}
return $copyright_str;
}
}
function zi_info_licenses($licenses)
{
$license_str = '';
// compose license string
if(!is_array($licenses) || !count($licenses)) {
return false;
} else {
foreach($licenses as $license) {
if(isset($license['@']['url'])) {
$license_str .= '<a href="'.$license['@']['url'].'" target="_blank">';
}
$license_str .= $license['#'];
if(isset($license['@']['version'])) {
$license_str .= ' '.$license['@']['version'];
}
if(isset($license['@']['url'])) {
$license_str .= '</a>';
}
$license_str .= '<br/>';
}
return $license_str;
}
}
?>