mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 23:06:03 +03:00
Simplification of codepage code, and changing private methods to protected
This commit is contained in:
parent
4d5ad7b86e
commit
89ccb90e8d
@ -40,25 +40,22 @@ class CachedObjectStorage_APC extends CachedObjectStorage_CacheBase implements C
|
|||||||
/**
|
/**
|
||||||
* Prefix used to uniquely identify cache data for this worksheet
|
* Prefix used to uniquely identify cache data for this worksheet
|
||||||
*
|
*
|
||||||
* @access private
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cachePrefix = null;
|
protected $_cachePrefix = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout
|
* Cache timeout
|
||||||
*
|
*
|
||||||
* @access private
|
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_cacheTime = 600;
|
protected $_cacheTime = 600;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @access private
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws PHPExcel\Exception
|
* @throws PHPExcel\Exception
|
||||||
*/
|
*/
|
||||||
|
@ -52,7 +52,7 @@ class Cell_DataType
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $_errorCodes = array(
|
protected static $_errorCodes = array(
|
||||||
'#NULL!' => 0,
|
'#NULL!' => 0,
|
||||||
'#DIV/0!' => 1,
|
'#DIV/0!' => 1,
|
||||||
'#VALUE!' => 2,
|
'#VALUE!' => 2,
|
||||||
|
@ -67,111 +67,97 @@ class Cell_DataValidation
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_formula1;
|
protected $_formula1 = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formula 2
|
* Formula 2
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_formula2;
|
protected $_formula2 = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type
|
* Type
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_type = Cell_DataValidation::TYPE_NONE;
|
protected $_type = Cell_DataValidation::TYPE_NONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error style
|
* Error style
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_errorStyle = Cell_DataValidation::STYLE_STOP;
|
protected $_errorStyle = Cell_DataValidation::STYLE_STOP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator
|
* Operator
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_operator;
|
protected $_operator = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Blank
|
* Allow Blank
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_allowBlank;
|
protected $_allowBlank = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show DropDown
|
* Show DropDown
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showDropDown;
|
protected $_showDropDown = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show InputMessage
|
* Show InputMessage
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showInputMessage;
|
protected $_showInputMessage = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show ErrorMessage
|
* Show ErrorMessage
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $_showErrorMessage;
|
protected $_showErrorMessage = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error title
|
* Error title
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_errorTitle;
|
protected $_errorTitle = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error
|
* Error
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_error;
|
protected $_error = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt title
|
* Prompt title
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_promptTitle;
|
protected $_promptTitle = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt
|
* Prompt
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_prompt;
|
protected $_prompt = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel\Cell_DataValidation
|
* Create a new PHPExcel\Cell_DataValidation
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Initialise member variables
|
|
||||||
$this->_formula1 = '';
|
|
||||||
$this->_formula2 = '';
|
|
||||||
$this->_type = Cell_DataValidation::TYPE_NONE;
|
|
||||||
$this->_errorStyle = Cell_DataValidation::STYLE_STOP;
|
|
||||||
$this->_operator = '';
|
|
||||||
$this->_allowBlank = FALSE;
|
|
||||||
$this->_showDropDown = FALSE;
|
|
||||||
$this->_showInputMessage = FALSE;
|
|
||||||
$this->_showErrorMessage = FALSE;
|
|
||||||
$this->_errorTitle = '';
|
|
||||||
$this->_error = '';
|
|
||||||
$this->_promptTitle = '';
|
|
||||||
$this->_prompt = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,52 @@ namespace PHPExcel;
|
|||||||
*/
|
*/
|
||||||
class Shared_CodePage
|
class Shared_CodePage
|
||||||
{
|
{
|
||||||
|
protected static $_codepages = array(
|
||||||
|
case 367 => 'ASCII'; // ASCII
|
||||||
|
case 437 => 'CP437'; // OEM US
|
||||||
|
case 737 => 'CP737'; // OEM Greek
|
||||||
|
case 775 => 'CP775'; // OEM Baltic
|
||||||
|
case 850 => 'CP850'; // OEM Latin I
|
||||||
|
case 852 => 'CP852'; // OEM Latin II (Central European)
|
||||||
|
case 855 => 'CP855'; // OEM Cyrillic
|
||||||
|
case 857 => 'CP857'; // OEM Turkish
|
||||||
|
case 858 => 'CP858'; // OEM Multilingual Latin I with Euro
|
||||||
|
case 860 => 'CP860'; // OEM Portugese
|
||||||
|
case 861 => 'CP861'; // OEM Icelandic
|
||||||
|
case 862 => 'CP862'; // OEM Hebrew
|
||||||
|
case 863 => 'CP863'; // OEM Canadian (French)
|
||||||
|
case 864 => 'CP864'; // OEM Arabic
|
||||||
|
case 865 => 'CP865'; // OEM Nordic
|
||||||
|
case 866 => 'CP866'; // OEM Cyrillic (Russian)
|
||||||
|
case 869 => 'CP869'; // OEM Greek (Modern)
|
||||||
|
case 874 => 'CP874'; // ANSI Thai
|
||||||
|
case 932 => 'CP932'; // ANSI Japanese Shift-JIS
|
||||||
|
case 936 => 'CP936'; // ANSI Chinese Simplified GBK
|
||||||
|
case 949 => 'CP949'; // ANSI Korean (Wansung)
|
||||||
|
case 950 => 'CP950'; // ANSI Chinese Traditional BIG5
|
||||||
|
case 1200 => 'UTF-16LE'; // UTF-16 (BIFF8)
|
||||||
|
case 1250 => 'CP1250'; // ANSI Latin II (Central European)
|
||||||
|
case 1251 => 'CP1251'; // ANSI Cyrillic
|
||||||
|
case 0 => 'CP1252'; // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program, so default it
|
||||||
|
case 1252 => 'CP1252'; // ANSI Latin I (BIFF4-BIFF7)
|
||||||
|
case 1253 => 'CP1253'; // ANSI Greek
|
||||||
|
case 1254 => 'CP1254'; // ANSI Turkish
|
||||||
|
case 1255 => 'CP1255'; // ANSI Hebrew
|
||||||
|
case 1256 => 'CP1256'; // ANSI Arabic
|
||||||
|
case 1257 => 'CP1257'; // ANSI Baltic
|
||||||
|
case 1258 => 'CP1258'; // ANSI Vietnamese
|
||||||
|
case 1361 => 'CP1361'; // ANSI Korean (Johab)
|
||||||
|
case 10000 => 'MAC'; // Apple Roman
|
||||||
|
case 10006 => 'MACGREEK'; // Macintosh Greek
|
||||||
|
case 10007 => 'MACCYRILLIC'; // Macintosh Cyrillic
|
||||||
|
case 10029 => 'MACCENTRALEUROPE'; // Macintosh Central Europe
|
||||||
|
case 10079 => 'MACICELAND'; // Macintosh Icelandic
|
||||||
|
case 10081 => 'MACTURKISH'; // Macintosh Turkish
|
||||||
|
case 32768 => 'MAC'; // Apple Roman
|
||||||
|
case 65000 => 'UTF-7'; // Unicode (UTF-7)
|
||||||
|
case 65001 => 'UTF-8'; // Unicode (UTF-8)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert Microsoft Code Page Identifier to Code Page Name which iconv
|
* Convert Microsoft Code Page Identifier to Code Page Name which iconv
|
||||||
* and mbstring understands
|
* and mbstring understands
|
||||||
@ -48,53 +94,12 @@ class Shared_CodePage
|
|||||||
public static function NumberToName($codePage = 1252)
|
public static function NumberToName($codePage = 1252)
|
||||||
{
|
{
|
||||||
switch ($codePage) {
|
switch ($codePage) {
|
||||||
case 367: return 'ASCII'; break; // ASCII
|
case 720: throw new Exception('Code page 720 not supported.'); break; // OEM Arabic
|
||||||
case 437: return 'CP437'; break; // OEM US
|
case 32769: throw new Exception('Code page 32769 not supported.'); break; // ANSI Latin I (BIFF2-BIFF3)
|
||||||
case 720: throw new Exception('Code page 720 not supported.');
|
default:
|
||||||
break; // OEM Arabic
|
if isset(self::$_codepages[$codePage]) {
|
||||||
case 737: return 'CP737'; break; // OEM Greek
|
return self::$_codepages[$codePage];
|
||||||
case 775: return 'CP775'; break; // OEM Baltic
|
}
|
||||||
case 850: return 'CP850'; break; // OEM Latin I
|
|
||||||
case 852: return 'CP852'; break; // OEM Latin II (Central European)
|
|
||||||
case 855: return 'CP855'; break; // OEM Cyrillic
|
|
||||||
case 857: return 'CP857'; break; // OEM Turkish
|
|
||||||
case 858: return 'CP858'; break; // OEM Multilingual Latin I with Euro
|
|
||||||
case 860: return 'CP860'; break; // OEM Portugese
|
|
||||||
case 861: return 'CP861'; break; // OEM Icelandic
|
|
||||||
case 862: return 'CP862'; break; // OEM Hebrew
|
|
||||||
case 863: return 'CP863'; break; // OEM Canadian (French)
|
|
||||||
case 864: return 'CP864'; break; // OEM Arabic
|
|
||||||
case 865: return 'CP865'; break; // OEM Nordic
|
|
||||||
case 866: return 'CP866'; break; // OEM Cyrillic (Russian)
|
|
||||||
case 869: return 'CP869'; break; // OEM Greek (Modern)
|
|
||||||
case 874: return 'CP874'; break; // ANSI Thai
|
|
||||||
case 932: return 'CP932'; break; // ANSI Japanese Shift-JIS
|
|
||||||
case 936: return 'CP936'; break; // ANSI Chinese Simplified GBK
|
|
||||||
case 949: return 'CP949'; break; // ANSI Korean (Wansung)
|
|
||||||
case 950: return 'CP950'; break; // ANSI Chinese Traditional BIG5
|
|
||||||
case 1200: return 'UTF-16LE'; break; // UTF-16 (BIFF8)
|
|
||||||
case 1250: return 'CP1250'; break; // ANSI Latin II (Central European)
|
|
||||||
case 1251: return 'CP1251'; break; // ANSI Cyrillic
|
|
||||||
case 0: // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program
|
|
||||||
case 1252: return 'CP1252'; break; // ANSI Latin I (BIFF4-BIFF7)
|
|
||||||
case 1253: return 'CP1253'; break; // ANSI Greek
|
|
||||||
case 1254: return 'CP1254'; break; // ANSI Turkish
|
|
||||||
case 1255: return 'CP1255'; break; // ANSI Hebrew
|
|
||||||
case 1256: return 'CP1256'; break; // ANSI Arabic
|
|
||||||
case 1257: return 'CP1257'; break; // ANSI Baltic
|
|
||||||
case 1258: return 'CP1258'; break; // ANSI Vietnamese
|
|
||||||
case 1361: return 'CP1361'; break; // ANSI Korean (Johab)
|
|
||||||
case 10000: return 'MAC'; break; // Apple Roman
|
|
||||||
case 10006: return 'MACGREEK'; break; // Macintosh Greek
|
|
||||||
case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic
|
|
||||||
case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe
|
|
||||||
case 10079: return 'MACICELAND'; break; // Macintosh Icelandic
|
|
||||||
case 10081: return 'MACTURKISH'; break; // Macintosh Turkish
|
|
||||||
case 32768: return 'MAC'; break; // Apple Roman
|
|
||||||
case 32769: throw new Exception('Code page 32769 not supported.');
|
|
||||||
break; // ANSI Latin I (BIFF2-BIFF3)
|
|
||||||
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
|
|
||||||
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Unknown codepage: ' . $codePage);
|
throw new Exception('Unknown codepage: ' . $codePage);
|
||||||
|
@ -26,7 +26,7 @@ Develop: [![Build Status](https://travis-ci.org/PHPOffice/PHPExcel.png?branch=de
|
|||||||
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* PHP version 5.2.0 or higher
|
* PHP version 5.3.0 or higher
|
||||||
* PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
|
* PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
|
||||||
* PHP extension php_xml enabled
|
* PHP extension php_xml enabled
|
||||||
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.2.0",
|
"php": ">=5.3.0",
|
||||||
"ext-xml": "*"
|
"ext-xml": "*"
|
||||||
},
|
},
|
||||||
"recommend": {
|
"recommend": {
|
||||||
|
Loading…
Reference in New Issue
Block a user