25 #require_once 'Zend/Text/Table.php'; 30 #require_once 'Zend/Text/MultiByte.php'; 75 protected $_allowedAligns = array(self::ALIGN_LEFT, self::ALIGN_CENTER, self::ALIGN_RIGHT);
91 if ($align !==
null) {
95 if ($colSpan !==
null) {
114 if (is_string(
$content) ===
false) {
115 #require_once 'Zend/Text/Table/Exception.php'; 119 if ($charset ===
null) {
122 $inputCharset = strtolower($charset);
127 if ($inputCharset !== $outputCharset) {
128 if (PHP_OS !==
'AIX') {
149 if (in_array($align, $this->_allowedAligns) ===
false) {
150 #require_once 'Zend/Text/Table/Exception.php'; 154 $this->_align = $align;
168 if (is_int($colSpan) ===
false or $colSpan < 1) {
169 #require_once 'Zend/Text/Table/Exception.php'; 173 $this->_colSpan = $colSpan;
197 public function render($columnWidth, $padding = 0)
199 if (is_int($columnWidth) ===
false or $columnWidth < 1) {
200 #require_once 'Zend/Text/Table/Exception.php'; 204 $columnWidth -= ($padding * 2);
206 if ($columnWidth < 1) {
207 #require_once 'Zend/Text/Table/Exception.php'; 211 switch ($this->_align) {
213 $padMode = STR_PAD_RIGHT;
217 $padMode = STR_PAD_BOTH;
221 $padMode = STR_PAD_LEFT;
231 $paddedLines = array();
233 foreach ($lines AS $line) {
234 $paddedLines[] = str_repeat(
' ', $padding)
236 . str_repeat(
' ', $padding);
239 $result = implode(
"\n", $paddedLines);
render($columnWidth, $padding=0)
setContent($content, $charset=null)
static wordWrap($string, $width=75, $break="\n", $cut=false, $charset='utf-8')
__construct($content=null, $align=null, $colSpan=null, $charset=null)
static getOutputCharset()
static strPad($input, $padLength, $padString=' ', $padType=STR_PAD_RIGHT, $charset='utf-8')