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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,17 +38,7 @@ class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
*/ */
public function __construct($name) public function __construct($name)
{ {
parent::__construct( parent::__construct(null, $name, PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, null, null, null, null, null, '', array());
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 * Directory for temporary files
* @var string * @var string
*/ */
protected $_tmp_dir = NULL; protected $_tmp_dir = null;
/** /**
* @param integer $time_1st A timestamp * @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(); $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
parent::__construct( 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);
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)) { if (is_resource($filename)) {
$this->_FILEH_ = $filename; $this->_FILEH_ = $filename;
} else if ($filename == '-' || $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_dir = PHPExcel_Shared_File::sys_get_temp_dir();
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b");

View File

@ -82,7 +82,7 @@ class PHPExcel_Shared_OLERead {
// Get the file identifier // Get the file identifier
// Don't bother reading the whole file until we know it's a valid OLE file // 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 // Check OLE identifier
if ($this->data != self::IDENTIFIER_OLE) { if ($this->data != self::IDENTIFIER_OLE) {
@ -172,7 +172,7 @@ class PHPExcel_Shared_OLERead {
*/ */
public function getStream($stream) public function getStream($stream)
{ {
if ($stream === NULL) { if ($stream === null) {
return null; return null;
} }
@ -197,7 +197,9 @@ class PHPExcel_Shared_OLERead {
++$numBlocks; ++$numBlocks;
} }
if ($numBlocks == 0) return ''; if ($numBlocks == 0) {
return '';
}
$block = $this->props[$stream]['startBlock']; $block = $this->props[$stream]['startBlock'];
@ -233,7 +235,8 @@ class PHPExcel_Shared_OLERead {
/** /**
* Read entries in the directory stream. * Read entries in the directory stream.
*/ */
private function _readPropertySets() { private function _readPropertySets()
{
$offset = 0; $offset = 0;
// loop through entires, each entry is 128 bytes // loop through entires, each entry is 128 bytes
@ -256,12 +259,12 @@ class PHPExcel_Shared_OLERead {
$name = str_replace("\x00", "", substr($d, 0, $nameSize)); $name = str_replace("\x00", "", substr($d, 0, $nameSize));
$this->props[] = array( $this->props[] = array(
'name' => $name, 'name' => $name,
'type' => $type, 'type' => $type,
'startBlock' => $startBlock, 'startBlock' => $startBlock,
'size' => $size); 'size' => $size
);
// tmp helper to simplify checks // tmp helper to simplify checks
$upName = strtoupper($name); $upName = strtoupper($name);
@ -269,8 +272,7 @@ class PHPExcel_Shared_OLERead {
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) { if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
$this->wrkbook = count($this->props) - 1; $this->wrkbook = count($this->props) - 1;
} } else if ($upName === 'ROOT ENTRY' || $upName === 'R') {
else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry // Root entry
$this->rootentry = count($this->props) - 1; $this->rootentry = count($this->props) - 1;
} }
@ -289,7 +291,6 @@ class PHPExcel_Shared_OLERead {
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE; $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; 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 // ----- Set default values
$v_options = array(); $v_options = array();
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
// ----- Look for variable options arguments // ----- Look for variable options arguments
$v_size = func_num_args(); $v_size = func_num_args();
@ -320,8 +320,7 @@ class PclZip
if ($v_size == 2) { if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) { } else if ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
"Invalid number / type of arguments");
return 0; return 0;
} }
} }
@ -443,7 +442,7 @@ class PclZip
// ----- Set default values // ----- Set default values
$v_options = array(); $v_options = array();
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
// ----- Look for variable options arguments // ----- Look for variable options arguments
$v_size = func_num_args(); $v_size = func_num_args();
@ -687,7 +686,7 @@ class PclZip
$v_size = func_num_args(); $v_size = func_num_args();
// ----- Default values for option // ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
// ----- Look for arguments // ----- Look for arguments
if ($v_size > 0) { if ($v_size > 0) {
@ -838,7 +837,7 @@ class PclZip
$v_size = func_num_args(); $v_size = func_num_args();
// ----- Default values for option // ----- Default values for option
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
// ----- Look for arguments // ----- Look for arguments
if ($v_size > 1) { if ($v_size > 1) {
@ -890,7 +889,7 @@ class PclZip
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
} }
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { 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 {
} }
} else { } else {
@ -1121,7 +1120,6 @@ class PclZip
// ----- Look if the $p_archive is a PclZip object // ----- Look if the $p_archive is a PclZip object
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) { if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) {
// ----- Duplicate the archive // ----- Duplicate the archive
$v_result = $this->privDuplicate($p_archive->zipname); $v_result = $this->privDuplicate($p_archive->zipname);
} else if (is_string($p_archive)) { } else if (is_string($p_archive)) {
@ -1386,7 +1384,7 @@ class PclZip
} }
// ----- Get the value // ----- 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++; $i++;
break; break;
@ -1450,12 +1448,11 @@ class PclZip
// ----- Get the value // ----- Get the value
if (is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) { 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++; $i++;
} else { } else {
} }
break; break;
// ----- Look for options that request an array of string for value // ----- Look for options that request an array of string for value
case PCLZIP_OPT_BY_NAME: case PCLZIP_OPT_BY_NAME:
// ----- Check the number of parameters // ----- Check the number of parameters
@ -2030,7 +2027,6 @@ class PclZip
// ----- Look if the archive exists or is empty // ----- Look if the archive exists or is empty
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) {
// ----- Do a create // ----- Do a create
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
@ -2964,8 +2960,7 @@ class PclZip
// ----- Read each entry // ----- Read each entry
for ($i=0; $i<$v_central_dir['entries']; $i++) { for ($i=0; $i<$v_central_dir['entries']; $i++) {
// ----- Read the file header // ----- Read the file header
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) {
{
$this->privSwapBackMagicQuotes(); $this->privSwapBackMagicQuotes();
return $v_result; return $v_result;
} }
@ -3141,19 +3136,7 @@ class PclZip
$v_extract = true; $v_extract = true;
} }
} }
} }else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- 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] != "")) {
// ----- Look for extract by preg rule // ----- Look for extract by preg rule
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
$v_extract = true; $v_extract = true;
@ -3546,7 +3529,7 @@ class PclZip
// ----- Decompress the file // ----- Decompress the file
$v_file_content = @gzinflate($v_buffer); $v_file_content = @gzinflate($v_buffer);
unset($v_buffer); unset($v_buffer);
if ($v_file_content === FALSE) { if ($v_file_content === false) {
// ----- Change the file status // ----- Change the file status
// TBC // TBC
@ -3856,7 +3839,7 @@ class PclZip
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']); $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file // ----- Decompress the file
if (($p_string = @gzinflate($v_data)) === FALSE) { if (($p_string = @gzinflate($v_data)) === false) {
// TBC // TBC
} }
} }
@ -4575,7 +4558,6 @@ class PclZip
{ {
$v_result = 1; $v_result = 1;
// ----- Remove the final '/' // ----- Remove the final '/'
if (($p_is_dir) && (substr($p_dir, -1)=='/')) { if (($p_is_dir) && (substr($p_dir, -1)=='/')) {
$p_dir = substr($p_dir, 0, strlen($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 ./ // ----- Look for path beginning by ./
if (($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { 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) == './'))) { 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 // ----- 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 Rasmus Andersson {@link http://rasmusandersson.se/}
* @author vadik56 * @author vadik56
*/ */
public static function utf16_decode($str, $bom_be = TRUE) { public static function utf16_decode($str, $bom_be = true)
{
if (strlen($str) < 2) { if (strlen($str) < 2) {
return $str; return $str;
} }

View File

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

View File

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

View File

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