Modifications to folder structure, and re-organise a few classes into different folders; add bootstrap and PSR-4 autoloader; initial work on namespacing
This commit is contained in:
parent
73b80d392f
commit
fdcba9a90a
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Autoloader for PHPExcel classes
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel
|
||||||
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
class Autoloader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register the Autoloader with SPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function register() {
|
||||||
|
if (function_exists('__autoload')) {
|
||||||
|
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||||
|
spl_autoload_register('__autoload');
|
||||||
|
}
|
||||||
|
// Register ourselves with SPL
|
||||||
|
return spl_autoload_register(array('PHPExcel\Autoloader', 'load'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autoload a class identified by name
|
||||||
|
*
|
||||||
|
* @param string $className Name of the object to load
|
||||||
|
*/
|
||||||
|
public static function load($className) {
|
||||||
|
if ((class_exists($className, false)) || (strpos($className, 'PHPExcel\\') !== 0)) {
|
||||||
|
// Either already loaded, or not a PHPExcel class request
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
|
||||||
|
'src' . DIRECTORY_SEPARATOR .
|
||||||
|
str_replace(['PHPExcel\\', '\\'], ['', '/'], $className) .
|
||||||
|
'.php';
|
||||||
|
|
||||||
|
if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {
|
||||||
|
// Can't load
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
require($classFilePath);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Bootstrap for PHPExcel classes
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel
|
||||||
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once __DIR__ . '/Autoloader.php';
|
||||||
|
|
||||||
|
\PHPExcel\Autoloader::register();
|
|
@ -1,13 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
namespace PHPExcel;
|
||||||
if (!defined('PHPEXCEL_ROOT')) {
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
|
|
||||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
||||||
// Test for support of \P (multibyte options) in PCRE
|
// Test for support of \P (multibyte options) in PCRE
|
||||||
|
@ -25,7 +18,7 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Calculation (Multiton)
|
* PHPExcel\Calculation (Multiton)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
@ -49,7 +42,7 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) {
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation
|
class Calculation
|
||||||
{
|
{
|
||||||
/** Constants */
|
/** Constants */
|
||||||
/** Regular Expressions */
|
/** Regular Expressions */
|
||||||
|
@ -87,20 +80,20 @@ class PHPExcel_Calculation
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of the workbook this Calculation Engine is using
|
* Instance of the spreadsheet this Calculation Engine is using
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var PHPExcel
|
* @var PHPExcel
|
||||||
*/
|
*/
|
||||||
private $workbook;
|
private $spreadsheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of instances of the calculation engine that we've instantiated for individual workbooks
|
* List of instances of the calculation engine that we've instantiated for individual spreadsheets
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var PHPExcel_Calculation[]
|
* @var PHPExcel_Calculation[]
|
||||||
*/
|
*/
|
||||||
private static $workbookSets;
|
private static $spreadsheetSets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculation cache
|
* Calculation cache
|
||||||
|
@ -2068,7 +2061,7 @@ class PHPExcel_Calculation
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
private function __construct(PHPExcel $workbook = null)
|
private function __construct(PHPExcel $spreadsheet = null)
|
||||||
{
|
{
|
||||||
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
|
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
|
||||||
$this->savedPrecision = ini_get('precision');
|
$this->savedPrecision = ini_get('precision');
|
||||||
|
@ -2077,11 +2070,11 @@ class PHPExcel_Calculation
|
||||||
}
|
}
|
||||||
$this->delta = 1 * pow(10, -$setPrecision);
|
$this->delta = 1 * pow(10, -$setPrecision);
|
||||||
|
|
||||||
if ($workbook !== null) {
|
if ($spreadsheet !== null) {
|
||||||
self::$workbookSets[$workbook->getID()] = $this;
|
self::$spreadsheetSets[$spreadsheet->getID()] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->workbook = $workbook;
|
$this->spreadsheet = $spreadsheet;
|
||||||
$this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
|
$this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
|
||||||
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
|
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
|
||||||
}
|
}
|
||||||
|
@ -2109,17 +2102,17 @@ class PHPExcel_Calculation
|
||||||
* Get an instance of this class
|
* Get an instance of this class
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param PHPExcel $workbook Injected workbook for working with a PHPExcel object,
|
* @param PHPExcel $spreadsheet Injected spreadsheet for working with a PHPExcel object,
|
||||||
* or NULL to create a standalone claculation engine
|
* or NULL to create a standalone claculation engine
|
||||||
* @return PHPExcel_Calculation
|
* @return PHPExcel_Calculation
|
||||||
*/
|
*/
|
||||||
public static function getInstance(PHPExcel $workbook = null)
|
public static function getInstance(Spreadsheet $spreadsheet = null)
|
||||||
{
|
{
|
||||||
if ($workbook !== null) {
|
if ($spreadsheet !== null) {
|
||||||
if (isset(self::$workbookSets[$workbook->getID()])) {
|
if (isset(self::$spreadsheetSets[$spreadsheet->getID()])) {
|
||||||
return self::$workbookSets[$workbook->getID()];
|
return self::$spreadsheetSets[$spreadsheet->getID()];
|
||||||
}
|
}
|
||||||
return new PHPExcel_Calculation($workbook);
|
return new PHPExcel_Calculation($spreadsheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$instance) || (self::$instance === null)) {
|
if (!isset(self::$instance) || (self::$instance === null)) {
|
||||||
|
@ -2133,13 +2126,13 @@ class PHPExcel_Calculation
|
||||||
* Unset an instance of this class
|
* Unset an instance of this class
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param PHPExcel $workbook Injected workbook identifying the instance to unset
|
* @param PHPExcel $spreadsheet Injected spreadsheet identifying the instance to unset
|
||||||
*/
|
*/
|
||||||
public static function unsetInstance(PHPExcel $workbook = null)
|
public static function unsetInstance(PHPExcel $spreadsheet = null)
|
||||||
{
|
{
|
||||||
if ($workbook !== null) {
|
if ($spreadsheet !== null) {
|
||||||
if (isset(self::$workbookSets[$workbook->getID()])) {
|
if (isset(self::$spreadsheetSets[$spreadsheet->getID()])) {
|
||||||
unset(self::$workbookSets[$workbook->getID()]);
|
unset(self::$spreadsheetSets[$spreadsheet->getID()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2636,10 +2629,10 @@ class PHPExcel_Calculation
|
||||||
try {
|
try {
|
||||||
$result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
|
$result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
|
||||||
$cellAddress = array_pop($this->cellStack);
|
$cellAddress = array_pop($this->cellStack);
|
||||||
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
|
$this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
|
||||||
} catch (PHPExcel_Exception $e) {
|
} catch (PHPExcel_Exception $e) {
|
||||||
$cellAddress = array_pop($this->cellStack);
|
$cellAddress = array_pop($this->cellStack);
|
||||||
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
|
$this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
|
||||||
throw new PHPExcel_Calculation_Exception($e->getMessage());
|
throw new PHPExcel_Calculation_Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3611,7 +3604,7 @@ class PHPExcel_Calculation
|
||||||
}
|
}
|
||||||
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
|
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
|
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false);
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError('Unable to access Cell Reference');
|
return $this->raiseFormulaError('Unable to access Cell Reference');
|
||||||
}
|
}
|
||||||
|
@ -3725,14 +3718,14 @@ class PHPExcel_Calculation
|
||||||
if ($matches[2] > '') {
|
if ($matches[2] > '') {
|
||||||
$matches[2] = trim($matches[2], "\"'");
|
$matches[2] = trim($matches[2], "\"'");
|
||||||
if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
|
if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
|
||||||
// It's a Reference to an external workbook (not currently supported)
|
// It's a Reference to an external spreadsheet (not currently supported)
|
||||||
return $this->raiseFormulaError('Unable to access External Workbook');
|
return $this->raiseFormulaError('Unable to access External Workbook');
|
||||||
}
|
}
|
||||||
$matches[2] = trim($matches[2], "\"'");
|
$matches[2] = trim($matches[2], "\"'");
|
||||||
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
|
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
|
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false);
|
||||||
} else {
|
} else {
|
||||||
return $this->raiseFormulaError('Unable to access Cell Reference');
|
return $this->raiseFormulaError('Unable to access Cell Reference');
|
||||||
}
|
}
|
||||||
|
@ -3759,15 +3752,15 @@ class PHPExcel_Calculation
|
||||||
if ($matches[2] > '') {
|
if ($matches[2] > '') {
|
||||||
$matches[2] = trim($matches[2], "\"'");
|
$matches[2] = trim($matches[2], "\"'");
|
||||||
if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
|
if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
|
||||||
// It's a Reference to an external workbook (not currently supported)
|
// It's a Reference to an external spreadsheet (not currently supported)
|
||||||
return $this->raiseFormulaError('Unable to access External Workbook');
|
return $this->raiseFormulaError('Unable to access External Workbook');
|
||||||
}
|
}
|
||||||
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
||||||
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
|
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
|
||||||
if ($pCellParent !== null) {
|
if ($pCellParent !== null) {
|
||||||
$cellSheet = $this->workbook->getSheetByName($matches[2]);
|
$cellSheet = $this->spreadsheet->getSheetByName($matches[2]);
|
||||||
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
|
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
|
$cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false);
|
||||||
$pCell->attach($pCellParent);
|
$pCell->attach($pCellParent);
|
||||||
} else {
|
} else {
|
||||||
$cellValue = null;
|
$cellValue = null;
|
||||||
|
@ -4215,7 +4208,7 @@ class PHPExcel_Calculation
|
||||||
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||||
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
|
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
|
||||||
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
|
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
|
||||||
$pSheet = $this->workbook->getSheetByName($pSheetName);
|
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract range
|
// Extract range
|
||||||
|
@ -4273,7 +4266,7 @@ class PHPExcel_Calculation
|
||||||
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
|
||||||
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
|
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
|
||||||
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
|
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
|
||||||
$pSheet = $this->workbook->getSheetByName($pSheetName);
|
$pSheet = $this->spreadsheet->getSheetByName($pSheetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Named range?
|
// Named range?
|
|
@ -1,17 +1,17 @@
|
||||||
ChartDirector
|
ChartDirector
|
||||||
http://www.advsofteng.com/cdphp.html
|
http://www.advsofteng.com/cdphp.html
|
||||||
|
|
||||||
GraPHPite
|
GraPHPite
|
||||||
http://graphpite.sourceforge.net/
|
http://graphpite.sourceforge.net/
|
||||||
|
|
||||||
JpGraph
|
JpGraph
|
||||||
http://www.aditus.nu/jpgraph/
|
http://www.aditus.nu/jpgraph/
|
||||||
|
|
||||||
LibChart
|
LibChart
|
||||||
http://naku.dohcrew.com/libchart/pages/introduction/
|
http://naku.dohcrew.com/libchart/pages/introduction/
|
||||||
|
|
||||||
pChart
|
pChart
|
||||||
http://pchart.sourceforge.net/
|
http://pchart.sourceforge.net/
|
||||||
|
|
||||||
TeeChart
|
TeeChart
|
||||||
http://www.steema.com/products/teechart/overview.html
|
http://www.steema.com/products/teechart/overview.html
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_IComparable
|
* PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
|
@ -23,7 +25,7 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_IComparable
|
interface IComparable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue