PSR2 Fixes

This commit is contained in:
Progi1984 2015-05-16 23:09:31 +02:00
parent f827a25af2
commit 082fb1b475
23 changed files with 429 additions and 421 deletions

View File

@ -38,58 +38,155 @@ class PHPExcel_Shared_CodePage
public static function NumberToName($codePage = 1252)
{
switch ($codePage) {
case 367: return 'ASCII'; break; // ASCII
case 437: return 'CP437'; break; // OEM US
case 720: throw new PHPExcel_Exception('Code page 720 not supported.');
case 367:
return 'ASCII';
break; // ASCII
case 437:
return 'CP437';
break; // OEM US
case 720:
throw new PHPExcel_Exception('Code page 720 not supported.');
break; // OEM Arabic
case 737: return 'CP737'; break; // OEM Greek
case 775: return 'CP775'; break; // OEM Baltic
case 850: return 'CP850'; break; // OEM Latin I
case 852: return 'CP852'; break; // OEM Latin II (Central European)
case 855: return 'CP855'; break; // OEM Cyrillic
case 857: return 'CP857'; break; // OEM Turkish
case 858: return 'CP858'; break; // OEM Multilingual Latin I with Euro
case 860: return 'CP860'; break; // OEM Portugese
case 861: return 'CP861'; break; // OEM Icelandic
case 862: return 'CP862'; break; // OEM Hebrew
case 863: return 'CP863'; break; // OEM Canadian (French)
case 864: return 'CP864'; break; // OEM Arabic
case 865: return 'CP865'; break; // OEM Nordic
case 866: return 'CP866'; break; // OEM Cyrillic (Russian)
case 869: return 'CP869'; break; // OEM Greek (Modern)
case 874: return 'CP874'; break; // ANSI Thai
case 932: return 'CP932'; break; // ANSI Japanese Shift-JIS
case 936: return 'CP936'; break; // ANSI Chinese Simplified GBK
case 949: return 'CP949'; break; // ANSI Korean (Wansung)
case 950: return 'CP950'; break; // ANSI Chinese Traditional BIG5
case 1200: return 'UTF-16LE'; break; // UTF-16 (BIFF8)
case 1250: return 'CP1250'; break; // ANSI Latin II (Central European)
case 1251: return 'CP1251'; break; // ANSI Cyrillic
case 0: // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program
case 1252: return 'CP1252'; break; // ANSI Latin I (BIFF4-BIFF7)
case 1253: return 'CP1253'; break; // ANSI Greek
case 1254: return 'CP1254'; break; // ANSI Turkish
case 1255: return 'CP1255'; break; // ANSI Hebrew
case 1256: return 'CP1256'; break; // ANSI Arabic
case 1257: return 'CP1257'; break; // ANSI Baltic
case 1258: return 'CP1258'; break; // ANSI Vietnamese
case 1361: return 'CP1361'; break; // ANSI Korean (Johab)
case 10000: return 'MAC'; break; // Apple Roman
case 10001: return 'CP932'; break; // Macintosh Japanese
case 10002: return 'CP950'; break; // Macintosh Chinese Traditional
case 10003: return 'CP1361'; break; // Macintosh Korean
case 10006: return 'MACGREEK'; break; // Macintosh Greek
case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic
case 10008: return 'CP936'; break; // Macintosh - Simplified Chinese (GB 2312)
case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe
case 10079: return 'MACICELAND'; break; // Macintosh Icelandic
case 10081: return 'MACTURKISH'; break; // Macintosh Turkish
case 21010: return 'UTF-16LE'; break; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE
case 32768: return 'MAC'; break; // Apple Roman
case 32769: throw new PHPExcel_Exception('Code page 32769 not supported.');
case 737:
return 'CP737';
break; // OEM Greek
case 775:
return 'CP775';
break; // OEM Baltic
case 850:
return 'CP850';
break; // OEM Latin I
case 852:
return 'CP852';
break; // OEM Latin II (Central European)
case 855:
return 'CP855';
break; // OEM Cyrillic
case 857:
return 'CP857';
break; // OEM Turkish
case 858:
return 'CP858';
break; // OEM Multilingual Latin I with Euro
case 860:
return 'CP860';
break; // OEM Portugese
case 861:
return 'CP861';
break; // OEM Icelandic
case 862:
return 'CP862';
break; // OEM Hebrew
case 863:
return 'CP863';
break; // OEM Canadian (French)
case 864:
return 'CP864';
break; // OEM Arabic
case 865:
return 'CP865';
break; // OEM Nordic
case 866:
return 'CP866';
break; // OEM Cyrillic (Russian)
case 869:
return 'CP869';
break; // OEM Greek (Modern)
case 874:
return 'CP874';
break; // ANSI Thai
case 932:
return 'CP932';
break; // ANSI Japanese Shift-JIS
case 936:
return 'CP936';
break; // ANSI Chinese Simplified GBK
case 949:
return 'CP949';
break; // ANSI Korean (Wansung)
case 950:
return 'CP950';
break; // ANSI Chinese Traditional BIG5
case 1200:
return 'UTF-16LE';
break; // UTF-16 (BIFF8)
case 1250:
return 'CP1250';
break; // ANSI Latin II (Central European)
case 1251:
return 'CP1251';
break; // ANSI Cyrillic
case 0:
// CodePage is not always correctly set when the xls file was saved by Apple's Numbers program
case 1252:
return 'CP1252';
break; // ANSI Latin I (BIFF4-BIFF7)
case 1253:
return 'CP1253';
break; // ANSI Greek
case 1254:
return 'CP1254';
break; // ANSI Turkish
case 1255:
return 'CP1255';
break; // ANSI Hebrew
case 1256:
return 'CP1256';
break; // ANSI Arabic
case 1257:
return 'CP1257';
break; // ANSI Baltic
case 1258:
return 'CP1258';
break; // ANSI Vietnamese
case 1361:
return 'CP1361';
break; // ANSI Korean (Johab)
case 10000:
return 'MAC';
break; // Apple Roman
case 10001:
return 'CP932';
break; // Macintosh Japanese
case 10002:
return 'CP950';
break; // Macintosh Chinese Traditional
case 10003:
return 'CP1361';
break; // Macintosh Korean
case 10006:
return 'MACGREEK';
break; // Macintosh Greek
case 10007:
return 'MACCYRILLIC';
break; // Macintosh Cyrillic
case 10008:
return 'CP936';
break; // Macintosh - Simplified Chinese (GB 2312)
case 10029:
return 'MACCENTRALEUROPE';
break; // Macintosh Central Europe
case 10079:
return 'MACICELAND';
break; // Macintosh Icelandic
case 10081:
return 'MACTURKISH';
break; // Macintosh Turkish
case 21010:
return 'UTF-16LE';
break; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE
case 32768:
return 'MAC';
break; // Apple Roman
case 32769:
throw new PHPExcel_Exception('Code page 32769 not supported.');
break; // ANSI Latin I (BIFF2-BIFF3)
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
case 65000:
return 'UTF-7';
break; // Unicode (UTF-7)
case 65001:
return 'UTF-8';
break; // Unicode (UTF-8)
}
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
}

