@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Send notification to the cache controller |
| 104 | 104 | * |
| 105 | - * @return void |
|
| 105 | + * @return PHPExcel_Cell |
|
| 106 | 106 | **/ |
| 107 | 107 | public function notifyCacheController() { |
| 108 | 108 | $this->_parent->getCellCacheController()->updateCacheData($this); |
@@ -113,6 +113,9 @@ discard block |
||
| 113 | 113 | $this->_parent = null; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param PHPExcel_Worksheet|null $parent |
|
| 118 | + */ |
|
| 116 | 119 | public function attach($parent) { |
| 117 | 120 | $this->_parent = $parent; |
| 118 | 121 | } |
@@ -498,7 +501,7 @@ discard block |
||
| 498 | 501 | * Coordinate from string |
| 499 | 502 | * |
| 500 | 503 | * @param string $pCoordinateString |
| 501 | - * @return array Array containing column and row (indexes 0 and 1) |
|
| 504 | + * @return string[] Array containing column and row (indexes 0 and 1) |
|
| 502 | 505 | * @throws Exception |
| 503 | 506 | */ |
| 504 | 507 | public static function coordinateFromString($pCoordinateString = 'A1') |
@@ -652,7 +655,7 @@ discard block |
||
| 652 | 655 | * Calculate range boundaries |
| 653 | 656 | * |
| 654 | 657 | * @param string $pRange Cell range (e.g. A1:A1) |
| 655 | - * @return array Range boundaries (staring Column, starting Row, Final Column, Final Row) |
|
| 658 | + * @return integer Range boundaries (staring Column, starting Row, Final Column, Final Row) |
|
| 656 | 659 | */ |
| 657 | 660 | public static function getRangeBoundaries($pRange = 'A1:A1') |
| 658 | 661 | { |
@@ -203,8 +203,8 @@ |
||
| 203 | 203 | public function getFormattedValue() |
| 204 | 204 | { |
| 205 | 205 | return (string) PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), |
| 206 | - $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
|
| 207 | - ); |
|
| 206 | + $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
|
| 207 | + ); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
| 147 | 147 | $this->_dataType = $pDataType; |
| 148 | 148 | } else { |
| 149 | - if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|
| 149 | + if ( ! self::getValueBinder()->bindValue($this, $pValue)) { |
|
| 150 | 150 | throw new Exception("Value could not be bound to cell."); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function getCoordinate() |
| 184 | 184 | { |
| 185 | - return $this->_column . $this->_row; |
|
| 185 | + return $this->_column.$this->_row; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getFormattedValue() |
| 204 | 204 | { |
| 205 | - return (string) PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), |
|
| 205 | + return (string) PHPExcel_Style_NumberFormat::toFormattedString($this->getCalculatedValue(), |
|
| 206 | 206 | $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
| 207 | 207 | ); |
| 208 | 208 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function setValue($pValue = null) |
| 219 | 219 | { |
| 220 | - if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|
| 220 | + if ( ! self::getValueBinder()->bindValue($this, $pValue)) { |
|
| 221 | 221 | throw new Exception("Value could not be bound to cell."); |
| 222 | 222 | } |
| 223 | 223 | return $this; |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | break; |
| 245 | 245 | |
| 246 | 246 | case PHPExcel_Cell_DataType::TYPE_NUMERIC: |
| 247 | - $this->_value = (float)$pValue; |
|
| 247 | + $this->_value = (float) $pValue; |
|
| 248 | 248 | break; |
| 249 | 249 | |
| 250 | 250 | case PHPExcel_Cell_DataType::TYPE_FORMULA: |
| 251 | - $this->_value = (string)$pValue; |
|
| 251 | + $this->_value = (string) $pValue; |
|
| 252 | 252 | break; |
| 253 | 253 | |
| 254 | 254 | case PHPExcel_Cell_DataType::TYPE_BOOL: |
| 255 | - $this->_value = (bool)$pValue; |
|
| 255 | + $this->_value = (bool) $pValue; |
|
| 256 | 256 | break; |
| 257 | 257 | |
| 258 | 258 | case PHPExcel_Cell_DataType::TYPE_ERROR: |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | break; |
| 261 | 261 | |
| 262 | 262 | default: |
| 263 | - throw new Exception('Invalid datatype: ' . $pDataType); |
|
| 263 | + throw new Exception('Invalid datatype: '.$pDataType); |
|
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -275,15 +275,15 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return mixed |
| 277 | 277 | */ |
| 278 | - public function getCalculatedValue($resetLog=true) |
|
| 278 | + public function getCalculatedValue($resetLog = true) |
|
| 279 | 279 | { |
| 280 | 280 | // echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'<br />'; |
| 281 | 281 | if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { |
| 282 | 282 | try { |
| 283 | 283 | // echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value<br />'; |
| 284 | - $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog); |
|
| 284 | + $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this, $resetLog); |
|
| 285 | 285 | // echo $this->getCoordinate().' calculation result is '.$result.'<br />'; |
| 286 | - } catch ( Exception $ex ) { |
|
| 286 | + } catch (Exception $ex) { |
|
| 287 | 287 | if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { |
| 288 | 288 | // echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />'; |
| 289 | 289 | return $this->_calculatedValue; // Fallback for calculations referencing external files. |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function hasDataValidation() |
| 369 | 369 | { |
| 370 | - if (!isset($this->_parent)) { |
|
| 370 | + if ( ! isset($this->_parent)) { |
|
| 371 | 371 | throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | public function getDataValidation() |
| 383 | 383 | { |
| 384 | - if (!isset($this->_parent)) { |
|
| 384 | + if ( ! isset($this->_parent)) { |
|
| 385 | 385 | throw new Exception('Cannot get data validation for cell that is not bound to a worksheet'); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null) |
| 399 | 399 | { |
| 400 | - if (!isset($this->_parent)) { |
|
| 400 | + if ( ! isset($this->_parent)) { |
|
| 401 | 401 | throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); |
| 402 | 402 | } |
| 403 | 403 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | public function hasHyperlink() |
| 415 | 415 | { |
| 416 | - if (!isset($this->_parent)) { |
|
| 416 | + if ( ! isset($this->_parent)) { |
|
| 417 | 417 | throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); |
| 418 | 418 | } |
| 419 | 419 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function getHyperlink() |
| 430 | 430 | { |
| 431 | - if (!isset($this->_parent)) { |
|
| 431 | + if ( ! isset($this->_parent)) { |
|
| 432 | 432 | throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); |
| 433 | 433 | } |
| 434 | 434 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null) |
| 446 | 446 | { |
| 447 | - if (!isset($this->_parent)) { |
|
| 447 | + if ( ! isset($this->_parent)) { |
|
| 448 | 448 | throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); |
| 449 | 449 | } |
| 450 | 450 | |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | */ |
| 483 | 483 | public function isInRange($pRange = 'A1:A1') |
| 484 | 484 | { |
| 485 | - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
| 485 | + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
| 486 | 486 | |
| 487 | 487 | // Translate properties |
| 488 | - $myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()); |
|
| 489 | - $myRow = $this->getRow(); |
|
| 488 | + $myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()); |
|
| 489 | + $myRow = $this->getRow(); |
|
| 490 | 490 | |
| 491 | 491 | // Verify if cell is in range |
| 492 | 492 | return (($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) && |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | public static function coordinateFromString($pCoordinateString = 'A1') |
| 505 | 505 | { |
| 506 | 506 | if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { |
| 507 | - return array($matches[1],$matches[2]); |
|
| 508 | - } elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) { |
|
| 507 | + return array($matches[1], $matches[2]); |
|
| 508 | + } elseif ((strpos($pCoordinateString, ':') !== false) || (strpos($pCoordinateString, ',') !== false)) { |
|
| 509 | 509 | throw new Exception('Cell coordinate string can not be a range of cells.'); |
| 510 | 510 | } elseif ($pCoordinateString == '') { |
| 511 | 511 | throw new Exception('Cell coordinate can not be zero-length string.'); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | */ |
| 524 | 524 | public static function absoluteReference($pCoordinateString = 'A1') |
| 525 | 525 | { |
| 526 | - if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) { |
|
| 526 | + if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) { |
|
| 527 | 527 | // Create absolute coordinate |
| 528 | 528 | if (ctype_digit($pCoordinateString)) { |
| 529 | 529 | return '$'.$pCoordinateString; |
@@ -545,20 +545,20 @@ discard block |
||
| 545 | 545 | */ |
| 546 | 546 | public static function absoluteCoordinate($pCoordinateString = 'A1') |
| 547 | 547 | { |
| 548 | - if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) { |
|
| 548 | + if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) { |
|
| 549 | 549 | // Create absolute coordinate |
| 550 | 550 | $worksheet = ''; |
| 551 | - $cellAddress = explode('!',$pCoordinateString); |
|
| 551 | + $cellAddress = explode('!', $pCoordinateString); |
|
| 552 | 552 | if (count($cellAddress) == 2) { |
| 553 | - list($worksheet,$pCoordinateString) = $cellAddress; |
|
| 553 | + list($worksheet, $pCoordinateString) = $cellAddress; |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString); |
| 557 | - if ($column[0] == '$') $column = substr($column,1); |
|
| 558 | - if ($row[0] == '$') $row = substr($row,1); |
|
| 557 | + if ($column[0] == '$') $column = substr($column, 1); |
|
| 558 | + if ($row[0] == '$') $row = substr($row, 1); |
|
| 559 | 559 | if ($worksheet > '') |
| 560 | 560 | $worksheet .= '!'; |
| 561 | - return $worksheet . '$' . $column . '$' . $row; |
|
| 561 | + return $worksheet.'$'.$column.'$'.$row; |
|
| 562 | 562 | } else { |
| 563 | 563 | throw new Exception("Coordinate string should not be a cell range."); |
| 564 | 564 | } |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | public static function buildRange($pRange) |
| 591 | 591 | { |
| 592 | 592 | // Verify range |
| 593 | - if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) { |
|
| 593 | + if ( ! is_array($pRange) || empty($pRange) || ! is_array($pRange[0])) { |
|
| 594 | 594 | throw new Exception('Range does not contain any information.'); |
| 595 | 595 | } |
| 596 | 596 | |
@@ -625,11 +625,11 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | // Calculate range outer borders |
| 627 | 627 | $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); |
| 628 | - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
| 628 | + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
| 629 | 629 | |
| 630 | 630 | // Translate column into index |
| 631 | - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]); |
|
| 632 | - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]); |
|
| 631 | + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]); |
|
| 632 | + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]); |
|
| 633 | 633 | |
| 634 | 634 | return array($rangeStart, $rangeEnd); |
| 635 | 635 | } |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | public static function rangeDimension($pRange = 'A1:A1') |
| 644 | 644 | { |
| 645 | 645 | // Calculate range outer borders |
| 646 | - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
| 646 | + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
| 647 | 647 | |
| 648 | - return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); |
|
| 648 | + return array(($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)); |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | list($rangeA, $rangeB) = explode(':', $pRange); |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | - return array( self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)); |
|
| 669 | + return array(self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /** |
@@ -699,18 +699,18 @@ discard block |
||
| 699 | 699 | // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString |
| 700 | 700 | // for improved performance |
| 701 | 701 | if (isset($pString{0})) { |
| 702 | - if (!isset($pString{1})) { |
|
| 702 | + if ( ! isset($pString{1})) { |
|
| 703 | 703 | $_indexCache[$pString] = $_columnLookup[$pString]; |
| 704 | 704 | return $_indexCache[$pString]; |
| 705 | - } elseif(!isset($pString{2})) { |
|
| 705 | + } elseif ( ! isset($pString{2})) { |
|
| 706 | 706 | $_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}]; |
| 707 | 707 | return $_indexCache[$pString]; |
| 708 | - } elseif(!isset($pString{3})) { |
|
| 708 | + } elseif ( ! isset($pString{3})) { |
|
| 709 | 709 | $_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}]; |
| 710 | 710 | return $_indexCache[$pString]; |
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | - throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty") . "."); |
|
| 713 | + throw new Exception("Column string index can not be ".((isset($pString{0})) ? "longer than 3 characters" : "empty")."."); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -726,16 +726,16 @@ discard block |
||
| 726 | 726 | // though it's additional memory overhead |
| 727 | 727 | static $_indexCache = array(); |
| 728 | 728 | |
| 729 | - if (!isset($_indexCache[$pColumnIndex])) { |
|
| 729 | + if ( ! isset($_indexCache[$pColumnIndex])) { |
|
| 730 | 730 | // Determine column string |
| 731 | 731 | if ($pColumnIndex < 26) { |
| 732 | 732 | $_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex); |
| 733 | 733 | } elseif ($pColumnIndex < 702) { |
| 734 | - $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) . |
|
| 734 | + $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)). |
|
| 735 | 735 | chr(65 + $pColumnIndex % 26); |
| 736 | 736 | } else { |
| 737 | - $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) . |
|
| 738 | - chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . |
|
| 737 | + $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)). |
|
| 738 | + chr(65 + ((($pColumnIndex - 26) % 676) / 26)). |
|
| 739 | 739 | chr(65 + $pColumnIndex % 26); |
| 740 | 740 | } |
| 741 | 741 | } |
@@ -756,24 +756,24 @@ discard block |
||
| 756 | 756 | $cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange))); |
| 757 | 757 | foreach ($cellBlocks as $cellBlock) { |
| 758 | 758 | // Single cell? |
| 759 | - if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) { |
|
| 759 | + if (strpos($cellBlock, ':') === false && strpos($cellBlock, ',') === false) { |
|
| 760 | 760 | $returnValue[] = $cellBlock; |
| 761 | 761 | continue; |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // Range... |
| 765 | 765 | $ranges = PHPExcel_Cell::splitRange($cellBlock); |
| 766 | - foreach($ranges as $range) { |
|
| 766 | + foreach ($ranges as $range) { |
|
| 767 | 767 | // Single cell? |
| 768 | - if (!isset($range[1])) { |
|
| 768 | + if ( ! isset($range[1])) { |
|
| 769 | 769 | $returnValue[] = $range[0]; |
| 770 | 770 | continue; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Range... |
| 774 | - list($rangeStart, $rangeEnd) = $range; |
|
| 775 | - list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d'); |
|
| 776 | - list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d'); |
|
| 774 | + list($rangeStart, $rangeEnd) = $range; |
|
| 775 | + list($startCol, $startRow) = sscanf($rangeStart, '%[A-Z]%d'); |
|
| 776 | + list($endCol, $endRow) = sscanf($rangeEnd, '%[A-Z]%d'); |
|
| 777 | 777 | $endCol++; |
| 778 | 778 | |
| 779 | 779 | // Current data |
@@ -142,8 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // Set datatype? |
| 144 | 144 | if ($pDataType !== null) { |
| 145 | - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|
| 146 | - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
| 145 | + if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { |
|
| 146 | + $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
| 147 | + } |
|
| 147 | 148 | $this->_dataType = $pDataType; |
| 148 | 149 | } else { |
| 149 | 150 | if (!self::getValueBinder()->bindValue($this, $pValue)) { |
@@ -352,8 +353,9 @@ discard block |
||
| 352 | 353 | */ |
| 353 | 354 | public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) |
| 354 | 355 | { |
| 355 | - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|
| 356 | - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
| 356 | + if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { |
|
| 357 | + $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
| 358 | + } |
|
| 357 | 359 | |
| 358 | 360 | $this->_dataType = $pDataType; |
| 359 | 361 | |
@@ -554,10 +556,15 @@ discard block |
||
| 554 | 556 | } |
| 555 | 557 | |
| 556 | 558 | list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString); |
| 557 | - if ($column[0] == '$') $column = substr($column,1); |
|
| 558 | - if ($row[0] == '$') $row = substr($row,1); |
|
| 559 | - if ($worksheet > '') |
|
| 560 | - $worksheet .= '!'; |
|
| 559 | + if ($column[0] == '$') { |
|
| 560 | + $column = substr($column,1); |
|
| 561 | + } |
|
| 562 | + if ($row[0] == '$') { |
|
| 563 | + $row = substr($row,1); |
|
| 564 | + } |
|
| 565 | + if ($worksheet > '') { |
|
| 566 | + $worksheet .= '!'; |
|
| 567 | + } |
|
| 561 | 568 | return $worksheet . '$' . $column . '$' . $row; |
| 562 | 569 | } else { |
| 563 | 570 | throw new Exception("Coordinate string should not be a cell range."); |
@@ -683,8 +690,9 @@ discard block |
||
| 683 | 690 | // though it's additional memory overhead |
| 684 | 691 | static $_indexCache = array(); |
| 685 | 692 | |
| 686 | - if (isset($_indexCache[$pString])) |
|
| 687 | - return $_indexCache[$pString]; |
|
| 693 | + if (isset($_indexCache[$pString])) { |
|
| 694 | + return $_indexCache[$pString]; |
|
| 695 | + } |
|
| 688 | 696 | |
| 689 | 697 | // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() |
| 690 | 698 | // and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | /** |
| 177 | 177 | * Get Plot Grouping Type |
| 178 | 178 | * |
| 179 | - * @return string |
|
| 179 | + * @return boolean |
|
| 180 | 180 | */ |
| 181 | 181 | public function getPlotGrouping() { |
| 182 | 182 | return $this->_plotGrouping; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | /** |
| 195 | 195 | * Get Plot Direction |
| 196 | 196 | * |
| 197 | - * @return string |
|
| 197 | + * @return boolean |
|
| 198 | 198 | */ |
| 199 | 199 | public function getPlotDirection() { |
| 200 | 200 | return $this->_plotDirection; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | /** |
| 321 | 321 | * Get Smooth Line |
| 322 | 322 | * |
| 323 | - * @return boolean |
|
| 323 | + * @return string |
|
| 324 | 324 | */ |
| 325 | 325 | public function getSmoothLine() { |
| 326 | 326 | return $this->_smoothLine; |
@@ -336,7 +336,7 @@ |
||
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | public function refresh(PHPExcel_Worksheet $worksheet) { |
| 339 | - foreach($this->_plotValues as $plotValues) { |
|
| 339 | + foreach($this->_plotValues as $plotValues) { |
|
| 340 | 340 | $plotValues->refresh($worksheet); |
| 341 | 341 | } |
| 342 | 342 | } |
@@ -37,25 +37,25 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | |
| 39 | 39 | const TYPE_BARCHART = 'barChart'; |
| 40 | - const TYPE_BARCHART_3D = 'bar3DChart'; |
|
| 40 | + const TYPE_BARCHART_3D = 'bar3DChart'; |
|
| 41 | 41 | const TYPE_LINECHART = 'lineChart'; |
| 42 | 42 | const TYPE_LINECHART_3D = 'line3DChart'; |
| 43 | 43 | const TYPE_AREACHART = 'areaChart'; |
| 44 | 44 | const TYPE_AREACHART_3D = 'area3DChart'; |
| 45 | 45 | const TYPE_PIECHART = 'pieChart'; |
| 46 | - const TYPE_PIECHART_3D = 'pie3DChart'; |
|
| 47 | - const TYPE_DOUGHTNUTCHART = 'doughnutChart'; |
|
| 48 | - const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym |
|
| 46 | + const TYPE_PIECHART_3D = 'pie3DChart'; |
|
| 47 | + const TYPE_DOUGHTNUTCHART = 'doughnutChart'; |
|
| 48 | + const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym |
|
| 49 | 49 | const TYPE_SCATTERCHART = 'scatterChart'; |
| 50 | 50 | const TYPE_SURFACECHART = 'surfaceChart'; |
| 51 | - const TYPE_SURFACECHART_3D = 'surface3DChart'; |
|
| 51 | + const TYPE_SURFACECHART_3D = 'surface3DChart'; |
|
| 52 | 52 | const TYPE_RADARCHART = 'radarChart'; |
| 53 | - const TYPE_BUBBLECHART = 'bubbleChart'; |
|
| 53 | + const TYPE_BUBBLECHART = 'bubbleChart'; |
|
| 54 | 54 | const TYPE_STOCKCHART = 'stockChart'; |
| 55 | 55 | |
| 56 | 56 | const GROUPING_CLUSTERED = 'clustered'; |
| 57 | - const GROUPING_STACKED = 'stacked'; |
|
| 58 | - const GROUPING_PERCENT_STACKED = 'percentStacked'; |
|
| 57 | + const GROUPING_STACKED = 'stacked'; |
|
| 58 | + const GROUPING_PERCENT_STACKED = 'percentStacked'; |
|
| 59 | 59 | const GROUPING_STANDARD = 'standard'; |
| 60 | 60 | |
| 61 | 61 | const DIRECTION_BAR = 'bar'; |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function getPlotLabelByIndex($index) { |
| 236 | 236 | $keys = array_keys($this->_plotLabel); |
| 237 | - if (in_array($index,$keys)) { |
|
| 237 | + if (in_array($index, $keys)) { |
|
| 238 | 238 | return $this->_plotLabel[$index]; |
| 239 | - } elseif(isset($keys[$index])) { |
|
| 239 | + } elseif (isset($keys[$index])) { |
|
| 240 | 240 | return $this->_plotLabel[$keys[$index]]; |
| 241 | 241 | } |
| 242 | 242 | return false; |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function getPlotCategoryByIndex($index) { |
| 260 | 260 | $keys = array_keys($this->_plotCategory); |
| 261 | - if (in_array($index,$keys)) { |
|
| 261 | + if (in_array($index, $keys)) { |
|
| 262 | 262 | return $this->_plotCategory[$index]; |
| 263 | - } elseif(isset($keys[$index])) { |
|
| 263 | + } elseif (isset($keys[$index])) { |
|
| 264 | 264 | return $this->_plotCategory[$keys[$index]]; |
| 265 | 265 | } |
| 266 | 266 | return false; |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | */ |
| 301 | 301 | public function getPlotValuesByIndex($index) { |
| 302 | 302 | $keys = array_keys($this->_plotValues); |
| 303 | - if (in_array($index,$keys)) { |
|
| 303 | + if (in_array($index, $keys)) { |
|
| 304 | 304 | return $this->_plotValues[$index]; |
| 305 | - } elseif(isset($keys[$index])) { |
|
| 305 | + } elseif (isset($keys[$index])) { |
|
| 306 | 306 | return $this->_plotValues[$keys[$index]]; |
| 307 | 307 | } |
| 308 | 308 | return false; |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | public function refresh(PHPExcel_Worksheet $worksheet) { |
| 339 | - foreach($this->_plotValues as $plotValues) { |
|
| 339 | + foreach ($this->_plotValues as $plotValues) { |
|
| 340 | 340 | $plotValues->refresh($worksheet); |
| 341 | 341 | } |
| 342 | 342 | } |
@@ -80,6 +80,8 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Create a new PHPExcel_Chart_DataSeriesValues object |
| 83 | + * @param string $dataType |
|
| 84 | + * @param string $dataSource |
|
| 83 | 85 | */ |
| 84 | 86 | public function __construct($dataType = null, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) |
| 85 | 87 | { |
@@ -191,7 +193,7 @@ discard block |
||
| 191 | 193 | /** |
| 192 | 194 | * Identify if the Data Series is a multi-level or a simple series |
| 193 | 195 | * |
| 194 | - * @return boolean |
|
| 196 | + * @return boolean|null |
|
| 195 | 197 | */ |
| 196 | 198 | public function isMultiLevelSeries() { |
| 197 | 199 | if (count($this->_dataValues) > 0) { |
@@ -203,7 +205,7 @@ discard block |
||
| 203 | 205 | /** |
| 204 | 206 | * Return the level count of a multi-level Data Series |
| 205 | 207 | * |
| 206 | - * @return boolean |
|
| 208 | + * @return integer |
|
| 207 | 209 | */ |
| 208 | 210 | public function multiLevelCount() { |
| 209 | 211 | $levelCount = 0; |
@@ -258,12 +258,12 @@ |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | public function refresh(PHPExcel_Worksheet $worksheet) { |
| 261 | - if ($this->_dataSource !== NULL) { |
|
| 262 | - $calcEngine = PHPExcel_Calculation::getInstance(); |
|
| 261 | + if ($this->_dataSource !== NULL) { |
|
| 262 | + $calcEngine = PHPExcel_Calculation::getInstance(); |
|
| 263 | 263 | $this->_dataValues = PHPExcel_Calculation::_unwrapResult( |
| 264 | - $calcEngine->_calculateFormulaValue( |
|
| 265 | - $this->_dataSource |
|
| 266 | - ) |
|
| 264 | + $calcEngine->_calculateFormulaValue( |
|
| 265 | + $this->_dataSource |
|
| 266 | + ) |
|
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -207,8 +207,8 @@ |
||
| 207 | 207 | */ |
| 208 | 208 | public function multiLevelCount() { |
| 209 | 209 | $levelCount = 0; |
| 210 | - foreach($this->_dataValues as $dataValueSet) { |
|
| 211 | - $levelCount = max($levelCount,count($dataValueSet)); |
|
| 210 | + foreach ($this->_dataValues as $dataValueSet) { |
|
| 211 | + $levelCount = max($levelCount, count($dataValueSet)); |
|
| 212 | 212 | } |
| 213 | 213 | return $levelCount; |
| 214 | 214 | } |
@@ -71,6 +71,9 @@ discard block |
||
| 71 | 71 | private static $_plotMark = 0; |
| 72 | 72 | |
| 73 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $markerID |
|
| 76 | + */ |
|
| 74 | 77 | private function _formatPointMarker($seriesPlot,$markerID) { |
| 75 | 78 | $plotMarkKeys = array_keys(self::$_markSet); |
| 76 | 79 | if (is_null($markerID)) { |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | } // function _formatDataSetLabels() |
| 133 | 136 | |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param integer $seriesCount |
|
| 140 | + */ |
|
| 135 | 141 | private function _percentageSumCalculation($groupID,$seriesCount) { |
| 136 | 142 | // Adjust our values to a percentage value across all series in the group |
| 137 | 143 | for($i = 0; $i < $seriesCount; ++$i) { |
@@ -162,6 +168,9 @@ discard block |
||
| 162 | 168 | } // function _percentageAdjustValues() |
| 163 | 169 | |
| 164 | 170 | |
| 171 | + /** |
|
| 172 | + * @param PHPExcel_Chart_Title $captionElement |
|
| 173 | + */ |
|
| 165 | 174 | private function _getCaption($captionElement) { |
| 166 | 175 | // Read any caption |
| 167 | 176 | $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
@@ -263,6 +272,9 @@ discard block |
||
| 263 | 272 | } // function _renderRadarPlotArea() |
| 264 | 273 | |
| 265 | 274 | |
| 275 | + /** |
|
| 276 | + * @param integer $groupID |
|
| 277 | + */ |
|
| 266 | 278 | private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') { |
| 267 | 279 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 268 | 280 | |
@@ -325,6 +337,9 @@ discard block |
||
| 325 | 337 | } // function _renderPlotLine() |
| 326 | 338 | |
| 327 | 339 | |
| 340 | + /** |
|
| 341 | + * @param integer $groupID |
|
| 342 | + */ |
|
| 328 | 343 | private function _renderPlotBar($groupID, $dimensions = '2d') { |
| 329 | 344 | $rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); |
| 330 | 345 | // Rotate for bar rather than column chart |
@@ -409,6 +424,10 @@ discard block |
||
| 409 | 424 | } // function _renderPlotBar() |
| 410 | 425 | |
| 411 | 426 | |
| 427 | + /** |
|
| 428 | + * @param integer $groupID |
|
| 429 | + * @param boolean $bubble |
|
| 430 | + */ |
|
| 412 | 431 | private function _renderPlotScatter($groupID,$bubble) { |
| 413 | 432 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 414 | 433 | $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
@@ -454,6 +473,9 @@ discard block |
||
| 454 | 473 | } // function _renderPlotScatter() |
| 455 | 474 | |
| 456 | 475 | |
| 476 | + /** |
|
| 477 | + * @param integer $groupID |
|
| 478 | + */ |
|
| 457 | 479 | private function _renderPlotRadar($groupID) { |
| 458 | 480 | $radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 459 | 481 | |
@@ -492,6 +514,9 @@ discard block |
||
| 492 | 514 | } // function _renderPlotRadar() |
| 493 | 515 | |
| 494 | 516 | |
| 517 | + /** |
|
| 518 | + * @param integer $groupID |
|
| 519 | + */ |
|
| 495 | 520 | private function _renderPlotContour($groupID) { |
| 496 | 521 | $contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 497 | 522 | |
@@ -512,6 +537,9 @@ discard block |
||
| 512 | 537 | } // function _renderPlotContour() |
| 513 | 538 | |
| 514 | 539 | |
| 540 | + /** |
|
| 541 | + * @param integer $groupID |
|
| 542 | + */ |
|
| 515 | 543 | private function _renderPlotStock($groupID) { |
| 516 | 544 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 517 | 545 | $plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); |
@@ -533,6 +561,9 @@ discard block |
||
| 533 | 561 | } // function _renderPlotStock() |
| 534 | 562 | |
| 535 | 563 | |
| 564 | + /** |
|
| 565 | + * @param integer $groupCount |
|
| 566 | + */ |
|
| 536 | 567 | private function _renderAreaChart($groupCount, $dimensions = '2d') { |
| 537 | 568 | require_once('jpgraph_line.php'); |
| 538 | 569 | |
@@ -544,6 +575,9 @@ discard block |
||
| 544 | 575 | } // function _renderAreaChart() |
| 545 | 576 | |
| 546 | 577 | |
| 578 | + /** |
|
| 579 | + * @param integer $groupCount |
|
| 580 | + */ |
|
| 547 | 581 | private function _renderLineChart($groupCount, $dimensions = '2d') { |
| 548 | 582 | require_once('jpgraph_line.php'); |
| 549 | 583 | |
@@ -555,6 +589,9 @@ discard block |
||
| 555 | 589 | } // function _renderLineChart() |
| 556 | 590 | |
| 557 | 591 | |
| 592 | + /** |
|
| 593 | + * @param integer $groupCount |
|
| 594 | + */ |
|
| 558 | 595 | private function _renderBarChart($groupCount, $dimensions = '2d') { |
| 559 | 596 | require_once('jpgraph_bar.php'); |
| 560 | 597 | |
@@ -566,6 +603,9 @@ discard block |
||
| 566 | 603 | } // function _renderBarChart() |
| 567 | 604 | |
| 568 | 605 | |
| 606 | + /** |
|
| 607 | + * @param integer $groupCount |
|
| 608 | + */ |
|
| 569 | 609 | private function _renderScatterChart($groupCount) { |
| 570 | 610 | require_once('jpgraph_scatter.php'); |
| 571 | 611 | require_once('jpgraph_regstat.php'); |
@@ -579,6 +619,9 @@ discard block |
||
| 579 | 619 | } // function _renderScatterChart() |
| 580 | 620 | |
| 581 | 621 | |
| 622 | + /** |
|
| 623 | + * @param integer $groupCount |
|
| 624 | + */ |
|
| 582 | 625 | private function _renderBubbleChart($groupCount) { |
| 583 | 626 | require_once('jpgraph_scatter.php'); |
| 584 | 627 | |
@@ -590,6 +633,9 @@ discard block |
||
| 590 | 633 | } // function _renderBubbleChart() |
| 591 | 634 | |
| 592 | 635 | |
| 636 | + /** |
|
| 637 | + * @param integer $groupCount |
|
| 638 | + */ |
|
| 593 | 639 | private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) { |
| 594 | 640 | require_once('jpgraph_pie.php'); |
| 595 | 641 | if ($dimensions == '3d') { |
@@ -663,6 +709,9 @@ discard block |
||
| 663 | 709 | } // function _renderPieChart() |
| 664 | 710 | |
| 665 | 711 | |
| 712 | + /** |
|
| 713 | + * @param integer $groupCount |
|
| 714 | + */ |
|
| 666 | 715 | private function _renderRadarChart($groupCount) { |
| 667 | 716 | require_once('jpgraph_radar.php'); |
| 668 | 717 | |
@@ -674,6 +723,9 @@ discard block |
||
| 674 | 723 | } // function _renderRadarChart() |
| 675 | 724 | |
| 676 | 725 | |
| 726 | + /** |
|
| 727 | + * @param integer $groupCount |
|
| 728 | + */ |
|
| 677 | 729 | private function _renderStockChart($groupCount) { |
| 678 | 730 | require_once('jpgraph_stock.php'); |
| 679 | 731 | |
@@ -685,6 +737,10 @@ discard block |
||
| 685 | 737 | } // function _renderStockChart() |
| 686 | 738 | |
| 687 | 739 | |
| 740 | + /** |
|
| 741 | + * @param integer $groupCount |
|
| 742 | + * @param string|null $dimensions |
|
| 743 | + */ |
|
| 688 | 744 | private function _renderContourChart($groupCount,$dimensions) { |
| 689 | 745 | require_once('jpgraph_contour.php'); |
| 690 | 746 | |
@@ -696,6 +752,9 @@ discard block |
||
| 696 | 752 | } // function _renderContourChart() |
| 697 | 753 | |
| 698 | 754 | |
| 755 | + /** |
|
| 756 | + * @param integer $groupCount |
|
| 757 | + */ |
|
| 699 | 758 | private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) { |
| 700 | 759 | require_once('jpgraph_line.php'); |
| 701 | 760 | require_once('jpgraph_bar.php'); |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | class PHPExcel_Chart_Renderer_jpgraph |
| 41 | 41 | { |
| 42 | - private static $_width = 640; |
|
| 42 | + private static $_width = 640; |
|
| 43 | 43 | |
| 44 | - private static $_height = 480; |
|
| 44 | + private static $_height = 480; |
|
| 45 | 45 | |
| 46 | - private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', |
|
| 47 | - 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', |
|
| 48 | - 'mediumblue', 'magenta', 'sandybrown', 'cyan', |
|
| 49 | - 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', |
|
| 46 | + private static $_colourSet = array('mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', |
|
| 47 | + 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', |
|
| 48 | + 'mediumblue', 'magenta', 'sandybrown', 'cyan', |
|
| 49 | + 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', |
|
| 50 | 50 | 'goldenrod2' |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - private static $_markSet = array( 'diamond' => MARK_DIAMOND, |
|
| 53 | + private static $_markSet = array('diamond' => MARK_DIAMOND, |
|
| 54 | 54 | 'square' => MARK_SQUARE, |
| 55 | 55 | 'triangle' => MARK_UTRIANGLE, |
| 56 | 56 | 'x' => MARK_X, |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | private $_graph = null; |
| 68 | 68 | |
| 69 | - private static $_plotColour = 0; |
|
| 69 | + private static $_plotColour = 0; |
|
| 70 | 70 | |
| 71 | - private static $_plotMark = 0; |
|
| 71 | + private static $_plotMark = 0; |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - private function _formatPointMarker($seriesPlot,$markerID) { |
|
| 74 | + private function _formatPointMarker($seriesPlot, $markerID) { |
|
| 75 | 75 | $plotMarkKeys = array_keys(self::$_markSet); |
| 76 | 76 | if (is_null($markerID)) { |
| 77 | 77 | // Use default plot marker (next marker in the series) |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | } // function _formatPointMarker() |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - private function _formatDataSetLabels($groupID,$datasetLabels,$rotation = '') { |
|
| 101 | + private function _formatDataSetLabels($groupID, $datasetLabels, $rotation = '') { |
|
| 102 | 102 | $datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode(); |
| 103 | - if (!is_null($datasetLabelFormatCode)) { |
|
| 103 | + if ( ! is_null($datasetLabelFormatCode)) { |
|
| 104 | 104 | // Retrieve any label formatting code |
| 105 | 105 | $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $testCurrentIndex = 0; |
| 109 | - foreach($datasetLabels as $i => $datasetLabel) { |
|
| 109 | + foreach ($datasetLabels as $i => $datasetLabel) { |
|
| 110 | 110 | // Fill in any missing values in the $datasetLabels array |
| 111 | 111 | while ($i != $testCurrentIndex) { |
| 112 | 112 | $datasetLabels[$testCurrentIndex] = ''; |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | if (is_array($datasetLabel)) { |
| 116 | 116 | if ($rotation == 'bar') { |
| 117 | 117 | $datasetLabel = array_reverse($datasetLabel); |
| 118 | - $datasetLabels[$i] = implode(" ",$datasetLabel); |
|
| 118 | + $datasetLabels[$i] = implode(" ", $datasetLabel); |
|
| 119 | 119 | } else { |
| 120 | - $datasetLabels[$i] = implode("\n",$datasetLabel); |
|
| 120 | + $datasetLabels[$i] = implode("\n", $datasetLabel); |
|
| 121 | 121 | } |
| 122 | 122 | } else { |
| 123 | 123 | // Format labels according to any formatting code |
| 124 | - if (!is_null($datasetLabelFormatCode)) { |
|
| 125 | - $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode); |
|
| 124 | + if ( ! is_null($datasetLabelFormatCode)) { |
|
| 125 | + $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | ++$testCurrentIndex; |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | } // function _formatDataSetLabels() |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - private function _percentageSumCalculation($groupID,$seriesCount) { |
|
| 135 | + private function _percentageSumCalculation($groupID, $seriesCount) { |
|
| 136 | 136 | // Adjust our values to a percentage value across all series in the group |
| 137 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 137 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 138 | 138 | if ($i == 0) { |
| 139 | 139 | $sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 140 | 140 | } else { |
| 141 | 141 | $nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 142 | - foreach($nextValues as $k => $value) { |
|
| 142 | + foreach ($nextValues as $k => $value) { |
|
| 143 | 143 | if (isset($sumValues[$k])) { |
| 144 | 144 | $sumValues[$k] += $value; |
| 145 | 145 | } else { |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | } // function _percentageSumCalculation() |
| 154 | 154 | |
| 155 | 155 | |
| 156 | - private function _percentageAdjustValues($dataValues,$sumValues) { |
|
| 157 | - foreach($dataValues as $k => $dataValue) { |
|
| 156 | + private function _percentageAdjustValues($dataValues, $sumValues) { |
|
| 157 | + foreach ($dataValues as $k => $dataValue) { |
|
| 158 | 158 | $dataValues[$k] = $dataValue / $sumValues[$k] * 100; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | private function _getCaption($captionElement) { |
| 166 | 166 | // Read any caption |
| 167 | - $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
|
| 167 | + $caption = ( ! is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
|
| 168 | 168 | // Test if we have a title caption to display |
| 169 | - if (!is_null($caption)) { |
|
| 169 | + if ( ! is_null($caption)) { |
|
| 170 | 170 | // If we do, it could be a plain string or an array |
| 171 | 171 | if (is_array($caption)) { |
| 172 | 172 | // Implode an array to a plain string |
| 173 | - $caption = implode('',$caption); |
|
| 173 | + $caption = implode('', $caption); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | return $caption; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | private function _renderTitle() { |
| 181 | 181 | $title = $this->_getCaption($this->_chart->getTitle()); |
| 182 | - if (!is_null($title)) { |
|
| 182 | + if ( ! is_null($title)) { |
|
| 183 | 183 | $this->_graph->title->Set($title); |
| 184 | 184 | } |
| 185 | 185 | } // function _renderTitle() |
@@ -187,32 +187,32 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | private function _renderLegend() { |
| 189 | 189 | $legend = $this->_chart->getLegend(); |
| 190 | - if (!is_null($legend)) { |
|
| 190 | + if ( ! is_null($legend)) { |
|
| 191 | 191 | $legendPosition = $legend->getPosition(); |
| 192 | 192 | $legendOverlay = $legend->getOverlay(); |
| 193 | 193 | switch ($legendPosition) { |
| 194 | 194 | case 'r' : |
| 195 | - $this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right |
|
| 195 | + $this->_graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right |
|
| 196 | 196 | break; |
| 197 | 197 | case 'l' : |
| 198 | - $this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left |
|
| 198 | + $this->_graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left |
|
| 199 | 199 | break; |
| 200 | 200 | case 't' : |
| 201 | - $this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top |
|
| 201 | + $this->_graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top |
|
| 202 | 202 | break; |
| 203 | 203 | case 'b' : |
| 204 | - $this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom |
|
| 204 | + $this->_graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom |
|
| 205 | 205 | break; |
| 206 | 206 | default : |
| 207 | - $this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right |
|
| 207 | + $this->_graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right |
|
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | } // function _renderLegend() |
| 212 | 212 | |
| 213 | 213 | |
| 214 | - private function _renderCartesianPlotArea($type='textlin') { |
|
| 215 | - $this->_graph = new Graph(self::$_width,self::$_height); |
|
| 214 | + private function _renderCartesianPlotArea($type = 'textlin') { |
|
| 215 | + $this->_graph = new Graph(self::$_width, self::$_height); |
|
| 216 | 216 | $this->_graph->SetScale($type); |
| 217 | 217 | |
| 218 | 218 | $this->_renderTitle(); |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | $reverse = ($rotation == 'bar') ? true : false; |
| 223 | 223 | |
| 224 | 224 | $xAxisLabel = $this->_chart->getXAxisLabel(); |
| 225 | - if (!is_null($xAxisLabel)) { |
|
| 225 | + if ( ! is_null($xAxisLabel)) { |
|
| 226 | 226 | $title = $this->_getCaption($xAxisLabel); |
| 227 | - if (!is_null($title)) { |
|
| 228 | - $this->_graph->xaxis->SetTitle($title,'center'); |
|
| 227 | + if ( ! is_null($title)) { |
|
| 228 | + $this->_graph->xaxis->SetTitle($title, 'center'); |
|
| 229 | 229 | $this->_graph->xaxis->title->SetMargin(35); |
| 230 | 230 | if ($reverse) { |
| 231 | 231 | $this->_graph->xaxis->title->SetAngle(90); |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $yAxisLabel = $this->_chart->getYAxisLabel(); |
| 238 | - if (!is_null($yAxisLabel)) { |
|
| 238 | + if ( ! is_null($yAxisLabel)) { |
|
| 239 | 239 | $title = $this->_getCaption($yAxisLabel); |
| 240 | - if (!is_null($title)) { |
|
| 241 | - $this->_graph->yaxis->SetTitle($title,'center'); |
|
| 240 | + if ( ! is_null($title)) { |
|
| 241 | + $this->_graph->yaxis->SetTitle($title, 'center'); |
|
| 242 | 242 | if ($reverse) { |
| 243 | 243 | $this->_graph->yaxis->title->SetAngle(0); |
| 244 | 244 | $this->_graph->yaxis->title->SetMargin(-55); |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | private function _renderPiePlotArea($doughnut = False) { |
| 252 | - $this->_graph = new PieGraph(self::$_width,self::$_height); |
|
| 252 | + $this->_graph = new PieGraph(self::$_width, self::$_height); |
|
| 253 | 253 | |
| 254 | 254 | $this->_renderTitle(); |
| 255 | 255 | } // function _renderPiePlotArea() |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | private function _renderRadarPlotArea() { |
| 259 | - $this->_graph = new RadarGraph(self::$_width,self::$_height); |
|
| 259 | + $this->_graph = new RadarGraph(self::$_width, self::$_height); |
|
| 260 | 260 | $this->_graph->SetScale('lin'); |
| 261 | 261 | |
| 262 | 262 | $this->_renderTitle(); |
@@ -268,29 +268,29 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); |
| 270 | 270 | if (count($datasetLabels) > 0) { |
| 271 | - $datasetLabels = $this->_formatDataSetLabels($groupID,$datasetLabels); |
|
| 271 | + $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels); |
|
| 272 | 272 | $this->_graph->xaxis->SetTickLabels($datasetLabels); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 276 | 276 | $seriesPlots = array(); |
| 277 | 277 | if ($grouping == 'percentStacked') { |
| 278 | - $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount); |
|
| 278 | + $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Loop through each data series in turn |
| 282 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 282 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 283 | 283 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 284 | 284 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 285 | 285 | |
| 286 | 286 | if ($grouping == 'percentStacked') { |
| 287 | - $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues); |
|
| 287 | + $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Fill in any missing values in the $dataValues array |
| 291 | 291 | $testCurrentIndex = 0; |
| 292 | - foreach($dataValues as $k => $dataValue) { |
|
| 293 | - while($k != $testCurrentIndex) { |
|
| 292 | + foreach ($dataValues as $k => $dataValue) { |
|
| 293 | + while ($k != $testCurrentIndex) { |
|
| 294 | 294 | $dataValues[$testCurrentIndex] = null; |
| 295 | 295 | ++$testCurrentIndex; |
| 296 | 296 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]); |
| 309 | 309 | } else { |
| 310 | 310 | // Set the appropriate plot marker |
| 311 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 311 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 312 | 312 | } |
| 313 | 313 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); |
| 314 | 314 | $seriesPlot->SetLegend($dataLabel); |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); |
| 337 | 337 | if (count($datasetLabels) > 0) { |
| 338 | - $datasetLabels = $this->_formatDataSetLabels($groupID,$datasetLabels,$rotation); |
|
| 338 | + $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $rotation); |
|
| 339 | 339 | // Rotate for bar rather than column chart |
| 340 | 340 | if ($rotation == 'bar') { |
| 341 | 341 | $datasetLabels = array_reverse($datasetLabels); |
| 342 | 342 | $this->_graph->yaxis->SetPos('max'); |
| 343 | - $this->_graph->yaxis->SetLabelAlign('center','top'); |
|
| 343 | + $this->_graph->yaxis->SetLabelAlign('center', 'top'); |
|
| 344 | 344 | $this->_graph->yaxis->SetLabelSide(SIDE_RIGHT); |
| 345 | 345 | } |
| 346 | 346 | $this->_graph->xaxis->SetTickLabels($datasetLabels); |
@@ -350,20 +350,20 @@ discard block |
||
| 350 | 350 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 351 | 351 | $seriesPlots = array(); |
| 352 | 352 | if ($grouping == 'percentStacked') { |
| 353 | - $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount); |
|
| 353 | + $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // Loop through each data series in turn |
| 357 | - for($j = 0; $j < $seriesCount; ++$j) { |
|
| 357 | + for ($j = 0; $j < $seriesCount; ++$j) { |
|
| 358 | 358 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); |
| 359 | 359 | if ($grouping == 'percentStacked') { |
| 360 | - $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues); |
|
| 360 | + $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // Fill in any missing values in the $dataValues array |
| 364 | 364 | $testCurrentIndex = 0; |
| 365 | - foreach($dataValues as $k => $dataValue) { |
|
| 366 | - while($k != $testCurrentIndex) { |
|
| 365 | + foreach ($dataValues as $k => $dataValue) { |
|
| 366 | + while ($k != $testCurrentIndex) { |
|
| 367 | 367 | $dataValues[$testCurrentIndex] = null; |
| 368 | 368 | ++$testCurrentIndex; |
| 369 | 369 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | if ($dimensions == '3d') { |
| 381 | 381 | $seriesPlot->SetShadow(); |
| 382 | 382 | } |
| 383 | - if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { |
|
| 383 | + if ( ! $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { |
|
| 384 | 384 | $dataLabel = ''; |
| 385 | 385 | } else { |
| 386 | 386 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue(); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $seriesPlots[] = $seriesPlot; |
| 391 | 391 | } |
| 392 | 392 | // Reverse the plot order for bar rather than column chart |
| 393 | - if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) { |
|
| 393 | + if (($rotation == 'bar') && ( ! ($grouping == 'percentStacked'))) { |
|
| 394 | 394 | $seriesPlots = array_reverse($seriesPlots); |
| 395 | 395 | } |
| 396 | 396 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | } // function _renderPlotBar() |
| 410 | 410 | |
| 411 | 411 | |
| 412 | - private function _renderPlotScatter($groupID,$bubble) { |
|
| 412 | + private function _renderPlotScatter($groupID, $bubble) { |
|
| 413 | 413 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 414 | 414 | $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 415 | 415 | |
@@ -417,34 +417,34 @@ discard block |
||
| 417 | 417 | $seriesPlots = array(); |
| 418 | 418 | |
| 419 | 419 | // Loop through each data series in turn |
| 420 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 420 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 421 | 421 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 422 | 422 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 423 | 423 | |
| 424 | - foreach($dataValuesY as $k => $dataValueY) { |
|
| 424 | + foreach ($dataValuesY as $k => $dataValueY) { |
|
| 425 | 425 | $dataValuesY[$k] = $k; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY); |
|
| 428 | + $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY); |
|
| 429 | 429 | if ($scatterStyle == 'lineMarker') { |
| 430 | 430 | $seriesPlot->SetLinkPoints(); |
| 431 | 431 | $seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]); |
| 432 | 432 | } elseif ($scatterStyle == 'smoothMarker') { |
| 433 | - $spline = new Spline($dataValuesY,$dataValuesX); |
|
| 434 | - list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20); |
|
| 435 | - $lplot = new LinePlot($splineDataX,$splineDataY); |
|
| 433 | + $spline = new Spline($dataValuesY, $dataValuesX); |
|
| 434 | + list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20); |
|
| 435 | + $lplot = new LinePlot($splineDataX, $splineDataY); |
|
| 436 | 436 | $lplot->SetColor(self::$_colourSet[self::$_plotColour]); |
| 437 | 437 | |
| 438 | 438 | $this->_graph->Add($lplot); |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if ($bubble) { |
| 442 | - $this->_formatPointMarker($seriesPlot,'dot'); |
|
| 442 | + $this->_formatPointMarker($seriesPlot, 'dot'); |
|
| 443 | 443 | $seriesPlot->mark->SetColor('black'); |
| 444 | 444 | $seriesPlot->mark->SetSize($bubbleSize); |
| 445 | 445 | } else { |
| 446 | 446 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 447 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 447 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 448 | 448 | } |
| 449 | 449 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); |
| 450 | 450 | $seriesPlot->SetLegend($dataLabel); |
@@ -461,14 +461,14 @@ discard block |
||
| 461 | 461 | $seriesPlots = array(); |
| 462 | 462 | |
| 463 | 463 | // Loop through each data series in turn |
| 464 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 464 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 465 | 465 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 466 | 466 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 467 | 467 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 468 | 468 | |
| 469 | 469 | $dataValues = array(); |
| 470 | - foreach($dataValuesY as $k => $dataValueY) { |
|
| 471 | - $dataValues[$k] = implode(' ',array_reverse($dataValueY)); |
|
| 470 | + foreach ($dataValuesY as $k => $dataValueY) { |
|
| 471 | + $dataValues[$k] = implode(' ', array_reverse($dataValueY)); |
|
| 472 | 472 | } |
| 473 | 473 | $tmp = array_shift($dataValues); |
| 474 | 474 | $dataValues[] = $tmp; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if ($radarStyle == 'filled') { |
| 485 | 485 | $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]); |
| 486 | 486 | } |
| 487 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 487 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 488 | 488 | $seriesPlot->SetLegend($dataLabel); |
| 489 | 489 | |
| 490 | 490 | $this->_graph->Add($seriesPlot); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | $dataValues = array(); |
| 502 | 502 | // Loop through each data series in turn |
| 503 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 503 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 504 | 504 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 505 | 505 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 506 | 506 | |
@@ -519,11 +519,11 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | $dataValues = array(); |
| 521 | 521 | // Loop through each data series in turn |
| 522 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 522 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 523 | 523 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 524 | 524 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 525 | 525 | |
| 526 | - foreach($dataValuesX as $j => $dataValueX) |
|
| 526 | + foreach ($dataValuesX as $j => $dataValueX) |
|
| 527 | 527 | $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $this->_renderCartesianPlotArea(); |
| 540 | 540 | |
| 541 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 542 | - $this->_renderPlotLine($i,True,False,$dimensions); |
|
| 541 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 542 | + $this->_renderPlotLine($i, True, False, $dimensions); |
|
| 543 | 543 | } |
| 544 | 544 | } // function _renderAreaChart() |
| 545 | 545 | |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | $this->_renderCartesianPlotArea(); |
| 551 | 551 | |
| 552 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 553 | - $this->_renderPlotLine($i,False,False,$dimensions); |
|
| 552 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 553 | + $this->_renderPlotLine($i, False, False, $dimensions); |
|
| 554 | 554 | } |
| 555 | 555 | } // function _renderLineChart() |
| 556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | $this->_renderCartesianPlotArea(); |
| 562 | 562 | |
| 563 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 564 | - $this->_renderPlotBar($i,$dimensions); |
|
| 563 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 564 | + $this->_renderPlotBar($i, $dimensions); |
|
| 565 | 565 | } |
| 566 | 566 | } // function _renderBarChart() |
| 567 | 567 | |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | $this->_renderCartesianPlotArea('linlin'); |
| 575 | 575 | |
| 576 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 577 | - $this->_renderPlotScatter($i,false); |
|
| 576 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 577 | + $this->_renderPlotScatter($i, false); |
|
| 578 | 578 | } |
| 579 | 579 | } // function _renderScatterChart() |
| 580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | $this->_renderCartesianPlotArea('linlin'); |
| 586 | 586 | |
| 587 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 588 | - $this->_renderPlotScatter($i,true); |
|
| 587 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 588 | + $this->_renderPlotScatter($i, true); |
|
| 589 | 589 | } |
| 590 | 590 | } // function _renderBubbleChart() |
| 591 | 591 | |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | $this->_renderPiePlotArea($doughnut); |
| 600 | 600 | |
| 601 | 601 | $iLimit = ($multiplePlots) ? $groupCount : 1; |
| 602 | - for($i = 0; $i < $iLimit; ++$i) { |
|
| 602 | + for ($i = 0; $i < $iLimit; ++$i) { |
|
| 603 | 603 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotGrouping(); |
| 604 | 604 | $exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotStyle(); |
| 605 | 605 | if ($i == 0) { |
| 606 | 606 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotCategoryByIndex(0)->getDataValues(); |
| 607 | 607 | if (count($datasetLabels) > 0) { |
| 608 | - $datasetLabels = $this->_formatDataSetLabels($i,$datasetLabels); |
|
| 608 | + $datasetLabels = $this->_formatDataSetLabels($i, $datasetLabels); |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
@@ -614,13 +614,13 @@ discard block |
||
| 614 | 614 | // For pie charts, we only display the first series: doughnut charts generally display all series |
| 615 | 615 | $jLimit = ($multiplePlots) ? $seriesCount : 1; |
| 616 | 616 | // Loop through each data series in turn |
| 617 | - for($j = 0; $j < $jLimit; ++$j) { |
|
| 617 | + for ($j = 0; $j < $jLimit; ++$j) { |
|
| 618 | 618 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotValuesByIndex($j)->getDataValues(); |
| 619 | 619 | |
| 620 | 620 | // Fill in any missing values in the $dataValues array |
| 621 | 621 | $testCurrentIndex = 0; |
| 622 | - foreach($dataValues as $k => $dataValue) { |
|
| 623 | - while($k != $testCurrentIndex) { |
|
| 622 | + foreach ($dataValues as $k => $dataValue) { |
|
| 623 | + while ($k != $testCurrentIndex) { |
|
| 624 | 624 | $dataValues[$testCurrentIndex] = null; |
| 625 | 625 | ++$testCurrentIndex; |
| 626 | 626 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | if ($multiplePlots) { |
| 641 | - $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4)); |
|
| 641 | + $seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4)); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if ($doughnut) { |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); |
| 649 | - $seriesPlot->SetLabels(array_fill(0,count($datasetLabels),'')); |
|
| 649 | + $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), '')); |
|
| 650 | 650 | if ($dimensions != '3d') { |
| 651 | 651 | $seriesPlot->SetGuideLines(false); |
| 652 | 652 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | |
| 669 | 669 | $this->_renderRadarPlotArea(); |
| 670 | 670 | |
| 671 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 671 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 672 | 672 | $this->_renderPlotRadar($i); |
| 673 | 673 | } |
| 674 | 674 | } // function _renderRadarChart() |
@@ -679,24 +679,24 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | $this->_renderCartesianPlotArea(); |
| 681 | 681 | |
| 682 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 682 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 683 | 683 | $this->_renderPlotStock($i); |
| 684 | 684 | } |
| 685 | 685 | } // function _renderStockChart() |
| 686 | 686 | |
| 687 | 687 | |
| 688 | - private function _renderContourChart($groupCount,$dimensions) { |
|
| 688 | + private function _renderContourChart($groupCount, $dimensions) { |
|
| 689 | 689 | require_once('jpgraph_contour.php'); |
| 690 | 690 | |
| 691 | 691 | $this->_renderCartesianPlotArea('intint'); |
| 692 | 692 | |
| 693 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 693 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 694 | 694 | $this->_renderPlotContour($i); |
| 695 | 695 | } |
| 696 | 696 | } // function _renderContourChart() |
| 697 | 697 | |
| 698 | 698 | |
| 699 | - private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) { |
|
| 699 | + private function _renderCombinationChart($groupCount, $dimensions, $outputDestination) { |
|
| 700 | 700 | require_once('jpgraph_line.php'); |
| 701 | 701 | require_once('jpgraph_bar.php'); |
| 702 | 702 | require_once('jpgraph_scatter.php'); |
@@ -705,30 +705,30 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | $this->_renderCartesianPlotArea(); |
| 707 | 707 | |
| 708 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 708 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 709 | 709 | $dimensions = null; |
| 710 | 710 | $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
| 711 | 711 | switch ($chartType) { |
| 712 | 712 | case 'area3DChart' : |
| 713 | 713 | $dimensions = '3d'; |
| 714 | 714 | case 'areaChart' : |
| 715 | - $this->_renderPlotLine($i,True,True,$dimensions); |
|
| 715 | + $this->_renderPlotLine($i, True, True, $dimensions); |
|
| 716 | 716 | break; |
| 717 | 717 | case 'bar3DChart' : |
| 718 | 718 | $dimensions = '3d'; |
| 719 | 719 | case 'barChart' : |
| 720 | - $this->_renderPlotBar($i,$dimensions); |
|
| 720 | + $this->_renderPlotBar($i, $dimensions); |
|
| 721 | 721 | break; |
| 722 | 722 | case 'line3DChart' : |
| 723 | 723 | $dimensions = '3d'; |
| 724 | 724 | case 'lineChart' : |
| 725 | - $this->_renderPlotLine($i,False,True,$dimensions); |
|
| 725 | + $this->_renderPlotLine($i, False, True, $dimensions); |
|
| 726 | 726 | break; |
| 727 | 727 | case 'scatterChart' : |
| 728 | - $this->_renderPlotScatter($i,false); |
|
| 728 | + $this->_renderPlotScatter($i, false); |
|
| 729 | 729 | break; |
| 730 | 730 | case 'bubbleChart' : |
| 731 | - $this->_renderPlotScatter($i,true); |
|
| 731 | + $this->_renderPlotScatter($i, true); |
|
| 732 | 732 | break; |
| 733 | 733 | default : |
| 734 | 734 | $this->_graph = null; |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
| 752 | 752 | } else { |
| 753 | 753 | $chartTypes = array(); |
| 754 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 754 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 755 | 755 | $chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
| 756 | 756 | } |
| 757 | 757 | $chartTypes = array_unique($chartTypes); |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | echo 'Chart is not yet implemented<br />'; |
| 762 | 762 | return false; |
| 763 | 763 | } else { |
| 764 | - return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination); |
|
| 764 | + return $this->_renderCombinationChart($groupCount, $dimensions, $outputDestination); |
|
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | |
@@ -769,27 +769,27 @@ discard block |
||
| 769 | 769 | case 'area3DChart' : |
| 770 | 770 | $dimensions = '3d'; |
| 771 | 771 | case 'areaChart' : |
| 772 | - $this->_renderAreaChart($groupCount,$dimensions); |
|
| 772 | + $this->_renderAreaChart($groupCount, $dimensions); |
|
| 773 | 773 | break; |
| 774 | 774 | case 'bar3DChart' : |
| 775 | 775 | $dimensions = '3d'; |
| 776 | 776 | case 'barChart' : |
| 777 | - $this->_renderBarChart($groupCount,$dimensions); |
|
| 777 | + $this->_renderBarChart($groupCount, $dimensions); |
|
| 778 | 778 | break; |
| 779 | 779 | case 'line3DChart' : |
| 780 | 780 | $dimensions = '3d'; |
| 781 | 781 | case 'lineChart' : |
| 782 | - $this->_renderLineChart($groupCount,$dimensions); |
|
| 782 | + $this->_renderLineChart($groupCount, $dimensions); |
|
| 783 | 783 | break; |
| 784 | 784 | case 'pie3DChart' : |
| 785 | 785 | $dimensions = '3d'; |
| 786 | 786 | case 'pieChart' : |
| 787 | - $this->_renderPieChart($groupCount,$dimensions,False,False); |
|
| 787 | + $this->_renderPieChart($groupCount, $dimensions, False, False); |
|
| 788 | 788 | break; |
| 789 | 789 | case 'doughnut3DChart' : |
| 790 | 790 | $dimensions = '3d'; |
| 791 | 791 | case 'doughnutChart' : |
| 792 | - $this->_renderPieChart($groupCount,$dimensions,True,True); |
|
| 792 | + $this->_renderPieChart($groupCount, $dimensions, True, True); |
|
| 793 | 793 | break; |
| 794 | 794 | case 'scatterChart' : |
| 795 | 795 | $this->_renderScatterChart($groupCount); |
@@ -803,10 +803,10 @@ discard block |
||
| 803 | 803 | case 'surface3DChart' : |
| 804 | 804 | $dimensions = '3d'; |
| 805 | 805 | case 'surfaceChart' : |
| 806 | - $this->_renderContourChart($groupCount,$dimensions); |
|
| 806 | + $this->_renderContourChart($groupCount, $dimensions); |
|
| 807 | 807 | break; |
| 808 | 808 | case 'stockChart' : |
| 809 | - $this->_renderStockChart($groupCount,$dimensions); |
|
| 809 | + $this->_renderStockChart($groupCount, $dimensions); |
|
| 810 | 810 | break; |
| 811 | 811 | default : |
| 812 | 812 | echo $chartType.' is not yet implemented<br />'; |
@@ -523,8 +523,9 @@ |
||
| 523 | 523 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 524 | 524 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 525 | 525 | |
| 526 | - foreach($dataValuesX as $j => $dataValueX) |
|
| 527 | - $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
|
| 526 | + foreach($dataValuesX as $j => $dataValueX) { |
|
| 527 | + $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
|
| 528 | + } |
|
| 528 | 529 | } |
| 529 | 530 | |
| 530 | 531 | $seriesPlot = new StockPlot($dataValues); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @static |
| 186 | 186 | * @access public |
| 187 | - * @param string $pFileName |
|
| 187 | + * @param string $pFilename |
|
| 188 | 188 | * @return PHPExcel |
| 189 | 189 | * @throws Exception |
| 190 | 190 | */ |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @static |
| 200 | 200 | * @access public |
| 201 | - * @param string $pFileName |
|
| 201 | + * @param string $pFilename |
|
| 202 | 202 | * @return string |
| 203 | 203 | * @throws Exception |
| 204 | 204 | */ |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @static |
| 217 | 217 | * @access public |
| 218 | - * @param string $pFileName |
|
| 218 | + * @param string $pFilename |
|
| 219 | 219 | * @return PHPExcel_Reader_IReader |
| 220 | 220 | * @throws Exception |
| 221 | 221 | */ |
@@ -73,18 +73,18 @@ |
||
| 73 | 73 | 'CSV', |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Private constructor for PHPExcel_IOFactory |
|
| 78 | - */ |
|
| 79 | - private function __construct() { } |
|
| 76 | + /** |
|
| 77 | + * Private constructor for PHPExcel_IOFactory |
|
| 78 | + */ |
|
| 79 | + private function __construct() { } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Get search locations |
|
| 83 | - * |
|
| 81 | + /** |
|
| 82 | + * Get search locations |
|
| 83 | + * |
|
| 84 | 84 | * @static |
| 85 | 85 | * @access public |
| 86 | - * @return array |
|
| 87 | - */ |
|
| 86 | + * @return array |
|
| 87 | + */ |
|
| 88 | 88 | public static function getSearchLocations() { |
| 89 | 89 | return self::$_searchLocations; |
| 90 | 90 | } // function getSearchLocations() |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @static |
| 53 | 53 | */ |
| 54 | 54 | private static $_searchLocations = array( |
| 55 | - array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), |
|
| 56 | - array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) |
|
| 55 | + array('type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}'), |
|
| 56 | + array('type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}') |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $classname Example: PHPExcel_Writer_{0} |
| 116 | 116 | */ |
| 117 | 117 | public static function addSearchLocation($type = '', $location = '', $classname = '') { |
| 118 | - self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); |
|
| 118 | + self::$_searchLocations[] = array('type' => $type, 'path' => $location, 'class' => $classname); |
|
| 119 | 119 | } // function addSearchLocation() |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | public static function identify($pFilename) { |
| 206 | 206 | $reader = self::createReaderForFile($pFilename); |
| 207 | 207 | $className = get_class($reader); |
| 208 | - $classType = explode('_',$className); |
|
| 208 | + $classType = explode('_', $className); |
|
| 209 | 209 | unset($reader); |
| 210 | 210 | return array_pop($classType); |
| 211 | 211 | } // function identify() |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * Can the current PHPExcel_Reader_IReader read the file? |
| 123 | 123 | * |
| 124 | 124 | * @access public |
| 125 | - * @param string $pFileName |
|
| 125 | + * @param string $pFilename |
|
| 126 | 126 | * @return boolean |
| 127 | 127 | * @throws Exception |
| 128 | 128 | */ |
@@ -479,7 +479,6 @@ discard block |
||
| 479 | 479 | * Set Contiguous |
| 480 | 480 | * |
| 481 | 481 | * @access public |
| 482 | - * @param string $pValue Input encoding |
|
| 483 | 482 | */ |
| 484 | 483 | public function setContiguous($contiguous = false) |
| 485 | 484 | { |
@@ -496,7 +495,7 @@ discard block |
||
| 496 | 495 | * Get Contiguous |
| 497 | 496 | * |
| 498 | 497 | * @access public |
| 499 | - * @return boolean |
|
| 498 | + * @return integer |
|
| 500 | 499 | */ |
| 501 | 500 | public function getContiguous() { |
| 502 | 501 | return $this->_contiguous; |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @access private |
| 51 | 51 | * @var string |
| 52 | 52 | */ |
| 53 | - private $_inputEncoding = 'UTF-8'; |
|
| 53 | + private $_inputEncoding = 'UTF-8'; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Delimiter |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @access private |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - private $_delimiter = ','; |
|
| 61 | + private $_delimiter = ','; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Enclosure |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @access private |
| 67 | 67 | * @var string |
| 68 | 68 | */ |
| 69 | - private $_enclosure = '"'; |
|
| 69 | + private $_enclosure = '"'; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Line ending |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @access private |
| 75 | 75 | * @var string |
| 76 | 76 | */ |
| 77 | - private $_lineEnding = PHP_EOL; |
|
| 77 | + private $_lineEnding = PHP_EOL; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Sheet index to read |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @access private |
| 83 | 83 | * @var int |
| 84 | 84 | */ |
| 85 | - private $_sheetIndex = 0; |
|
| 85 | + private $_sheetIndex = 0; |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Load rows contiguously |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @access private |
| 91 | 91 | * @var int |
| 92 | 92 | */ |
| 93 | - private $_contiguous = false; |
|
| 93 | + private $_contiguous = false; |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @access private |
| 100 | 100 | * @var int |
| 101 | 101 | */ |
| 102 | - private $_contiguousRow = -1; |
|
| 102 | + private $_contiguousRow = -1; |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * PHPExcel_Reader_IReadFilter instance |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * Create a new PHPExcel_Reader_CSV |
| 115 | 115 | */ |
| 116 | 116 | public function __construct() { |
| 117 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 117 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 118 | 118 | } // function __construct() |
| 119 | 119 | |
| 120 | 120 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | public function canRead($pFilename) |
| 130 | 130 | { |
| 131 | 131 | // Check if file exists |
| 132 | - if (!file_exists($pFilename)) { |
|
| 133 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 132 | + if ( ! file_exists($pFilename)) { |
|
| 133 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | return true; |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | public function listWorksheetInfo($pFilename) |
| 196 | 196 | { |
| 197 | 197 | // Check if file exists |
| 198 | - if (!file_exists($pFilename)) { |
|
| 199 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 198 | + if ( ! file_exists($pFilename)) { |
|
| 199 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Open file |
| 203 | 203 | $fileHandle = fopen($pFilename, 'r'); |
| 204 | 204 | if ($fileHandle === false) { |
| 205 | - throw new Exception("Could not open file " . $pFilename . " for reading."); |
|
| 205 | + throw new Exception("Could not open file ".$pFilename." for reading."); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Skip BOM, if any |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | break; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); |
|
| 234 | + $escapeEnclosures = array("\\".$this->_enclosure, $this->_enclosure.$this->_enclosure); |
|
| 235 | 235 | |
| 236 | 236 | $worksheetInfo = array(); |
| 237 | 237 | $worksheetInfo[0]['worksheetName'] = 'Worksheet'; |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
| 287 | 287 | { |
| 288 | 288 | // Check if file exists |
| 289 | - if (!file_exists($pFilename)) { |
|
| 290 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 289 | + if ( ! file_exists($pFilename)) { |
|
| 290 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Create new PHPExcel |
| 294 | 294 | while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { |
| 295 | 295 | $objPHPExcel->createSheet(); |
| 296 | 296 | } |
| 297 | - $sheet = $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); |
|
| 297 | + $sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); |
|
| 298 | 298 | |
| 299 | 299 | $lineEnding = ini_get('auto_detect_line_endings'); |
| 300 | 300 | ini_set('auto_detect_line_endings', true); |
@@ -331,20 +331,20 @@ discard block |
||
| 331 | 331 | break; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $escapeEnclosures = array( "\\" . $this->_enclosure, |
|
| 335 | - $this->_enclosure . $this->_enclosure |
|
| 334 | + $escapeEnclosures = array("\\".$this->_enclosure, |
|
| 335 | + $this->_enclosure.$this->_enclosure |
|
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | // Set our starting row based on whether we're in contiguous mode or not |
| 339 | 339 | $currentRow = 1; |
| 340 | 340 | if ($this->_contiguous) { |
| 341 | - $currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow; |
|
| 341 | + $currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow() : $this->_contiguousRow; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // Loop through each line of the file in turn |
| 345 | 345 | while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { |
| 346 | 346 | $columnLetter = 'A'; |
| 347 | - foreach($rowData as $rowDatum) { |
|
| 347 | + foreach ($rowData as $rowDatum) { |
|
| 348 | 348 | if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { |
| 349 | 349 | // Unescape enclosures |
| 350 | 350 | $rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // Set cell value |
| 358 | - $sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum); |
|
| 358 | + $sheet->getCell($columnLetter.$currentRow)->setValue($rowDatum); |
|
| 359 | 359 | } |
| 360 | 360 | ++$columnLetter; |
| 361 | 361 | } |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function setContiguous($contiguous = false) |
| 485 | 485 | { |
| 486 | - $this->_contiguous = (bool)$contiguous; |
|
| 487 | - if (!$contiguous) { |
|
| 488 | - $this->_contiguousRow = -1; |
|
| 486 | + $this->_contiguous = (bool) $contiguous; |
|
| 487 | + if ( ! $contiguous) { |
|
| 488 | + $this->_contiguousRow = -1; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | return $this; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | /** |
| 173 | 173 | * Can the current PHPExcel_Reader_IReader read the file? |
| 174 | 174 | * |
| 175 | - * @param string $pFileName |
|
| 175 | + * @param string $pFilename |
|
| 176 | 176 | * @return boolean |
| 177 | 177 | * @throws Exception |
| 178 | 178 | */ |
@@ -342,6 +342,9 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
| 345 | + /** |
|
| 346 | + * @param string $styleAttributeValue |
|
| 347 | + */ |
|
| 345 | 348 | private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { |
| 346 | 349 | $styleAttributeValue = strtolower($styleAttributeValue); |
| 347 | 350 | foreach($styleList as $style) { |
@@ -887,6 +890,9 @@ discard block |
||
| 887 | 890 | } |
| 888 | 891 | |
| 889 | 892 | |
| 893 | + /** |
|
| 894 | + * @param string $charset |
|
| 895 | + */ |
|
| 890 | 896 | private static function _convertStringEncoding($string,$charset) { |
| 891 | 897 | if ($charset != 'UTF-8') { |
| 892 | 898 | return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset); |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * Create a new PHPExcel_Reader_Excel2003XML |
| 85 | 85 | */ |
| 86 | 86 | public function __construct() { |
| 87 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 87 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | // Check if file exists |
| 198 | - if (!file_exists($pFilename)) { |
|
| 199 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 198 | + if ( ! file_exists($pFilename)) { |
|
| 199 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Read sample data (first 2 KB will do) |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | fclose($fh); |
| 206 | 206 | |
| 207 | 207 | $valid = true; |
| 208 | - foreach($signature as $match) { |
|
| 208 | + foreach ($signature as $match) { |
|
| 209 | 209 | // every part of the signature must be present |
| 210 | 210 | if (strpos($data, $match) === false) { |
| 211 | 211 | $valid = false; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // Retrieve charset encoding |
| 217 | - if(preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um',$data,$matches)) { |
|
| 217 | + if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) { |
|
| 218 | 218 | $this->_charSet = strtoupper($matches[1]); |
| 219 | 219 | } |
| 220 | 220 | // echo 'Character Set is ',$this->_charSet,'<br />'; |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | public function listWorksheetNames($pFilename) |
| 233 | 233 | { |
| 234 | 234 | // Check if file exists |
| 235 | - if (!file_exists($pFilename)) { |
|
| 236 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 235 | + if ( ! file_exists($pFilename)) { |
|
| 236 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 237 | 237 | } |
| 238 | - if (!$this->canRead($pFilename)) { |
|
| 239 | - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); |
|
| 238 | + if ( ! $this->canRead($pFilename)) { |
|
| 239 | + throw new Exception($pFilename." is an Invalid Spreadsheet file."); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $worksheetNames = array(); |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | $namespaces = $xml->getNamespaces(true); |
| 246 | 246 | |
| 247 | 247 | $xml_ss = $xml->children($namespaces['ss']); |
| 248 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 248 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 249 | 249 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 250 | - $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet); |
|
| 250 | + $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | return $worksheetNames; |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | public function listWorksheetInfo($pFilename) |
| 264 | 264 | { |
| 265 | 265 | // Check if file exists |
| 266 | - if (!file_exists($pFilename)) { |
|
| 267 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 266 | + if ( ! file_exists($pFilename)) { |
|
| 267 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $worksheetInfo = array(); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $worksheetID = 1; |
| 276 | 276 | $xml_ss = $xml->children($namespaces['ss']); |
| 277 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 277 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 278 | 278 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 279 | 279 | |
| 280 | 280 | $tmpInfo = array(); |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | if (isset($worksheet->Table->Row)) { |
| 294 | 294 | $rowIndex = 0; |
| 295 | 295 | |
| 296 | - foreach($worksheet->Table->Row as $rowData) { |
|
| 296 | + foreach ($worksheet->Table->Row as $rowData) { |
|
| 297 | 297 | $columnIndex = 0; |
| 298 | 298 | $rowHasData = false; |
| 299 | 299 | |
| 300 | - foreach($rowData->Cell as $cell) { |
|
| 300 | + foreach ($rowData->Cell as $cell) { |
|
| 301 | 301 | if (isset($cell->Data)) { |
| 302 | 302 | $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); |
| 303 | 303 | $rowHasData = true; |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
| 345 | - private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { |
|
| 345 | + private static function identifyFixedStyleValue($styleList, &$styleAttributeValue) { |
|
| 346 | 346 | $styleAttributeValue = strtolower($styleAttributeValue); |
| 347 | - foreach($styleList as $style) { |
|
| 347 | + foreach ($styleList as $style) { |
|
| 348 | 348 | if ($styleAttributeValue == strtolower($style)) { |
| 349 | 349 | $styleAttributeValue = $style; |
| 350 | 350 | return true; |
@@ -396,23 +396,23 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
| 398 | 398 | { |
| 399 | - $fromFormats = array('\-', '\ '); |
|
| 400 | - $toFormats = array('-', ' '); |
|
| 399 | + $fromFormats = array('\-', '\ '); |
|
| 400 | + $toFormats = array('-', ' '); |
|
| 401 | 401 | |
| 402 | - $underlineStyles = array ( |
|
| 402 | + $underlineStyles = array( |
|
| 403 | 403 | PHPExcel_Style_Font::UNDERLINE_NONE, |
| 404 | 404 | PHPExcel_Style_Font::UNDERLINE_DOUBLE, |
| 405 | 405 | PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING, |
| 406 | 406 | PHPExcel_Style_Font::UNDERLINE_SINGLE, |
| 407 | 407 | PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING |
| 408 | 408 | ); |
| 409 | - $verticalAlignmentStyles = array ( |
|
| 409 | + $verticalAlignmentStyles = array( |
|
| 410 | 410 | PHPExcel_Style_Alignment::VERTICAL_BOTTOM, |
| 411 | 411 | PHPExcel_Style_Alignment::VERTICAL_TOP, |
| 412 | 412 | PHPExcel_Style_Alignment::VERTICAL_CENTER, |
| 413 | 413 | PHPExcel_Style_Alignment::VERTICAL_JUSTIFY |
| 414 | 414 | ); |
| 415 | - $horizontalAlignmentStyles = array ( |
|
| 415 | + $horizontalAlignmentStyles = array( |
|
| 416 | 416 | PHPExcel_Style_Alignment::HORIZONTAL_GENERAL, |
| 417 | 417 | PHPExcel_Style_Alignment::HORIZONTAL_LEFT, |
| 418 | 418 | PHPExcel_Style_Alignment::HORIZONTAL_RIGHT, |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | |
| 428 | 428 | // Check if file exists |
| 429 | - if (!file_exists($pFilename)) { |
|
| 430 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 429 | + if ( ! file_exists($pFilename)) { |
|
| 430 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if (!$this->canRead($pFilename)) { |
|
| 434 | - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); |
|
| 433 | + if ( ! $this->canRead($pFilename)) { |
|
| 434 | + throw new Exception($pFilename." is an Invalid Spreadsheet file."); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $xml = simplexml_load_file($pFilename); |
@@ -439,52 +439,52 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $docProps = $objPHPExcel->getProperties(); |
| 441 | 441 | if (isset($xml->DocumentProperties[0])) { |
| 442 | - foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 442 | + foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 443 | 443 | switch ($propertyName) { |
| 444 | 444 | case 'Title' : |
| 445 | - $docProps->setTitle(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 445 | + $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 446 | 446 | break; |
| 447 | 447 | case 'Subject' : |
| 448 | - $docProps->setSubject(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 448 | + $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 449 | 449 | break; |
| 450 | 450 | case 'Author' : |
| 451 | - $docProps->setCreator(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 451 | + $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 452 | 452 | break; |
| 453 | 453 | case 'Created' : |
| 454 | 454 | $creationDate = strtotime($propertyValue); |
| 455 | 455 | $docProps->setCreated($creationDate); |
| 456 | 456 | break; |
| 457 | 457 | case 'LastAuthor' : |
| 458 | - $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 458 | + $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 459 | 459 | break; |
| 460 | 460 | case 'LastSaved' : |
| 461 | 461 | $lastSaveDate = strtotime($propertyValue); |
| 462 | 462 | $docProps->setModified($lastSaveDate); |
| 463 | 463 | break; |
| 464 | 464 | case 'Company' : |
| 465 | - $docProps->setCompany(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 465 | + $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 466 | 466 | break; |
| 467 | 467 | case 'Category' : |
| 468 | - $docProps->setCategory(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 468 | + $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 469 | 469 | break; |
| 470 | 470 | case 'Manager' : |
| 471 | - $docProps->setManager(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 471 | + $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 472 | 472 | break; |
| 473 | 473 | case 'Keywords' : |
| 474 | - $docProps->setKeywords(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 474 | + $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 475 | 475 | break; |
| 476 | 476 | case 'Description' : |
| 477 | - $docProps->setDescription(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 477 | + $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 478 | 478 | break; |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | if (isset($xml->CustomDocumentProperties)) { |
| 483 | - foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 483 | + foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 484 | 484 | $propertyAttributes = $propertyValue->attributes($namespaces['dt']); |
| 485 | - $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName); |
|
| 485 | + $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName); |
|
| 486 | 486 | $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; |
| 487 | - switch((string) $propertyAttributes) { |
|
| 487 | + switch ((string) $propertyAttributes) { |
|
| 488 | 488 | case 'string' : |
| 489 | 489 | $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; |
| 490 | 490 | $propertyValue = trim($propertyValue); |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | $propertyValue = strtotime(trim($propertyValue)); |
| 507 | 507 | break; |
| 508 | 508 | } |
| 509 | - $docProps->setCustomProperty($propertyName,$propertyValue,$propertyType); |
|
| 509 | + $docProps->setCustomProperty($propertyName, $propertyValue, $propertyType); |
|
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - foreach($xml->Styles[0] as $style) { |
|
| 513 | + foreach ($xml->Styles[0] as $style) { |
|
| 514 | 514 | $style_ss = $style->attributes($namespaces['ss']); |
| 515 | 515 | $styleID = (string) $style_ss['ID']; |
| 516 | 516 | // echo 'Style ID = '.$styleID.'<br />'; |
@@ -524,17 +524,17 @@ discard block |
||
| 524 | 524 | // echo $styleType.'<br />'; |
| 525 | 525 | switch ($styleType) { |
| 526 | 526 | case 'Alignment' : |
| 527 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 527 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 528 | 528 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 529 | 529 | $styleAttributeValue = (string) $styleAttributeValue; |
| 530 | 530 | switch ($styleAttributeKey) { |
| 531 | 531 | case 'Vertical' : |
| 532 | - if (self::identifyFixedStyleValue($verticalAlignmentStyles,$styleAttributeValue)) { |
|
| 532 | + if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { |
|
| 533 | 533 | $this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; |
| 534 | 534 | } |
| 535 | 535 | break; |
| 536 | 536 | case 'Horizontal' : |
| 537 | - if (self::identifyFixedStyleValue($horizontalAlignmentStyles,$styleAttributeValue)) { |
|
| 537 | + if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { |
|
| 538 | 538 | $this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; |
| 539 | 539 | } |
| 540 | 540 | break; |
@@ -545,10 +545,10 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | break; |
| 547 | 547 | case 'Borders' : |
| 548 | - foreach($styleData->Border as $borderStyle) { |
|
| 548 | + foreach ($styleData->Border as $borderStyle) { |
|
| 549 | 549 | $borderAttributes = $borderStyle->attributes($namespaces['ss']); |
| 550 | 550 | $thisBorder = array(); |
| 551 | - foreach($borderAttributes as $borderStyleKey => $borderStyleValue) { |
|
| 551 | + foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { |
|
| 552 | 552 | // echo $borderStyleKey.' = '.$borderStyleValue.'<br />'; |
| 553 | 553 | switch ($borderStyleKey) { |
| 554 | 554 | case 'LineStyle' : |
@@ -562,12 +562,12 @@ discard block |
||
| 562 | 562 | $borderPosition = strtolower($borderStyleValue); |
| 563 | 563 | break; |
| 564 | 564 | case 'Color' : |
| 565 | - $borderColour = substr($borderStyleValue,1); |
|
| 565 | + $borderColour = substr($borderStyleValue, 1); |
|
| 566 | 566 | $thisBorder['color']['rgb'] = $borderColour; |
| 567 | 567 | break; |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | - if (!empty($thisBorder)) { |
|
| 570 | + if ( ! empty($thisBorder)) { |
|
| 571 | 571 | if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { |
| 572 | 572 | $this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder; |
| 573 | 573 | } |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | break; |
| 577 | 577 | case 'Font' : |
| 578 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 578 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 579 | 579 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 580 | 580 | $styleAttributeValue = (string) $styleAttributeValue; |
| 581 | 581 | switch ($styleAttributeKey) { |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $this->_styles[$styleID]['font']['size'] = $styleAttributeValue; |
| 587 | 587 | break; |
| 588 | 588 | case 'Color' : |
| 589 | - $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1); |
|
| 589 | + $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1); |
|
| 590 | 590 | break; |
| 591 | 591 | case 'Bold' : |
| 592 | 592 | $this->_styles[$styleID]['font']['bold'] = true; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | $this->_styles[$styleID]['font']['italic'] = true; |
| 596 | 596 | break; |
| 597 | 597 | case 'Underline' : |
| 598 | - if (self::identifyFixedStyleValue($underlineStyles,$styleAttributeValue)) { |
|
| 598 | + if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { |
|
| 599 | 599 | $this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; |
| 600 | 600 | } |
| 601 | 601 | break; |
@@ -603,19 +603,19 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | break; |
| 605 | 605 | case 'Interior' : |
| 606 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 606 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 607 | 607 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 608 | 608 | switch ($styleAttributeKey) { |
| 609 | 609 | case 'Color' : |
| 610 | - $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1); |
|
| 610 | + $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); |
|
| 611 | 611 | break; |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | break; |
| 615 | 615 | case 'NumberFormat' : |
| 616 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 616 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 617 | 617 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 618 | - $styleAttributeValue = str_replace($fromFormats,$toFormats,$styleAttributeValue); |
|
| 618 | + $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue); |
|
| 619 | 619 | switch ($styleAttributeValue) { |
| 620 | 620 | case 'Short Date' : |
| 621 | 621 | $styleAttributeValue = 'dd/mm/yyyy'; |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | break; |
| 629 | 629 | case 'Protection' : |
| 630 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 630 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 631 | 631 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 632 | 632 | } |
| 633 | 633 | break; |
@@ -641,11 +641,11 @@ discard block |
||
| 641 | 641 | $worksheetID = 0; |
| 642 | 642 | $xml_ss = $xml->children($namespaces['ss']); |
| 643 | 643 | |
| 644 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 644 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 645 | 645 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 646 | 646 | |
| 647 | 647 | if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) && |
| 648 | - (!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) { |
|
| 648 | + ( ! in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) { |
|
| 649 | 649 | continue; |
| 650 | 650 | } |
| 651 | 651 | |
@@ -655,19 +655,19 @@ discard block |
||
| 655 | 655 | $objPHPExcel->createSheet(); |
| 656 | 656 | $objPHPExcel->setActiveSheetIndex($worksheetID); |
| 657 | 657 | if (isset($worksheet_ss['Name'])) { |
| 658 | - $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet); |
|
| 658 | + $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); |
|
| 659 | 659 | // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in |
| 660 | 660 | // formula cells... during the load, all formulae should be correct, and we're simply bringing |
| 661 | 661 | // the worksheet name in line with the formula, not the reverse |
| 662 | - $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); |
|
| 662 | + $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false); |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $columnID = 'A'; |
| 666 | 666 | if (isset($worksheet->Table->Column)) { |
| 667 | - foreach($worksheet->Table->Column as $columnData) { |
|
| 667 | + foreach ($worksheet->Table->Column as $columnData) { |
|
| 668 | 668 | $columnData_ss = $columnData->attributes($namespaces['ss']); |
| 669 | 669 | if (isset($columnData_ss['Index'])) { |
| 670 | - $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1); |
|
| 670 | + $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index'] - 1); |
|
| 671 | 671 | } |
| 672 | 672 | if (isset($columnData_ss['Width'])) { |
| 673 | 673 | $columnWidth = $columnData_ss['Width']; |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | $rowID = 1; |
| 682 | 682 | if (isset($worksheet->Table->Row)) { |
| 683 | - foreach($worksheet->Table->Row as $rowData) { |
|
| 683 | + foreach ($worksheet->Table->Row as $rowData) { |
|
| 684 | 684 | $rowHasData = false; |
| 685 | 685 | $row_ss = $rowData->attributes($namespaces['ss']); |
| 686 | 686 | if (isset($row_ss['Index'])) { |
@@ -689,16 +689,16 @@ discard block |
||
| 689 | 689 | // echo '<b>Row '.$rowID.'</b><br />'; |
| 690 | 690 | |
| 691 | 691 | $columnID = 'A'; |
| 692 | - foreach($rowData->Cell as $cell) { |
|
| 692 | + foreach ($rowData->Cell as $cell) { |
|
| 693 | 693 | |
| 694 | 694 | $cell_ss = $cell->attributes($namespaces['ss']); |
| 695 | 695 | if (isset($cell_ss['Index'])) { |
| 696 | - $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1); |
|
| 696 | + $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index'] - 1); |
|
| 697 | 697 | } |
| 698 | 698 | $cellRange = $columnID.$rowID; |
| 699 | 699 | |
| 700 | 700 | if ($this->getReadFilter() !== NULL) { |
| 701 | - if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
|
| 701 | + if ( ! $this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
|
| 702 | 702 | continue; |
| 703 | 703 | } |
| 704 | 704 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { |
| 707 | 707 | $columnTo = $columnID; |
| 708 | 708 | if (isset($cell_ss['MergeAcross'])) { |
| 709 | - $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); |
|
| 709 | + $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] - 1); |
|
| 710 | 710 | } |
| 711 | 711 | $rowTo = $rowID; |
| 712 | 712 | if (isset($cell_ss['MergeDown'])) { |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | const TYPE_ERROR = 'e'; |
| 745 | 745 | */ |
| 746 | 746 | case 'String' : |
| 747 | - $cellValue = self::_convertStringEncoding($cellValue,$this->_charSet); |
|
| 747 | + $cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); |
|
| 748 | 748 | $type = PHPExcel_Cell_DataType::TYPE_STRING; |
| 749 | 749 | break; |
| 750 | 750 | case 'Number' : |
@@ -772,58 +772,58 @@ discard block |
||
| 772 | 772 | // echo 'FORMULA<br />'; |
| 773 | 773 | $type = PHPExcel_Cell_DataType::TYPE_FORMULA; |
| 774 | 774 | $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID); |
| 775 | - if (substr($cellDataFormula,0,3) == 'of:') { |
|
| 776 | - $cellDataFormula = substr($cellDataFormula,3); |
|
| 775 | + if (substr($cellDataFormula, 0, 3) == 'of:') { |
|
| 776 | + $cellDataFormula = substr($cellDataFormula, 3); |
|
| 777 | 777 | // echo 'Before: ',$cellDataFormula,'<br />'; |
| 778 | - $temp = explode('"',$cellDataFormula); |
|
| 778 | + $temp = explode('"', $cellDataFormula); |
|
| 779 | 779 | $key = false; |
| 780 | - foreach($temp as &$value) { |
|
| 780 | + foreach ($temp as &$value) { |
|
| 781 | 781 | // Only replace in alternate array entries (i.e. non-quoted blocks) |
| 782 | - if ($key = !$key) { |
|
| 783 | - $value = str_replace(array('[.','.',']'),'',$value); |
|
| 782 | + if ($key = ! $key) { |
|
| 783 | + $value = str_replace(array('[.', '.', ']'), '', $value); |
|
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | } else { |
| 787 | 787 | // Convert R1C1 style references to A1 style references (but only when not quoted) |
| 788 | 788 | // echo 'Before: ',$cellDataFormula,'<br />'; |
| 789 | - $temp = explode('"',$cellDataFormula); |
|
| 789 | + $temp = explode('"', $cellDataFormula); |
|
| 790 | 790 | $key = false; |
| 791 | - foreach($temp as &$value) { |
|
| 791 | + foreach ($temp as &$value) { |
|
| 792 | 792 | // Only replace in alternate array entries (i.e. non-quoted blocks) |
| 793 | - if ($key = !$key) { |
|
| 794 | - preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); |
|
| 793 | + if ($key = ! $key) { |
|
| 794 | + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); |
|
| 795 | 795 | // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way |
| 796 | 796 | // through the formula from left to right. Reversing means that we work right to left.through |
| 797 | 797 | // the formula |
| 798 | 798 | $cellReferences = array_reverse($cellReferences); |
| 799 | 799 | // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, |
| 800 | 800 | // then modify the formula to use that new reference |
| 801 | - foreach($cellReferences as $cellReference) { |
|
| 801 | + foreach ($cellReferences as $cellReference) { |
|
| 802 | 802 | $rowReference = $cellReference[2][0]; |
| 803 | 803 | // Empty R reference is the current row |
| 804 | 804 | if ($rowReference == '') $rowReference = $rowID; |
| 805 | 805 | // Bracketed R references are relative to the current row |
| 806 | - if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 806 | + if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference, '[]'); |
|
| 807 | 807 | $columnReference = $cellReference[4][0]; |
| 808 | 808 | // Empty C reference is the current column |
| 809 | 809 | if ($columnReference == '') $columnReference = $columnNumber; |
| 810 | 810 | // Bracketed C references are relative to the current column |
| 811 | - if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 812 | - $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
| 813 | - $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
|
| 811 | + if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference, '[]'); |
|
| 812 | + $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference - 1).$rowReference; |
|
| 813 | + $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
|
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | } |
| 818 | 818 | unset($value); |
| 819 | 819 | // Then rebuild the formula string |
| 820 | - $cellDataFormula = implode('"',$temp); |
|
| 820 | + $cellDataFormula = implode('"', $temp); |
|
| 821 | 821 | // echo 'After: ',$cellDataFormula,'<br />'; |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | // echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />'; |
| 825 | 825 | // |
| 826 | - $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type); |
|
| 826 | + $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
| 827 | 827 | if ($hasCalculatedValue) { |
| 828 | 828 | // echo 'Formula result is '.$cellValue.'<br />'; |
| 829 | 829 | $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue); |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $commentAttributes = $cell->Comment->attributes($namespaces['ss']); |
| 837 | 837 | $author = 'unknown'; |
| 838 | 838 | if (isset($commentAttributes->Author)) { |
| 839 | - $author = (string)$commentAttributes->Author; |
|
| 839 | + $author = (string) $commentAttributes->Author; |
|
| 840 | 840 | // echo 'Author: ',$author,'<br />'; |
| 841 | 841 | } |
| 842 | 842 | $node = $cell->Comment->Data->asXML(); |
@@ -844,19 +844,19 @@ discard block |
||
| 844 | 844 | // echo $annotation,'<br />'; |
| 845 | 845 | $annotation = strip_tags($node); |
| 846 | 846 | // echo 'Annotation: ',$annotation,'<br />'; |
| 847 | - $objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) |
|
| 848 | - ->setAuthor(self::_convertStringEncoding($author ,$this->_charSet)) |
|
| 849 | - ->setText($this->_parseRichText($annotation) ); |
|
| 847 | + $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID) |
|
| 848 | + ->setAuthor(self::_convertStringEncoding($author, $this->_charSet)) |
|
| 849 | + ->setText($this->_parseRichText($annotation)); |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | if (($cellIsSet) && (isset($cell_ss['StyleID']))) { |
| 853 | 853 | $style = (string) $cell_ss['StyleID']; |
| 854 | 854 | // echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />'; |
| 855 | - if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) { |
|
| 855 | + if ((isset($this->_styles[$style])) && ( ! empty($this->_styles[$style]))) { |
|
| 856 | 856 | // echo 'Cell '.$columnID.$rowID.'<br />'; |
| 857 | 857 | // print_r($this->_styles[$style]); |
| 858 | 858 | // echo '<br />'; |
| 859 | - if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
| 859 | + if ( ! $objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
| 860 | 860 | $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL); |
| 861 | 861 | } |
| 862 | 862 | $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]); |
@@ -887,9 +887,9 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | |
| 890 | - private static function _convertStringEncoding($string,$charset) { |
|
| 890 | + private static function _convertStringEncoding($string, $charset) { |
|
| 891 | 891 | if ($charset != 'UTF-8') { |
| 892 | - return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset); |
|
| 892 | + return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset); |
|
| 893 | 893 | } |
| 894 | 894 | return $string; |
| 895 | 895 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | private function _parseRichText($is = '') { |
| 899 | 899 | $value = new PHPExcel_RichText(); |
| 900 | 900 | |
| 901 | - $value->createText(self::_convertStringEncoding($is,$this->_charSet)); |
|
| 901 | + $value->createText(self::_convertStringEncoding($is, $this->_charSet)); |
|
| 902 | 902 | |
| 903 | 903 | return $value; |
| 904 | 904 | } |
@@ -801,14 +801,22 @@ |
||
| 801 | 801 | foreach($cellReferences as $cellReference) { |
| 802 | 802 | $rowReference = $cellReference[2][0]; |
| 803 | 803 | // Empty R reference is the current row |
| 804 | - if ($rowReference == '') $rowReference = $rowID; |
|
| 804 | + if ($rowReference == '') { |
|
| 805 | + $rowReference = $rowID; |
|
| 806 | + } |
|
| 805 | 807 | // Bracketed R references are relative to the current row |
| 806 | - if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 808 | + if ($rowReference{0} == '[') { |
|
| 809 | + $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 810 | + } |
|
| 807 | 811 | $columnReference = $cellReference[4][0]; |
| 808 | 812 | // Empty C reference is the current column |
| 809 | - if ($columnReference == '') $columnReference = $columnNumber; |
|
| 813 | + if ($columnReference == '') { |
|
| 814 | + $columnReference = $columnNumber; |
|
| 815 | + } |
|
| 810 | 816 | // Bracketed C references are relative to the current column |
| 811 | - if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 817 | + if ($columnReference{0} == '[') { |
|
| 818 | + $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 819 | + } |
|
| 812 | 820 | $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
| 813 | 821 | $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
| 814 | 822 | } |
@@ -325,7 +325,7 @@ |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| 328 | - /** |
|
| 328 | + /** |
|
| 329 | 329 | * Loads PHPExcel from file |
| 330 | 330 | * |
| 331 | 331 | * @param string $pFilename |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** |
| 225 | 225 | * Can the current PHPExcel_Reader_IReader read the file? |
| 226 | 226 | * |
| 227 | - * @param string $pFileName |
|
| 227 | + * @param string $pFilename |
|
| 228 | 228 | * @return boolean |
| 229 | 229 | * @throws Exception |
| 230 | 230 | */ |
@@ -366,6 +366,11 @@ discard block |
||
| 366 | 366 | } // function _castToString() |
| 367 | 367 | |
| 368 | 368 | |
| 369 | + /** |
|
| 370 | + * @param string $r |
|
| 371 | + * @param string $cellDataType |
|
| 372 | + * @param string $castBaseType |
|
| 373 | + */ |
|
| 369 | 374 | private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { |
| 370 | 375 | // echo '<font color="darkgreen">Formula</font><br />'; |
| 371 | 376 | // echo '$c->f is '.$c->f.'<br />'; |
@@ -415,6 +420,9 @@ discard block |
||
| 415 | 420 | } |
| 416 | 421 | |
| 417 | 422 | |
| 423 | + /** |
|
| 424 | + * @return string |
|
| 425 | + */ |
|
| 418 | 426 | public function _getFromZipArchive(ZipArchive $archive, $fileName = '') |
| 419 | 427 | { |
| 420 | 428 | // Root-relative paths |
@@ -1755,6 +1763,9 @@ discard block |
||
| 1755 | 1763 | } |
| 1756 | 1764 | |
| 1757 | 1765 | |
| 1766 | + /** |
|
| 1767 | + * @param PHPExcel_Style $docStyle |
|
| 1768 | + */ |
|
| 1758 | 1769 | private static function _readStyle($docStyle, $style) { |
| 1759 | 1770 | // format code |
| 1760 | 1771 | if (isset($style->numFmt)) { |
@@ -1966,6 +1977,9 @@ discard block |
||
| 1966 | 1977 | } |
| 1967 | 1978 | |
| 1968 | 1979 | |
| 1980 | + /** |
|
| 1981 | + * @param string $style |
|
| 1982 | + */ |
|
| 1969 | 1983 | private static function toCSSArray($style) { |
| 1970 | 1984 | $style = str_replace(array("\r","\n"), "", $style); |
| 1971 | 1985 | |
@@ -766,12 +766,12 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { |
| 769 | - if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
|
| 770 | - $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 769 | + if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
|
| 770 | + $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
|
| 774 | - $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 773 | + if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
|
| 774 | + $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { |
@@ -787,22 +787,22 @@ discard block |
||
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | if (isset($xmlSheet->sheetViews->sheetView->pane)) { |
| 790 | - if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
|
| 791 | - $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 792 | - } else { |
|
| 793 | - $xSplit = 0; |
|
| 794 | - $ySplit = 0; |
|
| 795 | - |
|
| 796 | - if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { |
|
| 797 | - $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); |
|
| 798 | - } |
|
| 799 | - |
|
| 800 | - if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { |
|
| 801 | - $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); |
|
| 802 | - } |
|
| 803 | - |
|
| 804 | - $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); |
|
| 805 | - } |
|
| 790 | + if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
|
| 791 | + $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 792 | + } else { |
|
| 793 | + $xSplit = 0; |
|
| 794 | + $ySplit = 0; |
|
| 795 | + |
|
| 796 | + if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { |
|
| 797 | + $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); |
|
| 798 | + } |
|
| 799 | + |
|
| 800 | + if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { |
|
| 801 | + $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); |
|
| 802 | + } |
|
| 803 | + |
|
| 804 | + $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); |
|
| 805 | + } |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | if (isset($xmlSheet->sheetViews->sheetView->selection)) { |
@@ -1193,8 +1193,8 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { |
| 1195 | 1195 | foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { |
| 1196 | - // Uppercase coordinate |
|
| 1197 | - $range = strtoupper($dataValidation["sqref"]); |
|
| 1196 | + // Uppercase coordinate |
|
| 1197 | + $range = strtoupper($dataValidation["sqref"]); |
|
| 1198 | 1198 | $rangeSet = explode(' ',$range); |
| 1199 | 1199 | foreach($rangeSet as $range) { |
| 1200 | 1200 | $stRange = $docSheet->shrinkRangeToFit($range); |
@@ -1267,10 +1267,10 @@ discard block |
||
| 1267 | 1267 | if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
| 1268 | 1268 | $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
| 1269 | 1269 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1270 | - if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
|
| 1270 | + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
|
| 1271 | 1271 | $comments[(string)$ele["Id"]] = (string)$ele["Target"]; |
| 1272 | 1272 | } |
| 1273 | - if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
|
| 1273 | + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
|
| 1274 | 1274 | $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; |
| 1275 | 1275 | } |
| 1276 | 1276 | } |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | // Loop through VML comments |
| 1301 | - foreach ($vmlComments as $relName => $relPath) { |
|
| 1301 | + foreach ($vmlComments as $relName => $relPath) { |
|
| 1302 | 1302 | // Load VML comments file |
| 1303 | 1303 | $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
| 1304 | 1304 | $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); |
@@ -1309,42 +1309,42 @@ discard block |
||
| 1309 | 1309 | $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1310 | 1310 | |
| 1311 | 1311 | if (isset($shape['style'])) { |
| 1312 | - $style = (string)$shape['style']; |
|
| 1313 | - $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1314 | - $column = null; |
|
| 1315 | - $row = null; |
|
| 1316 | - |
|
| 1317 | - $clientData = $shape->xpath('.//x:ClientData'); |
|
| 1318 | - if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | - $clientData = $clientData[0]; |
|
| 1320 | - |
|
| 1321 | - if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1322 | - $temp = $clientData->xpath('.//x:Row'); |
|
| 1323 | - if (is_array($temp)) $row = $temp[0]; |
|
| 1324 | - |
|
| 1325 | - $temp = $clientData->xpath('.//x:Column'); |
|
| 1326 | - if (is_array($temp)) $column = $temp[0]; |
|
| 1327 | - } |
|
| 1328 | - } |
|
| 1329 | - |
|
| 1330 | - if (($column !== NULL) && ($row !== NULL)) { |
|
| 1331 | - // Set comment properties |
|
| 1332 | - $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
|
| 1333 | - $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1334 | - |
|
| 1335 | - // Parse style |
|
| 1336 | - $styleArray = explode(';', str_replace(' ', '', $style)); |
|
| 1337 | - foreach ($styleArray as $stylePair) { |
|
| 1338 | - $stylePair = explode(':', $stylePair); |
|
| 1339 | - |
|
| 1340 | - if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | - if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | - if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | - if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1345 | - |
|
| 1346 | - } |
|
| 1347 | - } |
|
| 1312 | + $style = (string)$shape['style']; |
|
| 1313 | + $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1314 | + $column = null; |
|
| 1315 | + $row = null; |
|
| 1316 | + |
|
| 1317 | + $clientData = $shape->xpath('.//x:ClientData'); |
|
| 1318 | + if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | + $clientData = $clientData[0]; |
|
| 1320 | + |
|
| 1321 | + if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1322 | + $temp = $clientData->xpath('.//x:Row'); |
|
| 1323 | + if (is_array($temp)) $row = $temp[0]; |
|
| 1324 | + |
|
| 1325 | + $temp = $clientData->xpath('.//x:Column'); |
|
| 1326 | + if (is_array($temp)) $column = $temp[0]; |
|
| 1327 | + } |
|
| 1328 | + } |
|
| 1329 | + |
|
| 1330 | + if (($column !== NULL) && ($row !== NULL)) { |
|
| 1331 | + // Set comment properties |
|
| 1332 | + $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
|
| 1333 | + $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1334 | + |
|
| 1335 | + // Parse style |
|
| 1336 | + $styleArray = explode(';', str_replace(' ', '', $style)); |
|
| 1337 | + foreach ($styleArray as $stylePair) { |
|
| 1338 | + $stylePair = explode(':', $stylePair); |
|
| 1339 | + |
|
| 1340 | + if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | + if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | + if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | + if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | + if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1345 | + |
|
| 1346 | + } |
|
| 1347 | + } |
|
| 1348 | 1348 | } |
| 1349 | 1349 | } |
| 1350 | 1350 | } |
@@ -1919,12 +1919,12 @@ discard block |
||
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
| 1922 | - || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1922 | + || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1923 | 1923 | $objText->getFont()->setBold(true); |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | 1926 | if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
| 1927 | - || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1927 | + || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1928 | 1928 | $objText->getFont()->setItalic(true); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
| 1948 | - || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1948 | + || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1949 | 1949 | $objText->getFont()->setStrikethrough(true); |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | public function canRead($pFilename) |
| 232 | 232 | { |
| 233 | 233 | // Check if file exists |
| 234 | - if (!file_exists($pFilename)) { |
|
| 235 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 234 | + if ( ! file_exists($pFilename)) { |
|
| 235 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Check if zip class exists |
| 239 | - if (!class_exists('ZipArchive')) { |
|
| 239 | + if ( ! class_exists('ZipArchive')) { |
|
| 240 | 240 | throw new Exception("ZipArchive library is not enabled"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | public function listWorksheetInfo($pFilename) |
| 275 | 275 | { |
| 276 | 276 | // Check if file exists |
| 277 | - if (!file_exists($pFilename)) { |
|
| 278 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 277 | + if ( ! file_exists($pFilename)) { |
|
| 278 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $worksheetInfo = array(); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | foreach ($rels->Relationship as $rel) { |
| 288 | 288 | if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") { |
| 289 | 289 | $dir = dirname($rel["Target"]); |
| 290 | - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 290 | + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/".basename($rel["Target"]).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 291 | 291 | $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); |
| 292 | 292 | |
| 293 | 293 | $worksheets = array(); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 300 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 301 | 301 | if ($xmlWorkbook->sheets) { |
| 302 | 302 | $dir = dirname($rel["Target"]); |
| 303 | 303 | foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $tmpInfo['totalColumns'] = 0; |
| 310 | 310 | |
| 311 | 311 | $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 312 | - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 312 | + $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 313 | 313 | if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { |
| 314 | 314 | foreach ($xmlSheet->sheetData->row as $row) { |
| 315 | 315 | foreach ($row->c as $c) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } elseif ($value == '1') { |
| 349 | 349 | return true; |
| 350 | 350 | } else { |
| 351 | - return (bool)$c->v; |
|
| 351 | + return (bool) $c->v; |
|
| 352 | 352 | } |
| 353 | 353 | return $value; |
| 354 | 354 | } // function _castToBool() |
@@ -356,38 +356,38 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | private static function _castToError($c) { |
| 358 | 358 | // echo 'Initial Cast to Error<br />'; |
| 359 | - return isset($c->v) ? (string) $c->v : null;; |
|
| 359 | + return isset($c->v) ? (string) $c->v : null; ; |
|
| 360 | 360 | } // function _castToError() |
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | private static function _castToString($c) { |
| 364 | 364 | // echo 'Initial Cast to String<br />'; |
| 365 | - return isset($c->v) ? (string) $c->v : null;; |
|
| 365 | + return isset($c->v) ? (string) $c->v : null; ; |
|
| 366 | 366 | } // function _castToString() |
| 367 | 367 | |
| 368 | 368 | |
| 369 | - private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { |
|
| 369 | + private function _castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) { |
|
| 370 | 370 | // echo '<font color="darkgreen">Formula</font><br />'; |
| 371 | 371 | // echo '$c->f is '.$c->f.'<br />'; |
| 372 | - $cellDataType = 'f'; |
|
| 373 | - $value = "={$c->f}"; |
|
| 374 | - $calculatedValue = self::$castBaseType($c); |
|
| 372 | + $cellDataType = 'f'; |
|
| 373 | + $value = "={$c->f}"; |
|
| 374 | + $calculatedValue = self::$castBaseType($c); |
|
| 375 | 375 | |
| 376 | 376 | // Shared formula? |
| 377 | - if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') { |
|
| 377 | + if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') { |
|
| 378 | 378 | // echo '<font color="darkgreen">SHARED FORMULA</font><br />'; |
| 379 | - $instance = (string)$c->f['si']; |
|
| 379 | + $instance = (string) $c->f['si']; |
|
| 380 | 380 | |
| 381 | 381 | // echo 'Instance ID = '.$instance.'<br />'; |
| 382 | 382 | // |
| 383 | 383 | // echo 'Shared Formula Array:<pre>'; |
| 384 | 384 | // print_r($sharedFormulas); |
| 385 | 385 | // echo '</pre>'; |
| 386 | - if (!isset($sharedFormulas[(string)$c->f['si']])) { |
|
| 386 | + if ( ! isset($sharedFormulas[(string) $c->f['si']])) { |
|
| 387 | 387 | // echo '<font color="darkgreen">SETTING NEW SHARED FORMULA</font><br />'; |
| 388 | 388 | // echo 'Master is '.$r.'<br />'; |
| 389 | 389 | // echo 'Formula is '.$value.'<br />'; |
| 390 | - $sharedFormulas[$instance] = array( 'master' => $r, |
|
| 390 | + $sharedFormulas[$instance] = array('master' => $r, |
|
| 391 | 391 | 'formula' => $value |
| 392 | 392 | ); |
| 393 | 393 | // echo 'New Shared Formula Array:<pre>'; |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); |
| 405 | 405 | $difference[1] = $current[1] - $master[1]; |
| 406 | 406 | |
| 407 | - $value = $this->_referenceHelper->updateFormulaReferences( $sharedFormulas[$instance]['formula'], |
|
| 407 | + $value = $this->_referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], |
|
| 408 | 408 | 'A1', |
| 409 | 409 | $difference[0], |
| 410 | 410 | $difference[1] |
@@ -444,8 +444,8 @@ discard block |
||
| 444 | 444 | public function listWorksheetNames($pFilename) |
| 445 | 445 | { |
| 446 | 446 | // Check if file exists |
| 447 | - if (!file_exists($pFilename)) { |
|
| 448 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 447 | + if ( ! file_exists($pFilename)) { |
|
| 448 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | $worksheetNames = array(); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | foreach ($rels->Relationship as $rel) { |
| 458 | 458 | switch ($rel["Type"]) { |
| 459 | 459 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": |
| 460 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 460 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 461 | 461 | |
| 462 | 462 | if ($xmlWorkbook->sheets) { |
| 463 | 463 | foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { |
@@ -483,14 +483,14 @@ discard block |
||
| 483 | 483 | public function load($pFilename) |
| 484 | 484 | { |
| 485 | 485 | // Check if file exists |
| 486 | - if (!file_exists($pFilename)) { |
|
| 487 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 486 | + if ( ! file_exists($pFilename)) { |
|
| 487 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Initialisations |
| 491 | 491 | $excel = new PHPExcel; |
| 492 | 492 | $excel->removeSheetByIndex(0); |
| 493 | - if (!$this->_readDataOnly) { |
|
| 493 | + if ( ! $this->_readDataOnly) { |
|
| 494 | 494 | $excel->removeCellStyleXfByIndex(0); // remove the default style |
| 495 | 495 | $excel->removeCellXfByIndex(0); // remove the default style |
| 496 | 496 | } |
@@ -502,22 +502,22 @@ discard block |
||
| 502 | 502 | foreach ($wbRels->Relationship as $rel) { |
| 503 | 503 | switch ($rel["Type"]) { |
| 504 | 504 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme": |
| 505 | - $themeOrderArray = array('lt1','dk1','lt2','dk2'); |
|
| 505 | + $themeOrderArray = array('lt1', 'dk1', 'lt2', 'dk2'); |
|
| 506 | 506 | $themeOrderAdditional = count($themeOrderArray); |
| 507 | 507 | |
| 508 | 508 | $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}")); |
| 509 | 509 | if (is_object($xmlTheme)) { |
| 510 | 510 | $xmlThemeName = $xmlTheme->attributes(); |
| 511 | 511 | $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
| 512 | - $themeName = (string)$xmlThemeName['name']; |
|
| 512 | + $themeName = (string) $xmlThemeName['name']; |
|
| 513 | 513 | |
| 514 | 514 | $colourScheme = $xmlTheme->themeElements->clrScheme->attributes(); |
| 515 | - $colourSchemeName = (string)$colourScheme['name']; |
|
| 515 | + $colourSchemeName = (string) $colourScheme['name']; |
|
| 516 | 516 | $colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
| 517 | 517 | |
| 518 | 518 | $themeColours = array(); |
| 519 | 519 | foreach ($colourScheme as $k => $xmlColour) { |
| 520 | - $themePos = array_search($k,$themeOrderArray); |
|
| 520 | + $themePos = array_search($k, $themeOrderArray); |
|
| 521 | 521 | if ($themePos === false) { |
| 522 | 522 | $themePos = $themeOrderAdditional++; |
| 523 | 523 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $themeColours[$themePos] = $xmlColourData['val']; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | - self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours); |
|
| 532 | + self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours); |
|
| 533 | 533 | } |
| 534 | 534 | break; |
| 535 | 535 | } |
@@ -579,9 +579,9 @@ discard block |
||
| 579 | 579 | $cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); |
| 580 | 580 | $attributeType = $cellDataOfficeChildren->getName(); |
| 581 | 581 | $attributeValue = (string) $cellDataOfficeChildren->{$attributeType}; |
| 582 | - $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType); |
|
| 582 | + $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType); |
|
| 583 | 583 | $attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType); |
| 584 | - $docProps->setCustomProperty($propertyName,$attributeValue,$attributeType); |
|
| 584 | + $docProps->setCustomProperty($propertyName, $attributeValue, $attributeType); |
|
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | } |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": |
| 591 | 591 | $dir = dirname($rel["Target"]); |
| 592 | - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 592 | + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/".basename($rel["Target"]).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 593 | 593 | $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); |
| 594 | 594 | |
| 595 | 595 | $sharedStrings = array(); |
| 596 | 596 | $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); |
| 597 | - $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 597 | + $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 598 | 598 | if (isset($xmlStrings) && isset($xmlStrings->si)) { |
| 599 | 599 | foreach ($xmlStrings->si as $val) { |
| 600 | 600 | if (isset($val->t)) { |
| 601 | - $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $val->t ); |
|
| 601 | + $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t); |
|
| 602 | 602 | } elseif (isset($val->r)) { |
| 603 | 603 | $sharedStrings[] = $this->_parseRichText($val); |
| 604 | 604 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $styles = array(); |
|
| 615 | + $styles = array(); |
|
| 616 | 616 | $cellStyles = array(); |
| 617 | 617 | $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); |
| 618 | 618 | $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | if (isset($numFmts) && ($numFmts !== NULL)) { |
| 624 | 624 | $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
| 625 | 625 | } |
| 626 | - if (!$this->_readDataOnly && $xmlStyles) { |
|
| 626 | + if ( ! $this->_readDataOnly && $xmlStyles) { |
|
| 627 | 627 | foreach ($xmlStyles->cellXfs->xf as $xf) { |
| 628 | 628 | $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; |
| 629 | 629 | |
@@ -636,8 +636,8 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - if ((int)$xf["numFmtId"] < 164) { |
|
| 640 | - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
| 639 | + if ((int) $xf["numFmtId"] < 164) { |
|
| 640 | + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | //$numFmt = str_replace('mm', 'i', $numFmt); |
@@ -665,8 +665,8 @@ discard block |
||
| 665 | 665 | $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); |
| 666 | 666 | if (isset($tmpNumFmt["formatCode"])) { |
| 667 | 667 | $numFmt = (string) $tmpNumFmt["formatCode"]; |
| 668 | - } else if ((int)$xf["numFmtId"] < 165) { |
|
| 669 | - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
| 668 | + } else if ((int) $xf["numFmtId"] < 165) { |
|
| 669 | + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | $dxfs = array(); |
| 691 | - if (!$this->_readDataOnly && $xmlStyles) { |
|
| 691 | + if ( ! $this->_readDataOnly && $xmlStyles) { |
|
| 692 | 692 | if ($xmlStyles->dxfs) { |
| 693 | 693 | foreach ($xmlStyles->dxfs->dxf as $dxf) { |
| 694 | 694 | $style = new PHPExcel_Style; |
@@ -713,13 +713,13 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 716 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 717 | 717 | |
| 718 | 718 | // Set base date |
| 719 | 719 | if ($xmlWorkbook->workbookPr) { |
| 720 | 720 | PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); |
| 721 | 721 | if (isset($xmlWorkbook->workbookPr['date1904'])) { |
| 722 | - $date1904 = (string)$xmlWorkbook->workbookPr['date1904']; |
|
| 722 | + $date1904 = (string) $xmlWorkbook->workbookPr['date1904']; |
|
| 723 | 723 | if ($date1904 == "true" || $date1904 == "1") { |
| 724 | 724 | PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); |
| 725 | 725 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | ++$oldSheetId; |
| 740 | 740 | |
| 741 | 741 | // Check if sheet should be skipped |
| 742 | - if (isset($this->_loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { |
|
| 742 | + if (isset($this->_loadSheetsOnly) && ! in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { |
|
| 743 | 743 | ++$countSkippedSheets; |
| 744 | 744 | $mapSheetId[$oldSheetId] = null; |
| 745 | 745 | continue; |
@@ -755,40 +755,40 @@ discard block |
||
| 755 | 755 | // references in formula cells... during the load, all formulae should be correct, |
| 756 | 756 | // and we're simply bringing the worksheet name in line with the formula, not the |
| 757 | 757 | // reverse |
| 758 | - $docSheet->setTitle((string) $eleSheet["name"],false); |
|
| 758 | + $docSheet->setTitle((string) $eleSheet["name"], false); |
|
| 759 | 759 | $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 760 | - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 760 | + $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 761 | 761 | |
| 762 | 762 | $sharedFormulas = array(); |
| 763 | 763 | |
| 764 | 764 | if (isset($eleSheet["state"]) && (string) $eleSheet["state"] != '') { |
| 765 | - $docSheet->setSheetState( (string) $eleSheet["state"] ); |
|
| 765 | + $docSheet->setSheetState((string) $eleSheet["state"]); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { |
| 769 | 769 | if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
| 770 | - $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 770 | + $docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale'])); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
| 774 | - $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 774 | + $docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { |
| 778 | - $docSheet->setShowGridLines((string)$xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); |
|
| 778 | + $docSheet->setShowGridLines((string) $xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) { |
| 782 | - $docSheet->setShowRowColHeaders((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'] ? true : false); |
|
| 782 | + $docSheet->setShowRowColHeaders((string) $xmlSheet->sheetViews->sheetView['showRowColHeaders'] ? true : false); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { |
| 786 | - $docSheet->setRightToLeft((string)$xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); |
|
| 786 | + $docSheet->setRightToLeft((string) $xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | if (isset($xmlSheet->sheetViews->sheetView->pane)) { |
| 790 | 790 | if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
| 791 | - $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 791 | + $docSheet->freezePane((string) $xmlSheet->sheetViews->sheetView->pane['topLeftCell']); |
|
| 792 | 792 | } else { |
| 793 | 793 | $xSplit = 0; |
| 794 | 794 | $ySplit = 0; |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | if (isset($xmlSheet->sheetViews->sheetView->selection)) { |
| 809 | 809 | if (isset($xmlSheet->sheetViews->sheetView->selection['sqref'])) { |
| 810 | - $sqref = (string)$xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
| 810 | + $sqref = (string) $xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
| 811 | 811 | $sqref = explode(' ', $sqref); |
| 812 | 812 | $sqref = $sqref[0]; |
| 813 | 813 | $docSheet->setSelectedCells($sqref); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) { |
| 820 | 820 | if (isset($xmlSheet->sheetPr->tabColor['rgb'])) { |
| 821 | - $docSheet->getTabColor()->setARGB( (string)$xmlSheet->sheetPr->tabColor['rgb'] ); |
|
| 821 | + $docSheet->getTabColor()->setARGB((string) $xmlSheet->sheetPr->tabColor['rgb']); |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
@@ -845,18 +845,18 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | if (isset($xmlSheet->sheetFormatPr)) { |
| 848 | - if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { |
|
| 849 | - $docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] ); |
|
| 848 | + if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string) $xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string) $xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { |
|
| 849 | + $docSheet->getDefaultRowDimension()->setRowHeight((float) $xmlSheet->sheetFormatPr['defaultRowHeight']); |
|
| 850 | 850 | } |
| 851 | 851 | if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { |
| 852 | - $docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] ); |
|
| 852 | + $docSheet->getDefaultColumnDimension()->setWidth((float) $xmlSheet->sheetFormatPr['defaultColWidth']); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | - if (isset($xmlSheet->cols) && !$this->_readDataOnly) { |
|
| 856 | + if (isset($xmlSheet->cols) && ! $this->_readDataOnly) { |
|
| 857 | 857 | foreach ($xmlSheet->cols->col as $col) { |
| 858 | 858 | for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { |
| 859 | - if ($col["style"] && !$this->_readDataOnly) { |
|
| 859 | + if ($col["style"] && ! $this->_readDataOnly) { |
|
| 860 | 860 | $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); |
| 861 | 861 | } |
| 862 | 862 | if ($col["bestFit"]) { |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | - if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { |
|
| 883 | + if (isset($xmlSheet->printOptions) && ! $this->_readDataOnly) { |
|
| 884 | 884 | if ($xmlSheet->printOptions['gridLinesSet'] == 'true' && $xmlSheet->printOptions['gridLinesSet'] == '1') { |
| 885 | 885 | $docSheet->setShowGridlines(true); |
| 886 | 886 | } |
@@ -899,10 +899,10 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { |
| 901 | 901 | foreach ($xmlSheet->sheetData->row as $row) { |
| 902 | - if ($row["ht"] && !$this->_readDataOnly) { |
|
| 902 | + if ($row["ht"] && ! $this->_readDataOnly) { |
|
| 903 | 903 | $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); |
| 904 | 904 | } |
| 905 | - if ($row["hidden"] && !$this->_readDataOnly) { |
|
| 905 | + if ($row["hidden"] && ! $this->_readDataOnly) { |
|
| 906 | 906 | $docSheet->getRowDimension(intval($row["r"]))->setVisible(false); |
| 907 | 907 | } |
| 908 | 908 | if ($row["collapsed"]) { |
@@ -911,21 +911,21 @@ discard block |
||
| 911 | 911 | if ($row["outlineLevel"] > 0) { |
| 912 | 912 | $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); |
| 913 | 913 | } |
| 914 | - if ($row["s"] && !$this->_readDataOnly) { |
|
| 914 | + if ($row["s"] && ! $this->_readDataOnly) { |
|
| 915 | 915 | $docSheet->getRowDimension(intval($row["r"]))->setXfIndex(intval($row["s"])); |
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | foreach ($row->c as $c) { |
| 919 | - $r = (string) $c["r"]; |
|
| 920 | - $cellDataType = (string) $c["t"]; |
|
| 921 | - $value = null; |
|
| 922 | - $calculatedValue = null; |
|
| 919 | + $r = (string) $c["r"]; |
|
| 920 | + $cellDataType = (string) $c["t"]; |
|
| 921 | + $value = null; |
|
| 922 | + $calculatedValue = null; |
|
| 923 | 923 | |
| 924 | 924 | // Read cell? |
| 925 | 925 | if ($this->getReadFilter() !== NULL) { |
| 926 | 926 | $coordinates = PHPExcel_Cell::coordinateFromString($r); |
| 927 | 927 | |
| 928 | - if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { |
|
| 928 | + if ( ! $this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { |
|
| 929 | 929 | continue; |
| 930 | 930 | } |
| 931 | 931 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | switch ($cellDataType) { |
| 940 | 940 | case "s": |
| 941 | 941 | // echo 'String<br />'; |
| 942 | - if ((string)$c->v != '') { |
|
| 942 | + if ((string) $c->v != '') { |
|
| 943 | 943 | $value = $sharedStrings[intval($c->v)]; |
| 944 | 944 | |
| 945 | 945 | if ($value instanceof PHPExcel_RichText) { |
@@ -952,11 +952,11 @@ discard block |
||
| 952 | 952 | break; |
| 953 | 953 | case "b": |
| 954 | 954 | // echo 'Boolean<br />'; |
| 955 | - if (!isset($c->f)) { |
|
| 955 | + if ( ! isset($c->f)) { |
|
| 956 | 956 | $value = self::_castToBool($c); |
| 957 | 957 | } else { |
| 958 | 958 | // Formula |
| 959 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool'); |
|
| 959 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToBool'); |
|
| 960 | 960 | if (isset($c->f['t'])) { |
| 961 | 961 | $att = array(); |
| 962 | 962 | $att = $c->f; |
@@ -972,11 +972,11 @@ discard block |
||
| 972 | 972 | break; |
| 973 | 973 | case "e": |
| 974 | 974 | // echo 'Error<br />'; |
| 975 | - if (!isset($c->f)) { |
|
| 975 | + if ( ! isset($c->f)) { |
|
| 976 | 976 | $value = self::_castToError($c); |
| 977 | 977 | } else { |
| 978 | 978 | // Formula |
| 979 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError'); |
|
| 979 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToError'); |
|
| 980 | 980 | // echo '$calculatedValue = '.$calculatedValue.'<br />'; |
| 981 | 981 | } |
| 982 | 982 | |
@@ -984,13 +984,13 @@ discard block |
||
| 984 | 984 | |
| 985 | 985 | default: |
| 986 | 986 | // echo 'Default<br />'; |
| 987 | - if (!isset($c->f)) { |
|
| 987 | + if ( ! isset($c->f)) { |
|
| 988 | 988 | // echo 'Not a Formula<br />'; |
| 989 | 989 | $value = self::_castToString($c); |
| 990 | 990 | } else { |
| 991 | 991 | // echo 'Treat as Formula<br />'; |
| 992 | 992 | // Formula |
| 993 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString'); |
|
| 993 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToString'); |
|
| 994 | 994 | // echo '$calculatedValue = '.$calculatedValue.'<br />'; |
| 995 | 995 | } |
| 996 | 996 | |
@@ -1000,9 +1000,9 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | // Check for numeric values |
| 1002 | 1002 | if (is_numeric($value) && $cellDataType != 's') { |
| 1003 | - if ($value == (int)$value) $value = (int)$value; |
|
| 1004 | - elseif ($value == (float)$value) $value = (float)$value; |
|
| 1005 | - elseif ($value == (double)$value) $value = (double)$value; |
|
| 1003 | + if ($value == (int) $value) $value = (int) $value; |
|
| 1004 | + elseif ($value == (float) $value) $value = (float) $value; |
|
| 1005 | + elseif ($value == (double) $value) $value = (double) $value; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | // Rich text? |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | // Style information? |
| 1025 | - if ($c["s"] && !$this->_readDataOnly) { |
|
| 1025 | + if ($c["s"] && ! $this->_readDataOnly) { |
|
| 1026 | 1026 | // no style index means 0, it seems |
| 1027 | 1027 | $cell->setXfIndex(isset($styles[intval($c["s"])]) ? |
| 1028 | 1028 | intval($c["s"]) : 0); |
@@ -1032,15 +1032,15 @@ discard block |
||
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | $conditionals = array(); |
| 1035 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { |
|
| 1035 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { |
|
| 1036 | 1036 | foreach ($xmlSheet->conditionalFormatting as $conditional) { |
| 1037 | 1037 | foreach ($conditional->cfRule as $cfRule) { |
| 1038 | 1038 | if ( |
| 1039 | 1039 | ( |
| 1040 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || |
|
| 1041 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || |
|
| 1042 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || |
|
| 1043 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION |
|
| 1040 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || |
|
| 1041 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || |
|
| 1042 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || |
|
| 1043 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION |
|
| 1044 | 1044 | ) && isset($dxfs[intval($cfRule["dxfId"])]) |
| 1045 | 1045 | ) { |
| 1046 | 1046 | $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; |
@@ -1053,19 +1053,19 @@ discard block |
||
| 1053 | 1053 | $conditionalStyles = array(); |
| 1054 | 1054 | foreach ($cfRules as $cfRule) { |
| 1055 | 1055 | $objConditional = new PHPExcel_Style_Conditional(); |
| 1056 | - $objConditional->setConditionType((string)$cfRule["type"]); |
|
| 1057 | - $objConditional->setOperatorType((string)$cfRule["operator"]); |
|
| 1056 | + $objConditional->setConditionType((string) $cfRule["type"]); |
|
| 1057 | + $objConditional->setOperatorType((string) $cfRule["operator"]); |
|
| 1058 | 1058 | |
| 1059 | - if ((string)$cfRule["text"] != '') { |
|
| 1060 | - $objConditional->setText((string)$cfRule["text"]); |
|
| 1059 | + if ((string) $cfRule["text"] != '') { |
|
| 1060 | + $objConditional->setText((string) $cfRule["text"]); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | if (count($cfRule->formula) > 1) { |
| 1064 | 1064 | foreach ($cfRule->formula as $formula) { |
| 1065 | - $objConditional->addCondition((string)$formula); |
|
| 1065 | + $objConditional->addCondition((string) $formula); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } else { |
| 1068 | - $objConditional->addCondition((string)$cfRule->formula); |
|
| 1068 | + $objConditional->addCondition((string) $cfRule->formula); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]); |
| 1071 | 1071 | $conditionalStyles[] = $objConditional; |
@@ -1080,14 +1080,14 @@ discard block |
||
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | $aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells"); |
| 1083 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1083 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1084 | 1084 | foreach ($aKeys as $key) { |
| 1085 | - $method = "set" . ucfirst($key); |
|
| 1085 | + $method = "set".ucfirst($key); |
|
| 1086 | 1086 | $docSheet->getProtection()->$method($xmlSheet->sheetProtection[$key] == "true"); |
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1090 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1091 | 1091 | $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true); |
| 1092 | 1092 | if ($xmlSheet->protectedRanges->protectedRange) { |
| 1093 | 1093 | foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { |
@@ -1096,17 +1096,17 @@ discard block |
||
| 1096 | 1096 | } |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | - if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) { |
|
| 1099 | + if ($xmlSheet && $xmlSheet->autoFilter && ! $this->_readDataOnly) { |
|
| 1100 | 1100 | $docSheet->setAutoFilter((string) $xmlSheet->autoFilter["ref"]); |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | - if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) { |
|
| 1103 | + if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && ! $this->_readDataOnly) { |
|
| 1104 | 1104 | foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { |
| 1105 | 1105 | $docSheet->mergeCells((string) $mergeCell["ref"]); |
| 1106 | 1106 | } |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | - if ($xmlSheet && $xmlSheet->pageMargins && !$this->_readDataOnly) { |
|
| 1109 | + if ($xmlSheet && $xmlSheet->pageMargins && ! $this->_readDataOnly) { |
|
| 1110 | 1110 | $docPageMargins = $docSheet->getPageMargins(); |
| 1111 | 1111 | $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"])); |
| 1112 | 1112 | $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"])); |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"])); |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - if ($xmlSheet && $xmlSheet->pageSetup && !$this->_readDataOnly) { |
|
| 1119 | + if ($xmlSheet && $xmlSheet->pageSetup && ! $this->_readDataOnly) { |
|
| 1120 | 1120 | $docPageSetup = $docSheet->getPageSetup(); |
| 1121 | 1121 | |
| 1122 | 1122 | if (isset($xmlSheet->pageSetup["orientation"])) { |
@@ -1135,34 +1135,34 @@ discard block |
||
| 1135 | 1135 | $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false); |
| 1136 | 1136 | } |
| 1137 | 1137 | if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) && |
| 1138 | - ((string)$xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string)$xmlSheet->pageSetup["useFirstPageNumber"] == '1')) { |
|
| 1138 | + ((string) $xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string) $xmlSheet->pageSetup["useFirstPageNumber"] == '1')) { |
|
| 1139 | 1139 | $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup["firstPageNumber"])); |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | - if ($xmlSheet && $xmlSheet->headerFooter && !$this->_readDataOnly) { |
|
| 1143 | + if ($xmlSheet && $xmlSheet->headerFooter && ! $this->_readDataOnly) { |
|
| 1144 | 1144 | $docHeaderFooter = $docSheet->getHeaderFooter(); |
| 1145 | 1145 | |
| 1146 | 1146 | if (isset($xmlSheet->headerFooter["differentOddEven"]) && |
| 1147 | - ((string)$xmlSheet->headerFooter["differentOddEven"] == 'true' || (string)$xmlSheet->headerFooter["differentOddEven"] == '1')) { |
|
| 1147 | + ((string) $xmlSheet->headerFooter["differentOddEven"] == 'true' || (string) $xmlSheet->headerFooter["differentOddEven"] == '1')) { |
|
| 1148 | 1148 | $docHeaderFooter->setDifferentOddEven(true); |
| 1149 | 1149 | } else { |
| 1150 | 1150 | $docHeaderFooter->setDifferentOddEven(false); |
| 1151 | 1151 | } |
| 1152 | 1152 | if (isset($xmlSheet->headerFooter["differentFirst"]) && |
| 1153 | - ((string)$xmlSheet->headerFooter["differentFirst"] == 'true' || (string)$xmlSheet->headerFooter["differentFirst"] == '1')) { |
|
| 1153 | + ((string) $xmlSheet->headerFooter["differentFirst"] == 'true' || (string) $xmlSheet->headerFooter["differentFirst"] == '1')) { |
|
| 1154 | 1154 | $docHeaderFooter->setDifferentFirst(true); |
| 1155 | 1155 | } else { |
| 1156 | 1156 | $docHeaderFooter->setDifferentFirst(false); |
| 1157 | 1157 | } |
| 1158 | 1158 | if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && |
| 1159 | - ((string)$xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string)$xmlSheet->headerFooter["scaleWithDoc"] == '0')) { |
|
| 1159 | + ((string) $xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string) $xmlSheet->headerFooter["scaleWithDoc"] == '0')) { |
|
| 1160 | 1160 | $docHeaderFooter->setScaleWithDocument(false); |
| 1161 | 1161 | } else { |
| 1162 | 1162 | $docHeaderFooter->setScaleWithDocument(true); |
| 1163 | 1163 | } |
| 1164 | 1164 | if (isset($xmlSheet->headerFooter["alignWithMargins"]) && |
| 1165 | - ((string)$xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string)$xmlSheet->headerFooter["alignWithMargins"] == '0')) { |
|
| 1165 | + ((string) $xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string) $xmlSheet->headerFooter["alignWithMargins"] == '0')) { |
|
| 1166 | 1166 | $docHeaderFooter->setAlignWithMargins(false); |
| 1167 | 1167 | } else { |
| 1168 | 1168 | $docHeaderFooter->setAlignWithMargins(true); |
@@ -1176,27 +1176,27 @@ discard block |
||
| 1176 | 1176 | $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | - if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) { |
|
| 1179 | + if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && ! $this->_readDataOnly) { |
|
| 1180 | 1180 | foreach ($xmlSheet->rowBreaks->brk as $brk) { |
| 1181 | 1181 | if ($brk["man"]) { |
| 1182 | 1182 | $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW); |
| 1183 | 1183 | } |
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | - if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) { |
|
| 1186 | + if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && ! $this->_readDataOnly) { |
|
| 1187 | 1187 | foreach ($xmlSheet->colBreaks->brk as $brk) { |
| 1188 | 1188 | if ($brk["man"]) { |
| 1189 | - $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN); |
|
| 1189 | + $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"])."1", PHPExcel_Worksheet::BREAK_COLUMN); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | - if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { |
|
| 1194 | + if ($xmlSheet && $xmlSheet->dataValidations && ! $this->_readDataOnly) { |
|
| 1195 | 1195 | foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { |
| 1196 | 1196 | // Uppercase coordinate |
| 1197 | 1197 | $range = strtoupper($dataValidation["sqref"]); |
| 1198 | - $rangeSet = explode(' ',$range); |
|
| 1199 | - foreach($rangeSet as $range) { |
|
| 1198 | + $rangeSet = explode(' ', $range); |
|
| 1199 | + foreach ($rangeSet as $range) { |
|
| 1200 | 1200 | $stRange = $docSheet->shrinkRangeToFit($range); |
| 1201 | 1201 | |
| 1202 | 1202 | // Extract all cell references in $range |
@@ -1224,13 +1224,13 @@ discard block |
||
| 1224 | 1224 | |
| 1225 | 1225 | // Add hyperlinks |
| 1226 | 1226 | $hyperlinks = array(); |
| 1227 | - if (!$this->_readDataOnly) { |
|
| 1227 | + if ( ! $this->_readDataOnly) { |
|
| 1228 | 1228 | // Locate hyperlink relations |
| 1229 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1230 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1229 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1230 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1231 | 1231 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1232 | 1232 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { |
| 1233 | - $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1233 | + $hyperlinks[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1234 | 1234 | } |
| 1235 | 1235 | } |
| 1236 | 1236 | } |
@@ -1242,17 +1242,17 @@ discard block |
||
| 1242 | 1242 | $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
| 1243 | 1243 | |
| 1244 | 1244 | foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { |
| 1245 | - $cell = $docSheet->getCell( $cellReference ); |
|
| 1245 | + $cell = $docSheet->getCell($cellReference); |
|
| 1246 | 1246 | if (isset($linkRel['id'])) { |
| 1247 | - $cell->getHyperlink()->setUrl( $hyperlinks[ (string)$linkRel['id'] ] ); |
|
| 1247 | + $cell->getHyperlink()->setUrl($hyperlinks[(string) $linkRel['id']]); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | if (isset($hyperlink['location'])) { |
| 1250 | - $cell->getHyperlink()->setUrl( 'sheet://' . (string)$hyperlink['location'] ); |
|
| 1250 | + $cell->getHyperlink()->setUrl('sheet://'.(string) $hyperlink['location']); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | // Tooltip |
| 1254 | 1254 | if (isset($hyperlink['tooltip'])) { |
| 1255 | - $cell->getHyperlink()->setTooltip( (string)$hyperlink['tooltip'] ); |
|
| 1255 | + $cell->getHyperlink()->setTooltip((string) $hyperlink['tooltip']); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | } |
@@ -1262,16 +1262,16 @@ discard block |
||
| 1262 | 1262 | // Add comments |
| 1263 | 1263 | $comments = array(); |
| 1264 | 1264 | $vmlComments = array(); |
| 1265 | - if (!$this->_readDataOnly) { |
|
| 1265 | + if ( ! $this->_readDataOnly) { |
|
| 1266 | 1266 | // Locate comment relations |
| 1267 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1268 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1267 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1268 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1269 | 1269 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1270 | 1270 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
| 1271 | - $comments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1271 | + $comments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1272 | 1272 | } |
| 1273 | 1273 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
| 1274 | - $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1274 | + $vmlComments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
@@ -1279,29 +1279,29 @@ discard block |
||
| 1279 | 1279 | // Loop through comments |
| 1280 | 1280 | foreach ($comments as $relName => $relPath) { |
| 1281 | 1281 | // Load comments file |
| 1282 | - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
|
| 1283 | - $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) ); |
|
| 1282 | + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet")."/".$relPath); |
|
| 1283 | + $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath)); |
|
| 1284 | 1284 | |
| 1285 | 1285 | // Utility variables |
| 1286 | 1286 | $authors = array(); |
| 1287 | 1287 | |
| 1288 | 1288 | // Loop through authors |
| 1289 | 1289 | foreach ($commentsFile->authors->author as $author) { |
| 1290 | - $authors[] = (string)$author; |
|
| 1290 | + $authors[] = (string) $author; |
|
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | // Loop through contents |
| 1294 | 1294 | foreach ($commentsFile->commentList->comment as $comment) { |
| 1295 | - $docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] ); |
|
| 1296 | - $docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) ); |
|
| 1295 | + $docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]); |
|
| 1296 | + $docSheet->getComment((string) $comment['ref'])->setText($this->_parseRichText($comment->text)); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | // Loop through VML comments |
| 1301 | 1301 | foreach ($vmlComments as $relName => $relPath) { |
| 1302 | 1302 | // Load VML comments file |
| 1303 | - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
|
| 1304 | - $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); |
|
| 1303 | + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet")."/".$relPath); |
|
| 1304 | + $vmlCommentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath)); |
|
| 1305 | 1305 | $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1306 | 1306 | |
| 1307 | 1307 | $shapes = $vmlCommentsFile->xpath('//v:shape'); |
@@ -1309,16 +1309,16 @@ discard block |
||
| 1309 | 1309 | $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1310 | 1310 | |
| 1311 | 1311 | if (isset($shape['style'])) { |
| 1312 | - $style = (string)$shape['style']; |
|
| 1313 | - $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1312 | + $style = (string) $shape['style']; |
|
| 1313 | + $fillColor = strtoupper(substr((string) $shape['fillcolor'], 1)); |
|
| 1314 | 1314 | $column = null; |
| 1315 | 1315 | $row = null; |
| 1316 | 1316 | |
| 1317 | 1317 | $clientData = $shape->xpath('.//x:ClientData'); |
| 1318 | - if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | - $clientData = $clientData[0]; |
|
| 1318 | + if (is_array($clientData) && ! empty($clientData)) { |
|
| 1319 | + $clientData = $clientData[0]; |
|
| 1320 | 1320 | |
| 1321 | - if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1321 | + if (isset($clientData['ObjectType']) && (string) $clientData['ObjectType'] == 'Note') { |
|
| 1322 | 1322 | $temp = $clientData->xpath('.//x:Row'); |
| 1323 | 1323 | if (is_array($temp)) $row = $temp[0]; |
| 1324 | 1324 | |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | if (($column !== NULL) && ($row !== NULL)) { |
| 1331 | 1331 | // Set comment properties |
| 1332 | 1332 | $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
| 1333 | - $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1333 | + $comment->getFillColor()->setRGB($fillColor); |
|
| 1334 | 1334 | |
| 1335 | 1335 | // Parse style |
| 1336 | 1336 | $styleArray = explode(';', str_replace(' ', '', $style)); |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
| 1342 | 1342 | if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
| 1343 | 1343 | if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1344 | + if ($stylePair[0] == 'visibility') $comment->setVisible($stylePair[1] == 'visible'); |
|
| 1345 | 1345 | |
| 1346 | 1346 | } |
| 1347 | 1347 | } |
@@ -1350,9 +1350,9 @@ discard block |
||
| 1350 | 1350 | } |
| 1351 | 1351 | |
| 1352 | 1352 | // Header/footer images |
| 1353 | - if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) { |
|
| 1354 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1355 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1353 | + if ($xmlSheet && $xmlSheet->legacyDrawingHF && ! $this->_readDataOnly) { |
|
| 1354 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1355 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1356 | 1356 | $vmlRelationship = ''; |
| 1357 | 1357 | |
| 1358 | 1358 | foreach ($relsWorksheet->Relationship as $ele) { |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | |
| 1364 | 1364 | if ($vmlRelationship != '') { |
| 1365 | 1365 | // Fetch linked images |
| 1366 | - $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1366 | + $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship).'/_rels/'.basename($vmlRelationship).'.rels')); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1367 | 1367 | $drawings = array(); |
| 1368 | 1368 | foreach ($relsVML->Relationship as $ele) { |
| 1369 | 1369 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { |
@@ -1384,20 +1384,20 @@ discard block |
||
| 1384 | 1384 | $imageData = $imageData[0]; |
| 1385 | 1385 | |
| 1386 | 1386 | $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); |
| 1387 | - $style = self::toCSSArray( (string)$shape['style'] ); |
|
| 1387 | + $style = self::toCSSArray((string) $shape['style']); |
|
| 1388 | 1388 | |
| 1389 | - $hfImages[ (string)$shape['id'] ] = new PHPExcel_Worksheet_HeaderFooterDrawing(); |
|
| 1389 | + $hfImages[(string) $shape['id']] = new PHPExcel_Worksheet_HeaderFooterDrawing(); |
|
| 1390 | 1390 | if (isset($imageData['title'])) { |
| 1391 | - $hfImages[ (string)$shape['id'] ]->setName( (string)$imageData['title'] ); |
|
| 1391 | + $hfImages[(string) $shape['id']]->setName((string) $imageData['title']); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | - $hfImages[ (string)$shape['id'] ]->setPath("zip://$pFilename#" . $drawings[(string)$imageData['relid']], false); |
|
| 1395 | - $hfImages[ (string)$shape['id'] ]->setResizeProportional(false); |
|
| 1396 | - $hfImages[ (string)$shape['id'] ]->setWidth($style['width']); |
|
| 1397 | - $hfImages[ (string)$shape['id'] ]->setHeight($style['height']); |
|
| 1398 | - $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']); |
|
| 1399 | - $hfImages[ (string)$shape['id'] ]->setOffsetY($style['margin-top']); |
|
| 1400 | - $hfImages[ (string)$shape['id'] ]->setResizeProportional(true); |
|
| 1394 | + $hfImages[(string) $shape['id']]->setPath("zip://$pFilename#".$drawings[(string) $imageData['relid']], false); |
|
| 1395 | + $hfImages[(string) $shape['id']]->setResizeProportional(false); |
|
| 1396 | + $hfImages[(string) $shape['id']]->setWidth($style['width']); |
|
| 1397 | + $hfImages[(string) $shape['id']]->setHeight($style['height']); |
|
| 1398 | + $hfImages[(string) $shape['id']]->setOffsetX($style['margin-left']); |
|
| 1399 | + $hfImages[(string) $shape['id']]->setOffsetY($style['margin-top']); |
|
| 1400 | + $hfImages[(string) $shape['id']]->setResizeProportional(true); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | $docSheet->getHeaderFooter()->setImages($hfImages); |
@@ -1408,18 +1408,18 @@ discard block |
||
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | // TODO: Make sure drawings and graph are loaded differently! |
| 1411 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1412 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1411 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1412 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1413 | 1413 | $drawings = array(); |
| 1414 | 1414 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1415 | 1415 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") { |
| 1416 | 1416 | $drawings[(string) $ele["Id"]] = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); |
| 1417 | 1417 | } |
| 1418 | 1418 | } |
| 1419 | - if ($xmlSheet->drawing && !$this->_readDataOnly) { |
|
| 1419 | + if ($xmlSheet->drawing && ! $this->_readDataOnly) { |
|
| 1420 | 1420 | foreach ($xmlSheet->drawing as $drawing) { |
| 1421 | 1421 | $fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 1422 | - $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1422 | + $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing)."/_rels/".basename($fileDrawing).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1423 | 1423 | $images = array(); |
| 1424 | 1424 | |
| 1425 | 1425 | if ($relsDrawing && $relsDrawing->Relationship) { |
@@ -1446,8 +1446,8 @@ discard block |
||
| 1446 | 1446 | $objDrawing = new PHPExcel_Worksheet_Drawing; |
| 1447 | 1447 | $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
| 1448 | 1448 | $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
| 1449 | - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1450 | - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); |
|
| 1449 | + $objDrawing->setPath("zip://$pFilename#".$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1450 | + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col).($oneCellAnchor->from->row + 1)); |
|
| 1451 | 1451 | $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); |
| 1452 | 1452 | $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); |
| 1453 | 1453 | $objDrawing->setResizeProportional(false); |
@@ -1468,10 +1468,10 @@ discard block |
||
| 1468 | 1468 | } |
| 1469 | 1469 | $objDrawing->setWorksheet($docSheet); |
| 1470 | 1470 | } else { |
| 1471 | - $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1); |
|
| 1471 | + $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col).($oneCellAnchor->from->row + 1); |
|
| 1472 | 1472 | $offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff); |
| 1473 | 1473 | $offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff); |
| 1474 | - $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); |
|
| 1474 | + $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); |
|
| 1475 | 1475 | $height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")); |
| 1476 | 1476 | } |
| 1477 | 1477 | } |
@@ -1485,8 +1485,8 @@ discard block |
||
| 1485 | 1485 | $objDrawing = new PHPExcel_Worksheet_Drawing; |
| 1486 | 1486 | $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
| 1487 | 1487 | $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
| 1488 | - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1489 | - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); |
|
| 1488 | + $objDrawing->setPath("zip://$pFilename#".$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1489 | + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col).($twoCellAnchor->from->row + 1)); |
|
| 1490 | 1490 | $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); |
| 1491 | 1491 | $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); |
| 1492 | 1492 | $objDrawing->setResizeProportional(false); |
@@ -1508,19 +1508,19 @@ discard block |
||
| 1508 | 1508 | $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); |
| 1509 | 1509 | } |
| 1510 | 1510 | $objDrawing->setWorksheet($docSheet); |
| 1511 | - } elseif($this->_includeCharts) { |
|
| 1512 | - $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1); |
|
| 1511 | + } elseif ($this->_includeCharts) { |
|
| 1512 | + $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col).($twoCellAnchor->from->row + 1); |
|
| 1513 | 1513 | $fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff); |
| 1514 | 1514 | $fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff); |
| 1515 | - $toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1); |
|
| 1515 | + $toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col).($twoCellAnchor->to->row + 1); |
|
| 1516 | 1516 | $toOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff); |
| 1517 | 1517 | $toOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff); |
| 1518 | - $graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic; |
|
| 1519 | - $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; |
|
| 1518 | + $graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic; |
|
| 1519 | + $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; |
|
| 1520 | 1520 | $thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); |
| 1521 | 1521 | |
| 1522 | 1522 | $chartDetails[$docSheet->getTitle().'!'.$thisChart] = |
| 1523 | - array( 'fromCoordinate' => $fromCoordinate, |
|
| 1523 | + array('fromCoordinate' => $fromCoordinate, |
|
| 1524 | 1524 | 'fromOffsetX' => $fromOffsetX, |
| 1525 | 1525 | 'fromOffsetY' => $fromOffsetY, |
| 1526 | 1526 | 'toCoordinate' => $toCoordinate, |
@@ -1540,23 +1540,23 @@ discard block |
||
| 1540 | 1540 | if ($xmlWorkbook->definedNames) { |
| 1541 | 1541 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
| 1542 | 1542 | // Extract range |
| 1543 | - $extractedRange = (string)$definedName; |
|
| 1543 | + $extractedRange = (string) $definedName; |
|
| 1544 | 1544 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
| 1545 | - if (($spos = strpos($extractedRange,'!')) !== false) { |
|
| 1546 | - $extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos)); |
|
| 1545 | + if (($spos = strpos($extractedRange, '!')) !== false) { |
|
| 1546 | + $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
| 1547 | 1547 | } else { |
| 1548 | 1548 | $extractedRange = str_replace('$', '', $extractedRange); |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | // Valid range? |
| 1552 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1552 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1553 | 1553 | continue; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | // Some definedNames are only applicable if we are on the same sheet... |
| 1557 | - if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) { |
|
| 1557 | + if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $sheetId) { |
|
| 1558 | 1558 | // Switch on type |
| 1559 | - switch ((string)$definedName['name']) { |
|
| 1559 | + switch ((string) $definedName['name']) { |
|
| 1560 | 1560 | |
| 1561 | 1561 | case '_xlnm._FilterDatabase': |
| 1562 | 1562 | $docSheet->setAutoFilter($extractedRange); |
@@ -1582,14 +1582,14 @@ discard block |
||
| 1582 | 1582 | break; |
| 1583 | 1583 | |
| 1584 | 1584 | case '_xlnm.Print_Area': |
| 1585 | - $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
| 1585 | + $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
| 1586 | 1586 | $newRangeSets = array(); |
| 1587 | - foreach($rangeSets as $rangeSet) { |
|
| 1588 | - $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
| 1587 | + foreach ($rangeSets as $rangeSet) { |
|
| 1588 | + $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
| 1589 | 1589 | $rangeSet = isset($range[1]) ? $range[1] : $range[0]; |
| 1590 | 1590 | $newRangeSets[] = str_replace('$', '', $rangeSet); |
| 1591 | 1591 | } |
| 1592 | - $docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets)); |
|
| 1592 | + $docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets)); |
|
| 1593 | 1593 | break; |
| 1594 | 1594 | |
| 1595 | 1595 | default: |
@@ -1607,24 +1607,24 @@ discard block |
||
| 1607 | 1607 | if ($xmlWorkbook->definedNames) { |
| 1608 | 1608 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
| 1609 | 1609 | // Extract range |
| 1610 | - $extractedRange = (string)$definedName; |
|
| 1610 | + $extractedRange = (string) $definedName; |
|
| 1611 | 1611 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
| 1612 | - if (($spos = strpos($extractedRange,'!')) !== false) { |
|
| 1613 | - $extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos)); |
|
| 1612 | + if (($spos = strpos($extractedRange, '!')) !== false) { |
|
| 1613 | + $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
| 1614 | 1614 | } else { |
| 1615 | 1615 | $extractedRange = str_replace('$', '', $extractedRange); |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | 1618 | // Valid range? |
| 1619 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1619 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1620 | 1620 | continue; |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | // Some definedNames are only applicable if we are on the same sheet... |
| 1624 | - if ((string)$definedName['localSheetId'] != '') { |
|
| 1624 | + if ((string) $definedName['localSheetId'] != '') { |
|
| 1625 | 1625 | // Local defined name |
| 1626 | 1626 | // Switch on type |
| 1627 | - switch ((string)$definedName['name']) { |
|
| 1627 | + switch ((string) $definedName['name']) { |
|
| 1628 | 1628 | |
| 1629 | 1629 | case '_xlnm._FilterDatabase': |
| 1630 | 1630 | case '_xlnm.Print_Titles': |
@@ -1632,26 +1632,26 @@ discard block |
||
| 1632 | 1632 | break; |
| 1633 | 1633 | |
| 1634 | 1634 | default: |
| 1635 | - $range = explode('!', (string)$definedName); |
|
| 1635 | + $range = explode('!', (string) $definedName); |
|
| 1636 | 1636 | if (count($range) == 2) { |
| 1637 | 1637 | $range[0] = str_replace("''", "'", $range[0]); |
| 1638 | 1638 | $range[0] = str_replace("'", "", $range[0]); |
| 1639 | 1639 | if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { |
| 1640 | 1640 | $extractedRange = str_replace('$', '', $range[1]); |
| 1641 | - $scope = $docSheet->getParent()->getSheet((string)$definedName['localSheetId']); |
|
| 1641 | + $scope = $docSheet->getParent()->getSheet((string) $definedName['localSheetId']); |
|
| 1642 | 1642 | |
| 1643 | - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); |
|
| 1643 | + $excel->addNamedRange(new PHPExcel_NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope)); |
|
| 1644 | 1644 | } |
| 1645 | 1645 | } |
| 1646 | 1646 | break; |
| 1647 | 1647 | } |
| 1648 | - } else if (!isset($definedName['localSheetId'])) { |
|
| 1648 | + } else if ( ! isset($definedName['localSheetId'])) { |
|
| 1649 | 1649 | // "Global" definedNames |
| 1650 | 1650 | $locatedSheet = null; |
| 1651 | 1651 | $extractedSheetName = ''; |
| 1652 | - if (strpos( (string)$definedName, '!' ) !== false) { |
|
| 1652 | + if (strpos((string) $definedName, '!') !== false) { |
|
| 1653 | 1653 | // Extract sheet name |
| 1654 | - $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle( (string)$definedName, true ); |
|
| 1654 | + $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle((string) $definedName, true); |
|
| 1655 | 1655 | $extractedSheetName = $extractedSheetName[0]; |
| 1656 | 1656 | |
| 1657 | 1657 | // Locate sheet |
@@ -1663,14 +1663,14 @@ discard block |
||
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | if ($locatedSheet !== NULL) { |
| 1666 | - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) ); |
|
| 1666 | + $excel->addNamedRange(new PHPExcel_NamedRange((string) $definedName['name'], $locatedSheet, $extractedRange, false)); |
|
| 1667 | 1667 | } |
| 1668 | 1668 | } |
| 1669 | 1669 | } |
| 1670 | 1670 | } |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | - if (!$this->_readDataOnly) { |
|
| 1673 | + if ( ! $this->_readDataOnly) { |
|
| 1674 | 1674 | // active sheet index |
| 1675 | 1675 | $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index |
| 1676 | 1676 | |
@@ -1690,15 +1690,15 @@ discard block |
||
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | |
| 1693 | - if (!$this->_readDataOnly) { |
|
| 1693 | + if ( ! $this->_readDataOnly) { |
|
| 1694 | 1694 | $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml")); |
| 1695 | 1695 | foreach ($contentTypes->Override as $contentType) { |
| 1696 | 1696 | switch ($contentType["ContentType"]) { |
| 1697 | 1697 | case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": |
| 1698 | 1698 | if ($this->_includeCharts) { |
| 1699 | - $chartEntryRef = ltrim($contentType['PartName'],'/'); |
|
| 1699 | + $chartEntryRef = ltrim($contentType['PartName'], '/'); |
|
| 1700 | 1700 | $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef)); |
| 1701 | - $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml')); |
|
| 1701 | + $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); |
|
| 1702 | 1702 | |
| 1703 | 1703 | // echo 'Chart ',$chartEntryRef,'<br />'; |
| 1704 | 1704 | // var_dump($charts[$chartEntryRef]); |
@@ -1711,11 +1711,11 @@ discard block |
||
| 1711 | 1711 | |
| 1712 | 1712 | $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); |
| 1713 | 1713 | $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet'])); |
| 1714 | - $objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'], |
|
| 1714 | + $objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], |
|
| 1715 | 1715 | $chartDetails[$chartPositionRef]['fromOffsetX'], |
| 1716 | 1716 | $chartDetails[$chartPositionRef]['fromOffsetY'] |
| 1717 | 1717 | ); |
| 1718 | - $objChart->setBottomRightPosition( $chartDetails[$chartPositionRef]['toCoordinate'], |
|
| 1718 | + $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], |
|
| 1719 | 1719 | $chartDetails[$chartPositionRef]['toOffsetX'], |
| 1720 | 1720 | $chartDetails[$chartPositionRef]['toOffsetY'] |
| 1721 | 1721 | ); |
@@ -1732,14 +1732,14 @@ discard block |
||
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | |
| 1735 | - private static function _readColor($color, $background=false) { |
|
| 1735 | + private static function _readColor($color, $background = false) { |
|
| 1736 | 1736 | if (isset($color["rgb"])) { |
| 1737 | - return (string)$color["rgb"]; |
|
| 1737 | + return (string) $color["rgb"]; |
|
| 1738 | 1738 | } else if (isset($color["indexed"])) { |
| 1739 | - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); |
|
| 1739 | + return PHPExcel_Style_Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
| 1740 | 1740 | } else if (isset($color["theme"])) { |
| 1741 | 1741 | if (self::$_theme !== NULL) { |
| 1742 | - $returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); |
|
| 1742 | + $returnColour = self::$_theme->getColourByIndex((int) $color["theme"]); |
|
| 1743 | 1743 | if (isset($color["tint"])) { |
| 1744 | 1744 | $tintAdjust = (float) $color["tint"]; |
| 1745 | 1745 | $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust); |
@@ -1766,24 +1766,24 @@ discard block |
||
| 1766 | 1766 | $docStyle->getFont()->setName((string) $style->font->name["val"]); |
| 1767 | 1767 | $docStyle->getFont()->setSize((string) $style->font->sz["val"]); |
| 1768 | 1768 | if (isset($style->font->b)) { |
| 1769 | - $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || $style->font->b["val"] == 'true' || $style->font->b["val"] == '1'); |
|
| 1769 | + $docStyle->getFont()->setBold( ! isset($style->font->b["val"]) || $style->font->b["val"] == 'true' || $style->font->b["val"] == '1'); |
|
| 1770 | 1770 | } |
| 1771 | 1771 | if (isset($style->font->i)) { |
| 1772 | - $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || $style->font->i["val"] == 'true' || $style->font->i["val"] == '1'); |
|
| 1772 | + $docStyle->getFont()->setItalic( ! isset($style->font->i["val"]) || $style->font->i["val"] == 'true' || $style->font->i["val"] == '1'); |
|
| 1773 | 1773 | } |
| 1774 | 1774 | if (isset($style->font->strike)) { |
| 1775 | - $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1'); |
|
| 1775 | + $docStyle->getFont()->setStrikethrough( ! isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1'); |
|
| 1776 | 1776 | } |
| 1777 | 1777 | $docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); |
| 1778 | 1778 | |
| 1779 | - if (isset($style->font->u) && !isset($style->font->u["val"])) { |
|
| 1779 | + if (isset($style->font->u) && ! isset($style->font->u["val"])) { |
|
| 1780 | 1780 | $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 1781 | 1781 | } else if (isset($style->font->u) && isset($style->font->u["val"])) { |
| 1782 | - $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); |
|
| 1782 | + $docStyle->getFont()->setUnderline((string) $style->font->u["val"]); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | if (isset($style->font->vertAlign) && isset($style->font->vertAlign["val"])) { |
| 1786 | - $vertAlign = strtolower((string)$style->font->vertAlign["val"]); |
|
| 1786 | + $vertAlign = strtolower((string) $style->font->vertAlign["val"]); |
|
| 1787 | 1787 | if ($vertAlign == 'superscript') { |
| 1788 | 1788 | $docStyle->getFont()->setSuperScript(true); |
| 1789 | 1789 | } |
@@ -1797,23 +1797,23 @@ discard block |
||
| 1797 | 1797 | if (isset($style->fill)) { |
| 1798 | 1798 | if ($style->fill->gradientFill) { |
| 1799 | 1799 | $gradientFill = $style->fill->gradientFill[0]; |
| 1800 | - if(!empty($gradientFill["type"])) { |
|
| 1800 | + if ( ! empty($gradientFill["type"])) { |
|
| 1801 | 1801 | $docStyle->getFill()->setFillType((string) $gradientFill["type"]); |
| 1802 | 1802 | } |
| 1803 | 1803 | $docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); |
| 1804 | 1804 | $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
| 1805 | - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) ); |
|
| 1806 | - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) ); |
|
| 1805 | + $docStyle->getFill()->getStartColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color)); |
|
| 1806 | + $docStyle->getFill()->getEndColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color)); |
|
| 1807 | 1807 | } elseif ($style->fill->patternFill) { |
| 1808 | - $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; |
|
| 1808 | + $patternType = (string) $style->fill->patternFill["patternType"] != '' ? (string) $style->fill->patternFill["patternType"] : 'solid'; |
|
| 1809 | 1809 | $docStyle->getFill()->setFillType($patternType); |
| 1810 | 1810 | if ($style->fill->patternFill->fgColor) { |
| 1811 | - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true)); |
|
| 1811 | + $docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor, true)); |
|
| 1812 | 1812 | } else { |
| 1813 | 1813 | $docStyle->getFill()->getStartColor()->setARGB('FF000000'); |
| 1814 | 1814 | } |
| 1815 | 1815 | if ($style->fill->patternFill->bgColor) { |
| 1816 | - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true)); |
|
| 1816 | + $docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor, true)); |
|
| 1817 | 1817 | } |
| 1818 | 1818 | } |
| 1819 | 1819 | } |
@@ -1850,22 +1850,22 @@ discard block |
||
| 1850 | 1850 | $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]); |
| 1851 | 1851 | |
| 1852 | 1852 | $textRotation = 0; |
| 1853 | - if ((int)$style->alignment["textRotation"] <= 90) { |
|
| 1854 | - $textRotation = (int)$style->alignment["textRotation"]; |
|
| 1855 | - } else if ((int)$style->alignment["textRotation"] > 90) { |
|
| 1856 | - $textRotation = 90 - (int)$style->alignment["textRotation"]; |
|
| 1853 | + if ((int) $style->alignment["textRotation"] <= 90) { |
|
| 1854 | + $textRotation = (int) $style->alignment["textRotation"]; |
|
| 1855 | + } else if ((int) $style->alignment["textRotation"] > 90) { |
|
| 1856 | + $textRotation = 90 - (int) $style->alignment["textRotation"]; |
|
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | $docStyle->getAlignment()->setTextRotation(intval($textRotation)); |
| 1860 | - $docStyle->getAlignment()->setWrapText( (string)$style->alignment["wrapText"] == "true" || (string)$style->alignment["wrapText"] == "1" ); |
|
| 1861 | - $docStyle->getAlignment()->setShrinkToFit( (string)$style->alignment["shrinkToFit"] == "true" || (string)$style->alignment["shrinkToFit"] == "1" ); |
|
| 1862 | - $docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 ); |
|
| 1860 | + $docStyle->getAlignment()->setWrapText((string) $style->alignment["wrapText"] == "true" || (string) $style->alignment["wrapText"] == "1"); |
|
| 1861 | + $docStyle->getAlignment()->setShrinkToFit((string) $style->alignment["shrinkToFit"] == "true" || (string) $style->alignment["shrinkToFit"] == "1"); |
|
| 1862 | + $docStyle->getAlignment()->setIndent(intval((string) $style->alignment["indent"]) > 0 ? intval((string) $style->alignment["indent"]) : 0); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | // protection |
| 1866 | 1866 | if (isset($style->protection)) { |
| 1867 | 1867 | if (isset($style->protection['locked'])) { |
| 1868 | - if ((string)$style->protection['locked'] == 'true') { |
|
| 1868 | + if ((string) $style->protection['locked'] == 'true') { |
|
| 1869 | 1869 | $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED); |
| 1870 | 1870 | } else { |
| 1871 | 1871 | $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | } |
| 1874 | 1874 | |
| 1875 | 1875 | if (isset($style->protection['hidden'])) { |
| 1876 | - if ((string)$style->protection['hidden'] == 'true') { |
|
| 1876 | + if ((string) $style->protection['hidden'] == 'true') { |
|
| 1877 | 1877 | $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED); |
| 1878 | 1878 | } else { |
| 1879 | 1879 | $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); |
@@ -1897,14 +1897,14 @@ discard block |
||
| 1897 | 1897 | $value = new PHPExcel_RichText(); |
| 1898 | 1898 | |
| 1899 | 1899 | if (isset($is->t)) { |
| 1900 | - $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) ); |
|
| 1900 | + $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $is->t)); |
|
| 1901 | 1901 | } else { |
| 1902 | 1902 | foreach ($is->r as $run) { |
| 1903 | - if (!isset($run->rPr)) { |
|
| 1904 | - $objText = $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); |
|
| 1903 | + if ( ! isset($run->rPr)) { |
|
| 1904 | + $objText = $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t)); |
|
| 1905 | 1905 | |
| 1906 | 1906 | } else { |
| 1907 | - $objText = $value->createTextRun( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); |
|
| 1907 | + $objText = $value->createTextRun(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t)); |
|
| 1908 | 1908 | |
| 1909 | 1909 | if (isset($run->rPr->rFont["val"])) { |
| 1910 | 1910 | $objText->getFont()->setName((string) $run->rPr->rFont["val"]); |
@@ -1915,21 +1915,21 @@ discard block |
||
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | 1917 | if (isset($run->rPr->color)) { |
| 1918 | - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) ); |
|
| 1918 | + $objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($run->rPr->color))); |
|
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | - if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
|
| 1922 | - || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1921 | + if ((isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
|
| 1922 | + || (isset($run->rPr->b) && ! isset($run->rPr->b["val"]))) { |
|
| 1923 | 1923 | $objText->getFont()->setBold(true); |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | - if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
|
| 1927 | - || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1926 | + if ((isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
|
| 1927 | + || (isset($run->rPr->i) && ! isset($run->rPr->i["val"]))) { |
|
| 1928 | 1928 | $objText->getFont()->setItalic(true); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
| 1931 | 1931 | if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { |
| 1932 | - $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); |
|
| 1932 | + $vertAlign = strtolower((string) $run->rPr->vertAlign["val"]); |
|
| 1933 | 1933 | if ($vertAlign == 'superscript') { |
| 1934 | 1934 | $objText->getFont()->setSuperScript(true); |
| 1935 | 1935 | } |
@@ -1938,14 +1938,14 @@ discard block |
||
| 1938 | 1938 | } |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | - if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { |
|
| 1941 | + if (isset($run->rPr->u) && ! isset($run->rPr->u["val"])) { |
|
| 1942 | 1942 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 1943 | 1943 | } else if (isset($run->rPr->u) && isset($run->rPr->u["val"])) { |
| 1944 | - $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); |
|
| 1944 | + $objText->getFont()->setUnderline((string) $run->rPr->u["val"]); |
|
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | - if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
|
| 1948 | - || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1947 | + if ((isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
|
| 1948 | + || (isset($run->rPr->strike) && ! isset($run->rPr->strike["val"]))) { |
|
| 1949 | 1949 | $objText->getFont()->setStrikethrough(true); |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
@@ -1962,12 +1962,12 @@ discard block |
||
| 1962 | 1962 | |
| 1963 | 1963 | |
| 1964 | 1964 | private static function dir_add($base, $add) { |
| 1965 | - return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); |
|
| 1965 | + return preg_replace('~[^/]+/\.\./~', '', dirname($base)."/$add"); |
|
| 1966 | 1966 | } |
| 1967 | 1967 | |
| 1968 | 1968 | |
| 1969 | 1969 | private static function toCSSArray($style) { |
| 1970 | - $style = str_replace(array("\r","\n"), "", $style); |
|
| 1970 | + $style = str_replace(array("\r", "\n"), "", $style); |
|
| 1971 | 1971 | |
| 1972 | 1972 | $temp = explode(';', $style); |
| 1973 | 1973 | $style = array(); |
@@ -561,10 +561,12 @@ discard block |
||
| 561 | 561 | $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); |
| 562 | 562 | if (is_object($xmlCore)) { |
| 563 | 563 | $docProps = $excel->getProperties(); |
| 564 | - if (isset($xmlCore->Company)) |
|
| 565 | - $docProps->setCompany((string) $xmlCore->Company); |
|
| 566 | - if (isset($xmlCore->Manager)) |
|
| 567 | - $docProps->setManager((string) $xmlCore->Manager); |
|
| 564 | + if (isset($xmlCore->Company)) { |
|
| 565 | + $docProps->setCompany((string) $xmlCore->Company); |
|
| 566 | + } |
|
| 567 | + if (isset($xmlCore->Manager)) { |
|
| 568 | + $docProps->setManager((string) $xmlCore->Manager); |
|
| 569 | + } |
|
| 568 | 570 | } |
| 569 | 571 | break; |
| 570 | 572 | |
@@ -1000,9 +1002,13 @@ discard block |
||
| 1000 | 1002 | |
| 1001 | 1003 | // Check for numeric values |
| 1002 | 1004 | if (is_numeric($value) && $cellDataType != 's') { |
| 1003 | - if ($value == (int)$value) $value = (int)$value; |
|
| 1004 | - elseif ($value == (float)$value) $value = (float)$value; |
|
| 1005 | - elseif ($value == (double)$value) $value = (double)$value; |
|
| 1005 | + if ($value == (int)$value) { |
|
| 1006 | + $value = (int)$value; |
|
| 1007 | + } elseif ($value == (float)$value) { |
|
| 1008 | + $value = (float)$value; |
|
| 1009 | + } elseif ($value == (double)$value) { |
|
| 1010 | + $value = (double)$value; |
|
| 1011 | + } |
|
| 1006 | 1012 | } |
| 1007 | 1013 | |
| 1008 | 1014 | // Rich text? |
@@ -1320,10 +1326,14 @@ discard block |
||
| 1320 | 1326 | |
| 1321 | 1327 | if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
| 1322 | 1328 | $temp = $clientData->xpath('.//x:Row'); |
| 1323 | - if (is_array($temp)) $row = $temp[0]; |
|
| 1329 | + if (is_array($temp)) { |
|
| 1330 | + $row = $temp[0]; |
|
| 1331 | + } |
|
| 1324 | 1332 | |
| 1325 | 1333 | $temp = $clientData->xpath('.//x:Column'); |
| 1326 | - if (is_array($temp)) $column = $temp[0]; |
|
| 1334 | + if (is_array($temp)) { |
|
| 1335 | + $column = $temp[0]; |
|
| 1336 | + } |
|
| 1327 | 1337 | } |
| 1328 | 1338 | } |
| 1329 | 1339 | |
@@ -1337,11 +1347,21 @@ discard block |
||
| 1337 | 1347 | foreach ($styleArray as $stylePair) { |
| 1338 | 1348 | $stylePair = explode(':', $stylePair); |
| 1339 | 1349 | |
| 1340 | - if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | - if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | - if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | - if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1350 | + if ($stylePair[0] == 'margin-left') { |
|
| 1351 | + $comment->setMarginLeft($stylePair[1]); |
|
| 1352 | + } |
|
| 1353 | + if ($stylePair[0] == 'margin-top') { |
|
| 1354 | + $comment->setMarginTop($stylePair[1]); |
|
| 1355 | + } |
|
| 1356 | + if ($stylePair[0] == 'width') { |
|
| 1357 | + $comment->setWidth($stylePair[1]); |
|
| 1358 | + } |
|
| 1359 | + if ($stylePair[0] == 'height') { |
|
| 1360 | + $comment->setHeight($stylePair[1]); |
|
| 1361 | + } |
|
| 1362 | + if ($stylePair[0] == 'visibility') { |
|
| 1363 | + $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1364 | + } |
|
| 1345 | 1365 | |
| 1346 | 1366 | } |
| 1347 | 1367 | } |
@@ -34,6 +34,10 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class PHPExcel_Reader_Excel2007_Chart |
| 36 | 36 | { |
| 37 | + /** |
|
| 38 | + * @param string $name |
|
| 39 | + * @param string $format |
|
| 40 | + */ |
|
| 37 | 41 | private static function _getAttribute($component, $name, $format) { |
| 38 | 42 | $attributes = $component->attributes(); |
| 39 | 43 | if (isset($attributes[$name])) { |
@@ -60,6 +64,10 @@ discard block |
||
| 60 | 64 | } |
| 61 | 65 | |
| 62 | 66 | |
| 67 | + /** |
|
| 68 | + * @param SimpleXMLElement $chartElements |
|
| 69 | + * @param string $chartName |
|
| 70 | + */ |
|
| 63 | 71 | public static function readChart($chartElements,$chartName) { |
| 64 | 72 | $namespacesChartMeta = $chartElements->getNamespaces(true); |
| 65 | 73 | $chartElementsC = $chartElements->children($namespacesChartMeta['c']); |
@@ -188,6 +196,9 @@ discard block |
||
| 188 | 196 | } // function readChart() |
| 189 | 197 | |
| 190 | 198 | |
| 199 | + /** |
|
| 200 | + * @param string $type |
|
| 201 | + */ |
|
| 191 | 202 | private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) { |
| 192 | 203 | $caption = array(); |
| 193 | 204 | $titleLayout = null; |
@@ -51,104 +51,104 @@ discard block |
||
| 51 | 51 | } // function _getAttribute() |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - private static function _readColor($color,$background=false) { |
|
| 54 | + private static function _readColor($color, $background = false) { |
|
| 55 | 55 | if (isset($color["rgb"])) { |
| 56 | - return (string)$color["rgb"]; |
|
| 56 | + return (string) $color["rgb"]; |
|
| 57 | 57 | } else if (isset($color["indexed"])) { |
| 58 | - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); |
|
| 58 | + return PHPExcel_Style_Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - public static function readChart($chartElements,$chartName) { |
|
| 63 | + public static function readChart($chartElements, $chartName) { |
|
| 64 | 64 | $namespacesChartMeta = $chartElements->getNamespaces(true); |
| 65 | 65 | $chartElementsC = $chartElements->children($namespacesChartMeta['c']); |
| 66 | 66 | |
| 67 | 67 | $XaxisLabel = $YaxisLabel = $legend = $title = null; |
| 68 | 68 | |
| 69 | - foreach($chartElementsC as $chartElementKey => $chartElement) { |
|
| 69 | + foreach ($chartElementsC as $chartElementKey => $chartElement) { |
|
| 70 | 70 | switch ($chartElementKey) { |
| 71 | 71 | case "chart": |
| 72 | - foreach($chartElement as $chartDetailsKey => $chartDetails) { |
|
| 72 | + foreach ($chartElement as $chartDetailsKey => $chartDetails) { |
|
| 73 | 73 | $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']); |
| 74 | 74 | switch ($chartDetailsKey) { |
| 75 | 75 | case "plotArea": |
| 76 | 76 | $plotAreaLayout = $XaxisLable = $YaxisLable = null; |
| 77 | 77 | $plotSeries = array(); |
| 78 | - foreach($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 78 | + foreach ($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 79 | 79 | switch ($chartDetailKey) { |
| 80 | 80 | case "layout": |
| 81 | - $plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea'); |
|
| 81 | + $plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea'); |
|
| 82 | 82 | break; |
| 83 | 83 | case "catAx": |
| 84 | 84 | if (isset($chartDetail->title)) { |
| 85 | - $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 85 | + $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 86 | 86 | } |
| 87 | 87 | break; |
| 88 | 88 | case "dateAx": |
| 89 | 89 | if (isset($chartDetail->title)) { |
| 90 | - $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 90 | + $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 91 | 91 | } |
| 92 | 92 | break; |
| 93 | 93 | case "valAx": |
| 94 | 94 | if (isset($chartDetail->title)) { |
| 95 | - $YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 95 | + $YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 96 | 96 | } |
| 97 | 97 | break; |
| 98 | 98 | case "barChart": |
| 99 | 99 | case "bar3DChart": |
| 100 | 100 | $barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string'); |
| 101 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 101 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 102 | 102 | $plotSer->setPlotDirection($barDirection); |
| 103 | 103 | $plotSeries[] = $plotSer; |
| 104 | 104 | break; |
| 105 | 105 | case "lineChart": |
| 106 | 106 | case "line3DChart": |
| 107 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 107 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 108 | 108 | break; |
| 109 | 109 | case "areaChart": |
| 110 | 110 | case "area3DChart": |
| 111 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 111 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 112 | 112 | break; |
| 113 | 113 | case "doughnutChart": |
| 114 | 114 | case "pieChart": |
| 115 | 115 | case "pie3DChart": |
| 116 | 116 | $explosion = isset($chartDetail->ser->explosion); |
| 117 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 117 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 118 | 118 | $plotSer->setPlotStyle($explosion); |
| 119 | 119 | $plotSeries[] = $plotSer; |
| 120 | 120 | break; |
| 121 | 121 | case "scatterChart": |
| 122 | 122 | $scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string'); |
| 123 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 123 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 124 | 124 | $plotSer->setPlotStyle($scatterStyle); |
| 125 | 125 | $plotSeries[] = $plotSer; |
| 126 | 126 | break; |
| 127 | 127 | case "bubbleChart": |
| 128 | 128 | $bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer'); |
| 129 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 129 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 130 | 130 | $plotSer->setPlotStyle($bubbleScale); |
| 131 | 131 | $plotSeries[] = $plotSer; |
| 132 | 132 | break; |
| 133 | 133 | case "radarChart": |
| 134 | 134 | $radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string'); |
| 135 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 135 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 136 | 136 | $plotSer->setPlotStyle($radarStyle); |
| 137 | 137 | $plotSeries[] = $plotSer; |
| 138 | 138 | break; |
| 139 | 139 | case "surfaceChart": |
| 140 | 140 | case "surface3DChart": |
| 141 | 141 | $wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean'); |
| 142 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 142 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 143 | 143 | $plotSer->setPlotStyle($wireFrame); |
| 144 | 144 | $plotSeries[] = $plotSer; |
| 145 | 145 | break; |
| 146 | 146 | case "stockChart": |
| 147 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 147 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | - $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries); |
|
| 151 | + $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); |
|
| 152 | 152 | break; |
| 153 | 153 | case "plotVisOnly": |
| 154 | 154 | $plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string'); |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | $dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); |
| 158 | 158 | break; |
| 159 | 159 | case "title": |
| 160 | - $title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title'); |
|
| 160 | + $title = self::_chartTitle($chartDetails, $namespacesChartMeta, 'title'); |
|
| 161 | 161 | break; |
| 162 | 162 | case "legend": |
| 163 | 163 | $legendPos = 'r'; |
| 164 | 164 | $legendLayout = null; |
| 165 | 165 | $legendOverlay = false; |
| 166 | - foreach($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 166 | + foreach ($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 167 | 167 | switch ($chartDetailKey) { |
| 168 | 168 | case "legendPos": |
| 169 | 169 | $legendPos = self::_getAttribute($chartDetail, 'val', 'string'); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); |
| 173 | 173 | break; |
| 174 | 174 | case "layout": |
| 175 | - $legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend'); |
|
| 175 | + $legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend'); |
|
| 176 | 176 | break; |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -182,20 +182,20 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | - $chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel); |
|
| 185 | + $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); |
|
| 186 | 186 | |
| 187 | 187 | return $chart; |
| 188 | 188 | } // function readChart() |
| 189 | 189 | |
| 190 | 190 | |
| 191 | - private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) { |
|
| 191 | + private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) { |
|
| 192 | 192 | $caption = array(); |
| 193 | 193 | $titleLayout = null; |
| 194 | - foreach($titleDetails as $titleDetailKey => $chartDetail) { |
|
| 194 | + foreach ($titleDetails as $titleDetailKey => $chartDetail) { |
|
| 195 | 195 | switch ($titleDetailKey) { |
| 196 | 196 | case "tx": |
| 197 | 197 | $titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']); |
| 198 | - foreach($titleDetails as $titleKey => $titleDetail) { |
|
| 198 | + foreach ($titleDetails as $titleKey => $titleDetail) { |
|
| 199 | 199 | switch ($titleKey) { |
| 200 | 200 | case "p": |
| 201 | 201 | $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | break; |
| 206 | 206 | case "layout": |
| 207 | - $titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta); |
|
| 207 | + $titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta); |
|
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | } // function _chartTitle() |
| 214 | 214 | |
| 215 | 215 | |
| 216 | - private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) { |
|
| 217 | - if (!isset($chartDetail->manualLayout)) { |
|
| 216 | + private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) { |
|
| 217 | + if ( ! isset($chartDetail->manualLayout)) { |
|
| 218 | 218 | return null; |
| 219 | 219 | } |
| 220 | 220 | $details = $chartDetail->manualLayout->children($namespacesChartMeta['c']); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | return null; |
| 223 | 223 | } |
| 224 | 224 | $layout = array(); |
| 225 | - foreach($details as $detailKey => $detail) { |
|
| 225 | + foreach ($details as $detailKey => $detail) { |
|
| 226 | 226 | // echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),'<br />'; |
| 227 | 227 | $layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); |
| 228 | 228 | } |
@@ -230,20 +230,20 @@ discard block |
||
| 230 | 230 | } // function _chartLayoutDetails() |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) { |
|
| 233 | + private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) { |
|
| 234 | 234 | $multiSeriesType = NULL; |
| 235 | 235 | $smoothLine = false; |
| 236 | 236 | $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array(); |
| 237 | 237 | |
| 238 | 238 | $seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']); |
| 239 | - foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) { |
|
| 239 | + foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { |
|
| 240 | 240 | switch ($seriesDetailKey) { |
| 241 | 241 | case "grouping": |
| 242 | 242 | $multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string'); |
| 243 | 243 | break; |
| 244 | 244 | case "ser": |
| 245 | 245 | $marker = NULL; |
| 246 | - foreach($seriesDetails as $seriesKey => $seriesDetail) { |
|
| 246 | + foreach ($seriesDetails as $seriesKey => $seriesDetail) { |
|
| 247 | 247 | switch ($seriesKey) { |
| 248 | 248 | case "idx": |
| 249 | 249 | $seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer'); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $plotOrder[$seriesIndex] = $seriesOrder; |
| 254 | 254 | break; |
| 255 | 255 | case "tx": |
| 256 | - $seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta); |
|
| 256 | + $seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); |
|
| 257 | 257 | break; |
| 258 | 258 | case "marker": |
| 259 | 259 | $marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string'); |
@@ -262,59 +262,59 @@ discard block |
||
| 262 | 262 | $smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean'); |
| 263 | 263 | break; |
| 264 | 264 | case "cat": |
| 265 | - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta); |
|
| 265 | + $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); |
|
| 266 | 266 | break; |
| 267 | 267 | case "val": |
| 268 | - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 268 | + $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 269 | 269 | break; |
| 270 | 270 | case "xVal": |
| 271 | - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 271 | + $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 272 | 272 | break; |
| 273 | 273 | case "yVal": |
| 274 | - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 274 | + $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine); |
|
| 280 | + return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); |
|
| 281 | 281 | } // function _chartDataSeries() |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) { |
| 285 | 285 | if (isset($seriesDetail->strRef)) { |
| 286 | 286 | $seriesSource = (string) $seriesDetail->strRef->f; |
| 287 | - $seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s'); |
|
| 287 | + $seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's'); |
|
| 288 | 288 | |
| 289 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 289 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 290 | 290 | } elseif (isset($seriesDetail->numRef)) { |
| 291 | 291 | $seriesSource = (string) $seriesDetail->numRef->f; |
| 292 | 292 | $seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); |
| 293 | 293 | |
| 294 | - return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 294 | + return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 295 | 295 | } elseif (isset($seriesDetail->multiLvlStrRef)) { |
| 296 | 296 | $seriesSource = (string) $seriesDetail->multiLvlStrRef->f; |
| 297 | - $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s'); |
|
| 297 | + $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's'); |
|
| 298 | 298 | $seriesData['pointCount'] = count($seriesData['dataValues']); |
| 299 | 299 | |
| 300 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 300 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 301 | 301 | } elseif (isset($seriesDetail->multiLvlNumRef)) { |
| 302 | 302 | $seriesSource = (string) $seriesDetail->multiLvlNumRef->f; |
| 303 | - $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s'); |
|
| 303 | + $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's'); |
|
| 304 | 304 | $seriesData['pointCount'] = count($seriesData['dataValues']); |
| 305 | 305 | |
| 306 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 306 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 307 | 307 | } |
| 308 | 308 | return null; |
| 309 | 309 | } // function _chartDataSeriesValueSet() |
| 310 | 310 | |
| 311 | 311 | |
| 312 | - private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') { |
|
| 312 | + private static function _chartDataSeriesValues($seriesValueSet, $dataType = 'n') { |
|
| 313 | 313 | $seriesVal = array(); |
| 314 | 314 | $formatCode = ''; |
| 315 | 315 | $pointCount = 0; |
| 316 | 316 | |
| 317 | - foreach($seriesValueSet as $seriesValueIdx => $seriesValue) { |
|
| 317 | + foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { |
|
| 318 | 318 | switch ($seriesValueIdx) { |
| 319 | 319 | case 'ptCount': |
| 320 | 320 | $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); |
@@ -333,20 +333,20 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return array( 'formatCode' => $formatCode, |
|
| 336 | + return array('formatCode' => $formatCode, |
|
| 337 | 337 | 'pointCount' => $pointCount, |
| 338 | 338 | 'dataValues' => $seriesVal |
| 339 | 339 | ); |
| 340 | 340 | } // function _chartDataSeriesValues() |
| 341 | 341 | |
| 342 | 342 | |
| 343 | - private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') { |
|
| 343 | + private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n') { |
|
| 344 | 344 | $seriesVal = array(); |
| 345 | 345 | $formatCode = ''; |
| 346 | 346 | $pointCount = 0; |
| 347 | 347 | |
| 348 | - foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) { |
|
| 349 | - foreach($seriesLevel as $seriesValueIdx => $seriesValue) { |
|
| 348 | + foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) { |
|
| 349 | + foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { |
|
| 350 | 350 | switch ($seriesValueIdx) { |
| 351 | 351 | case 'ptCount': |
| 352 | 352 | $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - return array( 'formatCode' => $formatCode, |
|
| 369 | + return array('formatCode' => $formatCode, |
|
| 370 | 370 | 'pointCount' => $pointCount, |
| 371 | 371 | 'dataValues' => $seriesVal |
| 372 | 372 | ); |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | private static function _parseRichText($titleDetailPart = null) { |
| 376 | 376 | $value = new PHPExcel_RichText(); |
| 377 | 377 | |
| 378 | - foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { |
|
| 378 | + foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { |
|
| 379 | 379 | if (isset($titleDetailElement->t)) { |
| 380 | - $objText = $value->createTextRun( (string) $titleDetailElement->t ); |
|
| 380 | + $objText = $value->createTextRun((string) $titleDetailElement->t); |
|
| 381 | 381 | } |
| 382 | 382 | if (isset($titleDetailElement->rPr)) { |
| 383 | 383 | if (isset($titleDetailElement->rPr->rFont["val"])) { |
@@ -385,39 +385,39 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer')); |
| 388 | - if (!is_null($fontSize)) { |
|
| 388 | + if ( ! is_null($fontSize)) { |
|
| 389 | 389 | $objText->getFont()->setSize(floor($fontSize / 100)); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); |
| 393 | - if (!is_null($fontColor)) { |
|
| 394 | - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) ); |
|
| 393 | + if ( ! is_null($fontColor)) { |
|
| 394 | + $objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($fontColor))); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean'); |
| 398 | - if (!is_null($bold)) { |
|
| 398 | + if ( ! is_null($bold)) { |
|
| 399 | 399 | $objText->getFont()->setBold($bold); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean'); |
| 403 | - if (!is_null($italic)) { |
|
| 403 | + if ( ! is_null($italic)) { |
|
| 404 | 404 | $objText->getFont()->setItalic($italic); |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | $baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); |
| 408 | - if (!is_null($baseline)) { |
|
| 408 | + if ( ! is_null($baseline)) { |
|
| 409 | 409 | if ($baseline > 0) { |
| 410 | 410 | $objText->getFont()->setSuperScript(true); |
| 411 | - } elseif($baseline < 0) { |
|
| 411 | + } elseif ($baseline < 0) { |
|
| 412 | 412 | $objText->getFont()->setSubScript(true); |
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | $underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string')); |
| 417 | - if (!is_null($underscore)) { |
|
| 417 | + if ( ! is_null($underscore)) { |
|
| 418 | 418 | if ($underscore == 'sng') { |
| 419 | 419 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 420 | - } elseif($underscore == 'dbl') { |
|
| 420 | + } elseif ($underscore == 'dbl') { |
|
| 421 | 421 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); |
| 422 | 422 | } else { |
| 423 | 423 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string')); |
| 428 | - if (!is_null($strikethrough)) { |
|
| 428 | + if ( ! is_null($strikethrough)) { |
|
| 429 | 429 | if ($strikethrough == 'noStrike') { |
| 430 | 430 | $objText->getFont()->setStrikethrough(false); |
| 431 | 431 | } else { |