import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Text_Table
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Column.php 12648 2008-11-14 15:46:12Z ralph $
|
||||
* @version $Id: Column.php 13556 2009-01-08 17:54:13Z dasprid $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -24,6 +24,11 @@
|
||||
*/
|
||||
require_once 'Zend/Text/Table.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Text_MultiByte
|
||||
*/
|
||||
require_once 'Zend/Text/MultiByte.php';
|
||||
|
||||
/**
|
||||
* Column class for Zend_Text_Table_Row
|
||||
*
|
||||
@ -61,7 +66,7 @@ class Zend_Text_Table_Column
|
||||
* @var integer
|
||||
*/
|
||||
protected $_colSpan = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Allowed align parameters
|
||||
*
|
||||
@ -116,15 +121,15 @@ class Zend_Text_Table_Column
|
||||
} else {
|
||||
$inputCharset = strtolower($charset);
|
||||
}
|
||||
|
||||
|
||||
$outputCharset = Zend_Text_Table::getOutputCharset();
|
||||
|
||||
|
||||
if ($inputCharset !== $outputCharset) {
|
||||
if (PHP_OS != 'AIX') {
|
||||
if (PHP_OS !== 'AIX') {
|
||||
// AIX does not understand these character sets
|
||||
$content = iconv($inputCharset, $outputCharset, $content);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->_content = $content;
|
||||
@ -195,9 +200,9 @@ class Zend_Text_Table_Column
|
||||
require_once 'Zend/Text/Table/Exception.php';
|
||||
throw new Zend_Text_Table_Exception('$columnWidth must be an integer and greater than 0');
|
||||
}
|
||||
|
||||
|
||||
$columnWidth -= ($padding * 2);
|
||||
|
||||
|
||||
if ($columnWidth < 1) {
|
||||
require_once 'Zend/Text/Table/Exception.php';
|
||||
throw new Zend_Text_Table_Exception('Padding (' . $padding . ') is greater than column width');
|
||||
@ -221,18 +226,18 @@ class Zend_Text_Table_Column
|
||||
break;
|
||||
}
|
||||
|
||||
$lines = explode("\n", wordwrap($this->_content, $columnWidth, "\n"));
|
||||
$paddedLines = array();
|
||||
$outputCharset = Zend_Text_Table::getOutputCharset();
|
||||
$lines = explode("\n", Zend_Text_MultiByte::wordWrap($this->_content, $columnWidth, "\n", true, $outputCharset));
|
||||
$paddedLines = array();
|
||||
|
||||
foreach ($lines AS $line) {
|
||||
$paddedLines[] = str_repeat(' ', $padding)
|
||||
. str_pad($line, $columnWidth, ' ', $padMode)
|
||||
. Zend_Text_MultiByte::strPad($line, $columnWidth, ' ', $padMode, $outputCharset)
|
||||
. str_repeat(' ', $padding);
|
||||
}
|
||||
|
||||
$result = implode("\n", $paddedLines);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user