@@ -198,7 +198,9 @@ discard block |
||
198 | 198 | * @param int &$str_unique Total number of unique strings |
199 | 199 | * @param array &$str_table String Table |
200 | 200 | * @param array &$colors Colour Table |
201 | - * @param mixed $parser The formula parser created for the Workbook |
|
201 | + * @param PHPExcel_Writer_Excel5_Parser $parser The formula parser created for the Workbook |
|
202 | + * @param integer $str_total |
|
203 | + * @param integer $str_unique |
|
202 | 204 | */ |
203 | 205 | public function __construct(PHPExcel $phpExcel = null, |
204 | 206 | &$str_total, &$str_unique, &$str_table, &$colors, |
@@ -248,6 +250,7 @@ discard block |
||
248 | 250 | * |
249 | 251 | * @param PHPExcel_Style |
250 | 252 | * @param boolean Is it a style XF? |
253 | + * @param PHPExcel_Style $style |
|
251 | 254 | * @return int Index to XF record |
252 | 255 | */ |
253 | 256 | public function addXfWriter($style, $isStyleXf = false) |
@@ -788,7 +791,7 @@ discard block |
||
788 | 791 | * |
789 | 792 | * @param string $name The name in UTF-8 |
790 | 793 | * @param string $formulaData The binary formula data |
791 | - * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global |
|
794 | + * @param integer $sheetIndex 1-based sheet index the defined name applies to. 0 = global |
|
792 | 795 | * @param boolean $isBuiltIn Built-in name? |
793 | 796 | * @return string Complete binary record data |
794 | 797 | */ |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function __construct(PHPExcel $phpExcel = null, |
204 | 204 | &$str_total, &$str_unique, &$str_table, &$colors, |
205 | - $parser ) |
|
205 | + $parser) |
|
206 | 206 | { |
207 | 207 | // It needs to call its parent's constructor explicitly |
208 | 208 | parent::__construct(); |
@@ -229,11 +229,11 @@ discard block |
||
229 | 229 | for ($i = 0; $i < $countSheets; ++$i) { |
230 | 230 | $phpSheet = $phpExcel->getSheet($i); |
231 | 231 | |
232 | - $this->_parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser |
|
232 | + $this->_parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser |
|
233 | 233 | |
234 | 234 | $supbook_index = 0x00; |
235 | 235 | $ref = pack('vvv', $supbook_index, $i, $i); |
236 | - $this->_parser->_references[] = $ref; // Register reference with parser |
|
236 | + $this->_parser->_references[] = $ref; // Register reference with parser |
|
237 | 237 | |
238 | 238 | // Sheet tab colors? |
239 | 239 | if ($phpSheet->isTabColorSet()) { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | public function _addFont(PHPExcel_Style_Font $font) |
304 | 304 | { |
305 | 305 | $fontHashCode = $font->getHashCode(); |
306 | - if(isset($this->_addedFonts[$fontHashCode])){ |
|
306 | + if (isset($this->_addedFonts[$fontHashCode])) { |
|
307 | 307 | $fontIndex = $this->_addedFonts[$fontHashCode]; |
308 | 308 | } else { |
309 | 309 | $countFonts = count($this->_fontWriters); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return int Color index |
325 | 325 | */ |
326 | 326 | private function _addColor($rgb) { |
327 | - if (!isset($this->_colors[$rgb])) { |
|
327 | + if ( ! isset($this->_colors[$rgb])) { |
|
328 | 328 | if (count($this->_colors) < 57) { |
329 | 329 | // then we add a custom color altering the palette |
330 | 330 | $colorIndex = 8 + count($this->_colors); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | */ |
479 | 479 | function _calcSheetOffsets() |
480 | 480 | { |
481 | - $boundsheet_length = 10; // fixed length for a BOUNDSHEET record |
|
481 | + $boundsheet_length = 10; // fixed length for a BOUNDSHEET record |
|
482 | 482 | |
483 | 483 | // size of Workbook globals part 1 + 3 |
484 | 484 | $offset = $this->_datasize; |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | // Create absolute coordinate |
662 | 662 | $range = PHPExcel_Cell::splitRange($namedRange->getRange()); |
663 | 663 | for ($i = 0; $i < count($range); $i++) { |
664 | - $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]); |
|
664 | + $range[$i][0] = '\''.str_replace("'", "''", $namedRange->getWorksheet()->getTitle()).'\'!'.PHPExcel_Cell::absoluteCoordinate($range[$i][0]); |
|
665 | 665 | if (isset($range[$i][1])) { |
666 | 666 | $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]); |
667 | 667 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | |
676 | 676 | // make sure tRef3d is of type tRef3dR (0x3A) |
677 | 677 | if (isset($formulaData{0}) and ($formulaData{0} == "\x7A" or $formulaData{0} == "\x5A")) { |
678 | - $formulaData = "\x3A" . substr($formulaData, 1); |
|
678 | + $formulaData = "\x3A".substr($formulaData, 1); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | if ($namedRange->getLocalOnly()) { |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | $chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false)); |
689 | 689 | |
690 | - } catch(Exception $e) { |
|
690 | + } catch (Exception $e) { |
|
691 | 691 | // do nothing |
692 | 692 | } |
693 | 693 | } |
@@ -810,12 +810,12 @@ discard block |
||
810 | 810 | |
811 | 811 | // combine the parts |
812 | 812 | $data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0) |
813 | - . $name . $formulaData; |
|
813 | + . $name.$formulaData; |
|
814 | 814 | $length = strlen($data); |
815 | 815 | |
816 | 816 | $header = pack('vv', $record, $length); |
817 | 817 | |
818 | - return $header . $data; |
|
818 | + return $header.$data; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | /** |
@@ -823,14 +823,14 @@ discard block |
||
823 | 823 | */ |
824 | 824 | private function _writeCodepage() |
825 | 825 | { |
826 | - $record = 0x0042; // Record identifier |
|
827 | - $length = 0x0002; // Number of bytes to follow |
|
828 | - $cv = $this->_codepage; // The code page |
|
826 | + $record = 0x0042; // Record identifier |
|
827 | + $length = 0x0002; // Number of bytes to follow |
|
828 | + $cv = $this->_codepage; // The code page |
|
829 | 829 | |
830 | 830 | $header = pack('vv', $record, $length); |
831 | - $data = pack('v', $cv); |
|
831 | + $data = pack('v', $cv); |
|
832 | 832 | |
833 | - $this->_append($header . $data); |
|
833 | + $this->_append($header.$data); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | /** |
@@ -838,31 +838,31 @@ discard block |
||
838 | 838 | */ |
839 | 839 | private function _writeWindow1() |
840 | 840 | { |
841 | - $record = 0x003D; // Record identifier |
|
842 | - $length = 0x0012; // Number of bytes to follow |
|
841 | + $record = 0x003D; // Record identifier |
|
842 | + $length = 0x0012; // Number of bytes to follow |
|
843 | 843 | |
844 | - $xWn = 0x0000; // Horizontal position of window |
|
845 | - $yWn = 0x0000; // Vertical position of window |
|
846 | - $dxWn = 0x25BC; // Width of window |
|
847 | - $dyWn = 0x1572; // Height of window |
|
844 | + $xWn = 0x0000; // Horizontal position of window |
|
845 | + $yWn = 0x0000; // Vertical position of window |
|
846 | + $dxWn = 0x25BC; // Width of window |
|
847 | + $dyWn = 0x1572; // Height of window |
|
848 | 848 | |
849 | - $grbit = 0x0038; // Option flags |
|
849 | + $grbit = 0x0038; // Option flags |
|
850 | 850 | |
851 | 851 | // not supported by PHPExcel, so there is only one selected sheet, the active |
852 | - $ctabsel = 1; // Number of workbook tabs selected |
|
852 | + $ctabsel = 1; // Number of workbook tabs selected |
|
853 | 853 | |
854 | - $wTabRatio = 0x0258; // Tab to scrollbar ratio |
|
854 | + $wTabRatio = 0x0258; // Tab to scrollbar ratio |
|
855 | 855 | |
856 | 856 | // not supported by PHPExcel, set to 0 |
857 | - $itabFirst = 0; // 1st displayed worksheet |
|
858 | - $itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet |
|
857 | + $itabFirst = 0; // 1st displayed worksheet |
|
858 | + $itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet |
|
859 | 859 | |
860 | - $header = pack("vv", $record, $length); |
|
860 | + $header = pack("vv", $record, $length); |
|
861 | 861 | $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, |
862 | 862 | $grbit, |
863 | 863 | $itabCur, $itabFirst, |
864 | 864 | $ctabsel, $wTabRatio); |
865 | - $this->_append($header . $data); |
|
865 | + $this->_append($header.$data); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | private function _writeBoundsheet($sheet, $offset) |
875 | 875 | { |
876 | 876 | $sheetname = $sheet->getTitle(); |
877 | - $record = 0x0085; // Record identifier |
|
877 | + $record = 0x0085; // Record identifier |
|
878 | 878 | |
879 | 879 | // sheet state |
880 | 880 | switch ($sheet->getSheetState()) { |
@@ -887,14 +887,14 @@ discard block |
||
887 | 887 | // sheet type |
888 | 888 | $st = 0x00; |
889 | 889 | |
890 | - $grbit = 0x0000; // Visibility and sheet type |
|
890 | + $grbit = 0x0000; // Visibility and sheet type |
|
891 | 891 | |
892 | 892 | $data = pack("VCC", $offset, $ss, $st); |
893 | 893 | $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname); |
894 | 894 | |
895 | 895 | $length = strlen($data); |
896 | - $header = pack("vv", $record, $length); |
|
897 | - $this->_append($header . $data); |
|
896 | + $header = pack("vv", $record, $length); |
|
897 | + $this->_append($header.$data); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | /** |
@@ -902,12 +902,12 @@ discard block |
||
902 | 902 | */ |
903 | 903 | private function _writeSupbookInternal() |
904 | 904 | { |
905 | - $record = 0x01AE; // Record identifier |
|
906 | - $length = 0x0004; // Bytes to follow |
|
905 | + $record = 0x01AE; // Record identifier |
|
906 | + $length = 0x0004; // Bytes to follow |
|
907 | 907 | |
908 | 908 | $header = pack("vv", $record, $length); |
909 | 909 | $data = pack("vv", $this->_phpExcel->getSheetCount(), 0x0401); |
910 | - return $this->writeData($header . $data); |
|
910 | + return $this->writeData($header.$data); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -918,16 +918,16 @@ discard block |
||
918 | 918 | private function _writeExternsheetBiff8() |
919 | 919 | { |
920 | 920 | $total_references = count($this->_parser->_references); |
921 | - $record = 0x0017; // Record identifier |
|
922 | - $length = 2 + 6 * $total_references; // Number of bytes to follow |
|
921 | + $record = 0x0017; // Record identifier |
|
922 | + $length = 2 + 6 * $total_references; // Number of bytes to follow |
|
923 | 923 | |
924 | - $supbook_index = 0; // FIXME: only using internal SUPBOOK record |
|
925 | - $header = pack("vv", $record, $length); |
|
924 | + $supbook_index = 0; // FIXME: only using internal SUPBOOK record |
|
925 | + $header = pack("vv", $record, $length); |
|
926 | 926 | $data = pack('v', $total_references); |
927 | 927 | for ($i = 0; $i < $total_references; ++$i) { |
928 | 928 | $data .= $this->_parser->_references[$i]; |
929 | 929 | } |
930 | - return $this->writeData($header . $data); |
|
930 | + return $this->writeData($header.$data); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | /** |
@@ -935,16 +935,16 @@ discard block |
||
935 | 935 | */ |
936 | 936 | private function _writeStyle() |
937 | 937 | { |
938 | - $record = 0x0293; // Record identifier |
|
939 | - $length = 0x0004; // Bytes to follow |
|
938 | + $record = 0x0293; // Record identifier |
|
939 | + $length = 0x0004; // Bytes to follow |
|
940 | 940 | |
941 | - $ixfe = 0x8000; // Index to cell style XF |
|
942 | - $BuiltIn = 0x00; // Built-in style |
|
943 | - $iLevel = 0xff; // Outline style level |
|
941 | + $ixfe = 0x8000; // Index to cell style XF |
|
942 | + $BuiltIn = 0x00; // Built-in style |
|
943 | + $iLevel = 0xff; // Outline style level |
|
944 | 944 | |
945 | - $header = pack("vv", $record, $length); |
|
945 | + $header = pack("vv", $record, $length); |
|
946 | 946 | $data = pack("vCC", $ixfe, $BuiltIn, $iLevel); |
947 | - $this->_append($header . $data); |
|
947 | + $this->_append($header.$data); |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
@@ -955,15 +955,15 @@ discard block |
||
955 | 955 | */ |
956 | 956 | private function _writeNumFormat($format, $ifmt) |
957 | 957 | { |
958 | - $record = 0x041E; // Record identifier |
|
958 | + $record = 0x041E; // Record identifier |
|
959 | 959 | |
960 | 960 | $numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format); |
961 | - $length = 2 + strlen($numberFormatString); // Number of bytes to follow |
|
961 | + $length = 2 + strlen($numberFormatString); // Number of bytes to follow |
|
962 | 962 | |
963 | 963 | |
964 | 964 | $header = pack("vv", $record, $length); |
965 | - $data = pack("v", $ifmt) . $numberFormatString; |
|
966 | - $this->_append($header . $data); |
|
965 | + $data = pack("v", $ifmt).$numberFormatString; |
|
966 | + $this->_append($header.$data); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | /** |
@@ -971,15 +971,15 @@ discard block |
||
971 | 971 | */ |
972 | 972 | private function _writeDatemode() |
973 | 973 | { |
974 | - $record = 0x0022; // Record identifier |
|
975 | - $length = 0x0002; // Bytes to follow |
|
974 | + $record = 0x0022; // Record identifier |
|
975 | + $length = 0x0002; // Bytes to follow |
|
976 | 976 | |
977 | 977 | $f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) ? |
978 | - 1 : 0; // Flag for 1904 date system |
|
978 | + 1 : 0; // Flag for 1904 date system |
|
979 | 979 | |
980 | 980 | $header = pack("vv", $record, $length); |
981 | 981 | $data = pack("v", $f1904); |
982 | - $this->_append($header . $data); |
|
982 | + $this->_append($header.$data); |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | /** |
@@ -996,12 +996,12 @@ discard block |
||
996 | 996 | */ |
997 | 997 | private function _writeExterncount($cxals) |
998 | 998 | { |
999 | - $record = 0x0016; // Record identifier |
|
1000 | - $length = 0x0002; // Number of bytes to follow |
|
999 | + $record = 0x0016; // Record identifier |
|
1000 | + $length = 0x0002; // Number of bytes to follow |
|
1001 | 1001 | |
1002 | 1002 | $header = pack("vv", $record, $length); |
1003 | - $data = pack("v", $cxals); |
|
1004 | - $this->_append($header . $data); |
|
1003 | + $data = pack("v", $cxals); |
|
1004 | + $this->_append($header.$data); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | /** |
@@ -1015,15 +1015,15 @@ discard block |
||
1015 | 1015 | */ |
1016 | 1016 | private function _writeExternsheet($sheetname) |
1017 | 1017 | { |
1018 | - $record = 0x0017; // Record identifier |
|
1019 | - $length = 0x02 + strlen($sheetname); // Number of bytes to follow |
|
1018 | + $record = 0x0017; // Record identifier |
|
1019 | + $length = 0x02 + strlen($sheetname); // Number of bytes to follow |
|
1020 | 1020 | |
1021 | - $cch = strlen($sheetname); // Length of sheet name |
|
1022 | - $rgch = 0x03; // Filename encoding |
|
1021 | + $cch = strlen($sheetname); // Length of sheet name |
|
1022 | + $rgch = 0x03; // Filename encoding |
|
1023 | 1023 | |
1024 | - $header = pack("vv", $record, $length); |
|
1024 | + $header = pack("vv", $record, $length); |
|
1025 | 1025 | $data = pack("CC", $cch, $rgch); |
1026 | - $this->_append($header . $data . $sheetname); |
|
1026 | + $this->_append($header.$data.$sheetname); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | /** |
@@ -1039,23 +1039,23 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | private function _writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax) |
1041 | 1041 | { |
1042 | - $record = 0x0018; // Record identifier |
|
1043 | - $length = 0x0024; // Number of bytes to follow |
|
1044 | - |
|
1045 | - $grbit = 0x0020; // Option flags |
|
1046 | - $chKey = 0x00; // Keyboard shortcut |
|
1047 | - $cch = 0x01; // Length of text name |
|
1048 | - $cce = 0x0015; // Length of text definition |
|
1049 | - $ixals = $index + 1; // Sheet index |
|
1050 | - $itab = $ixals; // Equal to ixals |
|
1051 | - $cchCustMenu = 0x00; // Length of cust menu text |
|
1052 | - $cchDescription = 0x00; // Length of description text |
|
1053 | - $cchHelptopic = 0x00; // Length of help topic text |
|
1054 | - $cchStatustext = 0x00; // Length of status bar text |
|
1055 | - $rgch = $type; // Built-in name type |
|
1042 | + $record = 0x0018; // Record identifier |
|
1043 | + $length = 0x0024; // Number of bytes to follow |
|
1044 | + |
|
1045 | + $grbit = 0x0020; // Option flags |
|
1046 | + $chKey = 0x00; // Keyboard shortcut |
|
1047 | + $cch = 0x01; // Length of text name |
|
1048 | + $cce = 0x0015; // Length of text definition |
|
1049 | + $ixals = $index + 1; // Sheet index |
|
1050 | + $itab = $ixals; // Equal to ixals |
|
1051 | + $cchCustMenu = 0x00; // Length of cust menu text |
|
1052 | + $cchDescription = 0x00; // Length of description text |
|
1053 | + $cchHelptopic = 0x00; // Length of help topic text |
|
1054 | + $cchStatustext = 0x00; // Length of status bar text |
|
1055 | + $rgch = $type; // Built-in name type |
|
1056 | 1056 | |
1057 | 1057 | $unknown03 = 0x3b; |
1058 | - $unknown04 = 0xffff-$index; |
|
1058 | + $unknown04 = 0xffff - $index; |
|
1059 | 1059 | $unknown05 = 0x0000; |
1060 | 1060 | $unknown06 = 0x0000; |
1061 | 1061 | $unknown07 = 0x1087; |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | $data .= pack("v", $rowmax); |
1086 | 1086 | $data .= pack("C", $colmin); |
1087 | 1087 | $data .= pack("C", $colmax); |
1088 | - $this->_append($header . $data); |
|
1088 | + $this->_append($header.$data); |
|
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | /** |
@@ -1103,30 +1103,30 @@ discard block |
||
1103 | 1103 | */ |
1104 | 1104 | private function _writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax) |
1105 | 1105 | { |
1106 | - $record = 0x0018; // Record identifier |
|
1107 | - $length = 0x003d; // Number of bytes to follow |
|
1108 | - $grbit = 0x0020; // Option flags |
|
1109 | - $chKey = 0x00; // Keyboard shortcut |
|
1110 | - $cch = 0x01; // Length of text name |
|
1111 | - $cce = 0x002e; // Length of text definition |
|
1112 | - $ixals = $index + 1; // Sheet index |
|
1113 | - $itab = $ixals; // Equal to ixals |
|
1114 | - $cchCustMenu = 0x00; // Length of cust menu text |
|
1115 | - $cchDescription = 0x00; // Length of description text |
|
1116 | - $cchHelptopic = 0x00; // Length of help topic text |
|
1117 | - $cchStatustext = 0x00; // Length of status bar text |
|
1118 | - $rgch = $type; // Built-in name type |
|
1106 | + $record = 0x0018; // Record identifier |
|
1107 | + $length = 0x003d; // Number of bytes to follow |
|
1108 | + $grbit = 0x0020; // Option flags |
|
1109 | + $chKey = 0x00; // Keyboard shortcut |
|
1110 | + $cch = 0x01; // Length of text name |
|
1111 | + $cce = 0x002e; // Length of text definition |
|
1112 | + $ixals = $index + 1; // Sheet index |
|
1113 | + $itab = $ixals; // Equal to ixals |
|
1114 | + $cchCustMenu = 0x00; // Length of cust menu text |
|
1115 | + $cchDescription = 0x00; // Length of description text |
|
1116 | + $cchHelptopic = 0x00; // Length of help topic text |
|
1117 | + $cchStatustext = 0x00; // Length of status bar text |
|
1118 | + $rgch = $type; // Built-in name type |
|
1119 | 1119 | |
1120 | 1120 | $unknown01 = 0x29; |
1121 | 1121 | $unknown02 = 0x002b; |
1122 | 1122 | $unknown03 = 0x3b; |
1123 | - $unknown04 = 0xffff-$index; |
|
1123 | + $unknown04 = 0xffff - $index; |
|
1124 | 1124 | $unknown05 = 0x0000; |
1125 | 1125 | $unknown06 = 0x0000; |
1126 | 1126 | $unknown07 = 0x1087; |
1127 | 1127 | $unknown08 = 0x8008; |
1128 | 1128 | |
1129 | - $header = pack("vv", $record, $length); |
|
1129 | + $header = pack("vv", $record, $length); |
|
1130 | 1130 | $data = pack("v", $grbit); |
1131 | 1131 | $data .= pack("C", $chKey); |
1132 | 1132 | $data .= pack("C", $cch); |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | $data .= pack("C", 0xff); |
1169 | 1169 | // End of data |
1170 | 1170 | $data .= pack("C", 0x10); |
1171 | - $this->_append($header . $data); |
|
1171 | + $this->_append($header.$data); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | /** |
@@ -1178,14 +1178,14 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | private function _writeCountry() |
1180 | 1180 | { |
1181 | - $record = 0x008C; // Record identifier |
|
1182 | - $length = 4; // Number of bytes to follow |
|
1181 | + $record = 0x008C; // Record identifier |
|
1182 | + $length = 4; // Number of bytes to follow |
|
1183 | 1183 | |
1184 | - $header = pack('vv', $record, $length); |
|
1184 | + $header = pack('vv', $record, $length); |
|
1185 | 1185 | /* using the same country code always for simplicity */ |
1186 | 1186 | $data = pack('vv', $this->_country_code, $this->_country_code); |
1187 | 1187 | //$this->_append($header . $data); |
1188 | - return $this->writeData($header . $data); |
|
1188 | + return $this->writeData($header.$data); |
|
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | /** |
@@ -1195,15 +1195,15 @@ discard block |
||
1195 | 1195 | */ |
1196 | 1196 | private function _writeRecalcId() |
1197 | 1197 | { |
1198 | - $record = 0x01C1; // Record identifier |
|
1199 | - $length = 8; // Number of bytes to follow |
|
1198 | + $record = 0x01C1; // Record identifier |
|
1199 | + $length = 8; // Number of bytes to follow |
|
1200 | 1200 | |
1201 | - $header = pack('vv', $record, $length); |
|
1201 | + $header = pack('vv', $record, $length); |
|
1202 | 1202 | |
1203 | 1203 | // by inspection of real Excel files, MS Office Excel 2007 writes this |
1204 | 1204 | $data = pack('VV', 0x000001C1, 0x00001E667); |
1205 | 1205 | |
1206 | - return $this->writeData($header . $data); |
|
1206 | + return $this->writeData($header.$data); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | /** |
@@ -1213,20 +1213,20 @@ discard block |
||
1213 | 1213 | { |
1214 | 1214 | $aref = $this->_palette; |
1215 | 1215 | |
1216 | - $record = 0x0092; // Record identifier |
|
1217 | - $length = 2 + 4 * count($aref); // Number of bytes to follow |
|
1218 | - $ccv = count($aref); // Number of RGB values to follow |
|
1219 | - $data = ''; // The RGB data |
|
1216 | + $record = 0x0092; // Record identifier |
|
1217 | + $length = 2 + 4 * count($aref); // Number of bytes to follow |
|
1218 | + $ccv = count($aref); // Number of RGB values to follow |
|
1219 | + $data = ''; // The RGB data |
|
1220 | 1220 | |
1221 | 1221 | // Pack the RGB data |
1222 | 1222 | foreach ($aref as $color) { |
1223 | 1223 | foreach ($color as $byte) { |
1224 | - $data .= pack("C",$byte); |
|
1224 | + $data .= pack("C", $byte); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $header = pack("vvv", $record, $length, $ccv); |
|
1229 | - $this->_append($header . $data); |
|
1228 | + $header = pack("vvv", $record, $length, $ccv); |
|
1229 | + $this->_append($header.$data); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | /** |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | $effective_space_remaining = $space_remaining; |
1319 | 1319 | |
1320 | 1320 | // for uncompressed strings, sometimes effective space remaining is reduced by 1 |
1321 | - if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) { |
|
1321 | + if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) { |
|
1322 | 1322 | --$effective_space_remaining; |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | $record = ($i == 0) ? 0x00FC : 0x003C; |
1349 | 1349 | |
1350 | 1350 | $header = pack("vv", $record, strlen($recordData)); |
1351 | - $data = $header . $recordData; |
|
1351 | + $data = $header.$recordData; |
|
1352 | 1352 | |
1353 | 1353 | $chunk .= $this->writeData($data); |
1354 | 1354 | } |
@@ -1368,9 +1368,9 @@ discard block |
||
1368 | 1368 | |
1369 | 1369 | $record = 0x00EB; |
1370 | 1370 | $length = strlen($data); |
1371 | - $header = pack("vv", $record, $length); |
|
1371 | + $header = pack("vv", $record, $length); |
|
1372 | 1372 | |
1373 | - return $this->writeData($header . $data); |
|
1373 | + return $this->writeData($header.$data); |
|
1374 | 1374 | |
1375 | 1375 | } else { |
1376 | 1376 | return ''; |
@@ -206,10 +206,12 @@ discard block |
||
206 | 206 | * @param int &$str_unique Total number of unique strings |
207 | 207 | * @param array &$str_table String Table |
208 | 208 | * @param array &$colors Colour Table |
209 | - * @param mixed $parser The formula parser created for the Workbook |
|
209 | + * @param PHPExcel_Writer_Excel5_Parser $parser The formula parser created for the Workbook |
|
210 | 210 | * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written |
211 | 211 | * @param string $phpSheet The worksheet to write |
212 | 212 | * @param PHPExcel_Worksheet $phpSheet |
213 | + * @param integer $str_total |
|
214 | + * @param integer $str_unique |
|
213 | 215 | */ |
214 | 216 | public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, |
215 | 217 | $parser, $preCalculateFormulas, $phpSheet) |
@@ -606,7 +608,7 @@ discard block |
||
606 | 608 | * @param integer $row Zero indexed row |
607 | 609 | * @param integer $col Zero indexed column |
608 | 610 | * @param float $num The number to write |
609 | - * @param mixed $xfIndex The optional XF format |
|
611 | + * @param integer $xfIndex The optional XF format |
|
610 | 612 | * @return integer |
611 | 613 | */ |
612 | 614 | private function _writeNumber($row, $col, $num, $xfIndex) |
@@ -643,7 +645,7 @@ discard block |
||
643 | 645 | * @param int $row Row index (0-based) |
644 | 646 | * @param int $col Column index (0-based) |
645 | 647 | * @param string $str The string |
646 | - * @param mixed $xfIndex The XF format index for the cell |
|
648 | + * @param integer $xfIndex The XF format index for the cell |
|
647 | 649 | * @param array $arrcRun Index to Font record and characters beginning |
648 | 650 | */ |
649 | 651 | private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){ |
@@ -711,7 +713,7 @@ discard block |
||
711 | 713 | * @param integer $row Zero indexed row |
712 | 714 | * @param integer $col Zero indexed column |
713 | 715 | * @param string $str The string to write |
714 | - * @param mixed $xfIndex The XF format index for the cell |
|
716 | + * @param integer $xfIndex The XF format index for the cell |
|
715 | 717 | * @return integer |
716 | 718 | */ |
717 | 719 | private function _writeLabelSst($row, $col, $str, $xfIndex) |
@@ -776,7 +778,7 @@ discard block |
||
776 | 778 | * |
777 | 779 | * @param integer $row Zero indexed row |
778 | 780 | * @param integer $col Zero indexed column |
779 | - * @param mixed $xfIndex The XF format index |
|
781 | + * @param integer $xfIndex The XF format index |
|
780 | 782 | */ |
781 | 783 | function _writeBlank($row, $col, $xfIndex) |
782 | 784 | { |
@@ -821,7 +823,7 @@ discard block |
||
821 | 823 | * @param integer $row Zero indexed row |
822 | 824 | * @param integer $col Zero indexed column |
823 | 825 | * @param string $formula The formula text string |
824 | - * @param mixed $xfIndex The XF format index |
|
826 | + * @param integer $xfIndex The XF format index |
|
825 | 827 | * @param mixed $calculatedValue Calculated value |
826 | 828 | * @return integer |
827 | 829 | */ |
@@ -2304,8 +2306,8 @@ discard block |
||
2304 | 2306 | * @param mixed $bitmap The bitmap filename or GD-image resource |
2305 | 2307 | * @param integer $x The horizontal position (offset) of the image inside the cell. |
2306 | 2308 | * @param integer $y The vertical position (offset) of the image inside the cell. |
2307 | - * @param float $scale_x The horizontal scale |
|
2308 | - * @param float $scale_y The vertical scale |
|
2309 | + * @param integer $scale_x The horizontal scale |
|
2310 | + * @param integer $scale_y The vertical scale |
|
2309 | 2311 | */ |
2310 | 2312 | function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) |
2311 | 2313 | { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $this->_preCalculateFormulas = $preCalculateFormulas; |
225 | 225 | $this->_str_total = &$str_total; |
226 | - $this->_str_unique = &$str_unique; |
|
226 | + $this->_str_unique = &$str_unique; |
|
227 | 227 | $this->_str_table = &$str_table; |
228 | 228 | $this->_colors = &$colors; |
229 | 229 | $this->_parser = $parser; |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | |
233 | 233 | //$this->ext_sheets = array(); |
234 | 234 | //$this->offset = 0; |
235 | - $this->_xls_strmax = 255; |
|
236 | - $this->_colinfo = array(); |
|
237 | - $this->_selection = array(0,0,0,0); |
|
238 | - $this->_active_pane = 3; |
|
235 | + $this->_xls_strmax = 255; |
|
236 | + $this->_colinfo = array(); |
|
237 | + $this->_selection = array(0, 0, 0, 0); |
|
238 | + $this->_active_pane = 3; |
|
239 | 239 | |
240 | 240 | $this->_print_headers = 0; |
241 | 241 | |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | $minR = 1; |
251 | 251 | $minC = 'A'; |
252 | 252 | |
253 | - $maxR = $this->_phpSheet->getHighestRow(); |
|
253 | + $maxR = $this->_phpSheet->getHighestRow(); |
|
254 | 254 | $maxC = $this->_phpSheet->getHighestColumn(); |
255 | 255 | |
256 | 256 | // Determine lowest and highest column and row |
257 | 257 | // $this->_firstRowIndex = ($minR > 65535) ? 65535 : $minR; |
258 | - $this->_lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ; |
|
258 | + $this->_lastRowIndex = ($maxR > 65535) ? 65535 : $maxR; |
|
259 | 259 | |
260 | 260 | $this->_firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC); |
261 | 261 | $this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | $columnDimensions = $_phpSheet->getColumnDimensions(); |
303 | - $maxCol = $this->_lastColumnIndex -1; |
|
303 | + $maxCol = $this->_lastColumnIndex - 1; |
|
304 | 304 | for ($i = 0; $i <= $maxCol; ++$i) { |
305 | 305 | $hidden = 0; |
306 | 306 | $level = 0; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->_writeDefcol(); |
385 | 385 | |
386 | 386 | // Write the COLINFO records if they exist |
387 | - if (!empty($this->_colinfo)) { |
|
387 | + if ( ! empty($this->_colinfo)) { |
|
388 | 388 | $colcount = count($this->_colinfo); |
389 | 389 | for ($i = 0; $i < $colcount; ++$i) { |
390 | 390 | $this->_writeColinfo($this->_colinfo[$i]); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | // Row dimensions |
398 | 398 | foreach ($_phpSheet->getRowDimensions() as $rowDimension) { |
399 | 399 | $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs |
400 | - $this->_writeRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() ); |
|
400 | + $this->_writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel()); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | // Write Cells |
@@ -485,17 +485,17 @@ discard block |
||
485 | 485 | |
486 | 486 | $url = $hyperlink->getUrl(); |
487 | 487 | |
488 | - if ( strpos($url, 'sheet://') !== false ) { |
|
488 | + if (strpos($url, 'sheet://') !== false) { |
|
489 | 489 | // internal to current workbook |
490 | 490 | $url = str_replace('sheet://', 'internal:', $url); |
491 | 491 | |
492 | - } else if ( preg_match('/^(http:|https:|ftp:|mailto:)/', $url) ) { |
|
492 | + } else if (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) { |
|
493 | 493 | // URL |
494 | 494 | // $url = $url; |
495 | 495 | |
496 | 496 | } else { |
497 | 497 | // external (local file) |
498 | - $url = 'external:' . $url; |
|
498 | + $url = 'external:'.$url; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | $this->_writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | $firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1) |
535 | - $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6) |
|
535 | + $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6) |
|
536 | 536 | |
537 | 537 | return(pack('vvvv', |
538 | 538 | $firstCellCoordinates[1] - 1, |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | // Return data stored in memory |
556 | 556 | if (isset($this->_data)) { |
557 | - $tmp = $this->_data; |
|
557 | + $tmp = $this->_data; |
|
558 | 558 | unset($this->_data); |
559 | 559 | return $tmp; |
560 | 560 | } |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | */ |
585 | 585 | function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) |
586 | 586 | { |
587 | - $this->_outline_on = $visible; |
|
587 | + $this->_outline_on = $visible; |
|
588 | 588 | $this->_outline_below = $symbols_below; |
589 | 589 | $this->_outline_right = $symbols_right; |
590 | 590 | $this->_outline_style = $auto_style; |
@@ -611,12 +611,12 @@ discard block |
||
611 | 611 | */ |
612 | 612 | private function _writeNumber($row, $col, $num, $xfIndex) |
613 | 613 | { |
614 | - $record = 0x0203; // Record identifier |
|
615 | - $length = 0x000E; // Number of bytes to follow |
|
614 | + $record = 0x0203; // Record identifier |
|
615 | + $length = 0x000E; // Number of bytes to follow |
|
616 | 616 | |
617 | - $header = pack("vv", $record, $length); |
|
618 | - $data = pack("vvv", $row, $col, $xfIndex); |
|
619 | - $xl_double = pack("d", $num); |
|
617 | + $header = pack("vv", $record, $length); |
|
618 | + $data = pack("vvv", $row, $col, $xfIndex); |
|
619 | + $xl_double = pack("d", $num); |
|
620 | 620 | if (self::getByteOrder()) { // if it's Big Endian |
621 | 621 | $xl_double = strrev($xl_double); |
622 | 622 | } |
@@ -646,20 +646,20 @@ discard block |
||
646 | 646 | * @param mixed $xfIndex The XF format index for the cell |
647 | 647 | * @param array $arrcRun Index to Font record and characters beginning |
648 | 648 | */ |
649 | - private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){ |
|
650 | - $record = 0x00FD; // Record identifier |
|
651 | - $length = 0x000A; // Bytes to follow |
|
649 | + private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) { |
|
650 | + $record = 0x00FD; // Record identifier |
|
651 | + $length = 0x000A; // Bytes to follow |
|
652 | 652 | |
653 | 653 | $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun); |
654 | 654 | |
655 | 655 | /* check if string is already present */ |
656 | - if (!isset($this->_str_table[$str])) { |
|
656 | + if ( ! isset($this->_str_table[$str])) { |
|
657 | 657 | $this->_str_table[$str] = $this->_str_unique++; |
658 | 658 | } |
659 | 659 | $this->_str_total++; |
660 | 660 | |
661 | - $header = pack('vv', $record, $length); |
|
662 | - $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); |
|
661 | + $header = pack('vv', $record, $length); |
|
662 | + $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); |
|
663 | 663 | $this->_append($header.$data); |
664 | 664 | } |
665 | 665 | |
@@ -681,21 +681,21 @@ discard block |
||
681 | 681 | private function _writeLabel($row, $col, $str, $xfIndex) |
682 | 682 | { |
683 | 683 | $strlen = strlen($str); |
684 | - $record = 0x0204; // Record identifier |
|
685 | - $length = 0x0008 + $strlen; // Bytes to follow |
|
684 | + $record = 0x0204; // Record identifier |
|
685 | + $length = 0x0008 + $strlen; // Bytes to follow |
|
686 | 686 | |
687 | 687 | $str_error = 0; |
688 | 688 | |
689 | 689 | if ($strlen > $this->_xls_strmax) { // LABEL must be < 255 chars |
690 | - $str = substr($str, 0, $this->_xls_strmax); |
|
690 | + $str = substr($str, 0, $this->_xls_strmax); |
|
691 | 691 | $length = 0x0008 + $this->_xls_strmax; |
692 | 692 | $strlen = $this->_xls_strmax; |
693 | 693 | $str_error = -3; |
694 | 694 | } |
695 | 695 | |
696 | - $header = pack("vv", $record, $length); |
|
697 | - $data = pack("vvvv", $row, $col, $xfIndex, $strlen); |
|
698 | - $this->_append($header . $data . $str); |
|
696 | + $header = pack("vv", $record, $length); |
|
697 | + $data = pack("vvvv", $row, $col, $xfIndex, $strlen); |
|
698 | + $this->_append($header.$data.$str); |
|
699 | 699 | return($str_error); |
700 | 700 | } |
701 | 701 | |
@@ -716,19 +716,19 @@ discard block |
||
716 | 716 | */ |
717 | 717 | private function _writeLabelSst($row, $col, $str, $xfIndex) |
718 | 718 | { |
719 | - $record = 0x00FD; // Record identifier |
|
720 | - $length = 0x000A; // Bytes to follow |
|
719 | + $record = 0x00FD; // Record identifier |
|
720 | + $length = 0x000A; // Bytes to follow |
|
721 | 721 | |
722 | 722 | $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str); |
723 | 723 | |
724 | 724 | /* check if string is already present */ |
725 | - if (!isset($this->_str_table[$str])) { |
|
725 | + if ( ! isset($this->_str_table[$str])) { |
|
726 | 726 | $this->_str_table[$str] = $this->_str_unique++; |
727 | 727 | } |
728 | 728 | $this->_str_total++; |
729 | 729 | |
730 | - $header = pack('vv', $record, $length); |
|
731 | - $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); |
|
730 | + $header = pack('vv', $record, $length); |
|
731 | + $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); |
|
732 | 732 | $this->_append($header.$data); |
733 | 733 | } |
734 | 734 | |
@@ -743,19 +743,19 @@ discard block |
||
743 | 743 | private function _writeNote($row, $col, $note) |
744 | 744 | { |
745 | 745 | $note_length = strlen($note); |
746 | - $record = 0x001C; // Record identifier |
|
747 | - $max_length = 2048; // Maximun length for a NOTE record |
|
746 | + $record = 0x001C; // Record identifier |
|
747 | + $max_length = 2048; // Maximun length for a NOTE record |
|
748 | 748 | |
749 | 749 | // Length for this record is no more than 2048 + 6 |
750 | 750 | $length = 0x0006 + min($note_length, 2048); |
751 | - $header = pack("vv", $record, $length); |
|
752 | - $data = pack("vvv", $row, $col, $note_length); |
|
753 | - $this->_append($header . $data . substr($note, 0, 2048)); |
|
751 | + $header = pack("vv", $record, $length); |
|
752 | + $data = pack("vvv", $row, $col, $note_length); |
|
753 | + $this->_append($header.$data.substr($note, 0, 2048)); |
|
754 | 754 | |
755 | 755 | for ($i = $max_length; $i < $note_length; $i += $max_length) { |
756 | 756 | $chunk = substr($note, $i, $max_length); |
757 | 757 | $length = 0x0006 + strlen($chunk); |
758 | - $header = pack("vv", $record, $length); |
|
758 | + $header = pack("vv", $record, $length); |
|
759 | 759 | $data = pack("vvv", -1, 0, strlen($chunk)); |
760 | 760 | $this->_append($header.$data.$chunk); |
761 | 761 | } |
@@ -780,12 +780,12 @@ discard block |
||
780 | 780 | */ |
781 | 781 | function _writeBlank($row, $col, $xfIndex) |
782 | 782 | { |
783 | - $record = 0x0201; // Record identifier |
|
784 | - $length = 0x0006; // Number of bytes to follow |
|
783 | + $record = 0x0201; // Record identifier |
|
784 | + $length = 0x0006; // Number of bytes to follow |
|
785 | 785 | |
786 | - $header = pack("vv", $record, $length); |
|
786 | + $header = pack("vv", $record, $length); |
|
787 | 787 | $data = pack("vvv", $row, $col, $xfIndex); |
788 | - $this->_append($header . $data); |
|
788 | + $this->_append($header.$data); |
|
789 | 789 | return 0; |
790 | 790 | } |
791 | 791 | |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | $record = 0x0205; |
804 | 804 | $length = 8; |
805 | 805 | |
806 | - $header = pack("vv", $record, $length); |
|
806 | + $header = pack("vv", $record, $length); |
|
807 | 807 | $data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError); |
808 | - $this->_append($header . $data); |
|
808 | + $this->_append($header.$data); |
|
809 | 809 | return 0; |
810 | 810 | } |
811 | 811 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | */ |
828 | 828 | private function _writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) |
829 | 829 | { |
830 | - $record = 0x0006; // Record identifier |
|
830 | + $record = 0x0006; // Record identifier |
|
831 | 831 | |
832 | 832 | // Initialize possible additional value for STRING record that should be written after the FORMULA record? |
833 | 833 | $stringValue = null; |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | // we use best effort to determine data type |
839 | 839 | if (is_bool($calculatedValue)) { |
840 | 840 | // Boolean value |
841 | - $num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF); |
|
841 | + $num = pack('CCCvCv', 0x01, 0x00, (int) $calculatedValue, 0x00, 0x00, 0xFFFF); |
|
842 | 842 | } elseif (is_int($calculatedValue) || is_float($calculatedValue)) { |
843 | 843 | // Numeric value |
844 | 844 | $num = pack('d', $calculatedValue); |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | $num = pack('d', 0x00); |
863 | 863 | } |
864 | 864 | |
865 | - $grbit = 0x03; // Option flags |
|
866 | - $unknown = 0x0000; // Must be zero |
|
865 | + $grbit = 0x03; // Option flags |
|
866 | + $unknown = 0x0000; // Must be zero |
|
867 | 867 | |
868 | 868 | // Strip the '=' or '@' sign at the beginning of the formula string |
869 | 869 | if ($formula{0} == '=') { |
870 | - $formula = substr($formula,1); |
|
870 | + $formula = substr($formula, 1); |
|
871 | 871 | } else { |
872 | 872 | // Error handling |
873 | 873 | $this->_writeString($row, $col, 'Unrecognised character for formula'); |
@@ -879,15 +879,15 @@ discard block |
||
879 | 879 | $error = $this->_parser->parse($formula); |
880 | 880 | $formula = $this->_parser->toReversePolish(); |
881 | 881 | |
882 | - $formlen = strlen($formula); // Length of the binary string |
|
883 | - $length = 0x16 + $formlen; // Length of the record data |
|
882 | + $formlen = strlen($formula); // Length of the binary string |
|
883 | + $length = 0x16 + $formlen; // Length of the record data |
|
884 | 884 | |
885 | - $header = pack("vv", $record, $length); |
|
885 | + $header = pack("vv", $record, $length); |
|
886 | 886 | |
887 | 887 | $data = pack("vvv", $row, $col, $xfIndex) |
888 | 888 | . $num |
889 | 889 | . pack("vVv", $grbit, $unknown, $formlen); |
890 | - $this->_append($header . $data . $formula); |
|
890 | + $this->_append($header.$data.$formula); |
|
891 | 891 | |
892 | 892 | // Append also a STRING record if necessary |
893 | 893 | if ($stringValue !== null) { |
@@ -909,13 +909,13 @@ discard block |
||
909 | 909 | */ |
910 | 910 | private function _writeStringRecord($stringValue) |
911 | 911 | { |
912 | - $record = 0x0207; // Record identifier |
|
912 | + $record = 0x0207; // Record identifier |
|
913 | 913 | $data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue); |
914 | 914 | |
915 | 915 | $length = strlen($data); |
916 | 916 | $header = pack('vv', $record, $length); |
917 | 917 | |
918 | - $this->_append($header . $data); |
|
918 | + $this->_append($header.$data); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | */ |
988 | 988 | function _writeUrlWeb($row1, $col1, $row2, $col2, $url) |
989 | 989 | { |
990 | - $record = 0x01B8; // Record identifier |
|
991 | - $length = 0x00000; // Bytes to follow |
|
990 | + $record = 0x01B8; // Record identifier |
|
991 | + $length = 0x00000; // Bytes to follow |
|
992 | 992 | |
993 | 993 | // Pack the undocumented parts of the hyperlink stream |
994 | 994 | $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000"); |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | |
1000 | 1000 | // Convert URL to a null terminated wchar string |
1001 | 1001 | $url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY)); |
1002 | - $url = $url . "\0\0\0"; |
|
1002 | + $url = $url."\0\0\0"; |
|
1003 | 1003 | |
1004 | 1004 | // Pack the length of the URL |
1005 | 1005 | $url_len = pack("V", strlen($url)); |
@@ -1008,13 +1008,13 @@ discard block |
||
1008 | 1008 | $length = 0x34 + strlen($url); |
1009 | 1009 | |
1010 | 1010 | // Pack the header data |
1011 | - $header = pack("vv", $record, $length); |
|
1012 | - $data = pack("vvvv", $row1, $row2, $col1, $col2); |
|
1011 | + $header = pack("vv", $record, $length); |
|
1012 | + $data = pack("vvvv", $row1, $row2, $col1, $col2); |
|
1013 | 1013 | |
1014 | 1014 | // Write the packed data |
1015 | - $this->_append($header . $data . |
|
1016 | - $unknown1 . $options . |
|
1017 | - $unknown2 . $url_len . $url); |
|
1015 | + $this->_append($header.$data. |
|
1016 | + $unknown1.$options. |
|
1017 | + $unknown2.$url_len.$url); |
|
1018 | 1018 | return 0; |
1019 | 1019 | } |
1020 | 1020 | |
@@ -1032,8 +1032,8 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | function _writeUrlInternal($row1, $col1, $row2, $col2, $url) |
1034 | 1034 | { |
1035 | - $record = 0x01B8; // Record identifier |
|
1036 | - $length = 0x00000; // Bytes to follow |
|
1035 | + $record = 0x01B8; // Record identifier |
|
1036 | + $length = 0x00000; // Bytes to follow |
|
1037 | 1037 | |
1038 | 1038 | // Strip URL type |
1039 | 1039 | $url = preg_replace('/^internal:/', '', $url); |
@@ -1057,13 +1057,13 @@ discard block |
||
1057 | 1057 | $length = 0x24 + strlen($url); |
1058 | 1058 | |
1059 | 1059 | // Pack the header data |
1060 | - $header = pack("vv", $record, $length); |
|
1061 | - $data = pack("vvvv", $row1, $row2, $col1, $col2); |
|
1060 | + $header = pack("vv", $record, $length); |
|
1061 | + $data = pack("vvvv", $row1, $row2, $col1, $col2); |
|
1062 | 1062 | |
1063 | 1063 | // Write the packed data |
1064 | - $this->_append($header . $data . |
|
1065 | - $unknown1 . $options . |
|
1066 | - $url_len . $url); |
|
1064 | + $this->_append($header.$data. |
|
1065 | + $unknown1.$options. |
|
1066 | + $url_len.$url); |
|
1067 | 1067 | return 0; |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1091,8 +1091,8 @@ discard block |
||
1091 | 1091 | return; //($this->_writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $record = 0x01B8; // Record identifier |
|
1095 | - $length = 0x00000; // Bytes to follow |
|
1094 | + $record = 0x01B8; // Record identifier |
|
1095 | + $length = 0x00000; // Bytes to follow |
|
1096 | 1096 | |
1097 | 1097 | // Strip URL type and change Unix dir separator to Dos style (if needed) |
1098 | 1098 | // |
@@ -1105,10 +1105,10 @@ discard block |
||
1105 | 1105 | // otherwise, absolute |
1106 | 1106 | |
1107 | 1107 | $absolute = 0x00; // relative path |
1108 | - if ( preg_match('/^[A-Z]:/', $url) ) { |
|
1108 | + if (preg_match('/^[A-Z]:/', $url)) { |
|
1109 | 1109 | $absolute = 0x02; // absolute path on Windows, e.g. C:\... |
1110 | 1110 | } |
1111 | - $link_type = 0x01 | $absolute; |
|
1111 | + $link_type = 0x01 | $absolute; |
|
1112 | 1112 | |
1113 | 1113 | // Determine if the link contains a sheet reference and change some of the |
1114 | 1114 | // parameters accordingly. |
@@ -1120,39 +1120,39 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | // Pack the link type |
1123 | - $link_type = pack("V", $link_type); |
|
1123 | + $link_type = pack("V", $link_type); |
|
1124 | 1124 | |
1125 | 1125 | // Calculate the up-level dir count e.g.. (..\..\..\ == 3) |
1126 | 1126 | $up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless); |
1127 | 1127 | $up_count = pack("v", $up_count); |
1128 | 1128 | |
1129 | 1129 | // Store the short dos dir name (null terminated) |
1130 | - $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0"; |
|
1130 | + $dir_short = preg_replace("/\.\.\\\/", '', $dir_long)."\0"; |
|
1131 | 1131 | |
1132 | 1132 | // Store the long dir name as a wchar string (non-null terminated) |
1133 | - $dir_long = $dir_long . "\0"; |
|
1133 | + $dir_long = $dir_long."\0"; |
|
1134 | 1134 | |
1135 | 1135 | // Pack the lengths of the dir strings |
1136 | - $dir_short_len = pack("V", strlen($dir_short) ); |
|
1137 | - $dir_long_len = pack("V", strlen($dir_long) ); |
|
1138 | - $stream_len = pack("V", 0);//strlen($dir_long) + 0x06); |
|
1136 | + $dir_short_len = pack("V", strlen($dir_short)); |
|
1137 | + $dir_long_len = pack("V", strlen($dir_long)); |
|
1138 | + $stream_len = pack("V", 0); //strlen($dir_long) + 0x06); |
|
1139 | 1139 | |
1140 | 1140 | // Pack the undocumented parts of the hyperlink stream |
1141 | - $unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' ); |
|
1142 | - $unknown2 = pack("H*",'0303000000000000C000000000000046' ); |
|
1143 | - $unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000'); |
|
1144 | - $unknown4 = pack("v", 0x03 ); |
|
1141 | + $unknown1 = pack("H*", 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); |
|
1142 | + $unknown2 = pack("H*", '0303000000000000C000000000000046'); |
|
1143 | + $unknown3 = pack("H*", 'FFFFADDE000000000000000000000000000000000000000'); |
|
1144 | + $unknown4 = pack("v", 0x03); |
|
1145 | 1145 | |
1146 | 1146 | // Pack the main data stream |
1147 | - $data = pack("vvvv", $row1, $row2, $col1, $col2) . |
|
1148 | - $unknown1 . |
|
1149 | - $link_type . |
|
1150 | - $unknown2 . |
|
1151 | - $up_count . |
|
1147 | + $data = pack("vvvv", $row1, $row2, $col1, $col2). |
|
1148 | + $unknown1. |
|
1149 | + $link_type. |
|
1150 | + $unknown2. |
|
1151 | + $up_count. |
|
1152 | 1152 | $dir_short_len. |
1153 | - $dir_short . |
|
1154 | - $unknown3 . |
|
1155 | - $stream_len ;/*. |
|
1153 | + $dir_short. |
|
1154 | + $unknown3. |
|
1155 | + $stream_len; /*. |
|
1156 | 1156 | $dir_long_len . |
1157 | 1157 | $unknown4 . |
1158 | 1158 | $dir_long . |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $header = pack("vv", $record, $length); |
1165 | 1165 | |
1166 | 1166 | // Write the packed data |
1167 | - $this->_append($header. $data); |
|
1167 | + $this->_append($header.$data); |
|
1168 | 1168 | return 0; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1180,25 +1180,25 @@ discard block |
||
1180 | 1180 | */ |
1181 | 1181 | private function _writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) |
1182 | 1182 | { |
1183 | - $record = 0x0208; // Record identifier |
|
1184 | - $length = 0x0010; // Number of bytes to follow |
|
1183 | + $record = 0x0208; // Record identifier |
|
1184 | + $length = 0x0010; // Number of bytes to follow |
|
1185 | 1185 | |
1186 | - $colMic = 0x0000; // First defined column |
|
1187 | - $colMac = 0x0000; // Last defined column |
|
1188 | - $irwMac = 0x0000; // Used by Excel to optimise loading |
|
1189 | - $reserved = 0x0000; // Reserved |
|
1190 | - $grbit = 0x0000; // Option flags |
|
1191 | - $ixfe = $xfIndex; |
|
1186 | + $colMic = 0x0000; // First defined column |
|
1187 | + $colMac = 0x0000; // Last defined column |
|
1188 | + $irwMac = 0x0000; // Used by Excel to optimise loading |
|
1189 | + $reserved = 0x0000; // Reserved |
|
1190 | + $grbit = 0x0000; // Option flags |
|
1191 | + $ixfe = $xfIndex; |
|
1192 | 1192 | |
1193 | - if ( $height < 0 ){ |
|
1193 | + if ($height < 0) { |
|
1194 | 1194 | $height = null; |
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | // Use _writeRow($row, null, $XF) to set XF format without setting height |
1198 | 1198 | if ($height != null) { |
1199 | - $miyRw = $height * 20; // row height |
|
1199 | + $miyRw = $height * 20; // row height |
|
1200 | 1200 | } else { |
1201 | - $miyRw = 0xff; // default row height is 256 |
|
1201 | + $miyRw = 0xff; // default row height is 256 |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | // Set the options flags. fUnsynced is used to show that the font and row |
@@ -1219,9 +1219,9 @@ discard block |
||
1219 | 1219 | } |
1220 | 1220 | $grbit |= 0x0100; |
1221 | 1221 | |
1222 | - $header = pack("vv", $record, $length); |
|
1223 | - $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, |
|
1224 | - $irwMac,$reserved, $grbit, $ixfe); |
|
1222 | + $header = pack("vv", $record, $length); |
|
1223 | + $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, |
|
1224 | + $irwMac, $reserved, $grbit, $ixfe); |
|
1225 | 1225 | $this->_append($header.$data); |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1250,47 +1250,47 @@ discard block |
||
1250 | 1250 | */ |
1251 | 1251 | private function _writeWindow2() |
1252 | 1252 | { |
1253 | - $record = 0x023E; // Record identifier |
|
1253 | + $record = 0x023E; // Record identifier |
|
1254 | 1254 | $length = 0x0012; |
1255 | 1255 | |
1256 | - $grbit = 0x00B6; // Option flags |
|
1257 | - $rwTop = 0x0000; // Top row visible in window |
|
1258 | - $colLeft = 0x0000; // Leftmost column visible in window |
|
1256 | + $grbit = 0x00B6; // Option flags |
|
1257 | + $rwTop = 0x0000; // Top row visible in window |
|
1258 | + $colLeft = 0x0000; // Leftmost column visible in window |
|
1259 | 1259 | |
1260 | 1260 | |
1261 | 1261 | // The options flags that comprise $grbit |
1262 | - $fDspFmla = 0; // 0 - bit |
|
1262 | + $fDspFmla = 0; // 0 - bit |
|
1263 | 1263 | $fDspGrid = $this->_phpSheet->getShowGridlines() ? 1 : 0; // 1 |
1264 | 1264 | $fDspRwCol = $this->_phpSheet->getShowRowColHeaders() ? 1 : 0; // 2 |
1265 | - $fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0; // 3 |
|
1266 | - $fDspZeros = 1; // 4 |
|
1267 | - $fDefaultHdr = 1; // 5 |
|
1265 | + $fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0; // 3 |
|
1266 | + $fDspZeros = 1; // 4 |
|
1267 | + $fDefaultHdr = 1; // 5 |
|
1268 | 1268 | $fArabic = $this->_phpSheet->getRightToLeft() ? 1 : 0; // 6 |
1269 | - $fDspGuts = $this->_outline_on; // 7 |
|
1270 | - $fFrozenNoSplit = 0; // 0 - bit |
|
1269 | + $fDspGuts = $this->_outline_on; // 7 |
|
1270 | + $fFrozenNoSplit = 0; // 0 - bit |
|
1271 | 1271 | // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet |
1272 | 1272 | $fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0; |
1273 | - $fPaged = 1; // 2 |
|
1273 | + $fPaged = 1; // 2 |
|
1274 | 1274 | |
1275 | 1275 | $grbit = $fDspFmla; |
1276 | - $grbit |= $fDspGrid << 1; |
|
1277 | - $grbit |= $fDspRwCol << 2; |
|
1278 | - $grbit |= $fFrozen << 3; |
|
1279 | - $grbit |= $fDspZeros << 4; |
|
1280 | - $grbit |= $fDefaultHdr << 5; |
|
1281 | - $grbit |= $fArabic << 6; |
|
1282 | - $grbit |= $fDspGuts << 7; |
|
1276 | + $grbit |= $fDspGrid << 1; |
|
1277 | + $grbit |= $fDspRwCol << 2; |
|
1278 | + $grbit |= $fFrozen << 3; |
|
1279 | + $grbit |= $fDspZeros << 4; |
|
1280 | + $grbit |= $fDefaultHdr << 5; |
|
1281 | + $grbit |= $fArabic << 6; |
|
1282 | + $grbit |= $fDspGuts << 7; |
|
1283 | 1283 | $grbit |= $fFrozenNoSplit << 8; |
1284 | - $grbit |= $fSelected << 9; |
|
1285 | - $grbit |= $fPaged << 10; |
|
1284 | + $grbit |= $fSelected << 9; |
|
1285 | + $grbit |= $fPaged << 10; |
|
1286 | 1286 | |
1287 | - $header = pack("vv", $record, $length); |
|
1288 | - $data = pack("vvv", $grbit, $rwTop, $colLeft); |
|
1287 | + $header = pack("vv", $record, $length); |
|
1288 | + $data = pack("vvv", $grbit, $rwTop, $colLeft); |
|
1289 | 1289 | |
1290 | 1290 | // FIXME !!! |
1291 | - $rgbHdr = 0x0040; // Row/column heading and gridline color index |
|
1291 | + $rgbHdr = 0x0040; // Row/column heading and gridline color index |
|
1292 | 1292 | $zoom_factor_page_break = 0x0000; |
1293 | - $zoom_factor_normal = 0x0000; |
|
1293 | + $zoom_factor_normal = 0x0000; |
|
1294 | 1294 | $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000); |
1295 | 1295 | |
1296 | 1296 | $this->_append($header.$data); |
@@ -1310,12 +1310,12 @@ discard block |
||
1310 | 1310 | // convert to twips |
1311 | 1311 | $defaultRowHeight = (int) 20 * $defaultRowHeight; |
1312 | 1312 | |
1313 | - $record = 0x0225; // Record identifier |
|
1314 | - $length = 0x0004; // Number of bytes to follow |
|
1313 | + $record = 0x0225; // Record identifier |
|
1314 | + $length = 0x0004; // Number of bytes to follow |
|
1315 | 1315 | |
1316 | 1316 | $header = pack("vv", $record, $length); |
1317 | - $data = pack("vv", 1, $defaultRowHeight); |
|
1318 | - $this->_append($header . $data); |
|
1317 | + $data = pack("vv", 1, $defaultRowHeight); |
|
1318 | + $this->_append($header.$data); |
|
1319 | 1319 | } |
1320 | 1320 | |
1321 | 1321 | /** |
@@ -1325,12 +1325,12 @@ discard block |
||
1325 | 1325 | { |
1326 | 1326 | $defaultColWidth = 8; |
1327 | 1327 | |
1328 | - $record = 0x0055; // Record identifier |
|
1329 | - $length = 0x0002; // Number of bytes to follow |
|
1328 | + $record = 0x0055; // Record identifier |
|
1329 | + $length = 0x0002; // Number of bytes to follow |
|
1330 | 1330 | |
1331 | 1331 | $header = pack("vv", $record, $length); |
1332 | 1332 | $data = pack("v", $defaultColWidth); |
1333 | - $this->_append($header . $data); |
|
1333 | + $this->_append($header.$data); |
|
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | /** |
@@ -1375,19 +1375,19 @@ discard block |
||
1375 | 1375 | } else { |
1376 | 1376 | $level = 0; |
1377 | 1377 | } |
1378 | - $record = 0x007D; // Record identifier |
|
1379 | - $length = 0x000C; // Number of bytes to follow |
|
1378 | + $record = 0x007D; // Record identifier |
|
1379 | + $length = 0x000C; // Number of bytes to follow |
|
1380 | 1380 | |
1381 | - $coldx *= 256; // Convert to units of 1/256 of a char |
|
1381 | + $coldx *= 256; // Convert to units of 1/256 of a char |
|
1382 | 1382 | |
1383 | 1383 | $ixfe = $xfIndex; |
1384 | - $reserved = 0x0000; // Reserved |
|
1384 | + $reserved = 0x0000; // Reserved |
|
1385 | 1385 | |
1386 | 1386 | $level = max(0, min($level, 7)); |
1387 | 1387 | $grbit |= $level << 8; |
1388 | 1388 | |
1389 | - $header = pack("vv", $record, $length); |
|
1390 | - $data = pack("vvvvvv", $colFirst, $colLast, $coldx, |
|
1389 | + $header = pack("vv", $record, $length); |
|
1390 | + $data = pack("vvvvvv", $colFirst, $colLast, $coldx, |
|
1391 | 1391 | $ixfe, $grbit, $reserved); |
1392 | 1392 | $this->_append($header.$data); |
1393 | 1393 | } |
@@ -1418,25 +1418,25 @@ discard block |
||
1418 | 1418 | |
1419 | 1419 | // make sure we are not out of bounds |
1420 | 1420 | $colFirst = min($colFirst, 255); |
1421 | - $colLast = min($colLast, 255); |
|
1421 | + $colLast = min($colLast, 255); |
|
1422 | 1422 | |
1423 | 1423 | $rwFirst = min($rwFirst, 65535); |
1424 | - $rwLast = min($rwLast, 65535); |
|
1424 | + $rwLast = min($rwLast, 65535); |
|
1425 | 1425 | |
1426 | - $record = 0x001D; // Record identifier |
|
1427 | - $length = 0x000F; // Number of bytes to follow |
|
1426 | + $record = 0x001D; // Record identifier |
|
1427 | + $length = 0x000F; // Number of bytes to follow |
|
1428 | 1428 | |
1429 | - $pnn = $this->_active_pane; // Pane position |
|
1430 | - $rwAct = $rwFirst; // Active row |
|
1431 | - $colAct = $colFirst; // Active column |
|
1432 | - $irefAct = 0; // Active cell ref |
|
1433 | - $cref = 1; // Number of refs |
|
1429 | + $pnn = $this->_active_pane; // Pane position |
|
1430 | + $rwAct = $rwFirst; // Active row |
|
1431 | + $colAct = $colFirst; // Active column |
|
1432 | + $irefAct = 0; // Active cell ref |
|
1433 | + $cref = 1; // Number of refs |
|
1434 | 1434 | |
1435 | - if (!isset($rwLast)) { |
|
1436 | - $rwLast = $rwFirst; // Last row in reference |
|
1435 | + if ( ! isset($rwLast)) { |
|
1436 | + $rwLast = $rwFirst; // Last row in reference |
|
1437 | 1437 | } |
1438 | - if (!isset($colLast)) { |
|
1439 | - $colLast = $colFirst; // Last col in reference |
|
1438 | + if ( ! isset($colLast)) { |
|
1439 | + $colLast = $colFirst; // Last col in reference |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | // Swap last row/col for first row/col as necessary |
@@ -1448,12 +1448,12 @@ discard block |
||
1448 | 1448 | list($colFirst, $colLast) = array($colLast, $colFirst); |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - $header = pack("vv", $record, $length); |
|
1452 | - $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, |
|
1451 | + $header = pack("vv", $record, $length); |
|
1452 | + $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, |
|
1453 | 1453 | $irefAct, $cref, |
1454 | 1454 | $rwFirst, $rwLast, |
1455 | 1455 | $colFirst, $colLast); |
1456 | - $this->_append($header . $data); |
|
1456 | + $this->_append($header.$data); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | /** |
@@ -1498,10 +1498,10 @@ discard block |
||
1498 | 1498 | |
1499 | 1499 | // flush record if we have reached limit for number of merged cells, or reached final merged cell |
1500 | 1500 | if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) { |
1501 | - $recordData = pack('v', $j) . $recordData; |
|
1501 | + $recordData = pack('v', $j).$recordData; |
|
1502 | 1502 | $length = strlen($recordData); |
1503 | 1503 | $header = pack('vv', $record, $length); |
1504 | - $this->_append($header . $recordData); |
|
1504 | + $this->_append($header.$recordData); |
|
1505 | 1505 | |
1506 | 1506 | // initialize for next record, if any |
1507 | 1507 | $recordData = ''; |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | */ |
1516 | 1516 | private function _writeSheetLayout() |
1517 | 1517 | { |
1518 | - if (!$this->_phpSheet->isTabColorSet()) { |
|
1518 | + if ( ! $this->_phpSheet->isTabColorSet()) { |
|
1519 | 1519 | return; |
1520 | 1520 | } |
1521 | 1521 | |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | |
1535 | 1535 | $record = 0x0862; // Record identifier |
1536 | 1536 | $header = pack('vv', $record, $length); |
1537 | - $this->_append($header . $recordData); |
|
1537 | + $this->_append($header.$recordData); |
|
1538 | 1538 | } |
1539 | 1539 | |
1540 | 1540 | /** |
@@ -1546,21 +1546,21 @@ discard block |
||
1546 | 1546 | $record = 0x0867; |
1547 | 1547 | |
1548 | 1548 | // prepare options |
1549 | - $options = (int) !$this->_phpSheet->getProtection()->getObjects() |
|
1550 | - | (int) !$this->_phpSheet->getProtection()->getScenarios() << 1 |
|
1551 | - | (int) !$this->_phpSheet->getProtection()->getFormatCells() << 2 |
|
1552 | - | (int) !$this->_phpSheet->getProtection()->getFormatColumns() << 3 |
|
1553 | - | (int) !$this->_phpSheet->getProtection()->getFormatRows() << 4 |
|
1554 | - | (int) !$this->_phpSheet->getProtection()->getInsertColumns() << 5 |
|
1555 | - | (int) !$this->_phpSheet->getProtection()->getInsertRows() << 6 |
|
1556 | - | (int) !$this->_phpSheet->getProtection()->getInsertHyperlinks() << 7 |
|
1557 | - | (int) !$this->_phpSheet->getProtection()->getDeleteColumns() << 8 |
|
1558 | - | (int) !$this->_phpSheet->getProtection()->getDeleteRows() << 9 |
|
1559 | - | (int) !$this->_phpSheet->getProtection()->getSelectLockedCells() << 10 |
|
1560 | - | (int) !$this->_phpSheet->getProtection()->getSort() << 11 |
|
1561 | - | (int) !$this->_phpSheet->getProtection()->getAutoFilter() << 12 |
|
1562 | - | (int) !$this->_phpSheet->getProtection()->getPivotTables() << 13 |
|
1563 | - | (int) !$this->_phpSheet->getProtection()->getSelectUnlockedCells() << 14 ; |
|
1549 | + $options = (int) ! $this->_phpSheet->getProtection()->getObjects() |
|
1550 | + | (int) ! $this->_phpSheet->getProtection()->getScenarios() << 1 |
|
1551 | + | (int) ! $this->_phpSheet->getProtection()->getFormatCells() << 2 |
|
1552 | + | (int) ! $this->_phpSheet->getProtection()->getFormatColumns() << 3 |
|
1553 | + | (int) ! $this->_phpSheet->getProtection()->getFormatRows() << 4 |
|
1554 | + | (int) ! $this->_phpSheet->getProtection()->getInsertColumns() << 5 |
|
1555 | + | (int) ! $this->_phpSheet->getProtection()->getInsertRows() << 6 |
|
1556 | + | (int) ! $this->_phpSheet->getProtection()->getInsertHyperlinks() << 7 |
|
1557 | + | (int) ! $this->_phpSheet->getProtection()->getDeleteColumns() << 8 |
|
1558 | + | (int) ! $this->_phpSheet->getProtection()->getDeleteRows() << 9 |
|
1559 | + | (int) ! $this->_phpSheet->getProtection()->getSelectLockedCells() << 10 |
|
1560 | + | (int) ! $this->_phpSheet->getProtection()->getSort() << 11 |
|
1561 | + | (int) ! $this->_phpSheet->getProtection()->getAutoFilter() << 12 |
|
1562 | + | (int) ! $this->_phpSheet->getProtection()->getPivotTables() << 13 |
|
1563 | + | (int) ! $this->_phpSheet->getProtection()->getSelectUnlockedCells() << 14; |
|
1564 | 1564 | |
1565 | 1565 | // record data |
1566 | 1566 | $recordData = pack( |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | $length = strlen($recordData); |
1579 | 1579 | $header = pack('vv', $record, $length); |
1580 | 1580 | |
1581 | - $this->_append($header . $recordData); |
|
1581 | + $this->_append($header.$recordData); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | /** |
@@ -1619,13 +1619,13 @@ discard block |
||
1619 | 1619 | hexdec($password) |
1620 | 1620 | ); |
1621 | 1621 | |
1622 | - $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); |
|
1622 | + $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p'.md5($recordData)); |
|
1623 | 1623 | |
1624 | 1624 | $length = strlen($recordData); |
1625 | 1625 | |
1626 | - $record = 0x0868; // Record identifier |
|
1626 | + $record = 0x0868; // Record identifier |
|
1627 | 1627 | $header = pack("vv", $record, $length); |
1628 | - $this->_append($header . $recordData); |
|
1628 | + $this->_append($header.$recordData); |
|
1629 | 1629 | } |
1630 | 1630 | } |
1631 | 1631 | |
@@ -1643,12 +1643,12 @@ discard block |
||
1643 | 1643 | */ |
1644 | 1644 | private function _writeExterncount($count) |
1645 | 1645 | { |
1646 | - $record = 0x0016; // Record identifier |
|
1647 | - $length = 0x0002; // Number of bytes to follow |
|
1646 | + $record = 0x0016; // Record identifier |
|
1647 | + $length = 0x0002; // Number of bytes to follow |
|
1648 | 1648 | |
1649 | 1649 | $header = pack("vv", $record, $length); |
1650 | - $data = pack("v", $count); |
|
1651 | - $this->_append($header . $data); |
|
1650 | + $data = pack("v", $count); |
|
1651 | + $this->_append($header.$data); |
|
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | /** |
@@ -1661,25 +1661,25 @@ discard block |
||
1661 | 1661 | */ |
1662 | 1662 | private function _writeExternsheet($sheetname) |
1663 | 1663 | { |
1664 | - $record = 0x0017; // Record identifier |
|
1664 | + $record = 0x0017; // Record identifier |
|
1665 | 1665 | |
1666 | 1666 | // References to the current sheet are encoded differently to references to |
1667 | 1667 | // external sheets. |
1668 | 1668 | // |
1669 | 1669 | if ($this->_phpSheet->getTitle() == $sheetname) { |
1670 | 1670 | $sheetname = ''; |
1671 | - $length = 0x02; // The following 2 bytes |
|
1672 | - $cch = 1; // The following byte |
|
1673 | - $rgch = 0x02; // Self reference |
|
1671 | + $length = 0x02; // The following 2 bytes |
|
1672 | + $cch = 1; // The following byte |
|
1673 | + $rgch = 0x02; // Self reference |
|
1674 | 1674 | } else { |
1675 | 1675 | $length = 0x02 + strlen($sheetname); |
1676 | 1676 | $cch = strlen($sheetname); |
1677 | - $rgch = 0x03; // Reference to a sheet in the current workbook |
|
1677 | + $rgch = 0x03; // Reference to a sheet in the current workbook |
|
1678 | 1678 | } |
1679 | 1679 | |
1680 | - $header = pack("vv", $record, $length); |
|
1680 | + $header = pack("vv", $record, $length); |
|
1681 | 1681 | $data = pack("CC", $cch, $rgch); |
1682 | - $this->_append($header . $data . $sheetname); |
|
1682 | + $this->_append($header.$data.$sheetname); |
|
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | /** |
@@ -1709,24 +1709,24 @@ discard block |
||
1709 | 1709 | } else { |
1710 | 1710 | $pnnAct = null; |
1711 | 1711 | } |
1712 | - $record = 0x0041; // Record identifier |
|
1713 | - $length = 0x000A; // Number of bytes to follow |
|
1712 | + $record = 0x0041; // Record identifier |
|
1713 | + $length = 0x000A; // Number of bytes to follow |
|
1714 | 1714 | |
1715 | 1715 | // Code specific to frozen or thawed panes. |
1716 | 1716 | if ($this->_phpSheet->getFreezePane()) { |
1717 | 1717 | // Set default values for $rwTop and $colLeft |
1718 | - if (!isset($rwTop)) { |
|
1718 | + if ( ! isset($rwTop)) { |
|
1719 | 1719 | $rwTop = $y; |
1720 | 1720 | } |
1721 | - if (!isset($colLeft)) { |
|
1721 | + if ( ! isset($colLeft)) { |
|
1722 | 1722 | $colLeft = $x; |
1723 | 1723 | } |
1724 | 1724 | } else { |
1725 | 1725 | // Set default values for $rwTop and $colLeft |
1726 | - if (!isset($rwTop)) { |
|
1726 | + if ( ! isset($rwTop)) { |
|
1727 | 1727 | $rwTop = 0; |
1728 | 1728 | } |
1729 | - if (!isset($colLeft)) { |
|
1729 | + if ( ! isset($colLeft)) { |
|
1730 | 1730 | $colLeft = 0; |
1731 | 1731 | } |
1732 | 1732 | |
@@ -1735,15 +1735,15 @@ discard block |
||
1735 | 1735 | // The default column width is 8.43 |
1736 | 1736 | // The following slope and intersection values were interpolated. |
1737 | 1737 | // |
1738 | - $y = 20*$y + 255; |
|
1739 | - $x = 113.879*$x + 390; |
|
1738 | + $y = 20 * $y + 255; |
|
1739 | + $x = 113.879 * $x + 390; |
|
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | |
1743 | 1743 | // Determine which pane should be active. There is also the undocumented |
1744 | 1744 | // option to override this should it be necessary: may be removed later. |
1745 | 1745 | // |
1746 | - if (!isset($pnnAct)) { |
|
1746 | + if ( ! isset($pnnAct)) { |
|
1747 | 1747 | if ($x != 0 && $y != 0) { |
1748 | 1748 | $pnnAct = 0; // Bottom right |
1749 | 1749 | } |
@@ -1760,9 +1760,9 @@ discard block |
||
1760 | 1760 | |
1761 | 1761 | $this->_active_pane = $pnnAct; // Used in _writeSelection |
1762 | 1762 | |
1763 | - $header = pack("vv", $record, $length); |
|
1763 | + $header = pack("vv", $record, $length); |
|
1764 | 1764 | $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct); |
1765 | - $this->_append($header . $data); |
|
1765 | + $this->_append($header.$data); |
|
1766 | 1766 | } |
1767 | 1767 | |
1768 | 1768 | /** |
@@ -1770,47 +1770,47 @@ discard block |
||
1770 | 1770 | */ |
1771 | 1771 | private function _writeSetup() |
1772 | 1772 | { |
1773 | - $record = 0x00A1; // Record identifier |
|
1774 | - $length = 0x0022; // Number of bytes to follow |
|
1773 | + $record = 0x00A1; // Record identifier |
|
1774 | + $length = 0x0022; // Number of bytes to follow |
|
1775 | 1775 | |
1776 | - $iPaperSize = $this->_phpSheet->getPageSetup()->getPaperSize(); // Paper size |
|
1776 | + $iPaperSize = $this->_phpSheet->getPageSetup()->getPaperSize(); // Paper size |
|
1777 | 1777 | |
1778 | 1778 | $iScale = $this->_phpSheet->getPageSetup()->getScale() ? |
1779 | - $this->_phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor |
|
1779 | + $this->_phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor |
|
1780 | 1780 | |
1781 | - $iPageStart = 0x01; // Starting page number |
|
1782 | - $iFitWidth = (int) $this->_phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide |
|
1783 | - $iFitHeight = (int) $this->_phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high |
|
1784 | - $grbit = 0x00; // Option flags |
|
1785 | - $iRes = 0x0258; // Print resolution |
|
1786 | - $iVRes = 0x0258; // Vertical print resolution |
|
1781 | + $iPageStart = 0x01; // Starting page number |
|
1782 | + $iFitWidth = (int) $this->_phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide |
|
1783 | + $iFitHeight = (int) $this->_phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high |
|
1784 | + $grbit = 0x00; // Option flags |
|
1785 | + $iRes = 0x0258; // Print resolution |
|
1786 | + $iVRes = 0x0258; // Vertical print resolution |
|
1787 | 1787 | |
1788 | - $numHdr = $this->_phpSheet->getPageMargins()->getHeader(); // Header Margin |
|
1788 | + $numHdr = $this->_phpSheet->getPageMargins()->getHeader(); // Header Margin |
|
1789 | 1789 | |
1790 | - $numFtr = $this->_phpSheet->getPageMargins()->getFooter(); // Footer Margin |
|
1791 | - $iCopies = 0x01; // Number of copies |
|
1790 | + $numFtr = $this->_phpSheet->getPageMargins()->getFooter(); // Footer Margin |
|
1791 | + $iCopies = 0x01; // Number of copies |
|
1792 | 1792 | |
1793 | - $fLeftToRight = 0x0; // Print over then down |
|
1793 | + $fLeftToRight = 0x0; // Print over then down |
|
1794 | 1794 | |
1795 | 1795 | // Page orientation |
1796 | 1796 | $fLandscape = ($this->_phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? |
1797 | 1797 | 0x0 : 0x1; |
1798 | 1798 | |
1799 | - $fNoPls = 0x0; // Setup not read from printer |
|
1800 | - $fNoColor = 0x0; // Print black and white |
|
1801 | - $fDraft = 0x0; // Print draft quality |
|
1802 | - $fNotes = 0x0; // Print notes |
|
1803 | - $fNoOrient = 0x0; // Orientation not set |
|
1804 | - $fUsePage = 0x0; // Use custom starting page |
|
1799 | + $fNoPls = 0x0; // Setup not read from printer |
|
1800 | + $fNoColor = 0x0; // Print black and white |
|
1801 | + $fDraft = 0x0; // Print draft quality |
|
1802 | + $fNotes = 0x0; // Print notes |
|
1803 | + $fNoOrient = 0x0; // Orientation not set |
|
1804 | + $fUsePage = 0x0; // Use custom starting page |
|
1805 | 1805 | |
1806 | 1806 | $grbit = $fLeftToRight; |
1807 | - $grbit |= $fLandscape << 1; |
|
1808 | - $grbit |= $fNoPls << 2; |
|
1809 | - $grbit |= $fNoColor << 3; |
|
1810 | - $grbit |= $fDraft << 4; |
|
1811 | - $grbit |= $fNotes << 5; |
|
1812 | - $grbit |= $fNoOrient << 6; |
|
1813 | - $grbit |= $fUsePage << 7; |
|
1807 | + $grbit |= $fLandscape << 1; |
|
1808 | + $grbit |= $fNoPls << 2; |
|
1809 | + $grbit |= $fNoColor << 3; |
|
1810 | + $grbit |= $fDraft << 4; |
|
1811 | + $grbit |= $fNotes << 5; |
|
1812 | + $grbit |= $fNoOrient << 6; |
|
1813 | + $grbit |= $fUsePage << 7; |
|
1814 | 1814 | |
1815 | 1815 | $numHdr = pack("d", $numHdr); |
1816 | 1816 | $numFtr = pack("d", $numFtr); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $iVRes); |
1831 | 1831 | $data2 = $numHdr.$numFtr; |
1832 | 1832 | $data3 = pack("v", $iCopies); |
1833 | - $this->_append($header . $data1 . $data2 . $data3); |
|
1833 | + $this->_append($header.$data1.$data2.$data3); |
|
1834 | 1834 | } |
1835 | 1835 | |
1836 | 1836 | /** |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | */ |
1839 | 1839 | private function _writeHeader() |
1840 | 1840 | { |
1841 | - $record = 0x0014; // Record identifier |
|
1841 | + $record = 0x0014; // Record identifier |
|
1842 | 1842 | |
1843 | 1843 | /* removing for now |
1844 | 1844 | // need to fix character count (multibyte!) |
@@ -1852,9 +1852,9 @@ discard block |
||
1852 | 1852 | $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddHeader()); |
1853 | 1853 | $length = strlen($recordData); |
1854 | 1854 | |
1855 | - $header = pack("vv", $record, $length); |
|
1855 | + $header = pack("vv", $record, $length); |
|
1856 | 1856 | |
1857 | - $this->_append($header . $recordData); |
|
1857 | + $this->_append($header.$recordData); |
|
1858 | 1858 | } |
1859 | 1859 | |
1860 | 1860 | /** |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | */ |
1863 | 1863 | private function _writeFooter() |
1864 | 1864 | { |
1865 | - $record = 0x0015; // Record identifier |
|
1865 | + $record = 0x0015; // Record identifier |
|
1866 | 1866 | |
1867 | 1867 | /* removing for now |
1868 | 1868 | // need to fix character count (multibyte!) |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | |
1879 | 1879 | $header = pack("vv", $record, $length); |
1880 | 1880 | |
1881 | - $this->_append($header . $recordData); |
|
1881 | + $this->_append($header.$recordData); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | /** |
@@ -1888,13 +1888,13 @@ discard block |
||
1888 | 1888 | */ |
1889 | 1889 | private function _writeHcenter() |
1890 | 1890 | { |
1891 | - $record = 0x0083; // Record identifier |
|
1892 | - $length = 0x0002; // Bytes to follow |
|
1891 | + $record = 0x0083; // Record identifier |
|
1892 | + $length = 0x0002; // Bytes to follow |
|
1893 | 1893 | |
1894 | - $fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering |
|
1894 | + $fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering |
|
1895 | 1895 | |
1896 | 1896 | $header = pack("vv", $record, $length); |
1897 | - $data = pack("v", $fHCenter); |
|
1897 | + $data = pack("v", $fHCenter); |
|
1898 | 1898 | |
1899 | 1899 | $this->_append($header.$data); |
1900 | 1900 | } |
@@ -1904,14 +1904,14 @@ discard block |
||
1904 | 1904 | */ |
1905 | 1905 | private function _writeVcenter() |
1906 | 1906 | { |
1907 | - $record = 0x0084; // Record identifier |
|
1908 | - $length = 0x0002; // Bytes to follow |
|
1907 | + $record = 0x0084; // Record identifier |
|
1908 | + $length = 0x0002; // Bytes to follow |
|
1909 | 1909 | |
1910 | - $fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering |
|
1910 | + $fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering |
|
1911 | 1911 | |
1912 | 1912 | $header = pack("vv", $record, $length); |
1913 | - $data = pack("v", $fVCenter); |
|
1914 | - $this->_append($header . $data); |
|
1913 | + $data = pack("v", $fVCenter); |
|
1914 | + $this->_append($header.$data); |
|
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | /** |
@@ -1919,18 +1919,18 @@ discard block |
||
1919 | 1919 | */ |
1920 | 1920 | private function _writeMarginLeft() |
1921 | 1921 | { |
1922 | - $record = 0x0026; // Record identifier |
|
1923 | - $length = 0x0008; // Bytes to follow |
|
1922 | + $record = 0x0026; // Record identifier |
|
1923 | + $length = 0x0008; // Bytes to follow |
|
1924 | 1924 | |
1925 | - $margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches |
|
1925 | + $margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches |
|
1926 | 1926 | |
1927 | - $header = pack("vv", $record, $length); |
|
1928 | - $data = pack("d", $margin); |
|
1927 | + $header = pack("vv", $record, $length); |
|
1928 | + $data = pack("d", $margin); |
|
1929 | 1929 | if (self::getByteOrder()) { // if it's Big Endian |
1930 | 1930 | $data = strrev($data); |
1931 | 1931 | } |
1932 | 1932 | |
1933 | - $this->_append($header . $data); |
|
1933 | + $this->_append($header.$data); |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | /** |
@@ -1938,18 +1938,18 @@ discard block |
||
1938 | 1938 | */ |
1939 | 1939 | private function _writeMarginRight() |
1940 | 1940 | { |
1941 | - $record = 0x0027; // Record identifier |
|
1942 | - $length = 0x0008; // Bytes to follow |
|
1941 | + $record = 0x0027; // Record identifier |
|
1942 | + $length = 0x0008; // Bytes to follow |
|
1943 | 1943 | |
1944 | - $margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches |
|
1944 | + $margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches |
|
1945 | 1945 | |
1946 | - $header = pack("vv", $record, $length); |
|
1947 | - $data = pack("d", $margin); |
|
1946 | + $header = pack("vv", $record, $length); |
|
1947 | + $data = pack("d", $margin); |
|
1948 | 1948 | if (self::getByteOrder()) { // if it's Big Endian |
1949 | 1949 | $data = strrev($data); |
1950 | 1950 | } |
1951 | 1951 | |
1952 | - $this->_append($header . $data); |
|
1952 | + $this->_append($header.$data); |
|
1953 | 1953 | } |
1954 | 1954 | |
1955 | 1955 | /** |
@@ -1957,18 +1957,18 @@ discard block |
||
1957 | 1957 | */ |
1958 | 1958 | private function _writeMarginTop() |
1959 | 1959 | { |
1960 | - $record = 0x0028; // Record identifier |
|
1961 | - $length = 0x0008; // Bytes to follow |
|
1960 | + $record = 0x0028; // Record identifier |
|
1961 | + $length = 0x0008; // Bytes to follow |
|
1962 | 1962 | |
1963 | - $margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches |
|
1963 | + $margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches |
|
1964 | 1964 | |
1965 | - $header = pack("vv", $record, $length); |
|
1966 | - $data = pack("d", $margin); |
|
1965 | + $header = pack("vv", $record, $length); |
|
1966 | + $data = pack("d", $margin); |
|
1967 | 1967 | if (self::getByteOrder()) { // if it's Big Endian |
1968 | 1968 | $data = strrev($data); |
1969 | 1969 | } |
1970 | 1970 | |
1971 | - $this->_append($header . $data); |
|
1971 | + $this->_append($header.$data); |
|
1972 | 1972 | } |
1973 | 1973 | |
1974 | 1974 | /** |
@@ -1976,18 +1976,18 @@ discard block |
||
1976 | 1976 | */ |
1977 | 1977 | private function _writeMarginBottom() |
1978 | 1978 | { |
1979 | - $record = 0x0029; // Record identifier |
|
1980 | - $length = 0x0008; // Bytes to follow |
|
1979 | + $record = 0x0029; // Record identifier |
|
1980 | + $length = 0x0008; // Bytes to follow |
|
1981 | 1981 | |
1982 | - $margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches |
|
1982 | + $margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches |
|
1983 | 1983 | |
1984 | - $header = pack("vv", $record, $length); |
|
1985 | - $data = pack("d", $margin); |
|
1984 | + $header = pack("vv", $record, $length); |
|
1985 | + $data = pack("d", $margin); |
|
1986 | 1986 | if (self::getByteOrder()) { // if it's Big Endian |
1987 | 1987 | $data = strrev($data); |
1988 | 1988 | } |
1989 | 1989 | |
1990 | - $this->_append($header . $data); |
|
1990 | + $this->_append($header.$data); |
|
1991 | 1991 | } |
1992 | 1992 | |
1993 | 1993 | /** |
@@ -1995,14 +1995,14 @@ discard block |
||
1995 | 1995 | */ |
1996 | 1996 | private function _writePrintHeaders() |
1997 | 1997 | { |
1998 | - $record = 0x002a; // Record identifier |
|
1999 | - $length = 0x0002; // Bytes to follow |
|
1998 | + $record = 0x002a; // Record identifier |
|
1999 | + $length = 0x0002; // Bytes to follow |
|
2000 | 2000 | |
2001 | - $fPrintRwCol = $this->_print_headers; // Boolean flag |
|
2001 | + $fPrintRwCol = $this->_print_headers; // Boolean flag |
|
2002 | 2002 | |
2003 | - $header = pack("vv", $record, $length); |
|
2004 | - $data = pack("v", $fPrintRwCol); |
|
2005 | - $this->_append($header . $data); |
|
2003 | + $header = pack("vv", $record, $length); |
|
2004 | + $data = pack("v", $fPrintRwCol); |
|
2005 | + $this->_append($header.$data); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | /** |
@@ -2011,14 +2011,14 @@ discard block |
||
2011 | 2011 | */ |
2012 | 2012 | private function _writePrintGridlines() |
2013 | 2013 | { |
2014 | - $record = 0x002b; // Record identifier |
|
2015 | - $length = 0x0002; // Bytes to follow |
|
2014 | + $record = 0x002b; // Record identifier |
|
2015 | + $length = 0x0002; // Bytes to follow |
|
2016 | 2016 | |
2017 | - $fPrintGrid = $this->_phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag |
|
2017 | + $fPrintGrid = $this->_phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag |
|
2018 | 2018 | |
2019 | - $header = pack("vv", $record, $length); |
|
2020 | - $data = pack("v", $fPrintGrid); |
|
2021 | - $this->_append($header . $data); |
|
2019 | + $header = pack("vv", $record, $length); |
|
2020 | + $data = pack("v", $fPrintGrid); |
|
2021 | + $this->_append($header.$data); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | /** |
@@ -2027,14 +2027,14 @@ discard block |
||
2027 | 2027 | */ |
2028 | 2028 | private function _writeGridset() |
2029 | 2029 | { |
2030 | - $record = 0x0082; // Record identifier |
|
2031 | - $length = 0x0002; // Bytes to follow |
|
2030 | + $record = 0x0082; // Record identifier |
|
2031 | + $length = 0x0002; // Bytes to follow |
|
2032 | 2032 | |
2033 | - $fGridSet = !$this->_phpSheet->getPrintGridlines(); // Boolean flag |
|
2033 | + $fGridSet = ! $this->_phpSheet->getPrintGridlines(); // Boolean flag |
|
2034 | 2034 | |
2035 | - $header = pack("vv", $record, $length); |
|
2036 | - $data = pack("v", $fGridSet); |
|
2037 | - $this->_append($header . $data); |
|
2035 | + $header = pack("vv", $record, $length); |
|
2036 | + $data = pack("v", $fGridSet); |
|
2037 | + $this->_append($header.$data); |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | /** |
@@ -2046,11 +2046,11 @@ discard block |
||
2046 | 2046 | */ |
2047 | 2047 | private function _writeGuts() |
2048 | 2048 | { |
2049 | - $record = 0x0080; // Record identifier |
|
2050 | - $length = 0x0008; // Bytes to follow |
|
2049 | + $record = 0x0080; // Record identifier |
|
2050 | + $length = 0x0008; // Bytes to follow |
|
2051 | 2051 | |
2052 | - $dxRwGut = 0x0000; // Size of row gutter |
|
2053 | - $dxColGut = 0x0000; // Size of col gutter |
|
2052 | + $dxRwGut = 0x0000; // Size of row gutter |
|
2053 | + $dxColGut = 0x0000; // Size of col gutter |
|
2054 | 2054 | |
2055 | 2055 | // determine maximum row outline level |
2056 | 2056 | $maxRowOutlineLevel = 0; |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel()); |
2059 | 2059 | } |
2060 | 2060 | |
2061 | - $col_level = 0; |
|
2061 | + $col_level = 0; |
|
2062 | 2062 | |
2063 | 2063 | // Calculate the maximum column outline level. The equivalent calculation |
2064 | 2064 | // for the row outline level is carried out in _writeRow(). |
@@ -2078,8 +2078,8 @@ discard block |
||
2078 | 2078 | ++$col_level; |
2079 | 2079 | } |
2080 | 2080 | |
2081 | - $header = pack("vv", $record, $length); |
|
2082 | - $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); |
|
2081 | + $header = pack("vv", $record, $length); |
|
2082 | + $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); |
|
2083 | 2083 | |
2084 | 2084 | $this->_append($header.$data); |
2085 | 2085 | } |
@@ -2090,15 +2090,15 @@ discard block |
||
2090 | 2090 | */ |
2091 | 2091 | private function _writeWsbool() |
2092 | 2092 | { |
2093 | - $record = 0x0081; // Record identifier |
|
2094 | - $length = 0x0002; // Bytes to follow |
|
2093 | + $record = 0x0081; // Record identifier |
|
2094 | + $length = 0x0002; // Bytes to follow |
|
2095 | 2095 | $grbit = 0x0000; |
2096 | 2096 | |
2097 | 2097 | // The only option that is of interest is the flag for fit to page. So we |
2098 | 2098 | // set all the options in one go. |
2099 | 2099 | // |
2100 | 2100 | // Set the option flags |
2101 | - $grbit |= 0x0001; // Auto page breaks visible |
|
2101 | + $grbit |= 0x0001; // Auto page breaks visible |
|
2102 | 2102 | if ($this->_outline_style) { |
2103 | 2103 | $grbit |= 0x0020; // Auto outline styles |
2104 | 2104 | } |
@@ -2115,9 +2115,9 @@ discard block |
||
2115 | 2115 | $grbit |= 0x0400; // Outline symbols displayed |
2116 | 2116 | } |
2117 | 2117 | |
2118 | - $header = pack("vv", $record, $length); |
|
2119 | - $data = pack("v", $grbit); |
|
2120 | - $this->_append($header . $data); |
|
2118 | + $header = pack("vv", $record, $length); |
|
2119 | + $data = pack("v", $grbit); |
|
2120 | + $this->_append($header.$data); |
|
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | /** |
@@ -2153,7 +2153,7 @@ discard block |
||
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | //horizontal page breaks |
2156 | - if (!empty($hbreaks)) { |
|
2156 | + if ( ! empty($hbreaks)) { |
|
2157 | 2157 | |
2158 | 2158 | // Sort and filter array of page breaks |
2159 | 2159 | sort($hbreaks, SORT_NUMERIC); |
@@ -2161,23 +2161,23 @@ discard block |
||
2161 | 2161 | array_shift($hbreaks); |
2162 | 2162 | } |
2163 | 2163 | |
2164 | - $record = 0x001b; // Record identifier |
|
2165 | - $cbrk = count($hbreaks); // Number of page breaks |
|
2166 | - $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2164 | + $record = 0x001b; // Record identifier |
|
2165 | + $cbrk = count($hbreaks); // Number of page breaks |
|
2166 | + $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2167 | 2167 | |
2168 | 2168 | $header = pack("vv", $record, $length); |
2169 | - $data = pack("v", $cbrk); |
|
2169 | + $data = pack("v", $cbrk); |
|
2170 | 2170 | |
2171 | 2171 | // Append each page break |
2172 | 2172 | foreach ($hbreaks as $hbreak) { |
2173 | 2173 | $data .= pack("vvv", $hbreak, 0x0000, 0x00ff); |
2174 | 2174 | } |
2175 | 2175 | |
2176 | - $this->_append($header . $data); |
|
2176 | + $this->_append($header.$data); |
|
2177 | 2177 | } |
2178 | 2178 | |
2179 | 2179 | // vertical page breaks |
2180 | - if (!empty($vbreaks)) { |
|
2180 | + if ( ! empty($vbreaks)) { |
|
2181 | 2181 | |
2182 | 2182 | // 1000 vertical pagebreaks appears to be an internal Excel 5 limit. |
2183 | 2183 | // It is slightly higher in Excel 97/200, approx. 1026 |
@@ -2189,19 +2189,19 @@ discard block |
||
2189 | 2189 | array_shift($vbreaks); |
2190 | 2190 | } |
2191 | 2191 | |
2192 | - $record = 0x001a; // Record identifier |
|
2193 | - $cbrk = count($vbreaks); // Number of page breaks |
|
2194 | - $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2192 | + $record = 0x001a; // Record identifier |
|
2193 | + $cbrk = count($vbreaks); // Number of page breaks |
|
2194 | + $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2195 | 2195 | |
2196 | - $header = pack("vv", $record, $length); |
|
2197 | - $data = pack("v", $cbrk); |
|
2196 | + $header = pack("vv", $record, $length); |
|
2197 | + $data = pack("v", $cbrk); |
|
2198 | 2198 | |
2199 | 2199 | // Append each page break |
2200 | 2200 | foreach ($vbreaks as $vbreak) { |
2201 | 2201 | $data .= pack("vvv", $vbreak, 0x0000, 0xffff); |
2202 | 2202 | } |
2203 | 2203 | |
2204 | - $this->_append($header . $data); |
|
2204 | + $this->_append($header.$data); |
|
2205 | 2205 | } |
2206 | 2206 | } |
2207 | 2207 | |
@@ -2211,17 +2211,17 @@ discard block |
||
2211 | 2211 | private function _writeProtect() |
2212 | 2212 | { |
2213 | 2213 | // Exit unless sheet protection has been specified |
2214 | - if (!$this->_phpSheet->getProtection()->getSheet()) { |
|
2214 | + if ( ! $this->_phpSheet->getProtection()->getSheet()) { |
|
2215 | 2215 | return; |
2216 | 2216 | } |
2217 | 2217 | |
2218 | - $record = 0x0012; // Record identifier |
|
2219 | - $length = 0x0002; // Bytes to follow |
|
2218 | + $record = 0x0012; // Record identifier |
|
2219 | + $length = 0x0002; // Bytes to follow |
|
2220 | 2220 | |
2221 | - $fLock = 1; // Worksheet is protected |
|
2221 | + $fLock = 1; // Worksheet is protected |
|
2222 | 2222 | |
2223 | 2223 | $header = pack("vv", $record, $length); |
2224 | - $data = pack("v", $fLock); |
|
2224 | + $data = pack("v", $fLock); |
|
2225 | 2225 | |
2226 | 2226 | $this->_append($header.$data); |
2227 | 2227 | } |
@@ -2232,12 +2232,12 @@ discard block |
||
2232 | 2232 | private function _writeScenProtect() |
2233 | 2233 | { |
2234 | 2234 | // Exit if sheet protection is not active |
2235 | - if (!$this->_phpSheet->getProtection()->getSheet()) { |
|
2235 | + if ( ! $this->_phpSheet->getProtection()->getSheet()) { |
|
2236 | 2236 | return; |
2237 | 2237 | } |
2238 | 2238 | |
2239 | 2239 | // Exit if scenarios are not protected |
2240 | - if (!$this->_phpSheet->getProtection()->getScenarios()) { |
|
2240 | + if ( ! $this->_phpSheet->getProtection()->getScenarios()) { |
|
2241 | 2241 | return; |
2242 | 2242 | } |
2243 | 2243 | |
@@ -2247,7 +2247,7 @@ discard block |
||
2247 | 2247 | $header = pack('vv', $record, $length); |
2248 | 2248 | $data = pack('v', 1); |
2249 | 2249 | |
2250 | - $this->_append($header . $data); |
|
2250 | + $this->_append($header.$data); |
|
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | /** |
@@ -2256,12 +2256,12 @@ discard block |
||
2256 | 2256 | private function _writeObjectProtect() |
2257 | 2257 | { |
2258 | 2258 | // Exit if sheet protection is not active |
2259 | - if (!$this->_phpSheet->getProtection()->getSheet()) { |
|
2259 | + if ( ! $this->_phpSheet->getProtection()->getSheet()) { |
|
2260 | 2260 | return; |
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | // Exit if objects are not protected |
2264 | - if (!$this->_phpSheet->getProtection()->getObjects()) { |
|
2264 | + if ( ! $this->_phpSheet->getProtection()->getObjects()) { |
|
2265 | 2265 | return; |
2266 | 2266 | } |
2267 | 2267 | |
@@ -2271,7 +2271,7 @@ discard block |
||
2271 | 2271 | $header = pack('vv', $record, $length); |
2272 | 2272 | $data = pack('v', 1); |
2273 | 2273 | |
2274 | - $this->_append($header . $data); |
|
2274 | + $this->_append($header.$data); |
|
2275 | 2275 | } |
2276 | 2276 | |
2277 | 2277 | /** |
@@ -2280,19 +2280,19 @@ discard block |
||
2280 | 2280 | private function _writePassword() |
2281 | 2281 | { |
2282 | 2282 | // Exit unless sheet protection and password have been specified |
2283 | - if (!$this->_phpSheet->getProtection()->getSheet() || !$this->_phpSheet->getProtection()->getPassword()) { |
|
2283 | + if ( ! $this->_phpSheet->getProtection()->getSheet() || ! $this->_phpSheet->getProtection()->getPassword()) { |
|
2284 | 2284 | return; |
2285 | 2285 | } |
2286 | 2286 | |
2287 | - $record = 0x0013; // Record identifier |
|
2288 | - $length = 0x0002; // Bytes to follow |
|
2287 | + $record = 0x0013; // Record identifier |
|
2288 | + $length = 0x0002; // Bytes to follow |
|
2289 | 2289 | |
2290 | - $wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password |
|
2290 | + $wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password |
|
2291 | 2291 | |
2292 | - $header = pack("vv", $record, $length); |
|
2293 | - $data = pack("v", $wPassword); |
|
2292 | + $header = pack("vv", $record, $length); |
|
2293 | + $data = pack("v", $wPassword); |
|
2294 | 2294 | |
2295 | - $this->_append($header . $data); |
|
2295 | + $this->_append($header.$data); |
|
2296 | 2296 | } |
2297 | 2297 | |
2298 | 2298 | /** |
@@ -2326,7 +2326,7 @@ discard block |
||
2326 | 2326 | $env = 0x01; |
2327 | 2327 | $lcb = $size; |
2328 | 2328 | |
2329 | - $header = pack("vvvvV", $record, $length, $cf, $env, $lcb); |
|
2329 | + $header = pack("vvvvV", $record, $length, $cf, $env, $lcb); |
|
2330 | 2330 | $this->_append($header.$data); |
2331 | 2331 | } |
2332 | 2332 | |
@@ -2384,8 +2384,8 @@ discard block |
||
2384 | 2384 | function _positionImage($col_start, $row_start, $x1, $y1, $width, $height) |
2385 | 2385 | { |
2386 | 2386 | // Initialise end cell to the same as the start cell |
2387 | - $col_end = $col_start; // Col containing lower right corner of object |
|
2388 | - $row_end = $row_start; // Row containing bottom right corner of object |
|
2387 | + $col_end = $col_start; // Col containing lower right corner of object |
|
2388 | + $row_end = $row_start; // Row containing bottom right corner of object |
|
2389 | 2389 | |
2390 | 2390 | // Zero the specified offset if greater than the cell dimensions |
2391 | 2391 | if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { |
@@ -2395,8 +2395,8 @@ discard block |
||
2395 | 2395 | $y1 = 0; |
2396 | 2396 | } |
2397 | 2397 | |
2398 | - $width = $width + $x1 -1; |
|
2399 | - $height = $height + $y1 -1; |
|
2398 | + $width = $width + $x1 - 1; |
|
2399 | + $height = $height + $y1 - 1; |
|
2400 | 2400 | |
2401 | 2401 | // Subtract the underlying cell widths to find the end cell of the image |
2402 | 2402 | while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { |
@@ -2416,21 +2416,21 @@ discard block |
||
2416 | 2416 | if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { |
2417 | 2417 | return; |
2418 | 2418 | } |
2419 | - if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { |
|
2419 | + if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { |
|
2420 | 2420 | return; |
2421 | 2421 | } |
2422 | 2422 | if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) == 0) { |
2423 | 2423 | return; |
2424 | 2424 | } |
2425 | - if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) { |
|
2425 | + if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) { |
|
2426 | 2426 | return; |
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | // Convert the pixel values to the percentage value expected by Excel |
2430 | - $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; |
|
2431 | - $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256; |
|
2432 | - $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object |
|
2433 | - $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object |
|
2430 | + $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; |
|
2431 | + $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256; |
|
2432 | + $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object |
|
2433 | + $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object |
|
2434 | 2434 | |
2435 | 2435 | $this->_writeObjPicture($col_start, $x1, |
2436 | 2436 | $row_start, $y1, |
@@ -2451,39 +2451,39 @@ discard block |
||
2451 | 2451 | * @param integer $rwB Row containing bottom right corner of object |
2452 | 2452 | * @param integer $dyB Distance from bottom of cell |
2453 | 2453 | */ |
2454 | - private function _writeObjPicture($colL,$dxL,$rwT,$dyT,$colR,$dxR,$rwB,$dyB) |
|
2454 | + private function _writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB) |
|
2455 | 2455 | { |
2456 | - $record = 0x005d; // Record identifier |
|
2457 | - $length = 0x003c; // Bytes to follow |
|
2458 | - |
|
2459 | - $cObj = 0x0001; // Count of objects in file (set to 1) |
|
2460 | - $OT = 0x0008; // Object type. 8 = Picture |
|
2461 | - $id = 0x0001; // Object ID |
|
2462 | - $grbit = 0x0614; // Option flags |
|
2463 | - |
|
2464 | - $cbMacro = 0x0000; // Length of FMLA structure |
|
2465 | - $Reserved1 = 0x0000; // Reserved |
|
2466 | - $Reserved2 = 0x0000; // Reserved |
|
2467 | - |
|
2468 | - $icvBack = 0x09; // Background colour |
|
2469 | - $icvFore = 0x09; // Foreground colour |
|
2470 | - $fls = 0x00; // Fill pattern |
|
2471 | - $fAuto = 0x00; // Automatic fill |
|
2472 | - $icv = 0x08; // Line colour |
|
2473 | - $lns = 0xff; // Line style |
|
2474 | - $lnw = 0x01; // Line weight |
|
2475 | - $fAutoB = 0x00; // Automatic border |
|
2476 | - $frs = 0x0000; // Frame style |
|
2477 | - $cf = 0x0009; // Image format, 9 = bitmap |
|
2478 | - $Reserved3 = 0x0000; // Reserved |
|
2479 | - $cbPictFmla = 0x0000; // Length of FMLA structure |
|
2480 | - $Reserved4 = 0x0000; // Reserved |
|
2481 | - $grbit2 = 0x0001; // Option flags |
|
2482 | - $Reserved5 = 0x0000; // Reserved |
|
2456 | + $record = 0x005d; // Record identifier |
|
2457 | + $length = 0x003c; // Bytes to follow |
|
2458 | + |
|
2459 | + $cObj = 0x0001; // Count of objects in file (set to 1) |
|
2460 | + $OT = 0x0008; // Object type. 8 = Picture |
|
2461 | + $id = 0x0001; // Object ID |
|
2462 | + $grbit = 0x0614; // Option flags |
|
2463 | + |
|
2464 | + $cbMacro = 0x0000; // Length of FMLA structure |
|
2465 | + $Reserved1 = 0x0000; // Reserved |
|
2466 | + $Reserved2 = 0x0000; // Reserved |
|
2467 | + |
|
2468 | + $icvBack = 0x09; // Background colour |
|
2469 | + $icvFore = 0x09; // Foreground colour |
|
2470 | + $fls = 0x00; // Fill pattern |
|
2471 | + $fAuto = 0x00; // Automatic fill |
|
2472 | + $icv = 0x08; // Line colour |
|
2473 | + $lns = 0xff; // Line style |
|
2474 | + $lnw = 0x01; // Line weight |
|
2475 | + $fAutoB = 0x00; // Automatic border |
|
2476 | + $frs = 0x0000; // Frame style |
|
2477 | + $cf = 0x0009; // Image format, 9 = bitmap |
|
2478 | + $Reserved3 = 0x0000; // Reserved |
|
2479 | + $cbPictFmla = 0x0000; // Length of FMLA structure |
|
2480 | + $Reserved4 = 0x0000; // Reserved |
|
2481 | + $grbit2 = 0x0001; // Option flags |
|
2482 | + $Reserved5 = 0x0000; // Reserved |
|
2483 | 2483 | |
2484 | 2484 | |
2485 | 2485 | $header = pack("vv", $record, $length); |
2486 | - $data = pack("V", $cObj); |
|
2486 | + $data = pack("V", $cObj); |
|
2487 | 2487 | $data .= pack("v", $OT); |
2488 | 2488 | $data .= pack("v", $id); |
2489 | 2489 | $data .= pack("v", $grbit); |
@@ -2514,7 +2514,7 @@ discard block |
||
2514 | 2514 | $data .= pack("v", $grbit2); |
2515 | 2515 | $data .= pack("V", $Reserved5); |
2516 | 2516 | |
2517 | - $this->_append($header . $data); |
|
2517 | + $this->_append($header.$data); |
|
2518 | 2518 | } |
2519 | 2519 | |
2520 | 2520 | /** |
@@ -2529,16 +2529,16 @@ discard block |
||
2529 | 2529 | $height = imagesy($image); |
2530 | 2530 | |
2531 | 2531 | $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); |
2532 | - for ($j=$height; $j--; ) { |
|
2533 | - for ($i=0; $i < $width; ++$i) { |
|
2532 | + for ($j = $height; $j--;) { |
|
2533 | + for ($i = 0; $i < $width; ++$i) { |
|
2534 | 2534 | $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); |
2535 | 2535 | foreach (array("red", "green", "blue") as $key) { |
2536 | 2536 | $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127); |
2537 | 2537 | } |
2538 | - $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]); |
|
2538 | + $data .= chr($color["blue"]).chr($color["green"]).chr($color["red"]); |
|
2539 | 2539 | } |
2540 | - if (3*$width % 4) { |
|
2541 | - $data .= str_repeat("\x00", 4 - 3*$width % 4); |
|
2540 | + if (3 * $width % 4) { |
|
2541 | + $data .= str_repeat("\x00", 4 - 3 * $width % 4); |
|
2542 | 2542 | } |
2543 | 2543 | } |
2544 | 2544 | |
@@ -2557,8 +2557,8 @@ discard block |
||
2557 | 2557 | function _processBitmap($bitmap) |
2558 | 2558 | { |
2559 | 2559 | // Open file. |
2560 | - $bmp_fd = @fopen($bitmap,"rb"); |
|
2561 | - if (!$bmp_fd) { |
|
2560 | + $bmp_fd = @fopen($bitmap, "rb"); |
|
2561 | + if ( ! $bmp_fd) { |
|
2562 | 2562 | throw new Exception("Couldn't import $bitmap"); |
2563 | 2563 | } |
2564 | 2564 | |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | // Read and remove the bitmap size. This is more reliable than reading |
2583 | 2583 | // the data size at offset 0x22. |
2584 | 2584 | // |
2585 | - $size_array = unpack("Vsa", substr($data, 0, 4)); |
|
2585 | + $size_array = unpack("Vsa", substr($data, 0, 4)); |
|
2586 | 2586 | $size = $size_array['sa']; |
2587 | 2587 | $data = substr($data, 4); |
2588 | 2588 | $size -= 0x36; // Subtract size of bitmap header. |
@@ -2626,8 +2626,8 @@ discard block |
||
2626 | 2626 | $data = substr($data, 20); |
2627 | 2627 | |
2628 | 2628 | // Add the BITMAPCOREHEADER data |
2629 | - $header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); |
|
2630 | - $data = $header . $data; |
|
2629 | + $header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); |
|
2630 | + $data = $header.$data; |
|
2631 | 2631 | |
2632 | 2632 | return (array($width, $height, $size, $data)); |
2633 | 2633 | } |
@@ -2643,12 +2643,12 @@ discard block |
||
2643 | 2643 | return; |
2644 | 2644 | } |
2645 | 2645 | |
2646 | - $record = 0x00A0; // Record identifier |
|
2647 | - $length = 0x0004; // Bytes to follow |
|
2646 | + $record = 0x00A0; // Record identifier |
|
2647 | + $length = 0x0004; // Bytes to follow |
|
2648 | 2648 | |
2649 | 2649 | $header = pack("vv", $record, $length); |
2650 | - $data = pack("vv", $this->_phpSheet->getSheetView()->getZoomScale(), 100); |
|
2651 | - $this->_append($header . $data); |
|
2650 | + $data = pack("vv", $this->_phpSheet->getSheetView()->getZoomScale(), 100); |
|
2651 | + $this->_append($header.$data); |
|
2652 | 2652 | } |
2653 | 2653 | |
2654 | 2654 | /** |
@@ -2689,16 +2689,16 @@ discard block |
||
2689 | 2689 | $nm = count($spOffsets) - 1; // number of shapes excluding first shape |
2690 | 2690 | for ($i = 1; $i <= $nm; ++$i) { |
2691 | 2691 | // MSODRAWING record |
2692 | - $record = 0x00EC; // Record identifier |
|
2692 | + $record = 0x00EC; // Record identifier |
|
2693 | 2693 | |
2694 | 2694 | // chunk of Escher stream for one shape |
2695 | 2695 | |
2696 | - $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]); |
|
2696 | + $dataChunk = substr($data, $spOffsets[$i - 1], $spOffsets[$i] - $spOffsets[$i - 1]); |
|
2697 | 2697 | |
2698 | 2698 | $length = strlen($dataChunk); |
2699 | 2699 | $header = pack("vv", $record, $length); |
2700 | 2700 | |
2701 | - $this->_append($header . $dataChunk); |
|
2701 | + $this->_append($header.$dataChunk); |
|
2702 | 2702 | |
2703 | 2703 | // OBJ record |
2704 | 2704 | $record = 0x005D; // record identifier |
@@ -2725,7 +2725,7 @@ discard block |
||
2725 | 2725 | |
2726 | 2726 | $length = strlen($objData); |
2727 | 2727 | $header = pack('vv', $record, $length); |
2728 | - $this->_append($header . $objData); |
|
2728 | + $this->_append($header.$objData); |
|
2729 | 2729 | } |
2730 | 2730 | } |
2731 | 2731 | } |
@@ -2739,24 +2739,24 @@ discard block |
||
2739 | 2739 | $dataValidationCollection = $this->_phpSheet->getDataValidationCollection(); |
2740 | 2740 | |
2741 | 2741 | // Write data validations? |
2742 | - if (!empty($dataValidationCollection)) { |
|
2742 | + if ( ! empty($dataValidationCollection)) { |
|
2743 | 2743 | |
2744 | 2744 | // DATAVALIDATIONS record |
2745 | - $record = 0x01B2; // Record identifier |
|
2746 | - $length = 0x0012; // Bytes to follow |
|
2745 | + $record = 0x01B2; // Record identifier |
|
2746 | + $length = 0x0012; // Bytes to follow |
|
2747 | 2747 | |
2748 | - $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records |
|
2749 | - $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position |
|
2750 | - $verPos = 0x00000000; // Vertical position of prompt box, if fixed position |
|
2751 | - $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible |
|
2748 | + $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records |
|
2749 | + $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position |
|
2750 | + $verPos = 0x00000000; // Vertical position of prompt box, if fixed position |
|
2751 | + $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible |
|
2752 | 2752 | |
2753 | 2753 | $header = pack('vv', $record, $length); |
2754 | - $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, |
|
2754 | + $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, |
|
2755 | 2755 | count($dataValidationCollection)); |
2756 | 2756 | $this->_append($header.$data); |
2757 | 2757 | |
2758 | 2758 | // DATAVALIDATION records |
2759 | - $record = 0x01BE; // Record identifier |
|
2759 | + $record = 0x01BE; // Record identifier |
|
2760 | 2760 | |
2761 | 2761 | foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) { |
2762 | 2762 | // initialize record data |
@@ -2768,36 +2768,36 @@ discard block |
||
2768 | 2768 | // data type |
2769 | 2769 | $type = $dataValidation->getType(); |
2770 | 2770 | switch ($type) { |
2771 | - case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break; |
|
2772 | - case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break; |
|
2773 | - case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break; |
|
2774 | - case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break; |
|
2775 | - case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break; |
|
2776 | - case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break; |
|
2777 | - case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break; |
|
2778 | - case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break; |
|
2771 | + case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break; |
|
2772 | + case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break; |
|
2773 | + case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break; |
|
2774 | + case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break; |
|
2775 | + case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break; |
|
2776 | + case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break; |
|
2777 | + case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break; |
|
2778 | + case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break; |
|
2779 | 2779 | } |
2780 | 2780 | $options |= $type << 0; |
2781 | 2781 | |
2782 | 2782 | // error style |
2783 | 2783 | $errorStyle = $dataValidation->getType(); |
2784 | 2784 | switch ($errorStyle) { |
2785 | - case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break; |
|
2786 | - case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break; |
|
2787 | - case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break; |
|
2785 | + case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break; |
|
2786 | + case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break; |
|
2787 | + case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break; |
|
2788 | 2788 | } |
2789 | 2789 | $options |= $errorStyle << 4; |
2790 | 2790 | |
2791 | 2791 | // explicit formula? |
2792 | 2792 | if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) { |
2793 | - $options |= 0x01 << 7; |
|
2793 | + $options |= 0x01 << 7; |
|
2794 | 2794 | } |
2795 | 2795 | |
2796 | 2796 | // empty cells allowed |
2797 | 2797 | $options |= $dataValidation->getAllowBlank() << 8; |
2798 | 2798 | |
2799 | 2799 | // show drop down |
2800 | - $options |= (!$dataValidation->getShowDropDown()) << 9; |
|
2800 | + $options |= ( ! $dataValidation->getShowDropDown()) << 9; |
|
2801 | 2801 | |
2802 | 2802 | // show input message |
2803 | 2803 | $options |= $dataValidation->getShowInputMessage() << 18; |
@@ -2808,18 +2808,18 @@ discard block |
||
2808 | 2808 | // condition operator |
2809 | 2809 | $operator = $dataValidation->getOperator(); |
2810 | 2810 | switch ($operator) { |
2811 | - case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break; |
|
2812 | - case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break; |
|
2813 | - case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break; |
|
2814 | - case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break; |
|
2815 | - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break; |
|
2816 | - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break; |
|
2817 | - case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break; |
|
2818 | - case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break; |
|
2811 | + case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00; break; |
|
2812 | + case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01; break; |
|
2813 | + case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02; break; |
|
2814 | + case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03; break; |
|
2815 | + case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04; break; |
|
2816 | + case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05; break; |
|
2817 | + case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break; |
|
2818 | + case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07; break; |
|
2819 | 2819 | } |
2820 | 2820 | $options |= $operator << 20; |
2821 | 2821 | |
2822 | - $data = pack('V', $options); |
|
2822 | + $data = pack('V', $options); |
|
2823 | 2823 | |
2824 | 2824 | // prompt title |
2825 | 2825 | $promptTitle = $dataValidation->getPromptTitle() !== '' ? |
@@ -2851,7 +2851,7 @@ discard block |
||
2851 | 2851 | $formula1 = $this->_parser->toReversePolish(); |
2852 | 2852 | $sz1 = strlen($formula1); |
2853 | 2853 | |
2854 | - } catch(Exception $e) { |
|
2854 | + } catch (Exception $e) { |
|
2855 | 2855 | $sz1 = 0; |
2856 | 2856 | $formula1 = ''; |
2857 | 2857 | } |
@@ -2868,7 +2868,7 @@ discard block |
||
2868 | 2868 | $formula2 = $this->_parser->toReversePolish(); |
2869 | 2869 | $sz2 = strlen($formula2); |
2870 | 2870 | |
2871 | - } catch(Exception $e) { |
|
2871 | + } catch (Exception $e) { |
|
2872 | 2872 | $sz2 = 0; |
2873 | 2873 | $formula2 = ''; |
2874 | 2874 | } |
@@ -2882,7 +2882,7 @@ discard block |
||
2882 | 2882 | $length = strlen($data); |
2883 | 2883 | $header = pack("vv", $record, $length); |
2884 | 2884 | |
2885 | - $this->_append($header . $data); |
|
2885 | + $this->_append($header.$data); |
|
2886 | 2886 | } |
2887 | 2887 | } |
2888 | 2888 | } |
@@ -261,7 +261,9 @@ discard block |
||
261 | 261 | $this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC); |
262 | 262 | |
263 | 263 | // if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255; |
264 | - if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255; |
|
264 | + if ($this->_lastColumnIndex > 255) { |
|
265 | + $this->_lastColumnIndex = 255; |
|
266 | + } |
|
265 | 267 | |
266 | 268 | $this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection()); |
267 | 269 | } |
@@ -426,8 +428,7 @@ discard block |
||
426 | 428 | // FONT Index |
427 | 429 | if ($element instanceof PHPExcel_RichText_Run) { |
428 | 430 | $str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()]; |
429 | - } |
|
430 | - else { |
|
431 | + } else { |
|
431 | 432 | $str_fontidx = 0; |
432 | 433 | } |
433 | 434 | $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx); |
@@ -30,6 +30,9 @@ discard block |
||
30 | 30 | return true; |
31 | 31 | } |
32 | 32 | |
33 | + /** |
|
34 | + * @param string $title |
|
35 | + */ |
|
33 | 36 | function _title($title) { |
34 | 37 | $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
35 | 38 | } |
@@ -71,6 +74,9 @@ discard block |
||
71 | 74 | } |
72 | 75 | } |
73 | 76 | |
77 | + /** |
|
78 | + * @param string $title |
|
79 | + */ |
|
74 | 80 | function _output($title, $type = 'Excel5') { |
75 | 81 | if ($type == 'Excel5') { |
76 | 82 | header("Content-type: application/vnd.ms-excel"); |
@@ -6,47 +6,47 @@ discard block |
||
6 | 6 | class ExcelHelper extends AppHelper { |
7 | 7 | |
8 | 8 | var $objPHPExcel; |
9 | - var $writer; |
|
10 | - var $sheet; |
|
11 | - var $data; |
|
12 | - var $blacklist = array(); |
|
9 | + var $writer; |
|
10 | + var $sheet; |
|
11 | + var $data; |
|
12 | + var $blacklist = array(); |
|
13 | 13 | |
14 | - public function excelHelper() { |
|
14 | + public function excelHelper() { |
|
15 | 15 | $this->log('run this'); |
16 | 16 | $this->objPHPExcel = new PHPExcel(); |
17 | 17 | |
18 | - //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
19 | - } |
|
18 | + //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
19 | + } |
|
20 | 20 | |
21 | - function generate($data, $title = 'Report') { |
|
22 | - $this->data = $data; |
|
21 | + function generate($data, $title = 'Report') { |
|
22 | + $this->data = $data; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - $this->_title($title); |
|
26 | + $this->_title($title); |
|
27 | 27 | // $this->_headers(); |
28 | 28 | // $this->_rows(); |
29 | - $this->_output($title); |
|
30 | - return true; |
|
31 | - } |
|
29 | + $this->_output($title); |
|
30 | + return true; |
|
31 | + } |
|
32 | 32 | |
33 | - function _title($title) { |
|
34 | - $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
35 | - } |
|
33 | + function _title($title) { |
|
34 | + $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
35 | + } |
|
36 | 36 | |
37 | - function _headers() { |
|
38 | - $i=0; |
|
37 | + function _headers() { |
|
38 | + $i=0; |
|
39 | 39 | |
40 | 40 | $this->log($this->data); |
41 | 41 | |
42 | - foreach ($this->data[0] as $field => $value) { |
|
43 | - if (!in_array($field,$this->blacklist)) { |
|
42 | + foreach ($this->data[0] as $field => $value) { |
|
43 | + if (!in_array($field,$this->blacklist)) { |
|
44 | 44 | |
45 | - $columnName = Inflector::humanize($field); |
|
46 | - $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
45 | + $columnName = Inflector::humanize($field); |
|
46 | + $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
47 | 47 | |
48 | - } |
|
49 | - } |
|
48 | + } |
|
49 | + } |
|
50 | 50 | /** |
51 | 51 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFont()->setBold(true); |
52 | 52 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID); |
@@ -55,42 +55,42 @@ discard block |
||
55 | 55 | for ($j=1; $j<$i; $j++) { |
56 | 56 | $this->objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($j))->setAutoSize(true); |
57 | 57 | } |
58 | - ***/ |
|
59 | - } |
|
58 | + ***/ |
|
59 | + } |
|
60 | 60 | |
61 | - function _rows() { |
|
62 | - $i=5; |
|
63 | - foreach ($this->data as $row) { |
|
64 | - $j=0; |
|
65 | - foreach ($row as $field => $value) { |
|
66 | - if(!in_array($field,$this->blacklist)) { |
|
67 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
68 | - } |
|
69 | - } |
|
70 | - $i++; |
|
71 | - } |
|
72 | - } |
|
61 | + function _rows() { |
|
62 | + $i=5; |
|
63 | + foreach ($this->data as $row) { |
|
64 | + $j=0; |
|
65 | + foreach ($row as $field => $value) { |
|
66 | + if(!in_array($field,$this->blacklist)) { |
|
67 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
68 | + } |
|
69 | + } |
|
70 | + $i++; |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | - function _output($title, $type = 'Excel5') { |
|
74 | + function _output($title, $type = 'Excel5') { |
|
75 | 75 | if ($type == 'Excel5') { |
76 | 76 | header("Content-type: application/vnd.ms-excel"); |
77 | - header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
78 | - header('Cache-Control: max-age=0'); |
|
77 | + header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
78 | + header('Cache-Control: max-age=0'); |
|
79 | 79 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel5'); |
80 | 80 | |
81 | 81 | |
82 | 82 | } else if ($type == 'CSV') { |
83 | 83 | header("Content-type: text/csv"); |
84 | - header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
85 | - header('Cache-Control: max-age=0'); |
|
84 | + header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
85 | + header('Cache-Control: max-age=0'); |
|
86 | 86 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'CSV'); |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - //$this->writer->setTempDir(TMP); |
|
92 | - $this->writer->save('php://output'); |
|
93 | - } |
|
91 | + //$this->writer->setTempDir(TMP); |
|
92 | + $this->writer->save('php://output'); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | ?> |
97 | 97 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once(APP . 'Vendor' . DS . 'PHPExcel' . DS . 'IOFactory.php'); |
|
4 | -include_once(APP . 'Vendor' . DS . 'PHPExcel' . DS . 'PHPExcel.php'); |
|
3 | +include_once(APP.'Vendor'.DS.'PHPExcel'.DS.'IOFactory.php'); |
|
4 | +include_once(APP.'Vendor'.DS.'PHPExcel'.DS.'PHPExcel.php'); |
|
5 | 5 | |
6 | 6 | class ExcelHelper extends AppHelper { |
7 | 7 | |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | function _headers() { |
38 | - $i=0; |
|
38 | + $i = 0; |
|
39 | 39 | |
40 | 40 | $this->log($this->data); |
41 | 41 | |
42 | 42 | foreach ($this->data[0] as $field => $value) { |
43 | - if (!in_array($field,$this->blacklist)) { |
|
43 | + if ( ! in_array($field, $this->blacklist)) { |
|
44 | 44 | |
45 | 45 | $columnName = Inflector::humanize($field); |
46 | 46 | $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | function _rows() { |
62 | - $i=5; |
|
62 | + $i = 5; |
|
63 | 63 | foreach ($this->data as $row) { |
64 | - $j=0; |
|
64 | + $j = 0; |
|
65 | 65 | foreach ($row as $field => $value) { |
66 | - if(!in_array($field,$this->blacklist)) { |
|
67 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
66 | + if ( ! in_array($field, $this->blacklist)) { |
|
67 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++, $i, $value); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | $i++; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * @param string $name template name |
79 | 79 | * @param string $cache_id cache id |
80 | 80 | * @param string $compile_id compile id |
81 | - * @return integer|boolean timestamp (epoch) the template was modified, or false if not found |
|
81 | + * @return integer timestamp (epoch) the template was modified, or false if not found |
|
82 | 82 | */ |
83 | 83 | protected function fetchTimestamp($id, $name, $cache_id, $compile_id) |
84 | 84 | { |
@@ -26,133 +26,133 @@ |
||
26 | 26 | */ |
27 | 27 | class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom |
28 | 28 | { |
29 | - // PDO instance |
|
30 | - protected $db; |
|
31 | - protected $fetch; |
|
32 | - protected $fetchTimestamp; |
|
33 | - protected $save; |
|
29 | + // PDO instance |
|
30 | + protected $db; |
|
31 | + protected $fetch; |
|
32 | + protected $fetchTimestamp; |
|
33 | + protected $save; |
|
34 | 34 | |
35 | - public function __construct() |
|
36 | - { |
|
37 | - try { |
|
38 | - $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); |
|
39 | - } catch (PDOException $e) { |
|
40 | - throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); |
|
41 | - } |
|
42 | - $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id'); |
|
43 | - $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id'); |
|
44 | - $this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content) |
|
35 | + public function __construct() |
|
36 | + { |
|
37 | + try { |
|
38 | + $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); |
|
39 | + } catch (PDOException $e) { |
|
40 | + throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); |
|
41 | + } |
|
42 | + $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id'); |
|
43 | + $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id'); |
|
44 | + $this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content) |
|
45 | 45 | VALUES (:id, :name, :cache_id, :compile_id, :content)'); |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * fetch cached content and its modification time from data source |
|
50 | - * |
|
51 | - * @param string $id unique cache content identifier |
|
52 | - * @param string $name template name |
|
53 | - * @param string $cache_id cache id |
|
54 | - * @param string $compile_id compile id |
|
55 | - * @param string $content cached content |
|
56 | - * @param integer $mtime cache modification timestamp (epoch) |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime) |
|
60 | - { |
|
61 | - $this->fetch->execute(array('id' => $id)); |
|
62 | - $row = $this->fetch->fetch(); |
|
63 | - $this->fetch->closeCursor(); |
|
64 | - if ($row) { |
|
65 | - $content = $row['content']; |
|
66 | - $mtime = strtotime($row['modified']); |
|
67 | - } else { |
|
68 | - $content = null; |
|
69 | - $mtime = null; |
|
70 | - } |
|
71 | - } |
|
48 | + /** |
|
49 | + * fetch cached content and its modification time from data source |
|
50 | + * |
|
51 | + * @param string $id unique cache content identifier |
|
52 | + * @param string $name template name |
|
53 | + * @param string $cache_id cache id |
|
54 | + * @param string $compile_id compile id |
|
55 | + * @param string $content cached content |
|
56 | + * @param integer $mtime cache modification timestamp (epoch) |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime) |
|
60 | + { |
|
61 | + $this->fetch->execute(array('id' => $id)); |
|
62 | + $row = $this->fetch->fetch(); |
|
63 | + $this->fetch->closeCursor(); |
|
64 | + if ($row) { |
|
65 | + $content = $row['content']; |
|
66 | + $mtime = strtotime($row['modified']); |
|
67 | + } else { |
|
68 | + $content = null; |
|
69 | + $mtime = null; |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Fetch cached content's modification timestamp from data source |
|
75 | - * |
|
76 | - * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content. |
|
77 | - * @param string $id unique cache content identifier |
|
78 | - * @param string $name template name |
|
79 | - * @param string $cache_id cache id |
|
80 | - * @param string $compile_id compile id |
|
81 | - * @return integer|boolean timestamp (epoch) the template was modified, or false if not found |
|
82 | - */ |
|
83 | - protected function fetchTimestamp($id, $name, $cache_id, $compile_id) |
|
84 | - { |
|
85 | - $this->fetchTimestamp->execute(array('id' => $id)); |
|
86 | - $mtime = strtotime($this->fetchTimestamp->fetchColumn()); |
|
87 | - $this->fetchTimestamp->closeCursor(); |
|
73 | + /** |
|
74 | + * Fetch cached content's modification timestamp from data source |
|
75 | + * |
|
76 | + * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content. |
|
77 | + * @param string $id unique cache content identifier |
|
78 | + * @param string $name template name |
|
79 | + * @param string $cache_id cache id |
|
80 | + * @param string $compile_id compile id |
|
81 | + * @return integer|boolean timestamp (epoch) the template was modified, or false if not found |
|
82 | + */ |
|
83 | + protected function fetchTimestamp($id, $name, $cache_id, $compile_id) |
|
84 | + { |
|
85 | + $this->fetchTimestamp->execute(array('id' => $id)); |
|
86 | + $mtime = strtotime($this->fetchTimestamp->fetchColumn()); |
|
87 | + $this->fetchTimestamp->closeCursor(); |
|
88 | 88 | |
89 | - return $mtime; |
|
90 | - } |
|
89 | + return $mtime; |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Save content to cache |
|
94 | - * |
|
95 | - * @param string $id unique cache content identifier |
|
96 | - * @param string $name template name |
|
97 | - * @param string $cache_id cache id |
|
98 | - * @param string $compile_id compile id |
|
99 | - * @param integer|null $exp_time seconds till expiration time in seconds or null |
|
100 | - * @param string $content content to cache |
|
101 | - * @return boolean success |
|
102 | - */ |
|
103 | - protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content) |
|
104 | - { |
|
105 | - $this->save->execute(array( |
|
106 | - 'id' => $id, |
|
107 | - 'name' => $name, |
|
108 | - 'cache_id' => $cache_id, |
|
109 | - 'compile_id' => $compile_id, |
|
110 | - 'content' => $content, |
|
111 | - )); |
|
92 | + /** |
|
93 | + * Save content to cache |
|
94 | + * |
|
95 | + * @param string $id unique cache content identifier |
|
96 | + * @param string $name template name |
|
97 | + * @param string $cache_id cache id |
|
98 | + * @param string $compile_id compile id |
|
99 | + * @param integer|null $exp_time seconds till expiration time in seconds or null |
|
100 | + * @param string $content content to cache |
|
101 | + * @return boolean success |
|
102 | + */ |
|
103 | + protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content) |
|
104 | + { |
|
105 | + $this->save->execute(array( |
|
106 | + 'id' => $id, |
|
107 | + 'name' => $name, |
|
108 | + 'cache_id' => $cache_id, |
|
109 | + 'compile_id' => $compile_id, |
|
110 | + 'content' => $content, |
|
111 | + )); |
|
112 | 112 | |
113 | - return !!$this->save->rowCount(); |
|
114 | - } |
|
113 | + return !!$this->save->rowCount(); |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Delete content from cache |
|
118 | - * |
|
119 | - * @param string $name template name |
|
120 | - * @param string $cache_id cache id |
|
121 | - * @param string $compile_id compile id |
|
122 | - * @param integer|null $exp_time seconds till expiration or null |
|
123 | - * @return integer number of deleted caches |
|
124 | - */ |
|
125 | - protected function delete($name, $cache_id, $compile_id, $exp_time) |
|
126 | - { |
|
127 | - // delete the whole cache |
|
128 | - if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { |
|
129 | - // returning the number of deleted caches would require a second query to count them |
|
130 | - $query = $this->db->query('TRUNCATE TABLE output_cache'); |
|
116 | + /** |
|
117 | + * Delete content from cache |
|
118 | + * |
|
119 | + * @param string $name template name |
|
120 | + * @param string $cache_id cache id |
|
121 | + * @param string $compile_id compile id |
|
122 | + * @param integer|null $exp_time seconds till expiration or null |
|
123 | + * @return integer number of deleted caches |
|
124 | + */ |
|
125 | + protected function delete($name, $cache_id, $compile_id, $exp_time) |
|
126 | + { |
|
127 | + // delete the whole cache |
|
128 | + if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { |
|
129 | + // returning the number of deleted caches would require a second query to count them |
|
130 | + $query = $this->db->query('TRUNCATE TABLE output_cache'); |
|
131 | 131 | |
132 | - return -1; |
|
133 | - } |
|
134 | - // build the filter |
|
135 | - $where = array(); |
|
136 | - // equal test name |
|
137 | - if ($name !== null) { |
|
138 | - $where[] = 'name = ' . $this->db->quote($name); |
|
139 | - } |
|
140 | - // equal test compile_id |
|
141 | - if ($compile_id !== null) { |
|
142 | - $where[] = 'compile_id = ' . $this->db->quote($compile_id); |
|
143 | - } |
|
144 | - // range test expiration time |
|
145 | - if ($exp_time !== null) { |
|
146 | - $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; |
|
147 | - } |
|
148 | - // equal test cache_id and match sub-groups |
|
149 | - if ($cache_id !== null) { |
|
150 | - $where[] = '(cache_id = '. $this->db->quote($cache_id) |
|
151 | - . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')'; |
|
152 | - } |
|
153 | - // run delete query |
|
154 | - $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); |
|
132 | + return -1; |
|
133 | + } |
|
134 | + // build the filter |
|
135 | + $where = array(); |
|
136 | + // equal test name |
|
137 | + if ($name !== null) { |
|
138 | + $where[] = 'name = ' . $this->db->quote($name); |
|
139 | + } |
|
140 | + // equal test compile_id |
|
141 | + if ($compile_id !== null) { |
|
142 | + $where[] = 'compile_id = ' . $this->db->quote($compile_id); |
|
143 | + } |
|
144 | + // range test expiration time |
|
145 | + if ($exp_time !== null) { |
|
146 | + $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; |
|
147 | + } |
|
148 | + // equal test cache_id and match sub-groups |
|
149 | + if ($cache_id !== null) { |
|
150 | + $where[] = '(cache_id = '. $this->db->quote($cache_id) |
|
151 | + . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')'; |
|
152 | + } |
|
153 | + // run delete query |
|
154 | + $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); |
|
155 | 155 | |
156 | - return $query->rowCount(); |
|
157 | - } |
|
156 | + return $query->rowCount(); |
|
157 | + } |
|
158 | 158 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | try { |
38 | 38 | $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); |
39 | 39 | } catch (PDOException $e) { |
40 | - throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); |
|
40 | + throw new SmartyException('Mysql Resource failed: '.$e->getMessage()); |
|
41 | 41 | } |
42 | 42 | $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id'); |
43 | 43 | $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'content' => $content, |
111 | 111 | )); |
112 | 112 | |
113 | - return !!$this->save->rowCount(); |
|
113 | + return ! ! $this->save->rowCount(); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -135,23 +135,23 @@ discard block |
||
135 | 135 | $where = array(); |
136 | 136 | // equal test name |
137 | 137 | if ($name !== null) { |
138 | - $where[] = 'name = ' . $this->db->quote($name); |
|
138 | + $where[] = 'name = '.$this->db->quote($name); |
|
139 | 139 | } |
140 | 140 | // equal test compile_id |
141 | 141 | if ($compile_id !== null) { |
142 | - $where[] = 'compile_id = ' . $this->db->quote($compile_id); |
|
142 | + $where[] = 'compile_id = '.$this->db->quote($compile_id); |
|
143 | 143 | } |
144 | 144 | // range test expiration time |
145 | 145 | if ($exp_time !== null) { |
146 | - $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; |
|
146 | + $where[] = 'modified < DATE_SUB(NOW(), INTERVAL '.intval($exp_time).' SECOND)'; |
|
147 | 147 | } |
148 | 148 | // equal test cache_id and match sub-groups |
149 | 149 | if ($cache_id !== null) { |
150 | - $where[] = '(cache_id = '. $this->db->quote($cache_id) |
|
151 | - . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')'; |
|
150 | + $where[] = '(cache_id = '.$this->db->quote($cache_id) |
|
151 | + . ' OR cache_id LIKE '.$this->db->quote($cache_id.'|%').')'; |
|
152 | 152 | } |
153 | 153 | // run delete query |
154 | - $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); |
|
154 | + $query = $this->db->query('DELETE FROM output_cache WHERE '.join(' AND ', $where)); |
|
155 | 155 | |
156 | 156 | return $query->rowCount(); |
157 | 157 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * all files in app/tmp/cache/views will be deleted |
457 | 457 | * @param string $type Directory in tmp/cache defaults to view directory |
458 | 458 | * @param string $ext The file extension you are deleting |
459 | - * @return true if files found and deleted false otherwise |
|
459 | + * @return boolean if files found and deleted false otherwise |
|
460 | 460 | */ |
461 | 461 | function clearCache($params = null, $type = 'views', $ext = '.php') { |
462 | 462 | if (is_string($params) || $params === null) { |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @param string $singular Text to translate |
549 | 549 | * @param mixed $args Array with arguments or multiple arguments in function |
550 | - * @return mixed translated string |
|
550 | + * @return null|string translated string |
|
551 | 551 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ |
552 | 552 | */ |
553 | 553 | function __($singular, $args = null) { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @param string $plural Plural text |
578 | 578 | * @param integer $count Count |
579 | 579 | * @param mixed $args Array with arguments or multiple arguments in function |
580 | - * @return mixed plural form of translated string |
|
580 | + * @return null|string plural form of translated string |
|
581 | 581 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n |
582 | 582 | */ |
583 | 583 | function __n($singular, $plural, $count, $args = null) { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @param string $domain Domain |
606 | 606 | * @param string $msg String to translate |
607 | 607 | * @param mixed $args Array with arguments or multiple arguments in function |
608 | - * @return translated string |
|
608 | + * @return null|string string |
|
609 | 609 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d |
610 | 610 | */ |
611 | 611 | function __d($domain, $msg, $args = null) { |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @param string $plural Plural |
637 | 637 | * @param integer $count Count |
638 | 638 | * @param mixed $args Array with arguments or multiple arguments in function |
639 | - * @return plural form of translated string |
|
639 | + * @return null|string form of translated string |
|
640 | 640 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn |
641 | 641 | */ |
642 | 642 | function __dn($domain, $singular, $plural, $count, $args = null) { |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @param string $msg Message to translate |
679 | 679 | * @param integer $category Category |
680 | 680 | * @param mixed $args Array with arguments or multiple arguments in function |
681 | - * @return translated string |
|
681 | + * @return null|string string |
|
682 | 682 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc |
683 | 683 | */ |
684 | 684 | function __dc($domain, $msg, $category, $args = null) { |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @param integer $count Count |
725 | 725 | * @param integer $category Category |
726 | 726 | * @param mixed $args Array with arguments or multiple arguments in function |
727 | - * @return plural form of translated string |
|
727 | + * @return null|string form of translated string |
|
728 | 728 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn |
729 | 729 | */ |
730 | 730 | function __dcn($domain, $singular, $plural, $count, $category, $args = null) { |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @param string $msg String to translate |
763 | 763 | * @param integer $category Category |
764 | 764 | * @param mixed $args Array with arguments or multiple arguments in function |
765 | - * @return translated string |
|
765 | + * @return null|string string |
|
766 | 766 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c |
767 | 767 | */ |
768 | 768 | function __c($msg, $category, $args = null) { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * Searches include path for files. |
806 | 806 | * |
807 | 807 | * @param string $file File to look for |
808 | - * @return Full path to file if exists, otherwise false |
|
808 | + * @return string|false path to file if exists, otherwise false |
|
809 | 809 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#fileExistsInPath |
810 | 810 | */ |
811 | 811 | function fileExistsInPath($file) { |
@@ -844,18 +844,18 @@ |
||
844 | 844 | |
845 | 845 | |
846 | 846 | function receber_data($data, $dia = true, $mes = true, $ano = true, $hora = false, $minuto = false, $segundo = false) { |
847 | - if ($hora || $minuto || $segundo) { |
|
848 | - $data = explode(' ', $data); |
|
849 | - $_hora = $data[1]; |
|
850 | - $data = $data[0]; |
|
851 | - |
|
852 | - $_hora = explode(':', $_hora); |
|
853 | - $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
854 | - } |
|
855 | - $recebe = explode('-', $data); |
|
856 | - if (isset($recebe[2]) && isset($recebe[1])) { |
|
857 | - $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
858 | - } |
|
859 | - |
|
860 | - return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
847 | + if ($hora || $minuto || $segundo) { |
|
848 | + $data = explode(' ', $data); |
|
849 | + $_hora = $data[1]; |
|
850 | + $data = $data[0]; |
|
851 | + |
|
852 | + $_hora = explode(':', $_hora); |
|
853 | + $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
854 | + } |
|
855 | + $recebe = explode('-', $data); |
|
856 | + if (isset($recebe[2]) && isset($recebe[1])) { |
|
857 | + $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
858 | + } |
|
859 | + |
|
860 | + return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
861 | 861 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | define('MONTH', 2592000); |
30 | 30 | define('YEAR', 31536000); |
31 | 31 | |
32 | -if (!function_exists('config')) { |
|
32 | +if ( ! function_exists('config')) { |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Loads configuration files. Receives a set of configuration files |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $count = count($args); |
47 | 47 | $included = 0; |
48 | 48 | foreach ($args as $arg) { |
49 | - if (file_exists(APP . 'Config' . DS . $arg . '.php')) { |
|
50 | - include_once APP . 'Config' . DS . $arg . '.php'; |
|
49 | + if (file_exists(APP.'Config'.DS.$arg.'.php')) { |
|
50 | + include_once APP.'Config'.DS.$arg.'.php'; |
|
51 | 51 | $included++; |
52 | 52 | } |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | -if (!function_exists('debug')) { |
|
59 | +if ( ! function_exists('debug')) { |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Prints out debug information about given variable. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if (!function_exists('sortByKey')) { |
|
123 | +if ( ! function_exists('sortByKey')) { |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Sorts given $array by key $sortBy. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey |
134 | 134 | */ |
135 | 135 | function sortByKey(&$array, $sortBy, $order = 'asc', $type = SORT_NUMERIC) { |
136 | - if (!is_array($array)) { |
|
136 | + if ( ! is_array($array)) { |
|
137 | 137 | return null; |
138 | 138 | } |
139 | 139 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | -if (!function_exists('h')) { |
|
158 | +if ( ! function_exists('h')) { |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Convenience method for htmlspecialchars. |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | return $texts; |
178 | 178 | } elseif (is_object($text)) { |
179 | 179 | if (method_exists($text, '__toString')) { |
180 | - $text = (string)$text; |
|
180 | + $text = (string) $text; |
|
181 | 181 | } else { |
182 | - $text = '(object)' . get_class($text); |
|
182 | + $text = '(object)'.get_class($text); |
|
183 | 183 | } |
184 | 184 | } elseif (is_bool($text)) { |
185 | 185 | return $text; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -if (!function_exists('pluginSplit')) { |
|
203 | +if ( ! function_exists('pluginSplit')) { |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Splits a dot syntax plugin name into its plugin and class name. |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | -if (!function_exists('pr')) { |
|
230 | +if ( ! function_exists('pr')) { |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * print_r() convenience function |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | } |
254 | 254 | |
255 | -if (!function_exists('am')) { |
|
255 | +if ( ! function_exists('am')) { |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Merge a group of arrays |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $r = array(); |
269 | 269 | $args = func_get_args(); |
270 | 270 | foreach ($args as $a) { |
271 | - if (!is_array($a)) { |
|
271 | + if ( ! is_array($a)) { |
|
272 | 272 | $a = array($a); |
273 | 273 | } |
274 | 274 | $r = array_merge($r, $a); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | } |
280 | 280 | |
281 | -if (!function_exists('env')) { |
|
281 | +if ( ! function_exists('env')) { |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * Gets an environment variable from available sources, and provides emulation |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | function env($key) { |
294 | 294 | if ($key === 'HTTPS') { |
295 | 295 | if (isset($_SERVER['HTTPS'])) { |
296 | - return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); |
|
296 | + return ( ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); |
|
297 | 297 | } |
298 | 298 | return (strpos(env('SCRIPT_URI'), 'https://') === 0); |
299 | 299 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $name = env('SCRIPT_NAME'); |
330 | 330 | $filename = env('SCRIPT_FILENAME'); |
331 | 331 | $offset = 0; |
332 | - if (!strpos($name, '.php')) { |
|
332 | + if ( ! strpos($name, '.php')) { |
|
333 | 333 | $offset = 4; |
334 | 334 | } |
335 | 335 | return substr($filename, 0, -(strlen($name) + $offset)); |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | $count = count($parts); |
344 | 344 | |
345 | 345 | if ($count === 1) { |
346 | - return '.' . $host; |
|
346 | + return '.'.$host; |
|
347 | 347 | } elseif ($count === 2) { |
348 | - return '.' . $host; |
|
348 | + return '.'.$host; |
|
349 | 349 | } elseif ($count === 3) { |
350 | 350 | $gTLD = array( |
351 | 351 | 'aero', |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | 'xxx' |
372 | 372 | ); |
373 | 373 | if (in_array($parts[1], $gTLD)) { |
374 | - return '.' . $host; |
|
374 | + return '.'.$host; |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | array_shift($parts); |
378 | - return '.' . implode('.', $parts); |
|
378 | + return '.'.implode('.', $parts); |
|
379 | 379 | } |
380 | 380 | return null; |
381 | 381 | } |
382 | 382 | |
383 | 383 | } |
384 | 384 | |
385 | -if (!function_exists('cache')) { |
|
385 | +if ( ! function_exists('cache')) { |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Reads/writes temporary data to cache files or session. |
@@ -400,19 +400,19 @@ discard block |
||
400 | 400 | } |
401 | 401 | $now = time(); |
402 | 402 | |
403 | - if (!is_numeric($expires)) { |
|
403 | + if ( ! is_numeric($expires)) { |
|
404 | 404 | $expires = strtotime($expires, $now); |
405 | 405 | } |
406 | 406 | |
407 | 407 | switch (strtolower($target)) { |
408 | 408 | case 'cache': |
409 | - $filename = CACHE . $path; |
|
409 | + $filename = CACHE.$path; |
|
410 | 410 | break; |
411 | 411 | case 'public': |
412 | - $filename = WWW_ROOT . $path; |
|
412 | + $filename = WWW_ROOT.$path; |
|
413 | 413 | break; |
414 | 414 | case 'tmp': |
415 | - $filename = TMP . $path; |
|
415 | + $filename = TMP.$path; |
|
416 | 416 | break; |
417 | 417 | } |
418 | 418 | $timediff = $expires - $now; |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | -if (!function_exists('clearCache')) { |
|
449 | +if ( ! function_exists('clearCache')) { |
|
450 | 450 | |
451 | 451 | /** |
452 | 452 | * Used to delete files in the cache directories, or clear contents of cache directories |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | function clearCache($params = null, $type = 'views', $ext = '.php') { |
462 | 462 | if (is_string($params) || $params === null) { |
463 | 463 | $params = preg_replace('/\/\//', '/', $params); |
464 | - $cache = CACHE . $type . DS . $params; |
|
464 | + $cache = CACHE.$type.DS.$params; |
|
465 | 465 | |
466 | - if (is_file($cache . $ext)) { |
|
466 | + if (is_file($cache.$ext)) { |
|
467 | 467 | //@codingStandardsIgnoreStart |
468 | - @unlink($cache . $ext); |
|
468 | + @unlink($cache.$ext); |
|
469 | 469 | //@codingStandardsIgnoreEnd |
470 | 470 | return true; |
471 | 471 | } elseif (is_dir($cache)) { |
472 | - $files = glob($cache . '*'); |
|
472 | + $files = glob($cache.'*'); |
|
473 | 473 | |
474 | 474 | if ($files === false) { |
475 | 475 | return false; |
476 | 476 | } |
477 | 477 | |
478 | 478 | foreach ($files as $file) { |
479 | - if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) { |
|
479 | + if (is_file($file) && strrpos($file, DS.'empty') !== strlen($file) - 6) { |
|
480 | 480 | //@codingStandardsIgnoreStart |
481 | 481 | @unlink($file); |
482 | 482 | //@codingStandardsIgnoreEnd |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | return true; |
486 | 486 | } |
487 | 487 | $cache = array( |
488 | - CACHE . $type . DS . '*' . $params . $ext, |
|
489 | - CACHE . $type . DS . '*' . $params . '_*' . $ext |
|
488 | + CACHE.$type.DS.'*'.$params.$ext, |
|
489 | + CACHE.$type.DS.'*'.$params.'_*'.$ext |
|
490 | 490 | ); |
491 | 491 | $files = array(); |
492 | 492 | while ($search = array_shift($cache)) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | return false; |
500 | 500 | } |
501 | 501 | foreach ($files as $file) { |
502 | - if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) { |
|
502 | + if (is_file($file) && strrpos($file, DS.'empty') !== strlen($file) - 6) { |
|
503 | 503 | //@codingStandardsIgnoreStart |
504 | 504 | @unlink($file); |
505 | 505 | //@codingStandardsIgnoreEnd |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | } |
520 | 520 | |
521 | -if (!function_exists('stripslashes_deep')) { |
|
521 | +if ( ! function_exists('stripslashes_deep')) { |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Recursively strips slashes from all values in an array |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | } |
542 | 542 | |
543 | -if (!function_exists('__')) { |
|
543 | +if ( ! function_exists('__')) { |
|
544 | 544 | |
545 | 545 | /** |
546 | 546 | * Returns a translated string if one is found; Otherwise, the submitted message. |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ |
552 | 552 | */ |
553 | 553 | function __($singular, $args = null) { |
554 | - if (!$singular) { |
|
554 | + if ( ! $singular) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | 557 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $translated = I18n::translate($singular); |
560 | 560 | if ($args === null) { |
561 | 561 | return $translated; |
562 | - } elseif (!is_array($args)) { |
|
562 | + } elseif ( ! is_array($args)) { |
|
563 | 563 | $args = array_slice(func_get_args(), 1); |
564 | 564 | } |
565 | 565 | return vsprintf($translated, $args); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | |
568 | 568 | } |
569 | 569 | |
570 | -if (!function_exists('__n')) { |
|
570 | +if ( ! function_exists('__n')) { |
|
571 | 571 | |
572 | 572 | /** |
573 | 573 | * Returns correct plural form of message identified by $singular and $plural for count $count. |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n |
582 | 582 | */ |
583 | 583 | function __n($singular, $plural, $count, $args = null) { |
584 | - if (!$singular) { |
|
584 | + if ( ! $singular) { |
|
585 | 585 | return; |
586 | 586 | } |
587 | 587 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $translated = I18n::translate($singular, $plural, null, 6, $count); |
590 | 590 | if ($args === null) { |
591 | 591 | return $translated; |
592 | - } elseif (!is_array($args)) { |
|
592 | + } elseif ( ! is_array($args)) { |
|
593 | 593 | $args = array_slice(func_get_args(), 3); |
594 | 594 | } |
595 | 595 | return vsprintf($translated, $args); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | |
598 | 598 | } |
599 | 599 | |
600 | -if (!function_exists('__d')) { |
|
600 | +if ( ! function_exists('__d')) { |
|
601 | 601 | |
602 | 602 | /** |
603 | 603 | * Allows you to override the current domain for a single message lookup. |
@@ -609,14 +609,14 @@ discard block |
||
609 | 609 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d |
610 | 610 | */ |
611 | 611 | function __d($domain, $msg, $args = null) { |
612 | - if (!$msg) { |
|
612 | + if ( ! $msg) { |
|
613 | 613 | return; |
614 | 614 | } |
615 | 615 | App::uses('I18n', 'I18n'); |
616 | 616 | $translated = I18n::translate($msg, null, $domain); |
617 | 617 | if ($args === null) { |
618 | 618 | return $translated; |
619 | - } elseif (!is_array($args)) { |
|
619 | + } elseif ( ! is_array($args)) { |
|
620 | 620 | $args = array_slice(func_get_args(), 2); |
621 | 621 | } |
622 | 622 | return vsprintf($translated, $args); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | } |
626 | 626 | |
627 | -if (!function_exists('__dn')) { |
|
627 | +if ( ! function_exists('__dn')) { |
|
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Allows you to override the current domain for a single plural message lookup. |
@@ -640,14 +640,14 @@ discard block |
||
640 | 640 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn |
641 | 641 | */ |
642 | 642 | function __dn($domain, $singular, $plural, $count, $args = null) { |
643 | - if (!$singular) { |
|
643 | + if ( ! $singular) { |
|
644 | 644 | return; |
645 | 645 | } |
646 | 646 | App::uses('I18n', 'I18n'); |
647 | 647 | $translated = I18n::translate($singular, $plural, $domain, 6, $count); |
648 | 648 | if ($args === null) { |
649 | 649 | return $translated; |
650 | - } elseif (!is_array($args)) { |
|
650 | + } elseif ( ! is_array($args)) { |
|
651 | 651 | $args = array_slice(func_get_args(), 4); |
652 | 652 | } |
653 | 653 | return vsprintf($translated, $args); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | } |
657 | 657 | |
658 | -if (!function_exists('__dc')) { |
|
658 | +if ( ! function_exists('__dc')) { |
|
659 | 659 | |
660 | 660 | /** |
661 | 661 | * Allows you to override the current domain for a single message lookup. |
@@ -682,14 +682,14 @@ discard block |
||
682 | 682 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc |
683 | 683 | */ |
684 | 684 | function __dc($domain, $msg, $category, $args = null) { |
685 | - if (!$msg) { |
|
685 | + if ( ! $msg) { |
|
686 | 686 | return; |
687 | 687 | } |
688 | 688 | App::uses('I18n', 'I18n'); |
689 | 689 | $translated = I18n::translate($msg, null, $domain, $category); |
690 | 690 | if ($args === null) { |
691 | 691 | return $translated; |
692 | - } elseif (!is_array($args)) { |
|
692 | + } elseif ( ! is_array($args)) { |
|
693 | 693 | $args = array_slice(func_get_args(), 3); |
694 | 694 | } |
695 | 695 | return vsprintf($translated, $args); |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | |
698 | 698 | } |
699 | 699 | |
700 | -if (!function_exists('__dcn')) { |
|
700 | +if ( ! function_exists('__dcn')) { |
|
701 | 701 | |
702 | 702 | /** |
703 | 703 | * Allows you to override the current domain for a single plural message lookup. |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn |
729 | 729 | */ |
730 | 730 | function __dcn($domain, $singular, $plural, $count, $category, $args = null) { |
731 | - if (!$singular) { |
|
731 | + if ( ! $singular) { |
|
732 | 732 | return; |
733 | 733 | } |
734 | 734 | App::uses('I18n', 'I18n'); |
735 | 735 | $translated = I18n::translate($singular, $plural, $domain, $category, $count); |
736 | 736 | if ($args === null) { |
737 | 737 | return $translated; |
738 | - } elseif (!is_array($args)) { |
|
738 | + } elseif ( ! is_array($args)) { |
|
739 | 739 | $args = array_slice(func_get_args(), 5); |
740 | 740 | } |
741 | 741 | return vsprintf($translated, $args); |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | } |
745 | 745 | |
746 | -if (!function_exists('__c')) { |
|
746 | +if ( ! function_exists('__c')) { |
|
747 | 747 | |
748 | 748 | /** |
749 | 749 | * The category argument allows a specific category of the locale settings to be used for fetching a message. |
@@ -766,14 +766,14 @@ discard block |
||
766 | 766 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c |
767 | 767 | */ |
768 | 768 | function __c($msg, $category, $args = null) { |
769 | - if (!$msg) { |
|
769 | + if ( ! $msg) { |
|
770 | 770 | return; |
771 | 771 | } |
772 | 772 | App::uses('I18n', 'I18n'); |
773 | 773 | $translated = I18n::translate($msg, null, null, $category); |
774 | 774 | if ($args === null) { |
775 | 775 | return $translated; |
776 | - } elseif (!is_array($args)) { |
|
776 | + } elseif ( ! is_array($args)) { |
|
777 | 777 | $args = array_slice(func_get_args(), 2); |
778 | 778 | } |
779 | 779 | return vsprintf($translated, $args); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | |
782 | 782 | } |
783 | 783 | |
784 | -if (!function_exists('LogError')) { |
|
784 | +if ( ! function_exists('LogError')) { |
|
785 | 785 | |
786 | 786 | /** |
787 | 787 | * Shortcut to Log::write. |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | |
800 | 800 | } |
801 | 801 | |
802 | -if (!function_exists('fileExistsInPath')) { |
|
802 | +if ( ! function_exists('fileExistsInPath')) { |
|
803 | 803 | |
804 | 804 | /** |
805 | 805 | * Searches include path for files. |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | function fileExistsInPath($file) { |
812 | 812 | $paths = explode(PATH_SEPARATOR, ini_get('include_path')); |
813 | 813 | foreach ($paths as $path) { |
814 | - $fullPath = $path . DS . $file; |
|
814 | + $fullPath = $path.DS.$file; |
|
815 | 815 | |
816 | 816 | if (file_exists($fullPath)) { |
817 | 817 | return $fullPath; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | |
825 | 825 | } |
826 | 826 | |
827 | -if (!function_exists('convertSlash')) { |
|
827 | +if ( ! function_exists('convertSlash')) { |
|
828 | 828 | |
829 | 829 | /** |
830 | 830 | * Convert forward slashes to underscores and removes first and last underscores in a string |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | $data = $data[0]; |
851 | 851 | |
852 | 852 | $_hora = explode(':', $_hora); |
853 | - $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
853 | + $_hora = ($hora ? $_hora[0] : '').($minuto ? ($hora ? ':' : '').$_hora[1] : '').($segundo ? ($hora || $minuto ? ':' : '').$_hora[2] : ''); |
|
854 | 854 | } |
855 | 855 | $recebe = explode('-', $data); |
856 | 856 | if (isset($recebe[2]) && isset($recebe[1])) { |
857 | - $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
857 | + $data = ($dia ? $recebe[2] : '').($mes ? ($dia ? '/' : '').$recebe[1] : '').($ano ? ($mes || $dia ? '/' : '').$recebe[0] : ''); |
|
858 | 858 | } |
859 | 859 | |
860 | - return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
860 | + return $data.(isset($_hora) ? ' '.$_hora : ''); |
|
861 | 861 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * If set to false, it returns all of $haystack from the first occurrence of $needle to the end, |
215 | 215 | * Default value is false. |
216 | 216 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
217 | - * @return string|boolean The portion of $haystack, or false if $needle is not found. |
|
217 | + * @return string|false The portion of $haystack, or false if $needle is not found. |
|
218 | 218 | */ |
219 | 219 | function mb_stristr($haystack, $needle, $part = false, $encoding = null) { |
220 | 220 | return Multibyte::stristr($haystack, $needle, $part); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * If set to false, it returns all of $haystack from the last occurrence of $needle to the end, |
269 | 269 | * Default value is false. |
270 | 270 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
271 | - * @return string|boolean The portion of $haystack. or false if $needle is not found. |
|
271 | + * @return string|false The portion of $haystack. or false if $needle is not found. |
|
272 | 272 | */ |
273 | 273 | function mb_strrchr($haystack, $needle, $part = false, $encoding = null) { |
274 | 274 | return Multibyte::strrchr($haystack, $needle, $part); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * If set to false, it returns all of $haystack from the last occurrence of $needle to the end, |
289 | 289 | * Default value is false. |
290 | 290 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
291 | - * @return string|boolean The portion of $haystack. or false if $needle is not found. |
|
291 | + * @return string|false The portion of $haystack. or false if $needle is not found. |
|
292 | 292 | */ |
293 | 293 | function mb_strrichr($haystack, $needle, $part = false, $encoding = null) { |
294 | 294 | return Multibyte::strrichr($haystack, $needle, $part); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * If set to false, it returns all of $haystack from the first occurrence of $needle to the end, |
346 | 346 | * Default value is FALSE. |
347 | 347 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
348 | - * @return string|boolean The portion of $haystack, or true if $needle is not found. |
|
348 | + * @return string|false The portion of $haystack, or true if $needle is not found. |
|
349 | 349 | */ |
350 | 350 | function mb_strstr($haystack, $needle, $part = false, $encoding = null) { |
351 | 351 | return Multibyte::strstr($haystack, $needle, $part); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param string $str The string being encoded |
425 | 425 | * @param string $charset specifies the name of the character set in which str is represented in. |
426 | 426 | * The default value is determined by the current NLS setting (mbstring.language). |
427 | - * @param string $transfer_encoding specifies the scheme of MIME encoding. |
|
427 | + * @param string $transferEncoding specifies the scheme of MIME encoding. |
|
428 | 428 | * It should be either "B" (Base64) or "Q" (Quoted-Printable). Falls back to "B" if not given. |
429 | 429 | * @param string $linefeed specifies the EOL (end-of-line) marker with which |
430 | 430 | * mb_encode_mimeheader() performs line-folding |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Basic CakePHP functionality. |
|
4 | - * |
|
5 | - * Handles loading of core files needed on every request |
|
6 | - * |
|
7 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
8 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | - * |
|
10 | - * Licensed under The MIT License |
|
11 | - * For full copyright and license information, please see the LICENSE.txt |
|
12 | - * Redistributions of files must retain the above copyright notice. |
|
13 | - * |
|
14 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
15 | - * @link http://cakephp.org CakePHP(tm) Project |
|
16 | - * @package Cake |
|
17 | - * @since CakePHP(tm) v 0.2.9 |
|
18 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | - */ |
|
3 | + * Basic CakePHP functionality. |
|
4 | + * |
|
5 | + * Handles loading of core files needed on every request |
|
6 | + * |
|
7 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
8 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | + * |
|
10 | + * Licensed under The MIT License |
|
11 | + * For full copyright and license information, please see the LICENSE.txt |
|
12 | + * Redistributions of files must retain the above copyright notice. |
|
13 | + * |
|
14 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
15 | + * @link http://cakephp.org CakePHP(tm) Project |
|
16 | + * @package Cake |
|
17 | + * @since CakePHP(tm) v 0.2.9 |
|
18 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | define('TIME_START', microtime(true)); |
22 | 22 |
@@ -20,124 +20,124 @@ discard block |
||
20 | 20 | |
21 | 21 | define('TIME_START', microtime(true)); |
22 | 22 | |
23 | -if (!defined('E_DEPRECATED')) { |
|
23 | +if ( ! defined('E_DEPRECATED')) { |
|
24 | 24 | define('E_DEPRECATED', 8192); |
25 | 25 | } |
26 | 26 | |
27 | -if (!defined('E_USER_DEPRECATED')) { |
|
27 | +if ( ! defined('E_USER_DEPRECATED')) { |
|
28 | 28 | define('E_USER_DEPRECATED', E_USER_NOTICE); |
29 | 29 | } |
30 | 30 | error_reporting(E_ALL & ~E_DEPRECATED); |
31 | 31 | |
32 | -if (!defined('CAKE_CORE_INCLUDE_PATH')) { |
|
32 | +if ( ! defined('CAKE_CORE_INCLUDE_PATH')) { |
|
33 | 33 | define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__))); |
34 | 34 | } |
35 | 35 | |
36 | -if (!defined('CORE_PATH')) { |
|
37 | - define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); |
|
36 | +if ( ! defined('CORE_PATH')) { |
|
37 | + define('CORE_PATH', CAKE_CORE_INCLUDE_PATH.DS); |
|
38 | 38 | } |
39 | 39 | |
40 | -if (!defined('WEBROOT_DIR')) { |
|
40 | +if ( ! defined('WEBROOT_DIR')) { |
|
41 | 41 | define('WEBROOT_DIR', 'webroot'); |
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Path to the cake directory. |
46 | 46 | */ |
47 | - define('CAKE', CORE_PATH . 'Cake' . DS); |
|
47 | + define('CAKE', CORE_PATH.'Cake'.DS); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Path to the application's directory. |
51 | 51 | */ |
52 | -if (!defined('APP')) { |
|
53 | - define('APP', ROOT . DS . APP_DIR . DS); |
|
52 | +if ( ! defined('APP')) { |
|
53 | + define('APP', ROOT.DS.APP_DIR.DS); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Path to the application's libs directory. |
58 | 58 | */ |
59 | - define('APPLIBS', APP . 'Lib' . DS); |
|
59 | + define('APPLIBS', APP.'Lib'.DS); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Path to the public CSS directory. |
63 | 63 | */ |
64 | -if (!defined('CSS')) { |
|
65 | - define('CSS', WWW_ROOT . 'css' . DS); |
|
64 | +if ( ! defined('CSS')) { |
|
65 | + define('CSS', WWW_ROOT.'css'.DS); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Path to the public JavaScript directory. |
70 | 70 | */ |
71 | -if (!defined('JS')) { |
|
72 | - define('JS', WWW_ROOT . 'js' . DS); |
|
71 | +if ( ! defined('JS')) { |
|
72 | + define('JS', WWW_ROOT.'js'.DS); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Path to the public images directory. |
77 | 77 | */ |
78 | -if (!defined('IMAGES')) { |
|
79 | - define('IMAGES', WWW_ROOT . 'img' . DS); |
|
78 | +if ( ! defined('IMAGES')) { |
|
79 | + define('IMAGES', WWW_ROOT.'img'.DS); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Path to the tests directory. |
84 | 84 | */ |
85 | -if (!defined('TESTS')) { |
|
86 | - define('TESTS', APP . 'Test' . DS); |
|
85 | +if ( ! defined('TESTS')) { |
|
86 | + define('TESTS', APP.'Test'.DS); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Path to the temporary files directory. |
91 | 91 | */ |
92 | -if (!defined('TMP')) { |
|
93 | - define('TMP', APP . 'tmp' . DS); |
|
92 | +if ( ! defined('TMP')) { |
|
93 | + define('TMP', APP.'tmp'.DS); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Path to the logs directory. |
98 | 98 | */ |
99 | -if (!defined('LOGS')) { |
|
100 | - define('LOGS', TMP . 'logs' . DS); |
|
99 | +if ( ! defined('LOGS')) { |
|
100 | + define('LOGS', TMP.'logs'.DS); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Path to the cache files directory. It can be shared between hosts in a multi-server setup. |
105 | 105 | */ |
106 | -if (!defined('CACHE')) { |
|
107 | - define('CACHE', TMP . 'cache' . DS); |
|
106 | +if ( ! defined('CACHE')) { |
|
107 | + define('CACHE', TMP.'cache'.DS); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Path to the vendors directory. |
112 | 112 | */ |
113 | -if (!defined('VENDORS')) { |
|
114 | - define('VENDORS', ROOT . DS . 'vendors' . DS); |
|
113 | +if ( ! defined('VENDORS')) { |
|
114 | + define('VENDORS', ROOT.DS.'vendors'.DS); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Web path to the public images directory. |
119 | 119 | */ |
120 | -if (!defined('IMAGES_URL')) { |
|
120 | +if ( ! defined('IMAGES_URL')) { |
|
121 | 121 | define('IMAGES_URL', 'img/'); |
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Web path to the CSS files directory. |
126 | 126 | */ |
127 | -if (!defined('CSS_URL')) { |
|
127 | +if ( ! defined('CSS_URL')) { |
|
128 | 128 | define('CSS_URL', 'css/'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Web path to the js files directory. |
133 | 133 | */ |
134 | -if (!defined('JS_URL')) { |
|
134 | +if ( ! defined('JS_URL')) { |
|
135 | 135 | define('JS_URL', 'js/'); |
136 | 136 | } |
137 | 137 | |
138 | -require CAKE . 'basics.php'; |
|
139 | -require CAKE . 'Core' . DS . 'App.php'; |
|
140 | -require CAKE . 'Error' . DS . 'exceptions.php'; |
|
138 | +require CAKE.'basics.php'; |
|
139 | +require CAKE.'Core'.DS.'App.php'; |
|
140 | +require CAKE.'Error'.DS.'exceptions.php'; |
|
141 | 141 | |
142 | 142 | spl_autoload_register(array('App', 'load')); |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * Full URL prefix |
153 | 153 | */ |
154 | -if (!defined('FULL_BASE_URL')) { |
|
154 | +if ( ! defined('FULL_BASE_URL')) { |
|
155 | 155 | $s = null; |
156 | 156 | if (env('HTTPS')) { |
157 | 157 | $s = 's'; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $httpHost = env('HTTP_HOST'); |
161 | 161 | |
162 | 162 | if (isset($httpHost)) { |
163 | - define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost); |
|
163 | + define('FULL_BASE_URL', 'http'.$s.'://'.$httpHost); |
|
164 | 164 | Configure::write('App.fullBaseUrl', FULL_BASE_URL); |
165 | 165 | } |
166 | 166 | unset($httpHost, $s); |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | |
177 | 177 | if (function_exists('mb_internal_encoding')) { |
178 | 178 | $encoding = Configure::read('App.encoding'); |
179 | - if (!empty($encoding)) { |
|
179 | + if ( ! empty($encoding)) { |
|
180 | 180 | mb_internal_encoding($encoding); |
181 | 181 | } |
182 | - if (!empty($encoding) && function_exists('mb_regex_encoding')) { |
|
182 | + if ( ! empty($encoding) && function_exists('mb_regex_encoding')) { |
|
183 | 183 | mb_regex_encoding($encoding); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | -if (!function_exists('mb_stripos')) { |
|
187 | +if ( ! function_exists('mb_stripos')) { |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Find position of first occurrence of a case-insensitive string. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | } |
204 | 204 | |
205 | -if (!function_exists('mb_stristr')) { |
|
205 | +if ( ! function_exists('mb_stristr')) { |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Finds first occurrence of a string within another, case insensitive. |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | } |
224 | 224 | |
225 | -if (!function_exists('mb_strlen')) { |
|
225 | +if ( ! function_exists('mb_strlen')) { |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Get string length. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | } |
240 | 240 | |
241 | -if (!function_exists('mb_strpos')) { |
|
241 | +if ( ! function_exists('mb_strpos')) { |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * Find position of first occurrence of a string. |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | -if (!function_exists('mb_strrchr')) { |
|
259 | +if ( ! function_exists('mb_strrchr')) { |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Finds the last occurrence of a character in a string within another. |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | } |
278 | 278 | |
279 | -if (!function_exists('mb_strrichr')) { |
|
279 | +if ( ! function_exists('mb_strrichr')) { |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Finds the last occurrence of a character in a string within another, case insensitive. |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | } |
298 | 298 | |
299 | -if (!function_exists('mb_strripos')) { |
|
299 | +if ( ! function_exists('mb_strripos')) { |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Finds position of last occurrence of a string within another, case insensitive |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | } |
316 | 316 | |
317 | -if (!function_exists('mb_strrpos')) { |
|
317 | +if ( ! function_exists('mb_strrpos')) { |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Find position of last occurrence of a string in a string. |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | } |
335 | 335 | |
336 | -if (!function_exists('mb_strstr')) { |
|
336 | +if ( ! function_exists('mb_strstr')) { |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * Finds first occurrence of a string within another |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | } |
355 | 355 | |
356 | -if (!function_exists('mb_strtolower')) { |
|
356 | +if ( ! function_exists('mb_strtolower')) { |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Make a string lowercase |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | } |
370 | 370 | |
371 | -if (!function_exists('mb_strtoupper')) { |
|
371 | +if ( ! function_exists('mb_strtoupper')) { |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Make a string uppercase |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | } |
385 | 385 | |
386 | -if (!function_exists('mb_substr_count')) { |
|
386 | +if ( ! function_exists('mb_substr_count')) { |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Count the number of substring occurrences |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | } |
401 | 401 | |
402 | -if (!function_exists('mb_substr')) { |
|
402 | +if ( ! function_exists('mb_substr')) { |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * Get part of string |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | |
417 | 417 | } |
418 | 418 | |
419 | -if (!function_exists('mb_encode_mimeheader')) { |
|
419 | +if ( ! function_exists('mb_encode_mimeheader')) { |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Encode string for MIME header |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * to decide whether actually delete the keys or just simulate it to achieve |
131 | 131 | * the same result. |
132 | 132 | * |
133 | - * @param string $groups name of the group to be cleared |
|
133 | + * @param string $group name of the group to be cleared |
|
134 | 134 | * @return boolean |
135 | 135 | */ |
136 | 136 | public function clearGroup($group) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * Generates a safe key for use with cache engine storage engines. |
162 | 162 | * |
163 | 163 | * @param string $key the key passed over |
164 | - * @return mixed string $key or false |
|
164 | + * @return false|string string $key or false |
|
165 | 165 | */ |
166 | 166 | public function key($key) { |
167 | 167 | if (empty($key)) { |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'groups' => array() |
53 | 53 | ); |
54 | 54 | $this->settings = $settings; |
55 | - if (!empty($this->settings['groups'])) { |
|
55 | + if ( ! empty($this->settings['groups'])) { |
|
56 | 56 | sort($this->settings['groups']); |
57 | 57 | $this->_groupPrefix = str_repeat('%s_', count($this->settings['groups'])); |
58 | 58 | } |
59 | - if (!is_numeric($this->settings['duration'])) { |
|
59 | + if ( ! is_numeric($this->settings['duration'])) { |
|
60 | 60 | $this->settings['duration'] = strtotime($this->settings['duration']) - time(); |
61 | 61 | } |
62 | 62 | return true; |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | $prefix = ''; |
172 | - if (!empty($this->_groupPrefix)) { |
|
172 | + if ( ! empty($this->_groupPrefix)) { |
|
173 | 173 | $prefix = vsprintf($this->_groupPrefix, $this->groups()); |
174 | 174 | } |
175 | 175 | |
176 | 176 | $key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DS, '/', '.'), '_', strval($key))))); |
177 | - return $prefix . $key; |
|
177 | + return $prefix.$key; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Write data for key into cache |
105 | 105 | * |
106 | 106 | * @param string $key Identifier for the data |
107 | - * @param mixed $data Data to be cached |
|
107 | + * @param string $data Data to be cached |
|
108 | 108 | * @param integer $duration How long to cache the data, in seconds |
109 | 109 | * @return boolean True if the data was successfully cached, false on failure |
110 | 110 | */ |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * Generates a safe key for use with cache engine storage engines. |
392 | 392 | * |
393 | 393 | * @param string $key the key passed over |
394 | - * @return mixed string $key or false |
|
394 | + * @return false|string string $key or false |
|
395 | 395 | */ |
396 | 396 | public function key($key) { |
397 | 397 | if (empty($key)) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (substr($this->settings['path'], -1) !== DS) { |
85 | 85 | $this->settings['path'] .= DS; |
86 | 86 | } |
87 | - if (!empty($this->_groupPrefix)) { |
|
87 | + if ( ! empty($this->_groupPrefix)) { |
|
88 | 88 | $this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix); |
89 | 89 | } |
90 | 90 | return $this->_active(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return boolean True if the data was successfully cached, false on failure |
110 | 110 | */ |
111 | 111 | public function write($key, $data, $duration) { |
112 | - if ($data === '' || !$this->_init) { |
|
112 | + if ($data === '' || ! $this->_init) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $lineBreak = "\r\n"; |
124 | 124 | } |
125 | 125 | |
126 | - if (!empty($this->settings['serialize'])) { |
|
126 | + if ( ! empty($this->settings['serialize'])) { |
|
127 | 127 | if ($this->settings['isWindows']) { |
128 | 128 | $data = str_replace('\\', '\\\\\\\\', serialize($data)); |
129 | 129 | } else { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | $expires = time() + $duration; |
135 | - $contents = $expires . $lineBreak . $data . $lineBreak; |
|
135 | + $contents = $expires.$lineBreak.$data.$lineBreak; |
|
136 | 136 | |
137 | 137 | if ($this->settings['lock']) { |
138 | 138 | $this->_File->flock(LOCK_EX); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it |
156 | 156 | */ |
157 | 157 | public function read($key) { |
158 | - if (!$this->_init || $this->_setKey($key) === false) { |
|
158 | + if ( ! $this->_init || $this->_setKey($key) === false) { |
|
159 | 159 | return false; |
160 | 160 | } |
161 | 161 | |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | $data = trim($data); |
189 | 189 | |
190 | - if ($data !== '' && !empty($this->settings['serialize'])) { |
|
190 | + if ($data !== '' && ! empty($this->settings['serialize'])) { |
|
191 | 191 | if ($this->settings['isWindows']) { |
192 | 192 | $data = str_replace('\\\\\\\\', '\\', $data); |
193 | 193 | } |
194 | - $data = unserialize((string)$data); |
|
194 | + $data = unserialize((string) $data); |
|
195 | 195 | } |
196 | 196 | return $data; |
197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed |
204 | 204 | */ |
205 | 205 | public function delete($key) { |
206 | - if ($this->_setKey($key) === false || !$this->_init) { |
|
206 | + if ($this->_setKey($key) === false || ! $this->_init) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | $path = $this->_File->getRealPath(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return boolean True if the cache was successfully cleared, false otherwise |
222 | 222 | */ |
223 | 223 | public function clear($check) { |
224 | - if (!$this->_init) { |
|
224 | + if ( ! $this->_init) { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | $this->_File = null; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | - $path = $path->getRealPath() . DS; |
|
246 | - if (!in_array($path, $cleared)) { |
|
245 | + $path = $path->getRealPath().DS; |
|
246 | + if ( ! in_array($path, $cleared)) { |
|
247 | 247 | $this->_clearDirectory($path, $now, $threshold); |
248 | 248 | $cleared[] = $path; |
249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | protected function _clearDirectory($path, $now, $threshold) { |
263 | 263 | $prefixLength = strlen($this->settings['prefix']); |
264 | 264 | |
265 | - if (!is_dir($path)) { |
|
265 | + if ( ! is_dir($path)) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { |
272 | 272 | continue; |
273 | 273 | } |
274 | - $filePath = $path . $entry; |
|
275 | - if (!file_exists($filePath) || is_dir($filePath)) { |
|
274 | + $filePath = $path.$entry; |
|
275 | + if ( ! file_exists($filePath) || is_dir($filePath)) { |
|
276 | 276 | continue; |
277 | 277 | } |
278 | - $file = new SplFileObject($path . $entry, 'r'); |
|
278 | + $file = new SplFileObject($path.$entry, 'r'); |
|
279 | 279 | |
280 | 280 | if ($threshold) { |
281 | 281 | $mtime = $file->getMTime(); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if ($mtime > $threshold) { |
284 | 284 | continue; |
285 | 285 | } |
286 | - $expires = (int)$file->current(); |
|
286 | + $expires = (int) $file->current(); |
|
287 | 287 | |
288 | 288 | if ($expires > $now) { |
289 | 289 | continue; |
@@ -334,17 +334,17 @@ discard block |
||
334 | 334 | */ |
335 | 335 | protected function _setKey($key, $createKey = false) { |
336 | 336 | $groups = null; |
337 | - if (!empty($this->_groupPrefix)) { |
|
337 | + if ( ! empty($this->_groupPrefix)) { |
|
338 | 338 | $groups = vsprintf($this->_groupPrefix, $this->groups()); |
339 | 339 | } |
340 | - $dir = $this->settings['path'] . $groups; |
|
340 | + $dir = $this->settings['path'].$groups; |
|
341 | 341 | |
342 | - if (!is_dir($dir)) { |
|
342 | + if ( ! is_dir($dir)) { |
|
343 | 343 | mkdir($dir, 0775, true); |
344 | 344 | } |
345 | - $path = new SplFileInfo($dir . $key); |
|
345 | + $path = new SplFileInfo($dir.$key); |
|
346 | 346 | |
347 | - if (!$createKey && !$path->isFile()) { |
|
347 | + if ( ! $createKey && ! $path->isFile()) { |
|
348 | 348 | return false; |
349 | 349 | } |
350 | 350 | if (empty($this->_File) || $this->_File->getBaseName() !== $key) { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | unset($path); |
359 | 359 | |
360 | - if (!$exists && !chmod($this->_File->getPathname(), (int)$this->settings['mask'])) { |
|
360 | + if ( ! $exists && ! chmod($this->_File->getPathname(), (int) $this->settings['mask'])) { |
|
361 | 361 | trigger_error(__d( |
362 | 362 | 'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"', |
363 | 363 | array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING); |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | $dir = new SplFileInfo($this->settings['path']); |
376 | 376 | if (Configure::read('debug')) { |
377 | 377 | $path = $dir->getPathname(); |
378 | - if (!is_dir($path)) { |
|
378 | + if ( ! is_dir($path)) { |
|
379 | 379 | mkdir($path, 0775, true); |
380 | 380 | } |
381 | 381 | } |
382 | - if ($this->_init && !($dir->isDir() && $dir->isWritable())) { |
|
382 | + if ($this->_init && ! ($dir->isDir() && $dir->isWritable())) { |
|
383 | 383 | $this->_init = false; |
384 | 384 | trigger_error(__d('cake_dev', '%s is not writable', $this->settings['path']), E_USER_WARNING); |
385 | 385 | return false; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); |
413 | 413 | $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); |
414 | 414 | foreach ($contents as $object) { |
415 | - $containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false; |
|
415 | + $containsGroup = strpos($object->getPathName(), DS.$group.DS) !== false; |
|
416 | 416 | $hasPrefix = true; |
417 | 417 | if (strlen($this->settings['prefix']) !== 0) { |
418 | 418 | $hasPrefix = strpos($object->getBaseName(), $this->settings['prefix']) === 0; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param string $key Identifier for the data |
135 | 135 | * @param integer $offset How much to increment |
136 | - * @return New incremented value, false otherwise |
|
136 | + * @return integer incremented value, false otherwise |
|
137 | 137 | * @throws CacheException when you try to increment with compress = true |
138 | 138 | */ |
139 | 139 | public function increment($key, $offset = 1) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param string $key Identifier for the data |
147 | 147 | * @param integer $offset How much to subtract |
148 | - * @return New decremented value, false otherwise |
|
148 | + * @return integer decremented value, false otherwise |
|
149 | 149 | * @throws CacheException when you try to decrement with compress = true |
150 | 150 | */ |
151 | 151 | public function decrement($key, $offset = 1) { |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Redis storage engine for cache |
|
4 | - * |
|
5 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
6 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | - * |
|
8 | - * Licensed under The MIT License |
|
9 | - * For full copyright and license information, please see the LICENSE.txt |
|
10 | - * Redistributions of files must retain the above copyright notice. |
|
11 | - * |
|
12 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | - * @link http://cakephp.org CakePHP(tm) Project |
|
14 | - * @package Cake.Cache.Engine |
|
15 | - * @since CakePHP(tm) v 2.2 |
|
16 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | - */ |
|
3 | + * Redis storage engine for cache |
|
4 | + * |
|
5 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
6 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | + * |
|
8 | + * Licensed under The MIT License |
|
9 | + * For full copyright and license information, please see the LICENSE.txt |
|
10 | + * Redistributions of files must retain the above copyright notice. |
|
11 | + * |
|
12 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | + * @link http://cakephp.org CakePHP(tm) Project |
|
14 | + * @package Cake.Cache.Engine |
|
15 | + * @since CakePHP(tm) v 2.2 |
|
16 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Redis storage engine for cache. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return boolean True if the engine has been successfully initialized, false if not |
53 | 53 | */ |
54 | 54 | public function init($settings = array()) { |
55 | - if (!class_exists('Redis')) { |
|
55 | + if ( ! class_exists('Redis')) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | parent::init(array_merge(array( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return boolean True if the data was successfully cached, false on failure |
102 | 102 | */ |
103 | 103 | public function write($key, $value, $duration) { |
104 | - if (!is_int($value)) { |
|
104 | + if ( ! is_int($value)) { |
|
105 | 105 | $value = serialize($value); |
106 | 106 | } |
107 | 107 | if ($duration === 0) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function read($key) { |
121 | 121 | $value = $this->_Redis->get($key); |
122 | 122 | if (ctype_digit($value)) { |
123 | - $value = (int)$value; |
|
123 | + $value = (int) $value; |
|
124 | 124 | } |
125 | 125 | if ($value !== false && is_string($value)) { |
126 | 126 | $value = unserialize($value); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @throws CacheException when you try to increment with compress = true |
138 | 138 | */ |
139 | 139 | public function increment($key, $offset = 1) { |
140 | - return (int)$this->_Redis->incrBy($key, $offset); |
|
140 | + return (int) $this->_Redis->incrBy($key, $offset); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @throws CacheException when you try to decrement with compress = true |
150 | 150 | */ |
151 | 151 | public function decrement($key, $offset = 1) { |
152 | - return (int)$this->_Redis->decrBy($key, $offset); |
|
152 | + return (int) $this->_Redis->decrBy($key, $offset); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($check) { |
173 | 173 | return true; |
174 | 174 | } |
175 | - $keys = $this->_Redis->getKeys($this->settings['prefix'] . '*'); |
|
175 | + $keys = $this->_Redis->getKeys($this->settings['prefix'].'*'); |
|
176 | 176 | $this->_Redis->del($keys); |
177 | 177 | |
178 | 178 | return true; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | public function groups() { |
189 | 189 | $result = array(); |
190 | 190 | foreach ($this->settings['groups'] as $group) { |
191 | - $value = $this->_Redis->get($this->settings['prefix'] . $group); |
|
192 | - if (!$value) { |
|
191 | + $value = $this->_Redis->get($this->settings['prefix'].$group); |
|
192 | + if ( ! $value) { |
|
193 | 193 | $value = 1; |
194 | - $this->_Redis->set($this->settings['prefix'] . $group, $value); |
|
194 | + $this->_Redis->set($this->settings['prefix'].$group, $value); |
|
195 | 195 | } |
196 | - $result[] = $group . $value; |
|
196 | + $result[] = $group.$value; |
|
197 | 197 | } |
198 | 198 | return $result; |
199 | 199 | } |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return boolean success |
206 | 206 | */ |
207 | 207 | public function clearGroup($group) { |
208 | - return (bool)$this->_Redis->incr($this->settings['prefix'] . $group); |
|
208 | + return (bool) $this->_Redis->incr($this->settings['prefix'].$group); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Disconnects from the redis server |
213 | 213 | */ |
214 | 214 | public function __destruct() { |
215 | - if (!$this->settings['persistent']) { |
|
215 | + if ( ! $this->settings['persistent']) { |
|
216 | 216 | $this->_Redis->close(); |
217 | 217 | } |
218 | 218 | } |