Modifying private visibility to protected in order to provide better extensibility

This commit is contained in:
Mark Baker 2013-06-21 23:31:29 +01:00
parent 11e33b2307
commit 5b921af905
13 changed files with 105 additions and 109 deletions

View File

@ -155,18 +155,17 @@ class Autoloader
*/ */
public function loadClass($className) public function loadClass($className)
{ {
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) { if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
$fileName = ''; $fileName = '';
$namespace = ''; $namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos); $namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1); $className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
} }
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; $fileName = str_replace(array('\\','_'), DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; }
}
} }
} }

View File

@ -29,15 +29,15 @@ namespace PHPExcel;
/** PHPOffice root directory */ /** PHPOffice root directory */
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/'); define('PHPEXCEL_ROOT', dirname(__FILE__));
} }
include PHPEXCEL_ROOT . 'Autoloader.php'; include PHPEXCEL_ROOT . '/Autoloader.php';
$autoloader = new Autoloader('PHPExcel', PHPEXCEL_ROOT); $autoloader = new Autoloader('PHPExcel', PHPEXCEL_ROOT);
$autoloader->register(); $autoloader->register();
// As we always try to run the autoloader before anything else, we can use it to do a few // As we always run the bootstrap before anything else, we can use it to do a few
// simple checks and initialisations // simple checks and initialisations
// check mbstring.func_overload // check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) { if (ini_get('mbstring.func_overload') & 2) {
@ -45,4 +45,3 @@ if (ini_get('mbstring.func_overload') & 2) {
} }
Shared_String::buildCharacterSets(); Shared_String::buildCharacterSets();

View File