View File

@ -184,13 +184,9 @@ class PHPExcel_Shared_Date
date_default_timezone_set('UTC');
$retValue = false;
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
);
$retValue = self::FormattedPHPToExcel($dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s'));
} elseif (is_numeric($dateValue)) {
$retValue = self::FormattedPHPToExcel( date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue),
date('H', $dateValue), date('i', $dateValue), date('s', $dateValue)
);
$retValue = self::FormattedPHPToExcel(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));
}
date_default_timezone_set($saveTimeZone);
@ -283,12 +279,15 @@ class PHPExcel_Shared_Date
*/
public static function isDateTimeFormatCode($pFormatCode = '')
{
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) {
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
return false;
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
}
if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) {
// Scientific format
return false;
}
// Switch on formatcode
switch ($pFormatCode) {
// Explicitly defined date formats
@ -352,10 +351,12 @@ class PHPExcel_Shared_Date
*/
public static function stringToExcel($dateValue = '')
{
if (strlen($dateValue) < 2)
if (strlen($dateValue) < 2) {
return false;
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
}
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) {
return false;
}
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);

View File

@ -79,5 +79,4 @@ class PHPExcel_Shared_Escher_DgContainer
{
return $this->_spgrContainer = $spgrContainer;
}
}

View File

@ -61,5 +61,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
{
return $this->_BSECollection;
}
}

