diff options
author | Tomas V.V.Cox <cox@php.net> | 2002-06-07 08:45:00 +0000 |
---|---|---|
committer | Tomas V.V.Cox <cox@php.net> | 2002-06-07 08:45:00 +0000 |
commit | c083784023ee1407af9dcbff0fc99f5e1dcbb05b (patch) | |
tree | 0a561f6987ecdce6375d3d631f1b79aeb56d67d6 /pear/PEAR/Command/Registry.php | |
parent | 9f46d24922bd04211a0f0c79848d0f2f0d7a2972 (diff) | |
download | php-git-c083784023ee1407af9dcbff0fc99f5e1dcbb05b.tar.gz |
Make "info" full human friendly (in deps list and lastmodified)
Diffstat (limited to 'pear/PEAR/Command/Registry.php')
-rw-r--r-- | pear/PEAR/Command/Registry.php | 37 |
1 files changed, 27 insertions, 10 deletions
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); } |