mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 23:06:03 +03:00
Close to the end of the psr-2 work, just trends to go
This commit is contained in:
parent
c4ff34dde4
commit
85692956a7
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Shared_String
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
@ -24,15 +25,6 @@
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Shared_String
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_String
|
||||
{
|
||||
/** Constants */
|
||||
@ -46,60 +38,60 @@ class PHPExcel_Shared_String
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_controlCharacters = array();
|
||||
private static $controlCharacters = array();
|
||||
|
||||
/**
|
||||
* SYLK Characters array
|
||||
*
|
||||
* $var array
|
||||
*/
|
||||
private static $_SYLKCharacters = array();
|
||||
private static $SYLKCharacters = array();
|
||||
|
||||
/**
|
||||
* Decimal separator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_decimalSeparator;
|
||||
private static $decimalSeparator;
|
||||
|
||||
/**
|
||||
* Thousands separator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_thousandsSeparator;
|
||||
private static $thousandsSeparator;
|
||||
|
||||
/**
|
||||
* Currency code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_currencyCode;
|
||||
private static $currencyCode;
|
||||
|
||||
/**
|
||||
* Is mbstring extension avalable?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private static $_isMbstringEnabled;
|
||||
private static $isMbstringEnabled;
|
||||
|
||||
/**
|
||||
* Is iconv extension avalable?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private static $_isIconvEnabled;
|
||||
private static $isIconvEnabled;
|
||||
|
||||
/**
|
||||
* Build control characters array
|
||||
*/
|
||||
private static function _buildControlCharacters()
|
||||
private static function buildControlCharacters()
|
||||
{
|
||||
for ($i = 0; $i <= 31; ++$i) {
|
||||
if ($i != 9 && $i != 10 && $i != 13) {
|
||||
$find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
|
||||
$replace = chr($i);
|
||||
self::$_controlCharacters[$find] = $replace;
|
||||
self::$controlCharacters[$find] = $replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,9 +99,9 @@ class PHPExcel_Shared_String
|
||||
/**
|
||||
* Build SYLK characters array
|
||||
*/
|
||||
private static function _buildSYLKCharacters()
|
||||
private static function buildSYLKCharacters()
|
||||
{
|
||||
self::$_SYLKCharacters = array(
|
||||
self::$SYLKCharacters = array(
|
||||
"\x1B 0" => chr(0),
|
||||
"\x1B 1" => chr(1),
|
||||
"\x1B 2" => chr(2),
|
||||
@ -276,14 +268,14 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function getIsMbstringEnabled()
|
||||
{
|
||||
if (isset(self::$_isMbstringEnabled)) {
|
||||
return self::$_isMbstringEnabled;
|
||||
if (isset(self::$isMbstringEnabled)) {
|
||||
return self::$isMbstringEnabled;
|
||||
}
|
||||
|
||||
self::$_isMbstringEnabled = function_exists('mb_convert_encoding') ?
|
||||
self::$isMbstringEnabled = function_exists('mb_convert_encoding') ?
|
||||
true : false;
|
||||
|
||||
return self::$_isMbstringEnabled;
|
||||
return self::$isMbstringEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -293,47 +285,47 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function getIsIconvEnabled()
|
||||
{
|
||||
if (isset(self::$_isIconvEnabled)) {
|
||||
return self::$_isIconvEnabled;
|
||||
if (isset(self::$isIconvEnabled)) {
|
||||
return self::$isIconvEnabled;
|
||||
}
|
||||
|
||||
// Fail if iconv doesn't exist
|
||||
if (!function_exists('iconv')) {
|
||||
self::$_isIconvEnabled = false;
|
||||
self::$isIconvEnabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
|
||||
if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
|
||||
self::$_isIconvEnabled = false;
|
||||
self::$isIconvEnabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
|
||||
// we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
|
||||
if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
|
||||
self::$_isIconvEnabled = false;
|
||||
self::$isIconvEnabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// CUSTOM: IBM AIX iconv() does not work
|
||||
if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
|
||||
self::$_isIconvEnabled = false;
|
||||
self::$isIconvEnabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we reach here no problems were detected with iconv
|
||||
self::$_isIconvEnabled = true;
|
||||
self::$isIconvEnabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function buildCharacterSets()
|
||||
{
|
||||
if (empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
if (empty(self::$controlCharacters)) {
|
||||
self::buildControlCharacters();
|
||||
}
|
||||
if (empty(self::$_SYLKCharacters)) {
|
||||
self::_buildSYLKCharacters();
|
||||
if (empty(self::$SYLKCharacters)) {
|
||||
self::buildSYLKCharacters();
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +345,7 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function ControlCharacterOOXML2PHP($value = '')
|
||||
{
|
||||
return str_replace(array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value);
|
||||
return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -372,7 +364,7 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function ControlCharacterPHP2OOXML($value = '')
|
||||
{
|
||||
return str_replace(array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value);
|
||||
return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -701,17 +693,17 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function getDecimalSeparator()
|
||||
{
|
||||
if (!isset(self::$_decimalSeparator)) {
|
||||
if (!isset(self::$decimalSeparator)) {
|
||||
$localeconv = localeconv();
|
||||
self::$_decimalSeparator = ($localeconv['decimal_point'] != '')
|
||||
self::$decimalSeparator = ($localeconv['decimal_point'] != '')
|
||||
? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
|
||||
|
||||
if (self::$_decimalSeparator == '') {
|
||||
if (self::$decimalSeparator == '') {
|
||||
// Default to .
|
||||
self::$_decimalSeparator = '.';
|
||||
self::$decimalSeparator = '.';
|
||||
}
|
||||
}
|
||||
return self::$_decimalSeparator;
|
||||
return self::$decimalSeparator;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -722,7 +714,7 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function setDecimalSeparator($pValue = '.')
|
||||
{
|
||||
self::$_decimalSeparator = $pValue;
|
||||
self::$decimalSeparator = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -733,17 +725,17 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function getThousandsSeparator()
|
||||
{
|
||||
if (!isset(self::$_thousandsSeparator)) {
|
||||
if (!isset(self::$thousandsSeparator)) {
|
||||
$localeconv = localeconv();
|
||||
self::$_thousandsSeparator = ($localeconv['thousands_sep'] != '')
|
||||
self::$thousandsSeparator = ($localeconv['thousands_sep'] != '')
|
||||
? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
|
||||
|
||||
if (self::$_thousandsSeparator == '') {
|
||||
if (self::$thousandsSeparator == '') {
|
||||
// Default to .
|
||||
self::$_thousandsSeparator = ',';
|
||||
self::$thousandsSeparator = ',';
|
||||
}
|
||||
}
|
||||
return self::$_thousandsSeparator;
|
||||
return self::$thousandsSeparator;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -754,7 +746,7 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function setThousandsSeparator($pValue = ',')
|
||||
{
|
||||
self::$_thousandsSeparator = $pValue;
|
||||
self::$thousandsSeparator = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -765,17 +757,17 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function getCurrencyCode()
|
||||
{
|
||||
if (!isset(self::$_currencyCode)) {
|
||||
if (!isset(self::$currencyCode)) {
|
||||
$localeconv = localeconv();
|
||||
self::$_currencyCode = ($localeconv['currency_symbol'] != '')
|
||||
self::$currencyCode = ($localeconv['currency_symbol'] != '')
|
||||
? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
|
||||
|
||||
if (self::$_currencyCode == '') {
|
||||
if (self::$currencyCode == '') {
|
||||
// Default to $
|
||||
self::$_currencyCode = '$';
|
||||
self::$currencyCode = '$';
|
||||
}
|
||||
}
|
||||
return self::$_currencyCode;
|
||||
return self::$currencyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -786,7 +778,7 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
public static function setCurrencyCode($pValue = '$')
|
||||
{
|
||||
self::$_currencyCode = $pValue;
|
||||
self::$currencyCode = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -802,7 +794,7 @@ class PHPExcel_Shared_String
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
foreach (self::$_SYLKCharacters as $k => $v) {
|
||||
foreach (self::$SYLKCharacters as $k => $v) {
|
||||
$pValue = str_replace($k, $v, $pValue);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class PHPExcel_Shared_TimeZone
|
||||
* @private
|
||||
* @var string
|
||||
*/
|
||||
protected static $_timezone = 'UTC';
|
||||
protected static $timezone = 'UTC';
|
||||
|
||||
/**
|
||||
* Validate a Timezone name
|
||||
@ -67,11 +67,11 @@ class PHPExcel_Shared_TimeZone
|
||||
public static function setTimeZone($timezone)
|
||||
{
|
||||
if (self::_validateTimezone($timezone)) {
|
||||
self::$_timezone = $timezone;
|
||||
self::$timezone = $timezone;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} // function setTimezone()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -81,8 +81,8 @@ class PHPExcel_Shared_TimeZone
|
||||
*/
|
||||
public static function getTimeZone()
|
||||
{
|
||||
return self::$_timezone;
|
||||
} // function getTimezone()
|
||||
return self::$timezone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -92,7 +92,7 @@ class PHPExcel_Shared_TimeZone
|
||||
* @param integer $timestamp PHP date/time value for finding the current transition
|
||||
* @return array The current transition details
|
||||
*/
|
||||
private static function _getTimezoneTransitions($objTimezone, $timestamp)
|
||||
private static function getTimezoneTransitions($objTimezone, $timestamp)
|
||||
{
|
||||
$allTransitions = $objTimezone->getTransitions();
|
||||
$transitions = array();
|
||||
@ -125,7 +125,7 @@ class PHPExcel_Shared_TimeZone
|
||||
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
|
||||
}
|
||||
} else {
|
||||
$timezone = self::$_timezone;
|
||||
$timezone = self::$timezone;
|
||||
}
|
||||
|
||||
if ($timezone == 'UST') {
|
||||
@ -136,7 +136,7 @@ class PHPExcel_Shared_TimeZone
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
$transitions = $objTimezone->getTransitions($timestamp, $timestamp);
|
||||
} else {
|
||||
$transitions = self::_getTimezoneTransitions($objTimezone, $timestamp);
|
||||
$transitions = self::getTimezoneTransitions($objTimezone, $timestamp);
|
||||
}
|
||||
|
||||
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
|
||||
|
@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
if (!defined('DATE_W3C')) {
|
||||
define('DATE_W3C', 'Y-m-d\TH:i:sP');
|
||||
}
|
||||
|
||||
if (!defined('DEBUGMODE_ENABLED')) {
|
||||
define('DEBUGMODE_ENABLED', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel_Shared_XMLWriter
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
@ -24,22 +33,6 @@
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
if (!defined('DATE_W3C')) {
|
||||
define('DATE_W3C', 'Y-m-d\TH:i:sP');
|
||||
}
|
||||
|
||||
if (!defined('DEBUGMODE_ENABLED')) {
|
||||
define('DEBUGMODE_ENABLED', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Shared_XMLWriter
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||
{
|
||||
/** Temporary storage method */
|
||||
@ -51,7 +44,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_tempFileName = '';
|
||||
private $tempFileName = '';
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Shared_XMLWriter instance
|
||||
@ -69,10 +62,10 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||
if ($pTemporaryStorageFolder === null) {
|
||||
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
}
|
||||
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||
$this->tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||
|
||||
// Open storage
|
||||
if ($this->openUri($this->_tempFileName) === false) {
|
||||
if ($this->openUri($this->tempFileName) === false) {
|
||||
// Fallback to memory...
|
||||
$this->openMemory();
|
||||
}
|
||||
@ -90,8 +83,8 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||
public function __destruct()
|
||||
{
|
||||
// Unlink temporary files
|
||||
if ($this->_tempFileName != '') {
|
||||
@unlink($this->_tempFileName);
|
||||
if ($this->tempFileName != '') {
|
||||
@unlink($this->tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,11 +95,11 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
if ($this->_tempFileName == '') {
|
||||
if ($this->tempFileName == '') {
|
||||
return $this->outputMemory(true);
|
||||
} else {
|
||||
$this->flush();
|
||||
return file_get_contents($this->_tempFileName);
|
||||
return file_get_contents($this->tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,14 +43,14 @@ class PHPExcel_Shared_ZipArchive
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_tempDir;
|
||||
private $tempDir;
|
||||
|
||||
/**
|
||||
* Zip Archive Stream Handle
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_zip;
|
||||
private $zip;
|
||||
|
||||
|
||||
/**
|
||||
@ -61,9 +61,8 @@ class PHPExcel_Shared_ZipArchive
|
||||
*/
|
||||
public function open($fileName)
|
||||
{
|
||||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
|
||||
$this->_zip = new PclZip($fileName);
|
||||
$this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
$this->zip = new PclZip($fileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -88,16 +87,16 @@ class PHPExcel_Shared_ZipArchive
|
||||
{
|
||||
$filenameParts = pathinfo($localname);
|
||||
|
||||
$handle = fopen($this->_tempDir.'/'.$filenameParts["basename"], "wb");
|
||||
$handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb");
|
||||
fwrite($handle, $contents);
|
||||
fclose($handle);
|
||||
|
||||
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
|
||||
$res = $this->zip->add($this->tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
|
||||
if ($res == 0) {
|
||||
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
||||
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->zip->errorInfo(true));
|
||||
}
|
||||
|
||||
unlink($this->_tempDir.'/'.$filenameParts["basename"]);
|
||||
unlink($this->tempDir.'/'.$filenameParts["basename"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +107,7 @@ class PHPExcel_Shared_ZipArchive
|
||||
*/
|
||||
public function locateName($fileName)
|
||||
{
|
||||
$list = $this->_zip->listContent();
|
||||
$list = $this->zip->listContent();
|
||||
$listCount = count($list);
|
||||
$list_index = -1;
|
||||
for ($i = 0; $i < $listCount; ++$i) {
|
||||
@ -129,7 +128,7 @@ class PHPExcel_Shared_ZipArchive
|
||||
*/
|
||||
public function getFromName($fileName)
|
||||
{
|
||||
$list = $this->_zip->listContent();
|
||||
$list = $this->zip->listContent();
|
||||
$listCount = count($list);
|
||||
$list_index = -1;
|
||||
for ($i = 0; $i < $listCount; ++$i) {
|
||||
@ -142,7 +141,7 @@ class PHPExcel_Shared_ZipArchive
|
||||
|
||||
$extracted = "";
|
||||
if ($list_index != -1) {
|
||||
$extracted = $this->_zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
$extracted = $this->zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
} else {
|
||||
$filename = substr($fileName, 1);
|
||||
$list_index = -1;
|
||||
@ -153,7 +152,7 @@ class PHPExcel_Shared_ZipArchive
|
||||
break;
|
||||
}
|
||||
}
|
||||
$extracted = $this->_zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
$extracted = $this->zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
}
|
||||
if ((is_array($extracted)) && ($extracted != 0)) {
|
||||
$contents = $extracted[0]["content"];
|
||||
|
@ -32,28 +32,28 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*
|
||||
* @var ZipArchive
|
||||
*/
|
||||
private $_archive;
|
||||
private $archive;
|
||||
|
||||
/**
|
||||
* Filename in ZipAcrhive
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_fileNameInArchive = '';
|
||||
private $fileNameInArchive = '';
|
||||
|
||||
/**
|
||||
* Position in file
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_position = 0;
|
||||
private $position = 0;
|
||||
|
||||
/**
|
||||
* Data
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $_data = '';
|
||||
private $data = '';
|
||||
|
||||
/**
|
||||
* Register wrapper
|
||||
@ -85,12 +85,12 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
$url['fragment'] = substr($path, $pos + 1);
|
||||
|
||||
// Open archive
|
||||
$this->_archive = new ZipArchive();
|
||||
$this->_archive->open($url['host']);
|
||||
$this->archive = new ZipArchive();
|
||||
$this->archive->open($url['host']);
|
||||
|
||||
$this->_fileNameInArchive = $url['fragment'];
|
||||
$this->_position = 0;
|
||||
$this->_data = $this->_archive->getFromName($this->_fileNameInArchive);
|
||||
$this->fileNameInArchive = $url['fragment'];
|
||||
$this->position = 0;
|
||||
$this->data = $this->archive->getFromName($this->fileNameInArchive);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -102,7 +102,7 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function statName()
|
||||
{
|
||||
return $this->_fileNameInArchive;
|
||||
return $this->fileNameInArchive;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +112,7 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function url_stat()
|
||||
{
|
||||
return $this->statName($this->_fileNameInArchive);
|
||||
return $this->statName($this->fileNameInArchive);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,7 +122,7 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function stream_stat()
|
||||
{
|
||||
return $this->_archive->statName($this->_fileNameInArchive);
|
||||
return $this->archive->statName($this->fileNameInArchive);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,8 +133,8 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function stream_read($count)
|
||||
{
|
||||
$ret = substr($this->_data, $this->_position, $count);
|
||||
$this->_position += strlen($ret);
|
||||
$ret = substr($this->data, $this->position, $count);
|
||||
$this->position += strlen($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->_position;
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
*/
|
||||
public function stream_eof()
|
||||
{
|
||||
return $this->_position >= strlen($this->_data);
|
||||
return $this->position >= strlen($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,8 +170,8 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
{
|
||||
switch ($whence) {
|
||||
case SEEK_SET:
|
||||
if ($offset < strlen($this->_data) && $offset >= 0) {
|
||||
$this->_position = $offset;
|
||||
if ($offset < strlen($this->data) && $offset >= 0) {
|
||||
$this->position = $offset;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -179,15 +179,15 @@ class PHPExcel_Shared_ZipStreamWrapper
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
if ($offset >= 0) {
|
||||
$this->_position += $offset;
|
||||
$this->position += $offset;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SEEK_END:
|
||||
if (strlen($this->_data) + $offset >= 0) {
|
||||
$this->_position = strlen($this->_data) + $offset;
|
||||
if (strlen($this->data) + $offset >= 0) {
|
||||
$this->position = strlen($this->data) + $offset;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -46,77 +46,77 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name;
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_description;
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $_worksheet;
|
||||
protected $worksheet;
|
||||
|
||||
/**
|
||||
* Coordinates
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_coordinates;
|
||||
protected $coordinates;
|
||||
|
||||
/**
|
||||
* Offset X
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetX;
|
||||
protected $offsetX;
|
||||
|
||||
/**
|
||||
* Offset Y
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_offsetY;
|
||||
protected $offsetY;
|
||||
|
||||
/**
|
||||
* Width
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_width;
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Height
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_height;
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Proportional resize
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_resizeProportional;
|
||||
protected $resizeProportional;
|
||||
|
||||
/**
|
||||
* Rotation
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_rotation;
|
||||
protected $rotation;
|
||||
|
||||
/**
|
||||
* Shadow
|
||||
*
|
||||
* @var PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
protected $_shadow;
|
||||
protected $shadow;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_BaseDrawing
|
||||
@ -124,17 +124,17 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_name = '';
|
||||
$this->_description = '';
|
||||
$this->_worksheet = null;
|
||||
$this->_coordinates = 'A1';
|
||||
$this->_offsetX = 0;
|
||||
$this->_offsetY = 0;
|
||||
$this->_width = 0;
|
||||
$this->_height = 0;
|
||||
$this->_resizeProportional = true;
|
||||
$this->_rotation = 0;
|
||||
$this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
||||
$this->name = '';
|
||||
$this->description = '';
|
||||
$this->worksheet = null;
|
||||
$this->coordinates = 'A1';
|
||||
$this->offsetX = 0;
|
||||
$this->offsetY = 0;
|
||||
$this->width = 0;
|
||||
$this->height = 0;
|
||||
$this->resizeProportional = true;
|
||||
$this->rotation = 0;
|
||||
$this->shadow = new PHPExcel_Worksheet_Drawing_Shadow();
|
||||
|
||||
// Set image index
|
||||
self::$imageCounter++;
|
||||
@ -158,7 +158,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +169,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setName($pValue = '')
|
||||
{
|
||||
$this->_name = $pValue;
|
||||
$this->name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,7 +191,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setDescription($pValue = '')
|
||||
{
|
||||
$this->_description = $pValue;
|
||||
$this->description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getWorksheet()
|
||||
{
|
||||
return $this->_worksheet;
|
||||
return $this->worksheet;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -215,20 +215,20 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
|
||||
{
|
||||
if (is_null($this->_worksheet)) {
|
||||
if (is_null($this->worksheet)) {
|
||||
// Add drawing to PHPExcel_Worksheet
|
||||
$this->_worksheet = $pValue;
|
||||
$this->_worksheet->getCell($this->_coordinates);
|
||||
$this->_worksheet->getDrawingCollection()->append($this);
|
||||
$this->worksheet = $pValue;
|
||||
$this->worksheet->getCell($this->coordinates);
|
||||
$this->worksheet->getDrawingCollection()->append($this);
|
||||
} else {
|
||||
if ($pOverrideOld) {
|
||||
// Remove drawing from old PHPExcel_Worksheet
|
||||
$iterator = $this->_worksheet->getDrawingCollection()->getIterator();
|
||||
$iterator = $this->worksheet->getDrawingCollection()->getIterator();
|
||||
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
||||
$this->_worksheet->getDrawingCollection()->offsetUnset($iterator->key());
|
||||
$this->_worksheet = null;
|
||||
$this->worksheet->getDrawingCollection()->offsetUnset($iterator->key());
|
||||
$this->worksheet = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->_coordinates;
|
||||
return $this->coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,7 +260,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setCoordinates($pValue = 'A1')
|
||||
{
|
||||
$this->_coordinates = $pValue;
|
||||
$this->coordinates = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getOffsetX()
|
||||
{
|
||||
return $this->_offsetX;
|
||||
return $this->offsetX;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,7 +282,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setOffsetX($pValue = 0)
|
||||
{
|
||||
$this->_offsetX = $pValue;
|
||||
$this->offsetX = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getOffsetY()
|
||||
{
|
||||
return $this->_offsetY;
|
||||
return $this->offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -304,7 +304,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setOffsetY($pValue = 0)
|
||||
{
|
||||
$this->_offsetY = $pValue;
|
||||
$this->offsetY = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,13 +327,13 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
public function setWidth($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
|
||||
$this->_height = round($ratio * $pValue);
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->height / ($this->width != 0 ? $this->width : 1);
|
||||
$this->height = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set width
|
||||
$this->_width = $pValue;
|
||||
$this->width = $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -345,7 +345,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -357,13 +357,13 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
public function setHeight($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
|
||||
$this->_width = round($ratio * $pValue);
|
||||
if ($this->resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->width / ($this->height != 0 ? $this->height : 1);
|
||||
$this->width = round($ratio * $pValue);
|
||||
}
|
||||
|
||||
// Set height
|
||||
$this->_height = $pValue;
|
||||
$this->height = $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -383,19 +383,19 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setWidthAndHeight($width = 0, $height = 0)
|
||||
{
|
||||
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
|
||||
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
|
||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->_height) < $height) {
|
||||
$this->_height = ceil($xratio * $this->_height);
|
||||
$this->_width = $width;
|
||||
$xratio = $width / ($this->width != 0 ? $this->width : 1);
|
||||
$yratio = $height / ($this->height != 0 ? $this->height : 1);
|
||||
if ($this->resizeProportional && !($width == 0 || $height == 0)) {
|
||||
if (($xratio * $this->height) < $height) {
|
||||
$this->height = ceil($xratio * $this->height);
|
||||
$this->width = $width;
|
||||
} else {
|
||||
$this->_width = ceil($yratio * $this->_width);
|
||||
$this->_height = $height;
|
||||
$this->width = ceil($yratio * $this->width);
|
||||
$this->height = $height;
|
||||
}
|
||||
} else {
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -408,7 +408,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getResizeProportional()
|
||||
{
|
||||
return $this->_resizeProportional;
|
||||
return $this->resizeProportional;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -419,7 +419,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setResizeProportional($pValue = true)
|
||||
{
|
||||
$this->_resizeProportional = $pValue;
|
||||
$this->resizeProportional = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getRotation()
|
||||
{
|
||||
return $this->_rotation;
|
||||
return $this->rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -441,7 +441,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setRotation($pValue = 0)
|
||||
{
|
||||
$this->_rotation = $pValue;
|
||||
$this->rotation = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function getShadow()
|
||||
{
|
||||
return $this->_shadow;
|
||||
return $this->shadow;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -464,7 +464,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*/
|
||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
|
||||
{
|
||||
$this->_shadow = $pValue;
|
||||
$this->shadow = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -476,16 +476,16 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->_name .
|
||||
$this->_description .
|
||||
$this->_worksheet->getHashCode() .
|
||||
$this->_coordinates .
|
||||
$this->_offsetX .
|
||||
$this->_offsetY .
|
||||
$this->_width .
|
||||
$this->_height .
|
||||
$this->_rotation .
|
||||
$this->_shadow->getHashCode() .
|
||||
$this->name .
|
||||
$this->description .
|
||||
$this->worksheet->getHashCode() .
|
||||
$this->coordinates .
|
||||
$this->offsetX .
|
||||
$this->offsetY .
|
||||
$this->width .
|
||||
$this->height .
|
||||
$this->rotation .
|
||||
$this->shadow->getHashCode() .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
||||
if (file_exists($pValue)) {
|
||||
$this->path = $pValue;
|
||||
|
||||
if ($this->_width == 0 && $this->_height == 0) {
|
||||
if ($this->width == 0 && $this->height == 0) {
|
||||
// Get width/height
|
||||
list($this->_width, $this->_height) = getimagesize($pValue);
|
||||
list($this->width, $this->height) = getimagesize($pValue);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception("File $pValue not found!");
|
||||
|
@ -104,8 +104,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
|
||||
if (!is_null($this->imageResource)) {
|
||||
// Get width/height
|
||||
$this->_width = imagesx($this->imageResource);
|
||||
$this->_height = imagesy($this->imageResource);
|
||||
$this->width = imagesx($this->imageResource);
|
||||
$this->height = imagesy($this->imageResource);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user