@ -50,14 +50,14 @@ class Cell
* *
* @var PHPExcel\Cell_IValueBinder * @var PHPExcel\Cell_IValueBinder
*/ */
private static $_valueBinder = NULL; protected static $_valueBinder = NULL;
/** /**
* Value of the cell * Value of the cell
* *
* @var mixed * @var mixed
*/ */
private $_value; protected $_value;
/** /**
* Calculated value of the cell (used for caching) * Calculated value of the cell (used for caching)
@ -69,34 +69,34 @@ class Cell
* *
* @var mixed * @var mixed
*/ */
private $_calculatedValue = NULL; protected $_calculatedValue = NULL;
/** /**
* Type of the cell data * Type of the cell data
* *
* @var string * @var string
*/ */
private $_dataType; protected $_dataType;
/** /**
* Parent worksheet * Parent worksheet
* *
* @var PHPExcel\CachedObjectStorage_CacheBase * @var PHPExcel\CachedObjectStorage_CacheBase
*/ */
private $_parent; protected $_parent;
/** /**
* Index to cellXf * Index to cellXf
* *
* @var int * @var int
*/ */
private $_xfIndex; protected $_xfIndex;
/** /**
* Attributes of the formula * Attributes of the formula
* *
*/ */
private $_formulaAttributes; protected $_formulaAttributes;
/** /**

View File

@ -42,63 +42,63 @@ class Comment implements IComparable
* *
* @var string * @var string
*/ */
private $_author; protected $_author;
/** /**
* Rich text comment * Rich text comment
* *
* @var PHPExcel\RichText * @var PHPExcel\RichText
*/ */
private $_text; protected $_text;
/** /**
* Comment width (CSS style, i.e. XXpx or YYpt) * Comment width (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_width = '96pt'; protected $_width = '96pt';
/** /**
* Left margin (CSS style, i.e. XXpx or YYpt) * Left margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginLeft = '59.25pt'; protected $_marginLeft = '59.25pt';
/** /**
* Top margin (CSS style, i.e. XXpx or YYpt) * Top margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginTop = '1.5pt'; protected $_marginTop = '1.5pt';
/** /**
* Visible * Visible
* *
* @var boolean * @var boolean
*/ */
private $_visible = false; protected $_visible = false;
/** /**
* Comment height (CSS style, i.e. XXpx or YYpt) * Comment height (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_height = '55.5pt'; protected $_height = '55.5pt';
/** /**
* Comment fill color * Comment fill color
* *
* @var PHPExcel\Style_Color * @var PHPExcel\Style_Color
*/ */
private $_fillColor; protected $_fillColor;
/** /**
* Alignment * Alignment
* *
* @var string * @var string
*/ */
private $_alignment; protected $_alignment;
/** /**
* Create a new PHPExcel\Comment * Create a new PHPExcel\Comment

View File

@ -50,84 +50,84 @@ class DocumentProperties
* *
* @var string * @var string
*/ */
private $_creator = 'Unknown Creator'; protected $_creator = 'Unknown Creator';
/** /**
* LastModifiedBy * LastModifiedBy
* *
* @var string * @var string
*/ */
private $_lastModifiedBy; protected $_lastModifiedBy;
/** /**
* Created * Created
* *
* @var datetime * @var datetime
*/ */
private $_created; protected $_created;
/** /**
* Modified * Modified
* *
* @var datetime * @var datetime
*/ */
private $_modified; protected $_modified;
/** /**
* Title * Title
* *
* @var string * @var string
*/ */
private $_title = 'Untitled Spreadsheet'; protected $_title = 'Untitled Spreadsheet';
/** /**
* Description * Description
* *
* @var string * @var string
*/ */
private $_description = ''; protected $_description = '';
/** /**
* Subject * Subject
* *
* @var string * @var string
*/ */
private $_subject = ''; protected $_subject = '';
/** /**
* Keywords * Keywords
* *
* @var string * @var string
*/ */
private $_keywords = ''; protected $_keywords = '';
/** /**
* Category * Category
* *
* @var string * @var string
*/ */
private $_category = ''; protected $_category = '';
/** /**
* Manager * Manager
* *
* @var string * @var string
*/ */
private $_manager = ''; protected $_manager = '';
/** /**
* Company * Company
* *
* @var string * @var string
*/ */
private $_company = 'Microsoft Corporation'; protected $_company = 'Microsoft Corporation';
/** /**
* Custom Properties * Custom Properties
* *
* @var string * @var string
*/ */
private $_customProperties = array(); protected $_customProperties = array();
/** /**

View File

@ -42,35 +42,35 @@ class DocumentSecurity
* *
* @var boolean * @var boolean
*/ */
private $_lockRevision; protected $_lockRevision;
/** /**
* LockStructure * LockStructure
* *
* @var boolean * @var boolean
*/ */
private $_lockStructure; protected $_lockStructure;
/** /**
* LockWindows * LockWindows
* *
* @var boolean * @var boolean
*/ */
private $_lockWindows; protected $_lockWindows;
/** /**
* RevisionsPassword * RevisionsPassword
* *
* @var string * @var string
*/ */
private $_revisionsPassword; protected $_revisionsPassword;
/** /**
* WorkbookPassword * WorkbookPassword
* *
* @var string * @var string
*/ */
private $_workbookPassword; protected $_workbookPassword;
/** /**
* Create a new PHPExcel\DocumentSecurity * Create a new PHPExcel\DocumentSecurity

View File

@ -41,10 +41,9 @@ class IOFactory
* Search locations * Search locations
* *
* @var array * @var array
* @access private
* @static * @static
*/ */
private static $_searchLocations = array( protected static $_searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'Writer_{0}' ), array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'Reader_{0}' ) array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'Reader_{0}' )
); );
@ -53,10 +52,9 @@ class IOFactory
* Autoresolve classes * Autoresolve classes
* *
* @var array * @var array
* @access private
* @static * @static
*/ */
private static $_autoResolveClasses = array( protected static $_autoResolveClasses = array(
'Excel2007', 'Excel2007',
'Excel5', 'Excel5',
'Excel2003XML', 'Excel2003XML',

View File

@ -42,35 +42,35 @@ class NamedRange
* *
* @var string * @var string
*/ */
private $_name; protected $_name;
/** /**
* Worksheet on which the named range can be resolved * Worksheet on which the named range can be resolved
* *
* @var PHPExcel\Worksheet * @var PHPExcel\Worksheet
*/ */
private $_worksheet; protected $_worksheet;
/** /**
* Range of the referenced cells * Range of the referenced cells
* *
* @var string * @var string
*/ */
private $_range; protected $_range;
/** /**
* Is the named range local? (i.e. can only be used on $this->_worksheet) * Is the named range local? (i.e. can only be used on $this->_worksheet)
* *
* @var bool * @var bool
*/ */
private $_localOnly; protected $_localOnly;
/** /**
* Scope * Scope
* *
* @var PHPExcel\Worksheet * @var PHPExcel\Worksheet
*/ */
private $_scope; protected $_scope;
/** /**
* Create a new NamedRange * Create a new NamedRange

View File

@ -110,7 +110,7 @@ class Reader_HTML extends Reader_Abstract implements Reader_IReader
{ {
// Reading 2048 bytes should be enough to validate that the format is HTML // Reading 2048 bytes should be enough to validate that the format is HTML
$data = fread($this->_fileHandle, 2048); $data = fread($this->_fileHandle, 2048);
if ((strpos('<',$data) !== FALSE) && if ((strpos($data, '<') !== FALSE) &&
(strlen($data) !== strlen(strip_tags($data)))) { (strlen($data) !== strlen(strip_tags($data)))) {
return TRUE; return TRUE;
} }

View File

@ -42,7 +42,7 @@ class RichText implements IComparable
* *
* @var PHPExcel\RichText_ITextElement[] * @var PHPExcel\RichText_ITextElement[]
*/ */
private $_richTextElements; protected $_richTextElements;
/** /**
* Create a new PHPExcel\RichText instance * Create a new PHPExcel\RichText instance

View File

@ -44,11 +44,11 @@ class Settings
const PDF_RENDERER_MPDF = 'mPDF'; const PDF_RENDERER_MPDF = 'mPDF';
private static $_chartRenderers = array( protected static $_chartRenderers = array(
self::CHART_RENDERER_JPGRAPH, self::CHART_RENDERER_JPGRAPH,
); );
private static $_pdfRenderers = array( protected static $_pdfRenderers = array(
self::PDF_RENDERER_TCPDF, self::PDF_RENDERER_TCPDF,
self::PDF_RENDERER_DOMPDF, self::PDF_RENDERER_DOMPDF,
self::PDF_RENDERER_MPDF, self::PDF_RENDERER_MPDF,
@ -62,7 +62,7 @@ class Settings
* *
* @var string * @var string
*/ */
private static $_zipClass = self::ZIPARCHIVE; protected static $_zipClass = self::ZIPARCHIVE;
/** /**
@ -72,14 +72,14 @@ class Settings
* *
* @var string * @var string
*/ */
private static $_chartRendererName = NULL; protected static $_chartRendererName = NULL;
/** /**
* Directory Path to the external Library used for rendering charts * Directory Path to the external Library used for rendering charts
* *
* @var string * @var string
*/ */
private static $_chartRendererPath = NULL; protected static $_chartRendererPath = NULL;
/** /**
@ -89,14 +89,14 @@ class Settings
* *
* @var string * @var string
*/ */
private static $_pdfRendererName = NULL; protected static $_pdfRendererName = NULL;
/** /**
* Directory Path to the external Library used for rendering PDF files * Directory Path to the external Library used for rendering PDF files
* *
* @var string * @var string
*/ */
private static $_pdfRendererPath = NULL; protected static $_pdfRendererPath = NULL;
/** /**

View File

@ -52,280 +52,280 @@ class Worksheet implements IComparable
* *
* @var array * @var array
*/ */
private static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']'); protected static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']');
/** /**
* Parent spreadsheet * Parent spreadsheet
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_parent; protected $_parent;
/** /**
* Cacheable collection of cells * Cacheable collection of cells
* *
* @var PHPExcel\CachedObjectStorage_xxx * @var PHPExcel\CachedObjectStorage_xxx
*/ */
private $_cellCollection = null; protected $_cellCollection = null;
/** /**
* Collection of row dimensions * Collection of row dimensions
* *
* @var PHPExcel\Worksheet_RowDimension[] * @var PHPExcel\Worksheet_RowDimension[]
*/ */
private $_rowDimensions = array(); protected $_rowDimensions = array();
/** /**
* Default row dimension * Default row dimension
* *
* @var PHPExcel\Worksheet_RowDimension * @var PHPExcel\Worksheet_RowDimension
*/ */
private $_defaultRowDimension = null; protected $_defaultRowDimension = null;
/** /**
* Collection of column dimensions * Collection of column dimensions
* *
* @var PHPExcel\Worksheet_ColumnDimension[] * @var PHPExcel\Worksheet_ColumnDimension[]
*/ */
private $_columnDimensions = array(); protected $_columnDimensions = array();
/** /**
* Default column dimension * Default column dimension
* *
* @var PHPExcel\Worksheet_ColumnDimension * @var PHPExcel\Worksheet_ColumnDimension
*/ */
private $_defaultColumnDimension = null; protected $_defaultColumnDimension = null;
/** /**
* Collection of drawings * Collection of drawings
* *
* @var PHPExcel\Worksheet_BaseDrawing[] * @var PHPExcel\Worksheet_BaseDrawing[]
*/ */
private $_drawingCollection = null; protected $_drawingCollection = null;
/** /**
* Collection of Chart objects * Collection of Chart objects
* *
* @var PHPExcel\Chart[] * @var PHPExcel\Chart[]
*/ */
private $_chartCollection = array(); protected $_chartCollection = array();
/** /**
* Worksheet title * Worksheet title
* *
* @var string * @var string
*/ */
private $_title; protected $_title;
/** /**
* Sheet state * Sheet state
* *
* @var string * @var string
*/ */
private $_sheetState; protected $_sheetState;
/** /**
* Page setup * Page setup
* *
* @var PHPExcel\Worksheet_PageSetup * @var PHPExcel\Worksheet_PageSetup
*/ */
private $_pageSetup; protected $_pageSetup;
/** /**
* Page margins * Page margins
* *
* @var PHPExcel\Worksheet_PageMargins * @var PHPExcel\Worksheet_PageMargins
*/ */
private $_pageMargins; protected $_pageMargins;
/** /**
* Page header/footer * Page header/footer
* *
* @var PHPExcel\Worksheet_HeaderFooter * @var PHPExcel\Worksheet_HeaderFooter
*/ */
private $_headerFooter; protected $_headerFooter;
/** /**
* Sheet view * Sheet view
* *
* @var PHPExcel\Worksheet_SheetView * @var PHPExcel\Worksheet_SheetView
*/ */
private $_sheetView; protected $_sheetView;
/** /**
* Protection * Protection
* *
* @var PHPExcel\Worksheet_Protection * @var PHPExcel\Worksheet_Protection
*/ */
private $_protection; protected $_protection;
/** /**
* Collection of styles * Collection of styles
* *
* @var PHPExcel\Style[] * @var PHPExcel\Style[]
*/ */
private $_styles = array(); protected $_styles = array();
/** /**
* Conditional styles. Indexed by cell coordinate, e.g. 'A1' * Conditional styles. Indexed by cell coordinate, e.g. 'A1'
* *
* @var array * @var array
*/ */
private $_conditionalStylesCollection = array(); protected $_conditionalStylesCollection = array();
/** /**
* Is the current cell collection sorted already? * Is the current cell collection sorted already?
* *
* @var boolean * @var boolean
*/ */
private $_cellCollectionIsSorted = false; protected $_cellCollectionIsSorted = false;
/** /**
* Collection of breaks * Collection of breaks
* *
* @var array * @var array
*/ */
private $_breaks = array(); protected $_breaks = array();
/** /**
* Collection of merged cell ranges * Collection of merged cell ranges
* *
* @var array * @var array
*/ */
private $_mergeCells = array(); protected $_mergeCells = array();
/** /**
* Collection of protected cell ranges * Collection of protected cell ranges
* *
* @var array * @var array
*/ */
private $_protectedCells = array(); protected $_protectedCells = array();
/** /**
* Autofilter Range and selection * Autofilter Range and selection
* *
* @var PHPExcel\Worksheet_AutoFilter * @var PHPExcel\Worksheet_AutoFilter
*/ */
private $_autoFilter = NULL; protected $_autoFilter = NULL;
/** /**
* Freeze pane * Freeze pane
* *
* @var string * @var string
*/ */
private $_freezePane = ''; protected $_freezePane = '';
/** /**
* Show gridlines? * Show gridlines?
* *
* @var boolean * @var boolean
*/ */
private $_showGridlines = true; protected $_showGridlines = true;
/** /**
* Print gridlines? * Print gridlines?
* *
* @var boolean * @var boolean
*/ */
private $_printGridlines = false; protected $_printGridlines = false;
/** /**
* Show row and column headers? * Show row and column headers?
* *
* @var boolean * @var boolean
*/ */
private $_showRowColHeaders = true; protected $_showRowColHeaders = true;
/** /**
* Show summary below? (Row/Column outline) * Show summary below? (Row/Column outline)
* *
* @var boolean * @var boolean
*/ */
private $_showSummaryBelow = true; protected $_showSummaryBelow = true;
/** /**
* Show summary right? (Row/Column outline) * Show summary right? (Row/Column outline)
* *
* @var boolean * @var boolean
*/ */
private $_showSummaryRight = true; protected $_showSummaryRight = true;
/** /**
* Collection of comments * Collection of comments
* *
* @var PHPExcel\Comment[] * @var PHPExcel\Comment[]
*/ */
private $_comments = array(); protected $_comments = array();
/** /**
* Active cell. (Only one!) * Active cell. (Only one!)
* *
* @var string * @var string
*/ */
private $_activeCell = 'A1'; protected $_activeCell = 'A1';
/** /**
* Selected cells * Selected cells
* *
* @var string * @var string
*/ */
private $_selectedCells = 'A1'; protected $_selectedCells = 'A1';
/** /**
* Cached highest column * Cached highest column
* *
* @var string * @var string
*/ */
private $_cachedHighestColumn = 'A'; protected $_cachedHighestColumn = 'A';
/** /**
* Cached highest row * Cached highest row
* *
* @var int * @var int
*/ */
private $_cachedHighestRow = 1; protected $_cachedHighestRow = 1;
/** /**
* Right-to-left? * Right-to-left?
* *
* @var boolean * @var boolean
*/ */
private $_rightToLeft = false; protected $_rightToLeft = false;
/** /**
* Hyperlinks. Indexed by cell coordinate, e.g. 'A1' * Hyperlinks. Indexed by cell coordinate, e.g. 'A1'
* *
* @var array * @var array
*/ */
private $_hyperlinkCollection = array(); protected $_hyperlinkCollection = array();
/** /**
* Data validation objects. Indexed by cell coordinate, e.g. 'A1' * Data validation objects. Indexed by cell coordinate, e.g. 'A1'
* *
* @var array * @var array
*/ */
private $_dataValidationCollection = array(); protected $_dataValidationCollection = array();
/** /**
* Tab color * Tab color
* *
* @var PHPExcel\Style_Color * @var PHPExcel\Style_Color
*/ */
private $_tabColor; protected $_tabColor;
/** /**
* Dirty flag * Dirty flag
* *
* @var boolean * @var boolean
*/ */
private $_dirty = true; protected $_dirty = true;
/** /**
* Hash * Hash
* *
* @var string * @var string
*/ */
private $_hash = null; protected $_hash = null;
/** /**
* Create a new worksheet * Create a new worksheet

View File

@ -44,14 +44,14 @@ class WorksheetIterator implements \Iterator
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_subject; protected $_subject;
/** /**
* Current iterator position * Current iterator position
* *
* @var int * @var int
*/ */
private $_position = 0; protected $_position = 0;
/** /**
* Create a new worksheet iterator * Create a new worksheet iterator