Yet more of the psr-2 work

This commit is contained in:
MarkBaker 2015-05-16 23:18:40 +01:00
parent 4c8dd00dff
commit 61e81377cb
10 changed files with 7225 additions and 7203 deletions

View File

@ -271,11 +271,13 @@ class PHPExcel_Calculation
// PHPExcel functions // PHPExcel functions
private static $PHPExcelFunctions = array( // PHPExcel functions private static $PHPExcelFunctions = array( // PHPExcel functions
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, 'ABS' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs', 'functionCall' => 'abs',
'argumentCount' => '1' argumentCount' => '1'
), ),
'ACCRINT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, 'ACCRINT' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT', 'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT',
'argumentCount' => '4-7' 'argumentCount' => '4-7'
), ),
@ -1697,7 +1699,8 @@ class PHPExcel_Calculation
'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT', 'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT',
'argumentCount' => '5,6' 'argumentCount' => '5,6'
), ),
'ZTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, 'ZTEST' => array(
'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST', 'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST',
'argumentCount' => '2-3' 'argumentCount' => '2-3'
) )
@ -1739,7 +1742,7 @@ class PHPExcel_Calculation
} }
} }
private static function _loadLocales() private static function loadLocales()
{ {
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) { foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
@ -1981,7 +1984,7 @@ class PHPExcel_Calculation
} }
if (count(self::$validLocaleLanguages) == 1) { if (count(self::$validLocaleLanguages) == 1) {
self::_loadLocales(); self::loadLocales();
} }
// Test whether we have any language data for this language (any locale) // Test whether we have any language data for this language (any locale)
if (in_array($language, self::$validLocaleLanguages)) { if (in_array($language, self::$validLocaleLanguages)) {

View File

@ -41,7 +41,7 @@ class PHPExcel_Chart_Legend
const POSITION_TOP = 't'; const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr'; const POSITION_TOPRIGHT = 'tr';
private static $_positionXLref = array( private static $positionXLref = array(
self::xlLegendPositionBottom => self::POSITION_BOTTOM, self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT, self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??', self::xlLegendPositionCustom => '??',
@ -99,7 +99,7 @@ class PHPExcel_Chart_Legend
*/ */
public function setPosition($position = self::POSITION_RIGHT) public function setPosition($position = self::POSITION_RIGHT)
{ {
if (!in_array($position, self::$_positionXLref)) { if (!in_array($position, self::$positionXLref)) {
return false; return false;
} }
@ -114,7 +114,7 @@ class PHPExcel_Chart_Legend
*/ */
public function getPositionXL() public function getPositionXL()
{ {
return array_search($this->position, self::$_positionXLref); return array_search($this->position, self::$positionXLref);
} }
/** /**
@ -124,11 +124,11 @@ class PHPExcel_Chart_Legend
*/ */
public function setPositionXL($positionXL = self::xlLegendPositionRight) public function setPositionXL($positionXL = self::xlLegendPositionRight)
{ {
if (!array_key_exists($positionXL, self::$_positionXLref)) { if (!array_key_exists($positionXL, self::$positionXLref)) {
return false; return false;
} }
$this->position = self::$_positionXLref[$positionXL]; $this->position = self::$positionXLref[$positionXL];
return true; return true;
} }

View File

@ -535,7 +535,7 @@ class PHPExcel_DocumentProperties
return strtotime($propertyValue); return strtotime($propertyValue);
break; break;
case 'bool': // Boolean case 'bool': // Boolean
return ($propertyValue == 'true') ? True : False; return ($propertyValue == 'true') ? true : false;
break; break;
case 'cy': // Currency case 'cy': // Currency
case 'error': // Error Status Code case 'error': // Error Status Code
@ -556,7 +556,8 @@ class PHPExcel_DocumentProperties
return $propertyValue; return $propertyValue;
} }
public static function convertPropertyType($propertyType) { public static function convertPropertyType($propertyType)
{
switch ($propertyType) { switch ($propertyType) {
case 'i1': // 1-Byte Signed Integer case 'i1': // 1-Byte Signed Integer
case 'i2': // 2-Byte Signed Integer case 'i2': // 2-Byte Signed Integer
@ -607,5 +608,4 @@ class PHPExcel_DocumentProperties
} }
return self::PROPERTY_TYPE_UNKNOWN; return self::PROPERTY_TYPE_UNKNOWN;
} }
} }

View File

@ -32,35 +32,35 @@ class PHPExcel_DocumentSecurity
* *
* @var boolean * @var boolean
*/ */
private $_lockRevision; private $lockRevision;
/** /**
* LockStructure * LockStructure
* *
* @var boolean * @var boolean
*/ */
private $_lockStructure; private $lockStructure;
/** /**
* LockWindows * LockWindows
* *
* @var boolean * @var boolean
*/ */
private $_lockWindows; private $lockWindows;
/** /**
* RevisionsPassword * RevisionsPassword
* *
* @var string * @var string
*/ */
private $_revisionsPassword; private $revisionsPassword;
/** /**
* WorkbookPassword * WorkbookPassword
* *
* @var string * @var string
*/ */
private $_workbookPassword; private $workbookPassword;
/** /**
* Create a new PHPExcel_DocumentSecurity * Create a new PHPExcel_DocumentSecurity
@ -68,11 +68,11 @@ class PHPExcel_DocumentSecurity
public function __construct() public function __construct()
{ {
// Initialise values // Initialise values
$this->_lockRevision = false; $this->lockRevision = false;
$this->_lockStructure = false; $this->lockStructure = false;
$this->_lockWindows = false; $this->lockWindows = false;
$this->_revisionsPassword = ''; $this->revisionsPassword = '';
$this->_workbookPassword = ''; $this->workbookPassword = '';
} }
/** /**
@ -82,9 +82,9 @@ class PHPExcel_DocumentSecurity
*/ */
public function isSecurityEnabled() public function isSecurityEnabled()
{ {
return $this->_lockRevision || return $this->lockRevision ||
$this->_lockStructure || $this->lockStructure ||
$this->_lockWindows; $this->lockWindows;
} }
/** /**
@ -94,7 +94,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function getLockRevision() public function getLockRevision()
{ {
return $this->_lockRevision; return $this->lockRevision;
} }
/** /**
@ -105,7 +105,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function setLockRevision($pValue = false) public function setLockRevision($pValue = false)
{ {
$this->_lockRevision = $pValue; $this->lockRevision = $pValue;
return $this; return $this;
} }
@ -116,7 +116,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function getLockStructure() public function getLockStructure()
{ {
return $this->_lockStructure; return $this->lockStructure;
} }
/** /**
@ -127,7 +127,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function setLockStructure($pValue = false) public function setLockStructure($pValue = false)
{ {
$this->_lockStructure = $pValue; $this->lockStructure = $pValue;
return $this; return $this;
} }
@ -138,7 +138,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function getLockWindows() public function getLockWindows()
{ {
return $this->_lockWindows; return $this->lockWindows;
} }
/** /**
@ -149,7 +149,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function setLockWindows($pValue = false) public function setLockWindows($pValue = false)
{ {
$this->_lockWindows = $pValue; $this->lockWindows = $pValue;
return $this; return $this;
} }
@ -160,7 +160,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function getRevisionsPassword() public function getRevisionsPassword()
{ {
return $this->_revisionsPassword; return $this->revisionsPassword;
} }
/** /**
@ -175,7 +175,7 @@ class PHPExcel_DocumentSecurity
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
} }
$this->_revisionsPassword = $pValue; $this->revisionsPassword = $pValue;
return $this; return $this;
} }
@ -186,7 +186,7 @@ class PHPExcel_DocumentSecurity
*/ */
public function getWorkbookPassword() public function getWorkbookPassword()
{ {
return $this->_workbookPassword; return $this->workbookPassword;
} }
/** /**
@ -201,7 +201,7 @@ class PHPExcel_DocumentSecurity
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
} }
$this->_workbookPassword = $pValue; $this->workbookPassword = $pValue;
return $this; return $this;
} }

View File

@ -573,7 +573,8 @@ class PHPExcel_Helper_HTML
protected $richTextObject; protected $richTextObject;
protected function initialise() { protected function initialise()
{
$this->face = $this->size = $this->color = null; $this->face = $this->size = $this->color = null;
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false; $this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
@ -582,7 +583,8 @@ class PHPExcel_Helper_HTML
$this->stringData = ''; $this->stringData = '';
} }
public function toRichTextObject($html) { public function toRichTextObject($html)
{
$this->initialise(); $this->initialise();
// Create a new DOM object // Create a new DOM object
@ -594,15 +596,17 @@ class PHPExcel_Helper_HTML
// Discard excess white space // Discard excess white space
$dom->preserveWhiteSpace = false; $dom->preserveWhiteSpace = false;
$this->richTextObject = new PHPExcel_RichText();; $this->richTextObject = new PHPExcel_RichText();
$this->parseElements($dom); $this->parseElements($dom);
return $this->richTextObject; return $this->richTextObject;
} }
protected function buildTextRun() { protected function buildTextRun()
{
$text = $this->stringData; $text = $this->stringData;
if (trim($text) === '') if (trim($text) === '') {
return; return;
}
$richtextRun = $this->richTextObject->createTextRun($this->stringData); $richtextRun = $this->richTextObject->createTextRun($this->stringData);
if ($this->face) { if ($this->face) {
@ -635,7 +639,8 @@ class PHPExcel_Helper_HTML
$this->stringData = ''; $this->stringData = '';
} }
protected function rgbToColour($rgb) { protected function rgbToColour($rgb)
{
preg_match_all('/\d+/', $rgb, $values); preg_match_all('/\d+/', $rgb, $values);
foreach ($values[0] as &$value) { foreach ($values[0] as &$value) {
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); $value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
@ -643,11 +648,13 @@ class PHPExcel_Helper_HTML
return implode($values[0]); return implode($values[0]);
} }
protected function colourNameLookup($rgb) { protected function colourNameLookup($rgb)
{
return self::$colourMap[$rgb]; return self::$colourMap[$rgb];
} }
protected function startFontTag($tag) { protected function startFontTag($tag)
{
foreach ($tag->attributes as $attribute) { foreach ($tag->attributes as $attribute) {
$attributeName = strtolower($attribute->name); $attributeName = strtolower($attribute->name);
$attributeValue = $attribute->value; $attributeValue = $attribute->value;
@ -666,69 +673,85 @@ class PHPExcel_Helper_HTML
} }
} }
protected function endFontTag() { protected function endFontTag()
{
$this->face = $this->size = $this->color = null; $this->face = $this->size = $this->color = null;
} }
protected function startBoldTag() { protected function startBoldTag()
{
$this->bold = true; $this->bold = true;
} }
protected function endBoldTag() { protected function endBoldTag()
{
$this->bold = false; $this->bold = false;
} }
protected function startItalicTag() { protected function startItalicTag()
{
$this->italic = true; $this->italic = true;
} }
protected function endItalicTag() { protected function endItalicTag()
{
$this->italic = false; $this->italic = false;
} }
protected function startUnderlineTag() { protected function startUnderlineTag()
{
$this->underline = true; $this->underline = true;
} }
protected function endUnderlineTag() { protected function endUnderlineTag()
{
$this->underline = false; $this->underline = false;
} }
protected function startSubscriptTag() { protected function startSubscriptTag()
{
$this->subscript = true; $this->subscript = true;
} }
protected function endSubscriptTag() { protected function endSubscriptTag()
{
$this->subscript = false; $this->subscript = false;
} }
protected function startSuperscriptTag() { protected function startSuperscriptTag()
{
$this->superscript = true; $this->superscript = true;
} }
protected function endSuperscriptTag() { protected function endSuperscriptTag()
{
$this->superscript = false; $this->superscript = false;
} }
protected function startStrikethruTag() { protected function startStrikethruTag()
{
$this->strikethrough = true; $this->strikethrough = true;
} }
protected function endStrikethruTag() { protected function endStrikethruTag()
{
$this->strikethrough = false; $this->strikethrough = false;
} }
protected function breakTag() { protected function breakTag()
{
$this->stringData .= PHP_EOL; $this->stringData .= PHP_EOL;
} }
protected function parseTextNode(DOMText $textNode) { protected function parseTextNode(DOMText $textNode)
{
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue)); $domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
$this->stringData .= $domText; $this->stringData .= $domText;
$this->buildTextRun(); $this->buildTextRun();
} }
protected function handleCallback($element, $callbackTag, $callbacks) { protected function handleCallback($element, $callbackTag, $callbacks)
{
if (isset($callbacks[$callbackTag])) { if (isset($callbacks[$callbackTag])) {
$elementHandler = $callbacks[$callbackTag]; $elementHandler = $callbacks[$callbackTag];
if (method_exists($this, $elementHandler)) { if (method_exists($this, $elementHandler)) {
@ -737,7 +760,8 @@ class PHPExcel_Helper_HTML
} }
} }
protected function parseElementNode(DOMElement $element) { protected function parseElementNode(DOMElement $element)
{
$callbackTag = strtolower($element->nodeName); $callbackTag = strtolower($element->nodeName);
$this->stack[] = $callbackTag; $this->stack[] = $callbackTag;
@ -750,7 +774,8 @@ class PHPExcel_Helper_HTML
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks); $this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
} }
protected function parseElements(DOMNode $element) { protected function parseElements(DOMNode $element)
{
foreach ($element->childNodes as $child) { foreach ($element->childNodes as $child) {
if ($child instanceof DOMText) { if ($child instanceof DOMText) {
$this->parseTextNode($child); $this->parseTextNode($child);

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_OLE_ChainedBlockStream
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,17 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Shared_OLE_ChainedBlockStream
*
* Stream wrapper for reading data stored in an OLE file. Implements methods
* for PHP's stream_wrapper_register(). For creating streams using this
* wrapper, use PHPExcel_Shared_OLE_PPS_File::getStream().
*
* @category PHPExcel
* @package PHPExcel_Shared_OLE
*/
class PHPExcel_Shared_OLE_ChainedBlockStream class PHPExcel_Shared_OLE_ChainedBlockStream
{ {
/** /**

View File

@ -71,10 +71,14 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
public function save($filename) public function save($filename)
{ {
// Initial Setting for saving // Initial Setting for saving
$this->_BIG_BLOCK_SIZE = pow(2, $this->_BIG_BLOCK_SIZE = pow(
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9)); 2,
$this->_SMALL_BLOCK_SIZE= pow(2, (isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6)); );
$this->_SMALL_BLOCK_SIZE= pow(
2,
(isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE) : 6
);
if (is_resource($filename)) { if (is_resource($filename)) {
$this->_FILEH_ = $filename; $this->_FILEH_ = $filename;

View File

@ -216,8 +216,7 @@
{ {
// ----- Tests the zlib // ----- Tests the zlib
if (!function_exists('gzopen')) if (!function_exists('gzopen')) {
{
die('Abort '.basename(__FILE__).' : Missing zlib extensions'); die('Abort '.basename(__FILE__).' : Missing zlib extensions');
} }
@ -229,6 +228,7 @@
// ----- Return // ----- Return
return; return;
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------