cvs: pear /PEAR_Size/Size Size.php Size_Factory.php Size_Output_html.php Size_Output_text.php /PEAR_Size/scripts pearsize.php

From: Date: Thu, 27 Mar 2008 22:42:40 +0000
Subject: cvs: pear /PEAR_Size/Size Size.php Size_Factory.php Size_Output_html.php Size_Output_text.php /PEAR_Size/scripts pearsize.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-51703@lists.php.net to get a copy of this message
kguest Thu Mar 27 22:42:40 2008 UTC Modified files: /pear/PEAR_Size/Size Size.php Size_Factory.php Size_Output_html.php Size_Output_text.php /pear/PEAR_Size/scripts pearsize.php Log: request #13441 - console output too long so set up callbacks for Console_Table

http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/Size/Size.php diff -u pear/PEAR_Size/Size/Size.php:1.7 pear/PEAR_Size/Size/Size.php:1.8 --- pear/PEAR_Size/Size/Size.php:1.7 Thu Mar 20 00:26:07 2008 +++ pear/PEAR_Size/Size/Size.php Thu Mar 27 22:42:40 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size.php,v 1.8 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -381,7 +381,7 @@ $this->_config = PEAR_Config::singleton(); $this->reg = $this->_config->getRegistry(); $this->_channels = array(); - $this->_all = false; + $this->_all = false; $this->_all_channels = false; $this->_verbose = false; $this->_readable = false; @@ -485,6 +485,8 @@ /** * set variables for analysing all channels. * + * @param bool $mode defaults to true. + * * @return void */ public function setAllChannels($mode = true) @@ -676,6 +678,11 @@ */ public function generateReport() { + if ($this->_verbose) { + $this->_driver->cols = 3; + } else { + $this->_driver->cols = 2; + } $indices = substr($this->search_roles, 1, strlen($this->search_roles) - 2); $details = explode("|", $indices); http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Factory.php?r1=1.7&r2=1.8&diff_format=u Index: pear/PEAR_Size/Size/Size_Factory.php diff -u pear/PEAR_Size/Size/Size_Factory.php:1.7 pear/PEAR_Size/Size/Size_Factory.php:1.8 --- pear/PEAR_Size/Size/Size_Factory.php:1.7 Thu Mar 27 22:26:39 2008 +++ pear/PEAR_Size/Size/Size_Factory.php Thu Mar 27 22:42:40 2008 @@ -9,7 +9,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.7 2008/03/27 22:26:39 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.8 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ @@ -21,7 +21,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.7 2008/03/27 22:26:39 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.8 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ interface PEAR_SIZE_Factory @@ -43,7 +43,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: $Id: Size_Factory.php,v 1.7 2008/03/27 22:26:39 kguest Exp $ + * @version CVS: $Id: Size_Factory.php,v 1.8 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ interface PEAR_Size_Output_Driver @@ -67,7 +67,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Factory.php,v 1.8 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_SIZE_OutputFactory implements PEAR_SIZE_Factory http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_html.php?r1=1.5&r2=1.6&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_html.php diff -u pear/PEAR_Size/Size/Size_Output_html.php:1.5 pear/PEAR_Size/Size/Size_Output_html.php:1.6 --- pear/PEAR_Size/Size/Size_Output_html.php:1.5 Sun Mar 16 23:15:16 2008 +++ pear/PEAR_Size/Size/Size_Output_html.php Thu Mar 27 22:42:40 2008 @@ -9,7 +9,7 @@ * @author Ken Guest <ken@linux.ie> * @copyright 2008 Ken Guest * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Output_html.php,v 1.6 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "HTML/Table.php"; @@ -21,7 +21,7 @@ * @uses HTML_Table * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Output_html.php,v 1.6 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ class PEAR_Size_HTML_Table extends HTML_Table @@ -48,10 +48,10 @@ * @uses PEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Output_html.php,v 1.6 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ -class PEAR_Size_Output_html implements PEAR_Size_Output_Driver +class PEAR_Size_Output_Html implements PEAR_Size_Output_Driver { /** * display given text. http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/Size/Size_Output_text.php?r1=1.4&r2=1.5&diff_format=u Index: pear/PEAR_Size/Size/Size_Output_text.php diff -u pear/PEAR_Size/Size/Size_Output_text.php:1.4 pear/PEAR_Size/Size/Size_Output_text.php:1.5 --- pear/PEAR_Size/Size/Size_Output_text.php:1.4 Sun Mar 16 23:15:16 2008 +++ pear/PEAR_Size/Size/Size_Output_text.php Thu Mar 27 22:42:40 2008 @@ -8,7 +8,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Output_text.php,v 1.5 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ require_once "Console/Table.php"; @@ -20,11 +20,57 @@ * @uses iPEAR_Size_Output_Driver * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: Size_Output_text.php,v 1.5 2008/03/27 22:42:40 kguest Exp $ * @link http://pear.php.net/package/PEAR_Size */ -class PEAR_Size_Output_text implements PEAR_Size_Output_Driver +class PEAR_Size_Output_Text implements PEAR_Size_Output_Driver { + + /** + * Filter callback for Console_Table - limit name column to a certain length + * + * @param string $data Content for the Name column + * + * @return string + */ + function _splitName($data) + { + if (strlen($data) <= 42) { + $value = str_pad($data, 42); + } else { + $value = '...' . substr($data, (strlen($data) - 39)); + } + return $value; + } + + /** + * Filter callback for Console_Table - limit size column to a certain length + * + * @param string $data Content for the Size column + * + * @return string + */ + function _splitSize($data) + { + return str_pad($data, 8, ' '); + } + + /** + * Filter callback for Console_Table - limit detail column to a certain length + * + * @param string $data Content for the Detail column + * + * @return string + */ + function _splitDetail($data) + { + $str = str_replace('(', '', $data); + $str = str_replace(')', '', $str); + $str = str_replace('; ', "\r\n", $str); + $str = rtrim($str, "\r\n"); + return $str; + } + /** * display given text. * @@ -46,6 +92,15 @@ public function table() { $tbl = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT); + //set up filters for limiting widths of columns inside the table + $filter0 = array($this, '_splitName'); + $tbl->addFilter(0, $filter0); + $filter1 = array($this, '_splitSize'); + $tbl->addFilter(1, $filter1); + if ($this->cols == 3) { + $filter2 = array($this, '_splitDetail'); + $tbl->addFilter(2, $filter2); + } return $tbl; } } http://cvs.php.net/viewvc.cgi/pear/PEAR_Size/scripts/pearsize.php?r1=1.5&r2=1.6&diff_format=u Index: pear/PEAR_Size/scripts/pearsize.php diff -u pear/PEAR_Size/scripts/pearsize.php:1.5 pear/PEAR_Size/scripts/pearsize.php:1.6 --- pear/PEAR_Size/scripts/pearsize.php:1.5 Thu Mar 20 00:26:07 2008 +++ pear/PEAR_Size/scripts/pearsize.php Thu Mar 27 22:42:40 2008 @@ -11,7 +11,7 @@ * @package PEAR_Size * @author Ken Guest <ken@linux.ie> * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) - * @version CVS: <cvs_id> + * @version CVS: $Id: pearsize.php,v 1.6 2008/03/27 22:42:40 kguest Exp $ * @link pearsize.php * * $ pearsize --all
« previous php.pear.cvs (#51703) next »