View File

@ -116,5 +116,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
{
$this->_blipType = $blipType;
}
}

View File

@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
{
return $this->_parent;
}
}

View File

@ -52,21 +52,16 @@ class PHPExcel_Shared_Excel5
// first find the true column width in pixels (uncollapsed and unhidden)
if (isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1) {
// then we have column dimension with explicit width
$columnDimension = $columnDimensions[$col];
$width = $columnDimension->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
// then we have default column dimension with explicit width
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
$width = $defaultColumnDimension->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
} else {
// we don't even have any default column dimension. Width depends on default font
$pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
}
@ -99,25 +94,19 @@ class PHPExcel_Shared_Excel5
// first find the true row height in pixels (uncollapsed and unhidden)
if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
// then we have a row dimension
$rowDimension = $rowDimensions[$row];
$rowHeight = $rowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
} else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
// then we have a default row dimension with explicit height
$defaultRowDimension = $sheet->getDefaultRowDimension();
$rowHeight = $defaultRowDimension->getRowHeight();
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
} else {
// we don't even have any default row dimension. Height depends on default font
$pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
$pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
}
// now find the effective row height in pixels
@ -313,5 +302,4 @@ class PHPExcel_Shared_Excel5
return $twoAnchor;
}
}

View File

@ -197,11 +197,11 @@ class PHPExcel_Shared_Font
public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
{
if (!in_array($pValue, self::$_autoSizeMethods)) {
return FALSE;
return false;
}
self::$autoSizeMethod = $pValue;
return TRUE;
return true;
}
/**
@ -249,7 +249,8 @@ class PHPExcel_Shared_Font
* @param PHPExcel_Style_Font|NULL $defaultFont Font object
* @return integer Column width
*/
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null)
{
// If it is rich text, use plain text
if ($cellText instanceof PHPExcel_RichText) {
$cellText = $cellText->getPlainText();
@ -301,7 +302,8 @@ class PHPExcel_Shared_Font
* @return int
* @throws PHPExcel_Exception
*/
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
{
if (!function_exists('imagettfbbox')) {
throw new PHPExcel_Exception('GD library needs to be enabled');
}
@ -391,7 +393,8 @@ class PHPExcel_Shared_Font
* @param int $fontSizeInPoints Font size (in points)
* @return int Font size (in pixels)
*/
public static function fontSizeToPixels($fontSizeInPoints = 11) {
public static function fontSizeToPixels($fontSizeInPoints = 11)
{
return (int) ((4 / 3) * $fontSizeInPoints);
}
@ -401,7 +404,8 @@ class PHPExcel_Shared_Font
* @param int $sizeInInch Font size (in inch)
* @return int Size (in pixels)
*/
public static function inchSizeToPixels($sizeInInch = 1) {
public static function inchSizeToPixels($sizeInInch = 1)
{
return ($sizeInInch * 96);
}
@ -411,7 +415,8 @@ class PHPExcel_Shared_Font
* @param int $sizeInCm Font size (in centimeters)
* @return int Size (in pixels)
*/
public static function centimeterSizeToPixels($sizeInCm = 1) {
public static function centimeterSizeToPixels($sizeInCm = 1)
{
return ($sizeInCm * 37.795275591);
}
@ -421,7 +426,8 @@ class PHPExcel_Shared_Font
* @param PHPExcel_Style_Font
* @return string Path to TrueType font file
*/
public static function getTrueTypeFontFileFromFont($font) {
public static function getTrueTypeFontFileFromFont($font)
{
if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified');
}
@ -438,95 +444,79 @@ class PHPExcel_Shared_Font
: ($italic ? self::ARIAL_ITALIC : self::ARIAL)
);
break;
case 'Calibri':
$fontFile = (
$bold ? ($italic ? self::CALIBRI_BOLD_ITALIC : self::CALIBRI_BOLD)
: ($italic ? self::CALIBRI_ITALIC : self::CALIBRI)
);
break;
case 'Courier New':
$fontFile = (
$bold ? ($italic ? self::COURIER_NEW_BOLD_ITALIC : self::COURIER_NEW_BOLD)
: ($italic ? self::COURIER_NEW_ITALIC : self::COURIER_NEW)
);
break;
case 'Comic Sans MS':
$fontFile = (
$bold ? self::COMIC_SANS_MS_BOLD : self::COMIC_SANS_MS
);
break;
case 'Georgia':
$fontFile = (
$bold ? ($italic ? self::GEORGIA_BOLD_ITALIC : self::GEORGIA_BOLD)
: ($italic ? self::GEORGIA_ITALIC : self::GEORGIA)
);
break;
case 'Impact':
$fontFile = self::IMPACT;
break;
case 'Liberation Sans':
$fontFile = (
$bold ? ($italic ? self::LIBERATION_SANS_BOLD_ITALIC : self::LIBERATION_SANS_BOLD)
: ($italic ? self::LIBERATION_SANS_ITALIC : self::LIBERATION_SANS)
);
break;
case 'Lucida Console':
$fontFile = self::LUCIDA_CONSOLE;
break;
case 'Lucida Sans Unicode':
$fontFile = self::LUCIDA_SANS_UNICODE;
break;
case 'Microsoft Sans Serif':
$fontFile = self::MICROSOFT_SANS_SERIF;
break;
case 'Palatino Linotype':
$fontFile = (
$bold ? ($italic ? self::PALATINO_LINOTYPE_BOLD_ITALIC : self::PALATINO_LINOTYPE_BOLD)
: ($italic ? self::PALATINO_LINOTYPE_ITALIC : self::PALATINO_LINOTYPE)
);
break;
case 'Symbol':
$fontFile = self::SYMBOL;
break;
case 'Tahoma':
$fontFile = (
$bold ? self::TAHOMA_BOLD : self::TAHOMA
);
break;
case 'Times New Roman':
$fontFile = (
$bold ? ($italic ? self::TIMES_NEW_ROMAN_BOLD_ITALIC : self::TIMES_NEW_ROMAN_BOLD)
: ($italic ? self::TIMES_NEW_ROMAN_ITALIC : self::TIMES_NEW_ROMAN)
);
break;
case 'Trebuchet MS':
$fontFile = (
$bold ? ($italic ? self::TREBUCHET_MS_BOLD_ITALIC : self::TREBUCHET_MS_BOLD)
: ($italic ? self::TREBUCHET_MS_ITALIC : self::TREBUCHET_MS)
);
break;
case 'Verdana':
$fontFile = (
$bold ? ($italic ? self::VERDANA_BOLD_ITALIC : self::VERDANA_BOLD)
: ($italic ? self::VERDANA_ITALIC : self::VERDANA)
);
break;
default:
throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
break;
@ -536,7 +526,7 @@ class PHPExcel_Shared_Font
// Check if file actually exists
if (!file_exists($fontFile)) {
throw New PHPExcel_Exception('TrueType Font file not found');
throw new PHPExcel_Exception('TrueType Font file not found');
}
return $fontFile;
@ -552,11 +542,16 @@ class PHPExcel_Shared_Font
{
switch ($name) {
// Add more cases. Check FONT records in real Excel files.
case 'EucrosiaUPC': return self::CHARSET_ANSI_THAI;
case 'Wingdings': return self::CHARSET_SYMBOL;
case 'Wingdings 2': return self::CHARSET_SYMBOL;
case 'Wingdings 3': return self::CHARSET_SYMBOL;
default: return self::CHARSET_ANSI_LATIN;
case 'EucrosiaUPC':
return self::CHARSET_ANSI_THAI;
case 'Wingdings':
return self::CHARSET_SYMBOL;
case 'Wingdings 2':
return self::CHARSET_SYMBOL;
case 'Wingdings 3':
return self::CHARSET_SYMBOL;
default:
return self::CHARSET_ANSI_LATIN;
}
}
@ -609,44 +604,36 @@ class PHPExcel_Shared_Font
// inspection of Arial 10 workbook says 12.75pt ~17px
$rowHeight = 12.75;
break;
case 9:
// inspection of Arial 9 workbook says 12.00pt ~16px
$rowHeight = 12;
break;
case 8:
// inspection of Arial 8 workbook says 11.25pt ~15px
$rowHeight = 11.25;
break;
case 7:
// inspection of Arial 7 workbook says 9.00pt ~12px
$rowHeight = 9;
break;
case 6:
case 5:
// inspection of Arial 5,6 workbook says 8.25pt ~11px
$rowHeight = 8.25;
break;
case 4:
// inspection of Arial 4 workbook says 6.75pt ~9px
$rowHeight = 6.75;
break;
case 3:
// inspection of Arial 3 workbook says 6.00pt ~8px
$rowHeight = 6;
break;
case 2:
case 1:
// inspection of Arial 1,2 workbook says 5.25pt ~7px
$rowHeight = 5.25;
break;
default:
// use Arial 10 workbook as an approximation, extrapolation
$rowHeight = 12.75 * $font->getSize() / 10;
@ -660,49 +647,40 @@ class PHPExcel_Shared_Font
// inspection of Calibri 11 workbook says 15.00pt ~20px
$rowHeight = 15;
break;
case 10:
// inspection of Calibri 10 workbook says 12.75pt ~17px
$rowHeight = 12.75;
break;
case 9:
// inspection of Calibri 9 workbook says 12.00pt ~16px
$rowHeight = 12;
break;
case 8:
// inspection of Calibri 8 workbook says 11.25pt ~15px
$rowHeight = 11.25;
break;
case 7:
// inspection of Calibri 7 workbook says 9.00pt ~12px
$rowHeight = 9;
break;
case 6:
case 5:
// inspection of Calibri 5,6 workbook says 8.25pt ~11px
$rowHeight = 8.25;
break;
case 4:
// inspection of Calibri 4 workbook says 6.75pt ~9px
$rowHeight = 6.75;
break;
case 3:
// inspection of Calibri 3 workbook says 6.00pt ~8px
$rowHeight = 6.00;
break;
case 2:
case 1:
// inspection of Calibri 1,2 workbook says 5.25pt ~7px
$rowHeight = 5.25;
break;
default:
// use Calibri 11 workbook as an approximation, extrapolation
$rowHeight = 15 * $font->getSize() / 11;
@ -716,51 +694,42 @@ class PHPExcel_Shared_Font
// inspection of Verdana 10 workbook says 12.75pt ~17px
$rowHeight = 12.75;
break;
case 9:
// inspection of Verdana 9 workbook says 11.25pt ~15px
$rowHeight = 11.25;
break;
case 8:
// inspection of Verdana 8 workbook says 10.50pt ~14px
$rowHeight = 10.50;
break;
case 7:
// inspection of Verdana 7 workbook says 9.00pt ~12px
$rowHeight = 9.00;
break;
case 6:
case 5:
// inspection of Verdana 5,6 workbook says 8.25pt ~11px
$rowHeight = 8.25;
break;
case 4:
// inspection of Verdana 4 workbook says 6.75pt ~9px
$rowHeight = 6.75;
break;
case 3:
// inspection of Verdana 3 workbook says 6.00pt ~8px
$rowHeight = 6;
break;
case 2:
case 1:
// inspection of Verdana 1,2 workbook says 5.25pt ~7px
$rowHeight = 5.25;
break;
default:
// use Verdana 10 workbook as an approximation, extrapolation
$rowHeight = 12.75 * $font->getSize() / 10;
break;
}
break;
default:
// just use Calibri as an approximation
$rowHeight = 15 * $font->getSize() / 11;
@ -769,5 +738,4 @@ class PHPExcel_Shared_Font
return $rowHeight;
}
}

View File

@ -83,10 +83,7 @@ class PHPExcel_Shared_OLE_ChainedBlockStream
// 25 is length of "ole-chainedblockstream://"
parse_str(substr($path, 25), $this->params);
if (!isset($this->params['oleInstanceId'],
$this->params['blockId'],
$GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
if (!isset($this->params['oleInstanceId'], $this->params['blockId'], $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
if ($options & STREAM_REPORT_ERRORS) {
trigger_error('OLE stream not found', E_USER_WARNING);
}
@ -96,10 +93,7 @@ class PHPExcel_Shared_OLE_ChainedBlockStream
$blockId = $this->params['blockId'];
$this->data = '';
if (isset($this->params['size']) &&
$this->params['size'] < $this->ole->bigBlockThreshold &&
$blockId != $this->ole->root->_StartBlock) {
if (isset($this->params['size']) && $this->params['size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->_StartBlock) {
// Block id refers to small blocks
$rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
while ($blockId != -2) {

View File

@ -38,17 +38,7 @@ class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
*/
public function __construct($name)
{
parent::__construct(
null,
$name,
PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
null,
null,
null,
null,
null,
'',
array());
parent::__construct(null, $name, PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, null, null, null, null, null, '', array());
}
/**

View File

@ -34,7 +34,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
* Directory for temporary files
* @var string
*/
protected $_tmp_dir = NULL;
protected $_tmp_dir = null;
/**
* @param integer $time_1st A timestamp
@ -44,17 +44,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
{
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
parent::__construct(
null,
PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'),
PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT,
null,
null,
null,
$time_1st,
$time_2nd,
null,
$raChild);
parent::__construct(null, PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'), PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
}
/**
@ -79,7 +69,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
if (is_resource($filename)) {
$this->_FILEH_ = $filename;
} else if ($filename == '-' || $filename == '') {
if ($this->_tmp_dir === NULL)
if ($this->_tmp_dir === null)
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b");

View File

@ -82,7 +82,7 @@ class PHPExcel_Shared_OLERead {
// Get the file identifier
// Don't bother reading the whole file until we know it's a valid OLE file
$this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8);
$this->data = file_get_contents($sFileName, false, null, 0, 8);
// Check OLE identifier
if ($this->data != self::IDENTIFIER_OLE) {
@ -172,7 +172,7 @@ class PHPExcel_Shared_OLERead {
*/
public function getStream($stream)
{
if ($stream === NULL) {
if ($stream === null) {
return null;
}
@ -197,7 +197,9 @@ class PHPExcel_Shared_OLERead {
++$numBlocks;
}
if ($numBlocks == 0) return '';
if ($numBlocks == 0) {
return '';
}
$block = $this->props[$stream]['startBlock'];
@ -233,7 +235,8 @@ class PHPExcel_Shared_OLERead {
/**
* Read entries in the directory stream.
*/
private function _readPropertySets() {
private function _readPropertySets()
{
$offset = 0;
// loop through entires, each entry is 128 bytes
@ -256,12 +259,12 @@ class PHPExcel_Shared_OLERead {
$name = str_replace("\x00", "", substr($d, 0, $nameSize));
$this->props[] = array(
'name' => $name,
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);
'size' => $size
);
// tmp helper to simplify checks
$upName = strtoupper($name);
@ -269,8 +272,7 @@ class PHPExcel_Shared_OLERead {
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
$this->wrkbook = count($this->props) - 1;
}
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
} else if ($upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry
$this->rootentry = count($this->props) - 1;
}
@ -289,7 +291,6 @@ class PHPExcel_Shared_OLERead {
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
}
}
/**
@ -313,5 +314,4 @@ class PHPExcel_Shared_OLERead {
}
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
}
}

View File

@ -276,7 +276,7 @@ class PclZip
// ----- Set default values
$v_options = array();
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
$v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
// ----- Look for variable options arguments
$v_size = func_num_args();
@ -320,8 +320,7 @@ class PclZip
if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
"Invalid number / type of arguments");
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
return 0;
}
}
@ -443,7 +442,7 @@ class PclZip
// ----- Set default values
$v_options = array();
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
$v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
// ----- Look for variable options arguments
$v_size = func_num_args();
@ -687,7 +686,7 @@ class PclZip
$v_size = func_num_args();
// ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
// ----- Look for arguments
if ($v_size > 0) {
@ -838,7 +837,7 @@ class PclZip
$v_size = func_num_args();
// ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
// ----- Look for arguments
if ($v_size > 1) {
@ -890,7 +889,7 @@ class PclZip
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
}
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
} else {
}
} else {
@ -1121,7 +1120,6 @@ class PclZip
// ----- Look if the $p_archive is a PclZip object
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) {
// ----- Duplicate the archive
$v_result = $this->privDuplicate($p_archive->zipname);
} else if (is_string($p_archive)) {
@ -1386,7 +1384,7 @@ class PclZip
}
// ----- Get the value
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
$i++;
break;
@ -1450,12 +1448,11 @@ class PclZip
// ----- Get the value
if (is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) {
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
$i++;
} else {
}
break;
// ----- Look for options that request an array of string for value
case PCLZIP_OPT_BY_NAME:
// ----- Check the number of parameters
@ -2030,7 +2027,6 @@ class PclZip
// ----- Look if the archive exists or is empty
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) {
// ----- Do a create
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
@ -2964,8 +2960,7 @@ class PclZip
// ----- Read each entry
for ($i=0; $i<$v_central_dir['entries']; $i++) {
// ----- Read the file header
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
{
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) {
$this->privSwapBackMagicQuotes();
return $v_result;
}
@ -3141,19 +3136,7 @@ class PclZip
$v_extract = true;
}
}
}
// ----- Look for extract by ereg rule
// ereg() is deprecated with PHP 5.3
/*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
$v_extract = true;
}
}
*/
else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
}else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by preg rule
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
$v_extract = true;
@ -3546,7 +3529,7 @@ class PclZip
// ----- Decompress the file
$v_file_content = @gzinflate($v_buffer);
unset($v_buffer);
if ($v_file_content === FALSE) {
if ($v_file_content === false) {
// ----- Change the file status
// TBC
@ -3856,7 +3839,7 @@ class PclZip
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file
if (($p_string = @gzinflate($v_data)) === FALSE) {
if (($p_string = @gzinflate($v_data)) === false) {
// TBC
}
}
@ -4575,7 +4558,6 @@ class PclZip
{
$v_result = 1;
// ----- Remove the final '/'
if (($p_is_dir) && (substr($p_dir, -1)=='/')) {
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
@ -5030,10 +5012,10 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
// ----- Look for path beginning by ./
if (($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
$p_dir = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_dir, 1);
}
if (($p_path == '.') || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
$p_path = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_path, 1);
}
// ----- Explode dir and path by directory separator

View File

@ -526,7 +526,8 @@ class PHPExcel_Shared_String
* @author Rasmus Andersson {@link http://rasmusandersson.se/}
* @author vadik56
*/
public static function utf16_decode($str, $bom_be = TRUE) {
public static function utf16_decode($str, $bom_be = true)
{
if (strlen($str) < 2) {
return $str;
}

View File

@ -59,7 +59,8 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter
* @param int $pTemporaryStorage Temporary storage location
* @param string $pTemporaryStorageFolder Temporary storage folder
*/
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = null) {
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = null)
{
// Open temporary storage
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
$this->openMemory();

View File

@ -39,7 +39,7 @@ class PHPExcel_Best_Fit
*
* @var boolean
**/
protected $_error = False;
protected $_error = false;
/**
* Algorithm type to use for best-fit
@ -163,7 +163,7 @@ class PHPExcel_Best_Fit
*/
public function getEquation($dp = 0)
{
return False;
return false;
} // function getEquation()
/**
@ -409,7 +409,7 @@ class PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression
* @param boolean $const
*/
function __construct($yValues, $xValues = array(), $const = true)
public function __construct($yValues, $xValues = array(), $const = true)
{
// Calculate number of points
$nY = count($yValues);

View File

@ -221,10 +221,10 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
$this->_order = $order;
$this->_polynomial_regression($order, $yValues, $xValues, $const);
if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
$this->_error = True;
$this->_error = true;
}
} else {
$this->_error = True;
$this->_error = true;
}
}
} // function __construct()