PSR2 Fixes
This commit is contained in:
parent
f827a25af2
commit
082fb1b475
|
@ -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.');
|
||||
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.');
|
||||
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 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.');
|
||||
break; // ANSI Latin I (BIFF2-BIFF3)
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -235,8 +231,8 @@ class PHPExcel_Shared_Date
|
|||
}
|
||||
|
||||
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
|
||||
$century = substr($year,0,2);
|
||||
$decade = substr($year,2,2);
|
||||
$century = substr($year, 0, 2);
|
||||
$decade = substr($year, 2, 2);
|
||||
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
|
||||
|
||||
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
|
||||
|
@ -273,7 +269,7 @@ class PHPExcel_Shared_Date
|
|||
}
|
||||
|
||||
|
||||
private static $possibleDateFormatCharacters = 'eymdHs';
|
||||
private static $possibleDateFormatCharacters = 'eymdHs';
|
||||
|
||||
/**
|
||||
* Is a given number format code a date/time?
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ class PHPExcel_Shared_Drawing
|
|||
|
||||
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
|
||||
// Calculate the next DWORD-position in the body
|
||||
for ($i = 0 ; $i < $body_size ; $i += 3) {
|
||||
for ($i = 0; $i < $body_size; $i += 3) {
|
||||
// Calculate line-ending and padding
|
||||
if ($x >= $width) {
|
||||
// If padding needed, ignore image-padding
|
||||
|
|
|
@ -79,5 +79,4 @@ class PHPExcel_Shared_Escher_DgContainer
|
|||
{
|
||||
return $this->_spgrContainer = $spgrContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,5 +61,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
|||
{
|
||||
return $this->_BSECollection;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,5 +116,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
|||
{
|
||||
$this->_blipType = $blipType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
|||
{
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,22 +51,17 @@ class PHPExcel_Shared_Excel5
|
|||
$columnDimensions = $sheet->getColumnDimensions();
|
||||
|
||||
// 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
|
||||
$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);
|
||||
}
|
||||
|
@ -98,30 +93,24 @@ class PHPExcel_Shared_Excel5
|
|||
$rowDimensions = $sheet->getRowDimensions();
|
||||
|
||||
// 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
|
||||
$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
|
||||
if ( isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible() ) {
|
||||
if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) {
|
||||
$effectivePixelRowHeight = 0;
|
||||
} else {
|
||||
$effectivePixelRowHeight = $pixelRowHeight;
|
||||
|
@ -313,5 +302,4 @@ class PHPExcel_Shared_Excel5
|
|||
|
||||
return $twoAnchor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,18 +152,18 @@ class PHPExcel_Shared_File
|
|||
|
||||
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||
if ( !function_exists('sys_get_temp_dir')) {
|
||||
if ($temp = getenv('TMP') ) {
|
||||
if (!function_exists('sys_get_temp_dir')) {
|
||||
if ($temp = getenv('TMP')) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
if ($temp = getenv('TEMP') ) {
|
||||
if ($temp = getenv('TEMP')) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
if ($temp = getenv('TMPDIR') ) {
|
||||
if ($temp = getenv('TMPDIR')) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class PHPExcel_Shared_Font
|
|||
{
|
||||
/* Methods for resolving autosize value */
|
||||
const AUTOSIZE_METHOD_APPROX = 'approx';
|
||||
const AUTOSIZE_METHOD_EXACT = 'exact';
|
||||
const AUTOSIZE_METHOD_EXACT = 'exact';
|
||||
|
||||
private static $_autoSizeMethods = array(
|
||||
self::AUTOSIZE_METHOD_APPROX,
|
||||
|
@ -48,84 +48,84 @@ class PHPExcel_Shared_Font
|
|||
const CHARSET_ANSI_LATIN = 0x00;
|
||||
const CHARSET_SYSTEM_DEFAULT = 0x01;
|
||||
const CHARSET_SYMBOL = 0x02;
|
||||
const CHARSET_APPLE_ROMAN = 0x4D;
|
||||
const CHARSET_APPLE_ROMAN = 0x4D;
|
||||
const CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80;
|
||||
const CHARSET_ANSI_KOREAN_HANGUL = 0x81;
|
||||
const CHARSET_ANSI_KOREAN_JOHAB = 0x82;
|
||||
const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; // gb2312
|
||||
const CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88; // big5
|
||||
const CHARSET_ANSI_KOREAN_JOHAB = 0x82;
|
||||
const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; // gb2312
|
||||
const CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88; // big5
|
||||
const CHARSET_ANSI_GREEK = 0xA1;
|
||||
const CHARSET_ANSI_TURKISH = 0xA2;
|
||||
const CHARSET_ANSI_VIETNAMESE = 0xA3;
|
||||
const CHARSET_ANSI_HEBREW = 0xB1;
|
||||
const CHARSET_ANSI_ARABIC = 0xB2;
|
||||
const CHARSET_ANSI_BALTIC = 0xBA;
|
||||
const CHARSET_ANSI_CYRILLIC = 0xCC;
|
||||
const CHARSET_ANSI_THAI = 0xDD;
|
||||
const CHARSET_ANSI_LATIN_II = 0xEE;
|
||||
const CHARSET_OEM_LATIN_I = 0xFF;
|
||||
const CHARSET_ANSI_TURKISH = 0xA2;
|
||||
const CHARSET_ANSI_VIETNAMESE = 0xA3;
|
||||
const CHARSET_ANSI_HEBREW = 0xB1;
|
||||
const CHARSET_ANSI_ARABIC = 0xB2;
|
||||
const CHARSET_ANSI_BALTIC = 0xBA;
|
||||
const CHARSET_ANSI_CYRILLIC = 0xCC;
|
||||
const CHARSET_ANSI_THAI = 0xDD;
|
||||
const CHARSET_ANSI_LATIN_II = 0xEE;
|
||||
const CHARSET_OEM_LATIN_I = 0xFF;
|
||||
|
||||
// XXX: Constants created!
|
||||
/** Font filenames */
|
||||
const ARIAL = 'arial.ttf';
|
||||
const ARIAL = 'arial.ttf';
|
||||
const ARIAL_BOLD = 'arialbd.ttf';
|
||||
const ARIAL_ITALIC = 'ariali.ttf';
|
||||
const ARIAL_BOLD_ITALIC = 'arialbi.ttf';
|
||||
const ARIAL_ITALIC = 'ariali.ttf';
|
||||
const ARIAL_BOLD_ITALIC = 'arialbi.ttf';
|
||||
|
||||
const CALIBRI = 'CALIBRI.TTF';
|
||||
const CALIBRI_BOLD = 'CALIBRIB.TTF';
|
||||
const CALIBRI = 'CALIBRI.TTF';
|
||||
const CALIBRI_BOLD = 'CALIBRIB.TTF';
|
||||
const CALIBRI_ITALIC = 'CALIBRII.TTF';
|
||||
const CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF';
|
||||
const CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF';
|
||||
|
||||
const COMIC_SANS_MS = 'comic.ttf';
|
||||
const COMIC_SANS_MS = 'comic.ttf';
|
||||
const COMIC_SANS_MS_BOLD = 'comicbd.ttf';
|
||||
|
||||
const COURIER_NEW = 'cour.ttf';
|
||||
const COURIER_NEW_BOLD = 'courbd.ttf';
|
||||
const COURIER_NEW = 'cour.ttf';
|
||||
const COURIER_NEW_BOLD = 'courbd.ttf';
|
||||
const COURIER_NEW_ITALIC = 'couri.ttf';
|
||||
const COURIER_NEW_BOLD_ITALIC = 'courbi.ttf';
|
||||
const COURIER_NEW_BOLD_ITALIC = 'courbi.ttf';
|
||||
|
||||
const GEORGIA = 'georgia.ttf';
|
||||
const GEORGIA_BOLD = 'georgiab.ttf';
|
||||
const GEORGIA = 'georgia.ttf';
|
||||
const GEORGIA_BOLD = 'georgiab.ttf';
|
||||
const GEORGIA_ITALIC = 'georgiai.ttf';
|
||||
const GEORGIA_BOLD_ITALIC = 'georgiaz.ttf';
|
||||
const GEORGIA_BOLD_ITALIC = 'georgiaz.ttf';
|
||||
|
||||
const IMPACT = 'impact.ttf';
|
||||
|
||||
const LIBERATION_SANS = 'LiberationSans-Regular.ttf';
|
||||
const LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf';
|
||||
const LIBERATION_SANS = 'LiberationSans-Regular.ttf';
|
||||
const LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf';
|
||||
const LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf';
|
||||
const LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf';
|
||||
const LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf';
|
||||
|
||||
const LUCIDA_CONSOLE = 'lucon.ttf';
|
||||
const LUCIDA_SANS_UNICODE = 'l_10646.ttf';
|
||||
const LUCIDA_SANS_UNICODE = 'l_10646.ttf';
|
||||
|
||||
const MICROSOFT_SANS_SERIF = 'micross.ttf';
|
||||
const MICROSOFT_SANS_SERIF = 'micross.ttf';
|
||||
|
||||
const PALATINO_LINOTYPE = 'pala.ttf';
|
||||
const PALATINO_LINOTYPE = 'pala.ttf';
|
||||
const PALATINO_LINOTYPE_BOLD = 'palab.ttf';
|
||||
const PALATINO_LINOTYPE_ITALIC = 'palai.ttf';
|
||||
const PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf';
|
||||
const PALATINO_LINOTYPE_ITALIC = 'palai.ttf';
|
||||
const PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf';
|
||||
|
||||
const SYMBOL = 'symbol.ttf';
|
||||
|
||||
const TAHOMA = 'tahoma.ttf';
|
||||
const TAHOMA_BOLD = 'tahomabd.ttf';
|
||||
const TAHOMA_BOLD = 'tahomabd.ttf';
|
||||
|
||||
const TIMES_NEW_ROMAN = 'times.ttf';
|
||||
const TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf';
|
||||
const TIMES_NEW_ROMAN = 'times.ttf';
|
||||
const TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf';
|
||||
const TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf';
|
||||
const TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf';
|
||||
const TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf';
|
||||
|
||||
const TREBUCHET_MS = 'trebuc.ttf';
|
||||
const TREBUCHET_MS_BOLD = 'trebucbd.ttf';
|
||||
const TREBUCHET_MS_ITALIC = 'trebucit.ttf';
|
||||
const TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf';
|
||||
const TREBUCHET_MS = 'trebuc.ttf';
|
||||
const TREBUCHET_MS_BOLD = 'trebucbd.ttf';
|
||||
const TREBUCHET_MS_ITALIC = 'trebucit.ttf';
|
||||
const TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf';
|
||||
|
||||
const VERDANA = 'verdana.ttf';
|
||||
const VERDANA_BOLD = 'verdanab.ttf';
|
||||
const VERDANA = 'verdana.ttf';
|
||||
const VERDANA_BOLD = 'verdanab.ttf';
|
||||
const VERDANA_ITALIC = 'verdanai.ttf';
|
||||
const VERDANA_BOLD_ITALIC = 'verdanaz.ttf';
|
||||
const VERDANA_BOLD_ITALIC = 'verdanaz.ttf';
|
||||
|
||||
/**
|
||||
* AutoSize method
|
||||
|
@ -196,12 +196,12 @@ class PHPExcel_Shared_Font
|
|||
*/
|
||||
public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
|
||||
{
|
||||
if (!in_array($pValue,self::$_autoSizeMethods)) {
|
||||
return FALSE;
|
||||
if (!in_array($pValue, self::$_autoSizeMethods)) {
|
||||
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,14 +426,15 @@ 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');
|
||||
}
|
||||
|
||||
$name = $font->getName();
|
||||
$bold = $font->getBold();
|
||||
$italic = $font->getItalic();
|
||||
$italic = $font->getItalic();
|
||||
|
||||
// Check if we can map font to true type font file
|
||||
switch ($name) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -169,7 +169,7 @@ class PHPExcel_Shared_OLE_PPS
|
|||
*/
|
||||
public function _getPpsWk()
|
||||
{
|
||||
$ret = str_pad($this->Name,64,"\x00");
|
||||
$ret = str_pad($this->Name, 64, "\x00");
|
||||
|
||||
$ret .= pack("v", strlen($this->Name) + 2) // 66
|
||||
. pack("c", $this->Type) // 67
|
||||
|
@ -202,9 +202,9 @@ class PHPExcel_Shared_OLE_PPS
|
|||
*/
|
||||
public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
|
||||
{
|
||||
if ( !is_array($to_save) || (empty($to_save)) ) {
|
||||
if (!is_array($to_save) || (empty($to_save))) {
|
||||
return 0xFFFFFFFF;
|
||||
} elseif ( count($to_save) == 1 ) {
|
||||
} elseif (count($to_save) == 1) {
|
||||
$cnt = count($raList);
|
||||
// If the first entry, it's the root... Don't clone it!
|
||||
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* @package PHPExcel_Shared_OLE
|
||||
*/
|
||||
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
{
|
||||
/**
|
||||
* The constructor
|
||||
*
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
* @package PHPExcel_Shared_OLE
|
||||
*/
|
||||
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");
|
||||
|
@ -447,7 +437,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
|||
if ($iBdCnt > $i1stBdL) {
|
||||
$iN=0;
|
||||
$iNb=0;
|
||||
for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) {
|
||||
for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) {
|
||||
if ($iN >= ($iBbCnt - 1)) {
|
||||
$iN = 0;
|
||||
++$iNb;
|
||||
|
|
|
@ -32,39 +32,39 @@ class PHPExcel_Shared_OLERead {
|
|||
private $data = '';
|
||||
|
||||
// OLE identifier
|
||||
const IDENTIFIER_OLE = IDENTIFIER_OLE;
|
||||
const IDENTIFIER_OLE = IDENTIFIER_OLE;
|
||||
|
||||
// Size of a sector = 512 bytes
|
||||
const BIG_BLOCK_SIZE = 0x200;
|
||||
|
||||
// Size of a short sector = 64 bytes
|
||||
const SMALL_BLOCK_SIZE = 0x40;
|
||||
const SMALL_BLOCK_SIZE = 0x40;
|
||||
|
||||
// Size of a directory entry always = 128 bytes
|
||||
const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
|
||||
const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
|
||||
|
||||
// Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams
|
||||
const SMALL_BLOCK_THRESHOLD = 0x1000;
|
||||
const SMALL_BLOCK_THRESHOLD = 0x1000;
|
||||
|
||||
// header offsets
|
||||
const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c;
|
||||
const ROOT_START_BLOCK_POS = 0x30;
|
||||
const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
|
||||
const EXTENSION_BLOCK_POS = 0x44;
|
||||
const NUM_EXTENSION_BLOCK_POS = 0x48;
|
||||
const ROOT_START_BLOCK_POS = 0x30;
|
||||
const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
|
||||
const EXTENSION_BLOCK_POS = 0x44;
|
||||
const NUM_EXTENSION_BLOCK_POS = 0x48;
|
||||
const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c;
|
||||
|
||||
// property storage offsets (directory offsets)
|
||||
const SIZE_OF_NAME_POS = 0x40;
|
||||
const TYPE_POS = 0x42;
|
||||
const START_BLOCK_POS = 0x74;
|
||||
const SIZE_POS = 0x78;
|
||||
const SIZE_OF_NAME_POS = 0x40;
|
||||
const TYPE_POS = 0x42;
|
||||
const START_BLOCK_POS = 0x74;
|
||||
const SIZE_POS = 0x78;
|
||||
|
||||
|
||||
|
||||
public $wrkbook = null;
|
||||
public $summaryInformation = null;
|
||||
public $documentSummaryInformation = null;
|
||||
public $wrkbook = null;
|
||||
public $summaryInformation = null;
|
||||
public $documentSummaryInformation = null;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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'];
|
||||
|
||||
|
@ -222,18 +224,19 @@ class PHPExcel_Shared_OLERead {
|
|||
$block = $bl;
|
||||
$data = '';
|
||||
|
||||
while ($block != -2) {
|
||||
while ($block != -2) {
|
||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read entries in the directory stream.
|
||||
*/
|
||||
private function _readPropertySets() {
|
||||
private function _readPropertySets()
|
||||
{
|
||||
$offset = 0;
|
||||
|
||||
// loop through entires, each entry is 128 bytes
|
||||
|
@ -254,14 +257,14 @@ class PHPExcel_Shared_OLERead {
|
|||
|
||||
$size = self::_GetInt4d($d, self::SIZE_POS);
|
||||
|
||||
$name = str_replace("\x00", "", substr($d,0, $nameSize));
|
||||
$name = str_replace("\x00", "", substr($d, 0, $nameSize));
|
||||
|
||||
|
||||
$this->props[] = array (
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// ----- Constants
|
||||
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
||||
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
|
||||
define('PCLZIP_READ_BLOCK_SIZE', 2048);
|
||||
}
|
||||
|
||||
// ----- File list separator
|
||||
|
@ -38,10 +38,10 @@ if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
|||
// However notice that changing this value, may have impact on existing
|
||||
// scripts, using space separated filenames.
|
||||
// Recommanded values for compatibility with older versions :
|
||||
//define( 'PCLZIP_SEPARATOR', ' ' );
|
||||
//define('PCLZIP_SEPARATOR', ' ');
|
||||
// Recommanded values for smart separation of filenames.
|
||||
if (!defined('PCLZIP_SEPARATOR')) {
|
||||
define( 'PCLZIP_SEPARATOR', ',' );
|
||||
define('PCLZIP_SEPARATOR', ',');
|
||||
}
|
||||
|
||||
// ----- Error configuration
|
||||
|
@ -50,7 +50,7 @@ if (!defined('PCLZIP_SEPARATOR')) {
|
|||
// you must ensure that you have included PclError library.
|
||||
// [2,...] : reserved for futur use
|
||||
if (!defined('PCLZIP_ERROR_EXTERNAL')) {
|
||||
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
|
||||
define('PCLZIP_ERROR_EXTERNAL', 0);
|
||||
}
|
||||
|
||||
// ----- Optional static temporary directory
|
||||
|
@ -60,10 +60,10 @@ if (!defined('PCLZIP_ERROR_EXTERNAL')) {
|
|||
// - MUST BE terminated by a '/'.
|
||||
// - MUST be a valid, already created directory
|
||||
// Samples :
|
||||
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
|
||||
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
|
||||
// define('PCLZIP_TEMPORARY_DIR', '/temp/');
|
||||
// define('PCLZIP_TEMPORARY_DIR', 'C:/Temp/');
|
||||
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
||||
define( 'PCLZIP_TEMPORARY_DIR', '' );
|
||||
define('PCLZIP_TEMPORARY_DIR', '');
|
||||
}
|
||||
|
||||
// ----- Optional threshold ratio for use of temporary files
|
||||
|
@ -73,9 +73,9 @@ if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
|||
// threshold = memory_limit * ratio.
|
||||
// Recommended values are under 0.5. Default 0.47.
|
||||
// Samples :
|
||||
// define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
|
||||
// define('PCLZIP_TEMPORARY_FILE_RATIO', 0.5);
|
||||
if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
|
||||
define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
|
||||
define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
@ -100,77 +100,77 @@ $g_pclzip_version = "2.8.2";
|
|||
// -12 : Unable to rename file (rename)
|
||||
// -13 : Invalid header checksum
|
||||
// -14 : Invalid archive size
|
||||
define( 'PCLZIP_ERR_USER_ABORTED', 2 );
|
||||
define( 'PCLZIP_ERR_NO_ERROR', 0 );
|
||||
define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
|
||||
define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
|
||||
define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
|
||||
define( 'PCLZIP_ERR_MISSING_FILE', -4 );
|
||||
define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
|
||||
define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
|
||||
define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
|
||||
define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
|
||||
define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
|
||||
define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
|
||||
define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
|
||||
define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
|
||||
define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
|
||||
define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
|
||||
define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
|
||||
define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
|
||||
define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
|
||||
define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
|
||||
define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
|
||||
define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
|
||||
define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
|
||||
define('PCLZIP_ERR_USER_ABORTED', 2);
|
||||
define('PCLZIP_ERR_NO_ERROR', 0);
|
||||
define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1);
|
||||
define('PCLZIP_ERR_READ_OPEN_FAIL', -2);
|
||||
define('PCLZIP_ERR_INVALID_PARAMETER', -3);
|
||||
define('PCLZIP_ERR_MISSING_FILE', -4);
|
||||
define('PCLZIP_ERR_FILENAME_TOO_LONG', -5);
|
||||
define('PCLZIP_ERR_INVALID_ZIP', -6);
|
||||
define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7);
|
||||
define('PCLZIP_ERR_DIR_CREATE_FAIL', -8);
|
||||
define('PCLZIP_ERR_BAD_EXTENSION', -9);
|
||||
define('PCLZIP_ERR_BAD_FORMAT', -10);
|
||||
define('PCLZIP_ERR_DELETE_FILE_FAIL', -11);
|
||||
define('PCLZIP_ERR_RENAME_FILE_FAIL', -12);
|
||||
define('PCLZIP_ERR_BAD_CHECKSUM', -13);
|
||||
define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14);
|
||||
define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15);
|
||||
define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16);
|
||||
define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17);
|
||||
define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18);
|
||||
define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19);
|
||||
define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20);
|
||||
define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21);
|
||||
|
||||
// ----- Options values
|
||||
define( 'PCLZIP_OPT_PATH', 77001 );
|
||||
define( 'PCLZIP_OPT_ADD_PATH', 77002 );
|
||||
define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
|
||||
define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
|
||||
define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
|
||||
define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
|
||||
define( 'PCLZIP_OPT_BY_NAME', 77008 );
|
||||
define( 'PCLZIP_OPT_BY_INDEX', 77009 );
|
||||
define( 'PCLZIP_OPT_BY_EREG', 77010 );
|
||||
define( 'PCLZIP_OPT_BY_PREG', 77011 );
|
||||
define( 'PCLZIP_OPT_COMMENT', 77012 );
|
||||
define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
|
||||
define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
|
||||
define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
|
||||
define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
|
||||
define('PCLZIP_OPT_PATH', 77001);
|
||||
define('PCLZIP_OPT_ADD_PATH', 77002);
|
||||
define('PCLZIP_OPT_REMOVE_PATH', 77003);
|
||||
define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004);
|
||||
define('PCLZIP_OPT_SET_CHMOD', 77005);
|
||||
define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006);
|
||||
define('PCLZIP_OPT_NO_COMPRESSION', 77007);
|
||||
define('PCLZIP_OPT_BY_NAME', 77008);
|
||||
define('PCLZIP_OPT_BY_INDEX', 77009);
|
||||
define('PCLZIP_OPT_BY_EREG', 77010);
|
||||
define('PCLZIP_OPT_BY_PREG', 77011);
|
||||
define('PCLZIP_OPT_COMMENT', 77012);
|
||||
define('PCLZIP_OPT_ADD_COMMENT', 77013);
|
||||
define('PCLZIP_OPT_PREPEND_COMMENT', 77014);
|
||||
define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015);
|
||||
define('PCLZIP_OPT_REPLACE_NEWER', 77016);
|
||||
define('PCLZIP_OPT_STOP_ON_ERROR', 77017);
|
||||
// Having big trouble with crypt. Need to multiply 2 long int
|
||||
// which is not correctly supported by PHP ...
|
||||
//define( 'PCLZIP_OPT_CRYPT', 77018 );
|
||||
define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
|
||||
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
|
||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
|
||||
//define('PCLZIP_OPT_CRYPT', 77018);
|
||||
define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019);
|
||||
define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias
|
||||
define('PCLZIP_OPT_TEMP_FILE_ON', 77021);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias
|
||||
define('PCLZIP_OPT_TEMP_FILE_OFF', 77022);
|
||||
define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias
|
||||
|
||||
// ----- File description attributes
|
||||
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
||||
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
||||
define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
|
||||
define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
|
||||
define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
|
||||
define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
|
||||
define('PCLZIP_ATT_FILE_NAME', 79001);
|
||||
define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002);
|
||||
define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003);
|
||||
define('PCLZIP_ATT_FILE_MTIME', 79004);
|
||||
define('PCLZIP_ATT_FILE_CONTENT', 79005);
|
||||
define('PCLZIP_ATT_FILE_COMMENT', 79006);
|
||||
|
||||
// ----- Call backs values
|
||||
define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
|
||||
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
|
||||
define( 'PCLZIP_CB_PRE_ADD', 78003 );
|
||||
define( 'PCLZIP_CB_POST_ADD', 78004 );
|
||||
define('PCLZIP_CB_PRE_EXTRACT', 78001);
|
||||
define('PCLZIP_CB_POST_EXTRACT', 78002);
|
||||
define('PCLZIP_CB_PRE_ADD', 78003);
|
||||
define('PCLZIP_CB_POST_ADD', 78004);
|
||||
/* For futur use
|
||||
define( 'PCLZIP_CB_PRE_LIST', 78005 );
|
||||
define( 'PCLZIP_CB_POST_LIST', 78006 );
|
||||
define( 'PCLZIP_CB_PRE_DELETE', 78007 );
|
||||
define( 'PCLZIP_CB_POST_DELETE', 78008 );
|
||||
define('PCLZIP_CB_PRE_LIST', 78005);
|
||||
define('PCLZIP_CB_POST_LIST', 78006);
|
||||
define('PCLZIP_CB_PRE_DELETE', 78007);
|
||||
define('PCLZIP_CB_POST_DELETE', 78008);
|
||||
*/
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
@ -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 {
|
||||
|
@ -921,7 +920,7 @@ class PclZip
|
|||
// with privParseOptions()
|
||||
$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
|
||||
$v_options_trick = array();
|
||||
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
||||
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional'));
|
||||
if ($v_result != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -1219,9 +1217,9 @@ class PclZip
|
|||
// Description :
|
||||
// Parameters :
|
||||
// --------------------------------------------------------------------------------
|
||||
function errorName($p_with_code=false)
|
||||
function errorName($p_with_code = false)
|
||||
{
|
||||
$v_name = array (
|
||||
$v_name = array(
|
||||
PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
|
||||
PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
|
||||
PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
|
||||
|
@ -1264,7 +1262,7 @@ class PclZip
|
|||
// Description :
|
||||
// Parameters :
|
||||
// --------------------------------------------------------------------------------
|
||||
function errorInfo($p_full=false)
|
||||
function errorInfo($p_full = false)
|
||||
{
|
||||
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
||||
return(PclErrorString());
|
||||
|
@ -1301,7 +1299,7 @@ class PclZip
|
|||
// true on success,
|
||||
// false on error, the error code is set.
|
||||
// --------------------------------------------------------------------------------
|
||||
function privCheckFormat($p_level=0)
|
||||
function privCheckFormat($p_level = 0)
|
||||
{
|
||||
$v_result = true;
|
||||
|
||||
|
@ -1354,7 +1352,7 @@ class PclZip
|
|||
// 1 on success.
|
||||
// 0 on failure.
|
||||
// --------------------------------------------------------------------------------
|
||||
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
|
||||
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false)
|
||||
{
|
||||
$v_result=1;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1439,7 +1437,7 @@ class PclZip
|
|||
$v_result_list[$p_options_list[$i]] = true;
|
||||
break;
|
||||
|
||||
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
|
||||
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION:
|
||||
// ----- Check the number of parameters
|
||||
if (($i+1) >= $p_size) {
|
||||
// ----- Error log
|
||||
|
@ -1450,14 +1448,13 @@ 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;
|
||||
|
||||
break;
|
||||
// ----- 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
|
||||
if (($i+1) >= $p_size) {
|
||||
// ----- Error log
|
||||
|
@ -1480,11 +1477,11 @@ class PclZip
|
|||
$i++;
|
||||
break;
|
||||
// ----- Look for options that request an EREG or PREG expression
|
||||
case PCLZIP_OPT_BY_EREG :
|
||||
case PCLZIP_OPT_BY_EREG:
|
||||
// ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
|
||||
// to PCLZIP_OPT_BY_PREG
|
||||
$p_options_list[$i] = PCLZIP_OPT_BY_PREG;
|
||||
case PCLZIP_OPT_BY_PREG :
|
||||
case PCLZIP_OPT_BY_PREG:
|
||||
//case PCLZIP_OPT_CRYPT :
|
||||
// ----- Check the number of parameters
|
||||
if (($i+1) >= $p_size) {
|
||||
|
@ -1507,9 +1504,9 @@ class PclZip
|
|||
break;
|
||||
|
||||
// ----- Look for options that takes a string
|
||||
case PCLZIP_OPT_COMMENT :
|
||||
case PCLZIP_OPT_ADD_COMMENT :
|
||||
case PCLZIP_OPT_PREPEND_COMMENT :
|
||||
case PCLZIP_OPT_COMMENT:
|
||||
case PCLZIP_OPT_ADD_COMMENT:
|
||||
case PCLZIP_OPT_PREPEND_COMMENT:
|
||||
// ----- Check the number of parameters
|
||||
if (($i+1) >= $p_size) {
|
||||
// ----- Error log
|
||||
|
@ -1533,7 +1530,7 @@ class PclZip
|
|||
break;
|
||||
|
||||
// ----- Look for options that request an array of index
|
||||
case PCLZIP_OPT_BY_INDEX :
|
||||
case PCLZIP_OPT_BY_INDEX:
|
||||
// ----- Check the number of parameters
|
||||
if (($i+1) >= $p_size) {
|
||||
// ----- Error log
|
||||
|
@ -1673,7 +1670,7 @@ class PclZip
|
|||
$v_result_list[$p_options_list[$i]] = $v_function_name;
|
||||
$i++;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
// ----- Error log
|
||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" .$p_options_list[$i]."'");
|
||||
|
||||
|
@ -1762,7 +1759,7 @@ class PclZip
|
|||
// 1 on success.
|
||||
// 0 on failure.
|
||||
// --------------------------------------------------------------------------------
|
||||
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
|
||||
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false)
|
||||
{
|
||||
$v_result=1;
|
||||
|
||||
|
@ -1836,7 +1833,7 @@ class PclZip
|
|||
case PCLZIP_ATT_FILE_CONTENT:
|
||||
$p_filedescr['content'] = $v_value;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
// ----- Error log
|
||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'");
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -2341,8 +2337,8 @@ class PclZip
|
|||
|
||||
// ----- Look if it is a file or a dir with no all path remove option
|
||||
// or a dir with all its path removed
|
||||
// if ( (is_file($p_filedescr_list[$j]['filename']))
|
||||
// || ( is_dir($p_filedescr_list[$j]['filename'])
|
||||
// if ( (is_file($p_filedescr_list[$j]['filename']))
|
||||
// || ( is_dir($p_filedescr_list[$j]['filename'])
|
||||
if (($p_filedescr_list[$j]['type'] == 'file') || ($p_filedescr_list[$j]['type'] == 'virtual_file') || (($p_filedescr_list[$j]['type'] == 'folder') && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
|
||||
// ----- Add the file
|
||||
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options);
|
||||
|
@ -2484,7 +2480,7 @@ class PclZip
|
|||
// ----- Look for a file
|
||||
if ($p_filedescr['type'] == 'file') {
|
||||
// ----- Look for using temporary file to zip
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) {
|
||||
$v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
|
||||
if ($v_result < PCLZIP_ERR_NO_ERROR) {
|
||||
return $v_result;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3053,7 +3048,7 @@ class PclZip
|
|||
$this->privDisableMagicQuotes();
|
||||
|
||||
// ----- Check the path
|
||||
if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path,1,2)!=":/"))) {
|
||||
if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2)!=":/"))) {
|
||||
$p_path = "./".$p_path;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -3533,7 +3516,7 @@ class PclZip
|
|||
}
|
||||
|
||||
// ----- Look for using temporary file to unzip
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
|
||||
if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) {
|
||||
$v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
|
||||
if ($v_result < PCLZIP_ERR_NO_ERROR) {
|
||||
return $v_result;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -4210,7 +4193,7 @@ class PclZip
|
|||
//$v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
||||
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
|
||||
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
|
||||
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
||||
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
||||
|
||||
// ----- Compare the bytes
|
||||
if ($v_bytes == 0x504b0506)
|
||||
|
@ -4369,7 +4352,7 @@ class PclZip
|
|||
// ----- Look for extract by ereg rule
|
||||
// ereg() is deprecated with PHP 5.3
|
||||
/*
|
||||
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
||||
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_list[$v_nb_extracted]['stored_filename'])) {
|
||||
|
@ -4571,11 +4554,10 @@ class PclZip
|
|||
// 1 : OK
|
||||
// -1 : Unable to create directory
|
||||
// --------------------------------------------------------------------------------
|
||||
function privDirCheck($p_dir, $p_is_dir=false)
|
||||
function privDirCheck($p_dir, $p_is_dir = false)
|
||||
{
|
||||
$v_result = 1;
|
||||
|
||||
|
||||
// ----- Remove the final '/'
|
||||
if (($p_is_dir) && (substr($p_dir, -1)=='/')) {
|
||||
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
|
||||
|
@ -4849,7 +4831,7 @@ class PclZip
|
|||
// Description :
|
||||
// Parameters :
|
||||
// --------------------------------------------------------------------------------
|
||||
function privErrorLog($p_error_code=0, $p_error_string='')
|
||||
function privErrorLog($p_error_code = 0, $p_error_string = '')
|
||||
{
|
||||
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
||||
PclError($p_error_code, $p_error_string);
|
||||
|
@ -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
|
||||
|
@ -5057,7 +5039,7 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
|
|||
}
|
||||
|
||||
// ----- Compare the items
|
||||
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
||||
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) {
|
||||
$v_result = 0;
|
||||
}
|
||||
|
||||
|
@ -5097,7 +5079,7 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
|
|||
// 3 : src & dest gzip
|
||||
// Return Values :
|
||||
// --------------------------------------------------------------------------------
|
||||
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
|
||||
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
|
||||
{
|
||||
$v_result = 1;
|
||||
|
||||
|
@ -5204,7 +5186,7 @@ function PclZipUtilOptionText($p_option)
|
|||
// Return Values :
|
||||
// The path translated.
|
||||
// --------------------------------------------------------------------------------
|
||||
function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
|
||||
function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
|
||||
{
|
||||
if (stristr(php_uname(), 'windows')) {
|
||||
// ----- Look for potential disk letter
|
||||
|
|
|
@ -526,21 +526,22 @@ 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;
|
||||
}
|
||||
$c0 = ord($str{0});
|
||||
$c1 = ord($str{1});
|
||||
if ($c0 == 0xfe && $c1 == 0xff) {
|
||||
$str = substr($str,2);
|
||||
$str = substr($str, 2);
|
||||
} elseif ($c0 == 0xff && $c1 == 0xfe) {
|
||||
$str = substr($str,2);
|
||||
$str = substr($str, 2);
|
||||
$bom_be = false;
|
||||
}
|
||||
$len = strlen($str);
|
||||
$newstr = '';
|
||||
for($i=0;$i<$len;$i+=2) {
|
||||
for ($i=0; $i<$len; $i+=2) {
|
||||
if ($bom_be) {
|
||||
$val = ord($str{$i}) << 4;
|
||||
$val += ord($str{$i+1});
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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()
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ class PHPExcel_Best_Fit
|
|||
* @param int $dp Number of places of decimal precision to display
|
||||
* @return string
|
||||
*/
|
||||
public function getIntersect($dp=0)
|
||||
public function getIntersect($dp = 0)
|
||||
{
|
||||
if ($dp != 0) {
|
||||
return round($this->_intersect, $dp);
|
||||
|
@ -347,7 +347,7 @@ class PHPExcel_Best_Fit
|
|||
|
||||
$this->_SSRegression = $this->_goodnessOfFit * $SStot;
|
||||
$this->_covariance = $SScov / $this->_valueCount;
|
||||
$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX,2)) * ($this->_valueCount * $sumY2 - pow($sumY,2)));
|
||||
$this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX, 2)) * ($this->_valueCount * $sumY2 - pow($sumY, 2)));
|
||||
$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
|
||||
$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
|
||||
if ($this->_SSResiduals != 0.0) {
|
||||
|
@ -373,7 +373,7 @@ class PHPExcel_Best_Fit
|
|||
$meanX = $x_sum / $this->_valueCount;
|
||||
$meanY = $y_sum / $this->_valueCount;
|
||||
$mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0;
|
||||
for($i = 0; $i < $this->_valueCount; ++$i) {
|
||||
for ($i = 0; $i < $this->_valueCount; ++$i) {
|
||||
$xy_sum += $xValues[$i] * $yValues[$i];
|
||||
$xx_sum += $xValues[$i] * $xValues[$i];
|
||||
$yy_sum += $yValues[$i] * $yValues[$i];
|
||||
|
@ -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);
|
||||
|
|
|
@ -54,7 +54,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
|||
**/
|
||||
public function getValueOfYForX($xValue)
|
||||
{
|
||||
return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset));
|
||||
return $this->getIntersect() * pow($this->getSlope(), ($xValue - $this->_Xoffset));
|
||||
} // function getValueOfYForX()
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,7 +161,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
|||
$x_sum = array_sum($xValues);
|
||||
$y_sum = array_sum($yValues);
|
||||
$xx_sum = $xy_sum = 0;
|
||||
for($i = 0; $i < $this->_valueCount; ++$i) {
|
||||
for ($i = 0; $i < $this->_valueCount; ++$i) {
|
||||
$xy_sum += $xValues[$i] * $yValues[$i];
|
||||
$xx_sum += $xValues[$i] * $xValues[$i];
|
||||
$yy_sum += $yValues[$i] * $yValues[$i];
|
||||
|
@ -187,7 +187,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
|||
$C = $matrixA->solve($matrixB);
|
||||
|
||||
$coefficients = array();
|
||||
for($i = 0; $i < $C->m; ++$i) {
|
||||
for ($i = 0; $i < $C->m; ++$i) {
|
||||
$r = $C->get($i, 0);
|
||||
if (abs($r) <= pow(10, -9)) {
|
||||
$r = 0;
|
||||
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue