import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
147
libs/Zend/Text/Table/Decorator/Ascii.php
Normal file
147
libs/Zend/Text/Table/Decorator/Ascii.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @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: Ascii.php 12529 2008-11-10 21:05:43Z dasprid $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Text_Table_Decorator_Interface
|
||||
*/
|
||||
require_once 'Zend/Text/Table/Decorator/Interface.php';
|
||||
|
||||
/**
|
||||
* ASCII Decorator for Zend_Text_Table
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Text_Table
|
||||
* @uses Zend_Text_Table_Decorator_Interface
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Text_Table_Decorator_Ascii implements Zend_Text_Table_Decorator_Interface
|
||||
{
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopLeft()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopRight()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomLeft()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomRight()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVertical()
|
||||
{
|
||||
return '|';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontal()
|
||||
{
|
||||
return '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCross()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalRight()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalLeft()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalDown()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalUp()
|
||||
{
|
||||
return '+';
|
||||
}
|
||||
}
|
108
libs/Zend/Text/Table/Decorator/Interface.php
Normal file
108
libs/Zend/Text/Table/Decorator/Interface.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @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: Interface.php 12529 2008-11-10 21:05:43Z dasprid $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for Zend_Text_Table decorators
|
||||
*
|
||||
* @category Zend
|
||||
* @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
|
||||
*/
|
||||
interface Zend_Text_Table_Decorator_Interface
|
||||
{
|
||||
/**
|
||||
* Get a single character for the top left corner
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopLeft();
|
||||
|
||||
/**
|
||||
* Get a single character for the top right corner
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopRight();
|
||||
|
||||
/**
|
||||
* Get a single character for the bottom left corner
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomLeft();
|
||||
|
||||
/**
|
||||
* Get a single character for the bottom right corner
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomRight();
|
||||
|
||||
/**
|
||||
* Get a single character for a vertical line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVertical();
|
||||
|
||||
/**
|
||||
* Get a single character for a horizontal line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontal();
|
||||
|
||||
/**
|
||||
* Get a single character for a crossing line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCross();
|
||||
|
||||
/**
|
||||
* Get a single character for a vertical divider right
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalRight();
|
||||
|
||||
/**
|
||||
* Get a single character for a vertical divider left
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalLeft();
|
||||
|
||||
/**
|
||||
* Get a single character for a horizontal divider down
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalDown();
|
||||
|
||||
/**
|
||||
* Get a single character for a horizontal divider up
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalUp();
|
||||
}
|
176
libs/Zend/Text/Table/Decorator/Unicode.php
Normal file
176
libs/Zend/Text/Table/Decorator/Unicode.php
Normal file
@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @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: Unicode.php 12529 2008-11-10 21:05:43Z dasprid $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Text_Table_Decorator_Interface
|
||||
*/
|
||||
require_once 'Zend/Text/Table/Decorator/Interface.php';
|
||||
|
||||
/**
|
||||
* Unicode Decorator for Zend_Text_Table
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Text_Table
|
||||
* @uses Zend_Text_Table_Decorator_Interface
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Text_Table_Decorator_Unicode implements Zend_Text_Table_Decorator_Interface
|
||||
{
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopLeft()
|
||||
{
|
||||
return $this->_uniChar(0x250C);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopRight()
|
||||
{
|
||||
return $this->_uniChar(0x2510);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomLeft()
|
||||
{
|
||||
return $this->_uniChar(0x2514);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomRight()
|
||||
{
|
||||
return $this->_uniChar(0x2518);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVertical()
|
||||
{
|
||||
return $this->_uniChar(0x2502);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontal()
|
||||
{
|
||||
return $this->_uniChar(0x2500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCross()
|
||||
{
|
||||
return $this->_uniChar(0x253C);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalRight()
|
||||
{
|
||||
return $this->_uniChar(0x251C);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVerticalLeft()
|
||||
{
|
||||
return $this->_uniChar(0x2524);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalDown()
|
||||
{
|
||||
return $this->_uniChar(0x252C);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Text_Table_Decorator_Interface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHorizontalUp()
|
||||
{
|
||||
return $this->_uniChar(0x2534);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert am unicode character code to a character
|
||||
*
|
||||
* @param integer $code
|
||||
* @return string|false
|
||||
*/
|
||||
protected function _uniChar($code)
|
||||
{
|
||||
if ($code <= 0x7F) {
|
||||
$char = chr($code);
|
||||
} else if ($code <= 0x7FF) {
|
||||
$char = chr(0xC0 | $code >> 6)
|
||||
. chr(0x80 | $code & 0x3F);
|
||||
} else if ($code <= 0xFFFF) {
|
||||
$char = chr(0xE0 | $code >> 12)
|
||||
. chr(0x80 | $code >> 6 & 0x3F)
|
||||
. chr(0x80 | $code & 0x3F);
|
||||
} else if ($code <= 0x10FFFF) {
|
||||
$char = chr(0xF0 | $code >> 18)
|
||||
. chr(0x80 | $code >> 12 & 0x3F)
|
||||
. chr(0x80 | $code >> 6 & 0x3F)
|
||||
. chr(0x80 | $code & 0x3F);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $char;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user