From c083784023ee1407af9dcbff0fc99f5e1dcbb05b Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Fri, 7 Jun 2002 08:45:00 +0000 Subject: Make "info" full human friendly (in deps list and lastmodified) --- pear/PEAR/Command/Registry.php | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'pear/PEAR') diff --git a/pear/PEAR/Command/Registry.php b/pear/PEAR/Command/Registry.php index 779e5634bc..bb12d1ecff 100644 --- a/pear/PEAR/Command/Registry.php +++ b/pear/PEAR/Command/Registry.php @@ -258,16 +258,27 @@ installed package.' $i = 0; $dstr = ''; foreach ($info[$key] as $d) { - if ($i++ > 0) { - $dstr .= ", "; - } if (isset($this->_deps_rel_trans[$d['rel']])) { - $d['rel'] = $this->_deps_rel_trans[$d['rel']]; + $rel = $this->_deps_rel_trans[$d['rel']]; + } else { + $rel = $d['rel']; + } + + if (isset($this->_deps_type_trans[$d['type']])) { + $type = ucfirst($this->_deps_type_trans[$d['type']]); + } else { + $type = $d['type']; + } + + if (isset($d['name'])) { + $name = $d['name'] . ' '; } - $dstr .= "$d[type] $d[rel]"; if (isset($d['version'])) { - $dstr .= " $d[version]"; + $version = $d['version']; + } else { + $version = ''; } + $dstr .= "$type $name$rel $version\n"; } $info[$key] = $dstr; break; @@ -278,9 +289,15 @@ installed package.' } } } - $info[$key] = trim($info[$key]); - if (in_array($key, $longtext)) { - $info[$key] = preg_replace('/ +/', ' ', $info[$key]); + if ($key == '_lastmodified') { + $hdate = date('Y-m-d', $info[$key]); + unset($info[$key]); + $info['Last Modified'] = $hdate; + } else { + $info[$key] = trim($info[$key]); + if (in_array($key, $longtext)) { + $info[$key] = preg_replace('/ +/', ' ', $info[$key]); + } } } $caption = 'About ' . $info['package'] . '-' . $info['version']; @@ -288,7 +305,7 @@ installed package.' 'caption' => $caption, 'border' => true); foreach ($info as $key => $value) { - $key = ucwords(str_replace('_', ' ', $key)); + $key = ucwords(trim(str_replace('_', ' ', $key))); $data['data'][] = array($key, $value); } -- cgit v1.2.1