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

File diff suppressed because it is too large Load Diff

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

@ -66,7 +66,7 @@ class PHPExcel_HashTable
// Check if an array was passed // Check if an array was passed
if ($pSource == null) { if ($pSource == null) {
return; return;
} else if (!is_array($pSource)) { } elseif (!is_array($pSource)) {
throw new PHPExcel_Exception('Invalid array parameter passed.'); throw new PHPExcel_Exception('Invalid array parameter passed.');
} }

View File

@ -3,7 +3,7 @@
class PHPExcel_Helper_HTML class PHPExcel_Helper_HTML
{ {
protected static $colourMap = array( protected static $colourMap = array(
'aliceblue' => 'f0f8ff', 'aliceblue' => 'f0f8ff',
'antiquewhite' => 'faebd7', 'antiquewhite' => 'faebd7',
'antiquewhite1' => 'ffefdb', 'antiquewhite1' => 'ffefdb',
'antiquewhite2' => 'eedfcc', 'antiquewhite2' => 'eedfcc',
@ -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) {
@ -612,7 +616,7 @@ class PHPExcel_Helper_HTML
$richtextRun->getFont()->setSize($this->size); $richtextRun->getFont()->setSize($this->size);
} }
if ($this->color) { if ($this->color) {
$richtextRun->getFont()->setColor( new PHPExcel_Style_Color( 'ff' . $this->color ) ); $richtextRun->getFont()->setColor(new PHPExcel_Style_Color('ff' . $this->color));
} }
if ($this->bold) { if ($this->bold) {
$richtextRun->getFont()->setBold(true); $richtextRun->getFont()->setBold(true);
@ -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

@ -28,7 +28,7 @@
* @package PHPExcel_Shared_OLE * @package PHPExcel_Shared_OLE
*/ */
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
{ {
/** /**
* The constructor * The constructor
* *

View File

@ -28,7 +28,7 @@
* @package PHPExcel_Shared_OLE * @package PHPExcel_Shared_OLE
*/ */
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
{ {
/** /**
* Directory for temporary files * Directory for temporary files
@ -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;

File diff suppressed because it is too large Load Diff