From 15441ded5d0f1e12b4a8604d7e6f5745d1fe3ad6 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 22 Aug 2009 11:22:50 +0000 Subject: [PATCH] do not try to display a tab that was not built --- ChangeLog | 29 +- Documentation.html | 156 +- config.sample.inc.php | 1 + db_structure.php | 10 + db_tracking.php | 206 + docs.css | 5 + import.php | 13 +- lang/afrikaans-utf-8.inc.php | 77 + lang/albanian-utf-8.inc.php | 157 +- lang/arabic-utf-8.inc.php | 77 + lang/azerbaijani-utf-8.inc.php | 77 + lang/bangla-utf-8.inc.php | 79 +- lang/basque-utf-8.inc.php | 77 + lang/belarusian_cyrillic-utf-8.inc.php | 77 + lang/belarusian_latin-utf-8.inc.php | 77 + lang/bosnian-utf-8.inc.php | 77 + lang/brazilian_portuguese-utf-8.inc.php | 2236 ++-- lang/bulgarian-utf-8.inc.php | 77 + lang/catalan-utf-8.inc.php | 99 +- lang/chinese_simplified-utf-8.inc.php | 77 + lang/chinese_traditional-utf-8.inc.php | 89 +- lang/croatian-utf-8.inc.php | 77 + lang/czech-utf-8.inc.php | 85 +- lang/danish-utf-8.inc.php | 77 + lang/dutch-utf-8.inc.php | 83 +- lang/english-utf-8.inc.php | 77 + lang/estonian-utf-8.inc.php | 153 +- lang/finnish-utf-8.inc.php | 77 + lang/french-utf-8.inc.php | 107 +- lang/galician-utf-8.inc.php | 77 + lang/georgian-utf-8.inc.php | 77 + lang/german-utf-8.inc.php | 735 +- lang/greek-utf-8.inc.php | 535 +- lang/hebrew-utf-8.inc.php | 79 +- lang/hindi-utf-8.inc.php | 157 +- lang/hungarian-utf-8.inc.php | 79 +- lang/indonesian-utf-8.inc.php | 77 + lang/italian-utf-8.inc.php | 77 + lang/japanese-utf-8.inc.php | 77 + lang/korean-utf-8.inc.php | 77 + lang/latvian-utf-8.inc.php | 77 + lang/lithuanian-utf-8.inc.php | 81 +- lang/macedonian_cyrillic-utf-8.inc.php | 77 + lang/malay-utf-8.inc.php | 77 + lang/mongolian-utf-8.inc.php | 195 +- lang/norwegian-utf-8.inc.php | 77 + lang/persian-utf-8.inc.php | 131 +- lang/polish-utf-8.inc.php | 79 +- lang/portuguese-utf-8.inc.php | 77 + lang/romanian-utf-8.inc.php | 79 +- lang/russian-utf-8.inc.php | 79 +- lang/serbian_cyrillic-utf-8.inc.php | 77 + lang/serbian_latin-utf-8.inc.php | 77 + lang/sinhala-utf-8.inc.php | 81 +- lang/slovak-utf-8.inc.php | 77 + lang/slovenian-utf-8.inc.php | 77 + lang/spanish-utf-8.inc.php | 115 +- lang/swedish-utf-8.inc.php | 106 +- lang/tatarish-utf-8.inc.php | 77 + lang/thai-utf-8.inc.php | 79 +- lang/turkish-utf-8.inc.php | 109 +- lang/ukrainian-utf-8.inc.php | 77 + lang/uzbek_cyrillic-utf-8.inc.php | 85 +- lang/uzbek_latin-utf-8.inc.php | 85 +- libraries/Message.class.php | 2 +- libraries/PHPExcel/PHPExcel.php | 749 ++ libraries/PHPExcel/PHPExcel/Calculation.php | 3075 +++++ .../PHPExcel/Calculation/Exception.php | 52 + .../PHPExcel/Calculation/ExceptionHandler.php | 60 + .../PHPExcel/Calculation/FormulaParser.php | 625 + .../PHPExcel/Calculation/FormulaToken.php | 176 + .../PHPExcel/Calculation/Function.php | 149 + .../PHPExcel/Calculation/Functions.php | 10505 ++++++++++++++++ .../PHPExcel/Calculation/functionlist.txt | 351 + libraries/PHPExcel/PHPExcel/Cell.php | 801 ++ .../PHPExcel/Cell/AdvancedValueBinder.php | 145 + libraries/PHPExcel/PHPExcel/Cell/DataType.php | 85 + .../PHPExcel/PHPExcel/Cell/DataValidation.php | 509 + .../PHPExcel/Cell/DefaultValueBinder.php | 108 + .../PHPExcel/PHPExcel/Cell/Hyperlink.php | 159 + .../PHPExcel/PHPExcel/Cell/IValueBinder.php | 58 + libraries/PHPExcel/PHPExcel/Comment.php | 337 + .../PHPExcel/PHPExcel/DocumentProperties.php | 345 + .../PHPExcel/PHPExcel/DocumentSecurity.php | 230 + libraries/PHPExcel/PHPExcel/HashTable.php | 228 + libraries/PHPExcel/PHPExcel/IComparable.php | 62 + libraries/PHPExcel/PHPExcel/IOFactory.php | 209 + libraries/PHPExcel/PHPExcel/NamedRange.php | 231 + libraries/PHPExcel/PHPExcel/Reader/CSV.php | 294 + .../PHPExcel/Reader/DefaultReadFilter.php | 61 + .../PHPExcel/PHPExcel/Reader/Excel2007.php | 1565 +++ libraries/PHPExcel/PHPExcel/Reader/Excel5.php | 5246 ++++++++ .../PHPExcel/Reader/Excel5/Escher.php | 709 ++ .../PHPExcel/PHPExcel/Reader/IReadFilter.php | 47 + .../PHPExcel/PHPExcel/Reader/IReader.php | 53 + .../PHPExcel/PHPExcel/Reader/Serialized.php | 133 + .../PHPExcel/PHPExcel/ReferenceHelper.php | 546 + libraries/PHPExcel/PHPExcel/RichText.php | 306 + .../PHPExcel/RichText/ITextElement.php | 76 + libraries/PHPExcel/PHPExcel/RichText/Run.php | 120 + .../PHPExcel/RichText/TextElement.php | 123 + libraries/PHPExcel/PHPExcel/Shared/Date.php | 277 + .../PHPExcel/PHPExcel/Shared/Drawing.php | 137 + libraries/PHPExcel/PHPExcel/Shared/Escher.php | 91 + .../PHPExcel/Shared/Escher/DgContainer.php | 83 + .../Escher/DgContainer/SpgrContainer.php | 109 + .../DgContainer/SpgrContainer/SpContainer.php | 368 + .../PHPExcel/Shared/Escher/DggContainer.php | 177 + .../Escher/DggContainer/BstoreContainer.php | 65 + .../DggContainer/BstoreContainer/BSE.php | 120 + .../DggContainer/BstoreContainer/BSE/Blip.php | 91 + libraries/PHPExcel/PHPExcel/Shared/Excel5.php | 322 + libraries/PHPExcel/PHPExcel/Shared/File.php | 98 + libraries/PHPExcel/PHPExcel/Shared/Font.php | 155 + .../PHPExcel/Shared/JAMA/CHANGELOG.TXT | 16 + .../Shared/JAMA/CholeskyDecomposition.php | 133 + .../Shared/JAMA/EigenvalueDecomposition.php | 789 ++ .../PHPExcel/Shared/JAMA/LUDecomposition.php | 222 + .../PHPExcel/PHPExcel/Shared/JAMA/Matrix.php | 1331 ++ .../PHPExcel/Shared/JAMA/QRDecomposition.php | 195 + .../JAMA/SingularValueDecomposition.php | 501 + .../PHPExcel/Shared/JAMA/utils/Error.php | 120 + .../PHPExcel/Shared/JAMA/utils/Maths.php | 40 + libraries/PHPExcel/PHPExcel/Shared/OLE.php | 555 + .../Shared/OLE/ChainedBlockStream.php | 234 + .../PHPExcel/PHPExcel/Shared/OLE/OLE_File.php | 130 + .../PHPExcel/PHPExcel/Shared/OLE/OLE_PPS.php | 228 + .../PHPExcel/PHPExcel/Shared/OLE/OLE_Root.php | 489 + .../PHPExcel/PHPExcel/Shared/OLERead.php | 305 + libraries/PHPExcel/PHPExcel/Shared/PDF.php | 39 + .../PHPExcel/Shared/PasswordHasher.php | 67 + libraries/PHPExcel/PHPExcel/Shared/String.php | 321 + .../PHPExcel/PHPExcel/Shared/XMLWriter.php | 141 + .../PHPExcel/Shared/ZipStreamWrapper.php | 182 + .../PHPExcel/Shared/trend/bestFitClass.php | 319 + .../Shared/trend/exponentialBestFitClass.php | 100 + .../Shared/trend/linearBestFitClass.php | 81 + .../Shared/trend/logarithmicBestFitClass.php | 84 + .../Shared/trend/polynomialBestFitClass.php | 175 + .../Shared/trend/powerBestFitClass.php | 94 + .../PHPExcel/Shared/trend/trendClass.php | 116 + libraries/PHPExcel/PHPExcel/Style.php | 702 ++ .../PHPExcel/PHPExcel/Style/Alignment.php | 532 + libraries/PHPExcel/PHPExcel/Style/Border.php | 428 + libraries/PHPExcel/PHPExcel/Style/Borders.php | 544 + libraries/PHPExcel/PHPExcel/Style/Color.php | 451 + .../PHPExcel/PHPExcel/Style/Conditional.php | 323 + libraries/PHPExcel/PHPExcel/Style/Fill.php | 447 + libraries/PHPExcel/PHPExcel/Style/Font.php | 665 + .../PHPExcel/PHPExcel/Style/NumberFormat.php | 658 + .../PHPExcel/PHPExcel/Style/Protection.php | 324 + libraries/PHPExcel/PHPExcel/Worksheet.php | 2378 ++++ .../PHPExcel/Worksheet/BaseDrawing.php | 533 + .../PHPExcel/Worksheet/CellIterator.php | 176 + .../PHPExcel/Worksheet/ColumnDimension.php | 238 + .../PHPExcel/PHPExcel/Worksheet/Drawing.php | 200 + .../PHPExcel/Worksheet/Drawing/Shadow.php | 336 + .../PHPExcel/Worksheet/HeaderFooter.php | 489 + .../Worksheet/HeaderFooterDrawing.php | 401 + .../PHPExcel/Worksheet/MemoryDrawing.php | 252 + .../PHPExcel/Worksheet/PageMargins.php | 227 + .../PHPExcel/PHPExcel/Worksheet/PageSetup.php | 590 + .../PHPExcel/Worksheet/Protection.php | 575 + libraries/PHPExcel/PHPExcel/Worksheet/Row.php | 108 + .../PHPExcel/Worksheet/RowDimension.php | 210 + .../PHPExcel/Worksheet/RowIterator.php | 129 + .../PHPExcel/PHPExcel/Worksheet/SheetView.php | 133 + .../PHPExcel/PHPExcel/WorksheetIterator.php | 126 + libraries/PHPExcel/PHPExcel/Writer/CSV.php | 320 + .../PHPExcel/PHPExcel/Writer/Excel2007.php | 580 + .../PHPExcel/Writer/Excel2007/Comments.php | 304 + .../Writer/Excel2007/ContentTypes.php | 262 + .../PHPExcel/Writer/Excel2007/DocProps.php | 220 + .../PHPExcel/Writer/Excel2007/Drawing.php | 552 + .../PHPExcel/Writer/Excel2007/Rels.php | 389 + .../PHPExcel/Writer/Excel2007/StringTable.php | 269 + .../PHPExcel/Writer/Excel2007/Style.php | 713 ++ .../PHPExcel/Writer/Excel2007/Theme.php | 1223 ++ .../PHPExcel/Writer/Excel2007/Workbook.php | 461 + .../PHPExcel/Writer/Excel2007/Worksheet.php | 1111 ++ .../PHPExcel/Writer/Excel2007/WriterPart.php | 80 + libraries/PHPExcel/PHPExcel/Writer/Excel5.php | 251 + .../PHPExcel/Writer/Excel5/BIFFwriter.php | 270 + .../PHPExcel/Writer/Excel5/Escher.php | 509 + .../PHPExcel/PHPExcel/Writer/Excel5/Font.php | 208 + .../PHPExcel/Writer/Excel5/Parser.php | 1575 +++ .../PHPExcel/Writer/Excel5/Workbook.php | 1546 +++ .../PHPExcel/Writer/Excel5/Worksheet.php | 2862 +++++ .../PHPExcel/PHPExcel/Writer/Excel5/Xf.php | 579 + libraries/PHPExcel/PHPExcel/Writer/HTML.php | 1088 ++ .../PHPExcel/PHPExcel/Writer/IWriter.php | 45 + libraries/PHPExcel/PHPExcel/Writer/PDF.php | 175 + .../PHPExcel/PHPExcel/Writer/Serialized.php | 208 + libraries/Tracker.class.php | 903 ++ libraries/common.inc.php | 12 +- libraries/common.lib.php | 29 +- libraries/config.default.php | 179 +- libraries/database_interface.lib.php | 40 +- libraries/db_links.inc.php | 10 + libraries/db_structure.lib.php | 34 +- libraries/dbi/mysql.dbi.lib.php | 3 + libraries/dbi/mysqli.dbi.lib.php | 3 + libraries/export/htmlexcel.php | 196 - libraries/export/sql.php | 60 +- libraries/export/xls.php | 192 +- libraries/export/xlsx.php | 205 + libraries/export/xml.php | 252 +- libraries/header_scripts.inc.php | 2 +- libraries/import.lib.php | 844 +- libraries/import/csv.php | 255 +- libraries/import/ods.php | 281 + libraries/import/upload/apc.php | 2 +- libraries/import/upload/noplugin.php | 2 +- libraries/import/upload/uploadprogress.php | 2 +- libraries/import/xls.php | 148 + libraries/import/xlsx.php | 148 + libraries/import/xml.php | 296 + libraries/relation.lib.php | 12 + libraries/sql_query_form.lib.php | 2 + libraries/tbl_links.inc.php | 13 + libraries/tbl_properties.inc.php | 6 +- .../text_plain__longToIpv4.inc.php | 2 +- libraries/zip_extension.lib.php | 40 +- scripts/create-release.sh | 27 +- scripts/create_tables.sql | 18 + server_status.php | 16 +- tbl_change.php | 10 +- tbl_structure.php | 19 +- tbl_tracking.php | 707 ++ test/wui.php | 2 +- themes/darkblue_orange/img/eye.png | Bin 0 -> 750 bytes themes/original/img/eye.png | Bin 0 -> 750 bytes themes/original/img/eye_grey.png | Bin 0 -> 550 bytes 233 files changed, 76811 insertions(+), 2473 deletions(-) create mode 100644 db_tracking.php create mode 100644 libraries/PHPExcel/PHPExcel.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/Exception.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/FormulaParser.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/FormulaToken.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/Function.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/Functions.php create mode 100644 libraries/PHPExcel/PHPExcel/Calculation/functionlist.txt create mode 100644 libraries/PHPExcel/PHPExcel/Cell.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/DataType.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/DataValidation.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/Hyperlink.php create mode 100644 libraries/PHPExcel/PHPExcel/Cell/IValueBinder.php create mode 100644 libraries/PHPExcel/PHPExcel/Comment.php create mode 100644 libraries/PHPExcel/PHPExcel/DocumentProperties.php create mode 100644 libraries/PHPExcel/PHPExcel/DocumentSecurity.php create mode 100644 libraries/PHPExcel/PHPExcel/HashTable.php create mode 100644 libraries/PHPExcel/PHPExcel/IComparable.php create mode 100644 libraries/PHPExcel/PHPExcel/IOFactory.php create mode 100644 libraries/PHPExcel/PHPExcel/NamedRange.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/CSV.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/Excel2007.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/Excel5.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/Excel5/Escher.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/IReadFilter.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/IReader.php create mode 100644 libraries/PHPExcel/PHPExcel/Reader/Serialized.php create mode 100644 libraries/PHPExcel/PHPExcel/ReferenceHelper.php create mode 100644 libraries/PHPExcel/PHPExcel/RichText.php create mode 100644 libraries/PHPExcel/PHPExcel/RichText/ITextElement.php create mode 100644 libraries/PHPExcel/PHPExcel/RichText/Run.php create mode 100644 libraries/PHPExcel/PHPExcel/RichText/TextElement.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Date.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Drawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Excel5.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/File.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/Font.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/CHANGELOG.TXT create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/LUDecomposition.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/Matrix.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/QRDecomposition.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/SingularValueDecomposition.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Error.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Maths.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLE.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLE/ChainedBlockStream.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_PPS.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_Root.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/OLERead.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/PDF.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/PasswordHasher.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/String.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/XMLWriter.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/ZipStreamWrapper.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/bestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/exponentialBestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/linearBestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/polynomialBestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/powerBestFitClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Shared/trend/trendClass.php create mode 100644 libraries/PHPExcel/PHPExcel/Style.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Alignment.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Border.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Borders.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Color.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Conditional.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Fill.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Font.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/NumberFormat.php create mode 100644 libraries/PHPExcel/PHPExcel/Style/Protection.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/BaseDrawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/CellIterator.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/ColumnDimension.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/Drawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/Drawing/Shadow.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooter.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooterDrawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/MemoryDrawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/PageMargins.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/PageSetup.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/Protection.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/Row.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/RowDimension.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/RowIterator.php create mode 100644 libraries/PHPExcel/PHPExcel/Worksheet/SheetView.php create mode 100644 libraries/PHPExcel/PHPExcel/WorksheetIterator.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/CSV.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Comments.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/ContentTypes.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/DocProps.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Drawing.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Rels.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/StringTable.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Style.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Theme.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Workbook.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/Worksheet.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel2007/WriterPart.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/BIFFwriter.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Escher.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Font.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Parser.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Workbook.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Worksheet.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Excel5/Xf.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/HTML.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/IWriter.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/PDF.php create mode 100644 libraries/PHPExcel/PHPExcel/Writer/Serialized.php create mode 100644 libraries/Tracker.class.php delete mode 100644 libraries/export/htmlexcel.php create mode 100644 libraries/export/xlsx.php create mode 100644 libraries/import/ods.php create mode 100644 libraries/import/xls.php create mode 100644 libraries/import/xlsx.php create mode 100644 libraries/import/xml.php create mode 100644 tbl_tracking.php create mode 100644 themes/darkblue_orange/img/eye.png create mode 100644 themes/original/img/eye.png create mode 100644 themes/original/img/eye_grey.png diff --git a/ChangeLog b/ChangeLog index f71e68193..abfe6a6dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,8 +21,26 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug [gui] Generate Password not working for 'Change Login Information', only for 'Change password' + [lang] Arabic update, thanks to Meno25 - meno25 + rfe #2822190 [structure] BOOLEAN is standard SQL +- bug #2823599 [edit] UUID Primary Key wrongly updated ++ [lang] German update, thanks to knittl ++ [lang] German update, thanks to virsacer ++ rfe #2813867 [structure] Default sorting order in list of tables ++ [import] Added MySQL type-detection functionality to import library, + thanks to Derek Schaefer ++ [import] Added ODS, Excel XLS, Excel XLSX, and XML import modules, + thanks to Derek Schaefer ++ [export] Added Excel XLSX export module, + thanks to Derek Schaefer ++ [core] Addded ability for tracking changes made through phpMyAdmin -3.2.1.0 (not yet released) +3.2.2.0 (not yet released) +- bug #2825293 [structure] Default value for a BIT column +- bug [display] Red arrows were reversed in the list of tables +- bug #2813879 [export] Duplicate empty lines when exporting without comments +- bug #2825919 [export] Trigger export with database name +- bug #2823996 [data] Cannot edit row with no PK and a BIT field + +3.2.1.0 (2009-08-09) - bug #2799009 Login with ipv6 IP address breaks redirect - bug #2796066 [priv] Inconsistent display of databases list - bug #2802870 [display] Incorrect overhead value for InnoDB @@ -41,6 +59,15 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #2819944 [setup] Incorrect mention of designer_coords - bug #2821757 [insert] "Insert another new row" no longer worked + [lang] Norwegian update, thanks to Sven-Erik Andersen +- bug [core] PMA_pow() can support negative exponents in the pow() case ++ [lang] Brazilian Portuguese update, thanks to Fabio Bucior - fabiobucior +- patch #2822384 [docs] Missing auth_type in docs-example, + thanks to Jürgen Wind - windkiel +- patch #2819728 [display] Slider effect jumping to top of page, + thanks to Jan Radem - summsel +- bug [display] Incorrect computation of overhead stats in server view + for tables under the InnoDB engine ++ [lang] Swedish update, thanks to Björn T. Hallberg 3.2.0.1 (2009-06-30) - [security] XSS: Insufficient output sanitizing in bookmarks diff --git a/Documentation.html b/Documentation.html index 12f0fb196..38a42333d 100644 --- a/Documentation.html +++ b/Documentation.html @@ -53,7 +53,7 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
  • License: LICENSE
  • -
  • Documentation version: +
  • Documentation version:
    $Id$
  • @@ -111,15 +111,16 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
  • create1 and read dumps of tables
  • export1 data to various formats: - CSV, + CSV, XML, PDF, ISO/IEC 26300 - OpenDocument Text and Spreadsheet, Word, - Excel and LATEX formats + Excel and LATEX formats
  • +
  • import data and MySQL structures from Microsoft Excel and OpenDocument spreadsheets, as well as XML, CSV, and SQL files
  • administer multiple servers
  • manage MySQL users and privileges
  • check referential integrity in MyISAM tables
  • @@ -131,6 +132,7 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
  • transform stored data into any format using a set of predefined functions, like displaying BLOB-data as image or download-link
  • +
  • track changes on databases, tables and views
  • support InnoDB tables and foreign keys (see FAQ 3.6)
  • support mysqli, the improved MySQL extension @@ -235,6 +237,7 @@ $i=0; $i++; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'cbb74bc'; // use here your password +$cfg['Servers'][$i]['auth_type'] = 'config'; ?> For a full explanation of possible configuration values, see the @@ -318,6 +321,7 @@ rm -rf config # remove not needed directory

    For a whole set of new features (bookmarks, comments, SQL-history, + tracking mechanism, PDF-generation, field contents transformation, etc.) you need to create a set of special tables. Those tables can be located in your own database, or in a central database for a @@ -1028,6 +1032,93 @@ ALTER TABLE `pma_column_comments` +

    + $cfg['Servers'][$i]['tracking'] string +
    +
    + Since release 3.3.x a tracking mechanism is available. + It helps you to track every SQL command which + is executed by phpMyAdmin. The mechanism supports logging of data manipulation + and data definition statements. After enabling it you can create versions of tables. +

    + The creation of a version has two effects: + +
      +
    • phpMyAdmin saves a snapshot of the table, including structure and indexes.
    • +
    • phpMyAdmin loggs all commands which change the structure and/or data of the table and links these commands with the version number.
    • +
    + + Of course you can view the tracked changes. On the "Tracking" page a complete report is available for every version. + For the report you can use filters, for example you can get a list of statements within a date range. + When you want to filter usernames you can enter * for all names or you enter a list of names separated by ','. + In addition you can export the (filtered) report to a file or to a temporary database. +

    + + To allow the usage of this functionality: + +
      +
    • set up pmadb and the linked-tables infrastructure
    • +
    • put the table name in $cfg['Servers'][$i]['tracking']
    • +
    +
    + +
    + $cfg['Servers'][$i]['tracking_version_auto_create'] boolean +
    +
    + Whether the tracking mechanism creates versions for tables and views automatically. Default value is true. +

    + If this is set to true and you create a table or view with + +
      +
    • CREATE TABLE ...
    • +
    • CREATE VIEW ...
    • +
    + + and no version exists for it, the mechanism will + create a version for you automatically. +
    + +
    + $cfg['Servers'][$i]['tracking_default_statements'] string +
    +
    + Defines the list of statements the auto-creation uses for new versions. Default value is +
    + +
    CREATE TABLE,ALTER TABLE,DROP TABLE,RENAME TABLE,
    +CREATE INDEX,DROP INDEX,
    +INSERT,UPDATE,DELETE,TRUNCATE,REPLACE,
    +CREATE VIEW,ALTER VIEW,DROP VIEW,
    +CREATE DATABASE,ALTER DATABASE,DROP DATABASE
    +
    + +
    + $cfg['Servers'][$i]['tracking_version_drop_view'] boolean +
    +
    + Whether a DROP VIEW IF EXISTS statement will added as first line to the log when creating a view. Default value is true. +

    +
    + + +
    + $cfg['Servers'][$i]['tracking_version_drop_table'] boolean +
    +
    + Whether a DROP TABLE IF EXISTS statement will added as first line to the log when creating a table. Default value is true. +

    +
    + +
    + $cfg['Servers'][$i]['tracking_version_drop_database'] boolean +
    +
    + Whether a DROP DATABASE IF EXISTS statement will added as first line to the log when creating a database. Default value is true. +

    +
    + +
    $cfg['Servers'][$i]['designer_coords'] string
    @@ -3330,6 +3421,55 @@ the mysql_upgrade command on the server.

    it's not likely to be solved in the future.

    + + +

    + 3.15 When I import an Excel spreadsheet, some cells with calculations do not display correctly.

    +

    + phpMyAdmin uses the PHPExcel library to parse Excel XLS and XLSX spreadsheets. + Therefore, any limitations that are listed on their page regarding Excel calculations will also apply here. +

    + PHPExcel will be kept up to date so as to make all improvements available to phpMyAdmin users. +

    + +

    + 3.16 When I compress (gzip, bzip2, zip) an Excel workbook and attempt to import it, nothing happens.

    +

    + Since Excel XLSX workbooks are already compressed, there is often times only a small benefit from compressing them yet again. + Support for compressed Excel XLSX and XLS workbooks may be added in the future. +

    + +

    + 3.17 When I import an Excel spreadsheet, my custom cell types are not represented as they are in Excel.

    +

    + Excel's internal representation of custom cell types is rather muddled (especially in Excel 97-2003 binary XLS files). If possible, + consider using a built-in type. These are almost always guarenteed to import correctly. +

    + + + + +

    + 3.18 When I import a CSV file that contains multiple tables, they are lumped together into a single table.

    +

    + There is no reliable way to differetiate tables in CSV format. For the time being, you will have to break apart CSV files containing multiple tables. +

    + + + + +

    + 3.19 When I import a file and have phpMyAdmin determine the appropriate data structure it only uses int, decimal, and varchar types.

    +

    + Currently, the import type-detection system can only assign these MySQL types to columns. In future, more will likely be added but for the time being + you will have to edit the structure to your liking post-import. +

    + Also, you should note the fact that phpMyAdmin will use the size of the largest item in any given column as the column size for the appropriate type. If you + know you will be adding larger items to that column then you should manually adjust the column sizes accordingly. This is done for the sake of efficiency. +

    + + +

    ISPs, multi-user installations

    @@ -4497,6 +4637,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  • improved setup script
  • +
  • Derek Schaefer (Google Summer of Code 2009) +
  • + +
  • Alexander Rutkowski (Google Summer of Code 2009) +
  • +

    diff --git a/config.sample.inc.php b/config.sample.inc.php index 6524de131..bf322f3b2 100644 --- a/config.sample.inc.php +++ b/config.sample.inc.php @@ -53,6 +53,7 @@ $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; +// $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; /* Contrib / Swekey authentication */ // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf'; diff --git a/db_structure.php b/db_structure.php index b53cc92a9..7bad957c2 100644 --- a/db_structure.php +++ b/db_structure.php @@ -312,6 +312,15 @@ foreach ($tables as $keyname => $each_table) { str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME']))); } + $tracking_icon = ''; + if (PMA_Tracker::isActive()) { + if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { + $tracking_icon = '' . $strTrackingIsActive . ''; + } else if (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { + $tracking_icon = '' . $strTrackingIsDeactive . ''; + } + } + if ($num_columns > 0 && $num_tables > $num_columns && (($row_count % $num_columns) == 0)) { $row_count = 1; @@ -331,6 +340,7 @@ foreach ($tables as $keyname => $each_table) { id="checkbox_tbl_" /> + diff --git a/db_tracking.php b/db_tracking.php new file mode 100644 index 000000000..8e30946a8 --- /dev/null +++ b/db_tracking.php @@ -0,0 +1,206 @@ +' . $strNoTablesFound . '

    ' . "\n"; + + if (empty($db_is_information_schema)) + { + require './libraries/display_create_table.lib.php'; + } + + // Display the footer + require_once './libraries/footer.inc.php'; + exit; +} + +// --------------------------------------------------------------------------- + +/* + * Display top menu links + */ +require_once './libraries/db_links.inc.php'; +?> +

    +

    + \'' . PMA_sqlAddslashes('') . '\' ' . + ' GROUP BY '. PMA_backquote('table_name') . + ' ORDER BY '. PMA_backquote('table_name') .'ASC , '. PMA_backquote('version') .' ASC '; + +$sql_result = PMA_query_as_controluser($sql_query); + +// Init HEAD version +$last_version = 0; + +// Get HEAD version +$maxversion = PMA_DBI_fetch_array($sql_result); +$last_version = $maxversion['version']; + +// If a HEAD version exists +if($last_version > 0) +{ +?> +

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + | + |
    + $value) +{ + if(PMA_Tracker::getVersion($GLOBALS['db'], $value['Name']) == -1) + $my_tables[] = $value['Name']; +} + +// If untracked tables exist +if(isset($my_tables)) +{ +?> +

    + + + + + + + + + + $tablename) + { + if(PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) + { + $my_link = ''; + + if ($cfg['PropertiesIconic']) + { + $my_link .= '' . $strTrackingTrackTable . ' '; + } + $my_link .= $strTrackingTrackTable . ''; + ?> + + + + + + +
    + + +

    + 0) +{ + $log = ''; + foreach ($data['ddlog'] as $entry) + { + $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n"; + } + PMA_showMessage($strTrackingDatabaseLog, $log); +} + + +/** + * Display the footer + */ +require_once './libraries/footer.inc.php'; +?> diff --git a/docs.css b/docs.css index 0592f5ad1..e9defb718 100644 --- a/docs.css +++ b/docs.css @@ -249,3 +249,8 @@ p.footnote { p.footnote:first-line { margin-left: -2%; } + +/* Block to mark separate translation string */ +div.l10n { + display: inline; +} diff --git a/import.php b/import.php index 43190ec0b..c1ad4c800 100644 --- a/import.php +++ b/import.php @@ -405,8 +405,15 @@ if (!empty($id_bookmark) && $action_bookmark == 2) { if ($import_type == 'query') { $message = PMA_Message::success(); } else { - $message = PMA_Message::success('strImportSuccessfullyFinished'); - $message->addParam($executed_queries); + if ($import_notice) { + $message = PMA_Message::success(''.$GLOBALS['strImportSuccessfullyFinished'].''); + $message->addParam($executed_queries); + + $message->addString($import_notice); + } else { + $message = PMA_Message::success('strImportSuccessfullyFinished'); + $message->addParam($executed_queries); + } } } @@ -420,7 +427,7 @@ if ($timeout_passed) { // if there is any message, copy it into $_SESSION as well, so we can obtain it by AJAX call if (isset($message)) { - $_SESSION['Import_message']['message'] = $message->getDisplay(); + $_SESSION['Import_message']['message'] = $message->getDisplay(); // $_SESSION['Import_message']['go_back_url'] = $goto.'?'. PMA_generate_common_url(); } // Parse and analyze the query, for correct db and table name diff --git a/lang/afrikaans-utf-8.inc.php b/lang/afrikaans-utf-8.inc.php index b2f09f8d2..e840a7e95 100644 --- a/lang/afrikaans-utf-8.inc.php +++ b/lang/afrikaans-utf-8.inc.php @@ -1490,4 +1490,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/albanian-utf-8.inc.php b/lang/albanian-utf-8.inc.php index c8ef55294..3cff3d318 100644 --- a/lang/albanian-utf-8.inc.php +++ b/lang/albanian-utf-8.inc.php @@ -19,14 +19,14 @@ $month = array('Jan', 'Shk', 'Mar', 'Pri', 'Maj', 'Qer', 'Kor', 'Gsh', 'Sht', 'T $datefmt = '%d %B, %Y at %I:%M %p'; //albanian time $timespanfmt = '%s ditë, %s orë, %s minuta dhe %s sekonda'; - + $strAbortedClients = 'Dështoi'; $strAccessDeniedExplanation = 'phpMyAdmin u përpoq të lidhet me server-in MySQL, dhe server-i refuzoi lidhjen. Kontrollo emrin e host, përdoruesin dhe fjalëkalimin tek file config.inc.php dhe sigurohu që korrispondojnë me informacionet që ju ka dhënë administratori i serverit MySQL.'; $strAccessDenied = 'Hyrja nuk u pranua'; $strAction = 'Veprimi'; $strAddAutoIncrement = 'Shto vlerë AUTO_INCREMENT'; -$strAddConstraints = 'Shto kushte'; +$strAddConstraints = 'Shto kushte'; $strAddDeleteColumn = 'Shto/Fshi fushën'; $strAddDeleteRow = 'Shto/Fshi kriterin'; $strAddHeaderComment = 'Shto një koment të personalizuar në header (\\n ndërpret rreshtin)'; @@ -41,7 +41,7 @@ $strAddUser = 'Shto një përdorues të ri'; $strAdministration = 'Administrimi'; $strAfterInsertBack = 'Mbrapa'; $strAfterInsertNewInsert = 'Shto një regjistrim të ri'; -$strAfterInsertSame = 'Kthehu mbrapa tek kjo faqe'; +$strAfterInsertSame = 'Kthehu mbrapa tek kjo faqe'; $strAfter = 'Mbas %s'; $strAllTableSameWidth = 'vizualizon të gjitha tabelat me të njëjtën gjërësi?'; $strAll = 'Të gjithë'; @@ -78,7 +78,7 @@ $strBrowse = 'Shfaq'; $strBulgarian = 'Bullgarisht'; $strBzip = '"kompresuar me bzip2"'; -$strCalendar = 'Kalendari'; +$strCalendar = 'Kalendari'; $strCannotLogin = 'E pamundur kryerja e login tek server-i MySQL'; $strCantLoad = 'I pamundur ngarkimi i prapashtesës %s,
    kontrollo konfigurimin e PHP'; $strCantLoadRecodeIconv = 'I pamundur ngarkimi i prapashtesës iconv apo recode të nevoitshëm për konvertimin e karaktereve, konfiguroni php për të lejuar përdorimin e këtyre prapashtesave ose disaktivoni konvertimin e set të karaktereve në phpMyAdmin.'; @@ -117,10 +117,10 @@ $strCompleteInserts = 'Të shtuarat komplet'; $strCompression = 'Kompresim'; $strConfigFileError = 'phpMyAdmin nuk arrin të lexojë file e konfigurimit!
    Kjo mund të ndodhë kur php gjen një parse error në të apo kur php nuk arrin ta gjejë këtë file.
    Ju lutem ngarkoheni direkt file e konfigurimit duke përdorur link-un e mëposhtëm dhe lexoni mesazhin(et) e gabimeve php që merrni. Në shumicën e rasteve mund t\'ju mungojë një apostrofë apo një presje.
    Nëse faqja që do t\'ju hapet është bosh (e bardhë), atëhere gjithçka është në rregull.'; $strConfigureTableCoord = 'Ju lutem, konfiguroni koordinatat për tabelën %s'; -$strConnectionError = 'E pamundur lidhja: rregullime të pavlefshme.'; +$strConnectionError = 'E pamundur lidhja: rregullime të pavlefshme.'; $strConnections = 'Lidhje'; -$strConstraintsForDumped = 'Kushtet për tabelat e nxjerra'; -$strConstraintsForTable = 'Kushtet për tabelën'; +$strConstraintsForDumped = 'Kushtet për tabelat e nxjerra'; +$strConstraintsForTable = 'Kushtet për tabelën'; $strCookiesRequired = 'Nga kjo pikë e tutje, cookies duhet të jenë të aktivuara.'; $strCopyTable = 'Kopjo tabelën tek (databaza.tabela):'; $strCopyTableOK = 'Tabela %s u kopjua tek %s.'; @@ -138,11 +138,11 @@ $strCriteria = 'Kriteri'; $strCroatian = 'Kroate'; $strCyrillic = 'Cyrillic'; $strCzech = 'Çekisht'; -$strCzechSlovak = 'Çeko-Sllovak'; +$strCzechSlovak = 'Çeko-Sllovak'; $strDanish = 'Danisht'; $strDatabase = 'Databazat'; -$strDatabaseEmpty = 'Emri i databazës mungon!'; +$strDatabaseEmpty = 'Emri i databazës mungon!'; $strDatabaseExportOptions = 'Opcione të eksportimit të databazës'; $strDatabaseHasBeenDropped = 'Databaza %s u eleminua.'; $strDatabases = 'Databazat'; @@ -156,12 +156,12 @@ $strDataOnly = 'Vetëm të dhëna'; $strData = 'Të dhëna'; $strDBComment = 'Komenti për Databazën: '; $strDbPrivileges = 'Të drejta specifike të databazës'; -$strDBRename = 'Ndysho emrin e databazës në'; +$strDBRename = 'Ndysho emrin e databazës në'; $strDbSpecific = 'specifik i databazës'; $strDefault = 'Prezgjedhur'; $strDefaultValueHelp = 'Për vlerat e prezgjedhura, ju lutem shtoni një vlerë të vetme, pa backslash escaping apo thonjëza, duke përdorur këtë format: a'; -$strDefragment = 'Defragmento tabelën'; -$strDelayedInserts = 'Përdor shtimet me vonesë'; +$strDefragment = 'Defragmento tabelën'; +$strDelayedInserts = 'Përdor shtimet me vonesë'; $strDeleteAndFlushDescr = 'Kjo është rruga më e pastër, por ngarkimi i të drejtave mund të zgjasë disa çaste më shumë.'; $strDeleteAndFlush = 'Fshi përdoruesit dhe pastaj rifresko të drejtat.'; $strDeleted = 'rreshti u fshi'; @@ -172,14 +172,14 @@ $strDescending = 'Zbritës'; $strDescription = 'Përshkrimi'; $strDictionary = 'fjalor'; $strDisabled = 'Jo aktiv'; -$strDisableForeignChecks = 'Ç\'aktivo kontrollin e kyçeve të jashtëm'; +$strDisableForeignChecks = 'Ç\'aktivo kontrollin e kyçeve të jashtëm'; $strDisplayFeat = 'Shfaq karakteristikat'; $strDisplayOrder = 'Mënyra e shfaqjes:'; $strDisplayPDF = 'Shfaq skemën e PDF'; $strDoAQuery = 'Zbato "query nga shembull" (karakteri jolly: "%")'; $strDocu = 'Dokumentet'; $strDoYouReally = 'Konfermo: '; -$strDropDatabaseStrongWarning = 'Jeni duke SHKATËRRUAR një databazë komplete!'; +$strDropDatabaseStrongWarning = 'Jeni duke SHKATËRRUAR një databazë komplete!'; $strDrop = 'Elemino'; $strDropUsersDb = 'Elemino databazat që kanë emër të njëjtë me përdoruesit.'; $strDumpingData = 'Dump i të dhënave për tabelën'; @@ -194,7 +194,7 @@ $strEffective = 'Efektiv'; $strEmptyResultSet = 'MySQL ka kthyer një të përbashkët boshe (p.sh. zero rreshta).'; $strEmpty = 'Zbraz'; $strEnabled = 'Aktiv'; -$strEncloseInTransaction = 'Përfshi eksportin në një transacion'; +$strEncloseInTransaction = 'Përfshi eksportin në një transacion'; $strEndCut = 'FUNDI I CUT'; $strEnd = 'Fund'; $strEndRaw = 'FUNDI I RAW'; @@ -230,7 +230,7 @@ $strFunction = 'Funksioni'; $strGenBy = 'Gjeneruar nga'; $strGeneralRelationFeat = 'Karakteristikat e përgjithshme të relacionit'; $strGenTime = 'Gjeneruar më'; -$strGeorgian = 'Gjeorgjisht'; +$strGeorgian = 'Gjeorgjisht'; $strGerman = 'Gjermanisht'; $strGlobal = 'globale'; $strGlobalPrivileges = 'Të drejtat e përgjithshme'; @@ -249,10 +249,10 @@ $strHostEmpty = 'Emri i host është bosh!'; $strHost = 'Host'; $strHungarian = 'Hungarisht'; -$strIcelandic = 'Islandeze'; +$strIcelandic = 'Islandeze'; $strId = 'ID'; $strIdxFulltext = 'Teksti komplet'; -$strIgnoreInserts = 'Përdor shpërfill shtimet'; +$strIgnoreInserts = 'Përdor shpërfill shtimet'; $strIgnore = 'Shpërfill'; $strImportFiles = 'Importo files'; $strIndexes = 'Tregues'; @@ -278,7 +278,7 @@ $strKill = 'Hiq'; $strKorean = 'Koreane'; $strLandscape = 'Horizontale'; -$strLatexCaption = 'Titulli i Tabelës caption'; +$strLatexCaption = 'Titulli i Tabelës caption'; $strLatexContent = 'Përmbajtja e tabelës __TABLE__'; $strLatexContinuedCaption = 'Nëntitulli i tabelës vazhduese'; $strLatexContinued = '(vazhdon)'; @@ -286,7 +286,7 @@ $strLatexIncludeCaption = 'Përfshi nëntitullin e tabelës'; $strLatexLabel = 'Kyçi i etiketës'; $strLaTeX = 'LaTeX'; $strLatexStructure = 'Struktura e tabelës __TABLE__'; -$strLatvian = 'Letone'; +$strLatvian = 'Letone'; $strLengthSet = 'Gjatësia/Set*'; $strLimitNumRows = 'regjistrime për faqe'; $strLinesTerminatedBy = 'Rreshta që mbarojnë me'; @@ -302,7 +302,7 @@ $strLogPassword = 'Fjalëkalimi:'; $strLogServer = 'Serveri'; $strLogUsername = 'Emri i përdoruesit:'; -$strMaximumSize = 'Madhësia maksimum: %s%s'; +$strMaximumSize = 'Madhësia maksimum: %s%s'; $strMIME_available_mime = 'Lloje MIME në dispozicion'; $strMIME_available_transform = 'Transformacionet në dispozicion'; $strMIME_description = 'Përshkrimi'; @@ -312,7 +312,7 @@ $strMIME_transformation_note = 'Për listën e opcioneve të transformimeve në $strMIME_transformation_options_note = 'Ju lutem shkruani vlerat për opcionet e transformimit duke përdorur këtë format: \'a\', 100, b,\'c\'...
    Nëse keni nevojë të shtoni një backslash ("\") apo një apostrofë ("\'") midis këtyre vlerave, duhet ti backslash-oni (për shembull \'\\\\xyz\' ose \'a\\\'b\').'; $strMIME_transformation_options = 'Opcione të transformimeve'; $strMIME_transformation = 'Transformimi i Shfletuesit'; -$strMIMETypesForTable = 'LLOJET E MIME PËR TABELËN'; +$strMIMETypesForTable = 'LLOJET E MIME PËR TABELËN'; $strMIME_without = 'Llojet-MIME të printuar në italics kanë një funksion transformacioni të veçantë'; $strModifications = 'Ndryshimet u ruajtën'; $strModifyIndexTopic = 'Ndrysho një tregues'; @@ -322,7 +322,7 @@ $strMoveTableSameNames = 'E pamundur lëvizja e tabelës tek vetvetja!'; $strMoveTable = 'Sposto tabelën në (databaza.tabela):'; $strMultilingual = 'shumëgjuhësh'; $strMySQLCharset = 'Set simbolesh MySQL'; -$strMySQLConnectionCollation = 'Vendosja e lidhjes MySQL'; +$strMySQLConnectionCollation = 'Vendosja e lidhjes MySQL'; $strMySQLSaid = 'Mesazh nga MySQL: '; $strMySQLShowProcess = 'Shfaq proceset në ekzekutim'; @@ -345,7 +345,7 @@ $strNoPermission = 'Serveri web nuk ka të drejtat e duhura për të ruajtur fil $strNoPhp = 'pa kod PHP'; $strNoPrivileges = 'Asnjë e drejtë'; $strNoRights = 'Nuk ke të drejta të mjaftueshme për të kryer këtë operacion!'; -$strNoRowsSelected = 'Nuk ka rreshta të zgjedhur'; +$strNoRowsSelected = 'Nuk ka rreshta të zgjedhur'; $strNoSpace = 'Hapësirë e pamjaftueshme për të ruajtur file %s.'; $strNoTablesFound = 'Nuk gjenden tabela në databazë.'; $strNotNumber = 'Ky nuk është një numër!'; @@ -360,7 +360,7 @@ $strNumTables = 'Tabela'; $strOK = 'OK'; $strOperations = 'Operacione'; -$strOperator = 'Operator'; +$strOperator = 'Operator'; $strOptimizeTable = 'Optimizo tabelën'; $strOr = 'Ose'; $strOverhead = 'Mbi limit'; @@ -384,7 +384,7 @@ $strPhp = 'Krijo kodin PHP'; $strPHPVersion = 'Versioni i PHP'; $strPmaDocumentation = 'Dokumente të phpMyAdmin'; $strPmaUriError = 'Direktiva $cfg[\'PmaAbsoluteUri\'] DUHET të përcaktohet tek file i konfigurimit!'; -$strPolish = 'Polonisht'; +$strPolish = 'Polonisht'; $strPortrait = 'Vertikal'; $strPos1 = 'Fillim'; $strPrevious = 'Paraardhësi'; @@ -442,15 +442,15 @@ $strQueryWindowLock = 'Mos e mbishkruaj këtë query nga jashtë dritares'; $strReceived = 'Marrë'; $strRecords = 'Regjistrime'; $strReferentialIntegrity = 'Kontrollo integritetin e informacioneve:'; -$strRefresh = 'Rifresko'; +$strRefresh = 'Rifresko'; $strRelationalSchema = 'Skema relacionale'; $strRelationNotWorking = 'Karakteristikat shtesë janë ç\'aktivuar për sa i takon funksionimit me tabelat e lidhura. Për të zbuluar përse, klikoni %skëtu%s.'; -$strRelationsForTable = 'RELACIONET PËR TABELËN'; +$strRelationsForTable = 'RELACIONET PËR TABELËN'; $strRelations = 'Relacione'; $strRelationView = 'Shiko relacionet'; $strReloadingThePrivileges = 'Duke ringarkuar të drejtat'; $strRemoveSelectedUsers = 'Heq përdoruesit e zgjedhur'; -$strRenameDatabaseOK = 'Databazës %s i është ndryshuar emri në %s'; +$strRenameDatabaseOK = 'Databazës %s i është ndryshuar emri në %s'; $strRenameTableOK = 'Tabela %s u riemërtua %s'; $strRenameTable = 'Riemërto tabelën në'; $strRepairTable = 'Riparo tabelën'; @@ -463,7 +463,7 @@ $strRevokeAndDeleteDescr = 'Përdoruesit DO TË MUND TË PËRDORIN sidoqoftë t $strRevokeAndDelete = 'Hiqja të gjitha të drejtat aktive përdoruesve dhe pastaj eleminoi.'; $strRevoke = 'Hiq'; $strRevokeMessage = 'Ke anulluar të drejtat për %s'; -$strRomanian = 'Romanisht'; +$strRomanian = 'Romanisht'; $strRowLength = 'Gjatësia e rreshtit'; $strRowsFrom = 'rreshta duke filluar nga'; $strRowSize = 'Madhësia e rreshtit'; @@ -500,7 +500,7 @@ $strSelectTables = 'Zgjidh Tabelat'; $strSend = 'Ruaje me emër...'; $strSent = 'Dërguar'; $strServerChoice = 'Zgjedhja e serverit'; -$strServerNotResponding = 'Serveri nuk përgjigjet'; +$strServerNotResponding = 'Serveri nuk përgjigjet'; $strServer = 'Serveri'; $strServerStatus = 'Informacione mbi Runtime'; $strServerStatusUptime = 'Ky server MySQL po punon që prej %s. U nis më %s.'; @@ -524,14 +524,14 @@ $strShowThisQuery = 'Tregoje përsëri këtë query'; $strSimplifiedChinese = 'Kineze e thjeshtëzuar'; $strSingly = '(një nga një)'; $strSize = 'Madhësia'; -$strSlovak = 'Sllovakisht'; -$strSlovenian = 'Sllovenisht'; +$strSlovak = 'Sllovakisht'; +$strSlovenian = 'Sllovenisht'; $strSortByKey = 'Rendit sipas kyçit'; $strSort = 'rreshtimi'; $strSpaceUsage = 'Hapësira e përdorur'; -$strSpanish = 'Spanjisht'; +$strSpanish = 'Spanjisht'; $strSplitWordsWithSpace = 'Fjalët janë të ndara me një hapsirë (" ").'; -$strSQLExportType = 'Lloji i Eksportit'; +$strSQLExportType = 'Lloji i Eksportit'; $strSQLParserBugMessage = 'Ka mundësi që ka një bug tek parser-i SQL. Ju lutem, kontrolloni query tuaj me kujdes, dhe kontrolloni që presjet të jenë ku duhet dhe jo të gabuara. Një shkak tjetër i mundshëm i gabimit mund të jetë që po mundoheni të uploadoni një file binar jashtë një zone teksti të kufizuar me presje. Mund edhe të provoni query tuaj MySQL nga interfaqja e shkruar e komandave. Gabimi i mëposhtëm i kthyer nga server-i MySQL, nëse ekziston një i tillë, mund tju ndihmojë në diagnostikimin e problemit. Nëse ka akoma probleme, apo n.q.s. parser-i SQL i phpMyAdmin gabon kur përkundrazi nga interfaqja e komandave të thjeshta nuk rezultojnë probleme, ju lutem zvogëloni query tuaj SQL në hyrje në query e vetme që shkakton probleme, dhe dërgoni një bug raportim me të dhënat rezultuese nga seksioni CUT i mëposhtëm:'; $strSQLParserUserError = 'Mesa duket ekziston një gabim tek query juaj SQL e futur. Gabimi i serverit MySQL i treguar më poshtë, nëse ekziston, mund t\'ju ndihmojë në diagnostikimin e problemit'; $strSQLQuery = 'query SQL'; @@ -548,7 +548,7 @@ $strStatus = 'Gjendja'; $strStrucCSV = 'të dhëna CSV'; $strStrucData = 'Struktura dhe të dhëna'; $strStrucExcelCSV = 'CSV për të dhëna MS Excel'; -$strStrucNativeExcel = 'Të dhëna orgjinale MS Excel'; +$strStrucNativeExcel = 'Të dhëna orgjinale MS Excel'; $strStrucOnly = 'Vetëm struktura'; $strStructPropose = 'Propozo strukturën e tabelës'; $strStructure = 'Struktura'; @@ -569,11 +569,11 @@ $strTableOptions = 'Opcione për tabelën'; $strTables = '%s tabela(at)'; $strTableStructure = 'Struktura e tabelës'; $strTable = 'Tabela'; -$strTakeIt = 'merre'; +$strTakeIt = 'merre'; $strTblPrivileges = 'Të drejta relative me tabelat'; $strTextAreaLength = ' Për shkak të gjatësisë saj,
    kjo fushë nuk mund të ndryshohet '; $strThai = 'Thai'; -$strTheme = 'Tema / Stili'; +$strTheme = 'Tema / Stili'; $strThisHost = 'Këtë Host'; $strThreadSuccessfullyKilled = 'Thread %s u përfundua me sukses.'; $strTime = 'Koha'; @@ -581,9 +581,9 @@ $strToggleScratchboard = '(ç\')aktivo scratchboard'; $strTotal = 'Gjithsej'; $strTotalUC = 'Gjithsej'; $strTraditionalChinese = 'Kineze tradicionale'; -$strTraditionalSpanish = 'Spanjishte tradicionale'; +$strTraditionalSpanish = 'Spanjishte tradicionale'; $strTraffic = 'Trafiku'; -$strTransformation_application_octetstream__download = 'Shfaq një lidhje për të shkarkuar të dhënat binare të një fushe. Mundësia e parë është emri i file binar. Opcioni i dytë është emri i mundshëm i fushës së rreshtit të tabelës që përmban emrin e file. Nëse jepni opcionin e dytë, opcioni i parë duhet të jetë një stringë bosh'; +$strTransformation_application_octetstream__download = 'Shfaq një lidhje për të shkarkuar të dhënat binare të një fushe. Mundësia e parë është emri i file binar. Opcioni i dytë është emri i mundshëm i fushës së rreshtit të tabelës që përmban emrin e file. Nëse jepni opcionin e dytë, opcioni i parë duhet të jetë një stringë bosh'; $strTransformation_image_jpeg__inline = 'Shfaq një miniaturë të klikueshme; mundësitë: gjërësia, lartësia në pixels (ruan proporcionin origjinal)'; $strTransformation_image_jpeg__link = 'Shfaq një lidhje për tek kjo figurë (download blob direkt, p.sh.).'; $strTransformation_image_png__inline = 'Shiko figurën/jpeg: në linjë'; @@ -1489,4 +1489,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/arabic-utf-8.inc.php b/lang/arabic-utf-8.inc.php index c619d4eb2..22b0793e9 100644 --- a/lang/arabic-utf-8.inc.php +++ b/lang/arabic-utf-8.inc.php @@ -1492,4 +1492,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/azerbaijani-utf-8.inc.php b/lang/azerbaijani-utf-8.inc.php index 07086298a..c8ec30de1 100644 --- a/lang/azerbaijani-utf-8.inc.php +++ b/lang/azerbaijani-utf-8.inc.php @@ -1486,4 +1486,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/bangla-utf-8.inc.php b/lang/bangla-utf-8.inc.php index b66c3b872..044fa55dd 100644 --- a/lang/bangla-utf-8.inc.php +++ b/lang/bangla-utf-8.inc.php @@ -8,7 +8,7 @@ $number_decimal_separator = '.'; // shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa $byteUnits = array('বাইট', 'কিলোবাইট', 'মেগাবাইট', 'গিগাবাইট', 'টেরাবাইট', 'পেটাবাইট', 'এক্সাবাইট'); -// MySQL manual language definition, this is optional, en will be used +// MySQL manual language definition, this is optional, en will be used // if not defined $mysql_4_1_doc_lang = 'bn'; $mysql_5_0_doc_lang = 'bn'; @@ -1465,4 +1465,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/basque-utf-8.inc.php b/lang/basque-utf-8.inc.php index 52137305a..0e30c638f 100644 --- a/lang/basque-utf-8.inc.php +++ b/lang/basque-utf-8.inc.php @@ -1483,4 +1483,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/belarusian_cyrillic-utf-8.inc.php b/lang/belarusian_cyrillic-utf-8.inc.php index 7c03971f0..18c6629b2 100644 --- a/lang/belarusian_cyrillic-utf-8.inc.php +++ b/lang/belarusian_cyrillic-utf-8.inc.php @@ -1465,4 +1465,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/belarusian_latin-utf-8.inc.php b/lang/belarusian_latin-utf-8.inc.php index 1ef77c4f8..538592594 100644 --- a/lang/belarusian_latin-utf-8.inc.php +++ b/lang/belarusian_latin-utf-8.inc.php @@ -1473,4 +1473,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/bosnian-utf-8.inc.php b/lang/bosnian-utf-8.inc.php index 460f60696..62370069d 100644 --- a/lang/bosnian-utf-8.inc.php +++ b/lang/bosnian-utf-8.inc.php @@ -1489,4 +1489,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/brazilian_portuguese-utf-8.inc.php b/lang/brazilian_portuguese-utf-8.inc.php index 91f90411c..45a31bb21 100644 --- a/lang/brazilian_portuguese-utf-8.inc.php +++ b/lang/brazilian_portuguese-utf-8.inc.php @@ -1,96 +1,99 @@ */ +/* translated by: Airon Luis Pereira */ +/* contribution by: Fabio Bucior */ -$charset = 'utf-8'; +$charset = 'utf-8'; $text_dir = 'ltr'; // ('ltr' da esquerda para direita, 'rtl' da direita para esquerda) -$number_thousands_separator = ','; -$number_decimal_separator = '.'; -// abreviações para Byte, Kilo, Mega, Giga, Tera, Peta, Exa -$byteUnits = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); +$number_thousands_separator = ','; +$number_decimal_separator = '.'; +// abreviações para Byte, Kilo, Mega, Giga, Tera, Peta, Exa +$byteUnits = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); $mysql_4_1_doc_lang = 'pt'; -$day_of_week = array('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'); -$month = array('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'); +$day_of_week = array('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'); +$month = array('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'); // Veja http://www.php.net/manual/en/function.strftime.php para definir // as variáveis abaixo -$datefmt = '%B %d, %Y as %I:%M %p'; +$datefmt = '%B %d, %Y as %I:%M %p'; -$timespanfmt = '%s dias, %s horas, %s minutos e %s segundos'; +$timespanfmt = '%s dias, %s horas, %s minutos e %s segundos'; -$strAbortedClients = 'Abortado'; -$strAccessDenied = 'Acesso negado'; +$strAbortedClients = 'Abortado'; +$strAccessDenied = 'Acesso negado'; $strAccessDeniedCreateConfig = 'A provável razão para isso é que você não criou o arquivo de configuração. Você deve usar o %1$ssetup script%2$s para criar um.'; -$strAccessDeniedExplanation = 'phpMyAdmin tentou se conectar no servidor MySQL e a conxão foi recusada. Você deve checar o servidor, nome de usuário e senha no config.inc.php e se certificar que correspondam com as informações fornecidas pelo administrador do servidor MySQL.'; -$strAction = 'Ação'; -$strAddAutoIncrement = 'Adicionar valor AUTO_INCREMENT'; +$strAccessDeniedExplanation = 'phpMyAdmin tentou se conectar no servidor MySQL e a conxão foi recusada. Você deve checar o servidor, nome de usuário e senha no config.inc.php e se certificar que correspondam com as informações fornecidas pelo administrador do servidor MySQL.'; +$strAction = 'Ação'; +$strActions = 'Ações'; +$strAddAutoIncrement = 'Adicionar valor AUTO_INCREMENT'; $strAddClause = 'Adicionar %s'; -$strAddConstraints = 'Adicionar restrições'; -$strAddDeleteColumn = 'Adicionar/Remover colunas'; -$strAddDeleteRow = 'Adicionar/Remover critérios de busca'; -$strAddFields = 'Adicionar %s campo(s)'; -$strAddHeaderComment = 'Adicionar comentário pessoal no cabeçalho (\\n quebra linhas)'; -$strAddIntoComments = 'Adicionar nos comentários'; -$strAddNewField = 'Adicionar novo campo'; -$strAddPrivilegesOnDb = 'Adicionar privilégios nas seguintes Banco de Dados'; -$strAddPrivilegesOnTbl = 'Adicionar privilégios nas seguintes tabelas'; -$strAddSearchConditions = 'Condição de Pesquisa (complemento da cláusula "onde"):'; -$strAddToIndex = 'Adicionar ao índice  %s coluna(s)'; -$strAddUser = 'Adicionar novo usuário'; -$strAddUserMessage = 'Adicionado usuário'; -$strAdministration = 'Administração'; -$strAfter = 'Depois %s'; -$strAfterInsertBack = 'Retornar'; -$strAfterInsertNewInsert = 'Inserir novo registro'; -$strAfterInsertNext = 'Editar próximo registro'; -$strAfterInsertSame = 'Voltar para esta página'; +$strAddConstraints = 'Adicionar restrições'; +$strAddDeleteColumn = 'Adicionar/Remover colunas'; +$strAddDeleteRow = 'Adicionar/Remover critérios de busca'; +$strAddFields = 'Adicionar %s campo(s)'; +$strAddHeaderComment = 'Adicionar comentário pessoal no cabeçalho (\\n quebra linhas)'; +$strAddIntoComments = 'Adicionar nos comentários'; +$strAddNewField = 'Adicionar novo campo'; +$strAddPrivilegesOnDb = 'Adicionar privilégios nas seguintes Banco de Dados'; +$strAddPrivilegesOnTbl = 'Adicionar privilégios nas seguintes tabelas'; +$strAddSearchConditions = 'Condição de Pesquisa (complemento da cláusula "onde"):'; +$strAddToIndex = 'Adicionar ao índice  %s coluna(s)'; +$strAddUser = 'Adicionar novo usuário'; +$strAddUserMessage = 'Adicionado usuário'; +$strAdministration = 'Administração'; +$strAfter = 'Depois %s'; +$strAfterInsertBack = 'Retornar'; +$strAfterInsertNewInsert = 'Inserir novo registro'; +$strAfterInsertNext = 'Editar próximo registro'; +$strAfterInsertSame = 'Voltar para esta página'; $strAllowInterrupt = 'Permitir interromper a importação caso se detecte que o script demorará perto do tempo limite. Isso pode ser um bom caminho para importar arquivos grandes, entretanto isso pode interromper as transações.'; -$strAllTableSameWidth = 'mostrar todas as tabelas com o mesmo tamanho?'; -$strAll = 'Todos'; -$strAlterOrderBy = 'Alterar tabela ordenada por'; -$strAnalyzeTable = 'Analizar tabela'; -$strAnd = 'E'; +$strAllTableSameWidth = 'mostrar todas as tabelas com o mesmo tamanho?'; +$strAll = 'Todos'; +$strAlterOrderBy = 'Alterar tabela ordenada por'; +$strAnalyze = 'Analizar'; +$strAnalyzeTable = 'Analizar tabela'; +$strAnd = 'E'; $strAndThen = 'e então'; $strAngularLinks = 'Links Angulares'; -$strAnIndex = 'Um índice foi adicionado a %s'; -$strAnyHost = 'Qualquer servidor'; -$strAny = 'Qualquer'; -$strAnyUser = 'Qualquer usuário'; -$strApproximateCount = 'Pode ser aproximado. Veja o FAQ 3.11'; -$strAPrimaryKey = 'Uma chave primária foi adicionada a %s'; -$strArabic = 'Árabe'; -$strArmenian = 'Armêno'; -$strAscending = 'Ascendente'; -$strAtBeginningOfTable = 'No início da tabela'; -$strAtEndOfTable = 'No final da tabela'; -$strAttr = 'Atributos'; -$strAutomaticLayout = 'Leiaute automático'; +$strAnIndex = 'Um índice foi adicionado a %s'; +$strAnyHost = 'Qualquer servidor'; +$strAny = 'Qualquer'; +$strAnyUser = 'Qualquer usuário'; +$strApproximateCount = 'Pode ser aproximado. Veja o FAQ 3.11'; +$strAPrimaryKey = 'Uma chave primária foi adicionada a %s'; +$strArabic = 'Árabe'; +$strArmenian = 'Armêno'; +$strAscending = 'Ascendente'; +$strAtBeginningOfTable = 'No início da tabela'; +$strAtEndOfTable = 'No final da tabela'; +$strAttr = 'Atributos'; +$strAutomaticLayout = 'Leiaute automático'; -$strBack = 'Voltar'; -$strBaltic = 'Báltico'; -$strBeginCut = 'INICIO CORTE'; -$strBeginRaw = 'INICIO CRU'; -$strBinary = ' Binário '; -$strBinaryDoNotEdit = ' Binário - não edite '; -$strBinaryLog = 'Log binário'; -$strBinLogEventType = 'Tipo de evento'; -$strBinLogInfo = 'Informação'; -$strBinLogName = 'Nome do log'; -$strBinLogOriginalPosition = 'Posição original'; -$strBinLogPosition = 'Posição'; -$strBinLogServerId = 'ID do Servidor'; -$strBookmarkAllUsers = 'Deixar qualquer usuário acessar esse marcador'; +$strBack = 'Voltar'; +$strBaltic = 'Báltico'; +$strBeginCut = 'INICIO CORTE'; +$strBeginRaw = 'INICIO CRU'; +$strBinary = ' Binário '; +$strBinaryDoNotEdit = ' Binário - não edite '; +$strBinaryLog = 'Log binário'; +$strBinLogEventType = 'Tipo de evento'; +$strBinLogInfo = 'Informação'; +$strBinLogName = 'Nome do log'; +$strBinLogOriginalPosition = 'Posição original'; +$strBinLogPosition = 'Posição'; +$strBinLogServerId = 'ID do Servidor'; +$strBookmarkAllUsers = 'Deixar qualquer usuário acessar esse marcador'; $strBookmarkCreated = 'Marcador %s criado'; -$strBookmarkDeleted = 'O marcador foi removido.'; -$strBookmarkLabel = 'Nome'; -$strBookmarkQuery = 'Consulta SQL gravada'; +$strBookmarkDeleted = 'O marcador foi removido.'; +$strBookmarkLabel = 'Nome'; +$strBookmarkQuery = 'Consulta SQL gravada'; $strBookmarkReplace = 'Substituir marcador de mesmo nome existente'; -$strBookmarkThis = 'Gravar essa consulta SQL'; -$strBookmarkView = 'Apenas visualizar'; +$strBookmarkThis = 'Gravar essa consulta SQL'; +$strBookmarkView = 'Apenas visualizar'; $strBrowseDistinctValues = 'Navegador distingue valores'; -$strBrowseForeignValues = 'Visualizar valores estrangeiros'; -$strBrowse = 'Visualizar'; +$strBrowseForeignValues = 'Visualizar valores estrangeiros'; +$strBrowse = 'Visualizar'; $strBufferPoolActivity = 'Atividade do Buffer Pool'; $strBufferPool = 'Buffer Pool'; $strBufferPoolUsage = 'Uso do Buffer Pool'; @@ -98,264 +101,271 @@ $strBufferReadMissesInPercent = 'Leitura falhou em %'; $strBufferReadMisses = 'Leitura falhou'; $strBufferWriteWaits = 'Escrever as esperas'; $strBufferWriteWaitsInPercent = 'Escrita esperada em %'; -$strBulgarian = 'Bulgaro'; +$strBulgarian = 'Bulgaro'; $strBusyPages = 'Página ocupadas'; -$strBzip = '"compactado com bzip"'; +$strBzip = '"compactado com bzip"'; -$strCalendar = 'Calendário'; +$strCalendar = 'Calendário'; $strCancel = 'Cancelar'; $strCanNotLoadExportPlugins = 'Não pode carregar exportação dos plugins, verifique sua instalação!'; $strCanNotLoadImportPlugins = 'Não foi possível importar plugins, verifique sua instalação!'; -$strCannotLogin = 'Não foi possível se logar no servidor MySQL'; -$strCantLoad = 'não carregou extensão %s,
    verifique a configurações do php'; -$strCantLoadRecodeIconv = 'Não é possível carregar iconv ou recodificar a extensão necessária para a conversão do Conjunto de Caracteres, configure o PHP de modo a permitir utilizar estas extensões ou desligue a conversão do Conjunto de Caracteres no phpMyAdmin.'; -$strCantRenameIdxToPrimary = 'Não foi possível renomear o índice para "PRIMARY"!'; -$strCantUseRecodeIconv = 'Não é possível usar iconv nem libiconv nem a função recode_string enquanto a extensão reportar que está ligada. Confira a configuração do seu php.'; -$strCardinality = 'Cardinalidade'; -$strCaseInsensitive = 'Não diferencia maiúsculas/minúsculas'; -$strCaseSensitive = 'Diferencia maiúsculas/minúsculas'; -$strCentralEuropean = 'Europeu Central'; -$strChange = 'Alterar'; -$strChangeCopyModeCopy = '... manter o antigo.'; -$strChangeCopyMode = 'Criar um novo usuário com os mesmos privilégios e ...'; -$strChangeCopyModeDeleteAndReload = ' ... apagar o antigo da tabela de usuários e depois recarregar os privilégios.'; -$strChangeCopyModeJustDelete = ' ... apagar o antigo da tabela de usuários.'; -$strChangeCopyModeRevoke = ' ... revogar todos privilégios do usuário antigo e depois apagar ele.'; -$strChangeCopyUser = 'Mudar informações de login / Copiar usuário'; -$strChangeDisplay = 'Escolha o campo para exibir'; -$strChangePassword = 'Alterar a senha'; -$strCharset = 'Conjunto de caracteres'; -$strCharsetOfFile = 'Conjunto de caracteres do arquivo'; -$strCharsetsAndCollations = 'Conjuntos de caracteres e Collations'; -$strCharsets = 'Conjuntos de caracteres'; -$strCheckAll = 'Marcar todos'; -$strCheckOverhead = 'Verificar sobre-carga'; -$strCheckPrivsLong = 'Verificar privilégios para a Banco de Dados "%s".'; -$strCheckPrivs = 'Verificar privilégios'; -$strCheckTable = 'Verificar tabela'; -$strChoosePage = 'Escolha a página para editar'; -$strColComFeat = 'Exibindo comentários da coluna'; -$strCollation = 'Collation'; -$strColumnNames = 'Nome das colunas'; -$strColumnPrivileges = 'Privilégios específicos da coluna'; -$strCommand = 'Comando'; -$strComments = 'Comentários'; -$strCompatibleHashing = 'Compatível com MySQL 4.0'; -$strCompleteInserts = 'Inserções completas'; -$strCompression = 'Compressão'; +$strCannotLogin = 'Não foi possível se logar no servidor MySQL'; +$strCantLoad = 'não carregou extensão %s,
    verifique a configurações do php'; +$strCantLoadRecodeIconv = 'Não é possível carregar iconv ou recodificar a extensão necessária para a conversão do Conjunto de Caracteres, configure o PHP de modo a permitir utilizar estas extensões ou desligue a conversão do Conjunto de Caracteres no phpMyAdmin.'; +$strCantRenameIdxToPrimary = 'Não foi possível renomear o índice para "PRIMARY"!'; +$strCantUseRecodeIconv = 'Não é possível usar iconv nem libiconv nem a função recode_string enquanto a extensão reportar que está ligada. Confira a configuração do seu php.'; +$strCardinality = 'Cardinalidade'; +$strCaseInsensitive = 'Não diferencia maiúsculas/minúsculas'; +$strCaseSensitive = 'Diferencia maiúsculas/minúsculas'; +$strCentralEuropean = 'Europeu Central'; +$strChange = 'Alterar'; +$strChangeCopyModeCopy = '... manter o antigo.'; +$strChangeCopyMode = 'Criar um novo usuário com os mesmos privilégios e ...'; +$strChangeCopyModeDeleteAndReload = ' ... apagar o antigo da tabela de usuários e depois recarregar os privilégios.'; +$strChangeCopyModeJustDelete = ' ... apagar o antigo da tabela de usuários.'; +$strChangeCopyModeRevoke = ' ... revogar todos privilégios do usuário antigo e depois apagar ele.'; +$strChangeCopyUser = 'Mudar informações de login / Copiar usuário'; +$strChangeDisplay = 'Escolha o campo para exibir'; +$strChangePassword = 'Alterar a senha'; +$strCharset = 'Conjunto de caracteres'; +$strCharsetOfFile = 'Conjunto de caracteres do arquivo'; +$strCharsetsAndCollations = 'Conjuntos de caracteres e Collations'; +$strCharsets = 'Conjuntos de caracteres'; +$strCheckAll = 'Marcar todos'; +$strCheck = 'Checar'; +$strCheckOverhead = 'Verificar sobre-carga'; +$strCheckPrivsLong = 'Verificar privilégios para a Banco de Dados "%s".'; +$strCheckPrivs = 'Verificar privilégios'; +$strCheckTable = 'Verificar tabela'; +$strChoosePage = 'Escolha a página para editar'; +$strColComFeat = 'Exibindo comentários da coluna'; +$strCollation = 'Collation'; +$strColumnNames = 'Nome das colunas'; +$strColumnPrivileges = 'Privilégios específicos da coluna'; +$strCommand = 'Comando'; +$strComment = 'Cometário'; +$strComments = 'Comentários'; +$strCompatibleHashing = 'Compatível com MySQL 4.0'; +$strCompleteInserts = 'Inserções completas'; +$strCompression = 'Compressão'; $strCompressionWillBeDetected = 'Compressão do arquivo importado será automaticamente detectada de: %s'; $strConfigDefaultFileError = 'Não foi possível carregar configuração padrão de: "%1$s"'; -$strConfigFileError = 'O phpMyAdmin não foi capaz de ler o arquivo de configuração!
    Isto pode acontecer se o php encontrar um erro no parsing ou se não conseguir encontrar o arquivo.
    Chame o arquivo de configuração diretamente usando o link abaixo e leia a(s) mensagem(ns) de erro do php. Na maior parte dos casos, trata-se de uma falta de aspas ou de um ponto e vírgula errado.
    Se receber uma página em branco, está tudo certo.'; -$strConfigureTableCoord = 'Configure as coordenadas para a tabela %s'; -$strConnectionError = 'Não pode conectar: configurações inválidas.'; -$strConnections = 'Conexões'; -$strConstraintsForDumped = 'Restrições para as tabelas dumpadas'; -$strConstraintsForTable = 'Restrições para a tabela'; +$strConfigFileError = 'O phpMyAdmin não foi capaz de ler o arquivo de configuração!
    Isto pode acontecer se o php encontrar um erro no parsing ou se não conseguir encontrar o arquivo.
    Chame o arquivo de configuração diretamente usando o link abaixo e leia a(s) mensagem(ns) de erro do php. Na maior parte dos casos, trata-se de uma falta de aspas ou de um ponto e vírgula errado.
    Se receber uma página em branco, está tudo certo.'; +$strConfigureTableCoord = 'Configure as coordenadas para a tabela %s'; +$strConnectionError = 'Não pode conectar: configurações inválidas.'; +$strConnections = 'Conexões'; +$strConstraintsForDumped = 'Restrições para as tabelas dumpadas'; +$strConstraintsForTable = 'Restrições para a tabela'; $strControluserFailed = 'Conexão para controle do usuário como definido nas configurações falhou.'; -$strCookiesRequired = 'Cookies devem estar ativos após este ponto.'; +$strCookiesRequired = 'Cookies devem estar ativos após este ponto.'; $strCopy = 'Copiar'; -$strCopyDatabaseOK = 'Banco de Dados %s copiado para %s'; -$strCopyTable = 'Copiar tabela para (Banco de Dados.tabela):'; -$strCopyTableOK = 'Tabela %s copiada para %s.'; -$strCopyTableSameNames = 'Não pode copiar a tabela para ela mesma!'; -$strCouldNotKill = 'phpMyAdmin não foi capaz de matar o processo %s. É possível que ele já esteja fechado.'; -$strCreate = 'Criar'; +$strCopyDatabaseOK = 'Banco de Dados %s copiado para %s'; +$strCopyTable = 'Copiar tabela para (Banco de Dados.tabela):'; +$strCopyTableOK = 'Tabela %s copiada para %s.'; +$strCopyTableSameNames = 'Não pode copiar a tabela para ela mesma!'; +$strCouldNotKill = 'phpMyAdmin não foi capaz de matar o processo %s. É possível que ele já esteja fechado.'; +$strCreate = 'Criar'; $strCreateDatabaseBeforeCopying = 'CREATE DATABASE antes de copiar'; -$strCreateIndex = 'Criar um índice em %s colunas'; -$strCreateIndexTopic = 'Criar um novo índice'; -$strCreateNewDatabase = 'Criar novo Banco de Dados'; -$strCreateNewTable = 'Criar nova tabela no Banco de Dados %s'; -$strCreatePage = 'Criar uma nova página'; -$strCreatePdfFeat = 'Criação de PDFs'; +$strCreateIndex = 'Criar um índice em %s colunas'; +$strCreateIndexTopic = 'Criar um novo índice'; +$strCreateNewDatabase = 'Criar novo Banco de Dados'; +$strCreateNewTable = 'Criar nova tabela no Banco de Dados %s'; +$strCreatePage = 'Criar uma nova página'; +$strCreatePdfFeat = 'Criação de PDFs'; $strCreateRelation = 'Criar relacionamento'; $strCreateTable = 'Criar tabela'; $strCreateUserDatabase = 'Banco de Dados para usuário'; $strCreateUserDatabaseName = 'Criar Banco de Dados com o mesmo nome e conceder todos os privilégios'; $strCreateUserDatabaseNone = 'Nenhum'; $strCreateUserDatabaseWildcard = 'Conceder todos os privilégios no nome coringa (nome_do_usuário_%)'; -$strCreationDates = 'Criar/Atualizar/Verificar datas'; -$strCriteria = 'Critério'; -$strCroatian = 'Croata'; +$strCreationDates = 'Criar/Atualizar/Verificar datas'; +$strCriteria = 'Critério'; +$strCroatian = 'Croata'; $strCSV = 'CSV'; -$strCyrillic = 'Cirílico'; -$strCzechSlovak = 'Tcheco-Eslováquio'; -$strCzech = 'Tcheco'; +$strCyrillic = 'Cirílico'; +$strCzechSlovak = 'Tcheco-Eslováquio'; +$strCzech = 'Tcheco'; -$strDanish = 'Dinamarquês'; -$strDatabase = 'Banco de Dados'; -$strDatabaseEmpty = 'O nome do Banco de Dados está em branco!'; -$strDatabaseExportOptions = 'Opções de exportação do Banco de Dados'; -$strDatabaseHasBeenDropped = 'Banco de Dados %s foi eliminado.'; -$strDatabases = 'Banco de Dados'; -$strDatabasesDropped = 'Banco de Dados %s foi eliminado com sucesso!'; -$strDatabasesStatsDisable = 'Disabilitar estatísticas'; -$strDatabasesStatsEnable = 'Habilitar estatísticas'; -$strDatabasesStats = 'Estatísticas do Banco de Dados'; -$strDatabasesStatsHeavyTraffic = 'Nota: Ativar as estatísticas pode causar um grande volume de tráfego de dados entre o servidor web e o servidor MySQL.'; -$strData = 'Dados'; -$strDataDict = 'Dicionário de dados'; -$strDataOnly = 'Dados apenas'; +$strDanish = 'Dinamarquês'; +$strDatabase = 'Banco de Dados'; +$strDatabaseEmpty = 'O nome do Banco de Dados está em branco!'; +$strDatabaseExportOptions = 'Opções de exportação do Banco de Dados'; +$strDatabaseHasBeenCreated = 'Banco de dados %1$s foi criado.'; +$strDatabaseHasBeenDropped = 'Banco de Dados %s foi eliminado.'; +$strDatabases = 'Banco de Dados'; +$strDatabasesDropped = 'Banco de Dados %s foi eliminado com sucesso!'; +$strDatabasesStatsDisable = 'Disabilitar estatísticas'; +$strDatabasesStatsEnable = 'Habilitar estatísticas'; +$strDatabasesStats = 'Estatísticas do Banco de Dados'; +$strDatabasesStatsHeavyTraffic = 'Nota: Ativar as estatísticas pode causar um grande volume de tráfego de dados entre o servidor web e o servidor MySQL.'; +$strData = 'Dados'; +$strDataDict = 'Dicionário de dados'; +$strDataOnly = 'Dados apenas'; $strDataPages = 'Páginas contendo dados'; -$strDBComment = 'Comentário do Banco de Dados: '; -$strDBCopy = 'Copiar Banco de Dados para'; +$strDBComment = 'Comentário do Banco de Dados: '; +$strDBCopy = 'Copiar Banco de Dados para'; $strDbIsEmpty = 'Banco de Dados parece estar vazio!'; -$strDbPrivileges = 'Privilégios específicos do Banco de Dados'; -$strDBRename = 'Renomear Banco de Dados para'; -$strDbSpecific = 'Específico do Banco de Dados'; +$strDbPrivileges = 'Privilégios específicos do Banco de Dados'; +$strDBRename = 'Renomear Banco de Dados para'; +$strDbSpecific = 'Específico do Banco de Dados'; $strDefaultEngine = '%s é o stored engine padrão neste servidor MySQL.'; -$strDefault = 'Padrão'; -$strDefaultValueHelp = 'Para valores padrão, digite um valor simples, sem barras de escape ou aspas, use este formato: a'; -$strDefragment = 'Desfragmentar tabela'; -$strDelayedInserts = 'Usar inserções demoradas'; -$strDeleteAndFlush = 'Apagar usuário e depois recarregar os privilégios.'; -$strDeleteAndFlushDescr = 'Esse é o caminho mais claro, mas recarregar os privilégios pode demorar um pouco.'; -$strDeleted = 'Registro eliminado'; +$strDefault = 'Padrão'; +$strDefaultValueHelp = 'Para valores padrão, digite um valor simples, sem barras de escape ou aspas, use este formato: a'; +$strDefragment = 'Desfragmentar tabela'; +$strDelayedInserts = 'Usar inserções demoradas'; +$strDeleteAndFlush = 'Apagar usuário e depois recarregar os privilégios.'; +$strDeleteAndFlushDescr = 'Esse é o caminho mais claro, mas recarregar os privilégios pode demorar um pouco.'; +$strDeleted = 'Registro eliminado'; $strDeleteNoUsersSelected = 'Nenhum usuário selecionado para exclusão!'; $strDeleteRelation = 'Apagar relacionamento'; -$strDelete = 'Remover'; -$strDeleting = 'Eliminando %s'; +$strDelete = 'Remover'; +$strDeleting = 'Eliminando %s'; $strDelimiter = 'Delimitadores'; -$strDelOld = 'A Página atual contêm referências para uma tabela que não existe. Gostaria de eliminar estas referências?'; -$strDescending = 'Descendente'; -$strDescription = 'Descrição'; +$strDelOld = 'A Página atual contêm referências para uma tabela que não existe. Gostaria de eliminar estas referências?'; +$strDescending = 'Descendente'; +$strDescription = 'Descrição'; $strDesigner = 'Designer'; $strDesignerHelpDisplayField = 'O campo de exibição está em rosa. Para ajustar/desajustar um campo como campo de exibição, clique no ícone "Escolher campo para exibição", então clique no nome do campo apropriado.'; -$strDictionary = 'dicionário'; +$strDetails = 'Detalhes...'; +$strDictionary = 'dicionário'; $strDirectLinks = 'Links diretos'; $strDirtyPages = 'Páginas sujas'; -$strDisabled = 'Desabilitado'; -$strDisableForeignChecks = 'Desabilitar verificação de chaves estrangeiras'; -$strDisplayFeat = 'Exibir recursos'; -$strDisplayOrder = 'Ordenado por:'; -$strDisplayPDF = 'Exibir esquema PDF'; -$strDoAQuery = 'Faça uma "consulta por exemplo" (coringa: "%")'; +$strDisabled = 'Desabilitado'; +$strDisableForeignChecks = 'Desabilitar verificação de chaves estrangeiras'; +$strDisplayFeat = 'Exibir recursos'; +$strDisplayOrder = 'Ordenado por:'; +$strDisplayPDF = 'Exibir esquema PDF'; +$strDoAQuery = 'Faça uma "consulta por exemplo" (coringa: "%")'; $strDocSQL = 'DocSQL'; -$strDocu = 'Documentação'; -$strDoYouReally = 'Confirmar'; -$strDropDatabaseStrongWarning = 'Você está prestes à DESTRUIR completamente o Banco de Dados!'; -$strDrop = 'Eliminar'; -$strDropUsersDb = 'Eliminar o Banco de Dados que possui o mesmo nome dos usuários.'; -$strDumpingData = 'Extraindo dados da tabela'; -$strDumpSaved = 'Dump foi salvo no arquivo %s.'; -$strDumpXRows = 'Dumpar %s registros, começando pelo registro %s.'; -$strDynamic = 'dinâmico'; +$strDocu = 'Documentação'; +$strDoYouReally = 'Confirmar'; +$strDropDatabaseStrongWarning = 'Você está prestes à DESTRUIR completamente o Banco de Dados!'; +$strDrop = 'Eliminar'; +$strDropUsersDb = 'Eliminar o Banco de Dados que possui o mesmo nome dos usuários.'; +$strDumpingData = 'Extraindo dados da tabela'; +$strDumpSaved = 'Dump foi salvo no arquivo %s.'; +$strDumpXRows = 'Dumpar %s registros, começando pelo registro %s.'; +$strDynamic = 'dinâmico'; -$strEdit = 'Editar'; -$strEditPDFPages = 'Editar Páginas PDF'; -$strEditPrivileges = 'Editar Privilégios'; -$strEffective = 'Efetivo'; -$strEmpty = 'Limpar'; -$strEmptyResultSet = 'MySQL retornou um conjunto vazio (ex. zero registros).'; -$strEnabled = 'Habilitado'; -$strEncloseInTransaction = 'Encapsular exportação numa transação'; -$strEndCut = 'FIM CORTE'; -$strEnd = 'Fim'; -$strEndRaw = 'FIM CRU'; +$strEdit = 'Editar'; +$strEditPDFPages = 'Editar Páginas PDF'; +$strEditPrivileges = 'Editar Privilégios'; +$strEffective = 'Efetivo'; +$strEmpty = 'Limpar'; +$strEmptyResultSet = 'MySQL retornou um conjunto vazio (ex. zero registros).'; +$strEnabled = 'Habilitado'; +$strEncloseInTransaction = 'Encapsular exportação numa transação'; +$strEndCut = 'FIM CORTE'; +$strEnd = 'Fim'; +$strEndRaw = 'FIM CRU'; $strEngineAvailable = '%s está disponível neste servidor MySQL.'; $strEngineDisabled = '%s está desabilitado neste servidor MySQL.'; $strEngines = 'Engines'; //sem traducao $strEngineUnsupported = 'Esse servidor MySQL não suporta o stored engine %s.'; -$strEnglish = 'Inglês'; -$strEnglishPrivileges = ' Nota: nomes de privilégios do MySQL são expressos em inglês '; -$strError = 'Erro'; +$strEnglish = 'Inglês'; +$strEnglishPrivileges = ' Nota: nomes de privilégios do MySQL são expressos em inglês '; +$strError = 'Erro'; $strErrorInZipFile = 'Erro no arquivo ZIP:'; $strErrorRelationAdded = 'Erro: relacionamento não adicionado.'; $strErrorRelationExists = 'Erro: relacionamento já existe.'; $strErrorRenamingTable = 'Erro ao renomear tabela %1$s para %2$s'; $strErrorSaveTable = 'Erro ao salvar coordenada para o Designer.'; -$strEscapeWildcards = 'Coringas _ e % precisam ser precedidos com uma \ para serem usados literalmente'; +$strEscapeWildcards = 'Coringas _ e % precisam ser precedidos com uma \ para serem usados literalmente'; $strEsperanto = 'Esperanto'; -$strEstonian = 'Estoniano'; +$strEstonian = 'Estoniano'; $strEvent = 'Evento'; -$strExcelEdition = 'Edição do Excel'; -$strExecuteBookmarked = 'Executar consulta marcada'; -$strExplain = 'Explicar SQL'; -$strExport = 'Exportar'; +$strEvents = 'Eventos'; +$strExcelEdition = 'Edição do Excel'; +$strExecuteBookmarked = 'Executar consulta marcada'; +$strExplain = 'Explicar SQL'; +$strExport = 'Exportar'; $strExportImportToScale = 'Exportar/Importar para escala'; $strExportMustBeFile = 'Tipo de exportação selecionada tem que ser salva no arquivo!'; -$strExtendedInserts = 'Inserções extendidas'; -$strExtra = 'Extra'; +$strExtendedInserts = 'Inserções extendidas'; +$strExtra = 'Extra'; -$strFailedAttempts = 'Tentativas falharam'; -$strField = 'Campo'; -$strFieldHasBeenDropped = 'Campo %s foi deletado'; +$strFailedAttempts = 'Tentativas falharam'; +$strField = 'Campo'; +$strFieldHasBeenDropped = 'Campo %s foi deletado'; $strFieldInsertFromFileTempDirNotExists = 'Erro ao mover o arquivo carregado, veja FAQ 1.11'; -$strFields = 'Campos'; -$strFieldsEnclosedBy = 'Campos delimitados por'; -$strFieldsEscapedBy = 'Campos contornados por'; -$strFieldsTerminatedBy = 'Campos terminados por'; -$strFileAlreadyExists = 'O arquivo %s já existe no servidor, mude o nome do arquivo ou verifique sua opção de sobrescrever.'; -$strFileCouldNotBeRead = 'O arquivo não pode ser lido'; +$strFields = 'Campos'; +$strFieldsEnclosedBy = 'Campos delimitados por'; +$strFieldsEscapedBy = 'Campos contornados por'; +$strFieldsTerminatedBy = 'Campos terminados por'; +$strFileAlreadyExists = 'O arquivo %s já existe no servidor, mude o nome do arquivo ou verifique sua opção de sobrescrever.'; +$strFileCouldNotBeRead = 'O arquivo não pode ser lido'; $strFileNameTemplateDescriptionDatabase = 'nome do Banco de Dados'; $strFileNameTemplateDescription = 'Esse valor é interpretado usando %1$sstrftime%2$s, então você pode usar as strings de formatação de tempo. Adicionalmente a seguinte transformação ocorrerá: %3$s. Outros textos serão mantidos como são.'; $strFileNameTemplateDescriptionServer = 'nome do servidor'; $strFileNameTemplateDescriptionTable = 'nome da tabela'; -$strFileNameTemplate = 'Nome do arquivo do modelo'; -$strFileNameTemplateRemember = 'lembrar modelo'; +$strFileNameTemplate = 'Nome do arquivo do modelo'; +$strFileNameTemplateRemember = 'lembrar modelo'; $strFiles = 'Arquivos'; $strFileToImport = 'Arquivo para importar'; -$strFlushPrivilegesNote = 'Nota: O phpMyAdmin recebe os privilégios dos usuário diretamente da tabela de privilégios do MySQL. O conteúdo destas tabelas pode divergir dos privilégios que o servidor usa se alterações manuais forem feitas nele. Neste caso, você deve usar %sRELOAD PRIVILEGES%s antes de continuar..'; +$strFlushPrivilegesNote = 'Nota: O phpMyAdmin recebe os privilégios dos usuário diretamente da tabela de privilégios do MySQL. O conteúdo destas tabelas pode divergir dos privilégios que o servidor usa se alterações manuais forem feitas nele. Neste caso, você deve usar %sRELOAD PRIVILEGES%s antes de continuar..'; $strFlushQueryCache = 'Nivelar cache da consulta'; //está correto isso? -$strFlushTable = 'Limpar a tabela ("LIMPAR")'; +$strFlushTable = 'Limpar a tabela ("LIMPAR")'; $strFlushTables = 'Nivelar (fechar) todas as tabelas'; //está correto isso? $strFontSize = 'Tamanho da fonte'; -$strFormat = 'Formato'; -$strFormEmpty = 'Faltando valores no formulário!'; +$strForeignKeyError = 'Erro ao criar chave externa no %1$s (check data types)'; +$strFormat = 'Formato'; +$strFormEmpty = 'Faltando valores no formulário!'; $strFreePages = 'Páginas livres'; -$strFullText = 'Textos completos'; -$strFunction = 'Funções'; +$strFullText = 'Textos completos'; +$strFunction = 'Funções'; $strFunctions = 'Funções'; -$strGenBy = 'Gerado por'; -$strGeneralRelationFeat = 'Recursos de relações gerais'; +$strGenBy = 'Gerado por'; +$strGeneralRelationFeat = 'Recursos de relações gerais'; $strGenerate = 'Gerar'; $strGeneratePassword = 'Gerar Senha'; -$strGenTime = 'Tempo de Geração'; -$strGeorgian = 'Georgiano'; -$strGerman = 'Alemão'; -$strGlobal = 'global'; -$strGlobalPrivileges = 'Privilégios globais'; -$strGlobalValue = 'Valor global'; -$strGo = 'Executar'; -$strGrantOption = 'Conceder/Grant'; -$strGreek = 'Grego'; -$strGzip = '"compactado com gzip"'; +$strGenTime = 'Tempo de Geração'; +$strGeorgian = 'Georgiano'; +$strGerman = 'Alemão'; +$strGlobal = 'global'; +$strGlobalPrivileges = 'Privilégios globais'; +$strGlobalValue = 'Valor global'; +$strGo = 'Executar'; +$strGrantOption = 'Conceder/Grant'; +$strGreek = 'Grego'; +$strGzip = '"compactado com gzip"'; $strHandler = 'Alimentador'; //está correto isso? seria Gestor?? -$strHasBeenAltered = 'foi alterado.'; -$strHaveToShow = 'Deve escolher pelo menos uma coluna para exibir'; -$strHebrew = 'Hebreu'; +$strHasBeenAltered = 'foi alterado.'; +$strHaveToShow = 'Deve escolher pelo menos uma coluna para exibir'; +$strHebrew = 'Hebreu'; $strHelp = 'Ajuda'; $strHexForBLOB = 'Usar hexadecimal para BLOB'; $strHide = 'Ocultar'; $strHideShowAll = 'Ocultar/Exibir tudo'; $strHideShowNoRelation = 'Ocultar/Exibir Tabelas sem relacionamento'; -$strHomepageOfficial = 'Página Oficial do phpMyAdmin'; -$strHome = 'Principal'; -$strHostEmpty = 'O nome do servidor está vazio!'; -$strHost = 'Servidor'; +$strHomepageOfficial = 'Página Oficial do phpMyAdmin'; +$strHome = 'Principal'; +$strHostEmpty = 'O nome do servidor está vazio!'; +$strHost = 'Servidor'; $strHTMLExcel = 'Microsoft Excel 2000'; $strHTMLWord = 'Microsoft Word 2000'; -$strHungarian = 'Húngaro'; +$strHungarian = 'Húngaro'; -$strIcelandic = 'Islandês'; -$strId = 'ID'; -$strIdxFulltext = 'Texto completo'; +$strIcelandic = 'Islandês'; +$strId = 'ID'; +$strIdxFulltext = 'Texto completo'; $strIEUnsupported = 'Internet Explorer não suporta esta função.'; $strIgnoreDuplicates = 'Ignorar linhas duplicadas'; -$strIgnore = 'Ignorar'; -$strIgnoreInserts = 'Usar inserções ignoradas'; +$strIgnore = 'Ignorar'; +$strIgnoreInserts = 'Usar inserções ignoradas'; $strImportExportCoords = 'Importar/Exportar coordenadas para esquema PDF'; -$strImportFiles = 'Importar arquivos'; +$strImportFiles = 'Importar arquivos'; $strImportFormat = 'Formato do arquivo importado'; $strImport = 'Importar'; $strImportSuccessfullyFinished = 'Importação finalizada com sucesso, %d consultas executadas.'; -$strIndexes = 'Índices'; -$strIndexHasBeenDropped = 'Índice %s foi eliminado'; -$strIndex = 'Índice'; -$strIndexName = 'Nome do índice:'; -$strIndexType = 'Tipo de índice:'; -$strIndexWarningTable = 'Problemas com o índice da tabela `%s`'; +$strIndexes = 'Índices'; +$strIndexesSeemEqual = 'A indexação %1$s e %2$s parecem ser iguais ou uma delas pode ter sido removida.'; +$strIndexHasBeenDropped = 'Índice %s foi eliminado'; +$strIndex = 'Índice'; +$strIndexName = 'Nome do índice:'; +$strIndexType = 'Tipo de índice:'; +$strIndexWarningTable = 'Problemas com o índice da tabela `%s`'; $strInnoDBAutoextendIncrementDesc = 'O tamanho do incremento para extender o tamanho de um tamanho de tabela autoextendida quando ela começar à ficar cheia.'; $strInnoDBAutoextendIncrement = 'Incremento autoextendido'; $strInnoDBBufferPoolSizeDesc = 'O tamanho do buffer de memória que o InnoDB usa para dados do cache e índices nas suas tabelas.'; @@ -364,13 +374,15 @@ $strInnoDBDataFilePath = 'Arquivos de dados'; $strInnoDBDataHomeDirDesc = 'A parte comum do caminho do diretório para todos os arquivos de dados do InnoDB.'; $strInnoDBDataHomeDir = 'Diretório raiz de dados'; $strInnoDBPages = 'páginas'; -$strInnodbStat = 'Status do InnoDB'; -$strInsecureMySQL = 'O seu arquivo de configuração contém configurações (root sem senha) que correspondem à conta privilegiada padrão do MySQL. O servidor MySQL rodando com esse padrão estará aberto a invasões, você realmente deveria corrigir este furo de segurança.'; -$strInsertAsNewRow = 'Inserir como um novo registro'; -$strInsert = 'Inserir'; +$strInnodbStat = 'Status do InnoDB'; +$strInsecureMySQL = 'O seu arquivo de configuração contém configurações (root sem senha) que correspondem à conta privilegiada padrão do MySQL. O servidor MySQL rodando com esse padrão estará aberto a invasões, você realmente deveria corrigir este furo de segurança.'; +$strInsertAsNewRow = 'Inserir como um novo registro'; +$strInsertedRowId = 'Id da linha inserida: %1$d'; +$strInsert = 'Inserir'; +$strInterface = 'Interface'; // Não há tradução clara... $strInternalRelationAdded = 'Adicionado relacionamento Interno'; -$strInternalRelations = 'Relações internas'; -$strInUse = 'em uso'; +$strInternalRelations = 'Relações internas'; +$strInUse = 'em uso'; $strInvalidAuthMethod = 'Método de autenticação inválido informado nas configurações:'; $strInvalidColumn = 'Coluna especificada (%s) é inválida!'; $strInvalidColumnCount = 'Contador da coluna deve ser maior que zero.'; @@ -386,74 +398,74 @@ $strInvalidServerHostname = 'Nome de serivdor inválido para o servidor %1$s. Ve $strInvalidServerIndex = 'Índice de servidor inválido: "%s"'; $strInvalidTableName = 'Nome de tabela inválida'; -$strJapanese = 'Japonês'; +$strJapanese = 'Japonês'; $strJoins = 'Junções'; -$strJumpToDB = 'Ir para o Banco de Dados "%s".'; -$strJustDelete = 'Apenas apagar o usuário da tabela de privilégios'; -$strJustDeleteDescr = 'O usuário "apagado" ainda podera continuar acessando o servidor normalmente até que os privilégios sejam recarregados.'; +$strJumpToDB = 'Ir para o Banco de Dados "%s".'; +$strJustDelete = 'Apenas apagar o usuário da tabela de privilégios'; +$strJustDeleteDescr = 'O usuário "apagado" ainda podera continuar acessando o servidor normalmente até que os privilégios sejam recarregados.'; -$strKeepPass = 'Não mudar a senha'; +$strKeepPass = 'Não mudar a senha'; $strKeyCache = 'Chave do cache'; -$strKeyname = 'Nome chave'; -$strKill = 'Matar'; +$strKeyname = 'Nome chave'; +$strKill = 'Matar'; $strKnownExternalBug = 'A funcionalidade %s é afetada por um bug conhecido, veja %s'; -$strKorean = 'Coreano'; +$strKorean = 'Coreano'; -$strLandscape = 'Paisagem'; +$strLandscape = 'Paisagem'; $strLanguage = 'Linguagem'; $strLanguageUnknown = 'Linguagem desconhecida: %1$s.'; $strLatchedPages = 'Páginas trancadas'; -$strLatexCaption = 'Leganda da Tabela'; -$strLatexContent = 'Conteúdo da tabela __TABLE__'; -$strLatexContinuedCaption = 'Continuação da legenda da tabela'; -$strLatexContinued = '(continuação)'; -$strLatexIncludeCaption = 'Incluir legenda da tabela'; -$strLatexLabel = 'Rótulo da chave'; -$strLaTeX = 'LaTeX'; -$strLatexStructure = 'Estrutura da tabela __TABLE__'; -$strLatvian = 'Letonês'; +$strLatexCaption = 'Leganda da Tabela'; +$strLatexContent = 'Conteúdo da tabela __TABLE__'; +$strLatexContinuedCaption = 'Continuação da legenda da tabela'; +$strLatexContinued = '(continuação)'; +$strLatexIncludeCaption = 'Incluir legenda da tabela'; +$strLatexLabel = 'Rótulo da chave'; +$strLaTeX = 'LaTeX'; +$strLatexStructure = 'Estrutura da tabela __TABLE__'; +$strLatvian = 'Letonês'; $strLDI = 'CSV usando LOAD DATA'; $strLDILocal = 'Usar palavra-chave LOCAL'; -$strLengthSet = 'Tamanho/Definir*'; -$strLimitNumRows = 'registros por página'; -$strLinesTerminatedBy = 'Linhas terminadas por'; -$strLinkNotFound = 'Link não encontrado'; -$strLinksTo = 'Links para'; -$strLithuanian = 'Lituânio'; -$strLocalhost = 'Local'; -$strLocationTextfile = 'Localização do arquivo texto'; -$strLogin = 'Autenticação'; -$strLoginInformation = 'Informação de login'; -$strLogout = 'Sair'; -$strLogPassword = 'Senha:'; -$strLogServer = 'Servidor'; -$strLogUsername = 'Usuário:'; +$strLengthSet = 'Tamanho/Definir*'; +$strLimitNumRows = 'registros por página'; +$strLinesTerminatedBy = 'Linhas terminadas por'; +$strLinkNotFound = 'Link não encontrado'; +$strLinksTo = 'Links para'; +$strLithuanian = 'Lituânio'; +$strLocalhost = 'Local'; +$strLocationTextfile = 'Localização do arquivo texto'; +$strLogin = 'Autenticação'; +$strLoginInformation = 'Informação de login'; +$strLogout = 'Sair'; +$strLogPassword = 'Senha:'; +$strLogServer = 'Servidor'; +$strLogUsername = 'Usuário:'; $strLongOperation = 'Esta operação pode ser demorada. Deseja prosseguir?'; $strMaxConnects = 'máx. de conexões concorrentes'; $strMaximalQueryLength = 'Tamanho máximo da consulta gerada'; -$strMaximumSize = 'Tamanho máximo: %s%s'; -$strMbExtensionMissing = 'A extensão mbstring do PHP não foi encontrada e você parece estar usando conjuntos de caracteres multibyte. Sem a extensão mbstring o phpMyAdmin não será capaz de dividir as strings corretamente isso pode causar resultados inesperados.'; -$strMbOverloadWarning = 'Você habilitou mbstring.func_overload nas configurações do PHP. Essa opção é incompatível com o phpMyAdmin e certamente causará a perda de algum dado!'; -$strMIME_available_mime = 'MIME-type disponíveis'; -$strMIME_available_transform = 'Transformações disponíveis'; -$strMIME_description = 'Descrição'; +$strMaximumSize = 'Tamanho máximo: %s%s'; +$strMbExtensionMissing = 'A extensão mbstring do PHP não foi encontrada e você parece estar usando conjuntos de caracteres multibyte. Sem a extensão mbstring o phpMyAdmin não será capaz de dividir as strings corretamente isso pode causar resultados inesperados.'; +$strMbOverloadWarning = 'Você habilitou mbstring.func_overload nas configurações do PHP. Essa opção é incompatível com o phpMyAdmin e certamente causará a perda de algum dado!'; +$strMIME_available_mime = 'MIME-type disponíveis'; +$strMIME_available_transform = 'Transformações disponíveis'; +$strMIME_description = 'Descrição'; $strMIME_MIMEtype = 'MIME-type'; // MIME-types nao tem traducao -$strMIME_nodescription = 'Sem descrição disponível para essa transformação.
    Pergunte ao autor o que %s faz.'; -$strMIME_transformation_note = 'Para uma lista de opções de transformação disponíveis e suas transformações MIME-type, clique em %sdescrição de transformações%s'; -$strMIME_transformation_options_note = 'Digite os valores para as opções de transformação usando este formato: \'a\', 100, b,\'c\'...
    Se por acaso precisar inserir uma contra-barra ("\") ou aspas ("\'") no meio desses valores, faça-o usando outra contra-barra (por exemplo \'\\\\xyz\' ou \'a\\\'b\').'; -$strMIME_transformation_options = 'Opções de transformação'; -$strMIME_transformation = 'Transformações do navegador'; -$strMIMETypesForTable = 'MIME-TYPES PARA AS TABELAS'; -$strMIME_without = 'MIME-types em itálico não têm uma função de transformação separada'; -$strModifications = 'Modificações foram salvas'; -$strModifyIndexTopic = 'Modificar um índice'; -$strModify = 'Modificar'; +$strMIME_nodescription = 'Sem descrição disponível para essa transformação.
    Pergunte ao autor o que %s faz.'; +$strMIME_transformation_note = 'Para uma lista de opções de transformação disponíveis e suas transformações MIME-type, clique em %sdescrição de transformações%s'; +$strMIME_transformation_options_note = 'Digite os valores para as opções de transformação usando este formato: \'a\', 100, b,\'c\'...
    Se por acaso precisar inserir uma contra-barra ("\") ou aspas ("\'") no meio desses valores, faça-o usando outra contra-barra (por exemplo \'\\\\xyz\' ou \'a\\\'b\').'; +$strMIME_transformation_options = 'Opções de transformação'; +$strMIME_transformation = 'Transformações do navegador'; +$strMIMETypesForTable = 'MIME-TYPES PARA AS TABELAS'; +$strMIME_without = 'MIME-types em itálico não têm uma função de transformação separada'; +$strModifications = 'Modificações foram salvas'; +$strModifyIndexTopic = 'Modificar um índice'; +$strModify = 'Modificar'; $strMoveMenu = 'Mover Menu'; -$strMoveTable = 'Mover tabela para (Banco de Dados.tabela):'; -$strMoveTableOK = 'Tabela %s foi movida para %s.'; -$strMoveTableSameNames = 'Não pode mover a tabela para ela mesma!'; -$strMultilingual = 'multi-linguagem'; +$strMoveTable = 'Mover tabela para (Banco de Dados.tabela):'; +$strMoveTableOK = 'Tabela %s foi movida para %s.'; +$strMoveTableSameNames = 'Não pode mover a tabela para ela mesma!'; +$strMultilingual = 'multi-linguagem'; $strMyISAMDataPointerSizeDesc = 'O tamanho padrão do ponteiro em bytes, para ser usado por CREATE TABLE para tabelas MyISAM quando a opção MAX_ROWS não é especificada.'; $strMyISAMDataPointerSize = 'Tamanho do ponteiro de dados'; $strMyISAMMaxExtraSortFileSizeDesc = 'Se os arquivos temporários usados para rápida criação de índices MyISAM forem maiores do que usando a chave do cache pela quantidade especificada aqui, prefira o método chave do cache.'; @@ -466,257 +478,275 @@ $strMyISAMRepairThreadsDesc = 'Se este valor for maior que 1, índices das tabel $strMyISAMRepairThreads = 'Processos de reparo'; $strMyISAMSortBufferSizeDesc = 'O buffer que é alocado quando são ordenados índices MyISAM durante um REPAIR TABLE ou quando são criados índices com CREATE INDEX ou ALTER TABLE.'; $strMyISAMSortBufferSize = 'Tamanho do buffer de ordenação'; -$strMySQLCharset = 'Conjunto de caracteres MySQL'; +$strMySQLCharset = 'Conjunto de caracteres MySQL'; $strMysqlClientVersion = 'Versão do cliente MySQL'; $strMySQLConnectionCollation = 'Collation de conexão do MySQL'; // Collation nao tem traducao $strMysqlLibDiffersServerVersion = 'Sua versão %s da biblioteca MySQL do PHP difere da versão %s do seu servidor MySQL. Isso pode causar um comportamento estranho.'; -$strMySQLSaid = 'Mensagens do MySQL : '; -$strMySQLShowProcess = 'Mostrar os Processos'; +$strMySQLSaid = 'Mensagens do MySQL : '; +$strMySQLShowProcess = 'Mostrar os Processos'; -$strName = 'Nome'; -$strNext = 'Próximo'; -$strNoActivity = 'Sem atividade por %s segundos ou mais, faça o login novamente'; -$strNoDatabasesSelected = 'Nenhum Banco de Dados selecionado.'; -$strNoDatabases = 'Sem bases'; +$strName = 'Nome'; +$strNext = 'Próximo'; +$strNoActivity = 'Sem atividade por %s segundos ou mais, faça o login novamente'; +$strNoDatabasesSelected = 'Nenhum Banco de Dados selecionado.'; +$strNoDatabases = 'Sem bases'; $strNoDataReceived = 'Nenhum dado foi recebido pra importar. Tampouco um nome de arquivo foi submetido, ou o tamanho do arquivo excedeu o tamanho máximo permitido pelas suas configurações do PHP. Veja FAQ 1.16.'; -$strNoDescription = 'sem Descrição'; +$strNoDescription = 'sem Descrição'; $strNoDetailsForEngine = 'Não há nenhuma informação detalhada do status disponível para esta storage engine.'; -$strNoDropDatabases = 'O comando "DROP DATABASE" está desabilitado.'; -$strNoExplain = 'Pular Explicação SQL'; +$strNoDropDatabases = 'O comando "DROP DATABASE" está desabilitado.'; +$strNoExplain = 'Pular Explicação SQL'; $strNoFilesFoundInZip = 'Nenhum arquivo encontrado dentro do arquivo ZIP!'; -$strNoFrames = 'phpMyAdmin é mais amigável com um navegador capaz de exibir frames.'; -$strNoIndex = 'Nenhum índice definido!'; -$strNoIndexPartsDefined = 'Nenhuma parte de índice definida!'; -$strNoModification = 'Sem Mudança'; -$strNo = 'Não'; -$strNone = 'Nenhum'; -$strNoOptions = 'Esse formato não tem opções'; -$strNoPassword = 'Sem senha'; -$strNoPermission = 'O servidor web não tem permissão para salvar o arquivo %s.'; -$strNoPhp = 'sem código PHP'; -$strNoPrivileges = 'Sem privilégios'; -$strNoRights = 'Você não tem direitos suficientes para estar aqui agora!'; -$strNoRowsSelected = 'Nenhum registro selecionado'; -$strNoSpace = 'Espaço insuficiente para salvar o arquivo %s.'; -$strNoTablesFound = 'Nenhuma tabela encontrada no Banco de Dados'; -$strNoThemeSupport = 'Sem suporte a Temas, verifique suas configurações e/ou seus Temas no diretório %s.'; -$strNotNumber = 'Isto não é um número!'; -$strNotOK = 'não está OK'; -$strNotSet = '%s tabela não encontrada ou não configurada em %s'; -$strNoUsersFound = 'Nenhum usuário(s) encontrado.'; -$strNoValidateSQL = 'Pular validação SQL'; -$strNull = 'Nulo'; +$strNoFrames = 'phpMyAdmin é mais amigável com um navegador capaz de exibir frames.'; +$strNoIndex = 'Nenhum índice definido!'; +$strNoIndexPartsDefined = 'Nenhuma parte de índice definida!'; +$strNoModification = 'Sem Mudança'; +$strNo = 'Não'; +$strNone = 'Nenhum'; +$strNoOptions = 'Esse formato não tem opções'; +$strNoPassword = 'Sem senha'; +$strNoPermission = 'O servidor web não tem permissão para salvar o arquivo %s.'; +$strNoPhp = 'sem código PHP'; +$strNoPrivileges = 'Sem privilégios'; +$strNoRights = 'Você não tem direitos suficientes para estar aqui agora!'; +$strNoRowsSelected = 'Nenhum registro selecionado'; +$strNoSpace = 'Espaço insuficiente para salvar o arquivo %s.'; +$strNoTablesFound = 'Nenhuma tabela encontrada no Banco de Dados'; +$strNoThemeSupport = 'Sem suporte a Temas, verifique suas configurações e/ou seus Temas no diretório %s.'; +$strNotNumber = 'Isto não é um número!'; +$strNotOK = 'não está OK'; +$strNotSet = '%s tabela não encontrada ou não configurada em %s'; +$strNoUsersFound = 'Nenhum usuário(s) encontrado.'; +$strNoValidateSQL = 'Pular validação SQL'; +$strNull = 'Nulo'; $strNumberOfFields = 'Número de arquivos'; $strNumberOfTables = 'Numero de tabelas'; -$strNumSearchResultsInTable = '%s resultado(s) dentro da tabela %s'; -$strNumSearchResultsTotal = 'Total: %s resultado(s)'; -$strNumTables = 'Tabelas'; +$strNumSearchResultsInTable = '%s resultado(s) dentro da tabela %s'; +$strNumSearchResultsTotal = 'Total: %s resultado(s)'; +$strNumTables = 'Tabelas'; -$strOK = 'OK'; +$strOK = 'OK'; $strOpenDocumentSpreadsheet = 'Abrir Documento Planilha'; $strOpenDocumentText = 'Abrir Documento de Texto'; $strOpenNewWindow = 'Abrir nova janela do phpMyAdmin'; -$strOperations = 'Operações'; -$strOperator = 'Operador'; -$strOptimizeTable = 'Otimizar tabela'; +$strOperations = 'Operações'; +$strOperator = 'Operador'; +$strOptimize = 'Otimizar'; +$strOptimizeTable = 'Otimizar tabela'; $strOptions = 'Opções'; -$strOr = 'Ou'; -$strOverhead = 'Sobrecarga'; -$strOverwriteExisting = 'Sobrescrever arquivo(s) existente(s)'; +$strOr = 'Ou'; +$strOverhead = 'Sobrecarga'; +$strOverwriteExisting = 'Sobrescrever arquivo(s) existente(s)'; -$strPageNumber = 'Numero da página:'; +$strPacked = 'Pacote'; +$strPageNumber = 'Numero da página:'; $strPagesToBeFlushed = 'Páginas para serem niveladas'; -$strPaperSize = 'Tamanho do papel'; +$strPaperSize = 'Tamanho do papel'; $strPartialImport = 'Importação parcial'; -$strPartialText = 'Textos parciais'; -$strPasswordChanged = 'A senha para %s foi modificada com sucesso.'; -$strPasswordEmpty = 'A senhas está em branco!'; +$strPartialText = 'Textos parciais'; +$strPartitionDefinition = 'Definição da PARTIÇÃO'; +$strPartitioned = 'Particionado'; +$strPartitionMaintenance = 'Manutenção da partição'; +$strPartition = 'Partição %s'; +$strPasswordChanged = 'A senha para %s foi modificada com sucesso.'; +$strPasswordEmpty = 'A senhas está em branco!'; $strPasswordHashing = 'Hashing da senha'; // Hashing nao tem traducao -$strPasswordNotSame = 'As senhas não são iguais!'; -$strPassword = 'Senha'; -$strPdfDbSchema = 'Esquema do Banco de Dados "%s" - Página %s'; -$strPdfInvalidTblName = 'A tabela "%s" não existe!'; -$strPdfNoTables = 'Sem tabelas'; +$strPasswordNotSame = 'As senhas não são iguais!'; +$strPassword = 'Senha'; +$strPdfDbSchema = 'Esquema do Banco de Dados "%s" - Página %s'; +$strPdfInvalidTblName = 'A tabela "%s" não existe!'; +$strPdfNoTables = 'Sem tabelas'; $strPDF = 'PDF'; $strPDFReportExplanation = '(Gerado um relatório contendo dados da tabela simples)'; $strPDFReportTitle = 'Título do Relatório'; -$strPerHour = 'por hora'; -$strPerMinute = 'por minuto'; -$strPerSecond = 'por segundo'; -$strPersian = 'Pérsa'; -$strPhoneBook = 'Agenda de telefones'; -$strPhp = 'Criar código PHP'; -$strPHPVersion = 'Versão do PHP'; +$strPerHour = 'por hora'; +$strPerMinute = 'por minuto'; +$strPerSecond = 'por segundo'; +$strPersian = 'Pérsa'; +$strPhoneBook = 'Agenda de telefones'; +$strPhp = 'Criar código PHP'; +$strPHPVersion = 'Versão do PHP'; $strPleaseSelectPrimaryOrUniqueKey = 'Por favor, selecione uma chave primária ou uma chave única'; -$strPmaDocumentation = 'Documentação do phpMyAdmin '; -$strPmaUriError = 'A variável $cfg[\'PmaAbsoluteUri\'] deve ser setada'; -$strPolish = 'Polonês'; -$strPortrait = 'Retrato'; -$strPos1 = 'Início'; -$strPrevious = 'Anterior'; -$strPrimaryKeyHasBeenDropped = 'A chave primária foi deletada'; -$strPrimaryKeyName = 'O nome da chave primária deve ser... "PRIMARY"!'; -$strPrimaryKeyWarning = '("PRIMARY" precisa ser o nome de e apenas da chave primária!)'; -$strPrimary = 'Primária'; -$strPrint = 'Imprimir'; -$strPrintViewFull = 'Ver impressão (com textos completos)'; -$strPrintView = 'Visualização para impressão'; -$strPrivDescAllPrivileges = 'Incluir todos os privilégios, exceto GRANT.'; -$strPrivDescAlter = 'Permitir alterar a estrutura das tabelas existentes.'; +$strPmaDocumentation = 'Documentação do phpMyAdmin '; +$strPmaUriError = 'A variável $cfg[\'PmaAbsoluteUri\'] deve ser setada'; +$strPolish = 'Polonês'; +$strPortrait = 'Retrato'; +$strPos1 = 'Início'; +$strPrevious = 'Anterior'; +$strPrimaryKeyHasBeenDropped = 'A chave primária foi deletada'; +$strPrimaryKeyName = 'O nome da chave primária deve ser... "PRIMARY"!'; +$strPrimaryKeyWarning = '("PRIMARY" precisa ser o nome de e apenas da chave primária!)'; +$strPrimary = 'Primária'; +$strPrint = 'Imprimir'; +$strPrintViewFull = 'Ver impressão (com textos completos)'; +$strPrintView = 'Visualização para impressão'; +$strPrivDescAllPrivileges = 'Incluir todos os privilégios, exceto GRANT.'; +$strPrivDescAlter = 'Permitir alterar a estrutura das tabelas existentes.'; $strPrivDescAlterRoutine = 'Permitir alterar e apagar stored routines.'; -$strPrivDescCreateDb = 'Permitir criar novas tabelas e Banco de Dados.'; +$strPrivDescCreateDb = 'Permitir criar novas tabelas e Banco de Dados.'; $strPrivDescCreateRoutine = 'Permitir criar stored routines.'; -$strPrivDescCreateTbl = 'Permitir criar novas tabelas.'; -$strPrivDescCreateTmpTable = 'Permitir criar tabelas temporárias.'; +$strPrivDescCreateTbl = 'Permitir criar novas tabelas.'; +$strPrivDescCreateTmpTable = 'Permitir criar tabelas temporárias.'; $strPrivDescCreateUser = 'Permitir criar, apagar e renomear contas dos usuários.'; $strPrivDescCreateView = 'Permitir criar novas visões.'; -$strPrivDescDelete = 'Permitir apagar dados.'; -$strPrivDescDropDb = 'Permitir eliminar Banco de Dados e tabelas.'; -$strPrivDescDropTbl = 'Permitir eliminar tabelas.'; +$strPrivDescDelete = 'Permitir apagar dados.'; +$strPrivDescDropDb = 'Permitir eliminar Banco de Dados e tabelas.'; +$strPrivDescDropTbl = 'Permitir eliminar tabelas.'; +$strPrivDescEvent = 'Permitir iniciar eventos no cronograma de eventos'; $strPrivDescExecute5 = 'Permitir executar stored routines.'; -$strPrivDescExecute = 'Permitir rodar "stored procedures"; Sem efeitos nesta versão do MySQL.'; -$strPrivDescFile = 'Permitir importar dados e exportar dados em arquivos.'; -$strPrivDescGrant = 'Permitir adicionar usuários e privilégios sem recarregar a tabela de privilégios.'; -$strPrivDescIndex = 'Permitir criar e eliminar índices.'; -$strPrivDescInsert = 'Permitir inserir e substituir dados.'; -$strPrivDescLockTables = 'Permitir bloquear tabelas para a processo atual.'; -$strPrivDescMaxConnections = 'Limitar o numero de novas conexões que o usuário pode abrir por hora.'; -$strPrivDescMaxQuestions = 'Limitar o número de consultas que podem ser enviadas ao servidor por hora.'; -$strPrivDescMaxUpdates = 'Limitar o número de comandos que alteram Bancos de Dados ou tabelas que o usuário pode executar por hora.'; +$strPrivDescExecute = 'Permitir rodar "stored procedures"; Sem efeitos nesta versão do MySQL.'; +$strPrivDescFile = 'Permitir importar dados e exportar dados em arquivos.'; +$strPrivDescGrant = 'Permitir adicionar usuários e privilégios sem recarregar a tabela de privilégios.'; +$strPrivDescIndex = 'Permitir criar e eliminar índices.'; +$strPrivDescInsert = 'Permitir inserir e substituir dados.'; +$strPrivDescLockTables = 'Permitir bloquear tabelas para a processo atual.'; +$strPrivDescMaxConnections = 'Limitar o numero de novas conexões que o usuário pode abrir por hora.'; +$strPrivDescMaxQuestions = 'Limitar o número de consultas que podem ser enviadas ao servidor por hora.'; +$strPrivDescMaxUpdates = 'Limitar o número de comandos que alteram Bancos de Dados ou tabelas que o usuário pode executar por hora.'; $strPrivDescMaxUserConnections = 'Limitar o número de conexões simultâneas que o usuário pode ter.'; -$strPrivDescReferences = 'Sem efeitos nesta versão do MySQL.'; -$strPrivDescReload = 'Permitir recarregar configurações do servidor e descarregar o cache do servidor.'; -$strPrivDescReplClient = 'Permitir que o usuário pergunte onde estão os escravos / mestres.'; -$strPrivDescReplSlave = 'Precisar dos escravos de replicação.'; -$strPrivDescSelect = 'Permitir leitura dos dados.'; -$strPrivDescShowDb = 'Permitir acesso completo à lista de Bancos de Dados.'; +$strPrivDescProcess = 'Permitir visualizar processos de todos os usuários'; +$strPrivDescReferences = 'Sem efeitos nesta versão do MySQL.'; +$strPrivDescReload = 'Permitir recarregar configurações do servidor e descarregar o cache do servidor.'; +$strPrivDescReplClient = 'Permitir que o usuário pergunte onde estão os escravos / mestres.'; +$strPrivDescReplSlave = 'Precisar dos escravos de replicação.'; +$strPrivDescSelect = 'Permitir leitura dos dados.'; +$strPrivDescShowDb = 'Permitir acesso completo à lista de Bancos de Dados.'; $strPrivDescShowView = 'Permitir executar consultas SHOW CREATE VIEW.'; -$strPrivDescShutdown = 'Permitir desligar o servidor.'; -$strPrivDescSuper = 'Permitir conectar, se o numero máximo de conexões for alcançado; Necessário para muitas operações administrativas, como setar variáveis globais e matar processos de outros usuários.'; -$strPrivDescUpdate = 'Permitir modificar dados.'; -$strPrivDescUsage = 'Sem privilégios.'; -$strPrivileges = 'Privilégios'; -$strPrivilegesReloaded = 'Os privilégios foram recarregados com sucesso.'; +$strPrivDescShutdown = 'Permitir desligar o servidor.'; +$strPrivDescSuper = 'Permitir conectar, se o numero máximo de conexões for alcançado; Necessário para muitas operações administrativas, como setar variáveis globais e matar processos de outros usuários.'; +$strPrivDescTrigger = 'Permitir criar e e largar em cadeia'; //será que ta certo? +$strPrivDescUpdate = 'Permitir modificar dados.'; +$strPrivDescUsage = 'Sem privilégios.'; +$strPrivileges = 'Privilégios'; +$strPrivilegesReloaded = 'Os privilégios foram recarregados com sucesso.'; $strProcedures = 'Procedimentos'; -$strProcesses = 'Processos'; -$strProcesslist = 'Lista de processos'; +$strProcesses = 'Processos'; +$strProcesslist = 'Lista de processos'; +$strProfiling = 'Perfil'; $strProtocolVersion = 'Versão do Protocolo'; -$strPutColNames = 'Colocar nome do campo na primeira linha'; +$strPutColNames = 'Colocar nome do campo na primeira linha'; -$strQBEDel = 'Del'; // (used in tbl_qbe.php) -$strQBEIns = 'Ins'; // (used in tbl_qbe.php) -$strQBE = 'Procurar por exemplo'; +$strQBEDel = 'Del'; // (used in tbl_qbe.php) +$strQBEIns = 'Ins'; // (used in tbl_qbe.php) +$strQBE = 'Procurar por exemplo'; $strQueryCache = 'Consulta do cache'; -$strQueryFrame = 'Janela de consulta'; -$strQueryOnDb = 'Consulta no Banco de Dados %s:'; +$strQueryFrame = 'Janela de consulta'; +$strQueryOnDb = 'Consulta no Banco de Dados %s:'; $strQueryResultsOperations = 'Operações resultantes das consultas'; -$strQuerySQLHistory = 'Histórico de consultas'; -$strQueryStatistics = 'Estatísticas das consultas: Desde o início, %s consultas foram enviadas para o servidor.'; -$strQueryTime = 'Consulta levou %01.4f segundos'; -$strQueryType = 'Tipo de consulta'; -$strQueryWindowLock = 'Não sobrescrever esta consulta fora desta janela'; +$strQuerySQLHistory = 'Histórico de consultas'; +$strQueryStatistics = 'Estatísticas das consultas: Desde o início, %s consultas foram enviadas para o servidor.'; +$strQueryTime = 'Consulta levou %01.4f segundos'; +$strQueryType = 'Tipo de consulta'; +$strQueryWindowLock = 'Não sobrescrever esta consulta fora desta janela'; $strReadRequests = 'Leitura requisitada'; -$strReceived = 'Recebido'; +$strRebuild = 'Reconstruir'; +$strReceived = 'Recebido'; $strRecommended = 'recomendado'; -$strRecords = 'Registros'; -$strReferentialIntegrity = 'Verificar integridade referencial:'; -$strRefresh = 'Atualizar'; -$strRelationalSchema = 'Esquema relacional'; +$strRecords = 'Registros'; +$strReferentialIntegrity = 'Verificar integridade referencial:'; +$strRefresh = 'Atualizar'; +$strRelationalKey = 'Chave de relação'; +$strRelationalSchema = 'Esquema relacional'; $strRelationDeleted = 'Relacionamento apagado'; -$strRelationNotWorking = 'Os recursos adicionais para trabalhar com tabelas linkadas foram desativadas. Para descobrir o motivo clique %saqui%s.'; -$strRelationsForTable = 'RELAÇÕES PARA A TABELA'; -$strRelations = 'Relações'; -$strRelationView = 'Ver relações'; -$strReloadingThePrivileges = 'Recarregando os privilégios'; +$strRelationNotWorking = 'Os recursos adicionais para trabalhar com tabelas linkadas foram desativadas. Para descobrir o motivo clique %saqui%s.'; +$strRelationsForTable = 'RELAÇÕES PARA A TABELA'; +$strRelations = 'Relações'; +$strRelationView = 'Ver relações'; +$strReloadingThePrivileges = 'Recarregando os privilégios'; $strReloadPrivileges = 'Recarregar privilégios'; $strReload = 'Recarregar'; -$strRemoveSelectedUsers = 'Remover os usuários selecionados'; -$strRenameDatabaseOK = 'O Banco de Dados %s foi renomeado para %s'; -$strRenameTableOK = 'Tabela %s renomeada para %s'; -$strRenameTable = 'Renomear a tabela para '; -$strRepairTable = 'Reparar tabela'; -$strReplaceNULLBy = 'Substituir NULL por'; -$strReplaceTable = 'Substituir os dados da tabela pelos do arquivo'; +$strRemovePartitioning = 'Remover partição'; +$strRemoveSelectedUsers = 'Remover os usuários selecionados'; +$strRenameDatabaseOK = 'O Banco de Dados %s foi renomeado para %s'; +$strRenameTableOK = 'Tabela %s renomeada para %s'; +$strRenameTable = 'Renomear a tabela para '; +$strRepair = 'Reparar'; +$strRepairTable = 'Reparar tabela'; +$strReplaceNULLBy = 'Substituir NULL por'; +$strReplaceTable = 'Substituir os dados da tabela pelos do arquivo'; $strReplication = 'Replicação'; -$strReset = 'Resetar'; -$strResourceLimits = 'Limite dos recursos'; +$strReset = 'Resetar'; +$strResourceLimits = 'Limite dos recursos'; $strRestartInsertion = 'Reiniciar inserção com %s registros'; -$strReType = 'Re-digite'; -$strRevokeAndDeleteDescr = 'Os usuários manterão o privilégio de USAGE até que os privilégios sejam recarregados.'; -$strRevokeAndDelete = 'Revogar todos os privilégios ativos dos usuarios e depois apagar eles.'; -$strRevokeMessage = 'Você revogou os privilégios para %s'; -$strRevoke = 'Revogar'; -$strRomanian = 'Romêno'; +$strReType = 'Re-digite'; +$strRevokeAndDeleteDescr = 'Os usuários manterão o privilégio de USAGE até que os privilégios sejam recarregados.'; +$strRevokeAndDelete = 'Revogar todos os privilégios ativos dos usuarios e depois apagar eles.'; +$strRevokeMessage = 'Você revogou os privilégios para %s'; +$strRevoke = 'Revogar'; +$strRomanian = 'Romêno'; $strRoutineReturnType = 'Tipo de returno'; $strRoutines = 'Rotinas'; -$strRowLength = 'Tamanho do registro'; -$strRowsFrom = 'registro(s) começando de'; -$strRowSize = ' Tamanho do registro '; -$strRowsModeFlippedHorizontal = 'horizontal (cabeçalhos rotacionados)'; -$strRowsModeHorizontal = 'horizontal'; -$strRowsModeOptions = 'no modo %s e repetindo cabeçalhos após %s células'; -$strRowsModeVertical = 'vertical'; -$strRows = 'Registros'; -$strRowsStatistic = 'Estatísticas do registros'; -$strRunning = 'Rodando em %s'; -$strRunQuery = 'Enviar consulta SQL'; -$strRunSQLQuery = 'Fazer consulta SQL no Banco de Dados %s'; +$strRowLength = 'Tamanho do registro'; +$strRowsAffected = '%1$d linha(s) afetadas.'; +$strRowsDeleted = '%1$d linhas(s) excluídas.'; +$strRowsFrom = 'registro(s) começando de'; +$strRowsInserted = '%1$d linha(s) inseridas.'; +$strRowSize = ' Tamanho do registro '; +$strRowsModeFlippedHorizontal = 'horizontal (cabeçalhos rotacionados)'; +$strRowsModeHorizontal = 'horizontal'; +$strRowsModeOptions = 'no modo %s e repetindo cabeçalhos após %s células'; +$strRowsModeVertical = 'vertical'; +$strRows = 'Registros'; +$strRowsStatistic = 'Estatísticas do registros'; +$strRunning = 'Rodando em %s'; +$strRunQuery = 'Enviar consulta SQL'; +$strRunSQLQuery = 'Fazer consulta SQL no Banco de Dados %s'; $strRunSQLQueryOnServer = 'Rodar consulta(s) SQL no servidor %s'; -$strRussian = 'Russo'; +$strRussian = 'Russo'; -$strSaveOnServer = 'Salvar no servidor no diretório %s'; +$strSaveOnServer = 'Salvar no servidor no diretório %s'; $strSavePosition = 'Salvar posição'; -$strSave = 'Salvar'; -$strScaleFactorSmall = 'A escala é muito pequena para ajustar o esquema em uma página'; -$strSearchFormTitle = 'Procurar no Banco de Dados'; -$strSearchInTables = 'Dentro da(s) tabela(s):'; -$strSearchNeedle = 'Palavra(s) ou valor(es) para procurar (coringa: "%"):'; -$strSearchOption1 = 'pelo menos uma das palavras'; -$strSearchOption2 = 'todas as palavras'; -$strSearchOption3 = 'a frase exata'; -$strSearchOption4 = 'como expressão regular'; -$strSearch = 'Procurar'; -$strSearchResultsFor = 'Procurar resultados por "%s" %s:'; -$strSearchType = 'Encontrar:'; -$strSecretRequired = 'O arquivo de configuração agora precisa de uma frase secreta com senha (blowfish_secret).'; -$strSelectADb = 'Selecionar um Banco de Dados'; -$strSelectAll = 'Selecionar Todos'; -$strSelectBinaryLog = 'Selecionar log binário para exibir'; -$strSelectFields = 'Selecionar os campos (no mínimo 1)'; +$strSave = 'Salvar'; +$strScaleFactorSmall = 'A escala é muito pequena para ajustar o esquema em uma página'; +$strSearchFormTitle = 'Procurar no Banco de Dados'; +$strSearchInField = 'Dentro do campo:'; +$strSearchInTables = 'Dentro da(s) tabela(s):'; +$strSearchNeedle = 'Palavra(s) ou valor(es) para procurar (coringa: "%"):'; +$strSearchOption1 = 'pelo menos uma das palavras'; +$strSearchOption2 = 'todas as palavras'; +$strSearchOption3 = 'a frase exata'; +$strSearchOption4 = 'como expressão regular'; +$strSearch = 'Procurar'; +$strSearchResultsFor = 'Procurar resultados por "%s" %s:'; +$strSearchType = 'Encontrar:'; +$strSecretRequired = 'O arquivo de configuração agora precisa de uma frase secreta com senha (blowfish_secret).'; +$strSelectADb = 'Selecionar um Banco de Dados'; +$strSelectAll = 'Selecionar Todos'; +$strSelectBinaryLog = 'Selecionar log binário para exibir'; +$strSelectFields = 'Selecionar os campos (no mínimo 1)'; $strSelectForeignKey = 'Selecionar Chave Estrangeira'; -$strSelectNumRows = 'na consulta'; +$strSelectNumRows = 'na consulta'; $strSelectReferencedKey = 'Seleciona chave referenciada'; -$strSelectTables = 'Tabelas selecionadas'; -$strSend = 'Enviado'; -$strSent = 'Enviar'; -$strServerChoice = 'Seleção do Servidor'; -$strServerNotResponding = 'O servidor não está respondendo'; -$strServer = 'Servidor'; +$strSelectTables = 'Tabelas selecionadas'; +$strSend = 'Enviado'; +$strSent = 'Enviar'; +$strServerChoice = 'Seleção do Servidor'; +$strServerNotResponding = 'O servidor não está respondendo'; +$strServer = 'Servidor'; $strServers = 'Servidores'; $strServerStatusDelayedInserts = 'Inserções demoradas'; -$strServerStatus = 'Informações de Runtime'; -$strServerStatusUptime = 'Esse servidor MySQL está rodando por %s. Ele foi iniciado em %s.'; -$strServerTabVariables = 'Variáveis'; -$strServerTrafficNotes = 'Tráfico do servidor: Essas tabelas mostram as estatísticas do tráfico da rede neste servidor MySQL desde o início.'; -$strServerVars = 'Variáveis e configurações do servidor'; -$strServerVersion = 'Versão do Servidor'; +$strServerStatus = 'Informações de Runtime'; +$strServerStatusUptime = 'Esse servidor MySQL está rodando por %s. Ele foi iniciado em %s.'; +$strServerTabVariables = 'Variáveis'; +$strServerTrafficNotes = 'Tráfico do servidor: Essas tabelas mostram as estatísticas do tráfico da rede neste servidor MySQL desde o início.'; +$strServerVars = 'Variáveis e configurações do servidor'; +$strServerVersion = 'Versão do Servidor'; $strSessionStartupErrorGeneral = 'Não pôde iniciar a sessão sem erros, cheque os erros ocorridos nos logs do PHP e/ou do seu servidor web e configure a instalação do PHP corretamente.'; -$strSessionValue = 'Valor da sessão'; -$strSetEnumVal = 'Se um tipo de campo é "enum" ou "set", por favor entre valores usando este formato: \'a\',\'b\',\'c\'...
    Se você for colocar uma barra contrária ("\") ou aspas simples ("\'") entre os valores, coloque uma barra contrária antes (por exemplo \'\\\\xyz\' ou \'a\\\'b\').'; -$strShowAll = 'Mostrar todos'; -$strShowColor = 'Mostrar cor'; -$strShowDatadictAs = 'Formato do dicionário de dados'; -$strShowFullQueries = 'Mostrar consultas completas'; -$strShowGrid = 'Mostrar grade'; +$strSessionValue = 'Valor da sessão'; +$strSetEnumVal = 'Se um tipo de campo é "enum" ou "set", por favor entre valores usando este formato: \'a\',\'b\',\'c\'...
    Se você for colocar uma barra contrária ("\") ou aspas simples ("\'") entre os valores, coloque uma barra contrária antes (por exemplo \'\\\\xyz\' ou \'a\\\'b\').'; +$strShowAll = 'Mostrar todos'; +$strShowColor = 'Mostrar cor'; +$strShowDatadictAs = 'Formato do dicionário de dados'; +$strShowFullQueries = 'Mostrar consultas completas'; +$strShowGrid = 'Mostrar grade'; $strShowHideLeftMenu = 'Exibir/Ocultar menu da esquerda'; $strShowingBookmark = 'Exibindo marcadores'; $strShowingPhp = 'Exibindo como código PHP'; -$strShowingRecords = 'Mostrando registros '; +$strShowingRecords = 'Mostrando registros '; $strShowingSQL = 'Exibindo consulta SQL'; -$strShow = 'Mostrar'; +$strShow = 'Mostrar'; $strShowOpenTables = 'Exibir tabelas abertas'; -$strShowPHPInfo = 'Mostrar informações do PHP'; +$strShowPHPInfo = 'Mostrar informações do PHP'; $strShowSlaveHosts = 'Exibir servidores escravos'; $strShowSlaveStatus = 'Exibir status dos escravos'; $strShowStatusBinlog_cache_disk_useDescr = 'O número de transações que usaram o cache do log binário temporário mas que excederam o valor do binlog_cache_size e usaram o arquivo temporário para armazenar enunciados da transação.'; @@ -826,129 +856,135 @@ $strShowStatusThreads_cachedDescr = 'O número de processos no cache de processo $strShowStatusThreads_connectedDescr = 'O número de conexões atualmente abertas.'; $strShowStatusThreads_createdDescr = 'O número de processos criadas para manipular conexões. Se Threads_created é grande, você deveria aumentar o valor de thread_cache_size. (Normalmente isso não da um aumento notável de performance se você tem uma boa implementação de processos.)'; $strShowStatusThreads_runningDescr = 'O número de processos que não estão dormindo.'; -$strShowTableDimension = 'Mostrar dimensão das tabelas'; -$strShowTables = 'Mostrar tabelas'; -$strShowThisQuery = ' Mostrar esta consulta SQL novamente '; -$strSimplifiedChinese = 'Chinês Simplificado'; -$strSingly = '(singularmente)'; -$strSize = 'Tamanho'; +$strShowTableDimension = 'Mostrar dimensão das tabelas'; +$strShowTables = 'Mostrar tabelas'; +$strShowThisQuery = ' Mostrar esta consulta SQL novamente '; +$strSimplifiedChinese = 'Chinês Simplificado'; +$strSingly = '(singularmente)'; +$strSize = 'Tamanho'; $strSkipQueries = 'Número de registros (consultas) ignoradas no início'; -$strSlovak = 'Eslováquio'; -$strSlovenian = 'Eslovênio'; +$strSlovak = 'Eslováquio'; +$strSlovenian = 'Eslovênio'; $strSmallBigAll = 'Tudo Pequeno/Grande'; $strSnapToGrid = 'Ajustar à grade'; $strSocketProblem = '(ou o soquete do servidor MySQL local não está configurado corretamente)'; -$strSortByKey = 'Ordenar pela chave'; +$strSortByKey = 'Ordenar pela chave'; $strSorting = 'Ordenando'; -$strSort = 'Ordenar'; -$strSpaceUsage = 'Uso do espaço'; -$strSpanish = 'Espanhol'; -$strSplitWordsWithSpace = 'Palavras são separadas por um caracter de espaço (" ").'; +$strSort = 'Ordenar'; +$strSpaceUsage = 'Uso do espaço'; +$strSpanish = 'Espanhol'; +$strSplitWordsWithSpace = 'Palavras são separadas por um caracter de espaço (" ").'; $strSQLCompatibility = 'Modo de compatibilidade SQL'; -$strSQLExportType = 'Tipo de exportação'; -$strSQLParserBugMessage = 'Talvez tenha encontrado um bug no analizador (parser) do SQL. Analise a sua Consulta SQL com atenção, e verifique se as aspas estão corretas e não estão desencontradas. Outra possibilidade de falha é o fato de estar tentando subir um arquivo com saída binária de uma área de texto citada. Pode também experimentar a sua consulta SQL no prompt de comandos do MySQL. A saída de erro do MySQL, isto se existir alguma, também poderá ajudar a diagnosticar o problema. Se continuar a ter problemas ou se o analisador (parser) falhar onde a interface da linha de comandos tiver sucesso, reduza por favor a entrada da consulta SQL até aquele que causou o problema, e envie o relatório de bug com os dados do chunk da seção CORTE abaixo:'; -$strSQLParserUserError = 'Parece haver um erro na sua consulta SQL. A saída do servidor MySQL abaixo, isto se existir alguma, também poderá ajudar a diagnosticar o problema.'; -$strSQLQuery = 'consulta SQL'; -$strSQLResult = 'Resultado SQL'; -$strSQL = 'SQL'; -$strSQPBugInvalidIdentifer = 'Identificador inválido'; -$strSQPBugUnclosedQuote = 'Aspas não fechada'; -$strSQPBugUnknownPunctuation = 'String de pontuação desconhecida'; +$strSQLExportType = 'Tipo de exportação'; +$strSQLParserBugMessage = 'Talvez tenha encontrado um bug no analizador (parser) do SQL. Analise a sua Consulta SQL com atenção, e verifique se as aspas estão corretas e não estão desencontradas. Outra possibilidade de falha é o fato de estar tentando subir um arquivo com saída binária de uma área de texto citada. Pode também experimentar a sua consulta SQL no prompt de comandos do MySQL. A saída de erro do MySQL, isto se existir alguma, também poderá ajudar a diagnosticar o problema. Se continuar a ter problemas ou se o analisador (parser) falhar onde a interface da linha de comandos tiver sucesso, reduza por favor a entrada da consulta SQL até aquele que causou o problema, e envie o relatório de bug com os dados do chunk da seção CORTE abaixo:'; +$strSQLParserUserError = 'Parece haver um erro na sua consulta SQL. A saída do servidor MySQL abaixo, isto se existir alguma, também poderá ajudar a diagnosticar o problema.'; +$strSQLQuery = 'consulta SQL'; +$strSQLResult = 'Resultado SQL'; +$strSQL = 'SQL'; +$strSQPBugInvalidIdentifer = 'Identificador inválido'; +$strSQPBugUnclosedQuote = 'Aspas não fechada'; +$strSQPBugUnknownPunctuation = 'String de pontuação desconhecida'; $strStandInStructureForView = 'Estrutura stand-in para visualizar'; -$strStatCheckTime = 'Última verificação'; -$strStatCreateTime = 'Criação'; -$strStatement = 'Comandos'; +$strStatCheckTime = 'Última verificação'; +$strStatCreateTime = 'Criação'; +$strStatement = 'Comandos'; $strStatisticsOverrun = 'Em servidores ocupados, os contadores de byte podem sobrecarregar, então as estatísticas como relatadas pelo servidor MySQL podem estar incorretas.'; -$strStatUpdateTime = 'Última atualização'; -$strStatus = 'Status'; +$strStatUpdateTime = 'Última atualização'; +$strStatus = 'Status'; $strStorageEngines = 'Storage Engines'; // sem traducao $strStorageEngine = 'Storage Engine'; // sem traducao -$strStrucCSV = 'Dados CSV'; -$strStrucData = 'Estrutura e dados'; -$strStrucExcelCSV = 'CSV para dados MS Excel'; -$strStrucNativeExcel = 'Dados nativos do MS Excel'; -$strStrucOnly = 'Somente estrutura'; -$strStructPropose = 'Propor estrutura da tabela'; -$strStructure = 'Estrutura'; +$strStrucCSV = 'Dados CSV'; +$strStrucData = 'Estrutura e dados'; +$strStrucExcelCSV = 'CSV para dados MS Excel'; +$strStrucNativeExcel = 'Dados nativos do MS Excel'; +$strStrucOnly = 'Somente estrutura'; +$strStructPropose = 'Propor estrutura da tabela'; +$strStructure = 'Estrutura'; $strStructureForView = 'Estrutura para visualizar'; -$strSubmit = 'Submeter'; -$strSuccess = 'Seu comando SQL foi executado com sucesso'; -$strSum = 'Soma'; -$strSwedish = 'Suéco'; -$strSwitchToDatabase = 'Mudar para o Banco de Dados copiado'; -$strSwitchToTable = 'Mudar para a tabela copiada'; +$strSubmit = 'Submeter'; +$strSuccess = 'Seu comando SQL foi executado com sucesso'; +$strSuhosin = 'Servidor rodando com \'Suhosin\'. Verifique a %sdocumentation%s para possíveis razões do erro.'; +$strSum = 'Soma'; +$strSwedish = 'Suéco'; +$strSwekeyAuthenticating = 'Autenticando...'; +$strSwekeyAuthFailed = 'Falha na autenticação de hardware'; +$strSwitchToDatabase = 'Mudar para o Banco de Dados copiado'; +$strSwitchToTable = 'Mudar para a tabela copiada'; $strTableAlreadyExists = 'Tabela %s já existe!'; -$strTableComments = 'Comentários da tabela'; -$strTableEmpty = 'O Nome da Tabela está vazio!'; -$strTableHasBeenDropped = 'Tabela %s foi eliminada'; -$strTableHasBeenEmptied = 'Tabela %s foi esvaziada'; -$strTableHasBeenFlushed = 'Tabela %s foi limpa'; +$strTableAlteredSuccessfully = 'A tabela %1$s foi alterada com sucesso'; +$strTableComments = 'Comentários da tabela'; +$strTableEmpty = 'O Nome da Tabela está vazio!'; +$strTableHasBeenCreated = 'A tabela %1$s foi criada.'; +$strTableHasBeenDropped = 'Tabela %s foi eliminada'; +$strTableHasBeenEmptied = 'Tabela %s foi esvaziada'; +$strTableHasBeenFlushed = 'Tabela %s foi limpa'; $strTableIsEmpty = 'Tabela para estar vazia!'; -$strTableMaintenance = 'Tabela de Manutenção'; +$strTableMaintenance = 'Tabela de Manutenção'; $strTableName = 'Nome da Tabela'; -$strTableOfContents = 'Tabela de conteúdos'; -$strTableOptions = 'Opções da tabela'; -$strTables = '%s tabela(s)'; -$strTableStructure = 'Estrutura da tabela'; -$strTable = 'Tabela'; -$strTakeIt = 'tome'; -$strTblPrivileges = 'Privilégios específicos da tabela'; +$strTableOfContents = 'Tabela de conteúdos'; +$strTableOptions = 'Opções da tabela'; +$strTables = '%s tabela(s)'; +$strTableStructure = 'Estrutura da tabela'; +$strTable = 'Tabela'; +$strTakeIt = 'tome'; +$strTblPrivileges = 'Privilégios específicos da tabela'; $strTempData = 'Dados temporários'; -$strTextAreaLength = ' Por causa da sua largura,
    esse campo pode não ser editável '; -$strThai = 'Thailandês'; +$strTextAreaLength = ' Por causa da sua largura,
    esse campo pode não ser editável '; +$strTexyText = 'Texy! texto'; // Texy?? +$strThai = 'Thailandês'; $strThemeDefaultNotFound = 'Tema padrão %s não encontrado!'; $strThemeNoPreviewAvailable = 'Nenhuma pré-visualização disponível.'; $strThemeNotFound = 'Tema %s não encontrado!'; $strThemeNoValidImgPath = 'Encontrado caminho inválido para imagens para o tema %s!'; $strThemePathNotFound = 'Encontrado caminho inválido para o tema %s!'; -$strTheme = 'Tema / Estilo'; -$strThisHost = 'Esse Servidor'; +$strTheme = 'Tema / Estilo'; +$strThisHost = 'Esse Servidor'; $strThreads = 'Processos'; -$strThreadSuccessfullyKilled = 'Processo %s foi morto com sucesso.'; +$strThreadSuccessfullyKilled = 'Processo %s foi morto com sucesso.'; $strTimeoutInfo = 'Importação anterior passou do tempo limite, depois de reenviar, irá continuar na posição %d.'; $strTimeoutNothingParsed = 'Entretanto na última vez nenhum dado foi passado, isso normalmente significa que o phpMyAdmin não é capaz de finalizar essa importação à menos que você aumente o tempo limite do PHP.'; $strTimeoutPassed = 'Script passou do tempo limite, se você deseja terminar a importação, reenvie o mesmo arquivo que a importação será resumida.'; -$strTime = 'Tempo'; +$strTime = 'Tempo'; $strToFromPage = 'página de/para'; $strToggleScratchboard = 'mudar o estado do Scratchboard'; //isso está correto? mas nao descobri o q eh $strToggleSmallBig = 'Mudar para pequeno/grande'; $strToSelectRelation = 'Para selecionar relacionamento, clique :'; -$strTotal = 'total'; -$strTotalUC = 'Total'; -$strTraditionalChinese = 'Chinês Tradicional'; -$strTraditionalSpanish = 'Espanhol Traditional'; -$strTraffic = 'Tráfego'; +$strTotal = 'total'; +$strTotalUC = 'Total'; +$strTraditionalChinese = 'Chinês Tradicional'; +$strTraditionalSpanish = 'Espanhol Traditional'; +$strTraffic = 'Tráfego'; $strTransactionCoordinator = 'Coordenador da transação'; -$strTransformation_application_octetstream__download = 'Mostrar o link para baixar os dados binários do campo. Primeira opção é o nome do arquivo binário. Segunda opção é um possível nome de campo de uma linha da tabela que contém o nome do arquivo. Se você usar a segunda opção precisa colocar na primeira opção uma string em branco'; +$strTransformation_application_octetstream__download = 'Mostrar o link para baixar os dados binários do campo. Primeira opção é o nome do arquivo binário. Segunda opção é um possível nome de campo de uma linha da tabela que contém o nome do arquivo. Se você usar a segunda opção precisa colocar na primeira opção uma string em branco'; $strTransformation_application_octetstream__hex = 'Exibir representação hexadecimal dos dados. Primeiro parâmetro opcional especifica como frequentemente espaços serão adicionados (padrão para 2 mordidelas).'; //ta certo isso? nibbles, traduzi como mordidelas -$strTransformation_image_jpeg__inline = 'Mostrar uma miniatura clicável; opções: largura,altura em pixels (mantém a proporção original)'; -$strTransformation_image_jpeg__link = 'Mostrar o link para esta imagem (ex.: blob download direto).'; -$strTransformation_image_png__inline = 'Ver imagem/jpeg: em linha'; +$strTransformation_image_jpeg__inline = 'Mostrar uma miniatura clicável; opções: largura,altura em pixels (mantém a proporção original)'; +$strTransformation_image_jpeg__link = 'Mostrar o link para esta imagem (ex.: blob download direto).'; +$strTransformation_image_png__inline = 'Ver imagem/jpeg: em linha'; $strTransformation_text_plain__dateformat = 'Exibir um TIME, TIMESTAMP, DATETIME ou campo numérico unix timestamp formatado como data. A primeira opção é o offset (em horas) que será adicionado ao timestamp (Padrão: 0). Use a segunda opção para especificar uma string de formatação data/tempo diferente. A terceira opção determina se você deseja ver data local ou UTC (use a string "local" ou "utc") para isso. De acordo com isso, o formatdo da data terá valores diferentes - para "local" veja a documentação do PHP para função strftime() e para "utc" isso é feito usando a função gmdate().'; -$strTransformation_text_plain__external = 'LINUX APENAS: Rode uma aplicação externa e alimente os campos de dados pela entrada padrão. Retorna a saída padrão da aplicação. Padrão é Limpo, para uma bonita impressão do código HTML. Por razões de segurança, você deve editar manualmente o arquivo libraries/transformations/text_plain__external.inc.php e inserir as ferramentas que você permite rodar. A primeira opção é o número do programa que você quer rodar e a segunda opção são os parâmetros para o programa. A terceira opção, se setada para 1 irá converter a saída usando htmlspecialchars() (Padrão é 1). A quarta opção, se setada como 1 irá por um NOWRAP para o conteúdo da célula, de forma que a saída inteira será mostrada sem reformatação(Padrão é 1)'; -$strTransformation_text_plain__formatted = 'Preservar a formatação original campo. Sem escape.'; -$strTransformation_text_plain__imagelink = 'Mostrar uma imagem e um link, o campo contém um nome de arquivo; primeira opção é um prefixo tipo "http://domain.com/", segunda opção é a largura em pixels, o terceiro é a altura.'; -$strTransformation_text_plain__link = 'Mostrar um link, o campo contém o nome do arquivo, primeira opção é um prefixo tipo "http://domain.com/", segunda opção é um título para o link.'; +$strTransformation_text_plain__external = 'LINUX APENAS: Rode uma aplicação externa e alimente os campos de dados pela entrada padrão. Retorna a saída padrão da aplicação. Padrão é Limpo, para uma bonita impressão do código HTML. Por razões de segurança, você deve editar manualmente o arquivo libraries/transformations/text_plain__external.inc.php e inserir as ferramentas que você permite rodar. A primeira opção é o número do programa que você quer rodar e a segunda opção são os parâmetros para o programa. A terceira opção, se setada para 1 irá converter a saída usando htmlspecialchars() (Padrão é 1). A quarta opção, se setada como 1 irá por um NOWRAP para o conteúdo da célula, de forma que a saída inteira será mostrada sem reformatação(Padrão é 1)'; +$strTransformation_text_plain__formatted = 'Preservar a formatação original campo. Sem escape.'; +$strTransformation_text_plain__imagelink = 'Mostrar uma imagem e um link, o campo contém um nome de arquivo; primeira opção é um prefixo tipo "http://domain.com/", segunda opção é a largura em pixels, o terceiro é a altura.'; +$strTransformation_text_plain__link = 'Mostrar um link, o campo contém o nome do arquivo, primeira opção é um prefixo tipo "http://domain.com/", segunda opção é um título para o link.'; $strTransformation_text_plain__sql = 'Formatar texto como consulta SQL com síntaxe colorida.'; -$strTransformation_text_plain__substr = 'Mostrar apenas parte da string. Primeira opção é um offset para definir onde a saída do seu texto deve iniciar (Padrão: 0). Segunda opção é o quanto do texto deverá ser retornado. Se estiver em branco, retorna todo o restante do texto. Terceira opção define quais caracteres serão acrescentados na substring retornada (Padrão: ...).'; +$strTransformation_text_plain__substr = 'Mostrar apenas parte da string. Primeira opção é um offset para definir onde a saída do seu texto deve iniciar (Padrão: 0). Segunda opção é o quanto do texto deverá ser retornado. Se estiver em branco, retorna todo o restante do texto. Terceira opção define quais caracteres serão acrescentados na substring retornada (Padrão: ...).'; $strTriggers = 'Gatilhos'; -$strTruncateQueries = 'Truncar as consultas SQL exibidas'; -$strTurkish = 'Turco'; -$strType = 'Tipo'; +$strTruncateQueries = 'Truncar as consultas SQL exibidas'; +$strTurkish = 'Turco'; +$strType = 'Tipo'; -$strUkrainian = 'Ucraniano'; -$strUncheckAll = 'Desmarcar todos'; -$strUnicode = 'Unicode'; -$strUnique = 'Único'; -$strUnknown = 'desconhecido'; -$strUnselectAll = 'Desmarcar Todos'; +$strUkrainian = 'Ucraniano'; +$strUncheckAll = 'Desmarcar todos'; +$strUnicode = 'Unicode'; +$strUnique = 'Único'; +$strUnknown = 'desconhecido'; +$strUnselectAll = 'Desmarcar Todos'; $strUnsupportedCompressionDetected = 'Você tentou carregar um arquivo com compressão não suportada (%s). Pode o suporte para isso não ter sido implementado ou pode ter sido desabilitado por sua configuração PHP.'; -$strUpdatePrivMessage = 'Você mudou os priviléios para %s.'; -$strUpdateProfileMessage = 'A configuração foi atualizada.'; -$strUpdateQuery = 'Atualizar a consulta SQL'; -$strUpdComTab = 'Consulte a documentação sobre como atualizar sua tabela Column_comments'; -$strUpgrade = 'Você deveria atualizar para %s %s ou posterior.'; +$strUpdatePrivMessage = 'Você mudou os priviléios para %s.'; +$strUpdateProfileMessage = 'A configuração foi atualizada.'; +$strUpdateQuery = 'Atualizar a consulta SQL'; +$strUpdComTab = 'Consulte a documentação sobre como atualizar sua tabela Column_comments'; +$strUpgrade = 'Você deveria atualizar para %s %s ou posterior.'; $strUploadErrorCantWrite = 'Falhou ao salvar arquivo no disco.'; $strUploadErrorExtension = 'Carregamento do arquivo parado pela extenção.'; $strUploadErrorFormSize = 'O arquivo carregado excede o tamanho definido na diretriz MAX_FILE_SIZE do formulário HTM.'; @@ -958,121 +994,55 @@ $strUploadErrorPartial = 'Carregamento do arquivo foi apenas parcial.'; $strUploadErrorUnknown = 'Erro desconhecido no carregamento do arquivo.'; $strUploadLimit = 'Você provavelmente tentou carregar um arquivo muito grande. Veja referências na %sdocumentation%s para burlar esses limites.'; $strUploadsNotAllowed = 'Não é permitido subir arquivos neste servidor.'; -$strUsage = 'Uso'; -$strUseBackquotes = 'Usar aspas simples nos nomes de tabelas e campos'; -$strUseHostTable = 'Usar Tabela do Servidor'; -$strUserAlreadyExists = 'O usuário %s já existe!'; -$strUserEmpty = 'O nome do usuário está em branco!'; -$strUserName = 'Nome do usuário'; -$strUserNotFound = 'O usuário selecionado não foi encontrado na tabela de privilégios.'; -$strUserOverview = 'Avaliação dos usuários'; -$strUsersDeleted = 'Os usuários selecionados foram apagados com sucesso.'; -$strUsersHavingAccessToDb = 'Usuários que têm acesso à "%s"'; -$strUser = 'Usuário'; -$strUseTabKey = 'Usar a teclar TAB para se mover de valor em valor, ou CTRL+setas para mover em qualquer direção'; -$strUseTables = 'Usar tabelas'; -$strUseTextField = 'Usar campo texto'; -$strUseThisValue = 'Usar este valor'; +$strUsage = 'Uso'; +$strUseBackquotes = 'Usar aspas simples nos nomes de tabelas e campos'; +$strUseHostTable = 'Usar Tabela do Servidor'; +$strUserAlreadyExists = 'O usuário %s já existe!'; +$strUserEmpty = 'O nome do usuário está em branco!'; +$strUserName = 'Nome do usuário'; +$strUserNotFound = 'O usuário selecionado não foi encontrado na tabela de privilégios.'; +$strUserOverview = 'Avaliação dos usuários'; +$strUsersDeleted = 'Os usuários selecionados foram apagados com sucesso.'; +$strUsersHavingAccessToDb = 'Usuários que têm acesso à "%s"'; +$strUser = 'Usuário'; +$strUseTabKey = 'Usar a tecla TAB para se mover de valor em valor, ou CTRL+setas para mover em qualquer direção'; +$strUseTables = 'Usar tabelas'; +$strUseTextField = 'Usar campo texto'; +$strUseThisValue = 'Usar este valor'; -$strValidateSQL = 'Validar SQL'; -$strValidatorError = 'O Validador SQL não pode ser inicializado. Verifique se você instalou a extenção necessária do php conforme está escrito em %sdocumentation%s.'; -$strValue = 'Valor'; -$strVar = 'Variáveis'; +$strValidateSQL = 'Validar SQL'; +$strValidatorError = 'O Validador SQL não pode ser inicializado. Verifique se você instalou a extenção necessária do php conforme está escrito em %sdocumentation%s.'; +$strValue = 'Valor'; +$strVar = 'Variáveis'; $strVersionInformation = 'Informações da versão'; -$strViewDumpDatabases = 'Ver dump (esquema) dos Bancos de Dados'; -$strViewDumpDB = 'Ver o esquema do Banco de Dados'; -$strViewDump = 'Ver o esquema da tabela'; +$strViewDumpDatabases = 'Ver dump (esquema) dos Bancos de Dados'; +$strViewDumpDB = 'Ver o esquema do Banco de Dados'; +$strViewDump = 'Ver o esquema da tabela'; $strViewHasBeenDropped = 'Visão %s foi apagada'; $strViewName = 'Nome da VISÃO'; $strView = 'Visão'; -$strWebServerUploadDirectoryError = 'O diretório que você especificou para subir arquivos não foi encontrado.'; -$strWebServerUploadDirectory = 'Servidor web subiu o diretório'; -$strWelcome = 'Bem vindo ao %s'; -$strWestEuropean = 'Oeste Europeu'; -$strWildcard = 'coringa'; -$strWindowNotFound = 'A janela alvo do navegador não pode ser atualizada. Talvez você tenha fechado a janela alvo ou o seu navegador tenha bloqueado a comunicação entre janelas nas configurações de segurança.'; -$strWithChecked = 'Com marcados:'; +$strWebServerUploadDirectoryError = 'O diretório que você especificou para subir arquivos não foi encontrado.'; +$strWebServerUploadDirectory = 'Servidor web subiu o diretório'; +$strWelcome = 'Bem vindo ao %s'; +$strWestEuropean = 'Oeste Europeu'; +$strWildcard = 'coringa'; +$strWindowNotFound = 'A janela alvo do navegador não pode ser atualizada. Talvez você tenha fechado a janela alvo ou o seu navegador tenha bloqueado a comunicação entre janelas nas configurações de segurança.'; +$strWithChecked = 'Com marcados:'; $strWriteRequests = 'Escrita requisitada'; -$strWrongUser = 'Usuário ou senha incorreta. Acesso negado.'; +$strWrongUser = 'Usuário ou senha incorreta. Acesso negado.'; -$strXML = 'XML'; +$strXML = 'XML'; -$strYes = 'Sim'; +$strYes = 'Sim'; -$strZeroRemovesTheLimit = 'Nota: Ajustar essa opção para 0 (zero) remove os limites.'; -$strZip = '"compactado com zip"'; +$strZeroRemovesTheLimit = 'Nota: Ajustar essa opção para 0 (zero) remove os limites.'; +$strZip = '"compactado com zip"'; -$strProfiling = 'Profiling'; //to translate -$strPartitionDefinition = 'PARTITION definition'; //to translate -$strPrivDescTrigger = 'Allows creating and dropping triggers'; //to translate -$strPrivDescEvent = 'Allows to set up events for the event scheduler'; //to translate -$strPrivDescProcess = 'Allows viewing processes of all users'; //to translate -$strPartitioned = 'partitioned'; //to translate -$strTableAlteredSuccessfully = 'Table %1$s has been altered successfully'; //to translate -$strDatabaseHasBeenCreated = 'Database %1$s has been created.'; //to translate -$strTableHasBeenCreated = 'Table %1$s has been created.'; //to translate -$strForeignKeyError = 'Error creating foreign key on %1$s (check data types)'; //to translate -$strRowsDeleted = '%1$d row(s) deleted.'; //to translate -$strRowsAffected = '%1$d row(s) affected.'; //to translate -$strRowsInserted = '%1$d row(s) inserted.'; //to translate -$strInsertedRowId = 'Inserted row id: %1$d'; //to translate -$strIndexesSeemEqual = 'The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'; //to translate -$strPartitionMaintenance = 'Partition maintenance'; //to translate -$strPartition = 'Partition %s'; //to translate -$strAnalyze = 'Analyze'; //to translate -$strCheck = 'Check'; //to translate -$strOptimize = 'Optimize'; //to translate -$strRebuild = 'Rebuild'; //to translate -$strRepair = 'Repair'; //to translate -$strRemovePartitioning = 'Remove partitioning'; //to translate -$strSearchInField = 'Inside field:'; //to translate -$strTexyText = 'Texy! text'; //to translate -$strDetails = 'Details...'; //to translate -$strComment = 'Comment'; //to translate -$strPacked = 'Packed'; //to translate -$strActions = 'Actions'; //to translate -$strInterface = 'Interface'; //to translate -$strSuhosin = 'Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'; //to translate -$strEvents = 'Events'; //to translate -$strForeignKeyRelationAdded = 'FOREIGN KEY relation added'; //to translate -$strInternalAndForeign = 'An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.'; //to translate -$strViewHasAtLeast = 'This view has at least this number of rows. Please refer to %sdocumentation%s.'; //to translate -$strRelationalKey = 'Relational key'; //to translate -$strRelationalDisplayField = 'Relational display field'; //to translate -$strSwekeyNoKey = 'No valid authentication key plugged'; //to translate -$strSwekeyNoKeyId = 'File %s does not contain any key id'; //to translate -$strSwekeyAuthFailed = 'Hardware authentication failed'; //to translate -$strSwekeyAuthenticating = 'Authenticating...'; //to translate -$strPBXTIndexCacheSize = 'Index cache size'; //to translate -$strPBXTRecordCacheSize = 'Record cache size'; //to translate -$strPBXTLogCacheSize = 'Log cache size'; //to translate -$strPBXTLogFileThreshold = 'Log file threshold'; //to translate -$strPBXTTransactionBufferSize = 'Transaction buffer size'; //to translate -$strPBXTCheckpointFrequency = 'Checkpoint frequency'; //to translate -$strPBXTDataLogThreshold = 'Data log threshold'; //to translate -$strPBXTGarbageThreshold = 'Garbage threshold'; //to translate -$strPBXTLogBufferSize = 'Log buffer size'; //to translate -$strPBXTDataFileGrowSize = 'Data file grow size'; //to translate -$strPBXTRowFileGrowSize = 'Row file grow size'; //to translate -$strPBXTRowFileGrowSizeDesc = 'The grow size of the row pointer (.xtr) files.'; //to translate -$strPBXTDataFileGrowSizeDesc = 'The grow size of the handle data (.xtd) files.'; //to translate -$strPBXTLogBufferSizeDesc = 'The size of the buffer used when writing a data log. The default is 256MB. The engine allocates one buffer per thread, but only if the thread is required to write a data log.'; //to translate -$strPBXTGarbageThresholdDesc = 'The percentage of garbage in a data log file before it is compacted. This is a value between 1 and 99. The default is 50.'; //to translate -$strPBXTDataLogThresholdDesc = 'The maximum size of a data log file. The default value is 64MB. PBXT can create a maximum of 32000 data logs, which are used by all tables. So the value of this variable can be increased to increase the total amount of data that can be stored in the database.'; //to translate -$strPBXTCheckpointFrequencyDesc = 'The amount of data written to the transaction log before a checkpoint is performed. The default value is 24MB.'; //to translate -$strPBXTTransactionBufferSizeDesc = 'The size of the global transaction log buffer (the engine allocates 2 buffers of this size). The default is 1MB.'; //to translate -$strPBXTLogFileThresholdDesc = 'The size of a transaction log before rollover, and a new log is created. The default value is 16MB.'; //to translate -$strPBXTLogCacheSizeDesc = 'The amount of memory allocated to the transaction log cache used to cache on transaction log data. The default is 16MB.'; //to translate -$strPBXTRecordCacheSizeDesc = 'This is the amount of memory allocated to the record cache used to cache table data. The default value is 32MB. This memory is used to cache changes to the handle data (.xtd) and row pointer (.xtr) files.'; //to translate -$strPBXTIndexCacheSizeDesc = 'This is the amount of memory allocated to the index cache. Default value is 32MB. The memory allocated here is used only for caching index pages.'; //to translate -$strPBXTLogFileCount = 'Log file count'; //to translate -$strPBXTLogFileCountDesc = 'This is the number of transaction log files (pbxt/system/xlog*.xt) the system will maintain. If the number of logs exceeds this value then old logs will be deleted, otherwise they are renamed and given the next highest number.'; //to translate +// To translate: +$strAndSmall = 'and'; //to translate $strAsDefined = 'As defined:'; //to translate -$strWiki = 'Wiki'; //to translate -$strWebServer = 'Web server'; //to translate -$strPHPExtension = 'PHP extension'; //to translate -$strCustomColor = 'Custom color'; //to translate + $strBLOBRepository = 'BLOB Repository'; //to translate $strBLOBRepositoryDamaged = 'Damaged'; //to translate $strBLOBRepositoryDisableAreYouSure = 'Are you sure you want to disable all BLOB references for database %s?'; //to translate @@ -1085,382 +1055,506 @@ $strBLOBRepositoryRemove = 'Remove BLOB Repository Reference'; //to translate $strBLOBRepositoryRepair = 'Repair'; //to translate $strBLOBRepositoryStatus = 'Status'; //to translate $strBLOBRepositoryUpload = 'Upload to BLOB repository'; //to translate -$strViewImage = 'View image'; //to translate -$strPlayAudio = 'Play audio'; //to translate -$strViewVideo = 'View video'; //to translate + +$strConfigDirectoryWarning = 'Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'; //to translate +$strCreateUserDatabasePrivileges = 'Grant all privileges on database "%s"'; //to translate +$strCustomColor = 'Custom color'; //to translate + +$strDoNotAutoIncrementZeroValues = 'Do not use AUTO_INCREMENT for zero values'; //to translate $strDownloadFile = 'Download file'; //to translate -$strLogServerHelp = 'You can enter hostname/IP address and port separated by space.'; //to translate -$strShowKeys = 'Only show keys'; //to translate -$strSetupServersAdd = 'Add a new server'; //to translate -$strSetupServersEdit = 'Edit server'; //to translate -$strSetupFormset_features = 'Features'; //to translate -$strSetupFormset_left_frame = 'Customize navigation frame'; //to translate -$strSetupFormset_main_frame = 'Customize main frame'; //to translate -$strSetupFormset_import = 'Customize import defaults'; //to translate -$strSetupFormset_export = 'Customize export options'; //to translate -$strSetupFormset_customization = 'Customization'; //to translate -$strSetupTrue = 'yes'; //to translate -$strSetupFalse = 'no'; //to translate -$strSetupDisplay = 'Display'; //to translate -$strSetupDownload = 'Download'; //to translate -$strSetupClear = 'Clear'; //to translate -$strSetupLoad = 'Load'; //to translate -$strSetupRestoreDefaultValue = 'Restore default value'; //to translate -$strSetupSetValue = 'Set value: %s'; //to translate -$strSetupWarning = 'Warning'; //to translate -$strSetupIgnoreErrors = 'Ignore errors'; //to translate -$strSetupRevertErroneousFields = 'Try to revert erroneous fields to their default values'; //to translate -$strSetupShowForm = 'Show form'; //to translate -$strSetupOverview = 'Overview'; //to translate -$strSetupShowHiddenMessages = 'Show hidden messages (#MSG_COUNT)'; //to translate -$strSetupNoServers = 'There are no configured servers'; //to translate -$strSetupNewServer = 'New server'; //to translate -$strSetupDefaultLanguage = 'Default language'; //to translate -$strSetupDefaultServer = 'Default server'; //to translate -$strSetupLetUserChoose = 'let the user choose'; //to translate -$strSetupOptionNone = '- none -'; //to translate -$strSetupEndOfLine = 'End of line'; //to translate -$strSetupConfigurationFile = 'Configuration file'; //to translate -$strSetupHomepageLink = 'phpMyAdmin homepage'; //to translate -$strSetupDonateLink = 'Donate'; //to translate -$strSetupVersionCheckLink = 'Check for latest version'; //to translate -$strSetupCannotLoadConfig = 'Cannot load or save configuration'; //to translate -$strSetupCannotLoadConfigMsg = 'Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@../Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.'; //to translate -$strSetupInsecureConnection = 'Insecure connection'; //to translate -$strSetupInsecureConnectionMsg2 = 'If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.'; //to translate -$strSetupVersionCheck = 'Version check'; //to translate -$strSetupVersionCheckWrapperError = 'Neither URL wrapper nor CURL is available. Version check is not possible.'; //to translate -$strSetupVersionCheckDataError = 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'; //to translate -$strSetupVersionCheckInvalid = 'Got invalid version string from server'; //to translate -$strSetupVersionCheckUnparsable = 'Unparsable version string'; //to translate -$strSetupVersionCheckNewAvailableSvn = 'You are using subversion version, run [kbd]svn update[/kbd] :-)[br]The latest stable version is %s, released on %s.'; //to translate -$strSetupVersionCheckNone = 'No newer stable version is available'; //to translate -$strSetupServerSecurityInfoMsg = 'If you feel this is necessary, use additional protection settings - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]host authentication[/a] settings and [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate -$strSetupServerSslMsg = 'You should use SSL connections if your web server supports it'; //to translate -$strSetupServerExtensionMsg = 'You should use mysqli for performance reasons'; //to translate -$strSetupBlowfishSecretLengthMsg = 'Key is too short, it should have at least 8 characters'; //to translate -$strSetupForceSSLMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be enabled if your web server supports it'; //to translate -$strSetupAllowArbitraryServerMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate -$strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] should be should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.'; //to translate -$strSetupDirectoryNotice = 'This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.'; //to translate -$strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]GZip compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]Bzip2 compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetuperror_form = 'Submitted form contains errors'; //to translate -$strSetuperror_missing_field_data = 'Missing data for %s'; //to translate -$strSetuperror_incorrect_port = 'Not a valid port number'; //to translate -$strSetuperror_incorrect_value = 'Incorrect value'; //to translate -$strSetuperror_incorrect_ip_address = 'Incorrect IP address: %s'; //to translate -$strSetuperror_nan_p = 'Not a positive number'; //to translate -$strSetuperror_nan_nneg = 'Not a non-negative number'; //to translate -$strSetuperror_empty_pmadb_user = 'Empty phpMyAdmin control user while using pmadb'; //to translate -$strSetuperror_empty_pmadb_password = 'Empty phpMyAdmin control user password while using pmadb'; //to translate -$strSetuperror_empty_user_for_config_auth = 'Empty username while using config authentication method'; //to translate -$strSetuperror_empty_signon_session = 'Empty signon session name while using signon authentication method'; //to translate -$strSetuperror_empty_signon_url = 'Empty signon URL while using signon authentication method'; //to translate -$strSetuperror_connection = 'Could not connect to MySQL server'; //to translate -$strSetupForm_Server = 'Basic settings'; //to translate -$strSetupForm_Server_desc = 'Enter server connection parameters'; //to translate -$strSetupForm_Server_login_options = 'Signon login options'; //to translate -$strSetupForm_Server_login_options_desc = 'Enter login options for signon authentication'; //to translate -$strSetupForm_Server_config = 'Server configuration'; //to translate -$strSetupForm_Server_config_desc = 'Advanced server configuration, do not change these options unless you know what they are for'; //to translate -$strSetupForm_Server_pmadb = 'PMA database'; //to translate -$strSetupForm_Server_pmadb_desc = 'Configure phpMyAdmin database to gain access to additional features, see [a@../Documentation.html#linked-tables]linked-tables infrastructure[/a] in documentation'; //to translate -$strSetupForm_Import_export = 'Import / export'; //to translate -$strSetupForm_Import_export_desc = 'Set import and export directories and compression options'; //to translate -$strSetupForm_Security = 'Security'; //to translate -$strSetupForm_Security_desc = 'Please note that phpMyAdmin is just a user interface and its features do not limit MySQL'; //to translate -$strSetupForm_Sql_queries = 'SQL queries'; //to translate -$strSetupForm_Sql_queries_desc = 'SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings'; //to translate -$strSetupForm_Other_core_settings = 'Other core settings'; //to translate -$strSetupForm_Other_core_settings_desc = 'Settings that didn\'t fit enywhere else'; //to translate -$strSetupForm_Left_frame = 'Navigation frame'; //to translate -$strSetupForm_Left_frame_desc = 'Customize appearance of the navigation frame'; //to translate -$strSetupForm_Left_servers = 'Servers'; //to translate -$strSetupForm_Left_servers_desc = 'Servers display options'; //to translate -$strSetupForm_Left_databases = 'Databases'; //to translate -$strSetupForm_Left_databases_desc = 'Databases display options'; //to translate -$strSetupForm_Left_tables = 'Tables'; //to translate -$strSetupForm_Left_tables_desc = 'Tables display options'; //to translate -$strSetupForm_Main_frame = 'Main frame'; //to translate -$strSetupForm_Startup = 'Startup'; //to translate -$strSetupForm_Startup_desc = 'Customize startup page'; //to translate -$strSetupForm_Browse = 'Browse mode'; //to translate -$strSetupForm_Browse_desc = 'Customize browse mode'; //to translate -$strSetupForm_Edit = 'Edit mode'; //to translate -$strSetupForm_Edit_desc = 'Customize edit mode'; //to translate -$strSetupForm_Tabs = 'Tabs'; //to translate -$strSetupForm_Tabs_desc = 'Choose how you want tabs to work'; //to translate -$strSetupForm_Sql_box = 'SQL Query box'; //to translate -$strSetupForm_Sql_box_desc = 'Customize links shown in SQL Query boxes'; //to translate -$strSetupForm_Import_defaults = 'Import defaults'; //to translate -$strSetupForm_Import_defaults_desc = 'Customize default common import options'; //to translate -$strSetupForm_Export_defaults = 'Export defaults'; //to translate -$strSetupForm_Export_defaults_desc = 'Customize default export options'; //to translate -$strSetupForm_Query_window = 'Query window'; //to translate -$strSetupForm_Query_window_desc = 'Customize query window options'; //to translate -$strSetupServers_verbose_name = 'Verbose name of this server'; //to translate -$strSetupServers_host_name = 'Server hostname'; //to translate -$strSetupServers_port_name = 'Server port'; //to translate -$strSetupServers_port_desc = 'Port on which MySQL server is listening, leave empty for default'; //to translate -$strSetupServers_socket_name = 'Server socket'; //to translate -$strSetupServers_socket_desc = 'Socket on which MySQL server is listening, leave empty for default'; //to translate -$strSetupServers_ssl_name = 'Use SSL'; //to translate -$strSetupServers_ssl_desc = ''; //to translate -$strSetupServers_connect_type_name = 'Connection type'; //to translate -$strSetupServers_connect_type_desc = 'How to connect to server, keep tcp if unsure'; //to translate -$strSetupServers_extension_name = 'PHP extension to use'; //to translate -$strSetupServers_compress_name = 'Compress connection'; //to translate -$strSetupServers_compress_desc = 'Compress connection to MySQL server'; //to translate -$strSetupServers_auth_type_name = 'Authentication type'; //to translate -$strSetupServers_auth_type_desc = 'Authentication method to use'; //to translate -$strSetupServers_user_name = 'User for config auth'; //to translate -$strSetupServers_user_desc = 'Leave empty if not using config auth'; //to translate -$strSetupServers_password_name = 'Password for config auth'; //to translate -$strSetupServers_password_desc = 'Leave empty if not using config auth'; //to translate -$strSetupServers_nopassword_name = 'Connect without password'; //to translate -$strSetupServers_nopassword_desc = 'Try to connect without password'; //to translate -$strSetupServers_SignonSession_name = 'Signon session name'; //to translate -$strSetupServers_SignonSession_desc = 'See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example'; //to translate -$strSetupServers_SignonURL_name = 'Signon URL'; //to translate -$strSetupServers_LogoutURL_name = 'Logout URL'; //to translate -$strSetupServers_auth_swekey_config_name = 'SweKey config file'; //to translate -$strSetupServers_only_db_name = 'Show only listed databases'; //to translate -$strSetupServers_only_db_desc = 'You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\''; //to translate -$strSetupServers_hide_db_name = 'Hide databases'; //to translate -$strSetupServers_hide_db_desc = 'Hide databases matching regular expression (PCRE)'; //to translate -$strSetupServers_AllowRoot_name = 'Allow root login'; //to translate -$strSetupServers_DisableIS_name = 'Disable use of INFORMATION_SCHEMA'; //to translate -$strSetupServers_DisableIS_desc = 'More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]'; //to translate -$strSetupServers_AllowDeny_order_name = 'Host authentication order'; //to translate -$strSetupServers_AllowDeny_order_desc = 'Leave blank if not used'; //to translate -$strSetupServers_AllowDeny_rules_name = 'Host authentication rules'; //to translate -$strSetupServers_AllowDeny_rules_desc = 'Leave blank for defaults'; //to translate -$strSetupServers_ShowDatabasesCommand_name = 'SHOW DATABASES command'; //to translate -$strSetupServers_ShowDatabasesCommand_desc = 'SQL command to fetch available databases'; //to translate -$strSetupServers_CountTables_name = 'Count tables'; //to translate -$strSetupServers_CountTables_desc = 'Count tables when showing database list'; //to translate -$strSetupServers_pmadb_name = 'PMA database'; //to translate -$strSetupServers_pmadb_desc = 'Database used for relations, bookmarks, and PDF features. See [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Suggested: [kbd]phpmyadmin[/kbd]'; //to translate -$strSetupServers_controluser_name = 'Control user'; //to translate -$strSetupServers_controluser_desc = 'A special MySQL user configured with limited permissions, more information available on [a@http://wiki.phpmyadmin.net/pma/controluser]wiki[/a]'; //to translate -$strSetupServers_controlpass_name = 'Control user password'; //to translate -$strSetupServers_verbose_check_name = 'Verbose check'; //to translate -$strSetupServers_verbose_check_desc = 'Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance'; //to translate -$strSetupServers_bookmarktable_name = 'Bookmark table'; //to translate -$strSetupServers_bookmarktable_desc = 'Leave blank for no [a@http://wiki.phpmyadmin.net/pma/bookmark]bookmark[/a] support, suggested: [kbd]pma_bookmark[/kbd]'; //to translate -$strSetupServers_relation_name = 'Relation table'; //to translate -$strSetupServers_relation_desc = 'Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma_relation[/kbd]'; //to translate -$strSetupServers_table_info_name = 'Display fields table'; //to translate -$strSetupServers_table_info_desc = 'Table to describe the display fields, leave blank for no support; suggested: [kbd]pma_table_info[/kbd]'; //to translate -$strSetupServers_table_coords_name = 'PDF schema: table coordinates'; //to translate -$strSetupServers_table_coords_desc = 'Leave blank for no PDF schema support, suggested: [kbd]pma_table_coords[/kbd]'; //to translate -$strSetupServers_pdf_pages_name = 'PDF schema: pages table'; //to translate -$strSetupServers_pdf_pages_desc = 'Leave blank for no PDF schema support, suggested: [kbd]pma_pdf_pages[/kbd]'; //to translate -$strSetupServers_column_info_name = 'Column information table'; //to translate -$strSetupServers_column_info_desc = 'Leave blank for no column comments/mime types, suggested: [kbd]pma_column_info[/kbd]'; //to translate -$strSetupServers_history_name = 'SQL query history table'; //to translate -$strSetupServers_history_desc = 'Leave blank for no SQL query history support, suggested: [kbd]pma_history[/kbd]'; //to translate -$strSetupServers_designer_coords_name = 'Designer table'; //to translate -$strSetupServers_designer_coords_desc = 'Leave blank for no Designer support, suggested: [kbd]pma_designer_coords[/kbd]'; //to translate -$strSetupUploadDir_name = 'Upload directory'; //to translate -$strSetupUploadDir_desc = 'Directory on server where you can upload files for import'; //to translate -$strSetupSaveDir_name = 'Save directory'; //to translate -$strSetupSaveDir_desc = 'Directory where exports can be saved on server'; //to translate -$strSetupAllowAnywhereRecoding_name = 'Allow character set conversion'; //to translate -$strSetupDefaultCharset_name = 'Default character set'; //to translate -$strSetupDefaultCharset_desc = 'Default character set used for conversions'; //to translate -$strSetupRecodingEngine_name = 'Recoding engine'; //to translate -$strSetupRecodingEngine_desc = 'Select which functions will be used for character set conversion'; //to translate -$strSetupIconvExtraParams_name = 'Extra parameters for iconv'; //to translate -$strSetupZipDump_name = 'ZIP'; //to translate -$strSetupZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations'; //to translate -$strSetupGZipDump_name = 'GZip'; //to translate -$strSetupGZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] compression for import and export operations'; //to translate -$strSetupBZipDump_name = 'Bzip2'; //to translate -$strSetupBZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for import and export operations'; //to translate -$strSetupCompressOnFly_name = 'Compress on the fly'; //to translate -$strSetupCompressOnFly_desc = 'Compress gzip/bzip2 exports on the fly without the need for much memory; if you encounter problems with created gzip/bzip2 files disable this feature'; //to translate -$strSetupblowfish_secret_name = 'Blowfish secret'; //to translate -$strSetupblowfish_secret_desc = 'Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] authentication'; //to translate -$strSetupForceSSL_name = 'Force SSL connection'; //to translate -$strSetupForceSSL_desc = 'Force secured connection while using phpMyAdmin'; //to translate -$strSetupCheckConfigurationPermissions_name = 'Check config file permissions'; //to translate -$strSetupTrustedProxies_name = 'List of trusted proxies for IP allow/deny'; //to translate -$strSetupTrustedProxies_desc = 'Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]'; //to translate -$strSetupAllowUserDropDatabase_name = 'Show "Drop database" link to normal users'; //to translate -$strSetupAllowArbitraryServer_name = 'Allow login to any MySQL server'; //to translate -$strSetupAllowArbitraryServer_desc = 'If enabled user can enter any MySQL server in login form for cookie auth'; //to translate -$strSetupLoginCookieRecall_name = 'Recall user name'; //to translate -$strSetupLoginCookieRecall_desc = 'Define whether the previous login should be recalled or not in cookie authentication mode'; //to translate -$strSetupLoginCookieValidity_name = 'Login cookie validity'; //to translate -$strSetupLoginCookieValidity_desc = 'Define how long (in seconds) a login cookie is valid'; //to translate -$strSetupLoginCookieStore_name = 'Login cookie store'; //to translate -$strSetupLoginCookieDeleteAll_name = 'Delete all cookies on logout'; //to translate -$strSetupShowSQL_name = 'Show SQL queries'; //to translate -$strSetupShowSQL_desc = 'Defines whether SQL queries generated by phpMyAdmin should be displayed'; //to translate -$strSetupConfirm_name = 'Confirm DROP queries'; //to translate -$strSetupConfirm_desc = 'Whether a warning ("Are your really sure...") should be displayed when you\'re about to lose data'; //to translate -$strSetupQueryHistoryDB_name = 'Permanent query history'; //to translate -$strSetupQueryHistoryDB_desc = 'Enable if you want DB-based query history (requires pmadb). If disabled, this utilizes JS-routines to display query history (lost by window close).'; //to translate -$strSetupQueryHistoryMax_name = 'Query history length'; //to translate -$strSetupQueryHistoryMax_desc = 'How many queries are kept in history'; //to translate -$strSetupIgnoreMultiSubmitErrors_name = 'Ignore multiple statement errors'; //to translate -$strSetupVerboseMultiSubmit_name = 'Verbose multiple statements'; //to translate -$strSetupVerboseMultiSubmit_desc = 'Show affected rows of each statement on multiple-statement queries. See libraries/import.lib.php for defaults on how many queries a statement may contain.'; //to translate -$strSetupMaxDbList_name = 'Maximum databases'; //to translate -$strSetupMaxDbList_desc = 'Maximum number of databases displayed in left frame and database list'; //to translate -$strSetupMaxTableList_name = 'Maximum tables'; //to translate -$strSetupMaxTableList_desc = 'Maximum number of tables displayed in table list'; //to translate -$strSetupMaxCharactersInDisplayedSQL_name = 'Maximum displayed SQL length'; //to translate -$strSetupMaxCharactersInDisplayedSQL_desc = 'Maximum number of characters used when a SQL query is displayed'; //to translate -$strSetupOBGzip_name = 'GZip output buffering'; //to translate -$strSetupOBGzip_desc = 'use GZip output buffering for increased speed in HTTP transfers'; //to translate -$strSetupPersistentConnections_name = 'Persistent connections'; //to translate -$strSetupPersistentConnections_desc = 'Use persistent connections to MySQL databases'; //to translate -$strSetupExecTimeLimit_name = 'Maximum execution time'; //to translate -$strSetupExecTimeLimit_desc = 'Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no limit)'; //to translate -$strSetupMemoryLimit_name = 'Memory limit'; //to translate -$strSetupMemoryLimit_desc = 'The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)'; //to translate -$strSetupSkipLockedTables_name = 'Skip locked tables'; //to translate -$strSetupSkipLockedTables_desc = 'Mark used tables and make it possible to show databases with locked tables'; //to translate -$strSetupUseDbSearch_name = 'Use database search'; //to translate -$strSetupUseDbSearch_desc = 'Allow for searching inside the entire database'; //to translate -$strSetupLeftFrameLight_name = 'Use light version'; //to translate -$strSetupLeftFrameLight_desc = 'Disable this if you want to see all databases at once'; //to translate -$strSetupLeftDisplayLogo_name = 'Display logo'; //to translate -$strSetupLeftDisplayLogo_desc = 'Show logo in left frame'; //to translate -$strSetupLeftLogoLink_name = 'Logo link URL'; //to translate -$strSetupLeftLogoLinkWindow_name = 'Logo link target'; //to translate -$strSetupLeftLogoLinkWindow_desc = 'Open the linked page in the main window ([kbd]main[/kbd]) or in a new one ([kbd]new[/kbd])'; //to translate -$strSetupLeftDefaultTabTable_name = 'Target for quick access icon'; //to translate -$strSetupLeftPointerEnable_name = 'Enable highlighting'; //to translate -$strSetupLeftPointerEnable_desc = 'Highlight server under the mouse cursor'; //to translate -$strSetupLeftDisplayServers_name = 'Display servers selection'; //to translate -$strSetupLeftDisplayServers_desc = 'Display server choice at the top of the left frame'; //to translate -$strSetupDisplayServersList_name = 'Display servers as a list'; //to translate -$strSetupDisplayServersList_desc = 'Show server listing as a list instead of a drop down'; //to translate -$strSetupDisplayDatabasesList_name = 'Display databases as a list'; //to translate -$strSetupDisplayDatabasesList_desc = 'Show database listing as a list instead of a drop down'; //to translate -$strSetupLeftFrameDBTree_name = 'Display databases in a tree'; //to translate -$strSetupLeftFrameDBTree_desc = 'Only light version; display databases in a tree (determined by the separator defined below)'; //to translate -$strSetupLeftFrameDBSeparator_name = 'Database tree separator'; //to translate -$strSetupLeftFrameDBSeparator_desc = 'String that separates databases into different tree levels'; //to translate -$strSetupShowTooltipAliasDB_name = 'Display database comment instead of its name'; //to translate -$strSetupShowTooltipAliasDB_desc = 'If tooltips are enabled and a database comment is set, this will flip the comment and the real name'; //to translate -$strSetupLeftFrameTableSeparator_name = 'Table tree separator'; //to translate -$strSetupLeftFrameTableSeparator_desc = 'String that separates tables into different tree levels'; //to translate -$strSetupLeftFrameTableLevel_name = 'Maximum table tree depth'; //to translate -$strSetupShowTooltip_name = 'Display table comments in tooltips'; //to translate -$strSetupShowTooltipAliasTB_name = 'Display table comment instead of its name'; //to translate -$strSetupShowTooltipAliasTB_desc = 'When setting this to [kbd]nested[/kbd], the alias of the table name is only used to split/nest the tables according to the $cfg[\'LeftFrameTableSeparator\'] directive, so only the folder is called like the alias, the table name itself stays unchanged'; //to translate -$strSetupShowStats_name = 'Show statistics'; //to translate -$strSetupShowStats_desc = 'Allow to display database and table statistics (eg. space usage)'; //to translate -$strSetupShowPhpInfo_name = 'Show phpinfo() link'; //to translate -$strSetupShowPhpInfo_desc = 'Shows link to [a@http://php.net/manual/function.phpinfo.php]phpinfo()[/a] output'; //to translate -$strSetupShowServerInfo_name = 'Show detailed MySQL server information'; //to translate -$strSetupShowChgPassword_name = 'Show password change form'; //to translate -$strSetupShowChgPassword_desc = 'Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly'; //to translate -$strSetupShowCreateDb_name = 'Show create database form'; //to translate -$strSetupSuggestDBName_name = 'Suggest new database name'; //to translate -$strSetupSuggestDBName_desc = 'Suggest a database name on the "Create Database" form (if possible) or keep the text field empty'; //to translate -$strSetupNavigationBarIconic_name = 'Iconic navigation bar'; //to translate -$strSetupNavigationBarIconic_desc = 'Use only icons, only text or both'; //to translate -$strSetupShowAll_name = 'Allow to display all the rows'; //to translate -$strSetupShowAll_desc = 'Whether a user should be displayed a "show all (records)" button'; //to translate -$strSetupMaxRows_name = 'Maximum number of rows to display'; //to translate -$strSetupMaxRows_desc = 'Number of rows displayed when browsing a result set. If the result set contains more rows, "Previous" and "Next" links will be shown.'; //to translate -$strSetupOrder_name = 'Default sorting order'; //to translate -$strSetupOrder_desc = '[kbd]SMART[/kbd] - i.e. descending order for fields of type TIME, DATE, DATETIME and TIMESTAMP, ascending order otherwise'; //to translate -$strSetupBrowsePointerEnable_name = 'Highlight pointer'; //to translate -$strSetupBrowsePointerEnable_desc = 'Highlight row pointed by the mouse cursor'; //to translate -$strSetupBrowseMarkerEnable_name = 'Row marker'; //to translate -$strSetupBrowseMarkerEnable_desc = 'Highlight selected rows'; //to translate -$strSetupProtectBinary_name = 'Protect binary fields'; //to translate -$strSetupProtectBinary_desc = 'Disallow BLOB and BINARY fields from editing'; //to translate -$strSetupShowFunctionFields_name = 'Show function fields'; //to translate -$strSetupShowFunctionFields_desc = 'Display the function fields in edit/insert mode'; //to translate -$strSetupCharEditing_name = 'CHAR fields editing'; //to translate -$strSetupCharEditing_desc = 'Defines which type of editing controls should be used for CHAR and VARCHAR fields; [kbd]input[/kbd] - allows limiting of input length, [kbd]textarea[/kbd] - allows newlines in fields'; //to translate -$strSetupCharTextareaCols_name = 'CHAR textarea columns'; //to translate -$strSetupCharTextareaCols_desc = 'Number of columns for CHAR/VARCHAR textareas'; //to translate -$strSetupCharTextareaRows_name = 'CHAR textarea rows'; //to translate -$strSetupCharTextareaRows_desc = 'Number of rows for CHAR/VARCHAR textareas'; //to translate -$strSetupInsertRows_name = 'Number of inserted rows'; //to translate -$strSetupInsertRows_desc = 'How many rows can be inserted at one time'; //to translate -$strSetupForeignKeyDropdownOrder_name = 'Foreign key dropdown order'; //to translate -$strSetupForeignKeyDropdownOrder_desc = 'Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value'; //to translate -$strSetupForeignKeyMaxLimit_name = 'Foreign key limit'; //to translate -$strSetupForeignKeyMaxLimit_desc = 'A dropdown will be used if fewer items are present'; //to translate -$strSetupLightTabs_name = 'Light tabs'; //to translate -$strSetupLightTabs_desc = 'Use less graphically intense tabs'; //to translate -$strSetupPropertiesIconic_name = 'Iconic table operations'; //to translate -$strSetupPropertiesIconic_desc = 'Use only icons, only text or both'; //to translate -$strSetupDefaultTabServer_name = 'Default server tab'; //to translate -$strSetupDefaultTabServer_desc = 'Tab that is displayed when entering a server'; //to translate -$strSetupDefaultTabDatabase_name = 'Default database tab'; //to translate -$strSetupDefaultTabDatabase_desc = 'Tab that is displayed when entering a database'; //to translate -$strSetupDefaultTabTable_name = 'Default table tab'; //to translate -$strSetupDefaultTabTable_desc = 'Tab that is displayed when entering a table'; //to translate -$strSetupQueryWindowDefTab_name = 'Default query window tab'; //to translate -$strSetupQueryWindowDefTab_desc = 'Tab displayed when opening a new query window'; //to translate -$strSetupSQLQuery_Edit_name = 'Edit'; //to translate -$strSetupSQLQuery_Explain_name = 'Explain SQL'; //to translate -$strSetupSQLQuery_ShowAsPHP_name = 'Create PHP Code'; //to translate -$strSetupSQLQuery_Validate_name = 'Validate SQL'; //to translate -$strSetupSQLQuery_Refresh_name = 'Refresh'; //to translate -$strSetupImport_format_name = 'Format of imported file'; //to translate -$strSetupImport_allow_interrupt_name = 'Partial import: allow interrupt'; //to translate -$strSetupImport_allow_interrupt_desc = 'Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.'; //to translate -$strSetupImport_skip_queries_name = 'Partial import: skip queries'; //to translate -$strSetupImport_skip_queries_desc = 'Number of records (queries) to skip from start'; //to translate -$strSetupExport_format_name = 'Format'; //to translate -$strSetupExport_compression_name = 'Compression'; //to translate -$strSetupExport_asfile_name = 'Save as file'; //to translate -$strSetupExport_charset_name = 'Character set of the file'; //to translate -$strSetupExport_onserver_name = 'Save on server'; //to translate -$strSetupExport_onserver_overwrite_name = 'Overwrite existing file(s)'; //to translate -$strSetupExport_remember_file_template_name = 'Remember file name template'; //to translate -$strSetupExport_file_template_table_name = 'Table name template'; //to translate -$strSetupExport_file_template_database_name = 'Database name template'; //to translate -$strSetupExport_file_template_server_name = 'Server name template'; //to translate -$strSetupBlowfishSecretCharsMsg = 'Key should contain letters, numbers [em]and[/em] special characters'; //to translate -$strSetupBlowfishSecretMsg = 'You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.'; //to translate -$strSetupIgnoreMultiSubmitErrors_desc = 'If enabled, phpMyAdmin continues computing multiple-statement queries even if one of the queries failed'; //to translate -$strSetupImport_format_desc = 'Default format; be aware that this list depends on location (database, table) and only SQL is always available'; //to translate -$strSetupInsecureConnectionMsg1 = 'You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!'; //to translate -$strSetupLoginCookieDeleteAll_desc = 'If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.'; //to translate -$strSetupLoginCookieStore_desc = 'Define how long (in seconds) a login cookie should be stored in browser. The default of 0 means that it will be kept for the existing session only, and will be deleted as soon as you close the browser window. This is recommended for non-trusted environments.'; //to translate -$strSetupServerAuthConfigMsg = 'You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set [a@?page=servers&mode=edit&id=%1$d#tab_Server]authentication type[/a] to [kbd]cookie[/kbd] or [kbd]http[/kbd].'; //to translate -$strSetupServers_extension_desc = 'What PHP extension to use; you should use mysqli if supported'; //to translate -$strSetupVersionCheckNewAvailable = 'A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'; //to translate -$strSetupServers_auth_swekey_config_desc = 'The path for the config file for [a@http://swekey.com]SweKey hardware authentication[/a] (not located in your document root; suggested: /etc/swekey.conf)'; //to translate -$strSessionGCWarning = 'Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@]session.gc_maxlifetime[/a] is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'; //to translate -$strSetupServers_host_desc = 'Hostname where MySQL server is running'; //to translate -$strSetupServers_verbose_desc = 'A user-friendly description of this server. Leave blank to display the hostname instead.'; //to translate -$strCreateUserDatabasePrivileges = 'Grant all privileges on database "%s"'; //to translate -$strShowBinaryContents = 'Show binary contents'; //to translate -$strShowBLOBContents = 'Show BLOB contents'; //to translate -$strStatic = 'static'; //to translate -$strLoginWithoutPassword = 'Login without a password is forbidden by configuration (see AllowNoPassword)'; //to translate -$strSetupServerNoPasswordMsg = 'You allow for connecting to the server without a password.'; //to translate -$strSetupServers_AllowNoPassword_name = 'Allow logins without a password'; //to translate -$strHostTableExplanation = 'When Host table is used, this field is ignored and values stored in Host table are used instead.'; //to translate + +$strForeignKeyRelationAdded = 'FOREIGN KEY relation added'; //to translate + $strGetMoreThemes = 'Get more themes!'; //to translate -$strNoneDefault = 'None'; //to translate -$strConfigDirectoryWarning = 'Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'; //to translate -$strRemoveCRLF = 'Remove CRLF characters within fields'; //to translate -$strDoNotAutoIncrementZeroValues = 'Do not use AUTO_INCREMENT for zero values'; //to translate -$strAndSmall = 'and'; //to translate -$strReplicationStatus = 'Replication status'; //to translate -$strReplicationStatusInfo = 'This MySQL server works as %s in replication process. For further information about replication status on the server, please visit the replication section.'; //to translate -$strReplicationStatus_master = 'Master status'; //to translate -$strReplicationStatus_slave = 'Slave status'; //to translate -$strNavTableFilter = 'Filter'; //to translate -$strPhpArray = 'PHP array'; //to translate + +$strHostTableExplanation = 'When Host table is used, this field is ignored and values stored in Host table are used instead.'; //to translate + $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strInternalAndForeign = 'An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.'; //to translate + +$strLoginWithoutPassword = 'Login without a password is forbidden by configuration (see AllowNoPassword)'; //to translate +$strLogServerHelp = 'You can enter hostname/IP address and port separated by space.'; //to translate + +$strNavTableFilter = 'Filter'; //to translate +$strNoneDefault = 'None'; //to translate + +$strPBXTCheckpointFrequency = 'Checkpoint frequency'; //to translate +$strPBXTCheckpointFrequencyDesc = 'The amount of data written to the transaction log before a checkpoint is performed. The default value is 24MB.'; //to translate +$strPBXTDataFileGrowSize = 'Data file grow size'; //to translate +$strPBXTDataFileGrowSizeDesc = 'The grow size of the handle data (.xtd) files.'; //to translate +$strPBXTDataLogThreshold = 'Data log threshold'; //to translate +$strPBXTDataLogThresholdDesc = 'The maximum size of a data log file. The default value is 64MB. PBXT can create a maximum of 32000 data logs, which are used by all tables. So the value of this variable can be increased to increase the total amount of data that can be stored in the database.'; //to translate +$strPBXTGarbageThresholdDesc = 'The percentage of garbage in a data log file before it is compacted. This is a value between 1 and 99. The default is 50.'; //to translate +$strPBXTGarbageThreshold = 'Garbage threshold'; //to translate +$strPBXTIndexCacheSizeDesc = 'This is the amount of memory allocated to the index cache. Default value is 32MB. The memory allocated here is used only for caching index pages.'; //to translate +$strPBXTIndexCacheSize = 'Index cache size'; //to translate +$strPBXTLogBufferSizeDesc = 'The size of the buffer used when writing a data log. The default is 256MB. The engine allocates one buffer per thread, but only if the thread is required to write a data log.'; //to translate +$strPBXTLogBufferSize = 'Log buffer size'; //to translate +$strPBXTLogCacheSizeDesc = 'The amount of memory allocated to the transaction log cache used to cache on transaction log data. The default is 16MB.'; //to translate +$strPBXTLogCacheSize = 'Log cache size'; //to translate +$strPBXTLogFileCountDesc = 'This is the number of transaction log files (pbxt/system/xlog*.xt) the system will maintain. If the number of logs exceeds this value then old logs will be deleted, otherwise they are renamed and given the next highest number.'; //to translate +$strPBXTLogFileCount = 'Log file count'; //to translate +$strPBXTLogFileThresholdDesc = 'The size of a transaction log before rollover, and a new log is created. The default value is 16MB.'; //to translate +$strPBXTLogFileThreshold = 'Log file threshold'; //to translate +$strPBXTRecordCacheSizeDesc = 'This is the amount of memory allocated to the record cache used to cache table data. The default value is 32MB. This memory is used to cache changes to the handle data (.xtd) and row pointer (.xtr) files.'; //to translate +$strPBXTRecordCacheSize = 'Record cache size'; //to translate +$strPBXTRowFileGrowSizeDesc = 'The grow size of the row pointer (.xtr) files.'; //to translate +$strPBXTRowFileGrowSize = 'Row file grow size'; //to translate +$strPBXTTransactionBufferSizeDesc = 'The size of the global transaction log buffer (the engine allocates 2 buffers of this size). The default is 1MB.'; //to translate +$strPBXTTransactionBufferSize = 'Transaction buffer size'; //to translate +$strPhpArray = 'PHP array'; //to translate +$strPHPExtension = 'PHP extension'; //to translate +$strPlayAudio = 'Play audio'; //to translate + +$strRelationalDisplayField = 'Relational display field'; //to translate +$strRemoveCRLF = 'Remove CRLF characters within fields'; //to translate +$strReplicationStatusInfo = 'This MySQL server works as %s in replication process. For further information about replication status on the server, please visit the replication section.'; //to translate +$strReplicationStatus_master = 'Master status'; //to translate +$strReplicationStatus = 'Replication status'; //to translate +$strReplicationStatus_slave = 'Slave status'; //to translate + +$strSessionGCWarning = 'Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@]session.gc_maxlifetime[/a] is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'; //to translate +$strSetupAllowAnywhereRecoding_name = 'Allow character set conversion'; //to translate +$strSetupAllowArbitraryServer_desc = 'If enabled user can enter any MySQL server in login form for cookie auth'; //to translate +$strSetupAllowArbitraryServerMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate +$strSetupAllowArbitraryServer_name = 'Allow login to any MySQL server'; //to translate +$strSetupAllowUserDropDatabase_name = 'Show "Drop database" link to normal users'; //to translate +$strSetupBlowfishSecretCharsMsg = 'Key should contain letters, numbers [em]and[/em] special characters'; //to translate +$strSetupblowfish_secret_desc = 'Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] authentication'; //to translate +$strSetupBlowfishSecretLengthMsg = 'Key is too short, it should have at least 8 characters'; //to translate +$strSetupBlowfishSecretMsg = 'You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.'; //to translate +$strSetupblowfish_secret_name = 'Blowfish secret'; //to translate +$strSetupBrowseMarkerEnable_desc = 'Highlight selected rows'; //to translate +$strSetupBrowseMarkerEnable_name = 'Row marker'; //to translate +$strSetupBrowsePointerEnable_desc = 'Highlight row pointed by the mouse cursor'; //to translate +$strSetupBrowsePointerEnable_name = 'Highlight pointer'; //to translate +$strSetupBZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for import and export operations'; //to translate +$strSetupBZipDump_name = 'Bzip2'; //to translate +$strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]Bzip2 compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate +$strSetupCannotLoadConfig = 'Cannot load or save configuration'; //to translate +$strSetupCannotLoadConfigMsg = 'Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@../Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.'; //to translate +$strSetupCharEditing_desc = 'Defines which type of editing controls should be used for CHAR and VARCHAR fields; [kbd]input[/kbd] - allows limiting of input length, [kbd]textarea[/kbd] - allows newlines in fields'; //to translate +$strSetupCharEditing_name = 'CHAR fields editing'; //to translate +$strSetupCharTextareaCols_desc = 'Number of columns for CHAR/VARCHAR textareas'; //to translate +$strSetupCharTextareaCols_name = 'CHAR textarea columns'; //to translate +$strSetupCharTextareaRows_desc = 'Number of rows for CHAR/VARCHAR textareas'; //to translate +$strSetupCharTextareaRows_name = 'CHAR textarea rows'; //to translate +$strSetupCheckConfigurationPermissions_name = 'Check config file permissions'; //to translate +$strSetupClear = 'Clear'; //to translate +$strSetupCompressOnFly_desc = 'Compress gzip/bzip2 exports on the fly without the need for much memory; if you encounter problems with created gzip/bzip2 files disable this feature'; //to translate +$strSetupCompressOnFly_name = 'Compress on the fly'; //to translate +$strSetupConfigurationFile = 'Configuration file'; //to translate +$strSetupConfirm_desc = 'Whether a warning ("Are your really sure...") should be displayed when you\'re about to lose data'; //to translate +$strSetupConfirm_name = 'Confirm DROP queries'; //to translate +$strSetupDefaultCharset_desc = 'Default character set used for conversions'; //to translate +$strSetupDefaultCharset_name = 'Default character set'; //to translate +$strSetupDefaultLanguage = 'Default language'; //to translate +$strSetupDefaultServer = 'Default server'; //to translate +$strSetupDefaultTabDatabase_desc = 'Tab that is displayed when entering a database'; //to translate +$strSetupDefaultTabDatabase_name = 'Default database tab'; //to translate +$strSetupDefaultTabServer_desc = 'Tab that is displayed when entering a server'; //to translate +$strSetupDefaultTabServer_name = 'Default server tab'; //to translate +$strSetupDefaultTabTable_desc = 'Tab that is displayed when entering a table'; //to translate +$strSetupDefaultTabTable_name = 'Default table tab'; //to translate +$strSetupDirectoryNotice = 'This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.'; //to translate +$strSetupDisplayDatabasesList_desc = 'Show database listing as a list instead of a drop down'; //to translate +$strSetupDisplayDatabasesList_name = 'Display databases as a list'; //to translate +$strSetupDisplay = 'Display'; //to translate +$strSetupDisplayServersList_desc = 'Show server listing as a list instead of a drop down'; //to translate +$strSetupDisplayServersList_name = 'Display servers as a list'; //to translate +$strSetupDonateLink = 'Donate'; //to translate +$strSetupDownload = 'Download'; //to translate +$strSetupEndOfLine = 'End of line'; //to translate +$strSetuperror_connection = 'Could not connect to MySQL server'; //to translate +$strSetuperror_empty_pmadb_password = 'Empty phpMyAdmin control user password while using pmadb'; //to translate +$strSetuperror_empty_pmadb_user = 'Empty phpMyAdmin control user while using pmadb'; //to translate +$strSetuperror_empty_signon_session = 'Empty signon session name while using signon authentication method'; //to translate +$strSetuperror_empty_signon_url = 'Empty signon URL while using signon authentication method'; //to translate +$strSetuperror_empty_user_for_config_auth = 'Empty username while using config authentication method'; //to translate +$strSetuperror_form = 'Submitted form contains errors'; //to translate +$strSetuperror_incorrect_ip_address = 'Incorrect IP address: %s'; //to translate +$strSetuperror_incorrect_port = 'Not a valid port number'; //to translate +$strSetuperror_incorrect_value = 'Incorrect value'; //to translate +$strSetuperror_missing_field_data = 'Missing data for %s'; //to translate +$strSetuperror_nan_nneg = 'Not a non-negative number'; //to translate +$strSetuperror_nan_p = 'Not a positive number'; //to translate +$strSetupExecTimeLimit_desc = 'Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no limit)'; //to translate +$strSetupExecTimeLimit_name = 'Maximum execution time'; //to translate +$strSetupExport_asfile_name = 'Save as file'; //to translate +$strSetupExport_charset_name = 'Character set of the file'; //to translate +$strSetupExport_compression_name = 'Compression'; //to translate +$strSetupExport_file_template_database_name = 'Database name template'; //to translate +$strSetupExport_file_template_server_name = 'Server name template'; //to translate +$strSetupExport_file_template_table_name = 'Table name template'; //to translate +$strSetupExport_format_name = 'Format'; //to translate +$strSetupExport_onserver_name = 'Save on server'; //to translate +$strSetupExport_onserver_overwrite_name = 'Overwrite existing file(s)'; //to translate +$strSetupExport_remember_file_template_name = 'Remember file name template'; //to translate +$strSetupFalse = 'no'; //to translate +$strSetupForceSSL_desc = 'Force secured connection while using phpMyAdmin'; //to translate +$strSetupForceSSLMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be enabled if your web server supports it'; //to translate +$strSetupForceSSL_name = 'Force SSL connection'; //to translate +$strSetupForeignKeyDropdownOrder_desc = 'Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value'; //to translate +$strSetupForeignKeyDropdownOrder_name = 'Foreign key dropdown order'; //to translate +$strSetupForeignKeyMaxLimit_desc = 'A dropdown will be used if fewer items are present'; //to translate +$strSetupForeignKeyMaxLimit_name = 'Foreign key limit'; //to translate +$strSetupForm_Browse = 'Browse mode'; //to translate +$strSetupForm_Browse_desc = 'Customize browse mode'; //to translate +$strSetupForm_Edit_desc = 'Customize edit mode'; //to translate +$strSetupForm_Edit = 'Edit mode'; //to translate +$strSetupForm_Export_defaults_desc = 'Customize default export options'; //to translate +$strSetupForm_Export_defaults = 'Export defaults'; //to translate +$strSetupForm_Import_defaults_desc = 'Customize default common import options'; //to translate +$strSetupForm_Import_defaults = 'Import defaults'; //to translate +$strSetupForm_Import_export_desc = 'Set import and export directories and compression options'; //to translate +$strSetupForm_Import_export = 'Import / export'; //to translate +$strSetupForm_Left_databases = 'Databases'; //to translate +$strSetupForm_Left_databases_desc = 'Databases display options'; //to translate +$strSetupForm_Left_frame_desc = 'Customize appearance of the navigation frame'; //to translate +$strSetupForm_Left_frame = 'Navigation frame'; //to translate +$strSetupForm_Left_servers_desc = 'Servers display options'; //to translate +$strSetupForm_Left_servers = 'Servers'; //to translate +$strSetupForm_Left_tables_desc = 'Tables display options'; //to translate +$strSetupForm_Left_tables = 'Tables'; //to translate +$strSetupForm_Main_frame = 'Main frame'; //to translate +$strSetupForm_Other_core_settings_desc = 'Settings that didn\'t fit enywhere else'; //to translate +$strSetupForm_Other_core_settings = 'Other core settings'; //to translate +$strSetupForm_Query_window_desc = 'Customize query window options'; //to translate +$strSetupForm_Query_window = 'Query window'; //to translate +$strSetupForm_Security_desc = 'Please note that phpMyAdmin is just a user interface and its features do not limit MySQL'; //to translate +$strSetupForm_Security = 'Security'; //to translate +$strSetupForm_Server = 'Basic settings'; //to translate +$strSetupForm_Server_config_desc = 'Advanced server configuration, do not change these options unless you know what they are for'; //to translate +$strSetupForm_Server_config = 'Server configuration'; //to translate +$strSetupForm_Server_desc = 'Enter server connection parameters'; //to translate +$strSetupForm_Server_login_options_desc = 'Enter login options for signon authentication'; //to translate +$strSetupForm_Server_login_options = 'Signon login options'; //to translate +$strSetupForm_Server_pmadb_desc = 'Configure phpMyAdmin database to gain access to additional features, see [a@../Documentation.html#linked-tables]linked-tables infrastructure[/a] in documentation'; //to translate +$strSetupForm_Server_pmadb = 'PMA database'; //to translate +$strSetupFormset_customization = 'Customization'; //to translate +$strSetupFormset_export = 'Customize export options'; //to translate +$strSetupFormset_features = 'Features'; //to translate +$strSetupFormset_import = 'Customize import defaults'; //to translate +$strSetupFormset_left_frame = 'Customize navigation frame'; //to translate +$strSetupFormset_main_frame = 'Customize main frame'; //to translate +$strSetupForm_Sql_box_desc = 'Customize links shown in SQL Query boxes'; //to translate +$strSetupForm_Sql_box = 'SQL Query box'; //to translate +$strSetupForm_Sql_queries_desc = 'SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings'; //to translate +$strSetupForm_Sql_queries = 'SQL queries'; //to translate +$strSetupForm_Startup_desc = 'Customize startup page'; //to translate +$strSetupForm_Startup = 'Startup'; //to translate +$strSetupForm_Tabs_desc = 'Choose how you want tabs to work'; //to translate +$strSetupForm_Tabs = 'Tabs'; //to translate +$strSetupGZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] compression for import and export operations'; //to translate +$strSetupGZipDump_name = 'GZip'; //to translate +$strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]GZip compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate +$strSetupHomepageLink = 'phpMyAdmin homepage'; //to translate +$strSetupIconvExtraParams_name = 'Extra parameters for iconv'; //to translate +$strSetupIgnoreErrors = 'Ignore errors'; //to translate +$strSetupIgnoreMultiSubmitErrors_desc = 'If enabled, phpMyAdmin continues computing multiple-statement queries even if one of the queries failed'; //to translate +$strSetupIgnoreMultiSubmitErrors_name = 'Ignore multiple statement errors'; //to translate +$strSetupImport_allow_interrupt_desc = 'Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.'; //to translate +$strSetupImport_allow_interrupt_name = 'Partial import: allow interrupt'; //to translate +$strSetupImport_format_desc = 'Default format; be aware that this list depends on location (database, table) and only SQL is always available'; //to translate +$strSetupImport_format_name = 'Format of imported file'; //to translate +$strSetupImport_skip_queries_desc = 'Number of records (queries) to skip from start'; //to translate +$strSetupImport_skip_queries_name = 'Partial import: skip queries'; //to translate +$strSetupInsecureConnection = 'Insecure connection'; //to translate +$strSetupInsecureConnectionMsg1 = 'You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!'; //to translate +$strSetupInsecureConnectionMsg2 = 'If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.'; //to translate +$strSetupInsertRows_desc = 'How many rows can be inserted at one time'; //to translate +$strSetupInsertRows_name = 'Number of inserted rows'; //to translate +$strSetupLeftDefaultTabTable_name = 'Target for quick access icon'; //to translate +$strSetupLeftDisplayLogo_desc = 'Show logo in left frame'; //to translate +$strSetupLeftDisplayLogo_name = 'Display logo'; //to translate +$strSetupLeftDisplayServers_desc = 'Display server choice at the top of the left frame'; //to translate +$strSetupLeftDisplayServers_name = 'Display servers selection'; //to translate +$strSetupLeftFrameDBSeparator_desc = 'String that separates databases into different tree levels'; //to translate +$strSetupLeftFrameDBSeparator_name = 'Database tree separator'; //to translate +$strSetupLeftFrameDBTree_desc = 'Only light version; display databases in a tree (determined by the separator defined below)'; //to translate +$strSetupLeftFrameDBTree_name = 'Display databases in a tree'; //to translate +$strSetupLeftFrameLight_desc = 'Disable this if you want to see all databases at once'; //to translate +$strSetupLeftFrameLight_name = 'Use light version'; //to translate +$strSetupLeftFrameTableLevel_name = 'Maximum table tree depth'; //to translate +$strSetupLeftFrameTableSeparator_desc = 'String that separates tables into different tree levels'; //to translate +$strSetupLeftFrameTableSeparator_name = 'Table tree separator'; //to translate +$strSetupLeftLogoLink_name = 'Logo link URL'; //to translate +$strSetupLeftLogoLinkWindow_desc = 'Open the linked page in the main window ([kbd]main[/kbd]) or in a new one ([kbd]new[/kbd])'; //to translate +$strSetupLeftLogoLinkWindow_name = 'Logo link target'; //to translate +$strSetupLeftPointerEnable_desc = 'Highlight server under the mouse cursor'; //to translate +$strSetupLeftPointerEnable_name = 'Enable highlighting'; //to translate +$strSetupLetUserChoose = 'let the user choose'; //to translate +$strSetupLightTabs_desc = 'Use less graphically intense tabs'; //to translate +$strSetupLightTabs_name = 'Light tabs'; //to translate +$strSetupLoad = 'Load'; //to translate +$strSetupLoginCookieDeleteAll_desc = 'If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.'; //to translate +$strSetupLoginCookieDeleteAll_name = 'Delete all cookies on logout'; //to translate +$strSetupLoginCookieRecall_desc = 'Define whether the previous login should be recalled or not in cookie authentication mode'; //to translate +$strSetupLoginCookieRecall_name = 'Recall user name'; //to translate +$strSetupLoginCookieStore_desc = 'Define how long (in seconds) a login cookie should be stored in browser. The default of 0 means that it will be kept for the existing session only, and will be deleted as soon as you close the browser window. This is recommended for non-trusted environments.'; //to translate +$strSetupLoginCookieStore_name = 'Login cookie store'; //to translate +$strSetupLoginCookieValidity_desc = 'Define how long (in seconds) a login cookie is valid'; //to translate +$strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] should be should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.'; //to translate +$strSetupLoginCookieValidity_name = 'Login cookie validity'; //to translate +$strSetupMaxCharactersInDisplayedSQL_desc = 'Maximum number of characters used when a SQL query is displayed'; //to translate +$strSetupMaxCharactersInDisplayedSQL_name = 'Maximum displayed SQL length'; //to translate +$strSetupMaxDbList_desc = 'Maximum number of databases displayed in left frame and database list'; //to translate +$strSetupMaxDbList_name = 'Maximum databases'; //to translate +$strSetupMaxRows_desc = 'Number of rows displayed when browsing a result set. If the result set contains more rows, "Previous" and "Next" links will be shown.'; //to translate +$strSetupMaxRows_name = 'Maximum number of rows to display'; //to translate +$strSetupMaxTableList_desc = 'Maximum number of tables displayed in table list'; //to translate +$strSetupMaxTableList_name = 'Maximum tables'; //to translate +$strSetupMemoryLimit_desc = 'The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)'; //to translate +$strSetupMemoryLimit_name = 'Memory limit'; //to translate +$strSetupNavigationBarIconic_desc = 'Use only icons, only text or both'; //to translate +$strSetupNavigationBarIconic_name = 'Iconic navigation bar'; //to translate +$strSetupNewServer = 'New server'; //to translate +$strSetupNoServers = 'There are no configured servers'; //to translate +$strSetupOBGzip_desc = 'use GZip output buffering for increased speed in HTTP transfers'; //to translate +$strSetupOBGzip_name = 'GZip output buffering'; //to translate +$strSetupOptionNone = '- none -'; //to translate +$strSetupOrder_desc = '[kbd]SMART[/kbd] - i.e. descending order for fields of type TIME, DATE, DATETIME and TIMESTAMP, ascending order otherwise'; //to translate +$strSetupOrder_name = 'Default sorting order'; //to translate +$strSetupOverview = 'Overview'; //to translate +$strSetupPersistentConnections_desc = 'Use persistent connections to MySQL databases'; //to translate +$strSetupPersistentConnections_name = 'Persistent connections'; //to translate +$strSetupPropertiesIconic_desc = 'Use only icons, only text or both'; //to translate +$strSetupPropertiesIconic_name = 'Iconic table operations'; //to translate +$strSetupProtectBinary_desc = 'Disallow BLOB and BINARY fields from editing'; //to translate +$strSetupProtectBinary_name = 'Protect binary fields'; //to translate +$strSetupQueryHistoryDB_desc = 'Enable if you want DB-based query history (requires pmadb). If disabled, this utilizes JS-routines to display query history (lost by window close).'; //to translate +$strSetupQueryHistoryDB_name = 'Permanent query history'; //to translate +$strSetupQueryHistoryMax_desc = 'How many queries are kept in history'; //to translate +$strSetupQueryHistoryMax_name = 'Query history length'; //to translate +$strSetupQueryWindowDefTab_desc = 'Tab displayed when opening a new query window'; //to translate +$strSetupQueryWindowDefTab_name = 'Default query window tab'; //to translate +$strSetupRecodingEngine_desc = 'Select which functions will be used for character set conversion'; //to translate +$strSetupRecodingEngine_name = 'Recoding engine'; //to translate +$strSetupRestoreDefaultValue = 'Restore default value'; //to translate +$strSetupRevertErroneousFields = 'Try to revert erroneous fields to their default values'; //to translate +$strSetupSaveDir_desc = 'Directory where exports can be saved on server'; //to translate +$strSetupSaveDir_name = 'Save directory'; //to translate +$strSetupServerAuthConfigMsg = 'You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set [a@?page=servers&mode=edit&id=%1$d#tab_Server]authentication type[/a] to [kbd]cookie[/kbd] or [kbd]http[/kbd].'; //to translate +$strSetupServerExtensionMsg = 'You should use mysqli for performance reasons'; //to translate +$strSetupServerNoPasswordMsg = 'You allow for connecting to the server without a password.'; //to translate +$strSetupServersAdd = 'Add a new server'; //to translate +$strSetupServers_AllowDeny_order_desc = 'Leave blank if not used'; //to translate +$strSetupServers_AllowDeny_order_name = 'Host authentication order'; //to translate +$strSetupServers_AllowDeny_rules_desc = 'Leave blank for defaults'; //to translate +$strSetupServers_AllowDeny_rules_name = 'Host authentication rules'; //to translate +$strSetupServers_AllowNoPassword_name = 'Allow logins without a password'; //to translate +$strSetupServers_AllowRoot_name = 'Allow root login'; //to translate +$strSetupServers_auth_swekey_config_desc = 'The path for the config file for [a@http://swekey.com]SweKey hardware authentication[/a] (not located in your document root; suggested: /etc/swekey.conf)'; //to translate +$strSetupServers_auth_swekey_config_name = 'SweKey config file'; //to translate +$strSetupServers_auth_type_desc = 'Authentication method to use'; //to translate +$strSetupServers_auth_type_name = 'Authentication type'; //to translate +$strSetupServers_bookmarktable_desc = 'Leave blank for no [a@http://wiki.cihar.com/pma/bookmark]bookmark[/a] support, default: [kbd]pma_bookmark[/kbd]'; //to translate +$strSetupServers_bookmarktable_name = 'Bookmark table'; //to translate +$strSetupServers_column_info_desc = 'Leave blank for no column comments/mime types, default: [kbd]pma_column_info[/kbd]'; //to translate +$strSetupServers_column_info_name = 'Column information table'; //to translate +$strSetupServers_compress_desc = 'Compress connection to MySQL server'; //to translate +$strSetupServers_compress_name = 'Compress connection'; //to translate +$strSetupServers_connect_type_desc = 'How to connect to server, keep tcp if unsure'; //to translate +$strSetupServers_connect_type_name = 'Connection type'; //to translate +$strSetupServers_controlpass_name = 'Control user password'; //to translate +$strSetupServers_controluser_desc = 'A special MySQL user configured with limited permissions, more information available on [a@http://wiki.cihar.com/pma/controluser]wiki[/a]'; //to translate +$strSetupServers_controluser_name = 'Control user'; //to translate +$strSetupServers_CountTables_desc = 'Count tables when showing database list'; //to translate +$strSetupServers_CountTables_name = 'Count tables'; //to translate +$strSetupServers_designer_coords_desc = 'Leave blank for no Designer support, default: [kbd]designer_coords[/kbd]'; //to translate +$strSetupServers_designer_coords_name = 'Designer table'; //to translate +$strSetupServers_DisableIS_desc = 'More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]'; //to translate +$strSetupServers_DisableIS_name = 'Disable use of INFORMATION_SCHEMA'; //to translate +$strSetupServerSecurityInfoMsg = 'If you feel this is necessary, use additional protection settings - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]host authentication[/a] settings and [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate +$strSetupServersEdit = 'Edit server'; //to translate +$strSetupServers_extension_desc = 'What PHP extension to use; you should use mysqli if supported'; //to translate +$strSetupServers_extension_name = 'PHP extension to use'; //to translate +$strSetupServers_hide_db_desc = 'Hide databases matching regular expression (PCRE)'; //to translate +$strSetupServers_hide_db_name = 'Hide databases'; //to translate +$strSetupServers_history_desc = 'Leave blank for no SQL query history support, default: [kbd]pma_history[/kbd]'; //to translate +$strSetupServers_history_name = 'SQL query history table'; //to translate +$strSetupServers_host_desc = ''; //to translate +$strSetupServers_host_name = 'Server hostname'; //to translate +$strSetupServers_LogoutURL_name = 'Logout URL'; //to translate +$strSetupServers_nopassword_desc = 'Try to connect without password'; //to translate +$strSetupServers_nopassword_name = 'Connect without password'; //to translate +$strSetupServers_only_db_desc = 'You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\''; //to translate +$strSetupServers_only_db_name = 'Show only listed databases'; //to translate +$strSetupServers_password_desc = 'Leave empty if not using config auth'; //to translate +$strSetupServers_password_name = 'Password for config auth'; //to translate +$strSetupServers_pdf_pages_desc = 'Leave blank for no PDF schema support, default: [kbd]pma_pdf_pages[/kbd]'; //to translate +$strSetupServers_pdf_pages_name = 'PDF schema: pages table'; //to translate +$strSetupServers_pmadb_desc = 'Database used for relations, bookmarks, and PDF features. See [a@http://wiki.cihar.com/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Default: [kbd]phpmyadmin[/kbd]'; //to translate +$strSetupServers_pmadb_name = 'PMA database'; //to translate +$strSetupServers_port_desc = 'Port on which MySQL server is listening, leave empty for default'; //to translate +$strSetupServers_port_name = 'Server port'; //to translate +$strSetupServers_relation_desc = 'Leave blank for no [a@http://wiki.cihar.com/pma/relation]relation-links[/a] support, default: [kbd]pma_relation[/kbd]'; //to translate +$strSetupServers_relation_name = 'Relation table'; //to translate +$strSetupServers_ShowDatabasesCommand_desc = 'SQL command to fetch available databases'; //to translate +$strSetupServers_ShowDatabasesCommand_name = 'SHOW DATABASES command'; //to translate +$strSetupServers_SignonSession_desc = 'See [a@http://wiki.cihar.com/pma/auth_types#signon]authentication types[/a] for an example'; //to translate +$strSetupServers_SignonSession_name = 'Signon session name'; //to translate +$strSetupServers_SignonURL_name = 'Signon URL'; //to translate +$strSetupServerSslMsg = 'You should use SSL connections if your web server supports it'; //to translate +$strSetupServers_socket_desc = 'Socket on which MySQL server is listening, leave empty for default'; //to translate +$strSetupServers_socket_name = 'Server socket'; //to translate +$strSetupServers_ssl_desc = ''; //to translate +$strSetupServers_ssl_name = 'Use SSL'; //to translate +$strSetupServers_table_coords_desc = 'Leave blank for no PDF schema support, default: [kbd]pma_table_coords[/kbd]'; //to translate +$strSetupServers_table_coords_name = 'PDF schema: table coordinates'; //to translate +$strSetupServers_table_info_desc = 'Table to describe the display fields, leave blank for no support; default: [kbd]pma_table_info[/kbd]'; //to translate +$strSetupServers_table_info_name = 'Display fields table'; //to translate +$strSetupServers_user_desc = 'Leave empty if not using config auth'; //to translate +$strSetupServers_user_name = 'User for config auth'; //to translate +$strSetupServers_verbose_check_desc = 'Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance'; //to translate +$strSetupServers_verbose_check_name = 'Verbose check'; //to translate +$strSetupServers_verbose_desc = 'Hostname where MySQL server is running'; //to translate +$strSetupServers_verbose_name = 'Verbose name of this server'; //to translate +$strSetupSetValue = 'Set value: %s'; //to translate +$strSetupShowAll_desc = 'Whether a user should be displayed a "show all (records)" button'; //to translate +$strSetupShowAll_name = 'Allow to display all the rows'; //to translate +$strSetupShowChgPassword_desc = 'Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly'; //to translate +$strSetupShowChgPassword_name = 'Show password change form'; //to translate +$strSetupShowCreateDb_name = 'Show create database form'; //to translate +$strSetupShowForm = 'Show form'; //to translate +$strSetupShowFunctionFields_desc = 'Display the function fields in edit/insert mode'; //to translate +$strSetupShowFunctionFields_name = 'Show function fields'; //to translate +$strSetupShowHiddenMessages = 'Show hidden messages (#MSG_COUNT)'; //to translate +$strSetupShowPhpInfo_desc = 'Shows link to [a@http://php.net/manual/function.phpinfo.php]phpinfo()[/a] output'; //to translate +$strSetupShowPhpInfo_name = 'Show phpinfo() link'; //to translate +$strSetupShowServerInfo_name = 'Show detailed MySQL server information'; //to translate +$strSetupShowSQL_desc = 'Defines whether SQL queries generated by phpMyAdmin should be displayed'; //to translate +$strSetupShowSQL_name = 'Show SQL queries'; //to translate +$strSetupShowStats_desc = 'Allow to display database and table statistics (eg. space usage)'; //to translate +$strSetupShowStats_name = 'Show statistics'; //to translate +$strSetupShowTooltipAliasDB_desc = 'If tooltips are enabled and a database comment is set, this will flip the comment and the real name'; //to translate +$strSetupShowTooltipAliasDB_name = 'Display database comment instead of its name'; //to translate +$strSetupShowTooltipAliasTB_desc = 'When setting this to [kbd]nested[/kbd], the alias of the table name is only used to split/nest the tables according to the $cfg[\'LeftFrameTableSeparator\'] directive, so only the folder is called like the alias, the table name itself stays unchanged'; //to translate +$strSetupShowTooltipAliasTB_name = 'Display table comment instead of its name'; //to translate +$strSetupShowTooltip_name = 'Display table comments in tooltips'; //to translate +$strSetupSkipLockedTables_desc = 'Mark used tables and make it possible to show databases with locked tables'; //to translate +$strSetupSkipLockedTables_name = 'Skip locked tables'; //to translate +$strSetupSQLQuery_Edit_name = 'Edit'; //to translate +$strSetupSQLQuery_Explain_name = 'Explain SQL'; //to translate +$strSetupSQLQuery_Refresh_name = 'Refresh'; //to translate +$strSetupSQLQuery_ShowAsPHP_name = 'Create PHP Code'; //to translate +$strSetupSQLQuery_Validate_name = 'Validate SQL'; //to translate +$strSetupSuggestDBName_desc = 'Suggest a database name on the "Create Database" form (if possible) or keep the text field empty'; //to translate +$strSetupSuggestDBName_name = 'Suggest new database name'; //to translate +$strSetupTrue = 'yes'; //to translate +$strSetupTrustedProxies_desc = 'Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]'; //to translate +$strSetupTrustedProxies_name = 'List of trusted proxies for IP allow/deny'; //to translate +$strSetupUploadDir_desc = 'Directory on server where you can upload files for import'; //to translate +$strSetupUploadDir_name = 'Upload directory'; //to translate +$strSetupUseDbSearch_desc = 'Allow for searching inside the entire database'; //to translate +$strSetupUseDbSearch_name = 'Use database search'; //to translate +$strSetupVerboseMultiSubmit_desc = 'Show affected rows of each statement on multiple-statement queries. See libraries/import.lib.php for defaults on how many queries a statement may contain.'; //to translate +$strSetupVerboseMultiSubmit_name = 'Verbose multiple statements'; //to translate +$strSetupVersionCheckDataError = 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'; //to translate +$strSetupVersionCheckInvalid = 'Got invalid version string from server'; //to translate +$strSetupVersionCheckLink = 'Check for latest version'; //to translate +$strSetupVersionCheckNewAvailable = 'A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'; //to translate +$strSetupVersionCheckNewAvailableSvn = 'You are using subversion version, run [kbd]svn update[/kbd] :-)[br]The latest stable version is %s, released on %s.'; //to translate +$strSetupVersionCheckNone = 'No newer stable version is available'; //to translate +$strSetupVersionCheckUnparsable = 'Unparsable version string'; //to translate +$strSetupVersionCheck = 'Version check'; //to translate +$strSetupVersionCheckWrapperError = 'Neither URL wrapper nor CURL is available. Version check is not possible.'; //to translate +$strSetupWarning = 'Warning'; //to translate +$strSetupZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations'; //to translate +$strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.'; //to translate +$strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate +$strSetupZipDump_name = 'ZIP'; //to translate +$strShowBinaryContents = 'Show binary contents'; //to translate +$strShowBLOBContents = 'Show BLOB contents'; //to translate +$strShowKeys = 'Only show keys'; //to translate +$strStatic = 'static'; //to translate +$strSwekeyNoKeyId = 'File %s does not contain any key id'; //to translate +$strSwekeyNoKey = 'No valid authentication key plugged'; //to translate + +$strViewHasAtLeast = 'This view has at least this number of rows. Please refer to %sdocumentation%s.'; //to translate +$strViewImage = 'View image'; //to translate +$strViewVideo = 'View video'; //to translate + +$strWebServer = 'Web server'; //to translate +$strWiki = 'Wiki'; //to translate + +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/bulgarian-utf-8.inc.php b/lang/bulgarian-utf-8.inc.php index bc0c1fa0d..213a27971 100644 --- a/lang/bulgarian-utf-8.inc.php +++ b/lang/bulgarian-utf-8.inc.php @@ -1486,4 +1486,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/catalan-utf-8.inc.php b/lang/catalan-utf-8.inc.php index a54319f14..8c2411f91 100644 --- a/lang/catalan-utf-8.inc.php +++ b/lang/catalan-utf-8.inc.php @@ -41,7 +41,7 @@ $strAdministration = 'Administració'; $strAfter = 'Darrere de %s'; $strAfterInsertBack = 'Tornar'; $strAfterInsertNewInsert = 'Insereix un nou registre'; -$strAfterInsertNext = 'Editar el següent registre'; +$strAfterInsertNext = 'Editar el següent registre'; $strAfterInsertSame = 'Tornar a aquesta pàgina'; $strAllowInterrupt = 'Permetre l\'interrupció de l\'importació en cas de que l\'arxiu d\'ordres detecti que s\'acosta el limit del temps. Pot ser una bona solució per importar arxius grans, però pot trencar transaccions.'; $strAllTableSameWidth = 'Mostrar totes les taules amb la mateixa amplada?'; @@ -169,7 +169,7 @@ $strConstraintsForDumped = 'Restriccions per taules bolcades'; $strConstraintsForTable = 'Restriccions per la taula'; $strControluserFailed = 'La connexió de l\'usuari de control ha fallat, tal com està definida ara a la configuració.'; $strCookiesRequired = 'A partir d\'aquest punt és necessari tenir les galetes (cookies) activades.'; -$strCopy = 'Copiar'; +$strCopy = 'Copiar'; $strCopyDatabaseOK = 'La Base de dades %s s\'ha copiat a %s'; $strCopyTable = 'Copia taula a (base-de-dades.taula):'; $strCopyTableOK = 'La taula %s s\'ha copiat a %s.'; @@ -333,8 +333,8 @@ $strFunctions = 'Funcions'; $strGenBy = 'Generat per'; $strGeneralRelationFeat = 'Característiques generals de relacions'; -$strGenerate = 'Generar'; -$strGeneratePassword = 'Generar Contrasenya'; +$strGenerate = 'Generar'; +$strGeneratePassword = 'Generar Contrasenya'; $strGenTime = 'Temps de generació'; $strGeorgian = 'Georgià'; $strGerman = 'Alemany'; @@ -501,7 +501,7 @@ $strMyISAMSortBufferSizeDesc = 'Ârea assignada per classificar índexos MyISAM $strMyISAMSortBufferSize = 'Tamany de l\'àrea de classificació'; $strMySQLCharset = 'Joc de caràcters de MySQL'; $strMysqlClientVersion = 'Versió del client MySQL'; -$strMySQLConnectionCollation = 'Ordenació de la connexió MySQL'; +$strMySQLConnectionCollation = 'Ordenació de la connexió MySQL'; $strMysqlLibDiffersServerVersion = 'La teva llibreria MySQL de PHP MySQL versió %s és diferent del teu servidor MySQL versió %s. Aixó pot provocar comportaments inesperats.'; $strMySQLSaid = 'MySQL diu: '; $strMySQLShowProcess = 'Mostrar processos'; @@ -629,18 +629,18 @@ $strPrintViewFull = 'Vista d\'impresió (amb texts sencers)'; $strPrintView = 'Imprimir vista'; $strPrivDescAllPrivileges = 'Inclou tots els permissos excepte GRANT (atorgar).'; $strPrivDescAlter = 'Permet alterar l\'estructura de taules existents.'; -$strPrivDescAlterRoutine = 'Permet alterar i esborrar rutines enmagatzemades.'; +$strPrivDescAlterRoutine = 'Permet alterar i esborrar rutines enmagatzemades.'; $strPrivDescCreateDb = 'Permet crear noves bases de dades i taules.'; -$strPrivDescCreateRoutine = 'Permet crear rutines enmgatzemades.'; +$strPrivDescCreateRoutine = 'Permet crear rutines enmgatzemades.'; $strPrivDescCreateTbl = 'Permet crear noves taules.'; $strPrivDescCreateTmpTable = 'Permet crear taules temporals.'; -$strPrivDescCreateUser = 'Permet crear, esborrar i reanomenar comptes d\'usuari.'; -$strPrivDescCreateView = 'Permet crear noves vistes.'; +$strPrivDescCreateUser = 'Permet crear, esborrar i reanomenar comptes d\'usuari.'; +$strPrivDescCreateView = 'Permet crear noves vistes.'; $strPrivDescDelete = 'Permet esborrar dades.'; $strPrivDescDropDb = 'Permet eliminar bases de dades i taules.'; $strPrivDescDropTbl = 'Permet eliminar taules.'; $strPrivDescEvent = 'Permet establir events per al planificador d\'events'; -$strPrivDescExecute5 = 'Permet executar rutines enmagatzemades.'; +$strPrivDescExecute5 = 'Permet executar rutines enmagatzemades.'; $strPrivDescExecute = 'Permet executar processos enmagatzemats (stored procedures); No té efecte en aquesta versió de MySQL.'; $strPrivDescFile = 'Permet importar i exportar dades amb arxius externs.'; $strPrivDescGrant = 'Permet afegir usuaris i permissos sense tenir que recarregar les taules de permissos.'; @@ -658,7 +658,7 @@ $strPrivDescReplClient = 'Dona el dret a l\'usuari de preguntar quins servidors $strPrivDescReplSlave = 'Es necessari per a la replicació en servidors esclaus.'; $strPrivDescSelect = 'Permet llegir dades.'; $strPrivDescShowDb = 'Dona accés a la llista completa de bases de dades.'; -$strPrivDescShowView = 'Permet fer consultes de tipus SHOW CREATE VIEW.'; +$strPrivDescShowView = 'Permet fer consultes de tipus SHOW CREATE VIEW.'; $strPrivDescShutdown = 'Permet parar el servidor.'; $strPrivDescSuper = 'Permet connectar, encara que s\'hagi arribat al máxim numero de connexions permés; Es necessari per moltes operacions d\'administració com ara establir variables globals o bé cancel.lar fils d\'execució d\'altres usuaris.'; $strPrivDescTrigger = 'Permet crear i eliminar disparadors (triggers)'; @@ -1460,4 +1460,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/chinese_simplified-utf-8.inc.php b/lang/chinese_simplified-utf-8.inc.php index 51fc90972..1eee245d2 100644 --- a/lang/chinese_simplified-utf-8.inc.php +++ b/lang/chinese_simplified-utf-8.inc.php @@ -1473,4 +1473,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/chinese_traditional-utf-8.inc.php b/lang/chinese_traditional-utf-8.inc.php index 44ed4d7e4..0e35c96e4 100644 --- a/lang/chinese_traditional-utf-8.inc.php +++ b/lang/chinese_traditional-utf-8.inc.php @@ -238,7 +238,7 @@ $strEndCut = '結束 剪取'; $strEndRaw = '結束 原始資料'; $strEngineAvailable = '%s 已支援這 MySQL 伺服器.'; $strEngineDisabled = '%s 己於這個 MySQL 伺服器中停用.'; -$strEngines = '引擎'; +$strEngines = '引擎'; $strEngineUnsupported = '這 MySQL 版本並不接受 %s 儲存引擎.'; $strEnglish = '英語'; $strEnglishPrivileges = '注意: MySQL 權限名稱會以英語顯示'; @@ -306,12 +306,12 @@ $strHTMLExcel = 'Microsoft Excel 2000'; $strHTMLWord = 'Microsoft Word 2000'; $strHungarian = '匈牙利語'; -$strIcelandic = '冰島語'; +$strIcelandic = '冰島語'; $strId = 'ID'; // use eng $strIdxFulltext = '全文檢索'; $strIgnore = '忽略'; $strIgnoreDuplicates = '略過重覆列'; -$strIgnoreInserts = '使用忽略加入 (insert)'; +$strIgnoreInserts = '使用忽略加入 (insert)'; $strImport = '載入'; $strImportFiles = '輸入檔案'; $strImportFormat = '載入檔案格式'; @@ -393,7 +393,7 @@ $strLongOperation = '這個作業所用時間會較長, 繼續?'; $strMaxConnects = '最大連線數目'; $strMaximalQueryLength = '建立之查詢最大長度'; -$strMaximumSize = '最大容量: %s%s'; +$strMaximumSize = '最大容量: %s%s'; $strMbExtensionMissing = '找不到 PHP 內的 mbstring 編碼模組, 沒有這個模組, phpMyAdmin 無法準確地分割雙字元文字, 而可能產生問題.'; $strMbOverloadWarning = '你在 PHP 設定內啟動了 mbstring.func_overload 選項, 這個選項暫時不兼容 phpMyAdmin , 你可能會損失部份資料!'; $strMIME_available_mime = '可使用 MIME 類型'; @@ -542,7 +542,7 @@ $strPrivDescReplClient = '容許用戶查詢 slaves / masters 在何處.'; $strPrivDescReplSlave = '需要複製的 slaves.'; $strPrivDescSelect = '容許讀取數據.'; $strPrivDescShowDb = '可讀取整個資料庫清單.'; -$strPrivDescShowView = '容許執行 SHOW CREATE VIEW 查詢.'; +$strPrivDescShowView = '容許執行 SHOW CREATE VIEW 查詢.'; $strPrivDescShutdown = '容許停止伺服器.'; $strPrivDescSuper = '容許連線, 就算超過了最大連線限制; 用於最高系統管理如設定整體權限或中止其他使用者指令.'; $strPrivDescUpdate = '容許更新數據.'; @@ -804,7 +804,7 @@ $strWriteRequests = '寫入要求'; $strWrongUser = '錯誤的使用者名稱或密碼,拒絕存取'; $strXML = 'XML'; //USE ENG - + $strYes = ' 是 '; $strZeroRemovesTheLimit = '註: 設定這些選項為 0 (零) 可解除限制.'; @@ -1470,4 +1470,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/croatian-utf-8.inc.php b/lang/croatian-utf-8.inc.php index a31e326e1..dc76caf41 100644 --- a/lang/croatian-utf-8.inc.php +++ b/lang/croatian-utf-8.inc.php @@ -1467,4 +1467,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/czech-utf-8.inc.php b/lang/czech-utf-8.inc.php index 600325e88..0ac10bb58 100644 --- a/lang/czech-utf-8.inc.php +++ b/lang/czech-utf-8.inc.php @@ -349,6 +349,9 @@ $strGlobal = 'globální'; $strGlobalPrivileges = 'Globální oprávnění'; $strGlobalValue = 'Globální hodnota'; $strGo = 'Proveď'; +$strGoToDatabase = 'Přejít na databázi'; +$strGoToTable = 'Přejít na tabulku'; +$strGoToView = 'Přejít na podhled'; $strGrantOption = 'Přidělování'; $strGreek = 'Řečtina'; $strGzip = '„zagzipováno“'; @@ -378,11 +381,25 @@ $strIEUnsupported = 'Prohlížeč Internet Explorer tuto funkci nepodporuje.'; $strIgnoreDuplicates = 'Ignorovat duplicitní řádky'; $strIgnore = 'Ignorovat'; $strIgnoreInserts = 'Použít IGNORE'; +$strImportColNames = 'Jména sloupců na prvním řádku'; +$strImportEmptyRows = 'Neimportovat prázdné řádky'; $strImportExportCoords = 'Import/Export souřadnic pro PDF schéma'; $strImportFiles = 'Importovat soubory'; $strImportFormat = 'Formát importovaného souboru'; $strImport = 'Import'; +$strImportLargeFileUploading = 'Nahrávaný soubor je pravděpodobně větší než je povolená velikost, nebo se jedná o známou chybu prohlížečů založených na webkitu (Safari, Google Chrome, Arora apod.).'; +$strImportNoticePt1 = 'Následující tabulkybyly vytvořeny nebo změněny. Teď můžete:'; +$strImportNoticePt2 = 'Zobrazit obsah tabulky kliknutím na její jméno'; +$strImportNoticePt3 = 'Změnit jakákoliv její nastavení kliknutím na odkaz "Nastavení"'; +$strImportNoticePt4 = 'Upravit strukturu kliknutím na odkaz "Struktura"'; +$strImportODSCurrency = 'Importovat měny (5.00 místo $5.00)'; +$strImportODS = 'Open Document Spreadsheet'; +$strImportODSPercents = 'Importovat procenta jako desetinná čísla (0.12 místo 12.00%)'; +$strImportProceedingFile = 'Soubor je zpracováván, prosím buďte trpěliví.'; $strImportSuccessfullyFinished = 'Import byl úspěšně dokončen, bylo provedeno %d dotazů.'; +$strImportUploadInfoNotAvailable = 'Soubor je zpracováván, prosím buďte trpěliví. Podrobnosti o nahrávání nejsou dostupné.'; +$strImportXLS = 'Excel 97-2003 XLS'; +$strImportXLSX = 'Excel 2007 XLSX'; $strIndexes = 'Indexy'; $strIndexesSeemEqual = 'Indexy %1$s a %2$s vypadají stejné a jeden z nich by pravděpodobně mohl být odstraněn.'; $strIndexHasBeenDropped = 'Index %s byl odstraněn'; @@ -616,6 +633,7 @@ $strPerMinute = 'za minutu'; $strPerSecond = 'za sekundu'; $strPersian = 'Perština'; $strPhoneBook = 'adresář'; +$strPhpArray = 'PHP pole'; $strPHPExtension = 'Rozšíření PHP'; $strPHPVersion = 'Verze PHP'; $strPhp = 'Vytvořit PHP kód'; @@ -796,6 +814,7 @@ $strSessionGCWarning = 'Vaše nastavení PHP ([a@http://php.net/manual/en/sessio $strSessionStartupErrorGeneral = 'Vytváření sezení selhalo, prosím zkontrolujte chyby v logu PHP a/nebo webserveru a pečlivě nastavte podporu sezení v PHP.'; $strSessionValue = 'Hodnota sezení'; $strSetEnumVal = 'Pokud je sloupec typu „enum“ nebo „set“, zadávejte hodnoty v následujícím formátu: \'a\',\'b\',\'c\'...
    Pokud potřebujete zadat zpětné lomítko („\“) nebo jednoduché uvozovky („\'“) mezi těmito hodnotami, napište před ně zpětné lomítko (příklad: \'\\\\xyz\' nebo \'a\\\'b\').'; +$strSettings = 'nastavení'; $strSetupAllowAnywhereRecoding_name = 'Povolit převod znakových sad'; $strSetupAllowArbitraryServer_desc = 'Pokud je povoleno, může uživatel zadat libovolný MySQL server do přihlašovacího formuláře pro autorizaci pomocí cookie'; $strSetupAllowArbitraryServerMsg = 'Tato [a@?page=form&formset=features#tab_Security]volba[/a] by měla být zakázána, protože umožňuje útočníkům prolomit přihlašování k libovolnému MySQL serveru útokem hrobou silou. V případě nutnosti použijte [a@?page=form&formset=features#tab_Security]seznam důvěryhodných proxy[/a]. Nicméně ochrana založená na kotrole IP adres, nemusí být spolehlivá, pokud Vaše IP adresa patří poskytovateli internetových služeb, ke kterému jsou připojeny tisíce uživatelů.'; @@ -1290,6 +1309,7 @@ $strStrucNativeExcel = 'Nativní formát MS Excelu'; $strStrucOnly = 'Pouze strukturu'; $strStructPropose = 'Navrhnout strukturu tabulky'; $strStructureForView = 'Struktura pro pohled'; +$strStructureLC = 'struktura'; $strStructure = 'Struktura'; $strSubmit = 'Provést'; $strSuccess = 'Váš SQL-dotaz byl úspěšně vykonán'; @@ -1344,6 +1364,59 @@ $strToggleSmallBig = 'Přepnout malé/velké'; $strToSelectRelation = 'Pro výběr relace klikněte :'; $strTotal = 'celkem'; $strTotalUC = 'Celkem'; +$strTrackingActivated = 'Sledování pro %s.%s je zapnuté.'; +$strTrackingActivateNow = 'Zapnout teď'; +$strTrackingActivateTrackingFor = 'Zapnuté sledování pro %s.%s'; +$strTrackingCreateVersionOf = 'Vytvořit verzi %s z %s.%s'; +$strTrackingCreateVersion = 'Vytvořit verzi'; +$strTrackingDatabaseLog = 'Historie databáze'; +$strTrackingDataDefinitionStatement = 'Příkaz pro definici dat'; +$strTrackingDataManipulationStatement = 'Příkaz pro úpravu dat'; +$strTrackingDate = 'Datum'; +$strTrackingDeactivateNow = 'Vypnout teď'; +$strTrackingDeactivateTrackingFor = 'Vypnout sledování pro %s.%s'; +$strTrackingDoIt = 'Udělej to'; +$strTrackingExportAs = 'Exportovat jako %s'; +$strTrackingIsActive = 'Sledování je zapnuté.'; +$strTrackingIsDeactive = 'Sledování je vypnuté.'; +$strTrackingMechanism = 'Sledovací mechanismus'; +$strTrackingReportClose = 'Ukončit'; +$strTrackingReport = 'Informace o sledování'; +$strTrackingSelectDataOnly = 'Jen data'; +$strTrackingSelectStructureAndData = 'Struktura a data'; +$strTrackingSelectStructureOnly = 'Jen struktura'; +$strTrackingShowLogDateUsers = 'Zobrazit %s s datumy od %s do %s od uživatele %s %s'; +$strTrackingShowVersions = 'Zobrazit verze'; +$strTracking = 'Sledování'; +$strTrackingSQLDumpFile = 'výpis SQL (stáhnout soubor)'; +$strTrackingSQLDump = 'výpis SQL'; +$strTrackingSQLExecuted = 'provedené SQL příkazy.'; +$strTrackingSQLExecutionAlert = 'Tato volba nahradí vaší tabulku a data, která obsahuje.'; +$strTrackingSQLExecution = 'Provedení SQL'; +$strTrackingSQLExported = 'SQL příkazy byly exportovány. Prosím zkopírujte si je, nebo je spusťte.'; +$strTrackingStatements = 'Sledování příkazů'; +$strTrackingStatusActive = 'zapnuté'; +$strTrackingStatusDeactive = 'vypnuté'; +$strTrackingStructureSnapshot = 'Snímek struktury'; +$strTrackingThCreated = 'Vytvořeno'; +$strTrackingThDatabase = 'Databáze'; +$strTrackingThLastVersion = 'Poslední verze'; +$strTrackingThShow = 'Zobrazit'; +$strTrackingThStatus = 'Stav'; +$strTrackingThTable = 'Tabulka'; +$strTrackingThUpdated = 'Aktualizováno'; +$strTrackingThVersion = 'Verze'; +$strTrackingTrackDDStatements = 'Sledovat tyto příkazy pro definici dat:'; +$strTrackingTrackDMStatements = 'Sledovat tyto příkazy pro úpravu dat:'; +$strTrackingTrackedTables = 'Sledované tabulky'; +$strTrackingTrackTable = 'Sledovat tabulku'; +$strTrackingUntrackedTables = 'Nesledované tabulky'; +$strTrackingUsername = 'Uživatel'; +$strTrackingVersionActivated = 'Sledování pro %s.%s , verze %s je zapnuté.'; +$strTrackingVersionCreated = 'Verze %s vytvořena, sledování pro %s.%s je zapnuté.'; +$strTrackingVersionDeactivated = 'Sledování pro %s.%s , verze %s je vypnuté.'; +$strTrackingVersionSnapshotSQL = 'Snímek verze %s (SQL kód)'; +$strTrackingVersions = 'Verze'; $strTraditionalChinese = 'Tradiční čínština'; $strTraditionalSpanish = 'Tradiční španělština'; $strTraffic = 'Provoz'; @@ -1429,6 +1502,14 @@ $strWithChecked = 'Zaškrtnuté:'; $strWriteRequests = 'Požadavků na čtení'; $strWrongUser = 'Špatné uživatelské jméno nebo heslo. Přístup odepřen.'; +$strXMLError = 'Zadaný XML soubor je buď poškozený nebo nekompletní. Prosím opravte ho a zkuste to znovu.'; +$strXMLExportContents = 'Exportovat obsah'; +$strXMLExportFunctions = 'Exportovat funkce'; +$strXMLExportProcedures = 'Exportovat procedury'; +$strXMLExportStructs = 'Exportovat schéma struktury (doporučené)'; +$strXMLExportTables = 'Exportovat tabulky'; +$strXMLExportTriggers = 'Exportovat spouště'; +$strXMLExportViews = 'Exportovat pohledy'; $strXML = 'XML'; $strYes = 'Ano'; @@ -1465,8 +1546,4 @@ $strSetupZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format $strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.'; //to translate $strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strPhpArray = 'PHP array'; //to translate -$strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate -$strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate -$strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate ?> diff --git a/lang/danish-utf-8.inc.php b/lang/danish-utf-8.inc.php index 197c24cd6..b5d0925de 100644 --- a/lang/danish-utf-8.inc.php +++ b/lang/danish-utf-8.inc.php @@ -1465,4 +1465,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/dutch-utf-8.inc.php b/lang/dutch-utf-8.inc.php index 68744cd65..690d1741a 100644 --- a/lang/dutch-utf-8.inc.php +++ b/lang/dutch-utf-8.inc.php @@ -261,7 +261,7 @@ $strDisplayPDF = 'Geef het PDF-schema weer'; $strDoAQuery = 'Voer een query op basis van een vergelijking uit (wildcard: "%")'; $strDocSQL = 'DocSQL'; $strDocu = 'Documentatie'; -$strDoNotAutoIncrementZeroValues = 'Gebruik geen AUTO_INCREMENT voor 0-waarden'; +$strDoNotAutoIncrementZeroValues = 'Gebruik geen AUTO_INCREMENT voor 0-waarden'; $strDownloadFile = 'Download bestand'; $strDoYouReally = 'Weet u zeker dat u dit wilt '; $strDropDatabaseStrongWarning = 'U staat op het punt een complete database te VERWIJDEREN!'; @@ -1466,8 +1466,85 @@ $strZeroRemovesTheLimit = 'Opmerking: Het instellen van deze waarden op 0 (nul) $strZip = '"Gezipt"'; $strNavTableFilter = 'Filter'; -$strPhpArray = 'PHP-array'; -$strImportLargeFileUploading = 'Het geuploade bestand is mogelijk groter dan de limiet toestaat, of u heeft last van een een bekende bug in op webkit gebaseerde browsers(Safari, Google Chrome, Arora).'; +$strPhpArray = 'PHP-array'; +$strImportLargeFileUploading = 'Het geuploade bestand is mogelijk groter dan de limiet toestaat, of u heeft last van een een bekende bug in op webkit gebaseerde browsers(Safari, Google Chrome, Arora).'; $strImportProceedingFile = 'Het bestand wordt verwerkt, een ogenblik geduld.'; $strImportUploadInfoNotAvailable = 'Een ogenblik geduld, het bestand wordt geupload. Details over de voortgang zijn niet beschikbaar.'; +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/english-utf-8.inc.php b/lang/english-utf-8.inc.php index 3afb5d018..f4d5d3151 100644 --- a/lang/english-utf-8.inc.php +++ b/lang/english-utf-8.inc.php @@ -348,6 +348,9 @@ $strGlobal = 'global'; $strGlobalPrivileges = 'Global privileges'; $strGlobalValue = 'Global value'; $strGo = 'Go'; +$strGoToDatabase = 'Go to database'; +$strGoToTable = 'Go to table'; +$strGoToView = 'Go to view'; $strGrantOption = 'Grant'; $strGreek = 'Greek'; $strGzip = '"gzipped"'; @@ -377,14 +380,25 @@ $strIEUnsupported = 'Internet Explorer does not support this function.'; $strIgnoreDuplicates = 'Ignore duplicate rows'; $strIgnore = 'Ignore'; $strIgnoreInserts = 'Use ignore inserts'; +$strImportColNames = 'Column names in first row'; +$strImportEmptyRows = 'Do not import empty rows'; $strImportExportCoords = 'Import/Export coordinates for PDF schema'; $strImportFiles = 'Import files'; $strImportFormat = 'Format of imported file'; $strImport = 'Import'; $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; +$strImportODS = 'Open Document Spreadsheet'; +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; $strImportProceedingFile = 'The file is being processed, please be patient.'; $strImportSuccessfullyFinished = 'Import has been successfully finished, %d queries executed.'; $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; +$strImportXLS = 'Excel 97-2003 XLS Workbook'; +$strImportXLSX = 'Excel 2007 XLSX Workbook'; $strIndexes = 'Indexes'; $strIndexesSeemEqual = 'The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'; $strIndexHasBeenDropped = 'Index %s has been dropped'; @@ -799,6 +813,7 @@ $strSessionGCWarning = 'Your PHP parameter [a@http://php.net/manual/en/session.c $strSessionStartupErrorGeneral = 'Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.'; $strSessionValue = 'Session value'; $strSetEnumVal = 'If field type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...
    If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').'; +$strSettings = 'settings'; $strSetupAllowAnywhereRecoding_name = 'Allow character set conversion'; $strSetupAllowArbitraryServer_desc = 'If enabled user can enter any MySQL server in login form for cookie auth'; $strSetupAllowArbitraryServerMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; @@ -1319,6 +1334,7 @@ $strStrucNativeExcel = 'Native MS Excel format'; $strStrucOnly = 'Structure only'; $strStructPropose = 'Propose table structure'; $strStructureForView = 'Structure for view'; +$strStructureLC = 'structure'; $strStructure = 'Structure'; $strSubmit = 'Submit'; $strSuccess = 'Your SQL query has been executed successfully'; @@ -1373,6 +1389,59 @@ $strToggleSmallBig = 'Toggle small/big'; $strToSelectRelation = 'To select relation, click :'; $strTotal = 'total'; $strTotalUC = 'Total'; +$strTrackingActivated = 'Tracking of %s.%s is activated.'; +$strTrackingActivateNow = 'Activate now'; +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; +$strTrackingCreateVersion = 'Create version'; +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; +$strTrackingDatabaseLog = 'Database Log'; +$strTrackingDataDefinitionStatement = 'Data definition statement'; +$strTrackingDataManipulationStatement = 'Data manipulation statement'; +$strTrackingDate = 'Date'; +$strTrackingDeactivateNow = 'Deactivate now'; +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; +$strTrackingDoIt = 'Do it'; +$strTrackingExportAs = 'Export as %s'; +$strTrackingIsActive = 'Tracking is active.'; +$strTrackingIsDeactive = 'Tracking is deactive.'; +$strTrackingMechanism = 'Tracking Mechanism'; +$strTrackingReportClose = 'Close'; +$strTrackingReport = 'Tracking report'; +$strTrackingSelectDataOnly = 'Data only'; +$strTrackingSelectStructureAndData = 'Structure and Data'; +$strTrackingSelectStructureOnly = 'Structure only'; +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; +$strTrackingShowVersions = 'Show versions'; +$strTrackingSQLDumpFile = 'SQL dump (file download)'; +$strTrackingSQLDump = 'SQL dump'; +$strTrackingSQLExecuted = 'SQL statements executed.'; +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; +$strTrackingSQLExecution = 'SQL execution'; +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; +$strTrackingStatements = 'Tracking statements'; +$strTrackingStatusActive = 'active'; +$strTrackingStatusDeactive = 'deactive'; +$strTrackingStructureSnapshot = 'Structure snapshot'; +$strTrackingThCreated = 'Created'; +$strTrackingThDatabase = 'Database'; +$strTrackingThLastVersion = 'Last version'; +$strTrackingThShow = 'Show'; +$strTrackingThStatus = 'Status'; +$strTrackingThTable = 'Table'; +$strTrackingThUpdated = 'Updated'; +$strTrackingThVersion = 'Version'; +$strTrackingTrackDDStatements = 'Track these data definition statements:'; +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; +$strTrackingTrackedTables = 'Tracked tables'; +$strTracking = 'Tracking'; +$strTrackingTrackTable = 'Track table'; +$strTrackingUntrackedTables = 'Untracked tables'; +$strTrackingUsername = 'Username'; +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; +$strTrackingVersions = 'Versions'; $strTraditionalChinese = 'Traditional Chinese'; $strTraditionalSpanish = 'Traditional Spanish'; $strTraffic = 'Traffic'; @@ -1458,6 +1527,14 @@ $strWithChecked = 'With selected:'; $strWriteRequests = 'Write requests'; $strWrongUser = 'Wrong username/password. Access denied.'; +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; +$strXMLExportContents = 'Export contents'; +$strXMLExportFunctions = 'Export functions'; +$strXMLExportProcedures = 'Export procedures'; +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; +$strXMLExportTables = 'Export tables'; +$strXMLExportTriggers = 'Export triggers'; +$strXMLExportViews = 'Export views'; $strXML = 'XML'; $strYes = 'Yes'; diff --git a/lang/estonian-utf-8.inc.php b/lang/estonian-utf-8.inc.php index ae541b8db..5a9917fc3 100644 --- a/lang/estonian-utf-8.inc.php +++ b/lang/estonian-utf-8.inc.php @@ -28,7 +28,7 @@ $strAccessDeniedExplanation = 'phpMyAdmin proovis ühenduda MySQL serveriga ja s $strAccessDenied = 'Ligipääs keelatud'; $strAction = 'Tegevus'; $strAddAutoIncrement = 'Lisa AUTO_INCREMENT väärtus'; -$strAddClause = 'Lisa %s'; +$strAddClause = 'Lisa %s'; $strAddConstraints = 'Lisa piirangud'; $strAddDeleteColumn = 'Lisa/Kustuta välja veerud'; $strAddDeleteRow = 'Lisa/Kustuta kriteeriumirida'; @@ -55,7 +55,7 @@ $strAlterOrderBy = 'Muuda tabeli sorteeringut'; $strAnalyzeTable = 'Analüüsi tabelit'; $strAnd = 'ja'; $strAndThen = 'ja siis'; -$strAngularLinks = 'Nurgelised lingid'; +$strAngularLinks = 'Nurgelised lingid'; $strAnIndex = 'Indeks lisati %s'; $strAnyHost = 'Kõik masinad'; $strAny = 'kõik'; @@ -106,7 +106,7 @@ $strBusyPages = 'Hõivatud lehed'; $strBzip = '"bzipitud"'; $strCalendar = 'Kalender'; -$strCancel = 'Katkesta'; +$strCancel = 'Katkesta'; $strCanNotLoadExportPlugins = 'Viga eksportimis moodulite laadimisel, palun kontrolli seadeid!'; $strCanNotLoadImportPlugins = 'Pole võimalik Importida mooduleid (plugins), palun kontrolli seadeid!'; $strCannotLogin = 'Ei suuda MySQL serverisse logida'; @@ -169,11 +169,11 @@ $strCreateNewDatabase = 'Loo uus andmebaas'; $strCreateNewTable = 'Loo uus tabel andmebaasi %s'; $strCreatePage = 'Loo uus leht'; $strCreatePdfFeat = 'PDF-ide tegemine'; -$strCreateRelation = 'Suhte loomine (relation)'; +$strCreateRelation = 'Suhte loomine (relation)'; $strCreateTable = 'Loo tabel'; -$strCreateUserDatabase = 'Andmebaas kasutajale'; -$strCreateUserDatabaseName = 'Loo sama nimega andmebaas ja anna kõik õigused'; -$strCreateUserDatabaseNone = 'Puudub'; +$strCreateUserDatabase = 'Andmebaas kasutajale'; +$strCreateUserDatabaseName = 'Loo sama nimega andmebaas ja anna kõik õigused'; +$strCreateUserDatabaseNone = 'Puudub'; $strCreateUserDatabaseWildcard = 'Anna kõik õigused Metanimele (username\_%)'; $strCreationDates = 'Loo/muuda/kontrolli kuupäevi'; $strCriteria = 'Kriteerium'; @@ -200,7 +200,7 @@ $strDataOnly = 'Ainult andmed'; $strDataPages = 'Lehed andmetega'; $strDBComment = 'Andmebaasi kommentaar: '; $strDBCopy = 'Kopeeri andmebaas'; -$strDbIsEmpty = 'Andmebaas tundub olevat tühi!'; +$strDbIsEmpty = 'Andmebaas tundub olevat tühi!'; $strDbPrivileges = 'Andmebaas-spetsiifilised privileegid'; $strDBRename = 'Nimeta andmebaas ümber'; $strDbSpecific = 'andmebaasipõhine'; @@ -214,15 +214,15 @@ $strDeleteAndFlush = 'Kustutage kasutajad ja taaslaadige privileegid pärast sed $strDeleted = 'Rida kustutatud'; $strDelete = 'Kustuta'; $strDeleteNoUsersSelected = 'Ühtegi kasutajat pole valitud kustutamiseks!'; -$strDeleteRelation = 'Kustuta suhe'; +$strDeleteRelation = 'Kustuta suhe'; $strDeleting = 'Kustutan %s'; -$strDelimiter = 'Eraldaja'; +$strDelimiter = 'Eraldaja'; $strDelOld = 'Antud lehel on viiteid tabelitele mida enam ei ole. Kas te soovite kustutada need viited?'; $strDescending = 'Kahanev'; $strDescription = 'Kirjeldus'; $strDesigner = 'Kujundaja'; $strDictionary = 'sõnaraamat'; -$strDirectLinks = 'Otselingid'; +$strDirectLinks = 'Otselingid'; $strDirtyPages = 'Mustad lehed'; $strDisabled = 'Keelatud'; $strDisableForeignChecks = 'Keela võõrvõtmete (foreign key) kontroll'; @@ -230,7 +230,7 @@ $strDisplayFeat = 'Kuva võimalused'; $strDisplayOrder = 'Näitamise järjekord:'; $strDisplayPDF = 'Näita PDF skeemi'; $strDoAQuery = 'Tee "päring näite järgi" (lühend: "%")'; -$strDocSQL = 'DocSQL'; +$strDocSQL = 'DocSQL'; $strDocu = 'Dokumentatsioon'; $strDoYouReally = 'Kas te tõesti tahate '; $strDropDatabaseStrongWarning = 'Tähelepanu! Te HÄVITATE kogu andmebaasi!'; @@ -259,7 +259,7 @@ $strEngineUnsupported = 'See MySQL server ei toeta %s varundusmootorit.'; $strEnglish = 'Inglise'; $strEnglishPrivileges = ' Märkus: MySQL privileegide nimed on ingliskeelsed '; $strErrorInZipFile = 'Viga ZIP arhiivis:'; -$strErrorRenamingTable = 'Viga tabeli nime %1$s muutimsel %2$s'; +$strErrorRenamingTable = 'Viga tabeli nime %1$s muutimsel %2$s'; $strError = 'Viga'; $strEscapeWildcards = 'Metamärgid _ ja % peaksid olema varjestatud märgiga \, kui soovite neid sisestada'; $strEsperanto = 'Esperanto'; @@ -299,7 +299,7 @@ $strFormEmpty = 'Puuduv väärtus vormis !'; $strFreePages = 'Vabad lehed'; $strFullText = 'Täistekstid'; $strFunction = 'Funktsioon'; -$strFunctions = 'Funktsioonid'; +$strFunctions = 'Funktsioonid'; $strGenBy = 'Genereerija '; $strGeneralRelationFeat = 'Peamised seoste võimalused'; @@ -320,10 +320,10 @@ $strHandler = 'Töötleja'; $strHasBeenAltered = 'on muudetud.'; $strHaveToShow = 'Te peate valima vähemalt ühe veeru kuvamiseks'; $strHebrew = 'Heebrea'; -$strHelp = 'Abi'; +$strHelp = 'Abi'; $strHide = 'Peida'; $strHideShowAll = 'Peida/Näita kõik'; -$strHideShowNoRelation = 'Peida/Näita tabelid millel puudub suhe'; +$strHideShowNoRelation = 'Peida/Näita tabelid millel puudub suhe'; $strHome = 'Esileht'; $strHomepageOfficial = 'Ametlik phpMyAdmini koduleht'; $strHostEmpty = 'Masin on tühi!'; @@ -361,7 +361,7 @@ $strInnodbStat = 'InnoDB staatus'; $strInsecureMySQL = 'Teie konfiguratsioonifail sisaldab seadeid (root kasutaja ilma paroolita) mis vastab MySQL-i vaikimisi priviligeeritud kasutajale. Kui Teie MySQL-i server jookseb sellise seadega on ta avatud rünnakutele, soovitav on see turvaauk kiiresti parandada.'; $strInsertAsNewRow = 'Lisa uue reana'; $strInsert = 'Lisa'; -$strInternalRelationAdded = 'Sisemine suhe loodud'; +$strInternalRelationAdded = 'Sisemine suhe loodud'; $strInternalRelations = 'Sisesed seosed'; $strInUse = 'kasutusel'; $strInvalidAuthMethod = 'Vigane autoriseerimise meetod konfiguratsioonifailis:'; @@ -370,14 +370,14 @@ $strInvalidColumn = 'Vigased välja veerud (%s) valitud!'; $strInvalidCSVFieldCount = 'Vigane väljade arv CSV sisendis real %d.'; $strInvalidCSVFormat = 'Vigane formaat CSV sisendis real %d.'; $strInvalidCSVParameter = 'Vigane parameeter CSV importimisel: %s'; -$strInvalidDatabase = 'Vigane andmebaas'; +$strInvalidDatabase = 'Vigane andmebaas'; $strInvalidFieldAddCount = 'Peate lisama vähemalt ühe välja.'; $strInvalidFieldCount = 'Tabelil peab olema vähemalt üks väli.'; $strInvalidLDIImport = 'See plugin ei toeta pakitud importe!'; $strInvalidRowNumber = '%d ei ole õige reanumber.'; $strInvalidServerHostname = 'Vigane hostname serverile %1$s. Palun kontrolli seadeid.'; $strInvalidServerIndex = 'Vigane serveri indeks: "%s"'; -$strInvalidTableName = 'Vigane tabeli nimi'; +$strInvalidTableName = 'Vigane tabeli nimi'; $strJapanese = 'Jaapani'; $strJoins = 'Liited'; @@ -393,7 +393,7 @@ $strKnownExternalBug = 'See %s funktionaalsus on mõjutatud tuntud viga, vaata % $strKorean = 'Korea'; $strLandscape = 'Laipilt'; -$strLanguage = 'Keel'; +$strLanguage = 'Keel'; $strLanguageUnknown = 'Tundmatu keel: %1$s.'; $strLatchedPages = 'Lukustatud lehed'; $strLatexCaption = 'Tabeli seletus'; @@ -442,7 +442,7 @@ $strMIME_without = 'MIME-tüübid kursiivis ei oma eraldi transofrmatsiooni funk $strModifications = 'Muutused salvestatud'; $strModifyIndexTopic = 'Muuda indeksit'; $strModify = 'Muuda'; -$strMoveMenu = 'Liiguta menüü'; +$strMoveMenu = 'Liiguta menüü'; $strMoveTableOK = 'Tabel %s viidu üle andmebaasi %s.'; $strMoveTableSameNames = 'Ei saa tabelit iseendasse liigutada!'; $strMoveTable = 'Vii tabel üle (andmebaas.tabel):'; @@ -506,7 +506,7 @@ $strNumTables = 'Tabelid'; $strOK = 'Korras'; $strOpenDocumentSpreadsheet = 'Ava dokumendi arvutustabel'; -$strOpenDocumentText = 'Ava dokumendi tekst'; +$strOpenDocumentText = 'Ava dokumendi tekst'; $strOpenNewWindow = 'Ava uus phpMyAdmin aken'; $strOperations = 'Tegevused'; $strOperator = 'Operaator'; @@ -538,7 +538,7 @@ $strPersian = 'Pärsia'; $strPhoneBook = 'telefoniraamat'; $strPhp = 'Loo PHP kood'; $strPHPVersion = 'PHP versioon'; -$strPleaseSelectPrimaryOrUniqueKey = 'Palun vali primaarne või unkaalne võti'; +$strPleaseSelectPrimaryOrUniqueKey = 'Palun vali primaarne või unkaalne võti'; $strPmaDocumentation = 'phpMyAdmini dokumentatsioon'; $strPmaUriError = '$cfg[\'PmaAbsoluteUri\'] konstant peab teie konfiguratsioonifailis määratud olema!'; $strPolish = 'Poola'; @@ -609,18 +609,18 @@ $strQueryWindowLock = 'Antud päringut mitte muuta väljaspool akent.'; $strReadRequests = 'Pöördumised lugemiseks'; $strReceived = 'Saadud'; -$strRecommended = 'soovituslik'; +$strRecommended = 'soovituslik'; $strRecords = 'Kirjeid'; $strReferentialIntegrity = 'Kontrolli pärinevust:'; $strRefresh = 'Uuenda'; $strRelationalSchema = 'Seoseskeem'; -$strRelationDeleted = 'Suhe kustutatud'; +$strRelationDeleted = 'Suhe kustutatud'; $strRelationNotWorking = 'Lisavõimalused töötamiseks lingitud tabelitega on deaktiveeritud. Et lugeda miks see nii on, vajutage %ssiia%s.'; $strRelationsForTable = 'SEOSED TABELILE'; $strRelations = 'Suhted'; $strRelationView = 'Pärinevuse vaade'; $strReloadingThePrivileges = 'Taaslaen privileege'; -$strReload = 'Lae uuesti'; +$strReload = 'Lae uuesti'; $strReloadPrivileges = 'Lae privileegid uuesti'; $strRemoveSelectedUsers = 'Eemalda valitud kasutajad'; $strRenameDatabaseOK = 'Andmebaas %s on ümber nimetatud %s'; @@ -654,7 +654,7 @@ $strRunSQLQuery = 'Päri SQL päring(uid) andmebaasist %s'; $strRussian = 'Vene'; $strSaveOnServer = 'Salvestage serverisse kataloogi %s'; -$strSavePosition = 'Salvesta positsioon'; +$strSavePosition = 'Salvesta positsioon'; $strSave = 'Salvesta'; $strScaleFactorSmall = 'Skalaarfaktor on liiga väike, et skeem mahuks ühele lehele.'; $strSearchFormTitle = 'Otsi andmebaasist'; @@ -672,7 +672,7 @@ $strSelectADb = 'Valige andmebaas'; $strSelectAll = 'Märgista kõik'; $strSelectBinaryLog = 'Valige binaarne logi vaatamiseks'; $strSelectFields = 'Vali väljad (vähemalt üks):'; -$strSelectForeignKey = 'Vali võõrvõti(Foreign Key)'; +$strSelectForeignKey = 'Vali võõrvõti(Foreign Key)'; $strSelectNumRows = 'päringus'; $strSelectReferencedKey = 'Vali eelistus võti (referenced key)'; $strSelectTables = 'Vali tabelid'; @@ -681,7 +681,7 @@ $strSent = 'Saadetud'; $strServerChoice = 'Serveri valik'; $strServerNotResponding = 'Server ei vasta'; $strServer = 'Server'; -$strServers = 'Serverid'; +$strServers = 'Serverid'; $strServerStatusDelayedInserts = 'Ajastatud lisamised'; $strServerStatus = 'Jooksev informatsioon'; $strServerStatusUptime = 'See MySQL server on käinud %s. Käivitusaeg %s.'; @@ -698,9 +698,9 @@ $strShowFullQueries = 'Näita täispikkasid päringuid'; $strShowGrid = 'Näita võrgustiku'; $strShowHideLeftMenu = 'Näita/Peida vasak menüü'; $strShowingBookmark = 'Näitan järjehoidjat'; -$strShowingPhp = 'Näitan PHP koodina'; +$strShowingPhp = 'Näitan PHP koodina'; $strShowingRecords = 'Näita ridu'; -$strShowingSQL = 'Näitan SQL päringut'; +$strShowingSQL = 'Näitan SQL päringut'; $strShow = 'Näita'; $strShowOpenTables = 'Näita avatud tabeleid'; $strShowPHPInfo = 'Näita PHP informatsiooni'; @@ -822,7 +822,7 @@ $strSize = 'Suurus'; $strSkipQueries = 'Käske (päringuid) mida algusest vahele jätta'; $strSlovak = 'Slovaki'; $strSlovenian = 'Sloveenia'; -$strSmallBigAll = 'Kõik Väikeseks/Suureks'; +$strSmallBigAll = 'Kõik Väikeseks/Suureks'; $strSocketProblem = '(või kohaliku MySQL serveri soketid ei ole korrektselt seadistatud)'; $strSortByKey = 'Sorteeri võtme järgi'; $strSorting = 'Järjestamine'; @@ -855,7 +855,7 @@ $strStrucExcelCSV = 'CSV MS Exceli jaoks'; $strStrucNativeExcel = 'Loomulikud MS Exceli andmed'; $strStrucOnly = 'Ainult struktuur'; $strStructPropose = 'Soovita tabeli struktuuri'; -$strStructureForView = 'Vaate (view) struktuur'; +$strStructureForView = 'Vaate (view) struktuur'; $strStructure = 'Struktuur'; $strSubmit = 'Vali'; $strSuccess = 'Teie SQL päring täideti edukalt'; @@ -870,9 +870,9 @@ $strTableEmpty = 'Tabeli nimi on tühi!'; $strTableHasBeenDropped = 'Tabel %s kustutatud'; $strTableHasBeenEmptied = 'Tabel %s tühjendatud'; $strTableHasBeenFlushed = 'Tabel %s ühtlustatud'; -$strTableIsEmpty = 'Tabel tundub olevat tühi!'; +$strTableIsEmpty = 'Tabel tundub olevat tühi!'; $strTableMaintenance = 'Tabeli hooldus'; -$strTableName = 'Tabeli nimi'; +$strTableName = 'Tabeli nimi'; $strTableOfContents = 'Sisukord'; $strTableOptions = 'Tabeli seaded'; $strTables = '%s tabel(it)'; @@ -896,7 +896,7 @@ $strTime = 'Aeg'; $strTimeoutInfo = 'Eelmine Import aegus, peale uuesti postitamist jätkub asukohast %d.'; $strTimeoutNothingParsed = 'Kuigi viimasel laadimisel andmeid ei töödeldud, see tähendab enamasti et phpMyAdmin pole võimeline Importi lõpetama, kui sa php skripti aega ei pikenda.'; $strTimeoutPassed = 'Skripti ajalimiit on ületatud, kui soovid importimist jätkata, palun lae sama fail uuesti ja import jätkub.'; -$strToFromPage = 'Kuhu/Kust leht'; +$strToFromPage = 'Kuhu/Kust leht'; $strToggleScratchboard = 'vaheta märkmetahvlit'; $strToSelectRelation = 'Et valida suhe, kliki :'; $strTotal = 'kokku'; @@ -910,7 +910,7 @@ $strTransformation_application_octetstream__hex = 'Kuvab andmed kuueteistkümnen $strTransformation_image_jpeg__inline = 'Kuvab lingitud väikepildi; seaded: laius,kõrgus pikslites (hoiab alles originaalpildi laiuse-kõrguse suhte)'; $strTransformation_image_jpeg__link = 'Kuvab lingi sellele pildile (otsene binaarne allalaadimine, jne.).'; $strTransformation_image_png__inline = 'Vaata image/jpeg: inline'; -$strTransformation_text_plain__dateformat = 'Näitab TIME, TIMESTAMP, DATETIME või numbrilist unix´i ajatempli välja formaaditud kuupäevana. Esimene valik on ajanihe (tundides) mis lisatakse ajatemplile (Vaikimisi: 0). Kasuta teist valikut et täpsustada kuupäeva formaat. Kolmas valik annab valida kas kuupäev kasutab kohalikku aega või UTC oma (kasuta "local" (kohalik) või "utc" stringe). Sellest tulenevalt, kuupäeva formaadil on teine väärtus - "local" väärtuse täpsustamiseks vaata dokumentatsiooni PHP strftime() funktsiooni kasutamise kohta ja kasutades "utc" vaata gmdate() funtsiooni kasutamist.'; +$strTransformation_text_plain__dateformat = 'Näitab TIME, TIMESTAMP, DATETIME või numbrilist unix´i ajatempli välja formaaditud kuupäevana. Esimene valik on ajanihe (tundides) mis lisatakse ajatemplile (Vaikimisi: 0). Kasuta teist valikut et täpsustada kuupäeva formaat. Kolmas valik annab valida kas kuupäev kasutab kohalikku aega või UTC oma (kasuta "local" (kohalik) või "utc" stringe). Sellest tulenevalt, kuupäeva formaadil on teine väärtus - "local" väärtuse täpsustamiseks vaata dokumentatsiooni PHP strftime() funktsiooni kasutamise kohta ja kasutades "utc" vaata gmdate() funtsiooni kasutamist.'; $strTransformation_text_plain__external = 'AINULT LINUXILE: Käivitab välise aplikatsiooni ja annab talle standard sisendisse ette välja sisu. Tagastab aplikatsiooni standard väljundi. Vaikimisi on selleks Tidy, et kuvada ilusti formaaditud HTML koodi. Turvariskide maandamiseks peate te käsitsi muutma faili libraries/transformations/text_plain__external.inc.php ja lisama sinna programmid mida te lasete käivitada. Esimene seade on siis kasutatava programmi number, teine seade on programmi parameetrid. Kui kolmas seade on 1 siis töödeldakse väljund funktsiooniga htmlspecialchars() (vaikimisi 1). Kui neljas seade on 1 pannakse NOWRAP sisu lahtrile nii, et kogu väljund kuvatakse ilma formaati muutmata(vaikimisi 1)'; $strTransformation_text_plain__formatted = 'Hoiab alles originaalset välja formaati. Ei varjestata.'; $strTransformation_text_plain__imagelink = 'Kuvab pildi ja lingi, väli sisaldab failinime; esimene seade on eelnev tekst nagu "http://domain.com/", teine seade on laius pikslites, kolmas on kõrgus.'; @@ -934,7 +934,7 @@ $strUpdateQuery = 'Uuenda päringut'; $strUpdComTab = 'Please see Documentation on how to update your Column_comments Table'; $strUpgrade = 'Te peaksite uuendama %s -i versioonini %s või uuemaks.'; $strUploadLimit = 'Te kindlasti proovisite laadida liiga suurt faili. Palun uuri dokumentatsiooni %sdocumentation%s selle limiidi seadmiseks.'; -$strUploadsNotAllowed = 'Faile pole lubatud laadida sellesse serverisse.'; +$strUploadsNotAllowed = 'Faile pole lubatud laadida sellesse serverisse.'; $strUsage = 'Kasutus'; $strUseBackquotes = 'Kasutage tagurpidi kaldkriipse tabelites või tabelinimedes'; $strUseHostTable = 'Kasuta host tabelit'; @@ -1471,4 +1471,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/finnish-utf-8.inc.php b/lang/finnish-utf-8.inc.php index 403a2e91c..913dcdce7 100644 --- a/lang/finnish-utf-8.inc.php +++ b/lang/finnish-utf-8.inc.php @@ -1466,4 +1466,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/french-utf-8.inc.php b/lang/french-utf-8.inc.php index e1408233d..8c412fd62 100644 --- a/lang/french-utf-8.inc.php +++ b/lang/french-utf-8.inc.php @@ -335,7 +335,7 @@ $strFunctions = 'Fonctions'; $strGenBy = 'Généré par'; $strGeneralRelationFeat = 'Fonctions relationnelles'; -$strGenerate = 'Générer'; +$strGenerate = 'Générer'; $strGeneratePassword = 'Générer un mot de passe'; $strGenTime = 'Généré le '; $strGeorgian = 'géorgien'; @@ -383,7 +383,7 @@ $strImportProceedingFile = 'Le fichier est en traitement, veuillez patienter.'; $strImportSuccessfullyFinished = 'L\'importation s\'est terminée avec succès, %d requêtes exécutées.'; $strImportUploadInfoNotAvailable = 'Veuillez patienter, le fichier est téléchargé; les détails sur le chargement ne sont pas disponibles.'; $strIndexes = 'Index'; -$strIndexesSeemEqual = 'Les index %1$s et %2$s semblent identiques et l\'un d\'eux pourrait être supprimé.'; +$strIndexesSeemEqual = 'Les index %1$s et %2$s semblent identiques et l\'un d\'eux pourrait être supprimé.'; $strIndexHasBeenDropped = 'L\'index %s a été effacé'; $strIndex = 'Index'; $strIndexName = 'Nom de l\'index :'; @@ -471,7 +471,7 @@ $strLongOperation = 'Cette opération pourrait être longue. Procéder quand mê $strMaxConnects = 'max. de connexions simultanées'; $strMaximalQueryLength = 'Taille maximum de la requête générée'; $strMaximumSize = 'Taille maximum: %s%s'; -$strMbExtensionMissing = 'L\'extension PHP mbstring n\'a pu être localisée et il semble que vous utilisiez un jeu de caractères multi-octets. Sans cette extension, phpMyAdmin est incapable de gérer correctement les caractères et il peut en résulter des problèmes.'; +$strMbExtensionMissing = 'L\'extension PHP mbstring n\'a pu être localisée et il semble que vous utilisiez un jeu de caractères multi-octets. Sans cette extension, phpMyAdmin est incapable de gérer correctement les caractères et il peut en résulter des problèmes.'; $strMbOverloadWarning = 'Vous avez activé mbstring.func_overload dans votre configuration PHP. Cette option est incompatible avec phpMyAdmin et peut nuire au traitement des données!'; $strMIME_available_mime = 'Types MIME disponibles'; $strMIME_available_transform = 'Transformations disponibles'; @@ -798,7 +798,7 @@ $strSessionValue = 'Valeur pour la session'; $strSetEnumVal = 'Les différentes valeurs des champs de type enum/set sont à spécifier sous la forme \'a\',\'b\',\'c\'...
    Pour utiliser un caractère "\\" ou "\'" dans l\'une de ces valeurs, faites-le précéder du caractère d\'échappement "\\" (par exemple \'\\\\xyz\' ou \'a\\\'b\').'; $strSetupAllowAnywhereRecoding_name = 'Active la conversion des caractères'; $strSetupAllowArbitraryServer_desc = 'Si activé, permet d\'entrer un nom de serveur MySQL sur le panneau de connexion (mode "cookie")'; -$strSetupAllowArbitraryServerMsg = 'Cette [a@?page=form&formset=features#tab_Security]option[/a] ne devrait pas être activée car elle permet à un attaquant de tenter de forcer l\'entrée sur tout serveur MySQL. Si vous en avez réellement besoin, utilisez [a@?page=form&formset=features#tab_Security]la liste des serveurs mandataires de confiance[/a].'; +$strSetupAllowArbitraryServerMsg = 'Cette [a@?page=form&formset=features#tab_Security]option[/a] ne devrait pas être activée car elle permet à un attaquant de tenter de forcer l\'entrée sur tout serveur MySQL. Si vous en avez réellement besoin, utilisez [a@?page=form&formset=features#tab_Security]la liste des serveurs mandataires de confiance[/a].'; $strSetupAllowArbitraryServer_name = 'Permettre de tenter une connexion à tout serveur MySQL'; $strSetupAllowUserDropDatabase_name = 'Montrer le lien pour détruire une base de données aux utilisateurs ordinaires'; $strSetupBlowfishSecretCharsMsg = 'La clé devrait contenir des lettres, des nombres et des caractères spéciaux'; @@ -810,12 +810,12 @@ $strSetupBrowseMarkerEnable_desc = '(utilisé quand on clique sur une ligne)'; $strSetupBrowseMarkerEnable_name = 'Activer le marqueur d\'enregistrements'; $strSetupBrowsePointerEnable_desc = ''; $strSetupBrowsePointerEnable_name = 'Activer le pointeur de surbrillance'; -$strSetupBZipDump_desc = 'Active la compression [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] pour les opérations d\'importation et d\'exportation'; +$strSetupBZipDump_desc = 'Active la compression [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] pour les opérations d\'importation et d\'exportation'; $strSetupBZipDump_name = 'Bzip2'; $strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]La compression et décompression Bzip2[/a] requièrent des fonctions (%s) non disponibles sur ce serveur.'; $strSetupCannotLoadConfig = 'Impossible de charger ou sauvegarder la configuration'; $strSetupCannotLoadConfigMsg = 'Veuillez créer le répertoire [em]config[/em] accessible en écriture tel que décrit sur [a@../Documentation.html#setup_script]documentation[/a]. Sinon vous ne pourrez que télécharger ou afficher la configuration.'; -$strSetupCharEditing_desc = 'Déterminer la méthode d\'édition pour les colonnes CHAR et VARCHAR; [kbd]input[/kbd] - permet de limiter la taille, [kbd]textarea[/kbd] - permet la saisie de sauts de lignes'; +$strSetupCharEditing_desc = 'Déterminer la méthode d\'édition pour les colonnes CHAR et VARCHAR; [kbd]input[/kbd] - permet de limiter la taille, [kbd]textarea[/kbd] - permet la saisie de sauts de lignes'; $strSetupCharEditing_name = 'Édition des colonnes CHAR'; $strSetupCharTextareaCols_desc = '(colonnes CHAR/VARCHAR)'; $strSetupCharTextareaCols_name = 'Taille horizontale pour un "textarea"'; @@ -874,9 +874,9 @@ $strSetupExport_onserver_overwrite_name = 'Écraser un fichier existant'; $strSetupExport_remember_file_template_name = 'Se souvenir du modèle de nom de fichier'; $strSetupFalse = 'non'; $strSetupForceSSL_desc = 'Force des connexions https entre le navigateur et phpMyAdmin'; -$strSetupForceSSLMsg = 'Cette [a@?page=form&formset=features#tab_Security]option[/a] doit être activée si votre serveur la supporte.'; +$strSetupForceSSLMsg = 'Cette [a@?page=form&formset=features#tab_Security]option[/a] doit être activée si votre serveur la supporte.'; $strSetupForceSSL_name = 'Forcer les connexions SSL'; -$strSetupForeignKeyDropdownOrder_desc = '[kbd]content[/kbd] signifie la donnée référencée, [kbd]id[/kbd] représente la valeur de la clé'; +$strSetupForeignKeyDropdownOrder_desc = '[kbd]content[/kbd] signifie la donnée référencée, [kbd]id[/kbd] représente la valeur de la clé'; $strSetupForeignKeyDropdownOrder_name = 'Ordre dans le menu des clés étrangères'; $strSetupForeignKeyMaxLimit_desc = 'Un menu déroulant sera utilisé si le nombre de valeurs est inférieur à cette limite'; $strSetupForeignKeyMaxLimit_name = 'Limite pour clé étrangère'; @@ -927,7 +927,7 @@ $strSetupForm_Startup_desc = 'Personnaliser la page de départ'; $strSetupForm_Startup = 'Page de départ'; $strSetupForm_Tabs_desc = 'Personnaliser les onglets'; $strSetupForm_Tabs = 'Onglets'; -$strSetupGZipDump_desc = 'Active la compression [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] pour les opérations d\'importation et d\'exportation'; +$strSetupGZipDump_desc = 'Active la compression [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] pour les opérations d\'importation et d\'exportation'; $strSetupGZipDump_name = 'GZip'; $strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]La compression et décompression GZip[/a] requièrent des fonctions (%s) non disponibles sur ce serveur.'; $strSetupHomepageLink = 'Site de phpMyAdmin'; @@ -980,7 +980,7 @@ $strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]L $strSetupLoginCookieValidity_name = 'Durée de validité de la connexion (mode "cookie")'; $strSetupMaxCharactersInDisplayedSQL_desc = '...en nombre de caractères'; $strSetupMaxCharactersInDisplayedSQL_name = 'Taille maximum des requêtes SQL affichées'; -$strSetupMaxDbList_desc = '...affichées dans le panneau de gauche et la liste des bases'; +$strSetupMaxDbList_desc = '...affichées dans le panneau de gauche et la liste des bases'; $strSetupMaxDbList_name = 'Nombre maximum de bases de données'; $strSetupMaxRows_desc = ''; $strSetupMaxRows_name = 'Nombre maximum d\'enregistrements à afficher'; @@ -1047,7 +1047,7 @@ $strSetupServers_designer_coords_desc = 'Laisser vider pour désactiver, suggér $strSetupServers_designer_coords_name = 'Table pour "concepteur"'; $strSetupServers_DisableIS_desc = 'Voir [a@http://sf.net/support/tracker.php?aid=1849494]ce bogue phpMyAdmin[/a] et [a@http://bugs.mysql.com/19588]ce bogue MySQL[/a]'; $strSetupServers_DisableIS_name = 'Empêcher l\'accès à INFORMATION_SCHEMA'; -$strSetupServerSecurityInfoMsg = 'Si vous l\'estimez nécessaire, utilisez des réglages de protection - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]authentification du serveur[/a] et [a@?page=form&formset=features#tab_Security]serveurs mandataires de confiance[/a].'; +$strSetupServerSecurityInfoMsg = 'Si vous l\'estimez nécessaire, utilisez des réglages de protection - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]authentification du serveur[/a] et [a@?page=form&formset=features#tab_Security]serveurs mandataires de confiance[/a].'; $strSetupServersEdit = 'Modifier serveur'; $strSetupServers_extension_desc = 'Quelle extension PHP utiliser (prenez mysqli si possible)'; $strSetupServers_extension_name = 'Extension PHP'; @@ -1060,7 +1060,7 @@ $strSetupServers_host_name = 'Nom du serveur'; $strSetupServers_LogoutURL_name = 'URL pour quitter'; $strSetupServers_nopassword_desc = 'Essayer de se connecter sans mot de passe'; $strSetupServers_nopassword_name = 'Connexion sans mot de passe'; -$strSetupServers_only_db_desc = 'Vous pouvez utiliser ces caractères passepartout (% et _), avec un caractère d\'échappement si vous les employez de manière littérale ("ma\_base" et non "ma_base")'; +$strSetupServers_only_db_desc = 'Vous pouvez utiliser ces caractères passepartout (% et _), avec un caractère d\'échappement si vous les employez de manière littérale ("ma\_base" et non "ma_base")'; $strSetupServers_only_db_name = 'Restreindre la liste des bases de données'; $strSetupServers_password_desc = 'Laisser vide si vous n\'utilisez pas la méthode d\'authentification "config"'; $strSetupServers_password_name = 'Mot de passe pour méthode "config"'; @@ -1072,7 +1072,7 @@ $strSetupServers_port_desc = 'Port sur lequel MySQL est en écoute, laisser vide $strSetupServers_port_name = 'Port'; $strSetupServers_relation_desc = 'Laisser vider pour désactiver le support [a@http://wiki.phpmyadmin.net/pma/relation]relationnel[/a], suggéré : [kbd]pma_relation[/kbd]'; $strSetupServers_relation_name = 'Table relationnelle'; -$strSetupServers_ShowDatabasesCommand_desc = 'La commande SQL à utiliser pour acquérir la liste des bases de données'; +$strSetupServers_ShowDatabasesCommand_desc = 'La commande SQL à utiliser pour acquérir la liste des bases de données'; $strSetupServers_ShowDatabasesCommand_name = 'Commande SHOW DATABASES'; $strSetupServers_SignonSession_desc = 'Voir [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] pour un exemple'; $strSetupServers_SignonSession_name = 'Nom de session pour méthode "signon"'; @@ -1261,13 +1261,13 @@ $strShowStatusSlave_retried_transactionsDescr = 'Nombre de fois (depuis le déma $strShowStatusSlave_runningDescr = 'Ceci est à ON si ce serveur est un esclave connecté à un maître.'; $strShowStatusSlow_launch_threadsDescr = 'Le nombre de fils d\'exécution dont le temps de création a excédé slow_launch_time secondes.'; $strShowStatusSlow_queriesDescr = 'Le nombre de requêtes dont le temps d\'exécution a excédé long_query_time secondes.'; -$strShowStatusSort_merge_passesDescr = 'Le nombre d\'opérations de fusion effectuées par l\'algorithme de tri. Si ce nombre est élevé, augmentez la valeur du paramètre sort_buffer_size.'; +$strShowStatusSort_merge_passesDescr = 'Le nombre d\'opérations de fusion effectuées par l\'algorithme de tri. Si ce nombre est élevé, augmentez la valeur du paramètre sort_buffer_size.'; $strShowStatusSort_rangeDescr = 'Le nombre de tri effectués avec des plages.'; $strShowStatusSort_rowsDescr = 'Le nombre d\'enregistrements triés.'; $strShowStatusSort_scanDescr = 'Le nombre de tri effectués via un parcours de la table.'; $strShowStatusTable_locks_immediateDescr = 'Le nombre de fois qu\'un verrou de table a été acquis immédiatement.'; $strShowStatusTable_locks_waitedDescr = 'Le nombre de fois qu\'un verrou de table n\'a pu être acquis immédiatement, induisant un temps d\'attente. Si ce nombre est élevé et que vous éprouvez des problèmes de performance, commencez par optimiser vos requêtes, puis subdivisez vos tables ou encore utiliser la réplication.'; -$strShowStatusThreads_cachedDescr = 'Le nombre de fils dans la cache des fils d\'exécution. Si cette valeur est en rouge, vous devriez augmenter la taille de cette cache.'; +$strShowStatusThreads_cachedDescr = 'Le nombre de fils dans la cache des fils d\'exécution. Si cette valeur est en rouge, vous devriez augmenter la taille de cette cache.'; $strShowStatusThreads_connectedDescr = 'Le nombre de connexions ouvertes actuellement.'; $strShowStatusThreads_createdDescr = 'Le nombre de fils d\'exécution créés afin de gérer les connexions. Si ce nombre est trop grand, vous pourriez augmenter la valeur du paramètre thread_cache_size. (Normalement, ceci ne procure pas une amélioration perceptible de la performance si votre serveur gère correctement les fils d\'exécution.'; $strShowStatusThreads_runningDescr = 'Le nombre de fils d\'exécution non suspendus.'; @@ -1462,4 +1462,81 @@ $strYes = 'Oui'; $strZeroRemovesTheLimit = 'Note: Une valeur de 0 (zero) enlève la limite.'; $strZip = '"zippé"'; +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/galician-utf-8.inc.php b/lang/galician-utf-8.inc.php index 116d2a677..ec1e948a6 100644 --- a/lang/galician-utf-8.inc.php +++ b/lang/galician-utf-8.inc.php @@ -1464,4 +1464,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/georgian-utf-8.inc.php b/lang/georgian-utf-8.inc.php index 0a39cd1d2..8e0eeb14c 100644 --- a/lang/georgian-utf-8.inc.php +++ b/lang/georgian-utf-8.inc.php @@ -1470,4 +1470,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/german-utf-8.inc.php b/lang/german-utf-8.inc.php index ec15ac6c9..8ba62d729 100644 --- a/lang/german-utf-8.inc.php +++ b/lang/german-utf-8.inc.php @@ -91,6 +91,18 @@ $strBinLogName = 'Protokoll'; $strBinLogOriginalPosition = 'Ursprungsposition'; $strBinLogPosition = 'Position'; $strBinLogServerId = 'Server-ID'; +$strBLOBRepository = 'BLOB-Repository'; +$strBLOBRepositoryDamaged = 'Beschädigt'; +$strBLOBRepositoryDisableAreYouSure = 'Wirklich alle BLOB-Referenzen für Datenbank %s deaktivieren?'; +$strBLOBRepositoryDisabled = 'Deaktiviert'; +$strBLOBRepositoryDisable = 'Deaktivieren'; +$strBLOBRepositoryDisableStrongWarning = 'Sie sind dabei ein BLOB-Repository zu deaktivieren!'; +$strBLOBRepositoryEnable = 'Aktivieren'; +$strBLOBRepositoryEnabled = 'Aktiviert'; +$strBLOBRepositoryRemove = 'BLOB-Referenz entfernen'; +$strBLOBRepositoryRepair = 'Reparieren'; +$strBLOBRepositoryStatus = 'Status'; +$strBLOBRepositoryUpload = 'Zu BLOB-Repository hochladen'; $strBookmarkAllUsers = 'Diese gespeicherte SQL-Abfrage für jeden Benutzer verfügbar machen'; $strBookmarkCreated = 'Bookmark %s wurde gespeichert'; $strBookmarkDeleted = 'SQL-Abfrage wurde gelöscht.'; @@ -126,6 +138,26 @@ $strCardinality = 'Kardinalität'; $strCaseInsensitive = 'case-insensitive'; $strCaseSensitive = 'case-sensitive'; $strCentralEuropean = 'Mitteleuropäisch'; +$strChange = 'Ändern'; +$strChangeCopyModeCopy = ' ... behalte den alten bei.'; +$strChangeCopyModeDeleteAndReload = ' ... lösche den alten und lade anschließend die Benutzertabellen neu.'; +$strChangeCopyMode = 'Erstelle einen neuen Benutzer mit identischen Rechten und ...'; +$strChangeCopyModeJustDelete = ' ... lösche den alten von den Benutzertabellen.'; +$strChangeCopyModeRevoke = ' ... entziehe dem alten alle Rechte und lösche ihn anschließend.'; +$strChangeCopyUser = 'Anmelde-Information ändern / Benutzer kopieren'; +$strChangeDisplay = 'Anzuzeigende Spalte bestimmen'; +$strChangePassword = 'Passwort ändern'; +$strCharsetOfFile = 'Zeichencodierung der Datei:'; +$strCharsetsAndCollations = 'Zeichensätze und Kollationen'; +$strCharsets = 'Zeichensätze'; +$strCharset = 'Zeichensatz'; +$strCheckAll = 'Alle auswählen'; +$strCheckOverhead = 'Tabellen m. Überhang ausw.'; +$strCheckPrivsLong = 'Überprüft die Rechte für die Datenbank "%s".'; +$strCheckPrivs = 'Rechte überprüfen'; +$strCheckTable = 'Überprüfe Tabelle'; +$strCheck = 'Überprüfen'; +$strChoosePage = 'Bitte wählen Sie die zu bearbeitende Seite.'; $strColComFeat = 'Darstellung von Spaltenkommentaren'; $strCollation = 'Kollation'; $strColumnNames = 'Spaltennamen'; @@ -175,26 +207,6 @@ $strCustomColor = 'Benutzerdefinierte Farbe'; $strCyrillic = 'Kyrillisch'; $strCzechSlovak = 'Tschechoslowakisch'; $strCzech = 'Tschechisch'; -$strChange = 'Ändern'; -$strChangeCopyModeCopy = ' ... behalte den alten bei.'; -$strChangeCopyModeDeleteAndReload = ' ... lösche den alten und lade anschließend die Benutzertabellen neu.'; -$strChangeCopyMode = 'Erstelle einen neuen Benutzer mit identischen Rechten und ...'; -$strChangeCopyModeJustDelete = ' ... lösche den alten von den Benutzertabellen.'; -$strChangeCopyModeRevoke = ' ... entziehe dem alten alle Rechte und lösche ihn anschließend.'; -$strChangeCopyUser = 'Anmelde-Information ändern / Benutzer kopieren'; -$strChangeDisplay = 'Anzuzeigende Spalte bestimmen'; -$strChangePassword = 'Passwort ändern'; -$strCharsetOfFile = 'Zeichencodierung der Datei:'; -$strCharsetsAndCollations = 'Zeichensätze und Kollationen'; -$strCharsets = 'Zeichensätze'; -$strCharset = 'Zeichensatz'; -$strCheckAll = 'Alle auswählen'; -$strCheckOverhead = 'Tabellen m. Überhang ausw.'; -$strCheckPrivsLong = 'Überprüft die Rechte für die Datenbank "%s".'; -$strCheckPrivs = 'Rechte überprüfen'; -$strCheckTable = 'Überprüfe Tabelle'; -$strCheck = 'Überprüfen'; -$strChoosePage = 'Bitte wählen Sie die zu bearbeitende Seite.'; $strDanish = 'Dänisch'; $strDatabase = 'Datenbank'; @@ -285,10 +297,12 @@ $strEscapeWildcards = 'Platzhalter _ und % sollten mit einem \ escaped werden, u $strEsperanto = 'Esperanto'; $strEstonian = 'Estnisch'; $strEvent = 'Ereignis'; +$strEvents = 'Ereignisse'; $strExcelEdition = 'Excel-Ausgabe'; $strExecuteBookmarked = 'Gespeicherte SQL-Anfrage ausführen'; $strExplain = 'SQL erklären'; $strExport = 'Exportieren'; +$strExportImportToScale = 'Export/Import skalieren'; $strExportMustBeFile = 'Der gewählte Export-Typ kann nur als Datei exportiert werden!'; $strExtendedInserts = 'Erweiterte \'INSERT\'s'; $strExtra = 'Extra'; @@ -317,6 +331,7 @@ $strFlushTable = 'Leeren des Tabellencaches ("FLUSH")'; $strFlushTables = 'Den Tabellencache leeren ("FLUSH")'; $strFontSize = 'Schriftgröße'; $strForeignKeyError = 'Fehler beim Erzeugen eines Fremdschlüssels für %1$s (überprüfen Sie die Datentypen)'; +$strForeignKeyRelationAdded = 'FOREIGN KEY Relation hinzugefügt'; $strFormat = 'Format'; $strFormEmpty = 'Das Formular ist leer !'; $strFreePages = 'Unbenutzte Seiten'; @@ -331,6 +346,7 @@ $strGeneratePassword = 'Passwort generieren'; $strGenTime = 'Erstellungszeit'; $strGeorgian = 'Georgisch'; $strGerman = 'Deutsch'; +$strGetMoreThemes = 'Mehr Designs herunterladen!'; $strGlobal = 'global'; $strGlobalPrivileges = 'Globale Rechte'; $strGlobalValue = 'Globaler Wert'; @@ -352,6 +368,7 @@ $strHome = 'Home'; $strHomepageOfficial = ' Offizielle Homepage '; $strHostEmpty = 'Es wurde kein Host angegeben!'; $strHost = 'Host'; +$strHostTableExplanation = 'Wenn die Host-Tabelle aktiv ist, wird dieses Feld ignoriert und stattdessen die Werte aus der Host-Tabelle verwendet.'; $strHTMLExcel = 'Microsoft Excel 2000'; $strHTMLWord = 'Microsoft Word 2000'; $strHungarian = 'Ungarisch'; @@ -389,6 +406,7 @@ $strInsertAsNewRow = ' Als neuen Datensatz speichern '; $strInsertedRowId = 'ID der eingefügten Zeile: %1$d'; $strInsert = 'Einfügen'; $strInterface = 'Oberfläche'; +$strInternalAndForeign = 'Eine interne Beziehung ist nicht notwendig, wenn bereits ein entsprechender FOREIGN KEY existiert.'; $strInternalRelationAdded = 'Interne Verknüpfung hinzugefügt'; $strInternalRelations = 'Interne Beziehungen'; $strInUse = 'in Benutzung'; @@ -423,6 +441,7 @@ $strKorean = 'Koreanisch'; $strLandscape = 'Querformat'; $strLanguage = 'Sprache'; $strLanguageUnknown = 'Unbekannte Sprache: "%1$s".'; +$strLatchedPages = 'Belegte Seiten'; $strLatexCaption = 'Tabellenbeschriftung'; $strLatexContent = 'Inhalt der Tabelle __TABLE__'; $strLatexContinuedCaption = 'Fortgesetzte Tabellenbeschriftung'; @@ -431,7 +450,6 @@ $strLatexIncludeCaption = 'Tabellenbeschriftung einfügen'; $strLatexLabel = 'Kennzeichen'; $strLaTeX = 'LaTeX'; $strLatexStructure = 'Struktur der Tabelle __TABLE__'; -$strLatchedPages = 'Belegte Seiten'; $strLatvian = 'Lettisch'; $strLDI = 'CSV mit LOAD DATA'; $strLDILocal = 'verwende LOCAL'; @@ -445,6 +463,7 @@ $strLocalhost = 'Lokal'; $strLocationTextfile = 'Datei'; $strLogin = 'Anmeldung'; $strLoginInformation = 'Anmelde-Informationen'; +$strLoginWithoutPassword = 'Login ohne Passwort ist verboten (siehe AllowNoPassword in der Konfiguration)'; $strLogout = 'Neu anmelden'; $strLogPassword = 'Passwort:'; $strLogServerHelp = 'Sie können einen Rechnernamen oder eine IP Adresse und einen Port durch Leerzeichen getrennt eingeben.'; @@ -488,9 +507,9 @@ $strMyISAMRepairThreadsDesc = 'Wenn dieser Wert größer als 1 ist, werden MyISA $strMyISAMRepairThreads = 'Reparaturprozess'; $strMyISAMSortBufferSizeDesc = 'Der Puffer, der beim Sortieren des Indexes zugewiesen wird, wenn man ein REPAIR oder ausführt oder Indizes mit CREATE INDEX oder ALTER TABLE erzeugt.'; $strMyISAMSortBufferSize = 'Größe des Sortierungspuffers'; +$strMySQLCharset = 'MySQL-Zeichensatz'; $strMysqlClientVersion = 'MySQL-Client-Version'; $strMySQLConnectionCollation = 'Zeichensatz / Kollation der MySQL-Verbindung'; -$strMySQLCharset = 'MySQL-Zeichensatz'; $strMysqlLibDiffersServerVersion = 'Die Version der verwendeten PHP MySQL Bibliothek %s unterscheidet sich von der Version des MySQL Servers %s. Dies kann zu unerwartetem Verhalten führen.'; $strMySQLSaid = 'MySQL meldet: '; $strMySQLShowProcess = 'Prozesse anzeigen'; @@ -558,11 +577,34 @@ $strPartitionDefinition = 'PARTITION Definition'; $strPartitioned = 'partitioniert'; $strPartitionMaintenance = 'Partitions-Hilfsmittel'; $strPartition = 'Partition %s'; +$strPasswordChanged = 'Das Passwort für %s wurde geändert.'; $strPasswordEmpty = 'Es wurde kein Passwort angegeben!'; $strPasswordHashing = 'Password-Verschlüsselung'; -$strPasswordChanged = 'Das Passwort für %s wurde geändert.'; $strPasswordNotSame = 'Die eingegebenen Passwörter sind nicht identisch!'; $strPassword = 'Passwort'; +$strPBXTCheckpointFrequency = 'Checkpoint-Frequenz'; +$strPBXTCheckpointFrequencyDesc = 'Die Menge an geschriebenen Daten in das Transaktionslog, bevor ein neuer Checkpoint angelegt wird. Die Voreinstellung ist 24 MB.'; +$strPBXTDataFileGrowSize = 'Dateiwachstumsgröße'; +$strPBXTDataFileGrowSizeDesc = 'Die Wachstumsgröße der Handle-Dateien (.xtd)'; +$strPBXTDataLogThreshold = 'Data Log Grenzwert'; +$strPBXTDataLogThresholdDesc = 'Die maximale Größe einer Logdatei. Der Standardwert ist 64 MB. PBXT kann maximal 32000 Logs erzeugen, welche von allen Tabellen genutzt werden. Diese Variable kann erhöht werden um die Menge an Daten, welche in der Datenbank gespeichert werden können zu vergrößern.'; +$strPBXTGarbageThresholdDesc = 'Der Prozentsatz an Müll in einer Logdatei bevor sie komprimiert wird. Der Wert kann zwischen 1 und 99 liegen, Voreinstellung ist 50.'; +$strPBXTGarbageThreshold = 'Müll-Grenzwert'; +$strPBXTIndexCacheSizeDesc = 'Die Menge an reserviertem Speicher für den Index-Cache. Die Voreinstellung ist 32 MB. Der Speicher wird nur zum cachen von Index-Seiten verwendet.'; +$strPBXTIndexCacheSize = 'Index-Cache Größe'; +$strPBXTLogBufferSizeDesc = 'Die Größe des Puffers zum Schreiben von Logdateien. Die Voreinstellung ist 256 MB. Pro Thread wird ein Puffer reserviert, aber nur wenn der Thread Logdateien schreiben können muss.'; +$strPBXTLogBufferSize = 'Log Puffergröße'; +$strPBXTLogCacheSizeDesc = 'Die Menge an reserviertem Speicher für den Transaktionslog. Die Voreinstellung ist 16 MB.'; +$strPBXTLogCacheSize = 'Log-Cache Größe'; +$strPBXTLogFileCountDesc = 'Die Anzahl an Transaktionslogdateien (pbxt/system/xlog*.xt), die vom System verwaltet werden. Sind mehr Logs vorhanden, werden alte Logs gelöscht, ansonsten werden sie umbenannt und bekommen die nächsthöhere Nummer.'; +$strPBXTLogFileCount = 'Log file Anzahl'; +$strPBXTLogFileThresholdDesc = 'Die Größe des Transaktionslog bevor ein Rollover durchgeführt wird und eine neue Logdatei angelegt wird. Die Voreinstellung ist 16 MB.'; +$strPBXTLogFileThreshold = 'Logdatei Grenzwert'; +$strPBXTRecordCacheSizeDesc = 'Die Menge an reserviertem Speicher zum Cachen von Tabellendaten. Die Voreinstellung ist 32 MB. Der Speicher wird verwendet um Änderungen an Handle-Dateien (.xtd) und Row-Pointer-Dateien (.xtr) zu cachen.'; +$strPBXTRowFileGrowSizeDesc = 'Wachstum der Row-Pointer-Dateien (.xtr).'; +$strPBXTRowFileGrowSize = 'Zeilenwachstum'; +$strPBXTTransactionBufferSizeDesc = 'Die Größe des globalen Transaktionslogpuffers (es werden zwei Puffer dieser Größe angelegt. Die Voreinstellung ist 1 MB.'; +$strPBXTTransactionBufferSize = 'Transaktionspuffergröße'; $strPdfDbSchema = 'Schema der Datenbank "%s" - Seite %s'; $strPdfInvalidTblName = 'Die Tabelle "%s" existiert nicht!'; $strPdfNoTables = 'keine Tabellen'; @@ -605,8 +647,8 @@ $strPrivDescDelete = 'Erlaubt das Löschen von Daten.'; $strPrivDescDropDb = 'Erlaubt das Löschen ganzer Datenbanken und Tabellen.'; $strPrivDescDropTbl = 'Erlaubt das Löschen ganzer Tabellen.'; $strPrivDescEvent = 'Erlaubt das Anlegen von Events für den Event-Scheduler'; -$strPrivDescExecute = 'Erlaubt das Ausführen gespeicherter Prozeduren; Hat keinen Effekt in dieser MySQL-Version.'; $strPrivDescExecute5 = 'Erlaubt das Ausführen von Routinen.'; +$strPrivDescExecute = 'Erlaubt das Ausführen gespeicherter Prozeduren; Hat keinen Effekt in dieser MySQL-Version.'; $strPrivDescFile = 'Erlaubt das Importieren von Daten aus und das Exportieren in externe Dateien.'; $strPrivDescGrant = 'Erlaubt das Hinzufügen von Benutzern und Rechten ohne den die Benutzerprofile neu laden zu müssen.'; $strPrivDescIndex = 'Erlaubt das Erstellen und Löschen von Indizes.'; @@ -749,11 +791,247 @@ $strSessionGCWarning = 'Ihre PHP Einstellung [a@http://php.net/manual/en/session $strSessionStartupErrorGeneral = 'Die Sitzung konnte nicht ohne Fehler gestartet werden, schauen Sie bitte in das Fehlerprokoll von PHP und/oder Ihres Webservers und konfigurieren Sie PHP entsprechend (session.save_path, Schreibrechte).'; $strSessionValue = 'Wert für diese Sitzung'; $strSetEnumVal = 'Wenn das Feld vom Typ \'ENUM\' oder \'SET\' ist, benutzen Sie bitte das Format: \'a\',\'b\',\'c\',... Wann immer Sie ein Backslash ("\") oder ein einfaches Anführungszeichen ("\'") verwenden, setzen Sie bitte ein Backslash vor das Zeichen. (z. B.: \'\\\\xyz\' oder \'a\\\'b\').'; +$strSetupAllowAnywhereRecoding_name = 'Zeichensatzkonvertierung erlauben.'; +$strSetupAllowArbitraryServer_desc = 'Wenn aktiv kann ein Benutzer die Adresse eines beliebigen Servers beim Login angeben.'; +$strSetupAllowArbitraryServerMsg = 'Diese [a@?page=form&formset=features#tab_Security]Option[/a]This [a@?page=form&formset=features#tab_Security]option[/a] sollte deaktiviert sein, weil sie Angreifern erlaubt Bruteforce-Attacken auf beliebige (auch fremde) MySQL-Servern durchzuführen. Wenn Sie der Meinung sind, dass diese Option unbedingt notwendig ist, sollten Sie die [a@?page=form&formset=features#tab_Security]trusted proxy list[/a] verwenden. IP-basierte Regeln sind aber nie wirklich ausreichend.'; +$strSetupAllowArbitraryServer_name = 'Login zu beliebigen MySQL-Server erlauben.'; +$strSetupAllowUserDropDatabase_name = '"Drop Database" normalen Benutzern anzeigen.'; +$strSetupBlowfishSecretCharsMsg = 'Schlüssel sollte Buchstaben, Ziffern [em]und[/em] Sonderzeichen enthalten.'; +$strSetupblowfish_secret_desc = 'Geheime Passphrase zum Verschlüsseln der Cookies bei [kbd]cookie[/kbd]-Authentisierung'; +$strSetupBlowfishSecretLengthMsg = 'Schlüssel ist zu kurz, er muss mindestens 8 Zeichen lang sein.'; +$strSetupBlowfishSecretMsg = 'Sie hatten keinen Blowfish-Schlüssel angegeben, aber cookie-Authentisierung aktiviert, deshalb wurde ein Schlüssel automatisch erzeugt. Er wird zum Verschlüsseln der Cookies verwendet und muss nicht gemerkt werden.'; +$strSetupblowfish_secret_name = 'Blowfish-Schlüssel'; +$strSetupBrowseMarkerEnable_desc = 'Markierte Zeilen hervorheben'; +$strSetupBrowseMarkerEnable_name = 'Zeilenmarker'; +$strSetupBrowsePointerEnable_desc = 'Zeile unter Mauscursor hervorheben'; +$strSetupBrowsePointerEnable_name = 'Cursor hervorheben'; +$strSetupBZipDump_desc = '[a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a]-Kompression für Import und Export aktivieren.'; +$strSetupBZipDump_name = 'Bzip2'; +$strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]Bzip2-Kompression und Dekompression[/a] benötigt Funktionen (%s), welche auf diesem System nicht verfügbar sind.'; +$strSetupCannotLoadConfig = 'Laden oder Speichern der Konfiguration fehlgeschlagen.'; +$strSetupCannotLoadConfigMsg = 'Bitte erstellen Sie den Ordner [em]config[/em] im phpMyAdmin-Verzeichnis, und setzen Sie der Berechtigungen entsprechend. Ansonsten können Sie die Konfiguration nur herunterladen bzw. anzeigen.'; +$strSetupCharEditing_desc = 'Definiert welcher Widgettyp zum Editieren von CHAR und VARCHAR-Feldern verwendet werden soll. [kbd]input[/kbd] - erlaubt das limitieren der Eingabelänge, [kbd]textarea[/kbd] - erlaubt Zeilenumbrüche in Feldern'; +$strSetupCharEditing_name = 'Bearbeitung von CHAR-Felder'; +$strSetupCharTextareaCols_desc = 'Spaltenanzahl der CHAR/VARCHAR-Textfelder'; +$strSetupCharTextareaCols_name = 'CHAR Textfeldspalten'; +$strSetupCharTextareaRows_desc = 'Zeilenanzahl der CHAR/VARCHAR-Textfelder'; +$strSetupCharTextareaRows_name = 'CHAR Textfeldzeilen'; +$strSetupCheckConfigurationPermissions_name = 'Configfile-Berechtigungen überprüfen'; +$strSetupClear = 'Werte löschen'; +$strSetupCompressOnFly_desc = 'gzip/bzip2 beim Exportieren verwenden ohne viel Speicher zu benötigen. Sollten Probleme mit komprimierten Dateien auftreten, ist diese Option zu deaktivieren.'; +$strSetupCompressOnFly_name = 'On the fly komprimieren'; +$strSetupConfigurationFile = 'Konfigurationsdatei'; +$strSetupConfirm_desc = 'Warnung ("Sind Sie wirklich sicher …") anzeigen, wenn Dateien verloren gehen könnten.'; +$strSetupConfirm_name = 'Nachfrage bei DROP-queries'; +$strSetupDefaultCharset_desc = 'Standardzeichensatz bei Konvertierung'; +$strSetupDefaultCharset_name = 'Standardzeichensatz'; +$strSetupDefaultLanguage = 'Voreingestellte Sprache'; +$strSetupDefaultServer = 'Standardserver'; +$strSetupDefaultTabDatabase_desc = 'Angezeigter Reiter beim Öffnen einer Datenbank'; +$strSetupDefaultTabDatabase_name = 'Standardtab bei Datenbanken'; +$strSetupDefaultTabServer_desc = 'Angezeigter Reiter beim Öffnen eines Servers'; +$strSetupDefaultTabServer_name = 'Standardtab bei Servern'; +$strSetupDefaultTabTable_desc = 'Angezeigter Reiter beim Öffnen einer Tabelle'; +$strSetupDefaultTabTable_name = 'Standardtab bei Tabellen'; +$strSetupDirectoryNotice = 'Diese Variable sollte sorgfältig geprüft wrden. Das angegebene Verzeichnis darf nicht von außen gelesen werden und andere Benutzer des Servers sollen keine Schreibrechte haben.'; +$strSetupDisplay = 'Anzeige'; +$strSetupDisplayDatabasesList_desc = 'Datenbanken als Liste statt Dropdownfeld anzeigen'; +$strSetupDisplayDatabasesList_name = 'Datenbanken als Liste anzeigen'; +$strSetupDisplayServersList_desc = 'Server als Liste statt Dropdownfeld anzeigen'; +$strSetupDisplayServersList_name = 'Server als Liste anzeigen'; +$strSetupDonateLink = 'Spenden'; +$strSetupDownload = 'Download'; +$strSetupEndOfLine = 'Zeilenenden'; +$strSetuperror_connection = 'Verbindungsaufbau zu MySQL-Server schlug fehl'; +$strSetuperror_empty_pmadb_password = 'Passwort des phpMyAdmin Hilfsusers ist leer, obwohl pmadb verwendet wird'; +$strSetuperror_empty_pmadb_user = 'Kein phpMyAdmin-Hilfsuser angegeben, obwohl pmadb verwendet wird'; +$strSetuperror_empty_signon_session = 'Leerer Sessionname, obwohl signon-Authentisierung verwendet wird'; +$strSetuperror_empty_signon_url = 'Leere signon-URL, obwohl signon-Authentisierung verwendet wird'; +$strSetuperror_empty_user_for_config_auth = 'Leerer Benutzername, obwohl config-Authentisierung verwnedet wird'; +$strSetuperror_form = 'Ausgefülltes Formular enthält Fehler'; +$strSetuperror_incorrect_ip_address = 'Ungültige IP-Adresse: %s'; +$strSetuperror_incorrect_port = 'Keine gültige Portnummer'; +$strSetuperror_incorrect_value = 'Ungültiger Wert'; +$strSetuperror_missing_field_data = 'Fehlende Daten für %s'; +$strSetuperror_nan_nneg = 'Keine nicht-negative Nummer'; +$strSetuperror_nan_p = 'Keine positive Nummer'; +$strSetupExecTimeLimit_desc = 'Die Anzahl der Sekunden, welche ein Script zur Ausführung benötigen darf([kbd]0[/kbd] für unbegrenzt)'; +$strSetupExecTimeLimit_name = 'Maximale Ausführungszeit'; +$strSetupExport_asfile_name = 'In Datei speichern'; +$strSetupExport_charset_name = 'Zeichensatz der Datei'; +$strSetupExport_compression_name = 'Kompression'; +$strSetupExport_file_template_database_name = 'Schablone für Datenbanknamen'; +$strSetupExport_file_template_server_name = 'Schablone für Servernamen'; +$strSetupExport_file_template_table_name = 'Schablone für Tabellennamen'; +$strSetupExport_format_name = 'Format'; +$strSetupExport_onserver_name = 'Auf Server speichern'; +$strSetupExport_onserver_overwrite_name = 'Existierende Datei(en) überschreiben'; +$strSetupExport_remember_file_template_name = 'Schablone für Dateinamen merken'; +$strSetupFalse = 'nein'; +$strSetupForceSSL_desc = 'Sicher Verbindung während der Nutzung von phpMyAdmin erzwingen'; +$strSetupForceSSLMsg = 'Falls vom Server unterstützt, sollte diese [a@?page=form&formset=features#tab_Security]Option[/a] aktiviert werden'; +$strSetupForceSSL_name = 'SSL-Verbindung erzwingen'; +$strSetupForeignKeyDropdownOrder_desc = 'Sortierreihenfolge für FOREIGN KEY Dropdownfelder. [kbd]content[/kbd] ist der referenzierte Wert, [kbd]id[/kbd] ist der Schlüsselwert'; +$strSetupForeignKeyDropdownOrder_name = 'Sortierreihenfolge für FOREIN KEY Dropdownfelder'; +$strSetupForeignKeyMaxLimit_desc = 'Es wird ein Dropdownfeld verwendet, falls weniger Einträge vorhanden sind.'; +$strSetupForeignKeyMaxLimit_name = 'FOREIGN KEY Limit'; +$strSetupForm_Browse = 'Anzeigemodus'; +$strSetupForm_Browse_desc = 'Anzeigemodus anpassen'; +$strSetupForm_Edit = 'Bearbeitungsmodus'; +$strSetupForm_Edit_desc = 'Bearbeitungsmodus anpassen'; +$strSetupForm_Export_defaults_desc = 'Standard-Exporteinstellungen anpassen'; +$strSetupForm_Export_defaults = 'Voreinstellung für Export'; +$strSetupForm_Import_defaults_desc = 'Standard-Importeinstellungen anpassen'; +$strSetupForm_Import_defaults = 'Voreinstellung für Import'; +$strSetupForm_Import_export_desc = 'Import/Export-Verzeichnis und Kompressionsoptionen setzen'; +$strSetupForm_Import_export = 'Import/export'; +$strSetupForm_Left_databases = 'Datenbanken'; +$strSetupForm_Left_databases_desc = 'Anzeigeoptionen für Datenbank'; +$strSetupForm_Left_frame_desc = 'Aussehen der Navigation anpassen'; +$strSetupForm_Left_frame = 'Navigationsframe'; +$strSetupForm_Left_servers_desc = 'Anzeigeoptionen für Server'; +$strSetupForm_Left_servers = 'Server'; +$strSetupForm_Left_tables_desc = 'Anzeigeoptionen für Tabellen'; +$strSetupForm_Left_tables = 'Tabellen'; +$strSetupForm_Main_frame = 'Hauptframe'; +$strSetupForm_Other_core_settings_desc = 'Einstellungen welche in keine andere Kategorie passten'; +$strSetupForm_Other_core_settings = 'Sonstige Einstellungen'; +$strSetupForm_Query_window_desc = 'Queryfenster-Einstellungen anpassen'; +$strSetupForm_Query_window = 'Queryfenster'; +$strSetupForm_Security_desc = 'Beachten Sie, dass phMyAdmin nur ein Userinterface ist und in keinster Weise die Möglichkeiten von MySQL limitiert'; +$strSetupForm_Security = 'Sicherheit'; +$strSetupForm_Server_config_desc = 'Erweiterte Serverkonfiguration, ändern Sie diese Einstellungen nur wenn Sie wissen was Sie tun'; +$strSetupForm_Server_config = 'Serverkonfiguration'; +$strSetupForm_Server_desc = 'Geben Sie die Verbindungsparameter für den Server ein'; +$strSetupForm_Server = 'Grundeinstellungen'; +$strSetupForm_Server_login_options_desc = 'Geben Sie die Login-Optionen für signon-Authentisierung an'; +$strSetupForm_Server_login_options = 'Optionen für Signon-Login'; +$strSetupForm_Server_pmadb_desc = 'Konfigurieren Sie eine phpMyAdmin-Datenbank um zusätzliche Features zu erhalten, siehe [a@../Documentation.html#linked-tables]linked-tables infrastructure[/a]'; +$strSetupForm_Server_pmadb = 'PMA-Datenbank'; +$strSetupFormset_customization = 'Anpassung'; +$strSetupFormset_export = 'Exportoptionen anpassen'; +$strSetupFormset_features = 'Features'; +$strSetupFormset_import = 'Importeinstellungen anpassen'; +$strSetupFormset_left_frame = 'Navigationsframe anpassen'; +$strSetupFormset_main_frame = 'Hauptframe anpassen'; +$strSetupForm_Sql_box_desc = 'Angezeigte Links in SQL-Querybox ändern'; +$strSetupForm_Sql_box = 'SQL-Querybox'; +$strSetupForm_Sql_queries_desc = 'SQL-Queryeinstellungen, für die SQL-Queryboxeinstellungen siehe [a@?page=form&formset=main_frame#tab_Sql_box]Navigationsframe[/a]einstellungen'; +$strSetupForm_Sql_queries = 'SQL-Querys'; +$strSetupForm_Startup_desc = 'Startseite anpassen'; +$strSetupForm_Startup = 'Start'; +$strSetupForm_Tabs_desc = 'Wählen Sie wie die Tabs funktionieren sollen'; +$strSetupForm_Tabs = 'Tabs'; +$strSetupGZipDump_desc = '[a@http://en.wikipedia.org/wiki/Gzip]GZip[/a]-Kompression für Import- und Exportoperationen aktiviren'; +$strSetupGZipDump_name = 'GZip'; +$strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]GZip-Kompression und Dekompression[/a] benötigt Funktionen (%s), welche auf diesem System nicht verfügbar sind.'; +$strSetupHomepageLink = 'phpMyAdmin-Homepage'; +$strSetupIconvExtraParams_name = 'Extra Parameter für iconv'; +$strSetupIgnoreErrors = 'Fehler ignorieren'; +$strSetupIgnoreMultiSubmitErrors_desc = 'Wenn aktiv, fährt phpMyAdmin bei der Verarbeitung von multi-Statement-Querys fort, wenn eine Query fehlschlägt'; +$strSetupIgnoreMultiSubmitErrors_name = 'Fehler bei Multi-Statements ignorieren'; +$strSetupImport_allow_interrupt_desc = 'Unterbrechungen bei Import erlauben, falls das Skript feststellt, dass das Zeitlimit bald erreicht ist. Dies ist eine gute Idee zum Importieren von großen Files, kann aber Probleme mit Transaktionen verursachen.'; +$strSetupImport_allow_interrupt_name = 'Teilweiser Import: Unterbrechung erlauben'; +$strSetupImport_format_name = 'Format'; +$strSetupImport_skip_queries_name = 'Teilimport: Überspringe Anfragen'; +$strSetupInsecureConnectionMsg1 = 'Sie benutzen keine sichere Verbindung. Alle Daten (einschließlich sensitive Information wie Passwörter) werden unverschlüsselt übertragen!'; +$strSetupInsecureConnectionMsg2 = 'Falls Ihr Server HTTPS Anfragen akzeptiert, folgen Sie [a@%s]diesem Link[/a] um eine sichere Verbindung zu benutzen.'; +$strSetupInsecureConnection = 'Unsichere Verbindung'; +$strSetupLetUserChoose = 'lass den Benutzer entscheiden'; +$strSetupLoad = 'Laden'; +$strSetupLoginCookieDeleteAll_name = 'All Cookies beim Logout löschen'; +$strSetupLoginCookieRecall_name = 'Benutzername wiederherstellen'; +$strSetupLoginCookieStore_name = 'Login Cookie Speicherung'; +$strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] sollte maximal auf 1800 Sekunden (30 minutes) gesetzt sein. Werte größer 1800 könnten ein Sicherheitsrisiko darstellen z.B. durch Imitation.'; +$strSetupLoginCookieValidity_name = 'Login Cookie Gültigkeit'; +$strSetupMaxCharactersInDisplayedSQL_name = 'Zeichen Maximum beim SQL Befehl anzeigen'; +$strSetupMaxDbList_name = 'Datenbanken Maximum'; +$strSetupMaxTableList_name = 'Tabellen Maximum'; +$strSetupMemoryLimit_name = 'Speicher Limit'; +$strSetupNewServer = 'Neuer Server'; +$strSetupNoServers = 'Es sind keine Server konfiguriert'; +$strSetupOBGzip_name = 'GZip Ausgabepufferung'; +$strSetupOptionNone = '- kein -'; +$strSetupOverview = 'Übersicht'; +$strSetupPersistentConnections_name = 'Persistente Verbindung'; +$strSetupQueryHistoryDB_name = 'Anfragelog speichern'; +$strSetupQueryHistoryMax_name = 'Anfragelog Länge'; +$strSetupRecodingEngine_name = 'Umwandlungs Engine'; +$strSetupRestoreDefaultValue = 'Standard wiederherstellen'; +$strSetupRevertErroneousFields = 'Versuche fehlerhafte Werte auf den Standardwert zu setzen'; +$strSetupSaveDir_name = 'Speicher Verzeichnis'; +$strSetupServerAuthConfigMsg = 'Sie haben die [kbd]config[/kbd] Authentifikation gewählt und einen Benutzernamen und Passwort für Auto-Login eingegeben, was für live Hosts nicht Wünschenswert ist. Jeder, der Ihre phpMyAdmin URL kennt oder errät kann direckt auf Ihre phpMyAdmin Oberfläche zugreifen. Setzen Sie den [a@?page=servers&mode=edit&id=%1$d#tab_Server]Authentifikationstyp[/a] auf [kbd]cookie[/kbd] oder [kbd]http[/kbd].'; +$strSetupServerExtensionMsg = 'Sie sollten mysqli wegen der Performance benutzen'; +$strSetupServerNoPasswordMsg = 'Sie erlauben Verbindungen mit dem Server ohne Passwort.'; +$strSetupServersAdd = 'Server hinzufügen'; +$strSetupServers_AllowDeny_order_name = 'Host Authentifikationsreihenfolge'; +$strSetupServers_AllowDeny_rules_name = 'Host Authentifikationsregeln'; +$strSetupServers_AllowNoPassword_name = 'Erlaube Logins ohne Passwort'; +$strSetupServers_AllowRoot_name = 'Erlaube root Login'; $strSetupServers_auth_swekey_config_desc = 'Pfad zur Konfigurationsdatei der [a@http://swekey.com]SweKey Hardware Authentifizierung[/a] (liegt nicht im Webhauptverzeichnis (document root); empfohlen: /etc/swekey.conf)'; +$strSetupServers_auth_swekey_config_name = 'SweKey Konfigurationsdatei'; +$strSetupServers_auth_type_name = 'Authentifikationstyp'; +$strSetupServers_bookmarktable_name = 'Bookmark Table'; +$strSetupServers_column_info_name = 'Column Info Table'; +$strSetupServers_compress_name = 'Verbindung komprimieren'; +$strSetupServers_connect_type_name = 'Verbindungstyp'; +$strSetupServers_controlpass_name = 'Control-user Passwort'; +$strSetupServers_controluser_name = 'Control-user'; +$strSetupServers_CountTables_name = 'Zähle Tabellen'; +$strSetupServers_designer_coords_name = 'Designer Coords Table'; +$strSetupServers_DisableIS_name = 'Benutzung von INFORMATION_SCHEMA deaktivieren'; +$strSetupServerSecurityInfoMsg = 'Falls Sie es für nötig halten, benutzen Sie die zusätzlichen Schutz Einstellungen - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]Host Authentifikation[/a] und [a@?page=form&formset=features#tab_Security]Vertrauenswürdige Proxies Liste[/a]. IP Basierter Schutz kann unzuverlässig sein, wenn die IP einem ISP gehört, mit dem tausende Benutzer, einschließlich Ihnen, verbunden sind.'; +$strSetupServersEdit = 'Server editieren'; $strSetupServers_extension_desc = 'Die zu verwendente PHP Erweiterung; sie sollten mysqli verwenden wenn es verfügbar ist'; +$strSetupServers_extension_name = 'PHP Erweiterung'; +$strSetupServers_hide_db_name = 'Datenbanken verstecken'; +$strSetupServers_history_name = 'History Table'; $strSetupServers_host_desc = 'Rechnername auf dem der MySQL Server läuft'; +$strSetupServers_host_name = 'Hostname'; +$strSetupServers_LogoutURL_name = 'Logout URL'; +$strSetupServers_nopassword_name = 'Ohne Passwort verbinden'; +$strSetupServers_only_db_name = 'Nur aufgelistete Datenbanken zeigen'; +$strSetupServers_password_name = 'Passwort für config Authentifikation'; +$strSetupServers_pdf_pages_name = 'PDF Pages Table'; +$strSetupServers_pmadb_name = 'PMA Datenbank'; +$strSetupServers_port_name = 'Port'; +$strSetupServers_relation_name = 'Relation Table'; +$strSetupServers_ShowDatabasesCommand_name = 'SHOW DATABASES Befehl'; +$strSetupServers_SignonSession_name = 'Signon Session-Name'; +$strSetupServers_SignonURL_name = 'Signon URL'; +$strSetupServerSslMsg = 'Sie sollten SSL Verbindungen benutzen, wenn Ihr Webserver es unterstützt'; +$strSetupServers_socket_name = 'Sockel'; +$strSetupServers_ssl_desc = ''; +$strSetupServers_ssl_name = 'Benutze SSL'; +$strSetupServers_table_coords_name = 'Table Coords Table'; +$strSetupServers_table_info_name = 'Table Info Table'; +$strSetupServers_user_name = 'Benutername für config Authentifikation'; +$strSetupServers_verbose_check_name = 'Tabellenprüfung'; $strSetupServers_verbose_desc = 'Benutzerfreundlicher Name des Servers. Leer lassen um den tatsächlichen Rechnernamen anzuzeigen.'; +$strSetupServers_verbose_name = 'Serverbezeichnung'; +$strSetupSetValue = 'Setze Wert: %s'; +$strSetupShowForm = 'Formular Zeigen'; +$strSetupShowHiddenMessages = 'Ausgeblendete Nachrichten anzeigen (#MSG_COUNT)'; +$strSetupShowSQL_name = 'Zeige SQL Anfragen'; +$strSetupSkipLockedTables_name = 'Überspringe gesperrte Tabellen'; +$strSetupTrue = 'Ja'; +$strSetupTrustedProxies_name = 'Liste der Vertrauenswürdigen Proxies für IP Filter'; +$strSetupUploadDir_name = 'Upload Verzeichnis'; +$strSetupUseDbSearch_name = 'Datenbank Suche'; +$strSetupVerboseMultiSubmit_name = 'Auswirkungen von Mehrfachbefehlen zeigen'; +$strSetupVersionCheckDataError = 'Lesen der Versioninformationen fehlgeschlagen. Vielleicht sind Sie offline oder der Server antwortet nicht.'; +$strSetupVersionCheckInvalid = 'Ungültige Versionsinformation erhalten'; +$strSetupVersionCheckLink = 'Auf neue Version prüfen'; $strSetupVersionCheckNewAvailable = 'Es ist eine neuere Version von phpMyAdmin verfügbar zu der sie aktualisieren sollten. Die neuste Version ist %s, erschienen %s.'; +$strSetupVersionCheckNewAvailableSvn = 'Sie benutzen eine SVN Version, starten Sie [kbd]svn update[/kbd] :-)[br]Die neuste stabile Version ist %s, veröffentlicht am %s.'; +$strSetupVersionCheckNone = 'Keine neuere stabile Version verfügbar'; +$strSetupVersionCheckUnparsable = 'Versionsinformation nicht analysierbar'; +$strSetupVersionCheck = 'Versionsüberprüfung'; +$strSetupVersionCheckWrapperError = 'Weder URL Wrapper noch CURL sind verfügbar. Versionsüberprüfung ist nicht möglich.'; +$strSetupWarning = 'Warnung'; +$strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip Komprimierung[/a] benötigt die Funktionen (%s) die auf dem System nicht zur Verfügung stehen.'; +$strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip Dekomprimierung[/a] benötigt die Funktionen (%s) die auf dem System nicht zur Verfügung stehen.'; +$strSetupZipDump_name = 'ZIP'; $strShowAll = 'Alles anzeigen'; $strShowBinaryContents = 'Binäre Inhalte anzeigen'; $strShowBLOBContents = 'BLOB Inhalte anzeigen'; @@ -860,8 +1138,8 @@ $strShowStatusReset = 'Zurücksetzen'; $strShowStatusRpl_statusDescr = 'Der Status der ausfallsicheren Replikation.'; $strShowStatusSelect_full_joinDescr = 'Anzahl der Joins ohne Schlüssel. Wenn dieser Wert nicht 0 ist sollten die Indizes der Tabellen sorgfältig überprüft werden.'; $strShowStatusSelect_full_range_joinDescr = 'Anzahl der Joins, bei denen eine Bereichssuche auf die Referenztabelle statt fand.'; -$strShowStatusSelect_rangeDescr = 'Anzahl der Joins, bei denen Bereiche auf die erste Tabelle benutzt wurden. (Es ist normalerweise unkritisch, wenn dieser Wert hoch ist.)'; $strShowStatusSelect_range_checkDescr = 'Anzahl der Joins ohne Schlüssel, bei denen nach jeder Zeile auf Schlüsselbenutzung geprüft wurde. Wenn dieser Wert nicht 0 ist sollten die Indizes der Tabellen sorgfältig überprüft werden.'; +$strShowStatusSelect_rangeDescr = 'Anzahl der Joins, bei denen Bereiche auf die erste Tabelle benutzt wurden. (Es ist normalerweise unkritisch, wenn dieser Wert hoch ist.)'; $strShowStatusSelect_scanDescr = 'Anzahl der Joins, bei denen die erste Tabelle gescannt wurde.'; $strShowStatusSlave_open_temp_tablesDescr = 'Anzahl der temporären Tabellen, die momentan vom Slave-Prozess geöffnet sind.'; $strShowStatusSlave_retried_transactionsDescr = 'Gesamtzahl (seit Start des Servers) der vom Replikations-Slave-SQL-Thread wiederversuchten Transaktionen.'; @@ -908,9 +1186,10 @@ $strSQPBugInvalidIdentifer = 'Ungültiger Bezeichner'; $strSQPBugUnclosedQuote = 'Nicht geschlossene Anführungszeichen'; $strSQPBugUnknownPunctuation = 'Unbekannte Interpunktion'; $strStandInStructureForView = 'Stellvertreter-Struktur des Views'; +$strStatCheckTime = 'Letzter Check am'; $strStatCreateTime = 'Erzeugt am'; $strStatement = 'Angaben'; -$strStatCheckTime = 'Letzter Check am'; +$strStatic = 'statisch'; $strStatisticsOverrun = 'Auf stark frequentierten Server kann der Byte-Zähler "überlaufen" (Wieder bei 0 beginnen), deshalb können diese Werte wie sie vom MySQL Server ausgegeben werden falsch sein.'; $strStatUpdateTime = 'Aktualisiert am'; $strStatus = 'Status'; @@ -926,8 +1205,10 @@ $strStructureForView = 'Struktur des Views'; $strStructure = 'Struktur'; $strSubmit = 'Abschicken'; $strSuccess = 'Ihr SQL-Befehl wurde erfolgreich ausgeführt.'; +$strSuhosin = 'Der Server läuft mit Suhosin. Bitte lesen Sie die %sDokumentation%s wegen möglicher Probleme.'; $strSum = 'Gesamt'; $strSwedish = 'Schwedisch'; +$strSwekeyAuthenticating = 'Authentifiziere ...'; $strSwekeyAuthFailed = 'Hardware Authentisierung fehlgeschlagen'; $strSwekeyNoKeyId = 'Die Datei %s enthält keine Schlüsselnummer'; $strSwekeyNoKey = 'Kein gültiger Authentisierungsschlüssel angeschlossen'; @@ -954,6 +1235,7 @@ $strTakeIt = 'auswählen'; $strTblPrivileges = 'Tabellenspezifische Rechte'; $strTempData = 'Temporäre Daten'; $strTextAreaLength = 'Wegen seiner Länge ist dieses
    Feld vielleicht nicht editierbar.'; +$strTexyText = 'Texy! Text'; $strThai = 'Thai'; $strThemeDefaultNotFound = 'Standard-Oberflächendesign "%s" nicht gefunden!'; $strThemeNoPreviewAvailable = 'Keine Vorschau verfügbar.'; @@ -974,6 +1256,58 @@ $strToggleSmallBig = 'Wechseln klein/groß'; $strToSelectRelation = 'Um eine Relation auszuwählen, klicken Sie :'; $strTotal = 'insgesamt'; $strTotalUC = 'Insgesamt'; +$strTrackingActivated = 'Tracking der Tabelle %s.%s ist aktiviert.'; +$strTrackingActivateNow = 'Jetzt aktivieren'; +$strTrackingActivateTrackingFor = 'Aktiviere tracking mechanismus für %s.%s'; +$strTrackingCreateVersion = 'Erzeuge Version'; +$strTrackingCreateVersionOf = 'Erzeuge Version %s von %s.%s'; +$strTrackingDataDefinitionStatement = 'DDL Befehl'; +$strTrackingDataManipulationStatement = 'DML Befehl'; +$strTrackingDate = 'Datum'; +$strTrackingDeactivateNow = 'Jetzt deaktivieren'; +$strTrackingDeactivateTrackingFor = 'Deaktiviere Tracking Mechanismus für %s.%s'; +$strTrackingDoIt = 'Los'; +$strTrackingExportAs = 'Export als %s'; +$strTrackingIsActive = 'Tracking ist aktiviert.'; +$strTrackingIsDeactive = 'Tracking is deactive.'; +$strTrackingMechanism = 'Tracking Mechanismus'; +$strTrackingReportClose = 'Schliesse'; +$strTrackingReport = 'Tracking Report'; +$strTrackingSelectDataOnly = 'Nur Daten'; +$strTrackingSelectStructureAndData = 'Struktur und Daten'; +$strTrackingSelectStructureOnly = 'Nur Struktur'; +$strTrackingShowLogDateUsers = 'Zeige %s mit Datum von %s bis %s und Benutzer %s %s'; +$strTrackingShowVersions = 'Zeige Versionen'; +$strTrackingSQLDumpFile = 'SQL Dump (Datei Download)'; +$strTrackingSQLDump = 'SQL Dump'; +$strTrackingSQLExecuted = 'SQL Befehle ausgeführt.'; +$strTrackingSQLExecutionAlert = 'Diese Option ersetzt Ihre Tabelle und enthaltene Daten.'; +$strTrackingSQLExecution = 'SQL Ausführung'; +$strTrackingSQLExported = 'SQL Befehle exportiert.'; +$strTrackingStatements = 'Verfolge die Befehle'; +$strTrackingStatusActive = 'aktiv'; +$strTrackingStatusDeactive = 'deaktiv'; +$strTrackingStructureSnapshot = 'Struktur Schnapschuss'; +$strTrackingThCreated = 'Erstellt'; +$strTrackingThDatabase = 'Datenbank'; +$strTrackingThLastVersion = 'Letzte Version'; +$strTrackingThShow = 'Zeige'; +$strTrackingThStatus = 'Status'; +$strTrackingThTable = 'Tabelle'; +$strTrackingThUpdated = 'Aktualisiert'; +$strTrackingThVersion = 'Version'; +$strTrackingTrackDDStatements = 'Verfolge diese Datenbeschreibungsbefehle (DDL):'; +$strTrackingTrackDMStatements = 'Verfolge diese Datenbearbeitungsbefehle (DML):'; +$strTrackingTrackedTables = 'Verfolgte Tabellen'; +$strTracking = 'Tracking'; +$strTrackingTrackTable = 'Verfolge Tabelle'; +$strTrackingUntrackedTables = 'Nicht verfolgte Tabellen'; +$strTrackingUsername = 'Benutzername'; +$strTrackingVersionActivated = 'Tracking von %s.%s , Version %s ist aktiviert.'; +$strTrackingVersionCreated = 'Version %s ist erstellt, Tracking von %s.%s ist aktiviert.'; +$strTrackingVersionDeactivated = 'Tracking von %s.%s , Version %s ist deaktiviert.'; +$strTrackingVersionSnapshotSQL = 'Version %s Schnapschuss (SQL code)'; +$strTrackingVersions = 'Versionen'; $strTraditionalChinese = 'Traditionelles Chinesisch'; $strTraditionalSpanish = 'Traditionelles Spanisch'; $strTraffic = 'Traffic'; @@ -1041,6 +1375,7 @@ $strView = 'Ansicht'; $strViewDumpDatabases = 'Dump (Schema) der Datenbanken anzeigen'; $strViewDumpDB = 'Dump (Schema) der Datenbank anzeigen'; $strViewDump = 'Dump (Schema) der Tabelle anzeigen'; +$strViewHasAtLeast = 'Dieser View hat mindestens diese Anzahl von Zeilen. Bitte lesen Sie die %sDokumentation%s.'; $strViewHasBeenDropped = 'Die Ansicht %s wurde gelöscht'; $strViewImage = 'Bild anzeigen'; $strViewName = 'VIEW Name'; @@ -1066,206 +1401,29 @@ $strZeroRemovesTheLimit = 'Der Wert 0 (null) entfernt die Beschränkung.'; $strZip = 'Zip-komprimiert'; // To translate: +$strAndSmall = 'and'; //to translate -$strBLOBRepository = 'BLOB Repository'; //to translate -$strBLOBRepositoryDamaged = 'Damaged'; //to translate -$strBLOBRepositoryDisableAreYouSure = 'Are you sure you want to disable all BLOB references for database %s?'; //to translate -$strBLOBRepositoryDisabled = 'Disabled'; //to translate -$strBLOBRepositoryDisable = 'Disable'; //to translate -$strBLOBRepositoryDisableStrongWarning = 'You are about to DISABLE a BLOB Repository!'; //to translate -$strBLOBRepositoryEnabled = 'Enabled'; //to translate -$strBLOBRepositoryEnable = 'Enable'; //to translate -$strBLOBRepositoryRemove = 'Remove BLOB Repository Reference'; //to translate -$strBLOBRepositoryRepair = 'Repair'; //to translate -$strBLOBRepositoryStatus = 'Status'; //to translate -$strBLOBRepositoryUpload = 'Upload to BLOB repository'; //to translate +$strConfigDirectoryWarning = 'Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'; //to translate -$strEvents = 'Events'; //to translate -$strExportImportToScale = 'Export/Import to scale'; // to translate +$strDoNotAutoIncrementZeroValues = 'Do not use AUTO_INCREMENT for zero values'; //to translate -$strForeignKeyRelationAdded = 'FOREIGN KEY relation added'; //to translate +$strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate +$strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate +$strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate -$strGetMoreThemes = 'Get more themes!'; //to translate +$strNavTableFilter = 'Filter'; //to translate -$strHostTableExplanation = 'When Host table is used, this field is ignored and values stored in Host table are used instead.'; //to translate - -$strInternalAndForeign = 'An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.'; //to translate - -$strLoginWithoutPassword = 'Login without a password is forbidden by configuration (see AllowNoPassword)'; //to translate - -$strPBXTDataFileGrowSize = 'Data file grow size'; //to translate -$strPBXTDataFileGrowSizeDesc = 'The grow size of the handle data (.xtd) files.'; //to translate -$strPBXTDataLogThreshold = 'Data log threshold'; //to translate -$strPBXTDataLogThresholdDesc = 'The maximum size of a data log file. The default value is 64MB. PBXT can create a maximum of 32000 data logs, which are used by all tables. So the value of this variable can be increased to increase the total amount of data that can be stored in the database.'; //to translate -$strPBXTGarbageThresholdDesc = 'The percentage of garbage in a data log file before it is compacted. This is a value between 1 and 99. The default is 50.'; //to translate -$strPBXTGarbageThreshold = 'Garbage threshold'; //to translate -$strPBXTCheckpointFrequencyDesc = 'The amount of data written to the transaction log before a checkpoint is performed. The default value is 24MB.'; //to translate -$strPBXTCheckpointFrequency = 'Checkpoint frequency'; //to translate -$strPBXTIndexCacheSizeDesc = 'This is the amount of memory allocated to the index cache. Default value is 32MB. The memory allocated here is used only for caching index pages.'; //to translate -$strPBXTIndexCacheSize = 'Index cache size'; //to translate -$strPBXTLogBufferSizeDesc = 'The size of the buffer used when writing a data log. The default is 256MB. The engine allocates one buffer per thread, but only if the thread is required to write a data log.'; //to translate -$strPBXTLogBufferSize = 'Log buffer size'; //to translate -$strPBXTLogCacheSizeDesc = 'The amount of memory allocated to the transaction log cache used to cache on transaction log data. The default is 16MB.'; //to translate -$strPBXTLogCacheSize = 'Log cache size'; //to translate -$strPBXTLogFileCountDesc = 'This is the number of transaction log files (pbxt/system/xlog*.xt) the system will maintain. If the number of logs exceeds this value then old logs will be deleted, otherwise they are renamed and given the next highest number.'; //to translate -$strPBXTLogFileCount = 'Log file count'; //to translate -$strPBXTLogFileThresholdDesc = 'The size of a transaction log before rollover, and a new log is created. The default value is 16MB.'; //to translate -$strPBXTLogFileThreshold = 'Log file threshold'; //to translate -$strPBXTRecordCacheSizeDesc = 'This is the amount of memory allocated to the record cache used to cache table data. The default value is 32MB. This memory is used to cache changes to the handle data (.xtd) and row pointer (.xtr) files.'; //to translate $strPBXTRecordCacheSize = 'Record cache size'; //to translate -$strPBXTRowFileGrowSizeDesc = 'The grow size of the row pointer (.xtr) files.'; //to translate -$strPBXTRowFileGrowSize = 'Row file grow size'; //to translate -$strPBXTTransactionBufferSizeDesc = 'The size of the global transaction log buffer (the engine allocates 2 buffers of this size). The default is 1MB.'; //to translate -$strPBXTTransactionBufferSize = 'Transaction buffer size'; //to translate +$strPhpArray = 'PHP array'; //to translate + +$strRemoveCRLF = 'Remove CRLF characters within fields'; //to translate +$strReplicationStatusInfo = 'This MySQL server works as %s in replication process. For further information about replication status on the server, please visit the replication section.'; //to translate +$strReplicationStatus_master = 'Master status'; //to translate +$strReplicationStatus = 'Replication status'; //to translate +$strReplicationStatus_slave = 'Slave status'; //to translate -$strSetupAllowAnywhereRecoding_name = 'Allow character set conversion'; //to translate -$strSetupAllowArbitraryServer_desc = 'If enabled user can enter any MySQL server in login form for cookie auth'; //to translate -$strSetupAllowArbitraryServerMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate -$strSetupAllowArbitraryServer_name = 'Allow login to any MySQL server'; //to translate -$strSetupAllowUserDropDatabase_name = 'Show "Drop database" link to normal users'; //to translate -$strSetupblowfish_secret_desc = 'Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] authentication'; //to translate -$strSetupBlowfishSecretCharsMsg = 'Key should contain letters, numbers [em]and[/em] special characters'; //to translate -$strSetupBlowfishSecretLengthMsg = 'Key is too short, it should have at least 8 characters'; //to translate -$strSetupBlowfishSecretMsg = 'You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.'; //to translate -$strSetupblowfish_secret_name = 'Blowfish secret'; //to translate -$strSetupBrowseMarkerEnable_desc = 'Highlight selected rows'; //to translate -$strSetupBrowseMarkerEnable_name = 'Row marker'; //to translate -$strSetupBrowsePointerEnable_desc = 'Highlight row pointed by the mouse cursor'; //to translate -$strSetupBrowsePointerEnable_name = 'Highlight pointer'; //to translate -$strSetupBZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for import and export operations'; //to translate -$strSetupBZipDump_name = 'Bzip2'; //to translate -$strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]Bzip2 compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupCannotLoadConfig = 'Cannot load or save configuration'; //to translate -$strSetupCannotLoadConfigMsg = 'Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@../Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.'; //to translate -$strSetupClear = 'Clear'; //to translate -$strSetupCompressOnFly_desc = 'Compress gzip/bzip2 exports on the fly without the need for much memory; if you encounter problems with created gzip/bzip2 files disable this feature'; //to translate -$strSetupCompressOnFly_name = 'Compress on the fly'; //to translate -$strSetupConfigurationFile = 'Configuration file'; //to translate -$strSetupConfirm_desc = 'Whether a warning ("Are your really sure...") should be displayed when you\'re about to lose data'; //to translate -$strSetupConfirm_name = 'Confirm DROP queries'; //to translate -$strSetupDefaultCharset_desc = 'Default character set used for conversions'; //to translate -$strSetupDefaultCharset_name = 'Default character set'; //to translate -$strSetupDefaultLanguage = 'Default language'; //to translate -$strSetupDefaultServer = 'Default server'; //to translate -$strSetupDefaultTabDatabase_desc = 'Tab that is displayed when entering a database'; //to translate -$strSetupDefaultTabDatabase_name = 'Default database tab'; //to translate -$strSetupDefaultTabServer_desc = 'Tab that is displayed when entering a server'; //to translate -$strSetupDefaultTabServer_name = 'Default server tab'; //to translate -$strSetupDefaultTabTable_desc = 'Tab that is displayed when entering a table'; //to translate -$strSetupDefaultTabTable_name = 'Default table tab'; //to translate -$strSetupDirectoryNotice = 'This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.'; //to translate -$strSetupDisplayDatabasesList_desc = 'Show database listing as a list instead of a drop down'; //to translate -$strSetupDisplayDatabasesList_name = 'Display databases as a list'; //to translate -$strSetupDisplay = 'Display'; //to translate -$strSetupDisplayServersList_desc = 'Show server listing as a list instead of a drop down'; //to translate -$strSetupDisplayServersList_name = 'Display servers as a list'; //to translate -$strSetupDonateLink = 'Donate'; //to translate -$strSetupDownload = 'Download'; //to translate -$strSetupEndOfLine = 'End of line'; //to translate -$strSetuperror_connection = 'Could not connect to MySQL server'; //to translate -$strSetuperror_empty_pmadb_password = 'Empty phpMyAdmin control user password while using pmadb'; //to translate -$strSetuperror_empty_pmadb_user = 'Empty phpMyAdmin control user while using pmadb'; //to translate -$strSetuperror_empty_signon_session = 'Empty signon session name while using signon authentication method'; //to translate -$strSetuperror_empty_signon_url = 'Empty signon URL while using signon authentication method'; //to translate -$strSetuperror_empty_user_for_config_auth = 'Empty username while using config authentication method'; //to translate -$strSetuperror_form = 'Submitted form contains errors'; //to translate -$strSetuperror_incorrect_ip_address = 'Incorrect IP address: %s'; //to translate -$strSetuperror_incorrect_port = 'Not a valid port number'; //to translate -$strSetuperror_incorrect_value = 'Incorrect value'; //to translate -$strSetuperror_missing_field_data = 'Missing data for %s'; //to translate -$strSetuperror_nan_nneg = 'Not a non-negative number'; //to translate -$strSetuperror_nan_p = 'Not a positive number'; //to translate -$strSetupExecTimeLimit_desc = 'Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no limit)'; //to translate -$strSetupExecTimeLimit_name = 'Maximum execution time'; //to translate -$strSetupExport_asfile_name = 'Save as file'; //to translate -$strSetupExport_compression_name = 'Compression'; //to translate -$strSetupExport_file_template_database_name = 'Database name template'; //to translate -$strSetupExport_file_template_server_name = 'Server name template'; //to translate -$strSetupExport_file_template_table_name = 'Table name template'; //to translate -$strSetupExport_format_name = 'Format'; //to translate -$strSetupExport_charset_name = 'Character set of the file'; //to translate -$strSetupExport_onserver_name = 'Save on server'; //to translate -$strSetupExport_onserver_overwrite_name = 'Overwrite existing file(s)'; //to translate -$strSetupExport_remember_file_template_name = 'Remember file name template'; //to translate -$strSetupFalse = 'no'; //to translate -$strSetupForceSSL_desc = 'Force secured connection while using phpMyAdmin'; //to translate -$strSetupForceSSLMsg = 'This [a@?page=form&formset=features#tab_Security]option[/a] should be enabled if your web server supports it'; //to translate -$strSetupForceSSL_name = 'Force SSL connection'; //to translate -$strSetupForeignKeyDropdownOrder_desc = 'Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value'; //to translate -$strSetupForeignKeyDropdownOrder_name = 'Foreign key dropdown order'; //to translate -$strSetupForeignKeyMaxLimit_desc = 'A dropdown will be used if fewer items are present'; //to translate -$strSetupForeignKeyMaxLimit_name = 'Foreign key limit'; //to translate -$strSetupForm_Browse = 'Browse mode'; //to translate -$strSetupForm_Browse_desc = 'Customize browse mode'; //to translate -$strSetupForm_Edit_desc = 'Customize edit mode'; //to translate -$strSetupForm_Edit = 'Edit mode'; //to translate -$strSetupForm_Export_defaults_desc = 'Customize default export options'; //to translate -$strSetupForm_Export_defaults = 'Export defaults'; //to translate -$strSetupForm_Import_defaults_desc = 'Customize default common import options'; //to translate -$strSetupForm_Import_defaults = 'Import defaults'; //to translate -$strSetupForm_Import_export_desc = 'Set import and export directories and compression options'; //to translate -$strSetupForm_Import_export = 'Import / export'; //to translate -$strSetupForm_Left_databases = 'Databases'; //to translate -$strSetupForm_Left_databases_desc = 'Databases display options'; //to translate -$strSetupForm_Left_frame_desc = 'Customize appearance of the navigation frame'; //to translate -$strSetupForm_Left_frame = 'Navigation frame'; //to translate -$strSetupForm_Left_servers_desc = 'Servers display options'; //to translate -$strSetupForm_Left_servers = 'Servers'; //to translate -$strSetupForm_Left_tables_desc = 'Tables display options'; //to translate -$strSetupForm_Left_tables = 'Tables'; //to translate -$strSetupForm_Main_frame = 'Main frame'; //to translate -$strSetupForm_Other_core_settings_desc = 'Settings that didn\'t fit enywhere else'; //to translate -$strSetupForm_Other_core_settings = 'Other core settings'; //to translate -$strSetupForm_Query_window_desc = 'Customize query window options'; //to translate -$strSetupForm_Query_window = 'Query window'; //to translate -$strSetupForm_Security_desc = 'Please note that phpMyAdmin is just a user interface and its features do not limit MySQL'; //to translate -$strSetupForm_Security = 'Security'; //to translate -$strSetupForm_Server = 'Basic settings'; //to translate -$strSetupForm_Server_config_desc = 'Advanced server configuration, do not change these options unless you know what they are for'; //to translate -$strSetupForm_Server_config = 'Server configuration'; //to translate -$strSetupForm_Server_desc = 'Enter server connection parameters'; //to translate -$strSetupForm_Server_login_options_desc = 'Enter login options for signon authentication'; //to translate -$strSetupForm_Server_login_options = 'Signon login options'; //to translate -$strSetupForm_Server_pmadb_desc = 'Configure phpMyAdmin database to gain access to additional features, see [a@../Documentation.html#linked-tables]linked-tables infrastructure[/a] in documentation'; //to translate -$strSetupForm_Server_pmadb = 'PMA database'; //to translate -$strSetupFormset_customization = 'Customization'; //to translate -$strSetupFormset_export = 'Customize export options'; //to translate -$strSetupFormset_features = 'Features'; //to translate -$strSetupFormset_import = 'Customize import defaults'; //to translate -$strSetupFormset_left_frame = 'Customize navigation frame'; //to translate -$strSetupFormset_main_frame = 'Customize main frame'; //to translate -$strSetupForm_Sql_box_desc = 'Customize links shown in SQL Query boxes'; //to translate -$strSetupForm_Sql_box = 'SQL Query box'; //to translate -$strSetupForm_Sql_queries_desc = 'SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings'; //to translate -$strSetupForm_Sql_queries = 'SQL queries'; //to translate -$strSetupForm_Startup_desc = 'Customize startup page'; //to translate -$strSetupForm_Startup = 'Startup'; //to translate -$strSetupForm_Tabs_desc = 'Choose how you want tabs to work'; //to translate -$strSetupForm_Tabs = 'Tabs'; //to translate -$strSetupGZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] compression for import and export operations'; //to translate -$strSetupGZipDump_name = 'GZip'; //to translate -$strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]GZip compression and decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupHomepageLink = 'phpMyAdmin homepage'; //to translate -$strSetupCharEditing_desc = 'Defines which type of editing controls should be used for CHAR and VARCHAR fields; [kbd]input[/kbd] - allows limiting of input length, [kbd]textarea[/kbd] - allows newlines in fields'; //to translate -$strSetupCharEditing_name = 'CHAR fields editing'; //to translate -$strSetupCharTextareaCols_desc = 'Number of columns for CHAR/VARCHAR textareas'; //to translate -$strSetupCharTextareaCols_name = 'CHAR textarea columns'; //to translate -$strSetupCharTextareaRows_desc = 'Number of rows for CHAR/VARCHAR textareas'; //to translate -$strSetupCharTextareaRows_name = 'CHAR textarea rows'; //to translate -$strSetupCheckConfigurationPermissions_name = 'Check config file permissions'; //to translate -$strSetupIconvExtraParams_name = 'Extra parameters for iconv'; //to translate -$strSetupIgnoreErrors = 'Ignore errors'; //to translate -$strSetupIgnoreMultiSubmitErrors_desc = 'If enabled, phpMyAdmin continues computing multiple-statement queries even if one of the queries failed'; //to translate -$strSetupIgnoreMultiSubmitErrors_name = 'Ignore multiple statement errors'; //to translate -$strSetupImport_allow_interrupt_desc = 'Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.'; //to translate -$strSetupImport_allow_interrupt_name = 'Partial import: allow interrupt'; //to translate $strSetupImport_format_desc = 'Default format; be aware that this list depends on location (database, table) and only SQL is always available'; //to translate -$strSetupImport_format_name = 'Format of imported file'; //to translate $strSetupImport_skip_queries_desc = 'Number of records (queries) to skip from start'; //to translate -$strSetupImport_skip_queries_name = 'Partial import: skip queries'; //to translate -$strSetupInsecureConnection = 'Insecure connection'; //to translate -$strSetupInsecureConnectionMsg1 = 'You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!'; //to translate -$strSetupInsecureConnectionMsg2 = 'If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.'; //to translate $strSetupInsertRows_desc = 'How many rows can be inserted at one time'; //to translate $strSetupInsertRows_name = 'Number of inserted rows'; //to translate $strSetupLeftDefaultTabTable_name = 'Target for quick access icon'; //to translate @@ -1287,144 +1445,72 @@ $strSetupLeftLogoLinkWindow_desc = 'Open the linked page in the main window ([kb $strSetupLeftLogoLinkWindow_name = 'Logo link target'; //to translate $strSetupLeftPointerEnable_desc = 'Highlight server under the mouse cursor'; //to translate $strSetupLeftPointerEnable_name = 'Enable highlighting'; //to translate -$strSetupLetUserChoose = 'let the user choose'; //to translate $strSetupLightTabs_desc = 'Use less graphically intense tabs'; //to translate $strSetupLightTabs_name = 'Light tabs'; //to translate -$strSetupLoad = 'Load'; //to translate $strSetupLoginCookieDeleteAll_desc = 'If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.'; //to translate -$strSetupLoginCookieDeleteAll_name = 'Delete all cookies on logout'; //to translate $strSetupLoginCookieRecall_desc = 'Define whether the previous login should be recalled or not in cookie authentication mode'; //to translate -$strSetupLoginCookieRecall_name = 'Recall user name'; //to translate $strSetupLoginCookieStore_desc = 'Define how long (in seconds) a login cookie should be stored in browser. The default of 0 means that it will be kept for the existing session only, and will be deleted as soon as you close the browser window. This is recommended for non-trusted environments.'; //to translate -$strSetupLoginCookieStore_name = 'Login cookie store'; //to translate $strSetupLoginCookieValidity_desc = 'Define how long (in seconds) a login cookie is valid'; //to translate -$strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] should be should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.'; //to translate -$strSetupLoginCookieValidity_name = 'Login cookie validity'; //to translate -$strSetupMaxDbList_desc = 'Maximum number of databases displayed in left frame and database list'; //to translate -$strSetupMaxDbList_name = 'Maximum databases'; //to translate $strSetupMaxCharactersInDisplayedSQL_desc = 'Maximum number of characters used when a SQL query is displayed'; //to translate -$strSetupMaxCharactersInDisplayedSQL_name = 'Maximum displayed SQL length'; //to translate +$strSetupMaxDbList_desc = 'Maximum number of databases displayed in left frame and database list'; //to translate $strSetupMaxRows_desc = 'Number of rows displayed when browsing a result set. If the result set contains more rows, "Previous" and "Next" links will be shown.'; //to translate $strSetupMaxRows_name = 'Maximum number of rows to display'; //to translate $strSetupMaxTableList_desc = 'Maximum number of tables displayed in table list'; //to translate -$strSetupMaxTableList_name = 'Maximum tables'; //to translate $strSetupMemoryLimit_desc = 'The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)'; //to translate -$strSetupMemoryLimit_name = 'Memory limit'; //to translate $strSetupNavigationBarIconic_desc = 'Use only icons, only text or both'; //to translate $strSetupNavigationBarIconic_name = 'Iconic navigation bar'; //to translate -$strSetupNewServer = 'New server'; //to translate -$strSetupNoServers = 'There are no configured servers'; //to translate $strSetupOBGzip_desc = 'use GZip output buffering for increased speed in HTTP transfers'; //to translate -$strSetupOBGzip_name = 'GZip output buffering'; //to translate -$strSetupOptionNone = '- none -'; //to translate $strSetupOrder_desc = '[kbd]SMART[/kbd] - i.e. descending order for fields of type TIME, DATE, DATETIME and TIMESTAMP, ascending order otherwise'; //to translate $strSetupOrder_name = 'Default sorting order'; //to translate -$strSetupOverview = 'Overview'; //to translate $strSetupPersistentConnections_desc = 'Use persistent connections to MySQL databases'; //to translate -$strSetupPersistentConnections_name = 'Persistent connections'; //to translate $strSetupPropertiesIconic_desc = 'Use only icons, only text or both'; //to translate $strSetupPropertiesIconic_name = 'Iconic table operations'; //to translate $strSetupProtectBinary_desc = 'Disallow BLOB and BINARY fields from editing'; //to translate $strSetupProtectBinary_name = 'Protect binary fields'; //to translate $strSetupQueryHistoryDB_desc = 'Enable if you want DB-based query history (requires pmadb). If disabled, this utilizes JS-routines to display query history (lost by window close).'; //to translate -$strSetupQueryHistoryDB_name = 'Permanent query history'; //to translate $strSetupQueryHistoryMax_desc = 'How many queries are kept in history'; //to translate -$strSetupQueryHistoryMax_name = 'Query history length'; //to translate $strSetupQueryWindowDefTab_desc = 'Tab displayed when opening a new query window'; //to translate $strSetupQueryWindowDefTab_name = 'Default query window tab'; //to translate $strSetupRecodingEngine_desc = 'Select which functions will be used for character set conversion'; //to translate -$strSetupRecodingEngine_name = 'Recoding engine'; //to translate -$strSetupRestoreDefaultValue = 'Restore default value'; //to translate -$strSetupRevertErroneousFields = 'Try to revert erroneous fields to their default values'; //to translate $strSetupSaveDir_desc = 'Directory where exports can be saved on server'; //to translate -$strSetupSaveDir_name = 'Save directory'; //to translate -$strSetupServerAuthConfigMsg = 'You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set [a@?page=servers&mode=edit&id=%1$d#tab_Server]authentication type[/a] to [kbd]cookie[/kbd] or [kbd]http[/kbd].'; //to translate -$strSetupServerExtensionMsg = 'You should use mysqli for performance reasons'; //to translate -$strSetupServerNoPasswordMsg = 'You allow for connecting to the server without a password.'; //to translate -$strSetupServersAdd = 'Add a new server'; //to translate $strSetupServers_AllowDeny_order_desc = 'Leave blank if not used'; //to translate -$strSetupServers_AllowDeny_order_name = 'Host authentication order'; //to translate $strSetupServers_AllowDeny_rules_desc = 'Leave blank for defaults'; //to translate -$strSetupServers_AllowDeny_rules_name = 'Host authentication rules'; //to translate -$strSetupServers_AllowNoPassword_name = 'Allow logins without a password'; //to translate -$strSetupServers_AllowRoot_name = 'Allow root login'; //to translate -$strSetupServers_auth_swekey_config_name = 'SweKey config file'; //to translate $strSetupServers_auth_type_desc = 'Authentication method to use'; //to translate -$strSetupServers_auth_type_name = 'Authentication type'; //to translate $strSetupServers_bookmarktable_desc = 'Leave blank for no [a@http://wiki.phpmyadmin.net/pma/bookmark]bookmark[/a] support, suggested: [kbd]pma_bookmark[/kbd]'; //to translate -$strSetupServers_bookmarktable_name = 'Bookmark table'; //to translate $strSetupServers_column_info_desc = 'Leave blank for no column comments/mime types, suggested: [kbd]pma_column_info[/kbd]'; //to translate -$strSetupServers_column_info_name = 'Column information table'; //to translate $strSetupServers_compress_desc = 'Compress connection to MySQL server'; //to translate -$strSetupServers_compress_name = 'Compress connection'; //to translate $strSetupServers_connect_type_desc = 'How to connect to server, keep tcp if unsure'; //to translate -$strSetupServers_connect_type_name = 'Connection type'; //to translate -$strSetupServers_controlpass_name = 'Control user password'; //to translate $strSetupServers_controluser_desc = 'A special MySQL user configured with limited permissions, more information available on [a@http://wiki.phpmyadmin.net/pma/controluser]wiki[/a]'; //to translate -$strSetupServers_controluser_name = 'Control user'; //to translate $strSetupServers_CountTables_desc = 'Count tables when showing database list'; //to translate -$strSetupServers_CountTables_name = 'Count tables'; //to translate $strSetupServers_designer_coords_desc = 'Leave blank for no Designer support, suggested: [kbd]pma_designer_coords[/kbd]'; //to translate -$strSetupServers_designer_coords_name = 'Designer table'; //to translate $strSetupServers_DisableIS_desc = 'More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]'; //to translate -$strSetupServers_DisableIS_name = 'Disable use of INFORMATION_SCHEMA'; //to translate -$strSetupServerSecurityInfoMsg = 'If you feel this is necessary, use additional protection settings - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]host authentication[/a] settings and [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.'; //to translate -$strSetupServersEdit = 'Edit server'; //to translate -$strSetupServers_extension_name = 'PHP extension to use'; //to translate $strSetupServers_hide_db_desc = 'Hide databases matching regular expression (PCRE)'; //to translate -$strSetupServers_hide_db_name = 'Hide databases'; //to translate $strSetupServers_history_desc = 'Leave blank for no SQL query history support, suggested: [kbd]pma_history[/kbd]'; //to translate -$strSetupServers_history_name = 'SQL query history table'; //to translate -$strSetupServers_host_name = 'Server hostname'; //to translate -$strSetupServers_LogoutURL_name = 'Logout URL'; //to translate $strSetupServers_nopassword_desc = 'Try to connect without password'; //to translate -$strSetupServers_nopassword_name = 'Connect without password'; //to translate $strSetupServers_only_db_desc = 'You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\''; //to translate -$strSetupServers_only_db_name = 'Show only listed databases'; //to translate $strSetupServers_password_desc = 'Leave empty if not using config auth'; //to translate -$strSetupServers_password_name = 'Password for config auth'; //to translate $strSetupServers_pdf_pages_desc = 'Leave blank for no PDF schema support, suggested: [kbd]pma_pdf_pages[/kbd]'; //to translate -$strSetupServers_pdf_pages_name = 'PDF schema: pages table'; //to translate $strSetupServers_pmadb_desc = 'Database used for relations, bookmarks, and PDF features. See [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Suggested: [kbd]phpmyadmin[/kbd]'; //to translate -$strSetupServers_pmadb_name = 'PMA database'; //to translate $strSetupServers_port_desc = 'Port on which MySQL server is listening, leave empty for default'; //to translate -$strSetupServers_port_name = 'Server port'; //to translate $strSetupServers_relation_desc = 'Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma_relation[/kbd]'; //to translate -$strSetupServers_relation_name = 'Relation table'; //to translate $strSetupServers_ShowDatabasesCommand_desc = 'SQL command to fetch available databases'; //to translate -$strSetupServers_ShowDatabasesCommand_name = 'SHOW DATABASES command'; //to translate $strSetupServers_SignonSession_desc = 'See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example'; //to translate -$strSetupServers_SignonSession_name = 'Signon session name'; //to translate -$strSetupServers_SignonURL_name = 'Signon URL'; //to translate -$strSetupServerSslMsg = 'You should use SSL connections if your web server supports it'; //to translate $strSetupServers_socket_desc = 'Socket on which MySQL server is listening, leave empty for default'; //to translate -$strSetupServers_socket_name = 'Server socket'; //to translate -$strSetupServers_ssl_desc = ''; //to translate -$strSetupServers_ssl_name = 'Use SSL'; //to translate $strSetupServers_table_coords_desc = 'Leave blank for no PDF schema support, suggested: [kbd]pma_table_coords[/kbd]'; //to translate -$strSetupServers_table_coords_name = 'PDF schema: table coordinates'; //to translate $strSetupServers_table_info_desc = 'Table to describe the display fields, leave blank for no support; suggested: [kbd]pma_table_info[/kbd]'; //to translate -$strSetupServers_table_info_name = 'Display fields table'; //to translate $strSetupServers_user_desc = 'Leave empty if not using config auth'; //to translate -$strSetupServers_user_name = 'User for config auth'; //to translate $strSetupServers_verbose_check_desc = 'Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance'; //to translate -$strSetupServers_verbose_check_name = 'Verbose check'; //to translate -$strSetupServers_verbose_name = 'Verbose name of this server'; //to translate -$strSetupSetValue = 'Set value: %s'; //to translate $strSetupShowAll_desc = 'Whether a user should be displayed a "show all (records)" button'; //to translate $strSetupShowAll_name = 'Allow to display all the rows'; //to translate -$strSetupShowCreateDb_name = 'Show create database form'; //to translate -$strSetupShowForm = 'Show form'; //to translate -$strSetupShowFunctionFields_desc = 'Display the function fields in edit/insert mode'; //to translate -$strSetupShowFunctionFields_name = 'Show function fields'; //to translate -$strSetupShowHiddenMessages = 'Show hidden messages (#MSG_COUNT)'; //to translate $strSetupShowChgPassword_desc = 'Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly'; //to translate $strSetupShowChgPassword_name = 'Show password change form'; //to translate +$strSetupShowCreateDb_name = 'Show create database form'; //to translate +$strSetupShowFunctionFields_desc = 'Display the function fields in edit/insert mode'; //to translate +$strSetupShowFunctionFields_name = 'Show function fields'; //to translate $strSetupShowPhpInfo_desc = 'Shows link to [a@http://php.net/manual/function.phpinfo.php]phpinfo()[/a] output'; //to translate $strSetupShowPhpInfo_name = 'Show phpinfo() link'; //to translate $strSetupShowServerInfo_name = 'Show detailed MySQL server information'; //to translate $strSetupShowSQL_desc = 'Defines whether SQL queries generated by phpMyAdmin should be displayed'; //to translate -$strSetupShowSQL_name = 'Show SQL queries'; //to translate $strSetupShowStats_desc = 'Allow to display database and table statistics (eg. space usage)'; //to translate $strSetupShowStats_name = 'Show statistics'; //to translate $strSetupShowTooltipAliasDB_desc = 'If tooltips are enabled and a database comment is set, this will flip the comment and the real name'; //to translate @@ -1433,7 +1519,6 @@ $strSetupShowTooltipAliasTB_desc = 'When setting this to [kbd]nested[/kbd], the $strSetupShowTooltipAliasTB_name = 'Display table comment instead of its name'; //to translate $strSetupShowTooltip_name = 'Display table comments in tooltips'; //to translate $strSetupSkipLockedTables_desc = 'Mark used tables and make it possible to show databases with locked tables'; //to translate -$strSetupSkipLockedTables_name = 'Skip locked tables'; //to translate $strSetupSQLQuery_Edit_name = 'Edit'; //to translate $strSetupSQLQuery_Explain_name = 'Explain SQL'; //to translate $strSetupSQLQuery_Refresh_name = 'Refresh'; //to translate @@ -1441,47 +1526,35 @@ $strSetupSQLQuery_ShowAsPHP_name = 'Create PHP Code'; //to translate $strSetupSQLQuery_Validate_name = 'Validate SQL'; //to translate $strSetupSuggestDBName_desc = 'Suggest a database name on the "Create Database" form (if possible) or keep the text field empty'; //to translate $strSetupSuggestDBName_name = 'Suggest new database name'; //to translate -$strSetupTrue = 'yes'; //to translate $strSetupTrustedProxies_desc = 'Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]'; //to translate -$strSetupTrustedProxies_name = 'List of trusted proxies for IP allow/deny'; //to translate $strSetupUploadDir_desc = 'Directory on server where you can upload files for import'; //to translate -$strSetupUploadDir_name = 'Upload directory'; //to translate $strSetupUseDbSearch_desc = 'Allow for searching inside the entire database'; //to translate -$strSetupUseDbSearch_name = 'Use database search'; //to translate $strSetupVerboseMultiSubmit_desc = 'Show affected rows of each statement on multiple-statement queries. See libraries/import.lib.php for defaults on how many queries a statement may contain.'; //to translate -$strSetupVerboseMultiSubmit_name = 'Verbose multiple statements'; //to translate -$strSetupVersionCheckDataError = 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'; //to translate -$strSetupVersionCheckInvalid = 'Got invalid version string from server'; //to translate -$strSetupVersionCheckLink = 'Check for latest version'; //to translate -$strSetupVersionCheckNewAvailableSvn = 'You are using subversion version, run [kbd]svn update[/kbd] :-)[br]The latest stable version is %s, released on %s.'; //to translate -$strSetupVersionCheckNone = 'No newer stable version is available'; //to translate -$strSetupVersionCheckUnparsable = 'Unparsable version string'; //to translate -$strSetupVersionCheck = 'Version check'; //to translate -$strSetupVersionCheckWrapperError = 'Neither URL wrapper nor CURL is available. Version check is not possible.'; //to translate -$strSetupWarning = 'Warning'; //to translate $strSetupZipDump_desc = 'Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations'; //to translate -$strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.'; //to translate -$strSetupZipDump_name = 'ZIP'; //to translate -$strStatic = 'static'; //to translate -$strSuhosin = 'Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'; //to translate -$strSwekeyAuthenticating = 'Authentisiere ...'; //to translate -$strTexyText = 'Texy! text'; //to translate - -$strViewHasAtLeast = 'This view has at least this number of rows. Please refer to %sdocumentation%s.'; //to translate - -$strConfigDirectoryWarning = 'Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'; //to translate -$strRemoveCRLF = 'Remove CRLF characters within fields'; //to translate -$strDoNotAutoIncrementZeroValues = 'Do not use AUTO_INCREMENT for zero values'; //to translate -$strAndSmall = 'and'; //to translate -$strReplicationStatus = 'Replication status'; //to translate -$strReplicationStatusInfo = 'This MySQL server works as %s in replication process. For further information about replication status on the server, please visit the replication section.'; //to translate -$strReplicationStatus_master = 'Master status'; //to translate -$strReplicationStatus_slave = 'Slave status'; //to translate -$strNavTableFilter = 'Filter'; //to translate -$strPhpArray = 'PHP array'; //to translate -$strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate -$strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate -$strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate ?> diff --git a/lang/greek-utf-8.inc.php b/lang/greek-utf-8.inc.php index b2474e4ee..80785c519 100644 --- a/lang/greek-utf-8.inc.php +++ b/lang/greek-utf-8.inc.php @@ -18,24 +18,24 @@ $datefmt = '%d %B %Y, στις %I:%M %p'; // To Arrange -$timespanfmt = '%s μέρες, %s ώρες, %s λεπτά and %s δευτερόλεπτα'; +$timespanfmt = '%s μέρες, %s ώρες, %s λεπτά and %s δευτερόλεπτα'; -$strAbortedClients = 'Ακυρωμένες συνδέσεις'; -$strAccessDeniedExplanation = 'Το phpMyAdmin προσπάθησε να συνδεθεί με τον διακομιστή MySQL αλλά ο διακομιστής απέριψε τη σύνδεση. Θα πρέπει να ελέγξετε την διεύθυνση, το όνομα χρήστη και τον κωδικό πρόσβασης στο αρχείο ρυθμίσεων config.inc.php και να βεβαιωθείτε ότι αντιστοιχούν σε αυτά που σας έχει δώσει ο διαχειρηστής του διακομιστή MySQL.'; +$strAbortedClients = 'Ακυρωμένες συνδέσεις'; +$strAccessDeniedExplanation = 'Το phpMyAdmin προσπάθησε να συνδεθεί με τον διακομιστή MySQL αλλά ο διακομιστής απέριψε τη σύνδεση. Θα πρέπει να ελέγξετε την διεύθυνση, το όνομα χρήστη και τον κωδικό πρόσβασης στο αρχείο ρυθμίσεων config.inc.php και να βεβαιωθείτε ότι αντιστοιχούν σε αυτά που σας έχει δώσει ο διαχειρηστής του διακομιστή MySQL.'; $strAccessDenied = '\'Αρνηση Πρόσβασης'; $strAction = 'Ενέργεια'; -$strAddAutoIncrement = 'Προσθήκη τιμής AUTO_INCREMENT'; +$strAddAutoIncrement = 'Προσθήκη τιμής AUTO_INCREMENT'; $strAddDeleteColumn = 'Προσθήκη/Αφαίρεση Στήλης Πεδίου'; $strAddDeleteRow = 'Προσθήκη/Αφαίρεση Γραμμής Κριτηρίων'; $strAddIntoComments = 'Προσθήκη στα σχόλια'; $strAddNewField = 'Προσθήκη νέου Πεδίου'; -$strAddPrivilegesOnDb = 'Προσθήκη προνομίων στην ακόλουθη βάση δεδομένων'; -$strAddPrivilegesOnTbl = 'Προσθήκη δεδομένων στον ακόλουθο πίνακα'; +$strAddPrivilegesOnDb = 'Προσθήκη προνομίων στην ακόλουθη βάση δεδομένων'; +$strAddPrivilegesOnTbl = 'Προσθήκη δεδομένων στον ακόλουθο πίνακα'; $strAddSearchConditions = 'Προσθήκη νέου όρου (σώμα της "where" πρότασης):'; $strAddToIndex = 'Προσθήκη στο ευρετήριο  %s κολώνας(ων)'; $strAddUserMessage = 'Προσθέσατε ένα νέο χρήστη.'; $strAddUser = 'Προσθήκη νέου Χρήστη'; -$strAdministration = 'Διαχείριση'; +$strAdministration = 'Διαχείριση'; $strAfterInsertBack = 'Επιστροφή'; $strAfterInsertNewInsert = 'Εισαγωγή νέας εγγραφής'; $strAfter = 'Μετά το %s'; @@ -49,18 +49,18 @@ $strAnyHost = 'Οποιοδήποτε Σύστημα'; $strAnyUser = 'Οποιοσδήποτε Χρήστης'; $strAny = 'Οποιοδήποτε'; $strAPrimaryKey = 'Ένα πρωτεύον κλειδί προστέθηκε στο %s'; -$strArabic = 'Αραβικά'; -$strArmenian = 'Αρμενικά'; +$strArabic = 'Αραβικά'; +$strArmenian = 'Αρμενικά'; $strAscending = 'Αύξουσα'; $strAtBeginningOfTable = 'Στην αρχή του Πίνακα'; $strAtEndOfTable = 'Στο τέλος του Πίνακα'; $strAttr = 'Χαρακτηριστικά'; -$strAutomaticLayout = 'Αυτόματη διάταξη'; +$strAutomaticLayout = 'Αυτόματη διάταξη'; $strBack = 'Επιστροφή'; -$strBaltic = 'Βαλτικής'; -$strBeginCut = 'BEGIN CUT'; -$strBeginRaw = 'BEGIN RAW'; +$strBaltic = 'Βαλτικής'; +$strBeginCut = 'BEGIN CUT'; +$strBeginRaw = 'BEGIN RAW'; $strBinaryDoNotEdit = 'Δυαδικό - χωρίς δυνατότητα επεξεργασίας'; $strBinary = 'Δυαδικό'; $strBookmarkDeleted = 'Η ετικέτα διεγράφη.'; @@ -69,196 +69,196 @@ $strBookmarkQuery = 'Αποθηκευμένο επερώτημα SQL'; $strBookmarkThis = 'Αποθήκευση αυτού του επερωτήματος SQL'; $strBookmarkView = 'Μόνο ανάγνωση'; $strBrowse = 'Περιήγηση'; -$strBulgarian = 'Βουλγαρικά'; +$strBulgarian = 'Βουλγαρικά'; $strBzip = 'συμπίεση «bzip»'; -$strCannotLogin = 'Δεν ήταν δυνατή η σύνδεση με τον διακομιστή MySQL'; -$strCantLoadRecodeIconv = 'Δεν είναι δυνατή η φόρτωση της επέκτασης iconv ή recode που χρειάζεται για την μετατροπή του σετ χαρακτήρων. Ρυθμίστε την php να επιτρέπει την χρήση αυτών των επεκτάσεων ή απανεργοποιήστε την μετατροπή χαρακτήρων στο phpMyAdmin.'; -$strCantLoad = 'δεν ήταν δυνατή η φόρτωση της επέκτασης %s ,
    παρακαλώ ελέγξτε τις ρυθμίσεις της PHP'; +$strCannotLogin = 'Δεν ήταν δυνατή η σύνδεση με τον διακομιστή MySQL'; +$strCantLoadRecodeIconv = 'Δεν είναι δυνατή η φόρτωση της επέκτασης iconv ή recode που χρειάζεται για την μετατροπή του σετ χαρακτήρων. Ρυθμίστε την php να επιτρέπει την χρήση αυτών των επεκτάσεων ή απανεργοποιήστε την μετατροπή χαρακτήρων στο phpMyAdmin.'; +$strCantLoad = 'δεν ήταν δυνατή η φόρτωση της επέκτασης %s ,
    παρακαλώ ελέγξτε τις ρυθμίσεις της PHP'; $strCantRenameIdxToPrimary = 'Η μετονομασία του ευρετηρίου σε PRIMARY σε είναι εφικτή!'; -$strCantUseRecodeIconv = 'Δεν είναι δυνατή η χρήση της επέκτασης iconv ούτε της libiconv ούτε της ρουτίνας recode_string, ενώ η επέκταση έχει φορτωθεί. Ελέξτε τις ρυθμίσεις της php.'; +$strCantUseRecodeIconv = 'Δεν είναι δυνατή η χρήση της επέκτασης iconv ούτε της libiconv ούτε της ρουτίνας recode_string, ενώ η επέκταση έχει φορτωθεί. Ελέξτε τις ρυθμίσεις της php.'; $strCardinality = 'Μοναδικότητα'; -$strCentralEuropean = 'Κεντρικής Ευρώπης'; -$strChangeCopyModeCopy = '... διατήρηση του παλιού χρήστη.'; -$strChangeCopyModeDeleteAndReload = ' ... διαγραφή του παλιού χρήστη από τους πίνακες χρηστών και επαναφόρτωση των προνομίων.'; -$strChangeCopyModeJustDelete = ' ... διαγραφή του παλιού χρήστη από τους πίνακες χρηστών.'; -$strChangeCopyModeRevoke = ' ... ανάκληση των προνομίων του παλιού χρήστη και διαγραφή του.'; -$strChangeCopyMode = 'Δημιουργία νέα χρήστη με τα ίδια προνόμια και ...'; -$strChangeCopyUser = 'Αλλαγή Στοιχείων Πρόσβασης / Αντιγραφή Χρήστη'; +$strCentralEuropean = 'Κεντρικής Ευρώπης'; +$strChangeCopyModeCopy = '... διατήρηση του παλιού χρήστη.'; +$strChangeCopyModeDeleteAndReload = ' ... διαγραφή του παλιού χρήστη από τους πίνακες χρηστών και επαναφόρτωση των προνομίων.'; +$strChangeCopyModeJustDelete = ' ... διαγραφή του παλιού χρήστη από τους πίνακες χρηστών.'; +$strChangeCopyModeRevoke = ' ... ανάκληση των προνομίων του παλιού χρήστη και διαγραφή του.'; +$strChangeCopyMode = 'Δημιουργία νέα χρήστη με τα ίδια προνόμια και ...'; +$strChangeCopyUser = 'Αλλαγή Στοιχείων Πρόσβασης / Αντιγραφή Χρήστη'; $strChangeDisplay = 'Επιλέξτε πεδίο για εμφάνιση'; $strChangePassword = 'Αλλαγή κωδικού πρόσβασης'; $strChange = 'Αλλαγή'; -$strCharsetOfFile = 'Σετ χαρακτήρων του αρχείου:'; -$strCharsets = 'Σετ χαρακτήρων'; -$strCharset = 'Σετ χαρακτήρων'; +$strCharsetOfFile = 'Σετ χαρακτήρων του αρχείου:'; +$strCharsets = 'Σετ χαρακτήρων'; +$strCharset = 'Σετ χαρακτήρων'; $strCheckAll = 'Επιλογή όλων'; -$strCheckPrivsLong = 'Έλεγχος προνομίων για τη βάση "%s".'; -$strCheckPrivs = 'Έλεγχος Προνομίων'; +$strCheckPrivsLong = 'Έλεγχος προνομίων για τη βάση "%s".'; +$strCheckPrivs = 'Έλεγχος Προνομίων'; $strCheckTable = 'Έλεγχος πίνακα'; -$strChoosePage = 'Παρακαλώ επιλέξτε σελίδα για αλλαγή'; +$strChoosePage = 'Παρακαλώ επιλέξτε σελίδα για αλλαγή'; $strColComFeat = 'Εμφάνιση σχολίων πεδίων'; $strColumnNames = 'Ονόματα στηλών'; -$strColumnPrivileges = 'Προνόμια πεδίων'; -$strCommand = 'Εντολή'; -$strComments = 'Σχόλια'; +$strColumnPrivileges = 'Προνόμια πεδίων'; +$strCommand = 'Εντολή'; +$strComments = 'Σχόλια'; $strCompleteInserts = 'Ολοκληρωμένες εντολές «Insert»'; -$strCompression = 'Συμπίεση'; -$strConfigFileError = 'Το phpMyAdmin δεν μπόρεσε να διαβάσει το αρχείο ρυθμίσεων!
    Αυτό μπορεί να συμβεί εάν η php βρει κάποιο λάθος στο αρχείο ή εάν η php δεν μπορεί να βρει το αρχείο.
    Παρακαλώ καλέστε το αρχείο ρυθμίσεων απ\' ευθείας χρησιμοποιώντας το ακόλουθο link και διαβάστε τα μυνήματα λάθους που θα επιστρέψει η php. Στις περισσότερες περιπτώσεις κάπου λείπουν εισαγωγικά (") ή ερωτιματικά (;).
    Εάν η php επιστρέψει μια λευκή σελίδα, όλα είναι σωστά.'; -$strConfigureTableCoord = 'Παρακαλώ ορίστε τις συντεταγμένες για τον πίνακα %s'; -$strConnections = 'Συνδέσεις'; +$strCompression = 'Συμπίεση'; +$strConfigFileError = 'Το phpMyAdmin δεν μπόρεσε να διαβάσει το αρχείο ρυθμίσεων!
    Αυτό μπορεί να συμβεί εάν η php βρει κάποιο λάθος στο αρχείο ή εάν η php δεν μπορεί να βρει το αρχείο.
    Παρακαλώ καλέστε το αρχείο ρυθμίσεων απ\' ευθείας χρησιμοποιώντας το ακόλουθο link και διαβάστε τα μυνήματα λάθους που θα επιστρέψει η php. Στις περισσότερες περιπτώσεις κάπου λείπουν εισαγωγικά (") ή ερωτιματικά (;).
    Εάν η php επιστρέψει μια λευκή σελίδα, όλα είναι σωστά.'; +$strConfigureTableCoord = 'Παρακαλώ ορίστε τις συντεταγμένες για τον πίνακα %s'; +$strConnections = 'Συνδέσεις'; $strCookiesRequired = 'Από αυτό το σημείο πρέπει να έχετε ενεργοποιημένα cookies.'; $strCopyTableOK = 'Ο Πίνακας %s αντιγράφηκε στο %s.'; -$strCopyTableSameNames = 'Δεν είναι δυνατή η αντιγραφή του πίνακα στον εαυτό του!'; +$strCopyTableSameNames = 'Δεν είναι δυνατή η αντιγραφή του πίνακα στον εαυτό του!'; $strCopyTable = 'Αντιγραφή πίνακα σε (βάση.πίνακας):'; -$strCouldNotKill = 'Το phpMyAdmin δεν μπόρεσε να διακόψει τη λειτουργία %s. Μπορεί να έχει ήδη σταματήσει.'; +$strCouldNotKill = 'Το phpMyAdmin δεν μπόρεσε να διακόψει τη λειτουργία %s. Μπορεί να έχει ήδη σταματήσει.'; $strCreateIndexTopic = 'Δημιουργία νέου ευρετηρίου'; $strCreateIndex = 'Δημιουργία ευρετηρίου σε  %s πεδία'; $strCreateNewDatabase = 'Δημιουργία νέας βάσης'; $strCreateNewTable = 'Δημιουργία νέου πίνακα στη βάση %s'; -$strCreatePage = 'Δημιουργία νέας σελίδας'; +$strCreatePage = 'Δημιουργία νέας σελίδας'; $strCreatePdfFeat = 'Δημιουργία αρχείων PDF'; $strCreate = 'Δημιουργία'; $strCriteria = 'Κριτήρια'; -$strCroatian = 'Κροατικά'; -$strCyrillic = 'Κυριλλικά'; -$strCzech = 'Τσεχικά'; +$strCroatian = 'Κροατικά'; +$strCyrillic = 'Κυριλλικά'; +$strCzech = 'Τσεχικά'; -$strDanish = 'Δανικά'; +$strDanish = 'Δανικά'; $strDatabaseExportOptions = 'Επιλογές εξαγωγής βάσης δεδομένων'; $strDatabaseHasBeenDropped = 'Η βάση δεδομένων %s διεγράφη.'; -$strDatabasesDropped = '%s βάσεις δεδομένων διεγράφησαν επιτυχώς.'; -$strDatabasesStatsDisable = 'Απενεργοποίηση Στατιστικών'; -$strDatabasesStatsEnable = 'Ενεργοποίηση Στατιστικών'; -$strDatabasesStatsHeavyTraffic = 'Σημείωση: Η ενεργοποίηση στατιστικών μπορεί να προκαλέσει μεγάλη μεταφορά δεδομένων μεταξύ του διακομιστή διαδικτύου και του διακομιστή MySQL.'; +$strDatabasesDropped = '%s βάσεις δεδομένων διεγράφησαν επιτυχώς.'; +$strDatabasesStatsDisable = 'Απενεργοποίηση Στατιστικών'; +$strDatabasesStatsEnable = 'Ενεργοποίηση Στατιστικών'; +$strDatabasesStatsHeavyTraffic = 'Σημείωση: Η ενεργοποίηση στατιστικών μπορεί να προκαλέσει μεγάλη μεταφορά δεδομένων μεταξύ του διακομιστή διαδικτύου και του διακομιστή MySQL.'; $strDatabasesStats = 'Στατιστικά βάσης'; $strDatabases = 'Βάσεις Δεδομένων'; $strDatabase = 'Βάση'; -$strDataDict = 'Λεξικό δεδομένων'; +$strDataDict = 'Λεξικό δεδομένων'; $strDataOnly = 'Μόνο τα δεδομένα'; $strData = 'Δεδομένα'; $strDBComment = 'Σχόλιο βάσης: '; -$strDbPrivileges = 'Προνόμια βάσης δεδομένων'; -$strDbSpecific = 'Χρήστης Βάσης'; -$strDefaultValueHelp = 'Για προκαθορισμένες τιμές, παρακαλώ εισάγετε μία τιμή, χωρίς χαρακτήρες διαφυγής ή εισαγωγικά, χρησιμοποιώντας τη μορφή: a'; +$strDbPrivileges = 'Προνόμια βάσης δεδομένων'; +$strDbSpecific = 'Χρήστης Βάσης'; +$strDefaultValueHelp = 'Για προκαθορισμένες τιμές, παρακαλώ εισάγετε μία τιμή, χωρίς χαρακτήρες διαφυγής ή εισαγωγικά, χρησιμοποιώντας τη μορφή: a'; $strDefault = 'Προκαθορισμένο'; -$strDeleteAndFlushDescr = 'Αυτός είναι ο πιο "καθαρός" τρόπος, αλλά η επαναφόρτωση των προνομίων μπορεί να καθυστερήσει.'; -$strDeleteAndFlush = 'Διαγραφή των χρηστών και επαναφόρτωση των προνομίων.'; +$strDeleteAndFlushDescr = 'Αυτός είναι ο πιο "καθαρός" τρόπος, αλλά η επαναφόρτωση των προνομίων μπορεί να καθυστερήσει.'; +$strDeleteAndFlush = 'Διαγραφή των χρηστών και επαναφόρτωση των προνομίων.'; $strDeleted = 'Η Εγγραφή έχει διαγραφεί'; $strDelete = 'Διαγραφή'; -$strDeleting = 'Διαγραφή %s'; -$strDelOld = 'Η τρέχουσα σελίδα έχει αναφορές σε πίνακες που δεν υπάρχουν πια. Θέλετε να διαγραφές αυτές οι αναφορές;'; +$strDeleting = 'Διαγραφή %s'; +$strDelOld = 'Η τρέχουσα σελίδα έχει αναφορές σε πίνακες που δεν υπάρχουν πια. Θέλετε να διαγραφές αυτές οι αναφορές;'; $strDescending = 'Φθίνουσα'; -$strDescription = 'Περιγραφή'; -$strDictionary = 'λεξικό'; +$strDescription = 'Περιγραφή'; +$strDictionary = 'λεξικό'; $strDisabled = 'Απενεργοποιημένο'; $strDisplayFeat = 'Λειτουργίες εμφάνισης'; $strDisplayOrder = 'Σειρά εμφάνισης:'; -$strDisplayPDF = 'Εμφάνιση σχήματος PDF'; +$strDisplayPDF = 'Εμφάνιση σχήματος PDF'; $strDoAQuery = 'Εκτέλεσε ένα «επερώτημα κατά παράδειγμα» (χαρακτήρας μπαλαντέρ "%")'; $strDocu = 'Τεκμηρίωση'; $strDoYouReally = 'Θέλετε να εκτελέσετε την εντολή'; -$strDropUsersDb = 'Διαγραφή βάσεων δεδομένων που έχουν ίδια ονόματα με χρήστες.'; +$strDropUsersDb = 'Διαγραφή βάσεων δεδομένων που έχουν ίδια ονόματα με χρήστες.'; $strDrop = 'Διαγραφή'; $strDumpingData = '\'Αδειασμα δεδομένων του πίνακα'; -$strDumpSaved = 'Το αρχείο εξόδου αποθηκεύτηκε ως %s.'; -$strDumpXRows = 'Εμφάνιση %s εγγραφών ξεκινώντας από την εγγραφή %s.'; +$strDumpSaved = 'Το αρχείο εξόδου αποθηκεύτηκε ως %s.'; +$strDumpXRows = 'Εμφάνιση %s εγγραφών ξεκινώντας από την εγγραφή %s.'; $strDynamic = 'δυναμικά'; -$strEditPDFPages = 'Αλλαγή σελίδων PDF'; +$strEditPDFPages = 'Αλλαγή σελίδων PDF'; $strEditPrivileges = 'Επεξεργασία Προνομίων'; $strEdit = 'Επεξεργασία'; $strEffective = 'Αποτελεσματικός'; $strEmptyResultSet = 'Η MySQL επέστρεψε ένα άδειο σύνολο αποτελεσμάτων (π.χ. καμμία εγγραφή).'; $strEmpty = '\'Αδειασμα'; $strEnabled = 'Ενεργοποιημένο'; -$strEndCut = 'END CUT'; -$strEndRaw = 'END RAW'; +$strEndCut = 'END CUT'; +$strEndRaw = 'END RAW'; $strEnd = 'Τέλος'; $strEnglishPrivileges = ' Σημείωση: Τα ονόματα προνομίων της MySQL εκφράζονται στα Αγγλικά '; -$strEnglish = 'Αγγλικά'; +$strEnglish = 'Αγγλικά'; $strError = 'λάθος'; -$strEstonian = 'Εσθονικά'; -$strExecuteBookmarked = 'Εκτέλεση αποθηκευμένου επερωτήματος'; -$strExplain = 'Ανάλυση SQL'; -$strExport = 'Εξαγωγή'; +$strEstonian = 'Εσθονικά'; +$strExecuteBookmarked = 'Εκτέλεση αποθηκευμένου επερωτήματος'; +$strExplain = 'Ανάλυση SQL'; +$strExport = 'Εξαγωγή'; $strExtendedInserts = 'Εκτεταμένες εντολές «Insert»'; $strExtra = 'Πρόσθετα'; -$strFailedAttempts = 'Αποτυχημένες προσπάθειες'; +$strFailedAttempts = 'Αποτυχημένες προσπάθειες'; $strFieldHasBeenDropped = 'Το πεδίο %s διεγράφη'; $strFieldsEnclosedBy = 'Πεδία που περικλείονται σε'; $strFieldsEscapedBy = 'Τα πεδία χρησιμοποιούν το χαρακτήρα διαφυγής '; $strFieldsTerminatedBy = 'Πεδία που τελειώνουν σε'; $strFields = 'Πεδία'; $strField = 'Πεδίο'; -$strFileAlreadyExists = 'Το αρχείο %s υπάρχει ήδη στον διακομιστή. Επιλέξτε διαφορετικό όνομα αρχείου ή ενεργοποιήστε την επιλογή αντικατάστασης.'; -$strFileCouldNotBeRead = 'Δεν ήταν δυνατή η ανάγνωση του αρχείου'; +$strFileAlreadyExists = 'Το αρχείο %s υπάρχει ήδη στον διακομιστή. Επιλέξτε διαφορετικό όνομα αρχείου ή ενεργοποιήστε την επιλογή αντικατάστασης.'; +$strFileCouldNotBeRead = 'Δεν ήταν δυνατή η ανάγνωση του αρχείου'; $strFileNameTemplateRemember = 'αποθήκευση μορφής'; $strFileNameTemplate = 'Μορφή ονόματος αρχείου'; -$strFlushPrivilegesNote = 'Σημείωση: Το phpMyAdmin διαβάζει τα προνόμια των χρηστών απ\' ευθείεας από τους πίνακες προνομίων της MySQL. Το περιεχόμενο αυτών των πινάκων μπορεί να διαφέρει από τα προνόμια που χρησιμοποιεί ο διακομιστής εάν έχουν γίνει αλλαγές χειροκίνητα. Σε αυτήν την περίπτωση, θα πρέπει να %sεπαναφορτώσετε τα προνόμια%s πριν συνεχίσετε.'; +$strFlushPrivilegesNote = 'Σημείωση: Το phpMyAdmin διαβάζει τα προνόμια των χρηστών απ\' ευθείεας από τους πίνακες προνομίων της MySQL. Το περιεχόμενο αυτών των πινάκων μπορεί να διαφέρει από τα προνόμια που χρησιμοποιεί ο διακομιστής εάν έχουν γίνει αλλαγές χειροκίνητα. Σε αυτήν την περίπτωση, θα πρέπει να %sεπαναφορτώσετε τα προνόμια%s πριν συνεχίσετε.'; $strFlushTable = 'Εκκαθάριση ("FLUSH") πίνακα'; $strFormat = 'Μορφοποίηση'; $strFormEmpty = 'Ελλειπής τιμή στο πεδίο !'; $strFullText = 'Πλήρη κείμενα'; $strFunction = 'Έλεγχος'; -$strGenBy = 'Δημιουργήθηκε από:'; +$strGenBy = 'Δημιουργήθηκε από:'; $strGeneralRelationFeat = 'Γενικές λειτουργίες συσχέτισης'; $strGenTime = 'Χρόνος δημιουργίας'; -$strGerman = 'Γερμανικά'; -$strGlobalPrivileges = 'Γενικά προνόμια'; -$strGlobalValue = 'Γενική τιμή'; -$strGlobal = 'Γενικός'; +$strGerman = 'Γερμανικά'; +$strGlobalPrivileges = 'Γενικά προνόμια'; +$strGlobalValue = 'Γενική τιμή'; +$strGlobal = 'Γενικός'; $strGo = 'Εκτέλεση'; $strGrantOption = 'Χορήγηση'; // Grant -$strGreek = 'Ελληνικά'; +$strGreek = 'Ελληνικά'; $strGzip = 'συμπίεση «gzip»'; $strHasBeenAltered = 'έχει αλλαχθεί.'; -$strHaveToShow = 'Πρέπει να επιλέξετε τουλάχιστον μία στήλη για εμφάνιση'; -$strHebrew = 'Εβραϊκά'; +$strHaveToShow = 'Πρέπει να επιλέξετε τουλάχιστον μία στήλη για εμφάνιση'; +$strHebrew = 'Εβραϊκά'; $strHomepageOfficial = 'Επίσημη σελίδα του phpMyAdmin'; $strHome = 'Κεντρική σελίδα'; $strHostEmpty = 'Το όνομα του Συστήματος είναι κενό!'; $strHost = 'Σύστημα'; -$strHungarian = 'Ουγγρικά'; +$strHungarian = 'Ουγγρικά'; -$strId = 'ID'; +$strId = 'ID'; $strIdxFulltext = 'Πλήρες κείμενο'; $strIgnore = 'Παράληψη'; -$strImportFiles = 'Εισαγωγή αρχείων'; +$strImportFiles = 'Εισαγωγή αρχείων'; $strIndexes = 'Ευρετήρια'; $strIndexHasBeenDropped = 'Το ευρετήριο %s διεγράφη'; $strIndexName = 'Όνομα ευρετηρίου :'; $strIndexType = 'Τύπος ευρετηρίου :'; $strIndex = 'Ευρετήριο'; -$strInnodbStat = 'Κατάσταση InnoDB'; -$strInsecureMySQL = 'Το αρχείο ρυθμίσεών σας περιέχει ρυθμίσεις (χρήστης root χωρίς κωδικό πρόσβασης) που αντιστοιχούν στον εξ\' ορισμού λογαριασμό χρήστη MySQL. Ο διακομιστής MySQL σας που τρέχει με αυτή τη ρύθμιση, είναι ανοιχτός σε επιθέσεις και θα πρέπει να διορθώσετε το πρόβλημα.'; +$strInnodbStat = 'Κατάσταση InnoDB'; +$strInsecureMySQL = 'Το αρχείο ρυθμίσεών σας περιέχει ρυθμίσεις (χρήστης root χωρίς κωδικό πρόσβασης) που αντιστοιχούν στον εξ\' ορισμού λογαριασμό χρήστη MySQL. Ο διακομιστής MySQL σας που τρέχει με αυτή τη ρύθμιση, είναι ανοιχτός σε επιθέσεις και θα πρέπει να διορθώσετε το πρόβλημα.'; $strInsertAsNewRow = 'Εισαγωγή ως νέα εγγραφές'; $strInsert = 'Εισαγωγή'; $strInUse = 'σε χρήση'; -$strJapanese = 'Ιαπωνικά'; -$strJumpToDB = 'Μεταπήδηση στην βάση "%s".'; -$strJustDeleteDescr = 'Οι "διεγραμμένοι" χρήστες θα συνεχίσουν να έχουν πρόσβαση στον διακομιστή μέχρις ότου να επαναφορτωθούν οι πίνακες προνομίων.'; -$strJustDelete = 'Απλή διαγραφή των χρηστών από τους πίνακες προνομίων.'; +$strJapanese = 'Ιαπωνικά'; +$strJumpToDB = 'Μεταπήδηση στην βάση "%s".'; +$strJustDeleteDescr = 'Οι "διεγραμμένοι" χρήστες θα συνεχίσουν να έχουν πρόσβαση στον διακομιστή μέχρις ότου να επαναφορτωθούν οι πίνακες προνομίων.'; +$strJustDelete = 'Απλή διαγραφή των χρηστών από τους πίνακες προνομίων.'; $strKeepPass = 'Διατήρηση κωδικού πρόσβασης'; $strKeyname = 'Όνομα κλειδιού'; $strKill = 'Τερματισμός'; -$strKorean = 'Κορεατικά'; +$strKorean = 'Κορεατικά'; -$strLandscape = 'Οριζόντια διάταξη'; -$strLaTeX = 'LaTeX'; +$strLandscape = 'Οριζόντια διάταξη'; +$strLaTeX = 'LaTeX'; $strLengthSet = 'Μήκος/Τιμές*'; $strLimitNumRows = 'Εγγραφές ανά σελίδα'; $strLinesTerminatedBy = 'Γραμμές που τελειώνουν σε'; -$strLinkNotFound = 'Δεν βρέθηκε η σύνδεση'; -$strLinksTo = 'Σύνδεση με'; -$strLithuanian = 'Λιθουανικά'; +$strLinkNotFound = 'Δεν βρέθηκε η σύνδεση'; +$strLinksTo = 'Σύνδεση με'; +$strLithuanian = 'Λιθουανικά'; $strLocalhost = 'Τοπικό'; $strLocationTextfile = 'Τοποθεσία του αρχείου κειμένου'; -$strLoginInformation = 'Πληροφορίες Σύνδεσης'; +$strLoginInformation = 'Πληροφορίες Σύνδεσης'; $strLogin = 'Σύνδεση'; $strLogout = 'Αποσύνδεση'; $strLogPassword = 'Κωδικός πρόσβασης:'; @@ -278,20 +278,20 @@ $strModifications = 'Οι αλλαγές αποθηκεύτηκαν'; $strModifyIndexTopic = 'Αλλαγή ενός ευρετηρίου'; $strModify = 'Τροποποίηση'; $strMoveTableOK = 'Ο πίνακας %s μεταφέρθηκε στο %s.'; -$strMoveTableSameNames = 'Δεν είναι δυνατή η μεταφορά του πίνακα στον εαυτό του!'; +$strMoveTableSameNames = 'Δεν είναι δυνατή η μεταφορά του πίνακα στον εαυτό του!'; $strMoveTable = 'Μεταφορά πίνακα σε (βάση.πίνακας):'; -$strMultilingual = 'πολυγλωσσικό'; -$strMySQLCharset = 'Σετ χαρακτήρων της MySQL'; +$strMultilingual = 'πολυγλωσσικό'; +$strMySQLCharset = 'Σετ χαρακτήρων της MySQL'; $strMySQLSaid = 'Η MySQL επέστρεψε το μύνημα: '; $strMySQLShowProcess = 'Εμφάνιση διεργασιών'; $strName = 'Όνομα'; $strNext = 'Επόμενο'; -$strNoDatabasesSelected = 'Δεν έχετε επιλέξει βάσεις.'; +$strNoDatabasesSelected = 'Δεν έχετε επιλέξει βάσεις.'; $strNoDatabases = 'Δεν υπάρχουν βάσεις δεδομένων'; -$strNoDescription = 'χωρίς περιγραφή'; +$strNoDescription = 'χωρίς περιγραφή'; $strNoDropDatabases = 'Οι εντολές «DROP DATABASE» έχουν απενεργοποιηθεί.'; -$strNoExplain = 'Χωρίς ανάλυση SQL'; +$strNoExplain = 'Χωρίς ανάλυση SQL'; $strNoFrames = 'Το phpMyAdmin είναι πιο φιλικό με έναν browser που υποστηρίζει frames.'; $strNoIndexPartsDefined = 'Δεν ορίστηκαν τα στοιχεία του ευρετηρίου!'; $strNoIndex = 'Δεν ορίστηκε ευρετήριο!'; @@ -299,49 +299,49 @@ $strNoModification = 'Χωρίς αλλαγή'; $strNone = 'Κανένα'; $strNoOptions = 'Αυτή η μορφή δεν έχει επιλογές'; $strNoPassword = 'Χωρίς Κωδικό Πρόσβασης'; -$strNoPermission = 'Ο διακομιστής δεν έχει δικαιώματα αποθήκευσης του αρχείου %s.'; -$strNoPhp = 'χωρίς κώδικα PHP'; +$strNoPermission = 'Ο διακομιστής δεν έχει δικαιώματα αποθήκευσης του αρχείου %s.'; +$strNoPhp = 'χωρίς κώδικα PHP'; $strNoPrivileges = 'Χωρίς Προνόμια'; $strNoRights = 'Δεν έχετε αρκετά δικαιώματα να είσαστε εδώ τώρα!'; -$strNoSpace = 'Δεν υπάρχει διαθέσιμος χώρος για την αποθήκευση του αρχείου %s.'; +$strNoSpace = 'Δεν υπάρχει διαθέσιμος χώρος για την αποθήκευση του αρχείου %s.'; $strNoTablesFound = 'Δεν βρέθηκαν Πίνακες στη βάση.'; $strNotNumber = 'Αυτό δεν είναι αριθμός!'; $strNotOK = 'ΛΑΘΟΣ'; -$strNotSet = 'Ο πίνακας %s δεν βρέθηκε ή δεν ορίστηκε στη %s'; +$strNotSet = 'Ο πίνακας %s δεν βρέθηκε ή δεν ορίστηκε στη %s'; $strNoUsersFound = 'Δεν βρέθηκαν χρήστες.'; -$strNoValidateSQL = 'Skip Validate SQL'; +$strNoValidateSQL = 'Skip Validate SQL'; $strNo = 'Όχι'; $strNull = 'Κενό'; $strNumSearchResultsInTable = '%s αποτελέσματα στον πίνακα %s'; $strNumSearchResultsTotal = 'Σύνολο: %s αποτελέσματα'; -$strNumTables = 'Πίνακες'; +$strNumTables = 'Πίνακες'; $strOK = 'OK'; -$strOperations = 'Λειτουργίες'; +$strOperations = 'Λειτουργίες'; $strOptimizeTable = 'Βελτιστοποίηση Πίνακα'; $strOr = 'Ή'; $strOverhead = 'Επιβάρυνση'; -$strOverwriteExisting = 'Αντικατάσταση υπαρχόντων αρχείων'; +$strOverwriteExisting = 'Αντικατάσταση υπαρχόντων αρχείων'; -$strPageNumber = 'Σελίδα:'; -$strPaperSize = 'Μέγεθος χαρτιού'; +$strPageNumber = 'Σελίδα:'; +$strPaperSize = 'Μέγεθος χαρτιού'; $strPartialText = 'Επιμέρους κείμενα'; -$strPasswordChanged = 'Ο Κωδικός Πρόσβασης για τον χρήστη %s άλλαξε επιτυχώς.'; +$strPasswordChanged = 'Ο Κωδικός Πρόσβασης για τον χρήστη %s άλλαξε επιτυχώς.'; $strPasswordEmpty = 'Ο Κωδικός Πρόσβασης είναι κενός!'; $strPasswordNotSame = 'Οι κωδικοί πρόσβασης δεν είναι ίδιοι!'; $strPassword = 'Κωδικός Πρόσβασης'; -$strPdfDbSchema = 'Σχήμα της βάσης "%s" - Σελίδα %s'; -$strPdfInvalidTblName = 'Ο πίνακας "%s" δεν υπάρχει!'; +$strPdfDbSchema = 'Σχήμα της βάσης "%s" - Σελίδα %s'; +$strPdfInvalidTblName = 'Ο πίνακας "%s" δεν υπάρχει!'; $strPdfNoTables = 'Δεν υπάρχουν πίνακες'; -$strPerHour = 'ανά ώρα'; +$strPerHour = 'ανά ώρα'; $strPerMinute = 'ανά λεπτό'; $strPerSecond = 'ανά δευτερόλεπτο'; -$strPhoneBook = 'τηλ. κατάλογος'; +$strPhoneBook = 'τηλ. κατάλογος'; $strPHPVersion = 'Έκδοση PHP'; -$strPhp = 'Δημιουργία κώδικα PHP'; +$strPhp = 'Δημιουργία κώδικα PHP'; $strPmaDocumentation = 'Τεκμηρίωση phpMyAdmin'; $strPmaUriError = 'Η εντολή $cfg[\'PmaAbsoluteUri\'] ΠΡΕΠΕΙ να οριστεί στο αρχείο ρυθμίσεων!'; -$strPortrait = 'Κάθετη διάταξη'; +$strPortrait = 'Κάθετη διάταξη'; $strPos1 = 'Αρχή'; $strPrevious = 'Προηγούμενο'; $strPrimaryKeyHasBeenDropped = 'Το πρωτεύον κλειδί διεγράφη'; @@ -349,39 +349,39 @@ $strPrimaryKeyName = 'Το όνομα του πρωτεύοντος κλειδι $strPrimaryKeyWarning = '("PRIMARY" πρέπει να είναι το όνομα του πρωτεύοντος κλειδιού και μόνο αυτού !)'; $strPrimary = 'Πρωτεύον'; $strPrintView = 'Εμφάνιση για εκτύπωση'; -$strPrint = 'Εκτύπωση'; -$strPrivDescAllPrivileges = 'Περιλαμβάνει όλα τα προνόμια εκτός από το GRANT.'; -$strPrivDescAlter = 'Επιτρέπει την αλλαγή δομής των υπαρχόντων πινάκων.'; -$strPrivDescCreateDb = 'Επιτρέπει τη δημιουργία νέων βάσεων και πινάκων.'; -$strPrivDescCreateTbl = 'Επιτρέπει τη δημιουργία νέων πινάκων.'; -$strPrivDescCreateTmpTable = 'Επιτρέπει τη δημιουργία προσωρινών πινάκων.'; -$strPrivDescDelete = 'Επιτρέπει τη διαγραφή δεδομένων.'; -$strPrivDescDropDb = 'Επιτρέπει τη διαγραφή βάσεων και πινάκων.'; -$strPrivDescDropTbl = 'Επιτρέπει τη διαγραφή πινάκων.'; -$strPrivDescExecute = 'Επιτρέπει την εκτέλεση αποθηκευμένων ρουτινών. Δεν έχει χρήση σε αυτήν την έκδοση MySQL version.'; -$strPrivDescFile = 'Επιτρέπει την εισαγωγή και εξαγωγή δεδομένων από και σε αρχεία.'; -$strPrivDescGrant = 'Επιτρέπει την προσθήκη χρηστών και προνομίων χωρίς να επαναφορτώσετε τους πίνακες προνομίων.'; -$strPrivDescIndex = 'Επιτρέπει την δημιουργία και την διαγραφή ευρετηρίων.'; -$strPrivDescInsert = 'Επιτρέπει την εισαγωγή και την αντικατάσταση δεδομένων.'; -$strPrivDescLockTables = 'Επιτρέπει το κλείδωμα πινάκων για την τρέχουσα λειτουργία.'; +$strPrint = 'Εκτύπωση'; +$strPrivDescAllPrivileges = 'Περιλαμβάνει όλα τα προνόμια εκτός από το GRANT.'; +$strPrivDescAlter = 'Επιτρέπει την αλλαγή δομής των υπαρχόντων πινάκων.'; +$strPrivDescCreateDb = 'Επιτρέπει τη δημιουργία νέων βάσεων και πινάκων.'; +$strPrivDescCreateTbl = 'Επιτρέπει τη δημιουργία νέων πινάκων.'; +$strPrivDescCreateTmpTable = 'Επιτρέπει τη δημιουργία προσωρινών πινάκων.'; +$strPrivDescDelete = 'Επιτρέπει τη διαγραφή δεδομένων.'; +$strPrivDescDropDb = 'Επιτρέπει τη διαγραφή βάσεων και πινάκων.'; +$strPrivDescDropTbl = 'Επιτρέπει τη διαγραφή πινάκων.'; +$strPrivDescExecute = 'Επιτρέπει την εκτέλεση αποθηκευμένων ρουτινών. Δεν έχει χρήση σε αυτήν την έκδοση MySQL version.'; +$strPrivDescFile = 'Επιτρέπει την εισαγωγή και εξαγωγή δεδομένων από και σε αρχεία.'; +$strPrivDescGrant = 'Επιτρέπει την προσθήκη χρηστών και προνομίων χωρίς να επαναφορτώσετε τους πίνακες προνομίων.'; +$strPrivDescIndex = 'Επιτρέπει την δημιουργία και την διαγραφή ευρετηρίων.'; +$strPrivDescInsert = 'Επιτρέπει την εισαγωγή και την αντικατάσταση δεδομένων.'; +$strPrivDescLockTables = 'Επιτρέπει το κλείδωμα πινάκων για την τρέχουσα λειτουργία.'; $strPrivDescMaxConnections = 'Περιορίζει τον αριθμό των νέων συνδέσεων που ο χρήστης μπορεί να ξεκινήσει ανά ώρα.'; $strPrivDescMaxQuestions = 'Περιορίζει τον αριθμό των επερωτημάτων που ο χρήστης μπορεί να στείλει στον διακομιστή ανά ώρα.'; $strPrivDescMaxUpdates = 'Περιορίζει τον αριθμό των αλλαγής πινάκων ή βάσεων που ο χρήστης μπορεί να εκετελέσει ανά ώρα.'; -$strPrivDescReferences = 'Δεν έχει χρήση σε αυτήν την έκδοση MySQL.'; -$strPrivDescReload = 'Επιτρέπει την επανεκκίνηση του διακομιστή και τον καθαρισμό των προσωρινών αρχείων του.'; -$strPrivDescReplClient = 'Δίνει το δικαίωμα στον χρήστη να βρει που είναι οι κύριοι και δευτερεύοντες διακομιστές.'; -$strPrivDescReplSlave = 'Απαιτείται για τους δευτερευόντες διακομιστές αναπαραγωγής.'; -$strPrivDescSelect = 'Επιτρέπει την ανάγνωση δεδομένων.'; -$strPrivDescShowDb = 'Δίνει πρόσβαση στην πλήρη λίστα των βάσεων δεδομένων.'; -$strPrivDescShutdown = 'Επιτρέπει την διακοπή λειτουργίας του διακομιστή.'; -$strPrivDescSuper = 'Επιτρέπει τη σύνδεση, ακόμα και όταν ο μέγιστος αριθμός συνδέσεων έχει καλυθφεί; Απαιτείται για τις περισσότερες λειτουργίες διαχείρισης όπως ο ορισμός γενικών μεταβλητών ή τη διακοπή λειτουργιών άλλων χρηστών.'; -$strPrivDescUpdate = 'Επιτρέπει την αλλαγή δεδομένων.'; -$strPrivDescUsage = 'Χωρίς προνόμια.'; -$strPrivilegesReloaded = 'Τα προνόμια επαναφορτώθηκαν επιτυχώς.'; +$strPrivDescReferences = 'Δεν έχει χρήση σε αυτήν την έκδοση MySQL.'; +$strPrivDescReload = 'Επιτρέπει την επανεκκίνηση του διακομιστή και τον καθαρισμό των προσωρινών αρχείων του.'; +$strPrivDescReplClient = 'Δίνει το δικαίωμα στον χρήστη να βρει που είναι οι κύριοι και δευτερεύοντες διακομιστές.'; +$strPrivDescReplSlave = 'Απαιτείται για τους δευτερευόντες διακομιστές αναπαραγωγής.'; +$strPrivDescSelect = 'Επιτρέπει την ανάγνωση δεδομένων.'; +$strPrivDescShowDb = 'Δίνει πρόσβαση στην πλήρη λίστα των βάσεων δεδομένων.'; +$strPrivDescShutdown = 'Επιτρέπει την διακοπή λειτουργίας του διακομιστή.'; +$strPrivDescSuper = 'Επιτρέπει τη σύνδεση, ακόμα και όταν ο μέγιστος αριθμός συνδέσεων έχει καλυθφεί; Απαιτείται για τις περισσότερες λειτουργίες διαχείρισης όπως ο ορισμός γενικών μεταβλητών ή τη διακοπή λειτουργιών άλλων χρηστών.'; +$strPrivDescUpdate = 'Επιτρέπει την αλλαγή δεδομένων.'; +$strPrivDescUsage = 'Χωρίς προνόμια.'; +$strPrivilegesReloaded = 'Τα προνόμια επαναφορτώθηκαν επιτυχώς.'; $strPrivileges = 'Προνόμια'; -$strProcesses = 'Διεργασίες'; -$strProcesslist = 'Λίστα διεργασιών'; -$strPutColNames = 'Εμφάνιση ονομάτων πεδίων στην πρώτη γραμμή'; +$strProcesses = 'Διεργασίες'; +$strProcesslist = 'Λίστα διεργασιών'; +$strPutColNames = 'Εμφάνιση ονομάτων πεδίων στην πρώτη γραμμή'; $strQBEDel = 'Διαγραφή'; $strQBEIns = 'Εισαγωγή'; @@ -391,28 +391,28 @@ $strQueryOnDb = 'Εντολή SQL στη βάση %s:'; $strQuerySQLHistory = 'Ιστορικό SQL'; $strQueryStatistics = 'Στατιστικά επερωτημάτων: Από την έναρξη λειτουργίας, %s επερωτήματα έχουν σταλεί στον διακομιστή.'; $strQueryTime = 'Το επερώτημα χρειάστηκε %01.4f δευτ/τα'; -$strQueryType = 'Τύπος επερωτήματος'; -$strQueryWindowLock = 'Να μην αλλάξει το επερώτημα από εξωτερική πηγή'; +$strQueryType = 'Τύπος επερωτήματος'; +$strQueryWindowLock = 'Να μην αλλάξει το επερώτημα από εξωτερική πηγή'; -$strReceived = 'Λήφθησαν'; +$strReceived = 'Λήφθησαν'; $strRecords = 'Εγγραφές'; $strReferentialIntegrity = 'Έλεγχος ακεραιότητας σχέσεων:'; -$strRelationalSchema = 'Σχεσιακό σχήμα'; +$strRelationalSchema = 'Σχεσιακό σχήμα'; $strRelationNotWorking = 'Οι επιπρόσθετες λειτουργίες για εργασία με συσχετισμένους πίνακες έχουν απενεργοποιηθεί. Για να μάθετε γιατί, πατήστε %sεδώ%s.'; -$strRelations = 'Σχέσεις'; -$strRelationView = 'Εμφάνιση σχέσεων'; -$strReloadingThePrivileges = 'Επαναφόρτωση προνομίων'; -$strRemoveSelectedUsers = 'Διαγραφή των επιλεγμένων χρηστών'; +$strRelations = 'Σχέσεις'; +$strRelationView = 'Εμφάνιση σχέσεων'; +$strReloadingThePrivileges = 'Επαναφόρτωση προνομίων'; +$strRemoveSelectedUsers = 'Διαγραφή των επιλεγμένων χρηστών'; $strRenameTableOK = 'Ο Πίνακας %s μετονομάσθηκε σε %s'; $strRenameTable = 'Μετονομασία πίνακα σε'; $strRepairTable = 'Επιδιόρθωση πίνακα'; -$strReplaceNULLBy = 'Αντικατάσταση τιμής NULL με'; +$strReplaceNULLBy = 'Αντικατάσταση τιμής NULL με'; $strReplaceTable = 'Αντικατάσταση δεδομένων Πίνακα με το αρχείο'; $strReset = 'Επαναφορά'; -$strResourceLimits = 'Όρια πόρων'; +$strResourceLimits = 'Όρια πόρων'; $strReType = 'Επαναεισαγωγή'; -$strRevokeAndDeleteDescr = 'Οι χρήστες θα συνεχίσουν να έχουν το προνόμιο USAGE μέχρις ότου επαναφορτωθούν τα προνόμια.'; -$strRevokeAndDelete = 'Ανάκληση όλων των ενεργών προνομίων από τους χρήστες και διαγραφή τους.'; +$strRevokeAndDeleteDescr = 'Οι χρήστες θα συνεχίσουν να έχουν το προνόμιο USAGE μέχρις ότου επαναφορτωθούν τα προνόμια.'; +$strRevokeAndDelete = 'Ανάκληση όλων των ενεργών προνομίων από τους χρήστες και διαγραφή τους.'; $strRevokeMessage = 'Ανακαλέσατε τα προνόμια για %s'; $strRevoke = 'Ανάκληση'; $strRowLength = 'Μέγεθος Γραμμής'; @@ -427,11 +427,11 @@ $strRows = 'Εγγραφές'; $strRunning = 'που εκτελείται στο %s'; $strRunQuery = 'Υποβολή επερωτήματος'; $strRunSQLQuery = 'Εκτέλεση εντολής/εντολών SQL στη βάση δεδομένων %s'; -$strRussian = 'Ρωσσικά'; +$strRussian = 'Ρωσσικά'; -$strSaveOnServer = 'Αποθήκευση στον διακομιστή στον φάκελο %s'; +$strSaveOnServer = 'Αποθήκευση στον διακομιστή στον φάκελο %s'; $strSave = 'Αποθήκευση'; -$strScaleFactorSmall = 'Η κλίμακα είναι πολύ μικρή για να εμφανιστεί το σχήμα σε μία σελίδα'; +$strScaleFactorSmall = 'Η κλίμακα είναι πολύ μικρή για να εμφανιστεί το σχήμα σε μία σελίδα'; $strSearchFormTitle = 'Αναζήτηση στη βάση'; $strSearchInTables = 'Μέσα στους πίνακες:'; $strSearchNeedle = 'Όροι ή τιμές για αναζήτηση (μπαλαντέρ: "%"):'; @@ -442,65 +442,65 @@ $strSearchOption4 = 'ως regular expression'; $strSearchResultsFor = 'Αποτελέσματα αναζήτησης για "%s" %s:'; $strSearchType = 'Έυρεση:'; $strSearch = 'Αναζήτηση'; -$strSecretRequired = 'Το αρχείο ρυθμίσεων χρειάζεται τώρα μία μυστική φράση-κλειδί (blowfish_secret).'; +$strSecretRequired = 'Το αρχείο ρυθμίσεων χρειάζεται τώρα μία μυστική φράση-κλειδί (blowfish_secret).'; $strSelectADb = 'Παρακαλώ επιλέξτε μία βάση δεδομένων'; $strSelectAll = 'Επιλογή όλων'; $strSelectFields = 'Επιλογή πεδίων (τουλάχιστον ένα)'; $strSelectNumRows = 'στην εντολή'; -$strSelectTables = 'Επιλογή Πινάκων'; +$strSelectTables = 'Επιλογή Πινάκων'; $strSend = 'Αποστολή'; -$strSent = 'Εστάλησαν'; +$strSent = 'Εστάλησαν'; $strServerChoice = 'Επιλογή Διακομιστή'; -$strServerStatusUptime = 'Αυτός ο διακομιστής MySQL λειτουργεί για %s. Ξεκίνησε στις %s.'; -$strServerStatus = 'Πληροφορίες εκτέλεσης'; -$strServerTabVariables = 'Μεταβλητές'; +$strServerStatusUptime = 'Αυτός ο διακομιστής MySQL λειτουργεί για %s. Ξεκίνησε στις %s.'; +$strServerStatus = 'Πληροφορίες εκτέλεσης'; +$strServerTabVariables = 'Μεταβλητές'; $strServerTrafficNotes = 'Κίνηση Διακομιστή: Αυτοί οι πίνακες δείχνουν στατιστικά χρήσης δικτύου αυτού του διακομιστή MySQL από την έναρξη της λειτουργίας του.'; -$strServerVars = 'Ρυθμίσεις και μεταβλητές του διακομιστή'; +$strServerVars = 'Ρυθμίσεις και μεταβλητές του διακομιστή'; $strServerVersion = 'Έκδοση Διακομιστή'; -$strServer = 'Διακομιστής'; -$strSessionValue = 'Τιμή Session'; +$strServer = 'Διακομιστής'; +$strSessionValue = 'Τιμή Session'; $strSetEnumVal = 'Αν ο τύπος του πεδίου είναι «enum» ή «set», παρακαλώ εισάγετε τις τιμές χρησιμοποιώντας την εξής μορφή: \'α\',\'β\',\'γ\'...
    Αν χρειάζεται να εισάγετε την ανάποδη κάθετο ("\") ή απλά εισαγωγικά ("\'"), προθέστε τα με ανάποδη κάθετο στην αρχή (για παράδειγμα \'\\\\χψω\' ή \'α\\\'β\').'; $strShowAll = 'Εμφάνιση όλων'; -$strShowColor = 'Εμφάνιση χρωμάτων'; -$strShowDatadictAs = 'Μορφή λεξικού δεδομένων'; -$strShowFullQueries = 'Πλήρης εμφάνιση επερωτημάτων'; -$strShowGrid = 'Εμφάνιση πλέγματος'; +$strShowColor = 'Εμφάνιση χρωμάτων'; +$strShowDatadictAs = 'Μορφή λεξικού δεδομένων'; +$strShowFullQueries = 'Πλήρης εμφάνιση επερωτημάτων'; +$strShowGrid = 'Εμφάνιση πλέγματος'; $strShowingRecords = 'Εμφάνιση εγγραφής '; $strShowPHPInfo = 'Εμφάνιση πληροφοριών της PHP'; -$strShowTableDimension = 'Εμφάνιση διαστάσεων πινάκων'; +$strShowTableDimension = 'Εμφάνιση διαστάσεων πινάκων'; $strShowTables = 'Εμφάνιση πινάκων'; $strShowThisQuery = ' Εμφάνισε εδώ ξανά αυτό το επερώτημα'; $strShow = 'Εμφάνιση'; -$strSimplifiedChinese = 'Απλοποιημένα Κινεζικά'; +$strSimplifiedChinese = 'Απλοποιημένα Κινεζικά'; $strSingly = '(μοναδικά)'; $strSize = 'Μέγεθος'; $strSort = 'Ταξινόμηση'; $strSpaceUsage = 'Χρήση χώρου'; $strSplitWordsWithSpace = 'Οι λέξεις χωρίζονται από τον χαρακτήρα διαστήματος (" ").'; -$strSQLParserBugMessage = 'Υπάρχει περίπτωση να εντοπίσατε ένα πρόβλημα στον SQL parser. Παρακαλώ εξετάστε το επερώτημά σας προσεκτικά και ελέγξτε ότι όλα τα εισαγωγικά ανοίγουν και κλείνουν σωστά. \'Αλλες πιθανές αιτίες μπορούν να είναι η αποστολή αρχείου με δυαδικό κώδικα εκτός εισαγωγικών. Μπορείτε επίσης να δοκιμάσετε το επερώτημά σας στη γραμμή εντολών της MySQL. Εάν συνεχίζετε να έχετε πρόβλημα, ή εάν ο parser αποτυγχάνει όπου η γραμμή εντολών επιτυγχάνει, παρακαλώ απομονώστε το επερώτημα εκείνο που δημιουργεί το πρόβλημα και στείλτε αναφορά λάθους με τα δεδομένα που βρίσκονται στο τμήμα CUT που ακολουθεί:'; +$strSQLParserBugMessage = 'Υπάρχει περίπτωση να εντοπίσατε ένα πρόβλημα στον SQL parser. Παρακαλώ εξετάστε το επερώτημά σας προσεκτικά και ελέγξτε ότι όλα τα εισαγωγικά ανοίγουν και κλείνουν σωστά. \'Αλλες πιθανές αιτίες μπορούν να είναι η αποστολή αρχείου με δυαδικό κώδικα εκτός εισαγωγικών. Μπορείτε επίσης να δοκιμάσετε το επερώτημά σας στη γραμμή εντολών της MySQL. Εάν συνεχίζετε να έχετε πρόβλημα, ή εάν ο parser αποτυγχάνει όπου η γραμμή εντολών επιτυγχάνει, παρακαλώ απομονώστε το επερώτημα εκείνο που δημιουργεί το πρόβλημα και στείλτε αναφορά λάθους με τα δεδομένα που βρίσκονται στο τμήμα CUT που ακολουθεί:'; $strSQLParserUserError = 'Φαίνεται να υπάρχει ένα λάθος στο επερώτημά σας. Το κάτωθι λάθος διακομιστή MySQL, εάν υπάρχει κάποιο, μπορεί επίσης να σας βοηθήσει να διαγνώσετε το πρόβλημα.'; $strSQLQuery = 'Εντολή SQL'; -$strSQLResult = 'αποτέλεσμα SQL'; -$strSQL = 'SQL'; -$strSQPBugInvalidIdentifer = '\'Αγνωστο Αναγνωριστικό'; -$strSQPBugUnclosedQuote = 'Ανοιχτά εισαγωγικά'; -$strSQPBugUnknownPunctuation = '\'Αγνωστο σημείο στίξης'; +$strSQLResult = 'αποτέλεσμα SQL'; +$strSQL = 'SQL'; +$strSQPBugInvalidIdentifer = '\'Αγνωστο Αναγνωριστικό'; +$strSQPBugUnclosedQuote = 'Ανοιχτά εισαγωγικά'; +$strSQPBugUnknownPunctuation = '\'Αγνωστο σημείο στίξης'; $strStatCheckTime = 'τελευταίος έλεγχος'; $strStatCreateTime = 'Δημιουργία'; $strStatement = 'Δηλώσεις'; $strStatUpdateTime = 'Τελευταία ενημέρωση'; -$strStatus = 'Κατάσταση'; +$strStatus = 'Κατάσταση'; $strStrucCSV = 'Δεδομένα CSV'; $strStrucData = 'Δομή και δεδομένα'; $strStrucExcelCSV = 'Μορφή CSV για δεδομένα MS Excel'; $strStrucOnly = 'Μόνο η δομή'; -$strStructPropose = 'Προτεινόμενη δομή πίνακα'; -$strStructure = 'Δομή'; +$strStructPropose = 'Προτεινόμενη δομή πίνακα'; +$strStructure = 'Δομή'; $strSubmit = 'Αποστολή'; $strSuccess = 'Η SQL εντολή σας εκτελέσθηκε επιτυχώς'; $strSum = 'Σύνολο'; -$strSwedish = 'Σουηδικά'; -$strSwitchToTable = 'Μεταφορά στον αντεγραμμένο πίνακα'; +$strSwedish = 'Σουηδικά'; +$strSwitchToTable = 'Μεταφορά στον αντεγραμμένο πίνακα'; $strTableComments = 'Σχόλια Πίνακα'; $strTableEmpty = 'Το όνομα του Πίνακα είναι κενό!'; @@ -508,73 +508,73 @@ $strTableHasBeenDropped = 'Ο Πίνακας %s διεγράφη'; $strTableHasBeenEmptied = 'Ο Πίνακας %s άδειασε'; $strTableHasBeenFlushed = 'Ο Πίνακας %s εκκαθαρίστικε ("FLUSH")'; $strTableMaintenance = 'Συντήρηση Πίνακα'; -$strTableOfContents = 'Πίνακας περιεχομένων'; -$strTableOptions = 'Επιλογές πίνακα'; +$strTableOfContents = 'Πίνακας περιεχομένων'; +$strTableOptions = 'Επιλογές πίνακα'; $strTables = '%s Πίνακας/Πίνακες'; $strTableStructure = 'Δομή Πίνακα για τον Πίνακα'; $strTable = 'Πίνακας '; -$strTblPrivileges = 'Προνόμια πινάκων'; +$strTblPrivileges = 'Προνόμια πινάκων'; $strTextAreaLength = ' Εξαιτίας του μεγέθος του,
    αυτό το πεδίο ίσως να μη μπορεί να διορθωθεί '; -$strThai = 'Ταϋλανδικά'; -$strThisHost = 'Αυτός ο διακομιστής'; -$strThreadSuccessfullyKilled = 'Η λειτουργία %s διεκόπη.'; -$strTime = 'Χρόνος'; -$strToggleScratchboard = '(Απ)ενεργοποίηση πίνακα σχεδιασμού'; -$strTotalUC = 'Σύνολο'; +$strThai = 'Ταϋλανδικά'; +$strThisHost = 'Αυτός ο διακομιστής'; +$strThreadSuccessfullyKilled = 'Η λειτουργία %s διεκόπη.'; +$strTime = 'Χρόνος'; +$strToggleScratchboard = '(Απ)ενεργοποίηση πίνακα σχεδιασμού'; +$strTotalUC = 'Σύνολο'; $strTotal = 'συνολικά'; -$strTraditionalChinese = 'Παραδοσιακά Κινεζικά'; -$strTraffic = 'Κίνηση'; +$strTraditionalChinese = 'Παραδοσιακά Κινεζικά'; +$strTraffic = 'Κίνηση'; $strTransformation_image_jpeg__inline = 'Εμφανίζει μια εικόνα προεπισκόπησης με σύνδεσμο; επιλογές: πλάτος, ύψος σε pixels (διατηρεί τις αρχικές αναλογίες)'; $strTransformation_image_jpeg__link = 'Εμφανίζει έναν σύνδεσμο για αυτήν την εικόνα.'; -$strTransformation_image_png__inline = 'Δείτε image/jpeg: inline'; +$strTransformation_image_png__inline = 'Δείτε image/jpeg: inline'; $strTransformation_text_plain__external = 'ΜΟΝΟ ΓΙΑ LINUX: Εκτελεί μία εξωτερική εφαρμογή και στέλνει τα δεδομένα μέσω \'standard input\'. Επιστρέφει το αποτέλεσμα της εφαρμογής. Εξ\' ορισμού τιμή είναι το Tidy, που τυπώνει μορφοποιημένο κώδικα HTML. Για λόγους ασφαλείες, πρέπει χειροκίνητα να αλλάξετε το αρχείο libraries/transformations/text_plain__external.inc.php και να εισάγετε τις εφαρμογές που εσείς επιτρέπετε να εκτελούνται. Η πρώτη επιλογή είναι ο αριθμός της εφαρμογής που θέλετε να χρησιμοποιήσετε και η δεύτερη επιλογή είναι οι παράμετροι της. Η τρίτη επιλογή, αν τεθεί σε 1 θα μετατρέψει το αποτέλεσμα χρησιμοποιώντας την εντολή htmlspecialchars() (Εξ\' ορισμού τιμή: 1). Η τέταρτη επιλογή, αν τεθεί σε 1 θα εισάγει NOWRAP στο κελί περιεχομένου ούτως ώστε όλο το αποτέλεσμα να εμφανιστεί χωρίς αλλαγές στην διάταξη (Εξ\' ορισμού τιμή: 1)'; $strTransformation_text_plain__formatted = 'Διατηρεί την αρχική μορφοποίηση του πεδίου. Δεν χρησιμοποιούνται χαρακτήρες διαφυγής.'; -$strTransformation_text_plain__imagelink = 'Εμφανίζει μία εικόνα και ένα σύνδεσμο, το πεδίο περιέχει το όνομα αρχείου. Η πρώτη επιλογή είναι ένα πρόθεμα όπως "http://domain.com/", η δεύτερη επιλογή είναι το πλάτος σε pixels, η τρίτη είναι το ύψος.'; -$strTransformation_text_plain__link = 'Εμφανίζει ένα σύνδεσμο, το πεδίο περιέχει το όνομα αρχείου. Η πρώτη επιλογή είναι ένα πρόθεμα όπως "http://domain.com/", η δεύτερη επιλογή είναι ένας τίτλος για τον σύνδεσμο.'; +$strTransformation_text_plain__imagelink = 'Εμφανίζει μία εικόνα και ένα σύνδεσμο, το πεδίο περιέχει το όνομα αρχείου. Η πρώτη επιλογή είναι ένα πρόθεμα όπως "http://domain.com/", η δεύτερη επιλογή είναι το πλάτος σε pixels, η τρίτη είναι το ύψος.'; +$strTransformation_text_plain__link = 'Εμφανίζει ένα σύνδεσμο, το πεδίο περιέχει το όνομα αρχείου. Η πρώτη επιλογή είναι ένα πρόθεμα όπως "http://domain.com/", η δεύτερη επιλογή είναι ένας τίτλος για τον σύνδεσμο.'; $strTransformation_text_plain__substr = 'Εμφανίζει μόνο μέρος ενός αλφαριθμητικού. Η πρώτη επιλογή είναι η θέση στην οποία ξεκινά η εμφάνιση του κειμένου (Εξ\' ορισμού 0). Η δεύτερη επιλογή είναι το μήκος του κειμένου. Αν μείνει κενό θα επιστραφεί όλο το αλφαριθμητικό. Η τρίτη επιλογή καθορίζει ποιοι χαρακτήρες θα ακολουθούν το κείμενο όταν εμφανίζεται μέρος του (Εξ\' ορισμού: ...) .'; -$strTruncateQueries = 'Αποκοπή εμφανιζόμενων επερωτημάτων'; -$strTurkish = 'Τουρκικά'; +$strTruncateQueries = 'Αποκοπή εμφανιζόμενων επερωτημάτων'; +$strTurkish = 'Τουρκικά'; $strType = 'Τύπος'; -$strUkrainian = 'Ουκρανικά'; +$strUkrainian = 'Ουκρανικά'; $strUncheckAll = 'Απεπιλογή όλων'; -$strUnicode = 'Unicode'; +$strUnicode = 'Unicode'; $strUnique = 'Μοναδικό'; -$strUnknown = 'άγνωστο'; +$strUnknown = 'άγνωστο'; $strUnselectAll = 'Απεπιλογή όλων'; $strUpdatePrivMessage = 'Τα προνόμια του χρήστη %s ενημερώθηκαν.'; $strUpdateProfileMessage = 'Τα στοιχεία ανανεώθηκαν.'; $strUpdateQuery = 'Ενημέρωση της εντολής'; -$strUpdComTab = 'Παρακαλώ διαβάστε στην τεκμηρίωση για το πως μπορείτε να ανανεώσετε τον πίνακα Column_comments'; +$strUpdComTab = 'Παρακαλώ διαβάστε στην τεκμηρίωση για το πως μπορείτε να ανανεώσετε τον πίνακα Column_comments'; $strUsage = 'Χρήση'; $strUseBackquotes = 'Χρήση ανάποδων εισαγωγικών στα ονόματα των Πινάκων και των Πεδίων'; -$strUseHostTable = 'Use Host Table'; -$strUserAlreadyExists = 'Ο χρήστης %s υπάρχει ήδη!'; +$strUseHostTable = 'Use Host Table'; +$strUserAlreadyExists = 'Ο χρήστης %s υπάρχει ήδη!'; $strUserEmpty = 'Το όνομα του χρήστη είναι κενό!'; $strUserName = 'Όνομα χρήστη'; -$strUserNotFound = 'Ο επιλεγμένος χρήστης δεν βρέθηκε στον πίνακα προνομίων.'; -$strUserOverview = 'Περίληψη χρηστών'; -$strUsersDeleted = 'Οι επιλεγμένοι χρήστες διεγράφησαν επιτυχώς.'; -$strUsersHavingAccessToDb = 'Χρήστες με πρόσβαση στη βάση "%s"'; +$strUserNotFound = 'Ο επιλεγμένος χρήστης δεν βρέθηκε στον πίνακα προνομίων.'; +$strUserOverview = 'Περίληψη χρηστών'; +$strUsersDeleted = 'Οι επιλεγμένοι χρήστες διεγράφησαν επιτυχώς.'; +$strUsersHavingAccessToDb = 'Χρήστες με πρόσβαση στη βάση "%s"'; $strUser = 'Χρήστης'; $strUseTables = 'Χρήση Πινάκων'; -$strUseTextField = 'Χρησιμοποιήστε το πεδίο κειμένου'; -$strUseThisValue = 'Χρήση αυτής της τιμής'; +$strUseTextField = 'Χρησιμοποιήστε το πεδίο κειμένου'; +$strUseThisValue = 'Χρήση αυτής της τιμής'; -$strValidateSQL = 'Επικύρωση SQL'; -$strValidatorError = 'Ο επικυρωτής SQL δεν μπόρεσε να ενεργοποιηθεί. Παρακαλώ ελέγξτε ότι έχετε εγκαταστήσει της απαραίτητες επεκτάσεις της php όπως περιγράφεται στην %sdocumentation%s.'; +$strValidateSQL = 'Επικύρωση SQL'; +$strValidatorError = 'Ο επικυρωτής SQL δεν μπόρεσε να ενεργοποιηθεί. Παρακαλώ ελέγξτε ότι έχετε εγκαταστήσει της απαραίτητες επεκτάσεις της php όπως περιγράφεται στην %sdocumentation%s.'; $strValue = 'Τιμή'; -$strVar = 'Μεταβλητή'; +$strVar = 'Μεταβλητή'; $strViewDumpDatabases = 'Εμφάνισης σχήματος βάσεων'; $strViewDumpDB = 'Εμφάνιση σχήματος της βάσης'; $strViewDump = 'Εμφάνιση σχήματος του πίνακα'; -$strWebServerUploadDirectoryError = 'Ο υποκατάλογος που ορίσατε για την αποθήκευση αρχείων δεν μπόρεσε να βρεθεί'; -$strWebServerUploadDirectory = 'Υποκατάλογος αποθήκευσης αρχείων διακομιστή'; +$strWebServerUploadDirectoryError = 'Ο υποκατάλογος που ορίσατε για την αποθήκευση αρχείων δεν μπόρεσε να βρεθεί'; +$strWebServerUploadDirectory = 'Υποκατάλογος αποθήκευσης αρχείων διακομιστή'; $strWelcome = 'Καλωσήρθατε στο %s'; -$strWestEuropean = 'Δυτικής Ευρώπης'; -$strWildcard = 'μπαλαντέρ'; -$strWindowNotFound = 'Δεν ήταν δυνατό να ανανεωθεί το target παράθυρο του περιηγητή. Ίσως κλείσατε το parent παράθυρο ή ο περιηγητής σας δεν επιτρέπει τις ανανεώσεις μεταξύ παραθύρων λόγω ρυθμίσεων ασφαλείας.'; +$strWestEuropean = 'Δυτικής Ευρώπης'; +$strWildcard = 'μπαλαντέρ'; +$strWindowNotFound = 'Δεν ήταν δυνατό να ανανεωθεί το target παράθυρο του περιηγητή. Ίσως κλείσατε το parent παράθυρο ή ο περιηγητής σας δεν επιτρέπει τις ανανεώσεις μεταξύ παραθύρων λόγω ρυθμίσεων ασφαλείας.'; $strWithChecked = 'Με τους επιλεγμένους:'; $strWrongUser = 'Λανθασμένο όνομα χρήστη/κωδικός πρόσβασης. \'Αρνηση πρόσβασης.'; @@ -582,7 +582,7 @@ $strXML = 'XML'; $strYes = 'Ναι'; -$strZeroRemovesTheLimit = 'Σημείωση: Αν ορίσετε αυτές τις επιλογές σε 0 (μηδέν) αφαιρείτε ο περιορισμός.'; +$strZeroRemovesTheLimit = 'Σημείωση: Αν ορίσετε αυτές τις επιλογές σε 0 (μηδέν) αφαιρείτε ο περιορισμός.'; $strZip = 'συμπίεση «zip»'; // To translate: @@ -1488,4 +1488,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/hebrew-utf-8.inc.php b/lang/hebrew-utf-8.inc.php index 9d0c1b43a..4676f82e8 100644 --- a/lang/hebrew-utf-8.inc.php +++ b/lang/hebrew-utf-8.inc.php @@ -1,5 +1,5 @@ */ $charset = 'utf-8'; @@ -1483,4 +1483,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/hindi-utf-8.inc.php b/lang/hindi-utf-8.inc.php index 33ad4de0d..b9ca19539 100644 --- a/lang/hindi-utf-8.inc.php +++ b/lang/hindi-utf-8.inc.php @@ -26,8 +26,8 @@ $timespanfmt = '%s days, %s hours, %s minutes and %s seconds'; $strAccessDenied = 'प्रवेश निषेध'; $strAction = ' कार्य'; $strAddNewField = 'नया फील्ड जोडो'; -$strAddPrivilegesOnDb = 'इन डाटाबेसों के लिये प्रिविलेज जोडिये'; -$strAddPrivilegesOnTbl = 'इन टेबल के लिये प्रिविलेज जोडिये'; +$strAddPrivilegesOnDb = 'इन डाटाबेसों के लिये प्रिविलेज जोडिये'; +$strAddPrivilegesOnTbl = 'इन टेबल के लिये प्रिविलेज जोडिये'; $strAddUser = 'नया यूसर बनाओ'; $strAddUserMessage = 'आपने नया यूसर बना लिया ।'; $strAfterInsertBack = 'पिछले पृष्ट पर वापस जाओ'; @@ -42,7 +42,7 @@ $strAny = 'कोई'; $strAnyHost = 'कोई भी होस्ट'; $strAnyUser = 'कोई भी यूसर'; $strAPrimaryKey = ' %s पर एक प्राईमरी की बनाया'; -$strArabic = 'पर्शियन'; +$strArabic = 'पर्शियन'; $strAtBeginningOfTable = ' टेबल के शुरू में'; $strAtEndOfTable = ' टेबल के आखिर में'; $strAttr = ' विशेषता'; @@ -50,10 +50,10 @@ $strAttr = ' विशेषता'; $strBack = 'वापस'; $strBinary = 'बइनरी'; $strBinaryDoNotEdit = 'बइनरी - एडिट मत करिये'; -$strBookmarkDeleted = 'यह bookmark डिलीट कर दिया गया।'; +$strBookmarkDeleted = 'यह bookmark डिलीट कर दिया गया।'; $strBookmarkLabel = 'लेबल'; -$strBookmarkQuery = 'Bookmark किया हुआ SQL-क्वरी'; -$strBookmarkThis = 'इस SQL-क्वरी को bookmark कीजिये '; +$strBookmarkQuery = 'Bookmark किया हुआ SQL-क्वरी'; +$strBookmarkThis = 'इस SQL-क्वरी को bookmark कीजिये '; $strBookmarkView = 'केवल देखिये'; $strBrowse = ' ब्रौस'; @@ -61,17 +61,17 @@ $strCantRenameIdxToPrimary = 'इन्डेक्स को PRIMARY नाम $strChange = 'बदलिये'; $strChangePassword = 'पासव्रड बदलिये'; $strCheckAll = 'सभी को चेक करें'; -$strCheckPrivs = 'प्रिविलेज चेक करें'; -$strCheckPrivsLong = 'डाटाबेस के प्रिविलेज चेक करें "%s".'; +$strCheckPrivs = 'प्रिविलेज चेक करें'; +$strCheckPrivsLong = 'डाटाबेस के प्रिविलेज चेक करें "%s".'; $strCheckTable = ' टेबल को चेक करें'; $strChoosePage = ' एडिट करने के लिये पेज़ चुने'; $strColumnNames = 'कोलम के नाम'; -$strColumnPrivileges = ' केवल कोलम के प्रिविलेज'; +$strColumnPrivileges = ' केवल कोलम के प्रिविलेज'; $strComments = ' टिप्पणी'; $strCompleteInserts = 'पूरा इनसर्टस'; $strCopyTable = ' (database.table) में टेबल को कापी करें:'; $strCopyTableOK = ' %s टेबल को %s में कापी कर दिया.'; -$strCouldNotKill = 'thread %s को मारने में phpMyAdmin असफल हुआ। शायद वह खतम हो चुका है।'; +$strCouldNotKill = 'thread %s को मारने में phpMyAdmin असफल हुआ। शायद वह खतम हो चुका है।'; $strCreate = 'बनाइये'; $strCreateIndex = '  %s  कोलम पर इन्डेक्स बनाऐं '; $strCreateIndexTopic = 'एक नया इन्डेक्स बनाऐं'; @@ -83,26 +83,26 @@ $strData = ' डाटा'; $strDatabase = ' डाटाबेस'; $strDatabaseHasBeenDropped = 'डाटाबेस %s को ड्रोप कर दिया ।'; $strDatabases = ' डाटाबेस'; -$strDatabasesDropped = '%s डाटाबेस को सफलता से डिलीट कर दिया गया।'; +$strDatabasesDropped = '%s डाटाबेस को सफलता से डिलीट कर दिया गया।'; $strDatabasesStats = ' डाटाबेसों के आँकडे'; -$strDatabasesStatsDisable = 'आँकडे Disable करें'; -$strDatabasesStatsEnable = 'आँकडे Enable करें'; -$strDatabasesStatsHeavyTraffic = ' नोट: यहां डाटाबेस के आँकडे Enable करने से webserver और MySQL के बीच में ट्रेफिक बडने की संभावना है। '; +$strDatabasesStatsDisable = 'आँकडे Disable करें'; +$strDatabasesStatsEnable = 'आँकडे Enable करें'; +$strDatabasesStatsHeavyTraffic = ' नोट: यहां डाटाबेस के आँकडे Enable करने से webserver और MySQL के बीच में ट्रेफिक बडने की संभावना है। '; $strDataOnly = 'केवल डाटा'; -$strDBComment = 'डाटाबेस की टिप्पणि: '; -$strDbPrivileges = ' केवल डाटाबेस के प्रिविलेज'; +$strDBComment = 'डाटाबेस की टिप्पणि: '; +$strDbPrivileges = ' केवल डाटाबेस के प्रिविलेज'; $strDefault = 'Default'; $strDelete = 'डिलीट'; $strDeleted = 'रौ को डिलीट कर दिया'; -$strDescription = 'वर्णन'; -$strDictionary = 'शब्दकोश'; +$strDescription = 'वर्णन'; +$strDictionary = 'शब्दकोश'; $strDisplayFeat = 'फीचरस दिखाओ'; $strDisplayOrder = 'क्रम से दिखाओ:'; $strDisplayPDF = 'PDF schema दिखाओ'; $strDocu = 'डोक्युमेंटेशन'; $strDoYouReally = 'क्या आप सचमुच चाहते है की'; $strDrop = ' ड्रोप'; -$strDropUsersDb = 'Drop the databases that have the same names as the users.'; +$strDropUsersDb = 'Drop the databases that have the same names as the users.'; $strEdit = 'एडिट'; $strEditPDFPages = 'PDF पेज एडिट करें'; @@ -110,8 +110,8 @@ $strEditPrivileges = ' प्रिविलेज एडिट करें'; $strEffective = ' वास्तविक'; $strEmpty = 'खाली करें'; $strEnd = 'आखरी'; -$strEnglish = 'अंग्रेजी'; -$strEnglishPrivileges = ' नोट: MySQL प्रिविलेज नामों को अंग्रेजी मे लिखा गया है '; +$strEnglish = 'अंग्रेजी'; +$strEnglishPrivileges = ' नोट: MySQL प्रिविलेज नामों को अंग्रेजी मे लिखा गया है '; $strError = 'गल्ती'; $strExplain = 'SQL की व्याख्या '; $strExport = 'एक्सपोर्ट'; @@ -123,23 +123,23 @@ $strFieldHasBeenDropped = ' फील्ड %s ड्रोप कर दिय $strFields = ' फील्डस'; $strFlushTable = ' टेबल को Flush करें ("FLUSH")'; -$strGenTime = 'समय पर बनाया'; -$strGerman = 'जर्मन'; -$strGreek = ' ग्रीक'; +$strGenTime = 'समय पर बनाया'; +$strGerman = 'जर्मन'; +$strGreek = ' ग्रीक'; -$strHasBeenAltered = 'को बदला गया। '; +$strHasBeenAltered = 'को बदला गया। '; $strHome = 'होम'; $strHomepageOfficial = 'phpMyAdmin का आधिकारिक होमपेज'; $strHost = 'होस्ट'; -$strHostEmpty = 'होस्ट का नाम (hostname) खाली है!'; +$strHostEmpty = 'होस्ट का नाम (hostname) खाली है!'; $strInsert = 'इनसर्ट'; -$strInsertAsNewRow = 'इसको नया रौ में जोडे '; +$strInsertAsNewRow = 'इसको नया रौ में जोडे '; -$strJapanese = 'जापानी'; +$strJapanese = 'जापानी'; -$strKeepPass = 'पासवर्ड मत बदलिये'; -$strKorean = 'कोरियन'; +$strKeepPass = 'पासवर्ड मत बदलिये'; +$strKorean = 'कोरियन'; $strLengthSet = 'लंबाई/अर्थ*'; $strLimitNumRows = 'प्रति पृष्ट कितने रौ'; @@ -158,12 +158,12 @@ $strName = 'नाम'; $strNext = ' अगला'; $strNo = 'नहीं'; $strNoDatabases = 'कोइ डाटाबेस नहिं'; -$strNoDatabasesSelected = ' कोइ डाटाबेस नहीं चुना गया है।'; -$strNoModification = 'कोइ बदलाव नहीं'; -$strNoPassword = 'पासवर्ड नहीं है'; -$strNoPrivileges = 'कोइ प्रिविलेज नहीं'; +$strNoDatabasesSelected = ' कोइ डाटाबेस नहीं चुना गया है।'; +$strNoModification = 'कोइ बदलाव नहीं'; +$strNoPassword = 'पासवर्ड नहीं है'; +$strNoPrivileges = 'कोइ प्रिविलेज नहीं'; $strNoTablesFound = 'डाटाबेस में कोई टेबल नहीं।'; -$strNotNumber = 'यह नंबर नहीं है!'; +$strNotNumber = 'यह नंबर नहीं है!'; $strNoUsersFound = 'कोई यूसर नहीं।'; $strOperations = 'कार्रवाई'; @@ -176,7 +176,7 @@ $strPmaDocumentation = 'phpMyAdmin डोक्युमेंटेशन'; $strPrivDescMaxConnections = 'Limits the number of new connections the user may open per hour.'; $strPrivDescMaxQuestions = 'Limits the number of queries the user may send to the server per hour.'; $strPrivDescMaxUpdates = 'Limits the number of commands that change any table or database the user may execute per hour.'; -$strPrivileges = ' प्रिविलेज'; +$strPrivileges = ' प्रिविलेज'; $strQBE = 'क्वरी'; $strQueryFrame = 'क्वरी पेज'; @@ -194,7 +194,7 @@ $strRowsModeOptions = ' %s रूप में और %s सेल के बा $strRowsModeVertical = 'खडा'; $strRunning = ' %s पर चल रहा है'; $strRunSQLQuery = 'डाटाबेस %s में SQL query/queries चलाइये '; -$strRussian = 'रशियन'; +$strRussian = 'रशियन'; $strSearch = 'सर्च'; $strSearchFormTitle = 'डाटाबेस में सर्च करें'; @@ -235,10 +235,10 @@ $strTableHasBeenEmptied = ' टेबल %s को खाली किया'; $strTableHasBeenFlushed = ' टेबल %s को flush किया'; $strTableMaintenance = ' टेबल रख-रखाव'; $strTables = ' %s टेबल(s)'; -$strTblPrivileges = ' केवल टेबल के प्रिविलेज'; -$strThreadSuccessfullyKilled = 'Thread %s को सफलता से मारा गया।'; +$strTblPrivileges = ' केवल टेबल के प्रिविलेज'; +$strThreadSuccessfullyKilled = 'Thread %s को सफलता से मारा गया।'; $strTotal = ' कुल'; -$strTurkish = 'तुर्क'; +$strTurkish = 'तुर्क'; $strType = ' प्रकार'; $strUncheckAll = ' सभी को अनचेक करें'; @@ -1491,4 +1491,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/hungarian-utf-8.inc.php b/lang/hungarian-utf-8.inc.php index 4737f199a..8dd09a14c 100644 --- a/lang/hungarian-utf-8.inc.php +++ b/lang/hungarian-utf-8.inc.php @@ -11,7 +11,7 @@ $number_decimal_separator = '.'; // shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa $byteUnits = array('Bájt', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); -// MySQL manual language definition, this is optional, en will be used +// MySQL manual language definition, this is optional, en will be used // if not defined $mysql_4_1_doc_lang = 'en'; $mysql_5_0_doc_lang = 'en'; @@ -1467,4 +1467,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/indonesian-utf-8.inc.php b/lang/indonesian-utf-8.inc.php index 89d7a7534..d0b886625 100644 --- a/lang/indonesian-utf-8.inc.php +++ b/lang/indonesian-utf-8.inc.php @@ -1481,4 +1481,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/italian-utf-8.inc.php b/lang/italian-utf-8.inc.php index 5f582c1e2..b22d1ade0 100644 --- a/lang/italian-utf-8.inc.php +++ b/lang/italian-utf-8.inc.php @@ -1470,4 +1470,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/japanese-utf-8.inc.php b/lang/japanese-utf-8.inc.php index c18293875..164c2b65f 100644 --- a/lang/japanese-utf-8.inc.php +++ b/lang/japanese-utf-8.inc.php @@ -1471,4 +1471,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/korean-utf-8.inc.php b/lang/korean-utf-8.inc.php index 6c1fed753..687757f29 100644 --- a/lang/korean-utf-8.inc.php +++ b/lang/korean-utf-8.inc.php @@ -1486,4 +1486,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/latvian-utf-8.inc.php b/lang/latvian-utf-8.inc.php index dac3807cd..4aaa6f8c0 100644 --- a/lang/latvian-utf-8.inc.php +++ b/lang/latvian-utf-8.inc.php @@ -1488,4 +1488,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/lithuanian-utf-8.inc.php b/lang/lithuanian-utf-8.inc.php index 944f90c93..43a2b35f9 100644 --- a/lang/lithuanian-utf-8.inc.php +++ b/lang/lithuanian-utf-8.inc.php @@ -231,7 +231,7 @@ $strErrorInZipFile = 'Klaida ZIP archyve:'; $strError = 'Klaida'; $strEscapeWildcards = 'Norint naudoti _ ir % simblius, juos reikėtų eskeipinti su \\'; $strEsperanto = 'Esperanto'; -$strEstonian = 'Estų'; +$strEstonian = 'Estų'; $strExcelEdition = 'Excel variantas'; $strExecuteBookmarked = 'Įvykdyti išsaugotą užklausą'; $strExplain = 'Paaiškinti'; @@ -306,7 +306,7 @@ $strIndexName = 'Indekso vardas :'; $strIndexType = 'Indekso tipas :'; $strIndexWarningTable = 'Iškilo problemos su `%s` lentelės indeksais'; $strInnoDBBufferPoolSize = 'Buferio pool\'o dydis'; -$strInnoDBDataFilePath = 'Duomenų failai'; +$strInnoDBDataFilePath = 'Duomenų failai'; $strInnoDBDataHomeDirDesc = 'Bendra direktorijų kelio dalis visiems InnoDB duomenų failams.'; $strInnoDBPages = 'puslapiai'; $strInnodbStat = 'InnoDB būsena'; @@ -1480,4 +1480,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/macedonian_cyrillic-utf-8.inc.php b/lang/macedonian_cyrillic-utf-8.inc.php index 97e0c03f4..999a24231 100644 --- a/lang/macedonian_cyrillic-utf-8.inc.php +++ b/lang/macedonian_cyrillic-utf-8.inc.php @@ -1466,4 +1466,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/malay-utf-8.inc.php b/lang/malay-utf-8.inc.php index 680efc00c..68525e5c5 100644 --- a/lang/malay-utf-8.inc.php +++ b/lang/malay-utf-8.inc.php @@ -1503,4 +1503,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/mongolian-utf-8.inc.php b/lang/mongolian-utf-8.inc.php index 75c3b6d31..1e07479a6 100644 --- a/lang/mongolian-utf-8.inc.php +++ b/lang/mongolian-utf-8.inc.php @@ -54,7 +54,7 @@ $strAlterOrderBy = 'Хүснэгтийг эрэмбэлэлтээр өөрчлө $strAnalyzeTable = 'Хүснэгтийг задлах'; $strAndThen = 'ба тэгээд'; $strAnd = 'БА'; -$strAngularLinks = 'Шууд бус холбоос'; +$strAngularLinks = 'Шууд бус холбоос'; $strAnIndex = '%s-д индекс нэмэгдсэн байна'; $strAnyHost = 'Дурын хост'; $strAnyUser = 'Дурын хэрэглэгч'; @@ -93,15 +93,15 @@ $strBookmarkView = 'Зөвхөн харах'; $strBrowseDistinctValues = 'Онцгой утгуудыг харах'; $strBrowseForeignValues = 'Browse foreign values'; $strBrowse = 'Хөтлөх'; -$strBufferPoolActivity = 'Буффер Pool Идэвхжил'; -$strBufferPoolUsage = 'Буффер Pool Хэрэглээ'; -$strBufferPool = 'Буффер Pool'; -$strBufferReadMissesInPercent = 'Уншилт алдсан нь %'; -$strBufferReadMisses = 'Уншилт алдагдсан'; -$strBufferWriteWaitsInPercent = 'Бичихээр хүлээгдэх нь %'; -$strBufferWriteWaits = 'Бичихээр хүлээх'; +$strBufferPoolActivity = 'Буффер Pool Идэвхжил'; +$strBufferPoolUsage = 'Буффер Pool Хэрэглээ'; +$strBufferPool = 'Буффер Pool'; +$strBufferReadMissesInPercent = 'Уншилт алдсан нь %'; +$strBufferReadMisses = 'Уншилт алдагдсан'; +$strBufferWriteWaitsInPercent = 'Бичихээр хүлээгдэх нь %'; +$strBufferWriteWaits = 'Бичихээр хүлээх'; $strBulgarian = 'Болгар'; -$strBusyPages = 'Завгүй хуудсууд'; +$strBusyPages = 'Завгүй хуудсууд'; $strBzip = 'bzip-ээр шахагдсан'; $strCalendar = 'Цагалбар'; @@ -159,7 +159,7 @@ $strCopyTableSameNames = ' Адил нэртэй хүснэгт рүү хуул $strCopyTable = 'Хүснэгт хуулах(өгөгдлийн сан.хүснэгт):'; $strCopy = 'Хуулах'; $strCouldNotKill = 'phpMyAdmin нь thread %s-ийг хааж чадсангүй. Энэ аль хэдийн хаагдсан байна.'; -$strCreateDatabaseBeforeCopying = 'хуулахын өмнө CREATE DATABASE'; +$strCreateDatabaseBeforeCopying = 'хуулахын өмнө CREATE DATABASE'; $strCreateIndex = ' %s багануудад индекс үүсгэх'; $strCreateIndexTopic = 'Шинэ индекс үүсгэх'; $strCreateNewDatabase = 'Шинэ ӨС үүсгэх'; @@ -192,7 +192,7 @@ $strDatabases = 'Өгөгдлийн сангууд'; $strDatabase = 'ӨС'; $strDataDict = 'Өгөгдлийн толь'; $strDataOnly = 'Зөвхөн өгөгдөл'; -$strDataPages = 'Хуудсуудын агуулсан өгөгдөл'; +$strDataPages = 'Хуудсуудын агуулсан өгөгдөл'; $strData = 'Өгөгдөл'; $strDBComment = 'ӨС-ийн тайлбар: '; $strDBCopy = 'Өгөгдлийн сан хуулах нь'; @@ -200,7 +200,7 @@ $strDbIsEmpty = 'Өгөгдлийн сан хоосон санагдаж бай $strDbPrivileges = ' Онцгой эрх, өгөгдлийн сангийн эрх'; $strDBRename = 'Өгөгдлийн санг д.нэрлэх нь'; $strDbSpecific = 'Өгөгдлийн сангийн эрх'; -$strDefaultEngine = '%s нь уг MySQL сервэрийн анхдагч агуулах хөдөлгүүр байна.'; +$strDefaultEngine = '%s нь уг MySQL сервэрийн анхдагч агуулах хөдөлгүүр байна.'; $strDefaultValueHelp = 'Анхдагч утгаар энэ тогтнолыг ашиглан ташуу зураас, хашилтгүй ганц утга оруулна уу: a'; $strDefault = 'Анхдагч'; $strDefragment = 'Хүснэгт янзлах'; @@ -219,7 +219,7 @@ $strDescription = 'Тайлбар'; $strDesigner = 'Дизайнч'; $strDictionary = 'толь'; $strDirectLinks = 'Шууд холбоос'; -$strDirtyPages = 'Бохир хуудсууд'; +$strDirtyPages = 'Бохир хуудсууд'; $strDisabled = 'Хаагдсан'; $strDisableForeignChecks = 'Гадаад түлхүүр шалгалтыг хаах'; $strDisplayFeat = 'Онцлог харуулах'; @@ -248,10 +248,10 @@ $strEncloseInTransaction = 'Хэлэлцээр дэх гаргалтыг хаа $strEndCut = 'END CUT'; $strEndRaw = 'END RAW'; $strEnd = 'Төгс'; -$strEngineAvailable = '%s нь уг MySQL сервэрт идэвхтэй байна.'; -$strEngineDisabled = '%s нь уг MySQL сервэр дээр хаалттай байна.'; -$strEngines = 'Хөдөлгүүрүүд'; -$strEngineUnsupported = 'Энэ MySQL сервэр нь %s агуулах хөдөлгүүрийг дэмжихгүй.'; +$strEngineAvailable = '%s нь уг MySQL сервэрт идэвхтэй байна.'; +$strEngineDisabled = '%s нь уг MySQL сервэр дээр хаалттай байна.'; +$strEngines = 'Хөдөлгүүрүүд'; +$strEngineUnsupported = 'Энэ MySQL сервэр нь %s агуулах хөдөлгүүрийг дэмжихгүй.'; $strEnglishPrivileges = ' Тэмдэглэл: MySQL онцгой эрхийн нэр нь англиар илэрхийлэгдсэн '; $strEnglish = 'Англи'; $strErrorInZipFile = 'ZIP архивт байгаа алдаа:'; @@ -293,7 +293,7 @@ $strFontSize = 'Үсгийн хэмжээ'; $strForeignKeyError = 'Гадаад түлхүүр үүсгэхэд алдаа гарлаа (өгөгдлийн төрлөө шалга)'; $strFormat = 'Тогтнол'; $strFormEmpty = 'Форм дахь утгыг орхисон!'; -$strFreePages = 'Чөлөөт хуудсууд'; +$strFreePages = 'Чөлөөт хуудсууд'; $strFullText = 'Бүтэн бичвэр'; $strFunctions = 'Функцүүд'; $strFunction = 'Функц'; @@ -301,7 +301,7 @@ $strFunction = 'Функц'; $strGenBy = 'Үүсгэгч'; $strGeneralRelationFeat = 'Ерөнхий хамаатай онцлог'; $strGeneratePassword = 'Нууц үг бий болгох'; -$strGenerate = 'Бий болгох'; +$strGenerate = 'Бий болгох'; $strGenTime = 'Үүссэн цаг'; $strGeorgian = 'Гүрж'; $strGerman = 'Немец'; @@ -325,8 +325,8 @@ $strHomepageOfficial = 'phpMyAdmin-ын албан ёсны вэб сайт'; $strHome = 'Гэр'; $strHostEmpty = 'Хостын нэр хоосон!'; $strHost = 'Хост'; -$strHTMLExcel = 'Microsoft Excel 2000'; -$strHTMLWord = 'Microsoft Word 2000'; +$strHTMLExcel = 'Microsoft Excel 2000'; +$strHTMLWord = 'Microsoft Word 2000'; $strHungarian = 'Унгар'; $strIcelandic = 'Исланд'; @@ -346,14 +346,14 @@ $strIndexName = 'Индексийн нэр :'; $strIndexType = 'Индексийн төрөл :'; $strIndexWarningTable = 'Хүснэгт `%s`-ийн индекс асуудалтай'; $strIndex = 'Индекс'; -$strInnoDBAutoextendIncrementDesc = ' The increment size for extending the size of an autoextending tablespace when it becomes full.'; -$strInnoDBAutoextendIncrement = 'Авто нэмэгдэлт'; -$strInnoDBBufferPoolSizeDesc = 'Энэ хүснэгтийн кэш өгөгдөл, индекст хэрэглэх InnoDB санах ойн буфферийн хэмжээ.'; -$strInnoDBBufferPoolSize = 'Буффер pool хэмжээ'; -$strInnoDBDataFilePath = 'Өгөгдлийн файлууд'; -$strInnoDBDataHomeDirDesc = 'Бүх InnoDB өгөгдлийн файлын хавтсын замын үндсэн хэсэг.'; -$strInnoDBDataHomeDir = 'Өгөгдлийн үндсэн хавтас'; -$strInnoDBPages = 'хуудсууд'; +$strInnoDBAutoextendIncrementDesc = ' The increment size for extending the size of an autoextending tablespace when it becomes full.'; +$strInnoDBAutoextendIncrement = 'Авто нэмэгдэлт'; +$strInnoDBBufferPoolSizeDesc = 'Энэ хүснэгтийн кэш өгөгдөл, индекст хэрэглэх InnoDB санах ойн буфферийн хэмжээ.'; +$strInnoDBBufferPoolSize = 'Буффер pool хэмжээ'; +$strInnoDBDataFilePath = 'Өгөгдлийн файлууд'; +$strInnoDBDataHomeDirDesc = 'Бүх InnoDB өгөгдлийн файлын хавтсын замын үндсэн хэсэг.'; +$strInnoDBDataHomeDir = 'Өгөгдлийн үндсэн хавтас'; +$strInnoDBPages = 'хуудсууд'; $strInnodbStat = 'InnoDB байдал'; $strInsecureMySQL = 'Таны тохиргооны файл нь MySQL-ын анхдагч онцгой эрхийг (нэвтрэгч root нь нууц үггүй) агуулжээ. Таны MySQL сервэр энэ анхдагчаар ажиллаж байгаа нь хэн ч урилгагүй орох боломжийг өгнө. Та хамгаалалтын асуудлаа засах хэрэгтэй'; $strInsertAsNewRow = 'Шинэ мөр оруулаад'; @@ -391,7 +391,7 @@ $strKorean = 'Солонгос'; $strLandscape = 'Ландшафт'; $strLanguageUnknown = 'Үл мэдэгдэх хэл: %1$s.'; $strLanguage = 'Хэл'; -$strLatchedPages = 'Latched хуудсууд'; +$strLatchedPages = 'Latched хуудсууд'; $strLatexCaption = 'Хүснэгтийн гарчиг'; $strLatexContent = '__TABLE__ хүснэгтийн агуулга'; $strLatexContinuedCaption = 'Үргэлжилсэн хүснэгтийн гарчиг'; @@ -417,7 +417,7 @@ $strLogout = 'Гарах'; $strLogPassword = 'Нууц үг:'; $strLogServer = 'Сервэр'; $strLogUsername = 'Нэвтрэгч:'; -$strLongOperation = 'Энэ үйлдэл удах янзтай. Юутай ч үргэлжлүүлэх үү?'; +$strLongOperation = 'Энэ үйлдэл удах янзтай. Юутай ч үргэлжлүүлэх үү?'; $strMaxConnects = 'ХИ. давхацсан холболтууд'; $strMaximalQueryLength = 'Үүсгэгдсэн асуудлын хамгийн их урт'; @@ -443,18 +443,18 @@ $strMoveTableOK = 'Хүснэгт %s нь %s руу зөөгдөв.'; $strMoveTableSameNames = 'Адил нэр байсан тул хүснэгтийг зөөсөнгүй!'; $strMoveTable = 'Хүснэгтийг зөөх (өгөгдлийн сан.хүснэгт):'; $strMultilingual = 'олонхэлийн'; -$strMyISAMDataPointerSizeDesc = 'Анхдагч заагчийн хэмжээ байтаар илэрхийлэгдэх ба, CREATE TABLE -ээр MyISAM хүснэгтийг MAX_ROWS сонголт тодорхойлогдоогүй үед хэрэглэгдэнэ.'; -$strMyISAMDataPointerSize = 'Өгөгдөл заагчийн хэмжээ'; -$strMyISAMMaxExtraSortFileSizeDesc = 'Хэрэв завсрын файл MyISAM индекс үүсгэлтэд хэрэглэгдсэн бол үүнээс их энд тодорхойлогдсон хэмжээгээр key cache хэрэглэх хэрэгтэй, key cache аргыг илүүд үзвэл.'; -$strMyISAMMaxExtraSortFileSize = 'Индекс үүсгэлт дэх завсрын файлын ХИ хэмжээ'; -$strMyISAMMaxSortFileSizeDesc = 'Завсрын MySQL файлын ХИ хэмжээ нь MyISAM индексийг да-үүсгэхэд (REPAIR TABLE, ALTER TABLE, болон LOAD DATA INFILE -ын үед) хэрэглэгдэнэ.'; -$strMyISAMMaxSortFileSize = 'Завсрын эрэмбэлэх файлын ХИ хэмжээ'; -$strMyISAMRecoverOptionsDesc = 'Горим нь эвдэрсэн MyISAM хүснэгтийг автоматаар засна, серверийн эхлэлийн --myisam-recover сонголтоор.'; -$strMyISAMRecoverOptions = 'Авто сэргээх горим'; -$strMyISAMRepairThreadsDesc = 'Хэрэв энэ утга нь 1 -ээс их байвал, эрэмбэлэх процессоор Засах үед MyISAM хүснэгтийн индексүүд нь зэрэгцээгээр (индекс бүрт өөрийн процесс) үүсгэгдсэн.'; -$strMyISAMRepairThreads = 'Thread засах'; -$strMyISAMSortBufferSizeDesc = 'REPAIR TABLE -ийн үед MyISAM индексийг эрэмбэлэх эсвэл CREATE INDEX болон ALTER TABLE -ээр индекс үүсгэх үед буффер хуваарилагдсан.'; -$strMyISAMSortBufferSize = 'Буфферийн хэмжээг эрэмбэлэх'; +$strMyISAMDataPointerSizeDesc = 'Анхдагч заагчийн хэмжээ байтаар илэрхийлэгдэх ба, CREATE TABLE -ээр MyISAM хүснэгтийг MAX_ROWS сонголт тодорхойлогдоогүй үед хэрэглэгдэнэ.'; +$strMyISAMDataPointerSize = 'Өгөгдөл заагчийн хэмжээ'; +$strMyISAMMaxExtraSortFileSizeDesc = 'Хэрэв завсрын файл MyISAM индекс үүсгэлтэд хэрэглэгдсэн бол үүнээс их энд тодорхойлогдсон хэмжээгээр key cache хэрэглэх хэрэгтэй, key cache аргыг илүүд үзвэл.'; +$strMyISAMMaxExtraSortFileSize = 'Индекс үүсгэлт дэх завсрын файлын ХИ хэмжээ'; +$strMyISAMMaxSortFileSizeDesc = 'Завсрын MySQL файлын ХИ хэмжээ нь MyISAM индексийг да-үүсгэхэд (REPAIR TABLE, ALTER TABLE, болон LOAD DATA INFILE -ын үед) хэрэглэгдэнэ.'; +$strMyISAMMaxSortFileSize = 'Завсрын эрэмбэлэх файлын ХИ хэмжээ'; +$strMyISAMRecoverOptionsDesc = 'Горим нь эвдэрсэн MyISAM хүснэгтийг автоматаар засна, серверийн эхлэлийн --myisam-recover сонголтоор.'; +$strMyISAMRecoverOptions = 'Авто сэргээх горим'; +$strMyISAMRepairThreadsDesc = 'Хэрэв энэ утга нь 1 -ээс их байвал, эрэмбэлэх процессоор Засах үед MyISAM хүснэгтийн индексүүд нь зэрэгцээгээр (индекс бүрт өөрийн процесс) үүсгэгдсэн.'; +$strMyISAMRepairThreads = 'Thread засах'; +$strMyISAMSortBufferSizeDesc = 'REPAIR TABLE -ийн үед MyISAM индексийг эрэмбэлэх эсвэл CREATE INDEX болон ALTER TABLE -ээр индекс үүсгэх үед буффер хуваарилагдсан.'; +$strMyISAMSortBufferSize = 'Буфферийн хэмжээг эрэмбэлэх'; $strMySQLCharset = 'MySQL-кодлол'; $strMysqlClientVersion = 'MySQL клиент хувилбар'; $strMySQLConnectionCollation = 'MySQL холболтын кодлол'; @@ -467,7 +467,7 @@ $strNoActivity = '%s секунд ба түүнээс их идэвхгүй ба $strNoDatabasesSelected = 'ӨС сонгогдоогүй.'; $strNoDatabases = 'ӨС байхгүй'; $strNoDescription = 'тайлбаргүй'; -$strNoDetailsForEngine = 'Энд уг агуулах хөдөлгүүрийн дэлгэрэнгүй төлвийн мэдээлэл алга.'; +$strNoDetailsForEngine = 'Энд уг агуулах хөдөлгүүрийн дэлгэрэнгүй төлвийн мэдээлэл алга.'; $strNoDropDatabases = '"ӨС устгах" нь хаалттай.'; $strNoExplain = 'SQL тайлбарлахыг орхих'; $strNoFilesFoundInZip = 'ZIP архив дотор файл байхгүй байна!'; @@ -510,7 +510,7 @@ $strOverhead = 'Толгой дээр'; $strOverwriteExisting = 'Файл(ууд)-г дарж бичих'; $strPageNumber = 'Хуудасны дугаар:'; -$strPagesToBeFlushed = 'Хуудсууд зайлагдсан'; +$strPagesToBeFlushed = 'Хуудсууд зайлагдсан'; $strPaperSize = 'Цаасны хэмжээ'; $strPartialImport = 'Хэсэгчлэн оруулах'; $strPartialText = 'Бичвэрийн зарим хэсэг'; @@ -546,18 +546,18 @@ $strPrintViewFull = 'Хэвлэхээр харах (бүх бичвэртэй н $strPrintView = 'Хэвлэхээр харах'; $strPrint = 'Хэвлэх'; $strPrivDescAllPrivileges = 'Includes all privileges except GRANT.'; -$strPrivDescAlterRoutine = 'Хадгалагдсан заншил устгах, өөрчлөхийг зөвшөөрөх.'; +$strPrivDescAlterRoutine = 'Хадгалагдсан заншил устгах, өөрчлөхийг зөвшөөрөх.'; $strPrivDescAlter = 'Байгаа хүснэгтийн бүтцийг өөрчлөхийг зөвшөөрөх.'; $strPrivDescCreateDb = 'Шинэ өгөгдлийн сан, хүснэгт үүсгэхийг зөвшөөрөх.'; -$strPrivDescCreateRoutine = 'Хадгалагдсан заншил үүсгэхийг зөвшөөрөх.'; +$strPrivDescCreateRoutine = 'Хадгалагдсан заншил үүсгэхийг зөвшөөрөх.'; $strPrivDescCreateTbl = 'Шинэ хүснэгт үүсгэхийг зөвшөөрөх.'; $strPrivDescCreateTmpTable = 'Завсрын хүснэгт үүсгэхийг зөвшөөрөх.'; -$strPrivDescCreateUser = 'Хэрэглэгчийн эрхийг үүсгэх, устгах, да.нэрлэхийг зөвшөөрөх.'; -$strPrivDescCreateView = 'Шинэ харц үүсгэхийг зөвшөөрөх.'; +$strPrivDescCreateUser = 'Хэрэглэгчийн эрхийг үүсгэх, устгах, да.нэрлэхийг зөвшөөрөх.'; +$strPrivDescCreateView = 'Шинэ харц үүсгэхийг зөвшөөрөх.'; $strPrivDescDelete = 'Өгөгдөл устгахыг зөвшөөрөх.'; $strPrivDescDropDb = 'ӨС, хүснэгт устгахыг зөвшөөрөх '; $strPrivDescDropTbl = 'Хүснэгт устгахыг зөвшөөрөх.'; -$strPrivDescExecute5 = 'Хадгалагдсан заншлыг ажиллуулахыг зөвшөөрөх.'; +$strPrivDescExecute5 = 'Хадгалагдсан заншлыг ажиллуулахыг зөвшөөрөх.'; $strPrivDescExecute = 'Агуулагдсан (stored) процедурыг ажиллуулахыг зөвшөөрөх; MySQL-ын энэ хувилбарт үйлчлэлгүй.'; $strPrivDescFile = 'Өгөгдөл оруулах, файл руу гаргахыг зөвшөөрөх.'; $strPrivDescGrant = 'Хэрэглэгч болон онцгой эрхийг онцгой эрхийн хүснэгтийг дуудалгүй нэмэхийг зөвшөөрөх.'; @@ -574,7 +574,7 @@ $strPrivDescReplClient = 'Gives the right to the user to ask where the slaves / $strPrivDescReplSlave = 'Needed for the replication slaves.'; $strPrivDescSelect = 'Өгөгдөл уншихыг зөвшөөрөх.'; $strPrivDescShowDb = 'Өгөгдлийн сангийн бүрэн жагсаалт руу хандахыг өгөх.'; -$strPrivDescShowView = 'SHOW CREATE VIEW асуултыг хийхийг зөвшөөрөх.'; +$strPrivDescShowView = 'SHOW CREATE VIEW асуултыг хийхийг зөвшөөрөх.'; $strPrivDescShutdown = 'Сервэрийг унтраахыг зөвшөөрөх.'; $strPrivDescSuper = 'Хэрэв ХИ холболтын тоо гүйцсэн ч холбогдохыг зөвшөөрөх. Бусад хэрэглэгчийн процессыг үгүй хийх эсвэл глобал утгыг өөрчлөх шаардлагатай болно.'; $strPrivDescUpdate = 'Өгөгдөл солихыг зөвшөөрөх.'; @@ -600,7 +600,7 @@ $strQueryTime = 'Асуулт нь %01.4f сек авлаа'; $strQueryType = 'Асуултын төрөл'; $strQueryWindowLock = 'Цонхны гаднаас энэ асуултыг давхарлахгүй байх'; -$strReadRequests = 'Унших гуйлт'; +$strReadRequests = 'Унших гуйлт'; $strReceived = 'Ирсэн'; $strRecommended = 'сайшаагдсан'; $strRecords = 'Бичлэгүүд'; @@ -754,7 +754,7 @@ $strSize = 'Хэмжээ'; $strSlovak = 'Словак'; $strSlovenian = 'Словени'; $strSmallBigAll = 'Жижиш/Том Бүгдийг'; -$strSocketProblem = '(эсвэл дотоод MySQL сервэрийн socket нь зөв тохируулагдаагүй)'; +$strSocketProblem = '(эсвэл дотоод MySQL сервэрийн socket нь зөв тохируулагдаагүй)'; $strSortByKey = 'Түлхүүрээр эрэмбэлэх'; $strSorting = 'Эрэмбэлж байна'; $strSort = 'Эрэмбэлэх'; @@ -776,8 +776,8 @@ $strStatCreateTime = 'Үүсгэлт'; $strStatement = 'Баримтжуулал'; $strStatUpdateTime = 'Сүүлийн шинэчлэл'; $strStatus = 'Статус'; -$strStorageEngines = 'Агуулах хөдөлгүүрүүд'; -$strStorageEngine = 'Агуулах хөдөлгүүр'; +$strStorageEngines = 'Агуулах хөдөлгүүрүүд'; +$strStorageEngine = 'Агуулах хөдөлгүүр'; $strStrucCSV = 'CSV өгөгдөл'; $strStrucData = 'Бүтэц ба өгөгдөл'; $strStrucExcelCSV = 'CSV өгөгдлийг MS Excel-ээр'; @@ -876,12 +876,12 @@ $strValidateSQL = 'SQL-ийг батлах'; $strValidatorError = 'SQL баталгаажуулагч эхлэгдсэнгүй. Хэрэв PHP өргөтгөл суугдсан бол шалгана уу, %sбаримтжуулалд%s тодорхойлогдсон.'; $strValue = 'Утга'; $strVar = 'Хувьсагч'; -$strVersionInformation = 'Хувилбарын мэдээлэл'; +$strVersionInformation = 'Хувилбарын мэдээлэл'; $strViewDumpDatabases = 'ӨС-ийн схем харах'; $strViewDumpDB = 'ӨС-ийн схем харах'; $strViewDump = 'Хүснэгтийн схем харах'; -$strViewHasBeenDropped = 'Харц %s нь устгагдсан'; -$strView = 'Харц'; +$strViewHasBeenDropped = 'Харц %s нь устгагдсан'; +$strView = 'Харц'; $strWebServerUploadDirectoryError = 'Таны сонгосон хавтас "upload" хийгдэхгүй байна'; $strWebServerUploadDirectory = 'web-сервэр түлхэх хавтас'; @@ -890,7 +890,7 @@ $strWestEuropean = 'Баруун-Европ'; $strWildcard = 'загвар'; $strWindowNotFound = 'Зорилтот хөтчийн цонх шинэчлэгдсэнгүй. Магадгүй та эх цонхыг хаасан эсвэл таны хөтөч хамгаалалтын тохиргооны улмаас шинэчлэлтийг хориглогдсон'; $strWithChecked = 'Сонгогдсонтой:'; -$strWriteRequests = 'Бичих гуйлт'; +$strWriteRequests = 'Бичих гуйлт'; $strWrongUser = 'Нэвтрэгч/нууц үг буруу. Хандах боломжгүй'; $strXML = 'XML'; @@ -1486,4 +1486,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/norwegian-utf-8.inc.php b/lang/norwegian-utf-8.inc.php index 916de7e9f..54cbc3a4c 100644 --- a/lang/norwegian-utf-8.inc.php +++ b/lang/norwegian-utf-8.inc.php @@ -1463,4 +1463,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/persian-utf-8.inc.php b/lang/persian-utf-8.inc.php index dbaac3c52..22e7c958e 100644 --- a/lang/persian-utf-8.inc.php +++ b/lang/persian-utf-8.inc.php @@ -337,45 +337,45 @@ $strWrongUser = 'نام كاربر/اسم رمز اشتباه است. دسترس $strYes = 'بلي'; $strZip = '"zipped"'; -$strArmenian = 'ارمنی'; +$strArmenian = 'ارمنی'; $strArabic = 'عربی'; -$strAndThen = 'و سپس'; -$strBinLogInfo = 'اطلاعات'; -$strBulgarian = 'بلغاری'; -$strAfterInsertSame = 'برگرد به این صفحه'; +$strAndThen = 'و سپس'; +$strBinLogInfo = 'اطلاعات'; +$strBulgarian = 'بلغاری'; +$strAfterInsertSame = 'برگرد به این صفحه'; $strCalendar = 'تقویم'; $strCommand = 'دستور'; -$strCopy = 'نسخه برداری'; -$strDanish = 'دانمارکی'; -$strEnglish = 'انگلیسی'; -$strGreek = 'یونانی'; +$strCopy = 'نسخه برداری'; +$strDanish = 'دانمارکی'; +$strEnglish = 'انگلیسی'; +$strGreek = 'یونانی'; $strGeorgian = 'گرجی'; $strGerman = 'آلمانی'; -$strXML = 'XML'; -$strAfterInsertNext = 'ویرایش کردن ردیف بعدی'; -$strAdministration = 'مدیریت'; -$strSpanish = 'اسپانیایی'; +$strXML = 'XML'; +$strAfterInsertNext = 'ویرایش کردن ردیف بعدی'; +$strAdministration = 'مدیریت'; +$strSpanish = 'اسپانیایی'; $strDeleting = 'در حال پاک کردن %s'; -$strDictionary = 'لغت نامه'; -$strJapanese = 'ژاپنی'; -$strKorean = 'کره‌ای'; -$strDescription = 'توضیحات'; +$strDictionary = 'لغت نامه'; +$strJapanese = 'ژاپنی'; +$strKorean = 'کره‌ای'; +$strDescription = 'توضیحات'; $strEngines = 'موتور'; -$strId = 'شناسه'; +$strId = 'شناسه'; $strLanguageUnknown = 'زبانِ ناشناس : %1$s.'; -$strTurkish = 'ترکی'; +$strTurkish = 'ترکی'; $strUkrainian = 'اوکراینی'; $strUnknown = 'ناشناس'; -$strVar = 'متغییر'; -$strView = 'نمایش'; -$strWestEuropean = 'اروپای غربی'; -$strAddClause = 'افزودن %s'; -$strLocalhost = 'محلی'; +$strVar = 'متغییر'; +$strView = 'نمایش'; +$strWestEuropean = 'اروپای غربی'; +$strAddClause = 'افزودن %s'; +$strLocalhost = 'محلی'; $strLoginInformation = 'اطلاعات ورود'; -$strPerHour = 'در ساعت'; -$strPerMinute = 'در دقیقه'; +$strPerHour = 'در ساعت'; +$strPerMinute = 'در دقیقه'; $strPerSecond = 'در ثانیه'; -$strPolish = 'لهستانی'; +$strPolish = 'لهستانی'; @@ -1517,4 +1517,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/polish-utf-8.inc.php b/lang/polish-utf-8.inc.php index 767dda022..575775c9c 100644 --- a/lang/polish-utf-8.inc.php +++ b/lang/polish-utf-8.inc.php @@ -1177,7 +1177,7 @@ $strSetupForm_Sql_queries = 'Zapytania SQL'; $strSetupForm_Sql_queries_desc = 'SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings'; //to translate $strSetupForm_Other_core_settings = 'Inne kluczowe ustawienia'; $strSetupForm_Other_core_settings_desc = 'Settings that didn\'t fit enywhere else'; //to translate -$strSetupForm_Left_frame = 'Ramka nawigacji'; +$strSetupForm_Left_frame = 'Ramka nawigacji'; $strSetupForm_Left_frame_desc = 'Customize appearance of the navigation frame'; //to translate $strSetupForm_Left_servers = 'Serwery'; $strSetupForm_Left_servers_desc = 'Servers display options'; //to translate @@ -1459,4 +1459,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/portuguese-utf-8.inc.php b/lang/portuguese-utf-8.inc.php index 0849e40a2..fc6d4535f 100644 --- a/lang/portuguese-utf-8.inc.php +++ b/lang/portuguese-utf-8.inc.php @@ -1492,4 +1492,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/romanian-utf-8.inc.php b/lang/romanian-utf-8.inc.php index 1f5420e9c..eee388bf7 100644 --- a/lang/romanian-utf-8.inc.php +++ b/lang/romanian-utf-8.inc.php @@ -9,7 +9,7 @@ $number_decimal_separator = '.'; // shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa $byteUnits = array('octeți', 'KiO', 'MiO', 'GiO', 'TiO', 'PiO', 'EiO'); -// MySQL manual language definition, this is optional, en will be used +// MySQL manual language definition, this is optional, en will be used // if not defined $mysql_4_1_doc_lang = 'en'; $mysql_5_0_doc_lang = 'en'; @@ -1472,4 +1472,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/russian-utf-8.inc.php b/lang/russian-utf-8.inc.php index 91502755b..4b6c6380e 100644 --- a/lang/russian-utf-8.inc.php +++ b/lang/russian-utf-8.inc.php @@ -397,7 +397,7 @@ $strInvalidColumn = 'Выбран неверный столбец (%s)!'; $strInvalidCSVFieldCount = 'Неправильное количество полей во входных CSV-данных в строке %d.'; $strInvalidCSVFormat = 'Неправильный формат входных CSV-данных в строке %d.'; $strInvalidCSVParameter = 'Неправильный параметр импорта CSV: %s'; -$strInvalidDatabase = 'Некорректная база данных'; +$strInvalidDatabase = 'Некорректная база данных'; $strInvalidFieldAddCount = 'Необходимо добавить хотя бы одно поле.'; $strInvalidFieldCount = 'У таблицы должно быть, как минимум, одно поле.'; $strInvalidLDIImport = 'Этот модуль не поддерживает импорт сжатых данных!'; @@ -1476,4 +1476,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/serbian_cyrillic-utf-8.inc.php b/lang/serbian_cyrillic-utf-8.inc.php index 8a01e8ac9..6c358f877 100644 --- a/lang/serbian_cyrillic-utf-8.inc.php +++ b/lang/serbian_cyrillic-utf-8.inc.php @@ -1465,4 +1465,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/serbian_latin-utf-8.inc.php b/lang/serbian_latin-utf-8.inc.php index 239fe2476..92c90376b 100644 --- a/lang/serbian_latin-utf-8.inc.php +++ b/lang/serbian_latin-utf-8.inc.php @@ -1465,4 +1465,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/sinhala-utf-8.inc.php b/lang/sinhala-utf-8.inc.php index c8fa43205..f0a1d5d7d 100644 --- a/lang/sinhala-utf-8.inc.php +++ b/lang/sinhala-utf-8.inc.php @@ -1,6 +1,6 @@ diff --git a/lang/slovak-utf-8.inc.php b/lang/slovak-utf-8.inc.php index f9a58a335..080170c2a 100644 --- a/lang/slovak-utf-8.inc.php +++ b/lang/slovak-utf-8.inc.php @@ -1466,4 +1466,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/slovenian-utf-8.inc.php b/lang/slovenian-utf-8.inc.php index bafa4056d..90b62833d 100644 --- a/lang/slovenian-utf-8.inc.php +++ b/lang/slovenian-utf-8.inc.php @@ -1485,4 +1485,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/spanish-utf-8.inc.php b/lang/spanish-utf-8.inc.php index 06327c38c..df71e3a66 100644 --- a/lang/spanish-utf-8.inc.php +++ b/lang/spanish-utf-8.inc.php @@ -93,14 +93,14 @@ $strBrowseDistinctValues = 'Navegar los valores distintivos'; $strBrowse = 'Examinar'; $strBrowseForeignValues = 'Mostrar los valores extranjeros'; $strBufferPoolActivity = 'Actividad de la memoria (búfer) de tránsito común'; -$strBufferPool = 'Total de memoria del búfer'; -$strBufferPoolUsage = 'Total de memoria del búfer consumido'; +$strBufferPool = 'Total de memoria del búfer'; +$strBufferPoolUsage = 'Total de memoria del búfer consumido'; $strBufferReadMissesInPercent = 'Leer los fallos en %'; $strBufferReadMisses = 'Leer los fallos'; $strBufferWriteWaits = 'Escribir las esperas'; $strBufferWriteWaitsInPercent = 'Escribir las esperas en %'; $strBulgarian = 'Búlgaro'; -$strBusyPages = 'Páginas activas'; +$strBusyPages = 'Páginas activas'; $strBzip = '"Comprimido con bzip"'; $strCalendar = 'Calendario'; @@ -126,9 +126,9 @@ $strChangeCopyUser = 'Cambiar la información de la cuenta / Copiar el usuario'; $strChangeDisplay = 'Elegir el campo a mostrar'; $strChangePassword = 'Cambio de contraseña'; $strCharset = 'Juego de caracteres'; -$strCharsetOfFile = 'Juego de caracteres del archivo:'; -$strCharsetsAndCollations = 'Juego de caracteres y sus cotejamientos'; -$strCharsets = 'Juegos de caracteres'; +$strCharsetOfFile = 'Juego de caracteres del archivo:'; +$strCharsetsAndCollations = 'Juego de caracteres y sus cotejamientos'; +$strCharsets = 'Juegos de caracteres'; $strCheckAll = 'Marcar todos/as'; $strCheckOverhead = 'Marcar las tablas con residuo a depurar'; $strCheckPrivsLong = 'Revisar los privilegios para la base de datos "%s".'; @@ -200,7 +200,7 @@ $strDatabasesStatsHeavyTraffic = 'Nota: Activar aquí las estadísticas de la ba $strData = 'Datos'; $strDataDict = 'Diccionario de datos'; $strDataOnly = 'Solamente datos'; -$strDataPages = 'Páginas que contienen datos'; +$strDataPages = 'Páginas que contienen datos'; $strDBComment = 'Comentario de la base de datos: '; $strDBCopy = 'Copiar la base de datos a'; $strDbIsEmpty = 'La base de datos, ¡parece estar vacía!'; @@ -228,7 +228,7 @@ $strDesignerHelpDisplayField = 'El campo Display se halla en color rosado. Para $strDetails = 'Detalles...'; $strDictionary = 'diccionario'; $strDirectLinks = 'Enlaces directos'; -$strDirtyPages = 'Páginas que requieren ser depuradas'; +$strDirtyPages = 'Páginas que requieren ser depuradas'; $strDisabled = 'Deshabilitado'; $strDisableForeignChecks = 'Deshabilitar la revisión de las llaves extranjeras (foreign keys)'; $strDisplayFeat = 'Mostrar las opciones'; //Features = ¿opciones, componentes? @@ -260,7 +260,7 @@ $strEndRaw = 'FIN DEL VOLCADO'; $strEngineAvailable = '%s está disponible en este servidor MySQL.'; $strEngineDisabled = '%s ha sido deshabilitado para este motor de almacenamiento.'; $strEngines = 'Motores'; -$strEngineUnsupported = 'Este servidor MySQL no es compatible con el motor de almacenamiento %s.'; +$strEngineUnsupported = 'Este servidor MySQL no es compatible con el motor de almacenamiento %s.'; $strEnglish = 'Inglés'; $strEnglishPrivileges = ' Nota: Los nombres de los privilegios de MySQL están expresados en inglés '; $strError = 'Error'; @@ -310,7 +310,7 @@ $strForeignKeyError = 'Ocurrió un error al crear la llave extranjera en %1$s (r $strForeignKeyRelationAdded = 'Se añadió una relación FOREIGN KEY'; $strFormat = 'Formato'; $strFormEmpty = '¡Falta un valor en el formulario!'; -$strFreePages = 'Páginas libres'; +$strFreePages = 'Páginas libres'; $strFullText = 'Textos completos'; $strFunction = 'Función'; $strFunctions = 'Funciones'; @@ -366,12 +366,12 @@ $strIndex = 'Índice'; $strIndexName = 'Nombre del índice :'; $strIndexType = 'Tipo de índice :'; $strIndexWarningTable = 'Problemas con los índices de la tabla `%s`'; -$strInnoDBAutoextendIncrementDesc = 'El tamaño a incrementar para que se extienda el ancho de una tabla capaz de autoextenderse cuando se llena.'; -$strInnoDBAutoextendIncrement = 'Incremente el valor AUTOEXTEND'; +$strInnoDBAutoextendIncrementDesc = 'El tamaño a incrementar para que se extienda el ancho de una tabla capaz de autoextenderse cuando se llena.'; +$strInnoDBAutoextendIncrement = 'Incremente el valor AUTOEXTEND'; $strInnoDBBufferPoolSizeDesc = 'El tamaño de la memoria intermedia (búfer) usado por InnoDB para almacenar, en el cache, los datos e índices de sus tablas.'; $strInnoDBBufferPoolSize = 'Tamaño de la memoria (búfer) de tránsito común'; -$strInnoDBDataFilePath = 'Archivos de datos'; -$strInnoDBDataHomeDirDesc = 'La parte constante de la ruta del directorio para todos los archivos de datos InnoDB.'; +$strInnoDBDataFilePath = 'Archivos de datos'; +$strInnoDBDataHomeDirDesc = 'La parte constante de la ruta del directorio para todos los archivos de datos InnoDB.'; $strInnoDBDataHomeDir = 'Directorio raíz de los datos'; $strInnoDBPages = 'páginas'; $strInnodbStat = 'Estado del InnoDB'; @@ -470,13 +470,13 @@ $strMultilingual = 'multilingüe'; $strMyISAMDataPointerSizeDesc = 'El tamaño predeterminado del puntero de datos en bytes, para su uso en CREATE TABLE para las tablas MyISAM cuando no se ha especificado la opción MAX_ROWS.'; $strMyISAMDataPointerSize = 'Tamaño del puntero de datos'; $strMyISAMMaxExtraSortFileSizeDesc = 'Si el archivo temporal usado para la generación rápida de índices MyISAM fuese mayor que el uso del key cache por la cantidad especificada aquí, preferir el método key cache.'; -$strMyISAMMaxExtraSortFileSize = 'Tamaño máximo de los archivos temporales durante la generación del índice'; +$strMyISAMMaxExtraSortFileSize = 'Tamaño máximo de los archivos temporales durante la generación del índice'; $strMyISAMMaxSortFileSizeDesc = 'El tamaño máximo del archivo temporal que MySQL puede generar mientras genera un nuevo índice MyISAM del archivo temporal (durante REPAIR TABLE, ALTER TABLE, o LOAD DATA INFILE).'; $strMyISAMMaxSortFileSize = 'Tamaño máximo para los archivos temporales generados durante la organización'; -$strMyISAMRecoverOptionsDesc = 'La modalidad para la recuperación automática de tablas MyISAM caídas catastróficamente, como fuera determinado mediante la opción al arranque del servidor --myisam-recover.'; +$strMyISAMRecoverOptionsDesc = 'La modalidad para la recuperación automática de tablas MyISAM caídas catastróficamente, como fuera determinado mediante la opción al arranque del servidor --myisam-recover.'; $strMyISAMRecoverOptions = 'Modalidad de recuperación automática'; $strMyISAMRepairThreadsDesc = 'Si este valor es superior a 1, se generan en paralelo los índices de las tablas MyISAM (cada índice con su propio proceso) durante el proceso \"Reparar mediante organización\".'; -$strMyISAMRepairThreads = 'Reparar los procesos'; +$strMyISAMRepairThreads = 'Reparar los procesos'; $strMyISAMSortBufferSizeDesc = 'La cantidad de memoria que se asigna para organizar los índices MyISAM durante la operación REPAIR TABLE o cuando se generan índices con CREATE INDEX o ALTER TABLE.'; $strMyISAMSortBufferSize = 'Organizar el tamaño del búfer de memoria'; $strMySQLCharset = 'Juegos de caracteres de MySQL'; @@ -540,7 +540,7 @@ $strOverwriteExisting = 'Sobreescribir el(los) archivo(s) existente(s)'; $strPacked = 'Empacado'; $strPageNumber = 'Número de página:'; -$strPagesToBeFlushed = 'Páginas que serán eliminadas'; +$strPagesToBeFlushed = 'Páginas que serán eliminadas'; $strPaperSize = 'Tamaño del papel'; $strPartialImport = 'Importación parcial'; $strPartialText = 'Textos parciales'; @@ -890,7 +890,7 @@ $strSimplifiedChinese = 'Chino simplificado'; $strSingly = '(solamente)'; $strSize = 'Tamaño'; $strSkipQueries = 'Número de registros (consultas) a saltarse desde el inicio'; -$strSlovak = 'Eslovaco'; +$strSlovak = 'Eslovaco'; $strSlovenian = 'Esloveno'; $strSmallBigAll = 'Pequeño/grande todos'; $strSnapToGrid = 'Cuadrícula magnética'; @@ -1463,4 +1463,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/swedish-utf-8.inc.php b/lang/swedish-utf-8.inc.php index ce47d4c06..ae78b73ed 100644 --- a/lang/swedish-utf-8.inc.php +++ b/lang/swedish-utf-8.inc.php @@ -380,7 +380,10 @@ $strImportExportCoords = 'Importera/exportera koordinater för PDF-schema'; $strImportFiles = 'Importera filer'; $strImportFormat = 'Format på importerad fil'; $strImport = 'Importera'; +$strImportLargeFileUploading = 'Filen som laddas upp är förmodligen större än maximalt tillåtna storlek eller så är detta än känd bugg i webkit-baserade webbläsare (Safari, Google Chrome, Arora etc.).'; +$strImportProceedingFile = 'Filen bearbetas, vänligen vänta.'; $strImportSuccessfullyFinished = 'Importen har avslutats korrekt, %d frågor utförda.'; +$strImportUploadInfoNotAvailable = 'Var god vänta, filen håller på att laddas upp. Detaljer om denna uppladdning är inte tillgängliga.'; $strIndexes = 'Index'; $strIndexesSeemEqual = 'Indexen %1$s och %2$s verkar vara identiska och ett av dem kan möjligen tas bort.'; $strIndexHasBeenDropped = 'Index %s har tagits bort'; @@ -511,6 +514,7 @@ $strMySQLSaid = 'MySQL sa: '; $strMySQLShowProcess = 'Visa processer'; $strName = 'Namn'; +$strNavTableFilter = 'Filter'; $strNext = 'Nästa'; $strNoActivity = 'Ingen aktivitet sedan %s sekunder eller mer. Var god logga in igen'; $strNoDatabases = 'Inga databaser'; @@ -613,6 +617,7 @@ $strPerMinute = 'per minut'; $strPerSecond = 'per sekund'; $strPersian = 'Persiska'; $strPhoneBook = 'telefonbok'; +$strPhpArray = 'PHP-array'; $strPHPExtension = 'PHP-tillägg'; $strPhp = 'Skapa PHP-kod'; $strPHPVersion = 'PHP-version'; @@ -1026,9 +1031,9 @@ $strSetupServers_auth_swekey_config_desc = 'Sökväg till konfigurationsfilen f $strSetupServers_auth_swekey_config_name = 'SweKey konfigurationsfil'; $strSetupServers_auth_type_desc = 'Autentiseringsmetod att använda'; $strSetupServers_auth_type_name = 'Typ av autentisering'; -$strSetupServers_bookmarktable_desc = 'Lämna tomt för inget stöd för [a@http://wiki.phpmyadmin.net/pma/bookmark]bokmärken[/a], standard: [kbd]pma_bookmark[/kbd]'; +$strSetupServers_bookmarktable_desc = 'Lämna tomt för inget stöd för [a@http://wiki.phpmyadmin.net/pma/bookmark]bokmärken[/a], förslag: [kbd]pma_bookmark[/kbd]'; $strSetupServers_bookmarktable_name = 'Tabell för bokmärken'; -$strSetupServers_column_info_desc = 'Lämna tomt för inget stöd för kolumnkommentarer/mime-typer, standard: [kbd]pma_column_info[/kbd]'; +$strSetupServers_column_info_desc = 'Lämna tomt för inget stöd för kolumnkommentarer/mime-typer, förslag: [kbd]pma_column_info[/kbd]'; $strSetupServers_column_info_name = 'Tabell för kolumninformation'; $strSetupServers_compress_desc = 'Komprimera anslutning till MySQL-servern'; $strSetupServers_compress_name = 'Komprimera anslutning'; @@ -1039,7 +1044,7 @@ $strSetupServers_controluser_desc = 'En speciell MySQL-användare konfigurerad m $strSetupServers_controluser_name = 'Kontrollanvändare'; $strSetupServers_CountTables_desc = 'Räkna tabeller vid visning av databaslista'; $strSetupServers_CountTables_name = 'Räkna tabeller'; -$strSetupServers_designer_coords_desc = 'Lämna tomt för inget stöd för Designer, standard: [kbd]pma_designer_coords[/kbd]'; +$strSetupServers_designer_coords_desc = 'Lämna tomt för inget stöd för Designer, förslag: [kbd]pma_designer_coords[/kbd]'; $strSetupServers_designer_coords_name = 'Tabell för Designer'; $strSetupServers_DisableIS_desc = 'Mer information på [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] och [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]'; $strSetupServers_DisableIS_name = 'Inaktivera användning av INFORMATION_SCHEMA'; @@ -1049,7 +1054,7 @@ $strSetupServers_extension_desc = 'Vilket PHP-tillägg som ska användas; du bö $strSetupServers_extension_name = 'PHP-tillägg att använda'; $strSetupServers_hide_db_desc = 'Dölj databaser som matchar reguljärt uttryck (PCRE)'; $strSetupServers_hide_db_name = 'Dölj databaser'; -$strSetupServers_history_desc = 'Lämna tomt för inget stöd för SQL-frågehistorik, standard: [kbd]pma_history[/kbd]'; +$strSetupServers_history_desc = 'Lämna tomt för inget stöd för SQL-frågehistorik, förslag: [kbd]pma_history[/kbd]'; $strSetupServers_history_name = 'Tabell för SQL-frågehistorik'; $strSetupServers_host_desc = 'Värdnamn där MySQL-servern körs'; $strSetupServers_host_name = 'Serverns värdnamn'; @@ -1060,13 +1065,13 @@ $strSetupServers_only_db_desc = 'Du kan använda MySQL:s jokertecken (% och _), $strSetupServers_only_db_name = 'Visa endast listade databaser'; $strSetupServers_password_desc = 'Lämna tomt om inte autentisering config används'; $strSetupServers_password_name = 'Löseenord för autentisering config'; -$strSetupServers_pdf_pages_desc = 'Lämna tomt för inget stöd för PDF-schema, standard: [kbd]pma_pdf_pages[/kbd]'; +$strSetupServers_pdf_pages_desc = 'Lämna tomt för inget stöd för PDF-schema, förslag: [kbd]pma_pdf_pages[/kbd]'; $strSetupServers_pdf_pages_name = 'PDF-schema: Tabell för sidor'; -$strSetupServers_pmadb_desc = 'Databas som används för relationer, bokmärken och PDF-funktioner. Se [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] för komplett information. Lämna tomt för utan stöd. Standard: [kbd]phpmyadmin[/kbd]'; +$strSetupServers_pmadb_desc = 'Databas som används för relationer, bokmärken och PDF-funktioner. Se [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] för komplett information. Lämna tomt för utan stöd. Förslag: [kbd]phpmyadmin[/kbd]'; $strSetupServers_pmadb_name = 'PMA databas'; $strSetupServers_port_desc = 'Port som MySQL-servern lyssnar på, lämna tomt för standard'; $strSetupServers_port_name = 'Serverport'; -$strSetupServers_relation_desc = 'Lämna tomt för inget stöd för [a@http://wiki.phpmyadmin.net/pma/relation]relationslänkar[/a], standard: [kbd]pma_relation[/kbd]'; +$strSetupServers_relation_desc = 'Lämna tomt för inget stöd för [a@http://wiki.phpmyadmin.net/pma/relation]relationslänkar[/a], förslag: [kbd]pma_relation[/kbd]'; $strSetupServers_relation_name = 'Tabell för relationer'; $strSetupServers_ShowDatabasesCommand_desc = 'SQL-kommando för att hämta tillgängliga databaser'; $strSetupServers_ShowDatabasesCommand_name = 'SHOW DATABASES-kommando'; @@ -1078,9 +1083,9 @@ $strSetupServers_socket_desc = 'Sockel som MySQL-servern lyssnar på, lämna tom $strSetupServers_socket_name = 'Serversockel'; $strSetupServers_ssl_desc = ''; $strSetupServers_ssl_name = 'Använd SSL'; -$strSetupServers_table_coords_desc = 'Lämna tomt för inget stöd för PDF-schema, standard: [kbd]pma_table_coords[/kbd]'; +$strSetupServers_table_coords_desc = 'Lämna tomt för inget stöd för PDF-schema, förslag: [kbd]pma_table_coords[/kbd]'; $strSetupServers_table_coords_name = 'PDF-schema: tabellkoordinater'; -$strSetupServers_table_info_desc = 'Tabell för att beskriva fält att visa, lämna tomt för inget stöd; standard: [kbd]pma_table_info[/kbd]'; +$strSetupServers_table_info_desc = 'Tabell för att beskriva fält att visa, lämna tomt för inget stöd; förslag: [kbd]pma_table_info[/kbd]'; $strSetupServers_table_info_name = 'Tabell för visa fält'; $strSetupServers_user_desc = 'Lämna tomt om inte autentisering config används'; $strSetupServers_user_name = 'Användare för autentisering config'; @@ -1457,10 +1462,81 @@ $strYes = 'Ja'; $strZeroRemovesTheLimit = 'Anm: Genom att sätta dessa alternativ till 0 (noll) tas begränsningarna bort.'; $strZip = '"zippad"'; - -$strNavTableFilter = 'Filter'; //to translate -$strPhpArray = 'PHP array'; //to translate -$strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate -$strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate -$strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/tatarish-utf-8.inc.php b/lang/tatarish-utf-8.inc.php index c76cb5347..46cb0895d 100644 --- a/lang/tatarish-utf-8.inc.php +++ b/lang/tatarish-utf-8.inc.php @@ -1476,4 +1476,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/thai-utf-8.inc.php b/lang/thai-utf-8.inc.php index a8cd28190..b7ed548b6 100644 --- a/lang/thai-utf-8.inc.php +++ b/lang/thai-utf-8.inc.php @@ -46,7 +46,7 @@ $strAny = 'ใดๆ'; $strAnyHost = 'โฮสต์ใดๆ'; $strAnyUser = 'ผู้ใช้ใดๆ'; $strAPrimaryKey = 'ได้เพิ่มไพรมารีคีย์แล้วใน %s'; -$strArabic = 'อารบิค'; +$strArabic = 'อารบิค'; $strArmenian = 'อาร์เมเนีย'; $strAscending = 'น้อยไปมาก'; $strAtBeginningOfTable = 'ที่จุดเริ่มต้นของตาราง'; @@ -1487,4 +1487,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/turkish-utf-8.inc.php b/lang/turkish-utf-8.inc.php index 61d5d13a3..c4445a46b 100644 --- a/lang/turkish-utf-8.inc.php +++ b/lang/turkish-utf-8.inc.php @@ -12,7 +12,7 @@ $number_decimal_separator = '.'; // shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa $byteUnits = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'); -// MySQL manual language definition, this is optional, en will be used +// MySQL manual language definition, this is optional, en will be used // if not defined $mysql_4_1_doc_lang = 'tr'; $mysql_5_0_doc_lang = 'tr'; @@ -82,13 +82,13 @@ $strBeginCut = 'BEGIN CUT'; $strBeginRaw = 'BEGIN RAW'; $strBinary = 'Binari'; $strBinaryDoNotEdit = 'Binari - düzenlemeyiniz'; -$strBinaryLog = 'Binari günlüğü'; -$strBinLogEventType = 'Olay türü'; -$strBinLogInfo = 'Bilgi'; +$strBinaryLog = 'Binari günlüğü'; +$strBinLogEventType = 'Olay türü'; +$strBinLogInfo = 'Bilgi'; $strBinLogName = 'Günlük ismi'; $strBinLogOriginalPosition = 'Orijinal konum'; -$strBinLogPosition = 'Konum'; -$strBinLogServerId = 'Sunucu ID'; +$strBinLogPosition = 'Konum'; +$strBinLogServerId = 'Sunucu ID'; $strBLOBRepository = 'BLOB Havuzu'; $strBLOBRepositoryDamaged = 'Hasarlı'; $strBLOBRepositoryDisableAreYouSure = 'Tüm BLOB referanslarını %s veritabanı için etkisizleştirmek istediğinize emin misiniz?'; @@ -120,7 +120,7 @@ $strBufferReadMisses = 'Okuma kaçırıyor'; $strBufferWriteWaitsInPercent = 'Yazma beklemesi %'; $strBufferWriteWaits = 'Yazma bekliyor'; $strBulgarian = 'Bulgarca'; -$strBusyPages = 'Meşgul sayfalar'; +$strBusyPages = 'Meşgul sayfalar'; $strBzip = '"bzip olarak"'; $strCalendar = 'Takvim'; @@ -163,7 +163,7 @@ $strColumnPrivileges = 'Sütuna özgü yetkiler'; $strCommand = 'Komut'; $strComment = 'Yorum'; $strComments = 'Yorumlar'; -$strCompatibleHashing = 'MySQL 4.0 uyumlu'; +$strCompatibleHashing = 'MySQL 4.0 uyumlu'; $strCompleteInserts = 'Bütün eklemeler'; $strCompression = 'Sıkıştırma'; $strCompressionWillBeDetected = 'İçeri aktarılmış dosya sıkıştırması otomatik olarak bu dosya türlerinden algılanacak: %s'; @@ -228,7 +228,7 @@ $strDbPrivileges = 'Veritabanına özgü yetkiler'; $strDBRename = 'Veritabanını şuna yeniden adlandır'; $strDbSpecific = 'Veritabanına özgü'; $strDefault = 'Varsayılan'; -$strDefaultEngine = '%s bu MySQL sunucusundaki varsayılan depolama motorudur.'; +$strDefaultEngine = '%s bu MySQL sunucusundaki varsayılan depolama motorudur.'; $strDefaultValueHelp = 'Varsayılan değerler için lütfen sola eğik çizgisiz veya alıntısız sadece tek değer girin. Bu biçimi kullanın: a'; $strDefragment = 'Tabloyu birleştir'; $strDelayedInserts = 'Gecikmiş eklemeleri kullan'; @@ -331,7 +331,7 @@ $strForeignKeyError = '%1$s üzerinde dış anahtar oluşturma hatası (veri tü $strForeignKeyRelationAdded = 'FOREIGN KEY bağlantısı eklendi'; $strFormat = 'Biçim'; $strFormEmpty = 'Formda eksik değer!'; -$strFreePages = 'Serbest sayfalar'; +$strFreePages = 'Serbest sayfalar'; $strFullText = 'Tam Metinler'; $strFunctions = 'İşlevler'; $strFunction = 'İşlev'; @@ -499,8 +499,8 @@ $strMyISAMRecoverOptionsDesc = '-myisam-recover sunucusu başlat seçeneği yolu $strMyISAMRecoverOptions = 'Otomatik kurtarma kipi'; $strMyISAMRepairThreadsDesc = 'Eğer bu değer 1\'den büyükse, sıralama işlemi tarafından yapılan onarma sırasında, MyISAM tablosu indeksleri (her bir indeks kendi işlemi içinde) paralel olarak oluşturulur.'; $strMyISAMRepairThreads = 'İşlemleri onar'; -$strMyISAMSortBufferSize = 'Ara bellek boyutunu sırala'; -$strMyISAMSortBufferSizeDesc = 'Bir REPAIR TABLE komutu sırasında MyISAM indeksleri sıralanırken ya da CREATE INDEX veya ALTER TABLE komutuyla indeksler oluşturulduğunda ayrılan ara bellek miktarı.'; +$strMyISAMSortBufferSize = 'Ara bellek boyutunu sırala'; +$strMyISAMSortBufferSizeDesc = 'Bir REPAIR TABLE komutu sırasında MyISAM indeksleri sıralanırken ya da CREATE INDEX veya ALTER TABLE komutuyla indeksler oluşturulduğunda ayrılan ara bellek miktarı.'; $strMySQLCharset = 'MySQL karakter grubu'; $strMysqlClientVersion = 'MySQL istemci sürümü'; $strMySQLConnectionCollation = 'MySQL bağlantı karşılaştırması'; @@ -515,7 +515,7 @@ $strNoDatabasesSelected = 'Veritabanı seçilmedi.'; $strNoDatabases = 'Veritabanı yok'; $strNoDataReceived = 'İçeri aktarmak için veri alınmadı. Ya dosya adı gönderilmedi ya da PHP yapılandırmanız tarafından izin verilen en fazla boyut aşıldı. SSS 1.16\'ya bakın.'; $strNoDescription = 'Açıklama yok'; -$strNoDetailsForEngine = 'Bu depolama motoru için ayrıntılı durum bilgisi mevcut değil.'; +$strNoDetailsForEngine = 'Bu depolama motoru için ayrıntılı durum bilgisi mevcut değil.'; $strNoDropDatabases = '"DROP DATABASE" ifadesi etkisiz.'; $strNoExplain = 'SQL Açıklamasını atla'; $strNoFilesFoundInZip = 'ZIP arşivi içinde hiç dosya bulunamadı!'; @@ -572,7 +572,7 @@ $strPartitionMaintenance = 'Bölüm bakımı'; $strPartition = 'Bölüm %s'; $strPasswordChanged = '%s için parola başarılı olarak değiştirildi.'; $strPasswordEmpty = 'Parola boş!'; -$strPasswordHashing = 'Parola Hesaplanıyor'; +$strPasswordHashing = 'Parola Hesaplanıyor'; $strPasswordNotSame = 'Parolalar birbiriyle aynı değil!'; $strPassword = 'Parola'; $strPBXTCheckpointFrequency = 'Kontrol noktası sıklığı'; @@ -969,7 +969,7 @@ $strSetupLoginCookieValidityMsg = '[a@?page=form&formset=features#tab_Security]O $strSetupLoginCookieValidity_name = 'Oturum açma tanımlama bilgisi geçerliliği'; $strSetupMaxCharactersInDisplayedSQL_desc = 'SQL sorgusu görüntülendiğinde kullanılan en fazla karakter sayısıdır'; $strSetupMaxCharactersInDisplayedSQL_name = 'En fazla görüntülenecek SQL uzunluğu'; -$strSetupMaxDbList_desc = 'Sol çerçevede ve veritabanı listesinde görüntülenecek olan en fazla veritabanı sayısıdır'; +$strSetupMaxDbList_desc = 'Sol çerçevede ve veritabanı listesinde görüntülenecek olan en fazla veritabanı sayısıdır'; $strSetupMaxDbList_name = 'En fazla veritabanı'; $strSetupMaxRows_desc = 'Sonuç grubuna göz atarken görüntülenecek satır sayısıdır. Eğer sonuç grubu daha fazla satır içeriyorsa, "Önceki" ve "Sonraki" bağlantıları gösterilecektir.'; $strSetupMaxRows_name = 'Görüntülemek için en fazla satır sayısı'; @@ -1310,7 +1310,7 @@ $strSwekeyAuthenticating = 'Kimlik denetleniyor...'; $strSwekeyAuthFailed = 'Donanım kimlik denetimi başarısız'; $strSwekeyNoKeyId = '%s dosyası herhangi bir anahtar kimliği içermiyor'; $strSwekeyNoKey = 'Geçerli kimlik denetimi anahtarı takılı değil'; -$strSwitchToDatabase = 'Kopyalanmış veritabanına geç.'; +$strSwitchToDatabase = 'Kopyalanmış veritabanına geç.'; $strSwitchToTable = 'Kopyalanmış tabloya geç'; $strTableAlreadyExists = '%s tablosu zaten var!'; @@ -1469,4 +1469,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/ukrainian-utf-8.inc.php b/lang/ukrainian-utf-8.inc.php index cbcf41db1..ba3a0f182 100644 --- a/lang/ukrainian-utf-8.inc.php +++ b/lang/ukrainian-utf-8.inc.php @@ -1485,4 +1485,81 @@ $strPhpArray = 'PHP array'; //to translate $strImportLargeFileUploading = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'; //to translate $strImportProceedingFile = 'The file is being processed, please be patient.'; //to translate $strImportUploadInfoNotAvailable = 'Please be patient, the file is being uploaded. Details about the upload are not available.'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/uzbek_cyrillic-utf-8.inc.php b/lang/uzbek_cyrillic-utf-8.inc.php index 930b36b70..c415d6aa5 100644 --- a/lang/uzbek_cyrillic-utf-8.inc.php +++ b/lang/uzbek_cyrillic-utf-8.inc.php @@ -418,7 +418,7 @@ $strInvalidColumnCount = 'Устунлар сони нолдан кўп бўли $strInvalidCSVFieldCount = 'Киритилаётган CSV маълумотларнинг %d қаторидаги майдонлар сони нотўғри.'; $strInvalidCSVFormat = 'Киритилаётган CSV маълумотларнинг %d қаторидаги маълумотлар формати нотўғри.'; $strInvalidCSVParameter = 'CSV импортидаги парамерт нотўғри: "%s"'; -$strInvalidDatabase = 'Нотўғри маълумотлар базаси'; +$strInvalidDatabase = 'Нотўғри маълумотлар базаси'; $strInvalidFieldAddCount = 'Ҳеч бўлмаганда битта майдон киритиш шарт.'; $strInvalidFieldCount = 'Жадвалда, ҳеч бўлмаганда, битта майдон бўлиши шарт.'; $strInvalidLDIImport = 'Ушбу модул қисилган маълумотларни импорт қила олмайди!'; @@ -810,7 +810,7 @@ $strSetupblowfish_secret_desc = '[kbd]cookie[/kbd]-аутентификация $strSetupblowfish_secret_name = 'Сирли калит сўз (Blowfish)'; $strSetupBlowfishSecretCharsMsg = 'Калит ҳарфлар, рақамлар [em]ва[/em] махсус белгиларни олиши керак'; $strSetupBlowfishSecretLengthMsg = 'Калит жуда қисқа, у камида 8 та белгидан иборат бўлиши керак'; -$strSetupBlowfishSecretMsg = 'Сиз конфигурацион файлда калит сўз(Blowfish)ни белгиламагансиз, лекин cookie-аутентификация усулидан фойдаланаяпсиз, шунинг учун калит сўз автоматик тарзда тузилди. Ушбу калит сўз шифрлашда қўлланилади, уни эслаб қолишингиз шарт эмас.'; +$strSetupBlowfishSecretMsg = 'Сиз конфигурацион файлда калит сўз(Blowfish)ни белгиламагансиз, лекин cookie-аутентификация усулидан фойдаланаяпсиз, шунинг учун калит сўз автоматик тарзда тузилди. Ушбу калит сўз шифрлашда қўлланилади, уни эслаб қолишингиз шарт эмас.'; $strSetupBrowseMarkerEnable_desc = 'Танланган қаторларни белгилаш'; $strSetupBrowseMarkerEnable_name = 'Қатор маркери'; $strSetupBrowsePointerEnable_desc = 'Сичқонча курсори кўрсатиб турган қаторни белгилаш'; @@ -895,7 +895,7 @@ $strSetupForm_Import_defaults = 'Импорт'; $strSetupForm_Import_defaults_desc = 'Импорт афзалликларини созлаш'; $strSetupForm_Import_export = 'Импорт/Экспорт'; $strSetupForm_Import_export_desc = 'Импорт ва экспорт каталоглари ва қисиш усулларини белгилаш'; -$strSetupForm_Left_databases = 'Маълумотлар базалари'; +$strSetupForm_Left_databases = 'Маълумотлар базалари'; $strSetupForm_Left_databases_desc = 'Маълумотлар базаларини кўрсатиш афзалликлари'; $strSetupForm_Left_frame = 'Навигация панели'; $strSetupForm_Left_frame_desc = 'Навигация панели кўринишини созлаш'; @@ -948,7 +948,7 @@ $strSetupImport_skip_queries_desc = 'Файл бошидаги эътибор б $strSetupImport_skip_queries_name = 'Қисман импорт: сўровларга эътибор бермаслик'; $strSetupInsecureConnection = 'Нохавфсиз уланиш'; $strSetupInsecureConnectionMsg1 = 'Сизнинг уланишингиз хавфсиз эмас; барча маълумотлар (шу жумладан, сирли маълумотлар, масалан, пароллар) шифрланмаган ҳолда узатилади!'; -$strSetupInsecureConnectionMsg2 = 'Агар серверингиз HTTPS талабларига жавоб бера олса, унда хавфсиз уланишни ишлатиш учун [a@"%s"]ушбу боғдан[/a] фойдаланинг.'; +$strSetupInsecureConnectionMsg2 = 'Агар серверингиз HTTPS талабларига жавоб бера олса, унда хавфсиз уланишни ишлатиш учун [a@"%s"]ушбу боғдан[/a] фойдаланинг.'; $strSetupInsertRows_desc = 'Бир вақтнинг ўзиданечта қатор қўйилиши мумкин'; $strSetupInsertRows_name = 'Қўйилган қаторлар сони'; $strSetupLeftDefaultTabTable_name = 'Тезкор мурожаат пиктограммаси учун нишон'; @@ -1467,4 +1467,81 @@ $strZeroRemovesTheLimit = 'ИЗОҲ: параметр қийматларини 0 $strZip = 'zip'; $strSetupServers_AllowNoPassword_name = 'Allow logins without a password'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/lang/uzbek_latin-utf-8.inc.php b/lang/uzbek_latin-utf-8.inc.php index 1d8e35000..7c0431b83 100644 --- a/lang/uzbek_latin-utf-8.inc.php +++ b/lang/uzbek_latin-utf-8.inc.php @@ -418,7 +418,7 @@ $strInvalidColumnCount = 'Ustunlar soni noldan ko‘p bo‘lishi shart.'; $strInvalidCSVFieldCount = 'Kiritilayotgan CSV ma`lumotlarning %d qatoridagi maydonlar soni noto‘g‘ri.'; $strInvalidCSVFormat = 'Kiritilayotgan CSV ma`lumotlarning %d qatoridagi ma`lumotlar formati noto‘g‘ri.'; $strInvalidCSVParameter = 'CSV importidagi paramert noto‘g‘ri: "%s"'; -$strInvalidDatabase = 'Noto‘g‘ri ma`lumotlar bazasi'; +$strInvalidDatabase = 'Noto‘g‘ri ma`lumotlar bazasi'; $strInvalidFieldAddCount = 'Hech bo‘lmaganda bitta maydon kiritish shart.'; $strInvalidFieldCount = 'Jadvalda, hech bo‘lmaganda, bitta maydon bo‘lishi shart.'; $strInvalidLDIImport = 'Ushbu modul qisilgan ma`lumotlarni import qila olmaydi!'; @@ -810,7 +810,7 @@ $strSetupblowfish_secret_desc = '[kbd]cookie[/kbd]-autentifikatsiya usulida cook $strSetupblowfish_secret_name = 'Sirli kalit so‘z (Blowfish)'; $strSetupBlowfishSecretCharsMsg = 'Kalit harflar, raqamlar [em]va[/em] maxsus belgilarni olishi kerak'; $strSetupBlowfishSecretLengthMsg = 'Kalit juda qisqa, u kamida 8 ta belgidan iborat bo‘lishi kerak'; -$strSetupBlowfishSecretMsg = 'Siz konfiguratsion faylda kalit so‘z(Blowfish)ni belgilamagansiz, lekin cookie-autentifikatsiya usulidan foydalanayapsiz, shuning uchun kalit so‘z avtomatik tarzda tuzildi. Ushbu kalit so‘z shifrlashda qo‘llaniladi, uni eslab qolishingiz shart emas.'; +$strSetupBlowfishSecretMsg = 'Siz konfiguratsion faylda kalit so‘z(Blowfish)ni belgilamagansiz, lekin cookie-autentifikatsiya usulidan foydalanayapsiz, shuning uchun kalit so‘z avtomatik tarzda tuzildi. Ushbu kalit so‘z shifrlashda qo‘llaniladi, uni eslab qolishingiz shart emas.'; $strSetupBrowseMarkerEnable_desc = 'Tanlangan qatorlarni belgilash'; $strSetupBrowseMarkerEnable_name = 'Qator markeri'; $strSetupBrowsePointerEnable_desc = 'Sichqoncha kursori ko‘rsatib turgan qatorni belgilash'; @@ -895,7 +895,7 @@ $strSetupForm_Import_defaults = 'Import'; $strSetupForm_Import_defaults_desc = 'Import afzalliklarini sozlash'; $strSetupForm_Import_export = 'Import/Eksport'; $strSetupForm_Import_export_desc = 'Import va eksport kataloglari va qisish usullarini belgilash'; -$strSetupForm_Left_databases = 'Ma`lumotlar bazalari'; +$strSetupForm_Left_databases = 'Ma`lumotlar bazalari'; $strSetupForm_Left_databases_desc = 'Ma`lumotlar bazalarini ko‘rsatish afzalliklari'; $strSetupForm_Left_frame = 'Navigatsiya paneli'; $strSetupForm_Left_frame_desc = 'Navigatsiya paneli ko‘rinishini sozlash'; @@ -948,7 +948,7 @@ $strSetupImport_skip_queries_desc = 'Fayl boshidagi e`tibor berish kerak bo‘lm $strSetupImport_skip_queries_name = 'Qisman import: so‘rovlarga e`tibor bermaslik'; $strSetupInsecureConnection = 'Noxavfsiz ulanish'; $strSetupInsecureConnectionMsg1 = 'Sizning ulanishingiz xavfsiz emas; barcha ma`lumotlar (shu jumladan, sirli ma`lumotlar, masalan, parollar) shifrlanmagan holda uzatiladi!'; -$strSetupInsecureConnectionMsg2 = 'Agar serveringiz HTTPS talablariga javob bera olsa, unda xavfsiz ulanishni ishlatish uchun [a@"%s"]ushbu bog‘dan[/a] foydalaning.'; +$strSetupInsecureConnectionMsg2 = 'Agar serveringiz HTTPS talablariga javob bera olsa, unda xavfsiz ulanishni ishlatish uchun [a@"%s"]ushbu bog‘dan[/a] foydalaning.'; $strSetupInsertRows_desc = 'Bir vaqtning o‘zidanechta qator qo‘yilishi mumkin'; $strSetupInsertRows_name = 'Qo‘yilgan qatorlar soni'; $strSetupLeftDefaultTabTable_name = 'Tezkor murojaat piktogrammasi uchun nishon'; @@ -1467,4 +1467,81 @@ $strZeroRemovesTheLimit = 'IZOH: parametr qiymatlarini 0 (nol) deb belgilash mav $strZip = 'zip'; $strSetupServers_AllowNoPassword_name = 'Allow logins without a password'; //to translate +$strImportNoticePt1 = 'The following structures have either been created or altered. Here you can:'; //to translate +$strImportNoticePt3 = 'Change any of its settings by clicking the corresponding "Options" link'; //to translate +$strGoToDatabase = 'Go to database'; //to translate +$strGoToTable = 'Go to table'; //to translate +$strGoToView = 'Go to view'; //to translate +$strStructureLC = 'structure'; //to translate +$strSettings = 'settings'; //to translate +$strImportODS = 'Open Document Spreadsheet'; //to translate +$strImportColNames = 'Column names in first row'; //to translate +$strImportEmptyRows = 'Do not import empty rows'; //to translate +$strImportODSPercents = 'Import percentages as proper decimals (12.00% to .12)'; //to translate +$strImportODSCurrency = 'Import currencies ($5.00 to 5.00)'; //to translate +$strImportXLS = 'Excel 97-2003 XLS Workbook'; //to translate +$strImportNoticePt2 = 'View a structure`s contents by clicking on its name'; //to translate +$strImportNoticePt4 = 'Edit its structure by following the "Structure" link'; //to translate +$strImportXLSX = 'Excel 2007 XLSX Workbook'; //to translate +$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate +$strXMLExportContents = 'Export contents'; //to translate +$strXMLExportFunctions = 'Export functions'; //to translate +$strXMLExportProcedures = 'Export procedures'; //to translate +$strXMLExportStructs = 'Export Structure Schemas (recommended)'; //to translate +$strXMLExportTables = 'Export tables'; //to translate +$strXMLExportTriggers = 'Export triggers'; //to translate +$strXMLExportViews = 'Export views'; //to translate +$strTracking = 'Tracking'; //to translate +$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate +$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate +$strTrackingActivateNow = 'Activate now'; //to translate +$strTrackingCreateVersion = 'Create version'; //to translate +$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate +$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate +$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate +$strTrackingDate = 'Date'; //to translate +$strTrackingDeactivateNow = 'Deactivate now'; //to translate +$strTrackingDeactivateTrackingFor = 'Deactivate tracking for %s.%s'; //to translate +$strTrackingDoIt = 'Do it'; //to translate +$strTrackingExportAs = 'Export as %s'; //to translate +$strTrackingIsActive = 'Tracking is active.'; //to translate +$strTrackingIsDeactive = 'Tracking is deactive.'; //to translate +$strTrackingMechanism = 'Tracking Mechanism'; //to translate +$strTrackingReport = 'Tracking report'; //to translate +$strTrackingReportClose = 'Close'; //to translate +$strTrackingSelectStructureAndData = 'Structure and Data'; //to translate +$strTrackingSelectDataOnly = 'Data only'; //to translate +$strTrackingSelectStructureOnly = 'Structure only'; //to translate +$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate +$strTrackingShowVersions = 'Show versions'; //to translate +$strTrackingSQLDump = 'SQL dump'; //to translate +$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate +$strTrackingSQLExecution = 'SQL execution'; //to translate +$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate +$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate +$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate +$strTrackingStatements = 'Tracking statements'; //to translate +$strTrackingStatusActive = 'active'; //to translate +$strTrackingStatusDeactive = 'deactive'; //to translate +$strTrackingStructureSnapshot = 'Structure snapshot'; //to translate +$strTrackingThDatabase = 'Database'; //to translate +$strTrackingThTable = 'Table'; //to translate +$strTrackingThLastVersion = 'Last version'; //to translate +$strTrackingThVersion = 'Version'; //to translate +$strTrackingThCreated = 'Created'; //to translate +$strTrackingThUpdated = 'Updated'; //to translate +$strTrackingThStatus = 'Status'; //to translate +$strTrackingThShow = 'Show'; //to translate +$strTrackingTrackDDStatements = 'Track these data definition statements:'; //to translate +$strTrackingTrackDMStatements = 'Track these data manipulation statements:'; //to translate +$strTrackingTrackTable = 'Track table'; //to translate +$strTrackingTrackedTables = 'Tracked tables'; //to translate +$strTrackingUntrackedTables = 'Untracked tables'; //to translate +$strTrackingUsername = 'Username'; //to translate +$strTrackingVersions = 'Versions'; //to translate +$strTrackingVersionCreated = 'Version %s is created, tracking for %s.%s is activated.'; //to translate +$strTrackingVersionActivated = 'Tracking for %s.%s , version %s is activated.'; //to translate +$strTrackingVersionDeactivated = 'Tracking for %s.%s , version %s is deactivated.'; //to translate +$strTrackingVersionSnapshotSQL = 'Version %s snapshot (SQL code)'; //to translate +$strTrackingDatabaseLog = 'Database Log'; //to translate ?> diff --git a/libraries/Message.class.php b/libraries/Message.class.php index ceca49e96..e7947b854 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -4,7 +4,7 @@ * Holds class PMA_Message * * @author Sebastian Mendel - * @version $Id: Error.class.php 10738 2007-10-08 16:02:58Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin */ diff --git a/libraries/PHPExcel/PHPExcel.php b/libraries/PHPExcel/PHPExcel.php new file mode 100644 index 000000000..ac5f00246 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel.php @@ -0,0 +1,749 @@ +_workSheetCollection = array(); + $this->_workSheetCollection[] = new PHPExcel_Worksheet($this); + $this->_activeSheetIndex = 0; + + // Create document properties + $this->_properties = new PHPExcel_DocumentProperties(); + + // Create document security + $this->_security = new PHPExcel_DocumentSecurity(); + + // Set named ranges + $this->_namedRanges = array(); + + // Create the cellXf supervisor + $this->_cellXfSupervisor = new PHPExcel_Style(true); + $this->_cellXfSupervisor->bindParent($this); + + // Create the default style + $this->addCellXf(new PHPExcel_Style); + $this->addCellStyleXf(new PHPExcel_Style); + } + + /** + * Get properties + * + * @return PHPExcel_DocumentProperties + */ + public function getProperties() + { + return $this->_properties; + } + + /** + * Set properties + * + * @param PHPExcel_DocumentProperties $pValue + */ + public function setProperties(PHPExcel_DocumentProperties $pValue) + { + $this->_properties = $pValue; + } + + /** + * Get security + * + * @return PHPExcel_DocumentSecurity + */ + public function getSecurity() + { + return $this->_security; + } + + /** + * Set security + * + * @param PHPExcel_DocumentSecurity $pValue + */ + public function setSecurity(PHPExcel_DocumentSecurity $pValue) + { + $this->_security = $pValue; + } + + /** + * Get active sheet + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_workSheetCollection[$this->_activeSheetIndex]; + } + + /** + * Create sheet and add it to this workbook + * + * @return PHPExcel_Worksheet + */ + public function createSheet($iSheetIndex = null) + { + $newSheet = new PHPExcel_Worksheet($this); + $this->addSheet($newSheet, $iSheetIndex); + return $newSheet; + } + + /** + * Add sheet + * + * @param PHPExcel_Worksheet $pSheet + * @throws Exception + */ + public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null) + { + if(is_null($iSheetIndex)) + { + $this->_workSheetCollection[] = $pSheet; + } + else + { + // Insert the sheet at the requested index + array_splice( + $this->_workSheetCollection, + $iSheetIndex, + 0, + array($pSheet) + ); + } + } + + /** + * Remove sheet by index + * + * @param int $pIndex Active sheet index + * @throws Exception + */ + public function removeSheetByIndex($pIndex = 0) + { + if ($pIndex > count($this->_workSheetCollection) - 1) { + throw new Exception("Sheet index is out of bounds."); + } else { + array_splice($this->_workSheetCollection, $pIndex, 1); + } + } + + /** + * Get sheet by index + * + * @param int $pIndex Sheet index + * @return PHPExcel_Worksheet + * @throws Exception + */ + public function getSheet($pIndex = 0) + { + if ($pIndex > count($this->_workSheetCollection) - 1) { + throw new Exception("Sheet index is out of bounds."); + } else { + return $this->_workSheetCollection[$pIndex]; + } + } + + /** + * Get all sheets + * + * @return PHPExcel_Worksheet[] + */ + public function getAllSheets() + { + return $this->_workSheetCollection; + } + + /** + * Get sheet by name + * + * @param string $pName Sheet name + * @return PHPExcel_Worksheet + * @throws Exception + */ + public function getSheetByName($pName = '') + { + $worksheetCount = count($this->_workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + if ($this->_workSheetCollection[$i]->getTitle() == $pName) { + return $this->_workSheetCollection[$i]; + } + } + + return null; + } + + /** + * Get index for sheet + * + * @param PHPExcel_Worksheet $pSheet + * @return Sheet index + * @throws Exception + */ + public function getIndex(PHPExcel_Worksheet $pSheet) + { + foreach ($this->_workSheetCollection as $key => $value) { + if ($value->getHashCode() == $pSheet->getHashCode()) { + return $key; + } + } + } + + /** + * Set index for sheet by sheet name. + * + * @param string $sheetName Sheet name to modify index for + * @param int $newIndex New index for the sheet + * @return New sheet index + * @throws Exception + */ + public function setIndexByName($sheetName, $newIndex) + { + $oldIndex = $this->getIndex($this->getSheetByName($sheetName)); + $pSheet = array_splice( + $this->_workSheetCollection, + $oldIndex, + 1 + ); + array_splice( + $this->_workSheetCollection, + $newIndex, + 0, + $pSheet + ); + return $newIndex; + } + + /** + * Get sheet count + * + * @return int + */ + public function getSheetCount() + { + return count($this->_workSheetCollection); + } + + /** + * Get active sheet index + * + * @return int Active sheet index + */ + public function getActiveSheetIndex() + { + return $this->_activeSheetIndex; + } + + /** + * Set active sheet index + * + * @param int $pIndex Active sheet index + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setActiveSheetIndex($pIndex = 0) + { + if ($pIndex > count($this->_workSheetCollection) - 1) { + throw new Exception("Active sheet index is out of bounds."); + } else { + $this->_activeSheetIndex = $pIndex; + } + return $this->getActiveSheet(); + } + + /** + * Get sheet names + * + * @return string[] + */ + public function getSheetNames() + { + $returnValue = array(); + $worksheetCount = $this->getSheetCount(); + for ($i = 0; $i < $worksheetCount; ++$i) { + array_push($returnValue, $this->getSheet($i)->getTitle()); + } + + return $returnValue; + } + + /** + * Add external sheet + * + * @param PHPExcel_Worksheet $pSheet External sheet to add + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function addExternalSheet(PHPExcel_Worksheet $pSheet) { + if (!is_null($this->getSheetByName($pSheet->getTitle()))) { + throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); + } + + // count how many cellXfs there are in this workbook currently, we will need this below + $countCellXfs = count($this->_cellXfCollection); + + // copy all the shared cellXfs from the external workbook and append them to the current + foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) { + $this->addCellXf(clone $cellXf); + } + + // move sheet to this workbook + $pSheet->rebindParent($this); + + // update the cellXfs + foreach ($pSheet->getCellCollection(false) as $cell) { + $cell->setXfIndex( $cell->getXfIndex() + $countCellXfs ); + } + + return $this->addSheet($pSheet); + } + + /** + * Get named ranges + * + * @return PHPExcel_NamedRange[] + */ + public function getNamedRanges() { + return $this->_namedRanges; + } + + /** + * Add named range + * + * @param PHPExcel_NamedRange $namedRange + * @return PHPExcel + */ + public function addNamedRange(PHPExcel_NamedRange $namedRange) { + $this->_namedRanges[$namedRange->getWorksheet()->getTitle().'!'.$namedRange->getName()] = $namedRange; + return true; + } + + /** + * Get named range + * + * @param string $namedRange + */ + public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + if ($namedRange != '' && !is_null($namedRange)) { + if (!is_null($pSheet)) { + $key = $pSheet->getTitle().'!'.$namedRange; + if (isset($this->_namedRanges[$key])) { + return $this->_namedRanges[$key]; + } + } + $returnCount = 0; + foreach($this->_namedRanges as $_namedRange) { + if ($_namedRange->getName() == $namedRange) { + if ((!is_null($pSheet)) && ($_namedRange->getWorksheet()->getTitle() == $pSheet->getTitle())) { + return $_namedRange; + } else { + $returnCount++; + $returnValue = $_namedRange; + } + } + } + if ($returnCount == 1) { + return $returnValue; + } + } + + return null; + } + + /** + * Remove named range + * + * @param string $namedRange + * @return PHPExcel + */ + public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + if ($namedRange != '' && !is_null($namedRange)) { + if (!is_null($pSheet)) { + $key = $pSheet->getTitle().'!'.$namedRange; + if (isset($this->_namedRanges[$key])) { + unset($this->_namedRanges[$key]); + } + } + foreach($this->_namedRanges as $_namedRange) { + if ($_namedRange->getName() == $namedRange) { + if ((!is_null($pSheet)) && ($_namedRange->getWorksheet()->getTitle() == $pSheet->getTitle())) { + $key = $pSheet->getTitle().'!'.$namedRange; + if (isset($this->_namedRanges[$key])) { + unset($this->_namedRanges[$key]); + } + } + } + } + } + return $this; + } + + /** + * Get worksheet iterator + * + * @return PHPExcel_WorksheetIterator + */ + public function getWorksheetIterator() { + return new PHPExcel_WorksheetIterator($this); + } + + /** + * Copy workbook (!= clone!) + * + * @return PHPExcel + */ + public function copy() { + $copied = clone $this; + + $worksheetCount = count($this->_workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + $this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy(); + $this->_workSheetCollection[$i]->rebindParent($this); + } + + return $copied; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + foreach($this as $key => $val) { + if (is_object($val) || (is_array($val))) { + $this->{$key} = unserialize(serialize($val)); + } + } + } + + /** + * Get the workbook collection of cellXfs + * + * @return PHPExcel_Style[] + */ + public function getCellXfCollection() + { + return $this->_cellXfCollection; + } + + /** + * Get cellXf by index + * + * @param int $index + * @return PHPExcel_Style + */ + public function getCellXfByIndex($pIndex = 0) + { + return $this->_cellXfCollection[$pIndex]; + } + + /** + * Get cellXf by hash code + * + * @param string $pValue + * @return PHPExcel_Style|false + */ + public function getCellXfByHashCode($pValue = '') + { + foreach ($this->_cellXfCollection as $cellXf) { + if ($cellXf->getHashCode() == $pValue) { + return $cellXf; + } + } + return false; + } + + /** + * Get default style + * + * @return PHPExcel_Style + * @throws Exception + */ + public function getDefaultStyle() + { + if (isset($this->_cellXfCollection[0])) { + return $this->_cellXfCollection[0]; + } + throw new Exception('No default style found for this workbook'); + } + + /** + * Add a cellXf to the workbook + * + * @param PHPExcel_Style + */ + public function addCellXf(PHPExcel_Style $style) + { + $this->_cellXfCollection[] = $style; + $style->setIndex(count($this->_cellXfCollection) - 1); + } + + /** + * Remove cellXf by index. It is ensured that all cells get their xf index updated. + * + * @param int $pIndex Index to cellXf + * @throws Exception + */ + public function removeCellXfByIndex($pIndex = 0) + { + if ($pIndex > count($this->_cellXfCollection) - 1) { + throw new Exception("CellXf index is out of bounds."); + } else { + // first remove the cellXf + array_splice($this->_cellXfCollection, $pIndex, 1); + + // then update cellXf indexes for cells + foreach ($this->_workSheetCollection as $worksheet) { + foreach ($worksheet->getCellCollection(false) as $cell) { + $xfIndex = $cell->getXfIndex(); + if ($xfIndex > $pIndex ) { + // decrease xf index by 1 + $cell->setXfIndex($xfIndex - 1); + } else if ($xfIndex == $pIndex) { + // set to default xf index 0 + $cell->setXfIndex(0); + } + } + } + } + } + + /** + * Get the cellXf supervisor + * + * @return PHPExcel_Style + */ + public function getCellXfSupervisor() + { + return $this->_cellXfSupervisor; + } + + /** + * Get the workbook collection of cellStyleXfs + * + * @return PHPExcel_Style[] + */ + public function getCellStyleXfCollection() + { + return $this->_cellStyleXfCollection; + } + + /** + * Get cellStyleXf by index + * + * @param int $pIndex + * @return PHPExcel_Style + */ + public function getCellStyleXfByIndex($pIndex = 0) + { + return $this->_cellStyleXfCollection[$pIndex]; + } + + /** + * Get cellStyleXf by hash code + * + * @param string $pValue + * @return PHPExcel_Style|false + */ + public function getCellStyleXfByHashCode($pValue = '') + { + foreach ($this->_cellXfStyleCollection as $cellStyleXf) { + if ($cellStyleXf->getHashCode() == $pValue) { + return $cellStyleXf; + } + } + return false; + } + + /** + * Add a cellStyleXf to the workbook + * + * @param PHPExcel_Style $pStyle + */ + public function addCellStyleXf(PHPExcel_Style $pStyle) + { + $this->_cellStyleXfCollection[] = $pStyle; + $pStyle->setIndex(count($this->_cellStyleXfCollection) - 1); + } + + /** + * Remove cellStyleXf by index + * + * @param int $pIndex + * @throws Exception + */ + public function removeCellStyleXfByIndex($pIndex = 0) + { + if ($pIndex > count($this->_cellStyleXfCollection) - 1) { + throw new Exception("CellStyleXf index is out of bounds."); + } else { + array_splice($this->_cellStyleXfCollection, $pIndex, 1); + } + } + + /** + * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells in the workbook + */ + public function garbageCollect() + { + // how many references are there to each cellXf ? + $countReferencesCellXf = array(); + foreach ($this->_cellXfCollection as $index => $cellXf) { + $countReferencesCellXf[$index] = 0; + } + + foreach ($this->getWorksheetIterator() as $sheet) { + foreach ($sheet->getCellCollection(false) as $cell) { + ++$countReferencesCellXf[$cell->getXfIndex()]; + } + } + + // remove those cellXfs that have zero references and create mapping so we can update xfIndex for all cells + $countNeededCellXfs = 0; + foreach ($this->_cellXfCollection as $index => $cellXf) { + if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf + ++$countNeededCellXfs; + } else { + unset($this->_cellXfCollection[$index]); + } + $map[$index] = $countNeededCellXfs - 1; + } + $this->_cellXfCollection = array_values($this->_cellXfCollection); + + // if we removed the first style by accident, recreate it + if (count($this->_cellXfCollection) == 0) { + $this->_cellXfCollection[] = new PHPExcel_Style(); + } + + // update the xfIndex for all cells + foreach ($this->getWorksheetIterator() as $sheet) { + foreach ($sheet->getCellCollection(false) as $cell) { + $cell->setXfIndex( $map[$cell->getXfIndex()] ); + } + } + + // also do garbage collection for all the sheets + foreach ($this->getWorksheetIterator() as $sheet) { + $sheet->garbageCollect(); + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation.php b/libraries/PHPExcel/PHPExcel/Calculation.php new file mode 100644 index 000000000..5ade6558c --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation.php @@ -0,0 +1,3075 @@ +', '<', '=', '>=', '<=', '<>'); + + + /** + * List of binary operators (those that expect two operands) + * + * @access private + * @var array + */ + private $_binaryOperators = array('+', '-', '*', '/', '^', '&', '>', '<', '=', '>=', '<=', '<>'); + + public $suppressFormulaErrors = false; + public $formulaError = null; + public $writeDebugLog = false; + private $debugLogStack = array(); + public $debugLog = array(); + + + // Constant conversion from text name/value to actual (datatyped) value + private $_ExcelConstants = array('TRUE' => True, + 'FALSE' => False, + 'NULL' => Null + ); + + // PHPExcel functions + private $_PHPExcelFunctions = array( // PHPExcel functions + 'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'abs', + 'argumentCount' => '1' + ), + 'ACCRINT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::ACCRINT', + 'argumentCount' => '4-7' + ), + 'ACCRINTM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::ACCRINTM', + 'argumentCount' => '3-5' + ), + 'ACOS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'acos', + 'argumentCount' => '1' + ), + 'ACOSH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'acosh', + 'argumentCount' => '1' + ), + 'ADDRESS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::CELL_ADDRESS', + 'argumentCount' => '2-5' + ), + 'AMORDEGRC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '6,7' + ), + 'AMORLINC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '6,7' + ), + 'AND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGICAL_AND', + 'argumentCount' => '1+' + ), + 'AREAS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'ASC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'ASIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'asin', + 'argumentCount' => '1' + ), + 'ASINH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'asinh', + 'argumentCount' => '1' + ), + 'ATAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'atan', + 'argumentCount' => '1' + ), + 'ATAN2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::REVERSE_ATAN2', + 'argumentCount' => '2' + ), + 'ATANH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'atanh', + 'argumentCount' => '1' + ), + 'AVEDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::AVEDEV', + 'argumentCount' => '1+' + ), + 'AVERAGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::AVERAGE', + 'argumentCount' => '1+' + ), + 'AVERAGEA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::AVERAGEA', + 'argumentCount' => '1+' + ), + 'AVERAGEIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2,3' + ), + 'AVERAGEIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3+' + ), + 'BAHTTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'BESSELI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BESSELI', + 'argumentCount' => '2' + ), + 'BESSELJ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BESSELJ', + 'argumentCount' => '2' + ), + 'BESSELK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BESSELK', + 'argumentCount' => '2' + ), + 'BESSELY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BESSELY', + 'argumentCount' => '2' + ), + 'BETADIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::BETADIST', + 'argumentCount' => '3-5' + ), + 'BETAINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::BETAINV', + 'argumentCount' => '3-5' + ), + 'BIN2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BINTODEC', + 'argumentCount' => '1' + ), + 'BIN2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BINTOHEX', + 'argumentCount' => '1,2' + ), + 'BIN2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::BINTOOCT', + 'argumentCount' => '1,2' + ), + 'BINOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::BINOMDIST', + 'argumentCount' => '4' + ), + 'CEILING' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::CEILING', + 'argumentCount' => '2' + ), + 'CELL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1,2' + ), + 'CHAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::CHARACTER', + 'argumentCount' => '1' + ), + 'CHIDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CHIDIST', + 'argumentCount' => '2' + ), + 'CHIINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CHIINV', + 'argumentCount' => '2' + ), + 'CHITEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'CHOOSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::CHOOSE', + 'argumentCount' => '2+' + ), + 'CLEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::TRIMNONPRINTABLE', + 'argumentCount' => '1' + ), + 'CODE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::ASCIICODE', + 'argumentCount' => '1' + ), + 'COLUMN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::COLUMN', + 'argumentCount' => '-1' + ), + 'COLUMNS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'COMBIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::COMBIN', + 'argumentCount' => '2' + ), + 'COMPLEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::COMPLEX', + 'argumentCount' => '2,3' + ), + 'CONCATENATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::CONCATENATE', + 'argumentCount' => '1+' + ), + 'CONFIDENCE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CONFIDENCE', + 'argumentCount' => '3' + ), + 'CONVERT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::CONVERTUOM', + 'argumentCount' => '3' + ), + 'CORREL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CORREL', + 'argumentCount' => '2' + ), + 'COS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'cos', + 'argumentCount' => '1' + ), + 'COSH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'cosh', + 'argumentCount' => '1' + ), + 'COUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::COUNT', + 'argumentCount' => '1+' + ), + 'COUNTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::COUNTA', + 'argumentCount' => '1+' + ), + 'COUNTBLANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::COUNTBLANK', + 'argumentCount' => '1' + ), + 'COUNTIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::COUNTIF', + 'argumentCount' => '2' + ), + 'COUNTIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'COUPDAYBS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COUPDAYS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COUPDAYSNC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COUPNCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COUPNUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COUPPCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'COVAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::COVAR', + 'argumentCount' => '2' + ), + 'CRITBINOM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CRITBINOM', + 'argumentCount' => '3' + ), + 'CUBEKPIMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBEMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBEMEMBERPROPERTY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBERANKEDMEMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBESET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBESETCOUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUBEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_CUBE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'CUMIPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CUMIPMT', + 'argumentCount' => '6' + ), + 'CUMPRINC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CUMPRINC', + 'argumentCount' => '6' + ), + 'DATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DATE', + 'argumentCount' => '3' + ), + 'DATEDIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DATEDIF', + 'argumentCount' => '3' + ), + 'DATEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DATEVALUE', + 'argumentCount' => '1' + ), + 'DAVERAGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DAYOFMONTH', + 'argumentCount' => '1' + ), + 'DAYS360' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DAYS360', + 'argumentCount' => '2,3' + ), + 'DB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DB', + 'argumentCount' => '4,5' + ), + 'DCOUNT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DCOUNTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DDB', + 'argumentCount' => '4,5' + ), + 'DEC2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::DECTOBIN', + 'argumentCount' => '1,2' + ), + 'DEC2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::DECTOHEX', + 'argumentCount' => '1,2' + ), + 'DEC2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::DECTOOCT', + 'argumentCount' => '1,2' + ), + 'DEGREES' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'rad2deg', + 'argumentCount' => '1' + ), + 'DELTA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::DELTA', + 'argumentCount' => '1,2' + ), + 'DEVSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DEVSQ', + 'argumentCount' => '1+' + ), + 'DGET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DISC', + 'argumentCount' => '4,5' + ), + 'DMAX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DMIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DOLLAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DOLLAR', + 'argumentCount' => '1,2' + ), + 'DOLLARDE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DOLLARDE', + 'argumentCount' => '2' + ), + 'DOLLARFR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DOLLARFR', + 'argumentCount' => '2' + ), + 'DPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DSTDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DSTDEVP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DURATION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '5,6' + ), + 'DVAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'DVARP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'EDATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::EDATE', + 'argumentCount' => '2' + ), + 'EFFECT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::EFFECT', + 'argumentCount' => '2' + ), + 'EOMONTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::EOMONTH', + 'argumentCount' => '2' + ), + 'ERF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::ERF', + 'argumentCount' => '1,2' + ), + 'ERFC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::ERFC', + 'argumentCount' => '1' + ), + 'ERROR.TYPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::ERROR_TYPE', + 'argumentCount' => '1' + ), + 'EVEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::EVEN', + 'argumentCount' => '1' + ), + 'EXACT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'EXP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'exp', + 'argumentCount' => '1' + ), + 'EXPONDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::EXPONDIST', + 'argumentCount' => '3' + ), + 'FACT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::FACT', + 'argumentCount' => '1' + ), + 'FACTDOUBLE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::FACTDOUBLE', + 'argumentCount' => '1' + ), + 'FALSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGICAL_FALSE', + 'argumentCount' => '0' + ), + 'FDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3' + ), + 'FIND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::SEARCHSENSITIVE', + 'argumentCount' => '2,3' + ), + 'FINDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::SEARCHSENSITIVE', + 'argumentCount' => '2,3' + ), + 'FINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3' + ), + 'FISHER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::FISHER', + 'argumentCount' => '1' + ), + 'FISHERINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::FISHERINV', + 'argumentCount' => '1' + ), + 'FIXED' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::FIXEDFORMAT', + 'argumentCount' => '1-3' + ), + 'FLOOR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::FLOOR', + 'argumentCount' => '2' + ), + 'FORECAST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::FORECAST', + 'argumentCount' => '3' + ), + 'FREQUENCY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'FTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'FV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::FV', + 'argumentCount' => '3-5' + ), + 'FVSCHEDULE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'GAMMADIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::GAMMADIST', + 'argumentCount' => '4' + ), + 'GAMMAINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::GAMMAINV', + 'argumentCount' => '3' + ), + 'GAMMALN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::GAMMALN', + 'argumentCount' => '1' + ), + 'GCD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::GCD', + 'argumentCount' => '1+' + ), + 'GEOMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::GEOMEAN', + 'argumentCount' => '1+' + ), + 'GESTEP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::GESTEP', + 'argumentCount' => '1,2' + ), + 'GETPIVOTDATA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2+' + ), + 'GROWTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::GROWTH', + 'argumentCount' => '1-4' + ), + 'HARMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::HARMEAN', + 'argumentCount' => '1+' + ), + 'HEX2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::HEXTOBIN', + 'argumentCount' => '1,2' + ), + 'HEX2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::HEXTODEC', + 'argumentCount' => '1' + ), + 'HEX2OCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::HEXTOOCT', + 'argumentCount' => '1,2' + ), + 'HLOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'HOUR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::HOUROFDAY', + 'argumentCount' => '1' + ), + 'HYPERLINK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1,2' + ), + 'HYPGEOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::HYPGEOMDIST', + 'argumentCount' => '4' + ), + 'IF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STATEMENT_IF', + 'argumentCount' => '1-3' + ), + 'IFERROR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STATEMENT_IFERROR', + 'argumentCount' => '1' + ), + 'IMABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMABS', + 'argumentCount' => '1' + ), + 'IMAGINARY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMAGINARY', + 'argumentCount' => '1' + ), + 'IMARGUMENT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMARGUMENT', + 'argumentCount' => '1' + ), + 'IMCONJUGATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMCONJUGATE', + 'argumentCount' => '1' + ), + 'IMCOS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMCOS', + 'argumentCount' => '1' + ), + 'IMDIV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMDIV', + 'argumentCount' => '2' + ), + 'IMEXP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMEXP', + 'argumentCount' => '1' + ), + 'IMLN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMLN', + 'argumentCount' => '1' + ), + 'IMLOG10' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMLOG10', + 'argumentCount' => '1' + ), + 'IMLOG2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMLOG2', + 'argumentCount' => '1' + ), + 'IMPOWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMPOWER', + 'argumentCount' => '2' + ), + 'IMPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMPRODUCT', + 'argumentCount' => '1+' + ), + 'IMREAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMREAL', + 'argumentCount' => '1' + ), + 'IMSIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMSIN', + 'argumentCount' => '1' + ), + 'IMSQRT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMSQRT', + 'argumentCount' => '1' + ), + 'IMSUB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMSUB', + 'argumentCount' => '2' + ), + 'IMSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::IMSUM', + 'argumentCount' => '1+' + ), + 'INDEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::INDEX', + 'argumentCount' => '1-4' + ), + 'INDIRECT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1,2' + ), + 'INFO' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'INT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::INTVALUE', + 'argumentCount' => '1' + ), + 'INTERCEPT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::INTERCEPT', + 'argumentCount' => '2' + ), + 'INTRATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::INTRATE', + 'argumentCount' => '4,5' + ), + 'IPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::IPMT', + 'argumentCount' => '4-6' + ), + 'IRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1,2' + ), + 'ISBLANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_BLANK', + 'argumentCount' => '1' + ), + 'ISERR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERR', + 'argumentCount' => '1' + ), + 'ISERROR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERROR', + 'argumentCount' => '1' + ), + 'ISEVEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_EVEN', + 'argumentCount' => '1' + ), + 'ISLOGICAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_LOGICAL', + 'argumentCount' => '1' + ), + 'ISNA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NA', + 'argumentCount' => '1' + ), + 'ISNONTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NONTEXT', + 'argumentCount' => '1' + ), + 'ISNUMBER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NUMBER', + 'argumentCount' => '1' + ), + 'ISODD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ODD', + 'argumentCount' => '1' + ), + 'ISPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '4' + ), + 'ISREF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'ISTEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::IS_TEXT', + 'argumentCount' => '1' + ), + 'JIS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'KURT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::KURT', + 'argumentCount' => '1+' + ), + 'LARGE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LARGE', + 'argumentCount' => '2' + ), + 'LCM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::LCM', + 'argumentCount' => '1+' + ), + 'LEFT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::LEFT', + 'argumentCount' => '1,2' + ), + 'LEFTB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::LEFT', + 'argumentCount' => '1,2' + ), + 'LEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::STRINGLENGTH', + 'argumentCount' => '1' + ), + 'LENB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::STRINGLENGTH', + 'argumentCount' => '1' + ), + 'LINEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LINEST', + 'argumentCount' => '1-4' + ), + 'LN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'log', + 'argumentCount' => '1' + ), + 'LOG' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOG_BASE', + 'argumentCount' => '1,2' + ), + 'LOG10' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'log10', + 'argumentCount' => '1' + ), + 'LOGEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGEST', + 'argumentCount' => '1-4' + ), + 'LOGINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGINV', + 'argumentCount' => '3' + ), + 'LOGNORMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGNORMDIST', + 'argumentCount' => '3' + ), + 'LOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOOKUP', + 'argumentCount' => '2,3' + ), + 'LOWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOWERCASE', + 'argumentCount' => '1' + ), + 'MATCH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::MATCH', + 'argumentCount' => '2,3' + ), + 'MAX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MAX', + 'argumentCount' => '1+' + ), + 'MAXA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MAXA', + 'argumentCount' => '1+' + ), + 'MDETERM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MDETERM', + 'argumentCount' => '1' + ), + 'MDURATION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '5,6' + ), + 'MEDIAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MEDIAN', + 'argumentCount' => '1+' + ), + 'MID' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::MID', + 'argumentCount' => '3' + ), + 'MIDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::MID', + 'argumentCount' => '3' + ), + 'MIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MIN', + 'argumentCount' => '1+' + ), + 'MINA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MINA', + 'argumentCount' => '1+' + ), + 'MINUTE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::MINUTEOFHOUR', + 'argumentCount' => '1' + ), + 'MINVERSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MINVERSE', + 'argumentCount' => '1' + ), + 'MIRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3' + ), + 'MMULT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MMULT', + 'argumentCount' => '2' + ), + 'MOD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MOD', + 'argumentCount' => '2' + ), + 'MODE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::MODE', + 'argumentCount' => '1+' + ), + 'MONTH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::MONTHOFYEAR', + 'argumentCount' => '1' + ), + 'MROUND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MROUND', + 'argumentCount' => '2' + ), + 'MULTINOMIAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::MULTINOMIAL', + 'argumentCount' => '1+' + ), + 'N' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'NA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::NA', + 'argumentCount' => '0' + ), + 'NEGBINOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NEGBINOMDIST', + 'argumentCount' => '3' + ), + 'NETWORKDAYS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::NETWORKDAYS', + 'argumentCount' => '2+' + ), + 'NOMINAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NOMINAL', + 'argumentCount' => '2' + ), + 'NORMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NORMDIST', + 'argumentCount' => '4' + ), + 'NORMINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NORMINV', + 'argumentCount' => '3' + ), + 'NORMSDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NORMSDIST', + 'argumentCount' => '1' + ), + 'NORMSINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NORMSINV', + 'argumentCount' => '1' + ), + 'NOT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGICAL_NOT', + 'argumentCount' => '1' + ), + 'NOW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DATETIMENOW', + 'argumentCount' => '0' + ), + 'NPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NPER', + 'argumentCount' => '3-5' + ), + 'NPV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::NPV', + 'argumentCount' => '2+' + ), + 'OCT2BIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::OCTTOBIN', + 'argumentCount' => '1,2' + ), + 'OCT2DEC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::OCTTODEC', + 'argumentCount' => '1' + ), + 'OCT2HEX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING, + 'functionCall' => 'PHPExcel_Calculation_Functions::OCTTOHEX', + 'argumentCount' => '1,2' + ), + 'ODD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::ODD', + 'argumentCount' => '1' + ), + 'ODDFPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '8,9' + ), + 'ODDFYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '8,9' + ), + 'ODDLPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '7,8' + ), + 'ODDLYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '7,8' + ), + 'OFFSET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::OFFSET', + 'argumentCount' => '3,5' + ), + 'OR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGICAL_OR', + 'argumentCount' => '1+' + ), + 'PEARSON' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::CORREL', + 'argumentCount' => '2' + ), + 'PERCENTILE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PERCENTILE', + 'argumentCount' => '2' + ), + 'PERCENTRANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PERCENTRANK', + 'argumentCount' => '2,3' + ), + 'PERMUT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PERMUT', + 'argumentCount' => '2' + ), + 'PHONETIC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'PI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'pi', + 'argumentCount' => '0' + ), + 'PMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PMT', + 'argumentCount' => '3-5' + ), + 'POISSON' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::POISSON', + 'argumentCount' => '3' + ), + 'POWER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::POWER', + 'argumentCount' => '2' + ), + 'PPMT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PPMT', + 'argumentCount' => '4-6' + ), + 'PRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '6,7' + ), + 'PRICEDISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PRICEDISC', + 'argumentCount' => '4,5' + ), + 'PRICEMAT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PRICEMAT', + 'argumentCount' => '5,6' + ), + 'PROB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'PRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::PRODUCT', + 'argumentCount' => '1+' + ), + 'PROPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::PROPERCASE', + 'argumentCount' => '1' + ), + 'PV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::PV', + 'argumentCount' => '3-5' + ), + 'QUARTILE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::QUARTILE', + 'argumentCount' => '2' + ), + 'QUOTIENT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::QUOTIENT', + 'argumentCount' => '2' + ), + 'RADIANS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'deg2rad', + 'argumentCount' => '1' + ), + 'RAND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::RAND', + 'argumentCount' => '0' + ), + 'RANDBETWEEN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::RAND', + 'argumentCount' => '2' + ), + 'RANK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::RANK', + 'argumentCount' => '2,3' + ), + 'RATE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3-6' + ), + 'RECEIVED' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::RECEIVED', + 'argumentCount' => '4-5' + ), + 'REPLACE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::REPLACE', + 'argumentCount' => '4' + ), + 'REPLACEB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::REPLACE', + 'argumentCount' => '4' + ), + 'REPT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'str_repeat', + 'argumentCount' => '2' + ), + 'RIGHT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::RIGHT', + 'argumentCount' => '1,2' + ), + 'RIGHTB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::RIGHT', + 'argumentCount' => '1,2' + ), + 'ROMAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::ROMAN', + 'argumentCount' => '1,2' + ), + 'ROUND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'round', + 'argumentCount' => '2' + ), + 'ROUNDDOWN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::ROUNDDOWN', + 'argumentCount' => '2' + ), + 'ROUNDUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::ROUNDUP', + 'argumentCount' => '2' + ), + 'ROW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::ROW', + 'argumentCount' => '-1' + ), + 'ROWS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'RSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::RSQ', + 'argumentCount' => '2' + ), + 'RTD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1+' + ), + 'SEARCH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::SEARCHINSENSITIVE', + 'argumentCount' => '2,3' + ), + 'SEARCHB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::SEARCHINSENSITIVE', + 'argumentCount' => '2,3' + ), + 'SECOND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::SECONDOFMINUTE', + 'argumentCount' => '1' + ), + 'SERIESSUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SERIESSUM', + 'argumentCount' => '4' + ), + 'SIGN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SIGN', + 'argumentCount' => '1' + ), + 'SIN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sin', + 'argumentCount' => '1' + ), + 'SINH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sinh', + 'argumentCount' => '1' + ), + 'SKEW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::SKEW', + 'argumentCount' => '1+' + ), + 'SLN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::SLN', + 'argumentCount' => '3' + ), + 'SLOPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::SLOPE', + 'argumentCount' => '2' + ), + 'SMALL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::SMALL', + 'argumentCount' => '2' + ), + 'SQRT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sqrt', + 'argumentCount' => '1' + ), + 'SQRTPI' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SQRTPI', + 'argumentCount' => '1' + ), + 'STANDARDIZE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STANDARDIZE', + 'argumentCount' => '3' + ), + 'STDEV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STDEV', + 'argumentCount' => '1+' + ), + 'STDEVA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STDEVA', + 'argumentCount' => '1+' + ), + 'STDEVP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STDEVP', + 'argumentCount' => '1+' + ), + 'STDEVPA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STDEVPA', + 'argumentCount' => '1+' + ), + 'STEYX' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::STEYX', + 'argumentCount' => '2' + ), + 'SUBSTITUTE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3,4' + ), + 'SUBTOTAL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUBTOTAL', + 'argumentCount' => '2+' + ), + 'SUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUM', + 'argumentCount' => '1+' + ), + 'SUMIF' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUMIF', + 'argumentCount' => '2,3' + ), + 'SUMIFS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ), + 'SUMPRODUCT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1+' + ), + 'SUMSQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUMSQ', + 'argumentCount' => '1+' + ), + 'SUMX2MY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUMX2MY2', + 'argumentCount' => '2' + ), + 'SUMX2PY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUMX2PY2', + 'argumentCount' => '2' + ), + 'SUMXMY2' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::SUMXMY2', + 'argumentCount' => '2' + ), + 'SYD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::SYD', + 'argumentCount' => '4' + ), + 'T' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::RETURNSTRING', + 'argumentCount' => '1' + ), + 'TAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'tan', + 'argumentCount' => '1' + ), + 'TANH' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'tanh', + 'argumentCount' => '1' + ), + 'TBILLEQ' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TBILLEQ', + 'argumentCount' => '3' + ), + 'TBILLPRICE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TBILLPRICE', + 'argumentCount' => '3' + ), + 'TBILLYIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TBILLYIELD', + 'argumentCount' => '3' + ), + 'TDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TDIST', + 'argumentCount' => '3' + ), + 'TEXT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::TEXTFORMAT', + 'argumentCount' => '2' + ), + 'TIME' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::TIME', + 'argumentCount' => '3' + ), + 'TIMEVALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::TIMEVALUE', + 'argumentCount' => '1' + ), + 'TINV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TINV', + 'argumentCount' => '2' + ), + 'TODAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DATENOW', + 'argumentCount' => '0' + ), + 'TRANSPOSE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::TRANSPOSE', + 'argumentCount' => '1' + ), + 'TREND' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TREND', + 'argumentCount' => '1-4' + ), + 'TRIM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::TRIMSPACES', + 'argumentCount' => '1' + ), + 'TRIMMEAN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::TRIMMEAN', + 'argumentCount' => '2' + ), + 'TRUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::LOGICAL_TRUE', + 'argumentCount' => '0' + ), + 'TRUNC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'PHPExcel_Calculation_Functions::TRUNC', + 'argumentCount' => '1,2' + ), + 'TTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '4' + ), + 'TYPE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'UPPER' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::UPPERCASE', + 'argumentCount' => '1' + ), + 'USDOLLAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2' + ), + 'VALUE' => array('category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '1' + ), + 'VAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::VARFunc', + 'argumentCount' => '1+' + ), + 'VARA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::VARA', + 'argumentCount' => '1+' + ), + 'VARP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::VARP', + 'argumentCount' => '1+' + ), + 'VARPA' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::VARPA', + 'argumentCount' => '1+' + ), + 'VDB' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '5-7' + ), + 'VERSION' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, + 'functionCall' => 'PHPExcel_Calculation_Functions::VERSION', + 'argumentCount' => '0' + ), + 'VLOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => 'PHPExcel_Calculation_Functions::VLOOKUP', + 'argumentCount' => '3,4' + ), + 'WEEKDAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::DAYOFWEEK', + 'argumentCount' => '1,2' + ), + 'WEEKNUM' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::WEEKOFYEAR', + 'argumentCount' => '1,2' + ), + 'WEIBULL' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::WEIBULL', + 'argumentCount' => '4' + ), + 'WORKDAY' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::WORKDAY', + 'argumentCount' => '2+' + ), + 'XIRR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '2,3' + ), + 'XNPV' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '3' + ), + 'YEAR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::YEAR', + 'argumentCount' => '1' + ), + 'YEARFRAC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, + 'functionCall' => 'PHPExcel_Calculation_Functions::YEARFRAC', + 'argumentCount' => '2,3' + ), + 'YIELD' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '6,7' + ), + 'YIELDDISC' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::YIELDDISC', + 'argumentCount' => '4,5' + ), + 'YIELDMAT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::YIELDMAT', + 'argumentCount' => '5,6' + ), + 'ZTEST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, + 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'argumentCount' => '?' + ) + ); + + + // Internal functions used for special control purposes + private $_controlFunctions = array( + 'MKMATRIX' => array('argumentCount' => '*', + 'functionCall' => array('self','_mkMatrix') + ) + ); + + + + + /** + * Get an instance of this class + * + * @access public + * @return PHPExcel_Calculation + */ + public static function getInstance() { + if (!isset(self::$_instance) || is_null(self::$_instance)) { + self::$_instance = new PHPExcel_Calculation(); + } + + return self::$_instance; + } // function getInstance() + + + /** + * __clone implementation. Cloning should not be allowed in a Singleton! + * + * @access public + * @throws Exception + */ + public final function __clone() { + throw new Exception ( 'Cloning a Singleton is not allowed!' ); + } // function __clone() + + + /** + * Set the Array Return Type (Array or Value of first element in the array) + * + * @access public + * @param string $returnType Array return type + * @return boolean Success or failure + */ + public static function setArrayReturnType($returnType) { + if (($returnType == self::RETURN_ARRAY_AS_VALUE) || + ($returnType == self::RETURN_ARRAY_AS_ARRAY)) { + self::$returnArrayAsType = $returnType; + return True; + } + return False; + } // function setExcelCalendar() + + + /** + * Return the Array Return Type (Array or Value of first element in the array) + * + * @access public + * @return string $returnType Array return type + */ + public static function getArrayReturnType() { + return self::$returnArrayAsType; + } // function getExcelCalendar() + + + /** + * Is calculation caching enabled? + * + * @access public + * @return boolean + */ + public function getCalculationCacheEnabled() { + return $this->_calculationCacheEnabled; + } // function getCalculationCacheEnabled() + + + /** + * Enable/disable calculation cache + * + * @access public + * @param boolean $pValue + */ + public function setCalculationCacheEnabled($pValue = true) { + $this->_calculationCacheEnabled = $pValue; + $this->clearCalculationCache(); + } // function setCalculationCacheEnabled() + + + /** + * Enable calculation cache + */ + public function enableCalculationCache() { + $this->setCalculationCacheEnabled(true); + } // function enableCalculationCache() + + + /** + * Disable calculation cache + */ + public function disableCalculationCache() { + $this->setCalculationCacheEnabled(false); + } // function disableCalculationCache() + + + /** + * Clear calculation cache + */ + public function clearCalculationCache() { + $this->_calculationCache = array(); + } // function clearCalculationCache() + + + /** + * Get calculation cache expiration time + * + * @return float + */ + public function getCalculationCacheExpirationTime() { + return $this->_calculationCacheExpirationTime; + } // getCalculationCacheExpirationTime() + + + /** + * Set calculation cache expiration time + * + * @param float $pValue + */ + public function setCalculationCacheExpirationTime($pValue = 0.01) { + $this->_calculationCacheExpirationTime = $pValue; + } // function setCalculationCacheExpirationTime() + + + + + /** + * Wrap string values in quotes + * + * @param mixed $value + * @return mixed + */ + public static function _wrapResult($value) { + if (is_string($value)) { + // Error values cannot be "wrapped" + if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) { + // Return Excel errors "as is" + return $value; + } + // Return strings wrapped in quotes + return '"'.$value.'"'; + // Convert numeric errors to NaN error + } else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { + return PHPExcel_Calculation_Functions::NaN(); + } + + return $value; + } // function _wrapResult() + + + /** + * Remove quotes used as a wrapper to identify string values + * + * @param mixed $value + * @return mixed + */ + public static function _unwrapResult($value) { + if (is_string($value)) { + if ((strlen($value) > 0) && ($value{0} == '"') && (substr($value,-1) == '"')) { + return substr($value,1,-1); + } + // Convert numeric errors to NaN error + } else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { + return PHPExcel_Calculation_Functions::NaN(); + } + return $value; + } // function _unwrapResult() + + + + + /** + * Calculate cell value (using formula from a cell ID) + * Retained for backward compatibility + * + * @access public + * @param PHPExcel_Cell $pCell Cell to calculate + * @return mixed + * @throws Exception + */ + public function calculate(PHPExcel_Cell $pCell = null) { + return $this->calculateCellValue($pCell); + } // function calculate() + + + /** + * Calculate the value of a cell formula + * + * @access public + * @param PHPExcel_Cell $pCell Cell to calculate + * @param Boolean $resetLog Flag indicating whether the debug log should be reset or not + * @return mixed + * @throws Exception + */ + public function calculateCellValue(PHPExcel_Cell $pCell = null, $resetLog = true) { + if ($resetLog) { + // Initialise the logging settings if requested + $this->formulaError = null; + $this->debugLog = array(); + $this->debugLogStack = array(); + } + + // Read the formula from the cell + if (is_null($pCell)) { + return null; + } + $formula = $pCell->getValue(); + $cellID = $pCell->getCoordinate(); + + // Execute the calculation for the cell formula + return self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); + } // function calculateCellValue( + + + /** + * Validate and parse a formula string + * + * @param string $formula Formula to parse + * @return array + * @throws Exception + */ + public function parseFormula($formula) { + // Basic validation that this is indeed a formula + // We return an empty array if not + $formula = trim($formula); + if ($formula{0} != '=') return array(); + $formula = trim(substr($formula,1)); + $formulaLength = strlen($formula); + if ($formulaLength < 1) return array(); + + // Parse the formula and return the token stack + return $this->_parseFormula($formula); + } // function parseFormula() + + + /** + * Calculate the value of a formula + * + * @param string $formula Formula to parse + * @return mixed + * @throws Exception + */ + public function calculateFormula($formula, $cellID=null, PHPExcel_Cell $pCell = null) { + // Initialise the logging settings + $this->formulaError = null; + $this->debugLog = array(); + $this->debugLogStack = array(); + + // Disable calculation cacheing because it only applies to cell calculations, not straight formulae + // But don't actually flush any cache + $resetCache = $this->getCalculationCacheEnabled(); + $this->_calculationCacheEnabled = false; + // Execute the calculation + $result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); + // Reset calculation cacheing to its previous state + $this->_calculationCacheEnabled = $resetCache; + + return $result; + } // function calculateFormula() + + + /** + * Parse a cell formula and calculate its value + * + * @param string $formula The formula to parse and calculate + * @param string $cellID The ID (e.g. A3) of the cell that we are calculating + * @param PHPExcel_Cell $pCell Cell to calculate + * @return mixed + * @throws Exception + */ + public function _calculateFormulaValue($formula, $cellID=null, PHPExcel_Cell $pCell = null) { +// echo ''.$cellID.'
    '; + $cellValue = ''; + + // Basic validation that this is indeed a formula + // We simply return the "cell value" (formula) if not + $formula = trim($formula); + if ($formula{0} != '=') return self::_wrapResult($formula); + $formula = trim(substr($formula,1)); + $formulaLength = strlen($formula); + if ($formulaLength < 1) return self::_wrapResult($formula); + + // Is calculation cacheing enabled? + if (!is_null($cellID)) { + if ($this->_calculationCacheEnabled) { + // Is the value present in calculation cache? +// echo 'Testing cache value
    '; + if (isset($this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()])) { +// echo 'Value is in cache
    '; + $this->_writeDebug($cellID,'Testing cache value'); + // Is cache still valid? + if ((time() + microtime()) - $this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()]['time'] < $this->_calculationCacheExpirationTime) { +// echo 'Cache time is still valid
    '; + $this->_writeDebug($cellID,'Retrieving value from cache'); + // Return the cached result + $returnValue = $this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()]['data']; +// echo 'Retrieving data value of '.$returnValue.' for '.$pCell->getCoordinate().' from cache
    '; + if (is_array($returnValue)) { + return array_shift(PHPExcel_Calculation_Functions::flattenArray($returnValue)); + } + return $returnValue; + } else { +// echo 'Cache has expired
    '; + $this->_writeDebug($cellID,'Cache value has expired'); + // Clear the cache if it's no longer valid + unset($this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()]); + } + } + } + } + + $this->debugLogStack[] = $cellID; + // Parse the formula onto the token stack and calculate the value + $cellValue = $this->_processTokenStack($this->_parseFormula($formula), $cellID, $pCell); + array_pop($this->debugLogStack); + + // Save to calculation cache + if (!is_null($cellID)) { + if ($this->_calculationCacheEnabled) { + $this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()]['time'] = (time() + microtime()); + $this->_calculationCache[$pCell->getParent()->getTitle()][$pCell->getCoordinate()]['data'] = $cellValue; + } + } + + // Return the calculated value + if (is_array($cellValue)) { + $cellValue = array_shift(PHPExcel_Calculation_Functions::flattenArray($cellValue)); + } + + return $cellValue; + } // function _calculateFormulaValue() + + + /** + * Ensure that paired matrix operands are both matrices and of the same size + * + * @param mixed $operand1 First matrix operand + * @param mixed $operand2 Second matrix operand + */ + private static function _checkMatrixOperands(&$operand1,&$operand2,$resize = 1) { + // Examine each of the two operands, and turn them into an array if they aren't one already + // Note that this function should only be called if one or both of the operand is already an array + if (!is_array($operand1)) { + list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand2); + $operand1 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand1)); + $resize = 0; + } elseif (!is_array($operand2)) { + list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand1); + $operand2 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand2)); + $resize = 0; + } + + // Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger + if ($resize == 2) { + self::_resizeMatricesExtend($operand1,$operand2); + } elseif ($resize == 1) { + self::_resizeMatricesShrink($operand1,$operand2); + } + } // function _checkMatrixOperands() + + + /** + * Re-index a matrix with straight numeric keys starting from row 0, column 0 + * + * @param mixed $matrix matrix operand + * @return array The re-indexed matrix + */ + private static function _reindexMatrixDimensions($matrix) { + foreach($matrix as $rowKey => $rowValue) { + $matrix[$rowKey] = array_values($rowValue); + } + return array_values($matrix); + } // function _getMatrixDimensions() + + + /** + * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0 + * + * @param mixed $matrix matrix operand + * @return array An array comprising the number of rows, and number of columns + */ + private static function _getMatrixDimensions(&$matrix) { + $matrixRows = count($matrix); + $matrixColumns = 0; + foreach($matrix as $rowKey => $rowValue) { + $colCount = count($rowValue); + if ($colCount > $matrixColumns) { + $matrixColumns = $colCount; + } + $matrix[$rowKey] = array_values($rowValue); + } + $matrix = array_values($matrix); + return array($matrixRows,$matrixColumns); + } // function _getMatrixDimensions() + + + /** + * Ensure that paired matrix operands are both matrices of the same size + * + * @param mixed $matrix1 First matrix operand + * @param mixed $matrix2 Second matrix operand + */ + private static function _resizeMatricesShrink(&$matrix1,&$matrix2) { + list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($matrix1); + list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($matrix2); + + if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { + if ($matrix2Columns < $matrix1Columns) { + for ($i = 0; $i < $matrix1Rows; ++$i) { + for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { + unset($matrix1[$i][$j]); + } + } + } + if ($matrix2Rows < $matrix1Rows) { + for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) { + unset($matrix1[$i]); + } + } + } + + if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { + if ($matrix1Columns < $matrix2Columns) { + for ($i = 0; $i < $matrix2Rows; ++$i) { + for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { + unset($matrix2[$i][$j]); + } + } + } + if ($matrix1Rows < $matrix2Rows) { + for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) { + unset($matrix2[$i]); + } + } + } + } // function _resizeMatricesShrink() + + + /** + * Ensure that paired matrix operands are both matrices of the same size + * + * @param mixed $matrix1 First matrix operand + * @param mixed $matrix2 Second matrix operand + */ + private static function _resizeMatricesExtend(&$matrix1,&$matrix2) { + list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($matrix1); + list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($matrix2); + + if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { + if ($matrix2Columns < $matrix1Columns) { + for ($i = 0; $i < $matrix2Rows; ++$i) { + $x = $matrix2[$i][$matrix2Columns-1]; + for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { + $matrix2[$i][$j] = $x; + } + } + } + if ($matrix2Rows < $matrix1Rows) { + $x = $matrix2[$matrix2Rows-1]; + for ($i = 0; $i < $matrix1Rows; ++$i) { + $matrix2[$i] = $x; + } + } + } + + if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { + if ($matrix1Columns < $matrix2Columns) { + for ($i = 0; $i < $matrix1Rows; ++$i) { + $x = $matrix1[$i][$matrix1Columns-1]; + for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { + $matrix1[$i][$j] = $x; + } + } + } + if ($matrix1Rows < $matrix2Rows) { + $x = $matrix1[$matrix1Rows-1]; + for ($i = 0; $i < $matrix2Rows; ++$i) { + $matrix1[$i] = $x; + } + } + } + } // function _resizeMatricesExtend() + + + /** + * Format details of an operand for display in the log (based on operand type) + * + * @param mixed $value First matrix operand + * @return mixed + */ + private static function _showValue($value) { + if (is_array($value)) { + $retVal = ''; + $i = 0; + foreach($value as $row) { + if (is_array($row)) { + if ($i > 0) { $retVal .= '; '; } + $j = 0; + foreach($row as $column) { + if ($j > 0) { $retVal .= ', '; } + $retVal .= $column; + ++$j; + } + } else { + if ($i > 0) { $retVal .= ', '; } + $retVal .= $row; + } + ++$i; + } + return '{ '.$retVal.' }'; + } elseif(is_bool($value)) { + return ($value) ? 'TRUE' : 'FALSE'; + } + + return $value; + } // function _showValue() + + + /** + * Format type and details of an operand for display in the log (based on operand type) + * + * @param mixed $value First matrix operand + * @return mixed + */ + private static function _showTypeDetails($value) { + switch (gettype($value)) { + case 'double' : + case 'float' : + $typeString = 'a floating point number'; + break; + case 'integer' : + $typeString = 'an integer number'; + break; + case 'boolean' : + $typeString = 'a boolean'; + break; + case 'array' : + $typeString = 'a matrix'; + break; + case 'string' : + if ($value == '') { + return 'an empty string'; + } elseif ($value{0} == '#') { + return 'a '.$value.' error'; + } else { + $typeString = 'a string'; + } + break; + case 'NULL' : + return 'a null value'; + } + return $typeString.' with a value of '.self::_showValue($value); + } // function _showTypeDetails() + + + private static function _convertMatrixReferences($formula) { + static $matrixReplaceFrom = array('{',';','}'); + static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(','),MKMATRIX(','))'); + + // Convert any Excel matrix references to the MKMATRIX() function + if (strpos($formula,'{') !== false) { + // Open and Closed counts used for trapping mismatched braces in the formula + $openCount = $closeCount = 0; + // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators + if (strpos($formula,'"') !== false) { + // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded + // the formula + $temp = explode('"',$formula); + $i = 0; + foreach($temp as &$value) { + // Only count/replace in alternate array entries + if (($i++ % 2) == 0) { + $openCount += substr_count($value,'{'); + $closeCount += substr_count($value,'}'); + $value = str_replace($matrixReplaceFrom,$matrixReplaceTo,$value); + } + } + unset($value); + // Then rebuild the formula string + $formula = implode('"',$temp); + } else { + // If there's no quoted strings, then we do a simple count/replace + $openCount += substr_count($formula,'{'); + $closeCount += substr_count($formula,'}'); + $formula = str_replace($matrixReplaceFrom,$matrixReplaceTo,$formula); + } + // Trap for mismatched braces and trigger an appropriate error + if ($openCount < $closeCount) { + if ($openCount > 0) { + return $this->_raiseFormulaError("Formula Error: Mismatched matrix braces '}'"); + } else { + return $this->_raiseFormulaError("Formula Error: Unexpected '}' encountered"); + } + } elseif ($openCount > $closeCount) { + if ($closeCount > 0) { + return $this->_raiseFormulaError("Formula Error: Mismatched matrix braces '{'"); + } else { + return $this->_raiseFormulaError("Formula Error: Unexpected '{' encountered"); + } + } + } + + return $formula; + } // function _convertMatrixReferences() + + + private static function _mkMatrix() { + return func_get_args(); + } // function _mkMatrix() + + + // Convert infix to postfix notation + private function _parseFormula($formula) { + if (($formula = self::_convertMatrixReferences(trim($formula))) === false) { + return false; + } + + // Binary Operators + // These operators always work on two values + // Array key is the operator, the value indicates whether this is a left or right associative operator + $operatorAssociativity = array('^' => 0, // Exponentiation + '*' => 0, '/' => 0, // Multiplication and Division + '+' => 0, '-' => 0, // Addition and Subtraction + '&' => 1, // Concatenation + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison + ); + // Comparison (Boolean) Operators + // These operators work on two values, but always return a boolean result + $comparisonOperators = array('>', '<', '=', '>=', '<=', '<>'); + + // Operator Precedence + // This list includes all valid operators, whether binary (including boolean) or unary (such as %) + // Array key is the operator, the value is its precedence + $operatorPrecedence = array('_' => 6, // Negation + '%' => 5, // Percentage + '^' => 4, // Exponentiation + '*' => 3, '/' => 3, // Multiplication and Division + '+' => 2, '-' => 2, // Addition and Subtraction + '&' => 1, // Concatenation + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison + ); + + $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. + '|'.self::CALCULATION_REGEXP_NUMBER. + '|'.self::CALCULATION_REGEXP_STRING. + '|'.self::CALCULATION_REGEXP_OPENBRACE. + '|'.self::CALCULATION_REGEXP_CELLREF. + '|'.self::CALCULATION_REGEXP_NAMEDRANGE. + ')/i'; + + // Start with initialisation + $index = 0; + $stack = new PHPExcel_Token_Stack; + $output = array(); + $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a + // - is a negation or + is a positive operator rather than an operation + $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand + // should be null in a function call + // The guts of the lexical parser + // Loop through the formula extracting each operator and operand in turn + while(True) { +// echo 'Assessing Expression '.substr($formula, $index).'
    '; + $opCharacter = $formula{$index}; // Get the first character of the value at the current index position +// echo 'Initial character of expression block is '.$opCharacter.'
    '; + if ((in_array($opCharacter, $comparisonOperators)) && (strlen($formula) > $index) && (in_array($formula{$index+1}, $comparisonOperators))) { + $opCharacter .= $formula{++$index}; +// echo 'Initial character of expression block is comparison operator '.$opCharacter.'
    '; + } + + // Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand + $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match); +// echo '$isOperandOrFunction is '.(($isOperandOrFunction)?'True':'False').'
    '; + + if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? +// echo 'Element is a Negation operator
    '; + $stack->push('_'); // Put a negation on the stack + ++$index; // and drop the negation symbol + } elseif ($opCharacter == '%' && $expectingOperator) { +// echo 'Element is a Percentage operator
    '; + $stack->push('%'); // Put a percentage on the stack + ++$index; + } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (rather than plus) can be discarded? +// echo 'Element is a Positive number, not Plus operator
    '; + ++$index; // Drop the redundant plus symbol + } elseif (($opCharacter == '_') && (!$isOperandOrFunction)) { // We have to explicitly deny an underscore, because it's legal on + return $this->_raiseFormulaError("Formula Error: Illegal character '_'"); // the stack but not in the input expression + // Note that _ is a valid first character in named ranges + // and this will need modifying soon when we start integrating + // with PHPExcel proper + + } elseif ((in_array($opCharacter, $this->_operators) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? +// echo 'Element with value '.$opCharacter.' is an Operator
    '; + while($stack->count() > 0 && + ($o2 = $stack->last()) && + in_array($o2, $this->_operators) && + ($operatorAssociativity[$opCharacter] ? $operatorPrecedence[$opCharacter] < $operatorPrecedence[$o2] : $operatorPrecedence[$opCharacter] <= $operatorPrecedence[$o2])) { + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output + } + $stack->push($opCharacter); // Finally put our current operator onto the stack + ++$index; + $expectingOperator = false; + + } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? +// echo 'Element is a Closing bracket
    '; + $expectingOperand = false; + while (($o2 = $stack->pop()) != '(') { // Pop off the stack back to the last ( + if (is_null($o2)) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"'); + else $output[] = $o2; + } + if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $stack->last(2), $matches)) { // Did this parenthesis just close a function? + $functionName = $matches[1]; // Get the function name +// echo 'Closed Function is '.$functionName.'
    '; + $argumentCount = $stack->pop(); // See how many arguments there were (argument count is the next value stored on the stack) +// if ($argumentCount == 0) { +// echo 'With no arguments
    '; +// } elseif ($argumentCount == 1) { +// echo 'With 1 argument
    '; +// } else { +// echo 'With '.$argumentCount.' arguments
    '; +// } + $output[] = $argumentCount; // Dump the argument count on the output + $output[] = $stack->pop(); // Pop the function and push onto the output + if (array_key_exists($functionName, $this->_controlFunctions)) { +// echo 'Built-in function '.$functionName.'
    '; + $expectedArgumentCount = $this->_controlFunctions[$functionName]['argumentCount']; + $functionCall = $this->_controlFunctions[$functionName]['functionCall']; + } elseif (array_key_exists($functionName, $this->_PHPExcelFunctions)) { +// echo 'PHPExcel function '.$functionName.'
    '; + $expectedArgumentCount = $this->_PHPExcelFunctions[$functionName]['argumentCount']; + $functionCall = $this->_PHPExcelFunctions[$functionName]['functionCall']; + } else { // did we somehow push a non-function on the stack? this should never happen + return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack"); + } + // Check the argument count + $argumentCountError = False; + if (is_numeric($expectedArgumentCount)) { + if ($expectedArgumentCount < 0) { +// echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount).'
    '; + if ($argumentCount > abs($expectedArgumentCount)) { + $argumentCountError = True; + $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); + } + } else { +// echo '$expectedArgumentCount is numeric '.$expectedArgumentCount.'
    '; + if ($argumentCount != $expectedArgumentCount) { + $argumentCountError = True; + $expectedArgumentCountString = $expectedArgumentCount; + } + } + } elseif ($expectedArgumentCount != '*') { + $isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch); +// print_r($argMatch); +// echo '
    '; + switch ($argMatch[2]) { + case '+' : + if ($argumentCount < $argMatch[1]) { + $argumentCountError = True; + $expectedArgumentCountString = $argMatch[1].' or more '; + } + break; + case '-' : + if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { + $argumentCountError = True; + $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; + } + break; + case ',' : + if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { + $argumentCountError = True; + $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; + } + break; + } + } + if ($argumentCountError) { + return $this->_raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected"); + } + } + ++$index; + + } elseif ($opCharacter == ',') { // Is this the comma separator for function arguments? +// echo 'Element is a Function argument separator
    '; + while (($o2 = $stack->pop()) != '(') { + if (is_null($o2)) return $this->_raiseFormulaError("Formula Error: Unexpected ','"); + else $output[] = $o2; // pop the argument expression stuff and push onto the output + } + // If we've a comma when we're expecting an operand, then what we actually have is a null operand; + // so push a null onto the stack + if (($expectingOperand) || (!$expectingOperator)) { + $output[] = $this->_ExcelConstants['NULL']; + } + // make sure there was a function + if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $stack->last(2), $matches)) + return $this->_raiseFormulaError("Formula Error: Unexpected ','"); + $stack->push($stack->pop()+1); // increment the argument count + $stack->push('('); // put the ( back on, we'll need to pop back to it again + $expectingOperator = false; + $expectingOperand = true; + ++$index; + + } elseif ($opCharacter == '(' && !$expectingOperator) { +// echo 'Element is an Opening Bracket
    '; + $stack->push('('); + ++$index; + + } elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number? + $expectingOperator = true; + $expectingOperand = false; + $val = $match[1]; + $length = strlen($val); +// echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function
    '; + + if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { + $val = preg_replace('/\s/','',$val); +// echo 'Element '.$val.' is a Function
    '; + if (array_key_exists(strtoupper($matches[1]), $this->_controlFunctions) || array_key_exists(strtoupper($matches[1]), $this->_PHPExcelFunctions)) { // it's a func + $stack->push(strtoupper($val)); + $ax = preg_match('/^\s*(\s*\))/i', substr($formula, $index+$length), $amatch); + if ($ax) { + $stack->push(0); + $expectingOperator = true; + } else { + $stack->push(1); + $expectingOperator = false; + } + $stack->push('('); + } else { // it's a var w/ implicit multiplication + $val = $matches[1]; + $output[] = $val; + } + } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { +// echo 'Element '.$val.' is a Cell reference
    '; +// Watch for this case-change when modifying to allow cell references in different worksheets... +// Should only be applied to the actual cell column, not the worksheet name +// $cellRef = strtoupper($val); +// $output[] = $cellRef; + $output[] = $val; +// $expectingOperator = false; + } else { // it's a variable, constant, string, number or boolean +// echo 'Element is a Variable, Constant, String, Number or Boolean
    '; + if ($opCharacter == '"') { +// echo 'Element is a String
    '; + $val = str_replace('""','"',$val); + } elseif (is_numeric($val)) { +// echo 'Element is a Number
    '; + if ((strpos($val,'.') !== False) || (stripos($val,'e') !== False)) { +// echo 'Casting '.$val.' to float
    '; + $val = (float) $val; + } else { +// echo 'Casting '.$val.' to integer
    '; + $val = (integer) $val; + } +// } elseif (array_key_exists(trim(strtoupper($val)), $this->_ExcelConstants)) { +// $excelConstant = trim(strtoupper($val)); +// echo 'Element '.$val.' is an Excel Constant
    '; +// $val = $this->_ExcelConstants[$excelConstant]; + } + $output[] = $val; + } + $index += $length; + + } elseif ($opCharacter == ')') { // miscellaneous error checking + if ($expectingOperand) { + $output[] = $this->_ExcelConstants['NULL']; + $expectingOperand = false; + $expectingOperator = True; + } else { + return $this->_raiseFormulaError("Formula Error: Unexpected ')'"); + } + } elseif (in_array($opCharacter, $this->_operators) && !$expectingOperator) { + return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'"); + } else { // I don't even want to know what you did to get here + return $this->_raiseFormulaError("Formula Error: An unexpected error occured"); + } + // Test for end of formula string + if ($index == strlen($formula)) { + // Did we end with an operator?. + // Only valid for the % unary operator + if ((in_array($opCharacter, $this->_operators)) && ($opCharacter != '%')) { + return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands"); + } else { + break; + } + } + // Ignore white space + while (substr($formula, $index, 1) == ' ') { + ++$index; + } + } + + while (!is_null($opCharacter = $stack->pop())) { // pop everything off the stack and push onto output + if ($opCharacter == '(') return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced + $output[] = $opCharacter; + } + return $output; + } // function _parseFormula() + + + // evaluate postfix notation + private function _processTokenStack($tokens, $cellID=null, PHPExcel_Cell $pCell = null) { + if ($tokens == false) return false; + + $stack = new PHPExcel_Token_Stack; + + // Loop through each token in turn + foreach ($tokens as $token) { +// echo 'Token is '.$token.'
    '; + // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack + if (in_array($token, $this->_binaryOperators, true)) { +// echo 'Token is a binary operator
    '; + // We must have two operands, error if we don't + if (is_null($operand2 = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack'); + if (is_null($operand1 = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack'); + // Log what we're doing + $this->_writeDebug($cellID,'Evaluating '.self::_showValue($operand1).' '.$token.' '.self::_showValue($operand2)); + // Process the operation in the appropriate manner + switch ($token) { + // Comparison (Boolean) Operators + case '>' : // Greater than + case '<' : // Less than + case '>=' : // Greater than or Equal to + case '<=' : // Less than or Equal to + case '=' : // Equality + case '<>' : // Inequality + $this->_executeBinaryComparisonOperation($cellID,$operand1,$operand2,$token,$stack); + break; + // Binary Operators + case '+' : // Addition + $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'plusEquals',$stack); + break; + case '-' : // Subtraction + $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'minusEquals',$stack); + break; + case '*' : // Multiplication + $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayTimesEquals',$stack); + break; + case '/' : // Division + $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayRightDivide',$stack); + break; + case '^' : // Exponential + $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'power',$stack); + break; + case '&' : // Concatenation + // If either of the operands is a matrix, we need to treat them both as matrices + // (converting the other operand to a matrix if need be); then perform the required + // matrix operation + if ((is_array($operand1)) || (is_array($operand2))) { + // Ensure that both operands are arrays/matrices + self::_checkMatrixOperands($operand1,$operand2); + try { + // Convert operand 1 from a PHP array to a matrix + $matrix = new Matrix($operand1); + // Perform the required operation against the operand 1 matrix, passing in operand 2 + $matrixResult = $matrix->concat($operand2); + $result = $matrixResult->getArray(); + } catch (Exception $ex) { + $this->_writeDebug($cellID,'JAMA Matrix Exception: '.$ex->getMessage()); + $result = '#VALUE!'; + } + } else { + $result = '"'.str_replace('""','"',self::_unwrapResult($operand1,'"').self::_unwrapResult($operand2,'"')).'"'; + } + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($result)); + $stack->push($result); + break; + } + + // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on + } elseif (($token === "_") || ($token === "%")) { +// echo 'Token is a unary operator
    '; + if (is_null($arg = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack'); + if ($token === "_") { +// echo 'Token is a negation operator
    '; + $this->_writeDebug($cellID,'Evaluating Negation of '.self::_showValue($arg)); + $multiplier = -1; + } else { +// echo 'Token is a percentile operator
    '; + $this->_writeDebug($cellID,'Evaluating Percentile of '.self::_showValue($arg)); + $multiplier = 0.01; + } + if (is_array($arg)) { + self::_checkMatrixOperands($arg,$multiplier); + try { + $matrix1 = new Matrix($arg); + $matrixResult = $matrix1->arrayTimesEquals($multiplier); + $result = $matrixResult->getArray(); + } catch (Exception $ex) { + $this->_writeDebug($cellID,'JAMA Matrix Exception: '.$ex->getMessage()); + $result = '#VALUE!'; + } + + } else { + $result = $multiplier * $arg; + } + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($result)); + $stack->push($result); + + } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { +// echo 'Element '.$token.' is a Cell reference
    '; + if (isset($matches[8])) { +// echo 'Reference is a Range of cells
    '; + if (is_null($pCell)) { +// We can't access the range, so return a REF error + $cellValue = PHPExcel_Calculation_Functions::REF(); + } else { + $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; + if ($matches[2] > '') { +// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
    '; + $this->_writeDebug($cellID,'Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]); + $cellValue = $this->extractCellRange($cellRef, $pCell->getParent()->getParent()->getSheetByName($matches[2]), false); + $this->_writeDebug($cellID,'Evaluation Result for cells '.$cellRef.' in worksheet '.$matches[2].' is '.self::_showTypeDetails($cellValue)); + } else { +// echo '$cellRef='.$cellRef.' in current worksheet
    '; + $this->_writeDebug($cellID,'Evaluating Cell Range '.$cellRef.' in current worksheet'); + $cellValue = $this->extractCellRange($cellRef, $pCell->getParent(), false); + $this->_writeDebug($cellID,'Evaluation Result for cells '.$cellRef.' is '.self::_showTypeDetails($cellValue)); + } + } + } else { +// echo 'Reference is a single Cell
    '; + if (is_null($pCell)) { +// We can't access the cell, so return a REF error + $cellValue = PHPExcel_Calculation_Functions::REF(); + } else { + $cellRef = $matches[6].$matches[7]; + if ($matches[2] > '') { +// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
    '; + $this->_writeDebug($cellID,'Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]); + if ($pCell->getParent()->cellExists($cellRef)) { + $cellValue = $this->extractCellRange($cellRef, $pCell->getParent()->getParent()->getSheetByName($matches[2]), false); + } else { + $cellValue = null; + } + $this->_writeDebug($cellID,'Evaluation Result for cell '.$cellRef.' in worksheet '.$matches[2].' is '.self::_showTypeDetails($cellValue)); + } else { +// echo '$cellRef='.$cellRef.' in current worksheet
    '; + $this->_writeDebug($cellID,'Evaluating Cell '.$cellRef.' in current worksheet'); + if ($pCell->getParent()->cellExists($cellRef)) { + $cellValue = $pCell->getParent()->getCell($cellRef)->getCalculatedValue(false); + } else { + $cellValue = ''; + } + $this->_writeDebug($cellID,'Evaluation Result for cell '.$cellRef.' is '.self::_showTypeDetails($cellValue)); + } + } + } + $stack->push($cellValue); + + // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on + } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) { +// echo 'Token is a function
    '; + $functionName = $matches[1]; + $argCount = $stack->pop(); + if ($functionName != 'MKMATRIX') { + $this->_writeDebug($cellID,'Evaluating Function '.$functionName.'() with '.(($argCount == 0) ? 'no' : $argCount).' argument'.(($argCount == 1) ? '' : 's')); + } + if ((array_key_exists($functionName, $this->_controlFunctions)) || (array_key_exists($functionName, $this->_PHPExcelFunctions))) { // function + if (array_key_exists($functionName, $this->_controlFunctions)) { + $functionCall = $this->_controlFunctions[$functionName]['functionCall']; + } elseif (array_key_exists($functionName, $this->_PHPExcelFunctions)) { + $functionCall = $this->_PHPExcelFunctions[$functionName]['functionCall']; + } + // get the arguments for this function +// echo 'Function '.$functionName.' expects '.$argCount.' arguments
    '; + $args = array(); + for ($i = $argCount; $i > 0; --$i) { + $arg = $stack->pop(); +// if (is_null($arg)) return $this->_raiseFormulaError("internal error"); + $args[$i] = $arg; + } + // Reverse the order of the arguments + ksort($args); +// echo 'Arguments are: '; +// print_r($args); +// echo '
    '; + if ($functionName != 'MKMATRIX') { + $argArrayVals = array(); + foreach($args as &$arg) { + $argArrayVals[] = self::_showValue($arg); + $arg = self::_unwrapResult($arg); + } + unset($arg); + $this->_writeDebug($cellID,'Evaluating '. $functionName.'( '.implode(', ',$argArrayVals).' )'); + } + // Process each argument in turn, building the return value as an array +// if (($argCount == 1) && (is_array($args[1])) && ($functionName != 'MKMATRIX')) { +// $operand1 = $args[1]; +// $this->_writeDebug($cellID,'Argument is a matrix: '.self::_showValue($operand1)); +// $result = array(); +// $row = 0; +// foreach($operand1 as $args) { +// if (is_array($args)) { +// foreach($args as $arg) { +// $this->_writeDebug($cellID,'Evaluating '. $functionName.'( '.self::_showValue($arg).' )'); +// $r = call_user_func_array($functionCall,$arg); +// $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($r)); +// $result[$row][] = $r; +// } +// ++$row; +// } else { +// $this->_writeDebug($cellID,'Evaluating '. $functionName.'( '.self::_showValue($args).' )'); +// $r = call_user_func_array($functionCall,$args); +// $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($r)); +// $result[] = $r; +// } +// } +// } else { + // Process the argument with the appropriate function call + $result = call_user_func_array($functionCall,$args); +// } + if ($functionName != 'MKMATRIX') { + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($result)); + } + $stack->push(self::_wrapResult($result)); + } + + } else { + // if the token is a number, boolean, string or an Excel error, push it onto the stack + if (array_key_exists(strtoupper($token), $this->_ExcelConstants)) { + $excelConstant = strtoupper($token); +// echo 'Token is a PHPExcel constant: '.$excelConstant.'
    '; + $stack->push($this->_ExcelConstants[$excelConstant]); + $this->_writeDebug($cellID,'Evaluating Constant '.$excelConstant.' as '.self::_showTypeDetails($this->_ExcelConstants[$excelConstant])); + } elseif ((is_null($token)) || ($token == '') || (is_bool($token)) || (is_numeric($token)) || ($token{0} == '"') || ($token{0} == '#')) { +// echo 'Token is a number, boolean, string or an Excel error
    '; + $stack->push($token); + // if the token is a constant, push the constant value on the stack + } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) { +// echo 'Token is a named range
    '; + $namedRange = $matches[6]; +// echo 'Named Range is '.$namedRange.'
    '; + $this->_writeDebug($cellID,'Evaluating Named Range '.$namedRange); + $cellValue = $this->extractNamedRange($namedRange, $pCell->getParent(), false); + $this->_writeDebug($cellID,'Evaluation Result for named range '.$namedRange.' is '.self::_showTypeDetails($cellValue)); + $stack->push($cellValue); + } else { + return $this->_raiseFormulaError("undefined variable '$token'"); + } + } + } + // when we're out of tokens, the stack should have a single element, the final result + if ($stack->count() != 1) return $this->_raiseFormulaError("internal error"); + $output = $stack->pop(); + if ((is_array($output)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { + return array_unshift(array_unshift($output)); + } + return $output; + } // function _processTokenStack() + + + private function _validateBinaryOperand($cellID,&$operand,&$stack) { + // Numbers, matrices and booleans can pass straight through, as they're already valid + if (is_string($operand)) { + // We only need special validations for the operand if it is a string + // Start by stripping off the quotation marks we use to identify true excel string values internally + if ($operand > '' && $operand{0} == '"') { $operand = self::_unwrapResult($operand,'"'); } + // If the string is a numeric value, we treat it as a numeric, so no further testing + if (!is_numeric($operand)) { + // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations + if ($operand > '' && $operand{0} == '#') { + $stack->push($operand); + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($operand)); + return false; + } else { + // If not a numeric, then it's a text string, and so can't be used in mathematical binary operations + $stack->push('#VALUE!'); + $this->_writeDebug($cellID,'Evaluation Result is a '.self::_showTypeDetails('#VALUE!')); + return false; + } + } + } + + // return a true if the value of the operand is one that we can use in normal binary operations + return true; + } // function _validateBinaryOperand() + + + private function _executeBinaryComparisonOperation($cellID,$operand1,$operand2,$operation,&$stack) { + // Validate the two operands + + // If we're dealing with non-matrix operations, execute the necessary operation + switch ($operation) { + // Greater than + case '>': + $result = ($operand1 > $operand2); + break; + // Less than + case '<': + $result = ($operand1 < $operand2); + break; + // Equality + case '=': + $result = ($operand1 == $operand2); + break; + // Greater than or equal + case '>=': + $result = ($operand1 >= $operand2); + break; + // Less than or equal + case '<=': + $result = ($operand1 <= $operand2); + break; + // Inequality + case '<>': + $result = ($operand1 != $operand2); + break; + } + + // Log the result details + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($result)); + // And push the result onto the stack + $stack->push($result); + return true; + } // function _executeBinaryComparisonOperation() + + private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) { + // Validate the two operands + if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false; + if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return false; + + // If either of the operands is a matrix, we need to treat them both as matrices + // (converting the other operand to a matrix if need be); then perform the required + // matrix operation + if ((is_array($operand1)) || (is_array($operand2))) { + // Ensure that both operands are arrays/matrices + self::_checkMatrixOperands($operand1,$operand2); + try { + // Convert operand 1 from a PHP array to a matrix + $matrix = new Matrix($operand1); + // Perform the required operation against the operand 1 matrix, passing in operand 2 + $matrixResult = $matrix->$matrixFunction($operand2); + $result = $matrixResult->getArray(); + } catch (Exception $ex) { + $this->_writeDebug($cellID,'JAMA Matrix Exception: '.$ex->getMessage()); + $result = '#VALUE!'; + } + } else { + // If we're dealing with non-matrix operations, execute the necessary operation + switch ($operation) { + // Addition + case '+': + $result = $operand1+$operand2; + break; + // Subtraction + case '-': + $result = $operand1-$operand2; + break; + // Multiplication + case '*': + $result = $operand1*$operand2; + break; + // Division + case '/': + if ($operand2 == 0) { + // Trap for Divide by Zero error + $stack->push('#DIV/0!'); + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails('#DIV/0!')); + return false; + } else { + $result = $operand1/$operand2; + } + break; + // Power + case '^': + $result = pow($operand1,$operand2); + break; + } + } + + // Log the result details + $this->_writeDebug($cellID,'Evaluation Result is '.self::_showTypeDetails($result)); + // And push the result onto the stack + $stack->push($result); + return true; + } // function _executeNumericBinaryOperation() + + + private function _writeDebug($cellID,$message) { + // Only write the debug log if logging is enabled + if ($this->writeDebugLog) { +// $prefix = substr(implode(' -> ',$this->debugLogStack).' -> ',4+strlen($this->debugLogStack[0])); + $prefix = implode(' -> ',$this->debugLogStack).' -> '; + $this->debugLog[] = $prefix.$message; + } + } // function _writeDebug() + + + // trigger an error, but nicely, if need be + private function _raiseFormulaError($errorMessage) { + $this->formulaError = $errorMessage; + if (!$this->suppressFormulaErrors) throw new Exception($errorMessage); + trigger_error($errorMessage, E_USER_ERROR); + } // function _raiseFormulaError() + + + /** + * Extract range values + * + * @param string $pRange String based range representation + * @param PHPExcel_Worksheet $pSheet Worksheet + * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. + * @throws Exception + */ + public function extractCellRange($pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) { + // Return value + $returnValue = array ( ); + +// echo 'extractCellRange('.$pRange.')
    '; + // Worksheet given? + if (!is_null($pSheet)) { + // Worksheet reference? +// echo 'Current sheet name is '.$pSheet->getTitle().'
    '; +// echo 'Range reference is '.$pRange.'
    '; + if (strpos ($pRange, '!') !== false) { +// echo '$pRange reference includes sheet reference
    '; + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true); + $pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]); +// echo 'New sheet name is '.$pSheet->getTitle().'
    '; + $pRange = $worksheetReference[1]; +// echo 'Adjusted Range reference is '.$pRange.'
    '; + } + + // Extract range + $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + if (count($aReferences) == 1) { + return $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); + } + + // Extract cell data + foreach ($aReferences as $reference) { + // Extract range + list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference); + + $returnValue[$currentCol][$currentRow] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); + } + } + + // Return + return $returnValue; + } // function extractCellRange() + + + /** + * Extract range values + * + * @param string $pRange String based range representation + * @param PHPExcel_Worksheet $pSheet Worksheet + * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. + * @throws Exception + */ + public function extractNamedRange($pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) { + // Return value + $returnValue = array ( ); + +// echo 'extractNamedRange('.$pRange.')
    '; + // Worksheet given? + if (!is_null($pSheet)) { + // Worksheet reference? +// echo 'Current sheet name is '.$pSheet->getTitle().'
    '; +// echo 'Range reference is '.$pRange.'
    '; + if (strpos ($pRange, '!') !== false) { +// echo '$pRange reference includes sheet reference
    '; + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true); + $pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]); +// echo 'New sheet name is '.$pSheet->getTitle().'
    '; + $pRange = $worksheetReference[1]; +// echo 'Adjusted Range reference is '.$pRange.'
    '; + } + + // Named range? + $namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet); + if (!is_null($namedRange)) { +// echo 'Named Range '.$pRange.' ('; + $pRange = $namedRange->getRange(); +// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'
    '; + if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) { + if (!$namedRange->getLocalOnly()) { + $pSheet = $namedRange->getWorksheet(); + } else { + return $returnValue; + } + } + } + + // Extract range + $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + if (count($aReferences) == 1) { + return $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); + } + + // Extract cell data + foreach ($aReferences as $reference) { + // Extract range + list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference); +// echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'
    '; + $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); + } +// print_r($returnValue); +// echo '
    '; + $returnValue = array_values($returnValue); + foreach($returnValue as &$rr) { + $rr = array_values($rr); + } + unset($rr); +// print_r($returnValue); +// echo '
    '; + } + + // Return + return $returnValue; + } // function extractNamedRange() + + + /** + * Is a specific function implemented? + * + * @param string $pFunction Function Name + * @return boolean + */ + public function isImplemented($pFunction = '') { + $pFunction = strtoupper ($pFunction); + if (isset ($this->_PHPExcelFunctions[$pFunction])) { + return ($this->_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY'); + } else { + return false; + } + } // function isImplemented() + + + /** + * Get a list of all implemented functions as an array of function objects + * + * @return array of PHPExcel_Calculation_Function + */ + public function listFunctions() { + // Return value + $returnValue = array(); + // Loop functions + foreach($this->_PHPExcelFunctions as $functionName => $function) { + if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') { + $returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'], + $functionName, + $function['functionCall'] + ); + } + } + + // Return + return $returnValue; + } // function listFunctions() + + + /** + * Get a list of implemented Excel function names + * + * @return array + */ + public function listFunctionNames() { + // Return value + $returnValue = array(); + // Loop functions + foreach ($this->_PHPExcelFunctions as $functionName => $function) { + $returnValue[] = $functionName; + } + + // Return + return $returnValue; + } // function listFunctionNames() + +} // class PHPExcel_Calculation + + + + +// for internal use +class PHPExcel_Token_Stack { + + private $_stack = array(); + private $_count = 0; + + public function count() { + return $this->_count; + } + + public function push($value) { + $this->_stack[$this->_count++] = $value; + } + + public function pop() { + if ($this->_count > 0) { + return $this->_stack[--$this->_count]; + } + return null; + } + + public function last($n=1) { + if ($this->_count-$n < 0) { + return null; + } + return $this->_stack[$this->_count-$n]; + } + + function __construct() { + } + +} // class PHPExcel_Token_Stack diff --git a/libraries/PHPExcel/PHPExcel/Calculation/Exception.php b/libraries/PHPExcel/PHPExcel/Calculation/Exception.php new file mode 100644 index 000000000..36ea5e08a --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/Exception.php @@ -0,0 +1,52 @@ +line = $line; + $e->file = $file; + throw $e; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php b/libraries/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php new file mode 100644 index 000000000..734c4a611 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php @@ -0,0 +1,60 @@ +<"; + const OPERATORS_POSTFIX = "%"; + + /** + * Formula + * + * @var string + */ + private $_formula; + + /** + * Tokens + * + * @var PHPExcel_Calculation_FormulaToken[] + */ + private $_tokens = array(); + + /** + * Create a new PHPExcel_Calculation_FormulaParser + * + * @param string $pFormula Formula to parse + * @throws Exception + */ + public function __construct($pFormula = '') + { + // Check parameters + if (is_null($pFormula)) { + throw new Exception("Invalid parameter passed: formula"); + } + + // Initialise values + $this->_formula = trim($pFormula); + // Parse! + $this->_parseToTokens(); + } + + /** + * Get Formula + * + * @return string + */ + public function getFormula() { + return $this->_formula; + } + + /** + * Get Token + * + * @param int $pId Token id + * @return string + * @throws Exception + */ + public function getToken($pId = 0) { + if (isset($this->_tokens[$pId])) { + return $this->_tokens[$pId]; + } else { + throw new Exception("Token with id $pId does not exist."); + } + } + + /** + * Get Token count + * + * @return string + */ + public function getTokenCount() { + return count($this->_tokens); + } + + /** + * Get Tokens + * + * @return PHPExcel_Calculation_FormulaToken[] + */ + public function getTokens() { + return $this->_tokens; + } + + /** + * Parse to tokens + */ + private function _parseToTokens() { + // No attempt is made to verify formulas; assumes formulas are derived from Excel, where + // they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions. + + // Check if the formula has a valid starting = + $formulaLength = strlen($this->_formula); + if ($formulaLength < 2 || $this->_formula{0} != '=') return; + + // Helper variables + $tokens1 = $tokens2 = $stack = array(); + $inString = $inPath = $inRange = $inError = false; + $token = $previousToken = $nextToken = null; + + $index = 1; + $value = ''; + + $ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"); + $COMPARATORS_MULTI = array(">=", "<=", "<>"); + + while ($index < $formulaLength) { + // state-dependent character evaluation (order is important) + + // double-quoted strings + // embeds are doubled + // end marks token + if ($inString) { + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { + if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) { + $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE; + ++$index; + } else { + $inString = false; + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT); + $value = ""; + } + } else { + $value .= $this->_formula{$index}; + } + ++$index; + continue; + } + + // single-quoted strings (links) + // embeds are double + // end does not mark a token + if ($inPath) { + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { + if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) { + $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE; + ++$index; + } else { + $inPath = false; + } + } else { + $value .= $this->_formula{$index}; + } + ++$index; + continue; + } + + // bracked strings (R1C1 range index or linked workbook name) + // no embeds (changed to "()" by Excel) + // end does not mark a token + if ($inRange) { + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) { + $inRange = false; + } + $value .= $this->_formula{$index}; + ++$index; + continue; + } + + // error values + // end marks a token, determined from absolute list of values + if ($inError) { + $value .= $this->_formula{$index}; + ++$index; + if (in_array($value, $ERRORS)) { + $inError = false; + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR); + $value = ""; + } + continue; + } + + // scientific notation check + if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->_formula{$index}) !== false) { + if (strlen($value) > 1) { + if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->_formula{$index}) != 0) { + $value .= $this->_formula{$index}; + ++$index; + continue; + } + } + } + + // independent character evaluation (order not important) + + // establish state-dependent character evaluations + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) { + if (strlen($value > 0)) { // unexpected + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ""; + } + $inString = true; + ++$index; + continue; + } + + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { + if (strlen($value) > 0) { // unexpected + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ""; + } + $inPath = true; + ++$index; + continue; + } + + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) { + $inRange = true; + $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN; + ++$index; + continue; + } + + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) { + if (strlen($value) > 0) { // unexpected + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ""; + } + $inError = true; + $value .= PHPExcel_Calculation_FormulaParser::ERROR_START; + ++$index; + continue; + } + + // mark start and end of arrays and array rows + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) { + if (strlen($value) > 0) { // unexpected + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ""; + } + + $tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + ++$index; + continue; + } + + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + + $tmp = array_pop($stack); + $tmp->setValue(""); + $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + $tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); + $tokens1[] = $tmp; + + $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + ++$index; + continue; + } + + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + + $tmp = array_pop($stack); + $tmp->setValue(""); + $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + $tmp = array_pop($stack); + $tmp->setValue(""); + $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + ++$index; + continue; + } + + // trim white-space + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE); + ++$index; + while (($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) { + ++$index; + } + continue; + } + + // multi-character comparators + if (($index + 2) <= $formulaLength) { + if (in_array(substr($this->_formula, $index, 2), $COMPARATORS_MULTI)) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + $tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->_formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + $index += 2; + continue; + } + } + + // standard infix operators + if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->_formula{$index}) !== false) { + if (strlen($value) > 0) { + $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX); + ++$index; + continue; + } + + // standard postfix operators (only one) + if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->_formula{$index}) !== false) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); + ++$index; + continue; + } + + // start subexpression or function + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) { + if (strlen($value) > 0) { + $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + $value = ""; + } else { + $tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + } + ++$index; + continue; + } + + // function, subexpression, or array parameters, or operand unions + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + + $tmp = array_pop($stack); + $tmp->setValue(""); + $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $stack[] = $tmp; + + if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION); + } else { + $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT); + } + ++$index; + continue; + } + + // stop subexpression + if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) { + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + $value = ""; + } + + $tmp = array_pop($stack); + $tmp->setValue(""); + $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + ++$index; + continue; + } + + // token accumulation + $value .= $this->_formula{$index}; + ++$index; + } + + // dump remaining accumulation + if (strlen($value) > 0) { + $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); + } + + // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections + $tokenCount = count($tokens1); + for ($i = 0; $i < $tokenCount; ++$i) { + $token = $tokens1[$i]; + if (isset($tokens1[$i - 1])) { + $previousToken = $tokens1[$i - 1]; + } else { + $previousToken = null; + } + if (isset($tokens1[$i + 1])) { + $nextToken = $tokens1[$i + 1]; + } else { + $nextToken = null; + } + + if (is_null($token)) { + continue; + } + + if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) { + $tokens2[] = $token; + continue; + } + + if (is_null($previousToken)) { + continue; + } + + if (! ( + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + ) ) { + continue; + } + + if (is_null($nextToken)) { + continue; + } + + if (! ( + (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || + (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) || + ($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + ) ) { + continue; + } + + $tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION); + } + + // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators + // to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names + $this->_tokens = array(); + + $tokenCount = count($tokens2); + for ($i = 0; $i < $tokenCount; ++$i) { + $token = $tokens2[$i]; + if (isset($tokens2[$i - 1])) { + $previousToken = $tokens2[$i - 1]; + } else { + $previousToken = null; + } + if (isset($tokens2[$i + 1])) { + $nextToken = $tokens2[$i + 1]; + } else { + $nextToken = null; + } + + if (is_null($token)) { + continue; + } + + if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") { + if ($i == 0) { + $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + } else if ( + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + ) { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + } else { + $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + } + + $this->_tokens[] = $token; + continue; + } + + if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") { + if ($i == 0) { + continue; + } else if ( + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND) + ) { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + } else { + continue; + } + + $this->_tokens[] = $token; + continue; + } + + if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + } else if ($token->getValue() == "&") { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION); + } else { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH); + } + + $this->_tokens[] = $token; + continue; + } + + if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if (!is_numeric($token->getValue())) { + if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL); + } else { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE); + } + } else { + $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER); + } + + $this->_tokens[] = $token; + continue; + } + + if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) { + if (strlen($token->getValue() > 0)) { + if (substr($token->getValue(), 0, 1) == "@") { + $token->setValue(substr($token->getValue(), 1)); + } + } + } + + $this->_tokens[] = $token; + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation/FormulaToken.php b/libraries/PHPExcel/PHPExcel/Calculation/FormulaToken.php new file mode 100644 index 000000000..dff57675c --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/FormulaToken.php @@ -0,0 +1,176 @@ +_value = $pValue; + $this->_tokenType = $pTokenType; + $this->_tokenSubType = $pTokenSubType; + } + + /** + * Get Value + * + * @return string + */ + public function getValue() { + return $this->_value; + } + + /** + * Set Value + * + * @param string $value + */ + public function setValue($value) { + $this->_value = $value; + } + + /** + * Get Token Type (represented by TOKEN_TYPE_*) + * + * @return string + */ + public function getTokenType() { + return $this->_tokenType; + } + + /** + * Set Token Type + * + * @param string $value + */ + public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { + $this->_tokenType = $value; + } + + /** + * Get Token SubType (represented by TOKEN_SUBTYPE_*) + * + * @return string + */ + public function getTokenSubType() { + return $this->_tokenSubType; + } + + /** + * Set Token SubType + * + * @param string $value + */ + public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { + $this->_tokenSubType = $value; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation/Function.php b/libraries/PHPExcel/PHPExcel/Calculation/Function.php new file mode 100644 index 000000000..7b0c6c175 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/Function.php @@ -0,0 +1,149 @@ +_category = $pCategory; + $this->_excelName = $pExcelName; + $this->_phpExcelName = $pPHPExcelName; + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Get Category (represented by CATEGORY_*) + * + * @return string + */ + public function getCategory() { + return $this->_category; + } + + /** + * Set Category (represented by CATEGORY_*) + * + * @param string $value + * @throws Exception + */ + public function setCategory($value = null) { + if (!is_null($value)) { + $this->_category = $value; + } else { + throw new Exception("Invalid parameter passed."); + } + } + + /** + * Get Excel name + * + * @return string + */ + public function getExcelName() { + return $this->_excelName; + } + + /** + * Set Excel name + * + * @param string $value + */ + public function setExcelName($value) { + $this->_excelName = $value; + } + + /** + * Get PHPExcel name + * + * @return string + */ + public function getPHPExcelName() { + return $this->_phpExcelName; + } + + /** + * Set PHPExcel name + * + * @param string $value + */ + public function setPHPExcelName($value) { + $this->_phpExcelName = $value; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation/Functions.php b/libraries/PHPExcel/PHPExcel/Calculation/Functions.php new file mode 100644 index 000000000..8d6ca3d05 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/Functions.php @@ -0,0 +1,10505 @@ + '#NULL!', + 'divisionbyzero' => '#DIV/0!', + 'value' => '#VALUE!', + 'reference' => '#REF!', + 'name' => '#NAME?', + 'num' => '#NUM!', + 'na' => '#N/A', + 'gettingdata' => '#GETTING_DATA' + ); + + + /** + * Set the Compatibility Mode + * + * @access public + * @category Function Configuration + * @param string $compatibilityMode Compatibility Mode + * Permitted values are: + * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' + * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * @return boolean (Success or Failure) + */ + public static function setCompatibilityMode($compatibilityMode) { + if (($compatibilityMode == self::COMPATIBILITY_EXCEL) || + ($compatibilityMode == self::COMPATIBILITY_GNUMERIC) || + ($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) { + self::$compatibilityMode = $compatibilityMode; + return True; + } + return False; + } // function setCompatibilityMode() + + + /** + * Return the current Compatibility Mode + * + * @access public + * @category Function Configuration + * @return string Compatibility Mode + * Possible Return values are: + * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel' + * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + */ + public static function getCompatibilityMode() { + return self::$compatibilityMode; + } // function getCompatibilityMode() + + + /** + * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object) + * + * @access public + * @category Function Configuration + * @param string $returnDateType Return Date Format + * Permitted values are: + * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' + * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' + * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E' + * @return boolean Success or failure + */ + public static function setReturnDateType($returnDateType) { + if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) || + ($returnDateType == self::RETURNDATE_PHP_OBJECT) || + ($returnDateType == self::RETURNDATE_EXCEL)) { + self::$ReturnDateType = $returnDateType; + return True; + } + return False; + } // function setReturnDateType() + + + /** + * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object) + * + * @access public + * @category Function Configuration + * @return string Return Date Format + * Possible Return values are: + * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P' + * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O' + * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E' + */ + public static function getReturnDateType() { + return self::$ReturnDateType; + } // function getReturnDateType() + + + /** + * DUMMY + * + * @access public + * @category Error Returns + * @return string #Not Yet Implemented + */ + public static function DUMMY() { + return '#Not Yet Implemented'; + } // function DUMMY() + + + /** + * NA + * + * @access public + * @category Error Returns + * @return string #N/A! + */ + public static function NA() { + return self::$_errorCodes['na']; + } // function NA() + + + /** + * NAN + * + * @access public + * @category Error Returns + * @return string #NUM! + */ + public static function NaN() { + return self::$_errorCodes['num']; + } // function NAN() + + + /** + * NAME + * + * @access public + * @category Error Returns + * @return string #NAME! + */ + public static function NAME() { + return self::$_errorCodes['name']; + } // function NAME() + + + /** + * REF + * + * @access public + * @category Error Returns + * @return string #REF! + */ + public static function REF() { + return self::$_errorCodes['reference']; + } // function REF() + + + /** + * LOGICAL_AND + * + * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE. + * + * Excel Function: + * AND(logical1[,logical2[, ...]]) + * + * The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays + * or references that contain logical values. + * + * Booleans arguments are treated as True or False as appropriate + * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False + * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds the value TRUE or FALSE, + * holds the value TRUE or FALSE, in which case it is evaluated as a boolean + * + * @access public + * @category Logical Functions + * @param mixed $arg,... Data values + * @return boolean The logical AND of the arguments. + */ + public static function LOGICAL_AND() { + // Return value + $returnValue = True; + + // Loop through the arguments + $aArgs = self::flattenArray(func_get_args()); + $argCount = 0; + foreach ($aArgs as $arg) { + // Is it a boolean value? + if (is_bool($arg)) { + $returnValue = $returnValue && $arg; + ++$argCount; + } elseif ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue = $returnValue && ($arg != 0); + ++$argCount; + } elseif (is_string($arg)) { + $arg = strtoupper($arg); + if ($arg == 'TRUE') { + $arg = 1; + } elseif ($arg == 'FALSE') { + $arg = 0; + } else { + return self::$_errorCodes['value']; + } + $returnValue = $returnValue && ($arg != 0); + ++$argCount; + } + } + + // Return + if ($argCount == 0) { + return self::$_errorCodes['value']; + } + return $returnValue; + } // function LOGICAL_AND() + + + /** + * LOGICAL_OR + * + * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. + * + * Excel Function: + * OR(logical1[,logical2[, ...]]) + * + * The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays + * or references that contain logical values. + * + * Booleans arguments are treated as True or False as appropriate + * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False + * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string + * holds the value TRUE or FALSE, in which case it is evaluated as a boolean + * + * @access public + * @category Logical Functions + * @param mixed $arg,... Data values + * @return boolean The logical OR of the arguments. + */ + public static function LOGICAL_OR() { + // Return value + $returnValue = False; + + // Loop through the arguments + $aArgs = self::flattenArray(func_get_args()); + $argCount = 0; + foreach ($aArgs as $arg) { + // Is it a boolean value? + if (is_bool($arg)) { + $returnValue = $returnValue || $arg; + ++$argCount; + } elseif ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue = $returnValue || ($arg != 0); + ++$argCount; + } elseif (is_string($arg)) { + $arg = strtoupper($arg); + if ($arg == 'TRUE') { + $arg = 1; + } elseif ($arg == 'FALSE') { + $arg = 0; + } else { + return self::$_errorCodes['value']; + } + $returnValue = $returnValue || ($arg != 0); + ++$argCount; + } + } + + // Return + if ($argCount == 0) { + return self::$_errorCodes['value']; + } + return $returnValue; + } // function LOGICAL_OR() + + + /** + * LOGICAL_FALSE + * + * Returns the boolean FALSE. + * + * Excel Function: + * FALSE() + * + * @access public + * @category Logical Functions + * @return boolean False + */ + public static function LOGICAL_FALSE() { + return False; + } // function LOGICAL_FALSE() + + + /** + * LOGICAL_TRUE + * + * Returns the boolean TRUE. + * + * Excel Function: + * TRUE() + * + * @access public + * @category Logical Functions + * @return boolean True + */ + public static function LOGICAL_TRUE() { + return True; + } // function LOGICAL_TRUE() + + + /** + * LOGICAL_NOT + * + * Returns the boolean inverse of the argument. + * + * Excel Function: + * NOT(logical) + * + * @access public + * @category Logical Functions + * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE + * @return boolean The boolean inverse of the argument. + */ + public static function LOGICAL_NOT($logical) { + return !$logical; + } // function LOGICAL_NOT() + + + /** + * STATEMENT_IF + * + * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. + * + * Excel Function: + * IF(condition[,returnIfTrue[,returnIfFalse]]) + * + * Condition is any value or expression that can be evaluated to TRUE or FALSE. + * For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, + * the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. + * This argument can use any comparison calculation operator. + * ReturnIfTrue is the value that is returned if condition evaluates to TRUE. + * For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE, + * then the IF function returns the text "Within budget" + * If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use + * the logical value TRUE for this argument. + * ReturnIfTrue can be another formula. + * ReturnIfFalse is the value that is returned if condition evaluates to FALSE. + * For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE, + * then the IF function returns the text "Over budget". + * If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned. + * If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned. + * ReturnIfFalse can be another formula. + * + * @param mixed $condition Condition to evaluate + * @param mixed $returnIfTrue Value to return when condition is true + * @param mixed $returnIfFalse Value to return when condition is false + * @return mixed The value of returnIfTrue or returnIfFalse determined by condition + */ + public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = False) { + $condition = self::flattenSingleValue($condition); + $returnIfTrue = self::flattenSingleValue($returnIfTrue); + $returnIfFalse = self::flattenSingleValue($returnIfFalse); + if (is_null($returnIfTrue)) { $returnIfTrue = 0; } + if (is_null($returnIfFalse)) { $returnIfFalse = 0; } + + return ($condition ? $returnIfTrue : $returnIfFalse); + } // function STATEMENT_IF() + + + /** + * STATEMENT_IFERROR + * + * @param mixed $value Value to check , is also value when no error + * @param mixed $errorpart Value when error + * @return mixed + */ + public static function STATEMENT_IFERROR($value = '', $errorpart = '') { + return self::STATEMENT_IF(self::IS_ERROR($value), $errorpart, $value); + } // function STATEMENT_IFERROR() + + + /** + * ATAN2 + * + * This function calculates the arc tangent of the two variables x and y. It is similar to + * calculating the arc tangent of y x, except that the signs of both arguments are used + * to determine the quadrant of the result. + * The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a + * point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between + * -pi and pi, excluding -pi. + * + * Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard + * PHP atan2() function, so we need to reverse them here before calling the PHP atan() function. + * + * Excel Function: + * ATAN2(xCoordinate,yCoordinate) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param float $xCoordinate The x-coordinate of the point. + * @param float $yCoordinate The y-coordinate of the point. + * @return float The inverse tangent of the specified x- and y-coordinates. + */ + public static function REVERSE_ATAN2($xCoordinate, $yCoordinate) { + $xCoordinate = (float) self::flattenSingleValue($xCoordinate); + $yCoordinate = (float) self::flattenSingleValue($yCoordinate); + + if (($xCoordinate == 0) && ($yCoordinate == 0)) { + return self::$_errorCodes['divisionbyzero']; + } + + return atan2($yCoordinate, $xCoordinate); + } // function REVERSE_ATAN2() + + + /** + * LOG_BASE + * + * Returns the logarithm of a number to a specified base. The default base is 10. + * + * Excel Function: + * LOG(number[,base]) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param float $value The positive real number for which you want the logarithm + * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. + * @return float + */ + public static function LOG_BASE($number, $base=10) { + $number = self::flattenSingleValue($number); + $base = self::flattenSingleValue($base); + + return log($number, $base); + } // function LOG_BASE() + + + /** + * SUM + * + * SUM computes the sum of all the values and cells referenced in the argument list. + * + * Excel Function: + * SUM(value1[,value2[, ...]]) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function SUM() { + // Return value + $returnValue = 0; + + // Loop through the arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += $arg; + } + } + + // Return + return $returnValue; + } // function SUM() + + + /** + * SUMSQ + * + * SUMSQ returns the sum of the squares of the arguments + * + * Excel Function: + * SUMSQ(value1[,value2[, ...]]) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function SUMSQ() { + // Return value + $returnValue = 0; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += pow($arg,2); + } + } + + // Return + return $returnValue; + } // function SUMSQ() + + + /** + * PRODUCT + * + * PRODUCT returns the product of all the values and cells referenced in the argument list. + * + * Excel Function: + * PRODUCT(value1[,value2[, ...]]) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function PRODUCT() { + // Return value + $returnValue = null; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = $arg; + } else { + $returnValue *= $arg; + } + } + } + + // Return + if (is_null($returnValue)) { + return 0; + } + return $returnValue; + } // function PRODUCT() + + + /** + * QUOTIENT + * + * QUOTIENT function returns the integer portion of a division. Numerator is the divided number + * and denominator is the divisor. + * + * Excel Function: + * QUOTIENT(value1[,value2[, ...]]) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function QUOTIENT() { + // Return value + $returnValue = null; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = ($arg == 0) ? 0 : $arg; + } else { + if (($returnValue == 0) || ($arg == 0)) { + $returnValue = 0; + } else { + $returnValue /= $arg; + } + } + } + } + + // Return + return intval($returnValue); + } // function QUOTIENT() + + + /** + * MIN + * + * MIN returns the value of the element of the values passed that has the smallest value, + * with negative numbers considered smaller than positive numbers. + * + * Excel Function: + * MIN(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MIN() { + // Return value + $returnValue = null; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ((is_null($returnValue)) || ($arg < $returnValue)) { + $returnValue = $arg; + } + } + } + + // Return + if(is_null($returnValue)) { + return 0; + } + return $returnValue; + } // function MIN() + + + /** + * MINA + * + * Returns the smallest value in a list of arguments, including numbers, text, and logical values + * + * Excel Function: + * MINA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MINA() { + // Return value + $returnValue = null; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if ((is_null($returnValue)) || ($arg < $returnValue)) { + $returnValue = $arg; + } + } + } + + // Return + if(is_null($returnValue)) { + return 0; + } + return $returnValue; + } // function MINA() + + + /** + * SMALL + * + * Returns the nth smallest value in a data set. You can use this function to + * select a value based on its relative standing. + * + * Excel Function: + * SMALL(value1[,value2[, ...]],entry) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param int $entry Position (ordered from the smallest) in the array or range of data to return + * @return float + */ + public static function SMALL() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $n = array_pop($aArgs); + + if ((is_numeric($n)) && (!is_string($n))) { + $mArgs = array(); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $count = self::COUNT($mArgs); + $n = floor(--$n); + if (($n < 0) || ($n >= $count) || ($count == 0)) { + return self::$_errorCodes['num']; + } + sort($mArgs); + return $mArgs[$n]; + } + return self::$_errorCodes['value']; + } // function SMALL() + + + /** + * MAX + * + * MAX returns the value of the element of the values passed that has the highest value, + * with negative numbers considered smaller than positive numbers. + * + * Excel Function: + * MAX(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MAX() { + // Return value + $returnValue = null; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ((is_null($returnValue)) || ($arg > $returnValue)) { + $returnValue = $arg; + } + } + } + + // Return + if(is_null($returnValue)) { + return 0; + } + return $returnValue; + } // function MAX() + + + /** + * MAXA + * + * Returns the greatest value in a list of arguments, including numbers, text, and logical values + * + * Excel Function: + * MAXA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MAXA() { + // Return value + $returnValue = null; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if ((is_null($returnValue)) || ($arg > $returnValue)) { + $returnValue = $arg; + } + } + } + + // Return + if(is_null($returnValue)) { + return 0; + } + return $returnValue; + } // function MAXA() + + + /** + * LARGE + * + * Returns the nth largest value in a data set. You can use this function to + * select a value based on its relative standing. + * + * Excel Function: + * LARGE(value1[,value2[, ...]],entry) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param int $entry Position (ordered from the largest) in the array or range of data to return + * @return float + * + */ + public static function LARGE() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $n = floor(array_pop($aArgs)); + + if ((is_numeric($n)) && (!is_string($n))) { + $mArgs = array(); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $count = self::COUNT($mArgs); + $n = floor(--$n); + if (($n < 0) || ($n >= $count) || ($count == 0)) { + return self::$_errorCodes['num']; + } + rsort($mArgs); + return $mArgs[$n]; + } + return self::$_errorCodes['value']; + } // function LARGE() + + + /** + * PERCENTILE + * + * Returns the nth percentile of values in a range.. + * + * Excel Function: + * PERCENTILE(value1[,value2[, ...]],entry) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param float $entry Percentile value in the range 0..1, inclusive. + * @return float + */ + public static function PERCENTILE() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $entry = array_pop($aArgs); + + if ((is_numeric($entry)) && (!is_string($entry))) { + if (($entry < 0) || ($entry > 1)) { + return self::$_errorCodes['num']; + } + $mArgs = array(); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $mValueCount = count($mArgs); + if ($mValueCount > 0) { + sort($mArgs); + $count = self::COUNT($mArgs); + $index = $entry * ($count-1); + $iBase = floor($index); + if ($index == $iBase) { + return $mArgs[$index]; + } else { + $iNext = $iBase + 1; + $iProportion = $index - $iBase; + return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion) ; + } + } + } + return self::$_errorCodes['value']; + } // function PERCENTILE() + + + /** + * QUARTILE + * + * Returns the quartile of a data set. + * + * Excel Function: + * QUARTILE(value1[,value2[, ...]],entry) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param int $entry Quartile value in the range 1..3, inclusive. + * @return float + */ + public static function QUARTILE() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $entry = floor(array_pop($aArgs)); + + if ((is_numeric($entry)) && (!is_string($entry))) { + $entry /= 4; + if (($entry < 0) || ($entry > 1)) { + return self::$_errorCodes['num']; + } + return self::PERCENTILE($aArgs,$entry); + } + return self::$_errorCodes['value']; + } // function QUARTILE() + + + /** + * COUNT + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * COUNT(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return int + */ + public static function COUNT() { + // Return value + $returnValue = 0; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + if ((is_bool($arg)) && (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) { + $arg = (int) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + ++$returnValue; + } + } + + // Return + return $returnValue; + } // function COUNT() + + + /** + * COUNTBLANK + * + * Counts the number of empty cells within the list of arguments + * + * Excel Function: + * COUNTBLANK(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return int + */ + public static function COUNTBLANK() { + // Return value + $returnValue = 0; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a blank cell? + if ((is_null($arg)) || ((is_string($arg)) && ($arg == ''))) { + ++$returnValue; + } + } + + // Return + return $returnValue; + } // function COUNTBLANK() + + + /** + * COUNTA + * + * Counts the number of cells that are not empty within the list of arguments + * + * Excel Function: + * COUNTA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return int + */ + public static function COUNTA() { + // Return value + $returnValue = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric, boolean or string value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + ++$returnValue; + } + } + + // Return + return $returnValue; + } // function COUNTA() + + + /** + * COUNTIF + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * COUNTIF(value1[,value2[, ...]],condition) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param string $condition The criteria that defines which cells will be counted. + * @return int + */ + public static function COUNTIF($aArgs,$condition) { + // Return value + $returnValue = 0; + + $aArgs = self::flattenArray($aArgs); + if (!in_array($condition{0},array('>', '<', '='))) { + if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } + $condition = '='.$condition; + } + // Loop through arguments + foreach ($aArgs as $arg) { + if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + $testCondition = '='.$arg.$condition; + if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is it a value within our criteria + ++$returnValue; + } + } + + // Return + return $returnValue; + } // function COUNTIF() + + + /** + * SUMIF + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * SUMIF(value1[,value2[, ...]],condition) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @param string $condition The criteria that defines which cells will be summed. + * @return float + */ + public static function SUMIF($aArgs,$condition,$sumArgs = array()) { + // Return value + $returnValue = 0; + + $aArgs = self::flattenArray($aArgs); + $sumArgs = self::flattenArray($sumArgs); + if (count($sumArgs) == 0) { + $sumArgs = $aArgs; + } + if (!in_array($condition{0},array('>', '<', '='))) { + if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } + $condition = '='.$condition; + } + // Loop through arguments + foreach ($aArgs as $key => $arg) { + if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + $testCondition = '='.$arg.$condition; + if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is it a value within our criteria + $returnValue += $sumArgs[$key]; + } + } + + // Return + return $returnValue; + } // function SUMIF() + + + /** + * AVERAGE + * + * Returns the average (arithmetic mean) of the arguments + * + * Excel Function: + * AVERAGE(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function AVERAGE() { + // Return value + $returnValue = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + if ((is_bool($arg)) && (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) { + $arg = (integer) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = $arg; + } else { + $returnValue += $arg; + } + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + return $returnValue / $aCount; + } else { + return self::$_errorCodes['divisionbyzero']; + } + } // function AVERAGE() + + + /** + * AVERAGEA + * + * Returns the average of its arguments, including numbers, text, and logical values + * + * Excel Function: + * AVERAGEA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function AVERAGEA() { + // Return value + $returnValue = null; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if (is_null($returnValue)) { + $returnValue = $arg; + } else { + $returnValue += $arg; + } + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + return $returnValue / $aCount; + } else { + return self::$_errorCodes['divisionbyzero']; + } + } // function AVERAGEA() + + + /** + * MEDIAN + * + * Returns the median of the given numbers. The median is the number in the middle of a set of numbers. + * + * Excel Function: + * MEDIAN(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MEDIAN() { + // Return value + $returnValue = self::$_errorCodes['num']; + + $mArgs = array(); + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + + $mValueCount = count($mArgs); + if ($mValueCount > 0) { + sort($mArgs,SORT_NUMERIC); + $mValueCount = $mValueCount / 2; + if ($mValueCount == floor($mValueCount)) { + $returnValue = ($mArgs[$mValueCount--] + $mArgs[$mValueCount]) / 2; + } else { + $mValueCount == floor($mValueCount); + $returnValue = $mArgs[$mValueCount]; + } + } + + // Return + return $returnValue; + } // function MEDIAN() + + + // + // Special variant of array_count_values that isn't limited to strings and integers, + // but can work with floating point numbers as values + // + private static function _modeCalc($data) { + $frequencyArray = array(); + foreach($data as $datum) { + $found = False; + foreach($frequencyArray as $key => $value) { + if ((string) $value['value'] == (string) $datum) { + ++$frequencyArray[$key]['frequency']; + $found = True; + break; + } + } + if (!$found) { + $frequencyArray[] = array('value' => $datum, + 'frequency' => 1 ); + } + } + + foreach($frequencyArray as $key => $value) { + $frequencyList[$key] = $value['frequency']; + $valueList[$key] = $value['value']; + } + array_multisort($frequencyList, SORT_DESC, $valueList, SORT_ASC, SORT_NUMERIC, $frequencyArray); + + if ($frequencyArray[0]['frequency'] == 1) { + return self::NA(); + } + return $frequencyArray[0]['value']; + } // function _modeCalc() + + + /** + * MODE + * + * Returns the most frequently occurring, or repetitive, value in an array or range of data + * + * Excel Function: + * MODE(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function MODE() { + // Return value + $returnValue = self::NA(); + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + + $mArgs = array(); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + + if (count($mArgs) > 0) { + return self::_modeCalc($mArgs); + } + + // Return + return $returnValue; + } // function MODE() + + + /** + * DEVSQ + * + * Returns the sum of squares of deviations of data points from their sample mean. + * + * Excel Function: + * DEVSQ(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function DEVSQ() { + // Return value + $returnValue = null; + + $aMean = self::AVERAGE(func_get_args()); + if (!is_null($aMean)) { + $aArgs = self::flattenArray(func_get_args()); + + $aCount = -1; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_bool($arg)) && (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) { + $arg = (int) $arg; + } + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = pow(($arg - $aMean),2); + } else { + $returnValue += pow(($arg - $aMean),2); + } + ++$aCount; + } + } + + // Return + if (is_null($returnValue)) { + return self::$_errorCodes['num']; + } else { + return $returnValue; + } + } + return self::NA(); + } // function DEVSQ() + + + /** + * AVEDEV + * + * Returns the average of the absolute deviations of data points from their mean. + * AVEDEV is a measure of the variability in a data set. + * + * Excel Function: + * AVEDEV(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function AVEDEV() { + $aArgs = self::flattenArray(func_get_args()); + + // Return value + $returnValue = null; + + $aMean = self::AVERAGE($aArgs); + if ($aMean != self::$_errorCodes['divisionbyzero']) { + $aCount = 0; + foreach ($aArgs as $arg) { + if ((is_bool($arg)) && (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) { + $arg = (integer) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = abs($arg - $aMean); + } else { + $returnValue += abs($arg - $aMean); + } + ++$aCount; + } + } + + // Return + return $returnValue / $aCount ; + } + return self::$_errorCodes['num']; + } // function AVEDEV() + + + /** + * GEOMEAN + * + * Returns the geometric mean of an array or range of positive data. For example, you + * can use GEOMEAN to calculate average growth rate given compound interest with + * variable rates. + * + * Excel Function: + * GEOMEAN(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function GEOMEAN() { + $aMean = self::PRODUCT(func_get_args()); + if (is_numeric($aMean) && ($aMean > 0)) { + $aArgs = self::flattenArray(func_get_args()); + $aCount = self::COUNT($aArgs) ; + if (self::MIN($aArgs) > 0) { + return pow($aMean, (1 / $aCount)); + } + } + return self::$_errorCodes['num']; + } // GEOMEAN() + + + /** + * HARMEAN + * + * Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the + * arithmetic mean of reciprocals. + * + * Excel Function: + * HARMEAN(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function HARMEAN() { + // Return value + $returnValue = self::NA(); + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + if (self::MIN($aArgs) < 0) { + return self::$_errorCodes['num']; + } + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($arg <= 0) { + return self::$_errorCodes['num']; + } + if (is_null($returnValue)) { + $returnValue = (1 / $arg); + } else { + $returnValue += (1 / $arg); + } + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + return 1 / ($returnValue / $aCount); + } else { + return $returnValue; + } + } // function HARMEAN() + + + /** + * TRIMMEAN + * + * Returns the mean of the interior of a data set. TRIMMEAN calculates the mean + * taken by excluding a percentage of data points from the top and bottom tails + * of a data set. + * + * Excel Function: + * TRIMEAN(value1[,value2[, ...]],$discard) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @param float $discard Percentage to discard + * @return float + */ + public static function TRIMMEAN() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $percent = array_pop($aArgs); + + if ((is_numeric($percent)) && (!is_string($percent))) { + if (($percent < 0) || ($percent > 1)) { + return self::$_errorCodes['num']; + } + $mArgs = array(); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $discard = floor(self::COUNT($mArgs) * $percent / 2); + sort($mArgs); + for ($i=0; $i < $discard; ++$i) { + array_pop($mArgs); + array_shift($mArgs); + } + return self::AVERAGE($mArgs); + } + return self::$_errorCodes['value']; + } // function TRIMMEAN() + + + /** + * STDEV + * + * Estimates standard deviation based on a sample. The standard deviation is a measure of how + * widely values are dispersed from the average value (the mean). + * + * Excel Function: + * STDEV(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function STDEV() { + // Return value + $returnValue = null; + + $aMean = self::AVERAGE(func_get_args()); + if (!is_null($aMean)) { + $aArgs = self::flattenArray(func_get_args()); + + $aCount = -1; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = pow(($arg - $aMean),2); + } else { + $returnValue += pow(($arg - $aMean),2); + } + ++$aCount; + } + } + + // Return + if (($aCount > 0) && ($returnValue > 0)) { + return sqrt($returnValue / $aCount); + } + } + return self::$_errorCodes['divisionbyzero']; + } // function STDEV() + + + /** + * STDEVA + * + * Estimates standard deviation based on a sample, including numbers, text, and logical values + * + * Excel Function: + * STDEVA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function STDEVA() { + // Return value + $returnValue = null; + + $aMean = self::AVERAGEA(func_get_args()); + if (!is_null($aMean)) { + $aArgs = self::flattenArray(func_get_args()); + + $aCount = -1; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if (is_null($returnValue)) { + $returnValue = pow(($arg - $aMean),2); + } else { + $returnValue += pow(($arg - $aMean),2); + } + ++$aCount; + } + } + + // Return + if (($aCount > 0) && ($returnValue > 0)) { + return sqrt($returnValue / $aCount); + } + } + return self::$_errorCodes['divisionbyzero']; + } // function STDEVA() + + + /** + * STDEVP + * + * Calculates standard deviation based on the entire population + * + * Excel Function: + * STDEVP(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function STDEVP() { + // Return value + $returnValue = null; + + $aMean = self::AVERAGE(func_get_args()); + if (!is_null($aMean)) { + $aArgs = self::flattenArray(func_get_args()); + + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (is_null($returnValue)) { + $returnValue = pow(($arg - $aMean),2); + } else { + $returnValue += pow(($arg - $aMean),2); + } + ++$aCount; + } + } + + // Return + if (($aCount > 0) && ($returnValue > 0)) { + return sqrt($returnValue / $aCount); + } + } + return self::$_errorCodes['divisionbyzero']; + } // function STDEVP() + + + /** + * STDEVPA + * + * Calculates standard deviation based on the entire population, including numbers, text, and logical values + * + * Excel Function: + * STDEVPA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function STDEVPA() { + // Return value + $returnValue = null; + + $aMean = self::AVERAGEA(func_get_args()); + if (!is_null($aMean)) { + $aArgs = self::flattenArray(func_get_args()); + + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if (is_null($returnValue)) { + $returnValue = pow(($arg - $aMean),2); + } else { + $returnValue += pow(($arg - $aMean),2); + } + ++$aCount; + } + } + + // Return + if (($aCount > 0) && ($returnValue > 0)) { + return sqrt($returnValue / $aCount); + } + } + return self::$_errorCodes['divisionbyzero']; + } // function STDEVPA() + + + /** + * VARFunc + * + * Estimates variance based on a sample. + * + * Excel Function: + * VAR(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function VARFunc() { + // Return value + $returnValue = self::$_errorCodes['divisionbyzero']; + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + // Return + if ($aCount > 1) { + $summerA = $summerA * $aCount; + $summerB = ($summerB * $summerB); + $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1)); + } + return $returnValue; + } // function VARFunc() + + + /** + * VARA + * + * Estimates variance based on a sample, including numbers, text, and logical values + * + * Excel Function: + * VARA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function VARA() { + // Return value + $returnValue = self::$_errorCodes['divisionbyzero']; + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + // Return + if ($aCount > 1) { + $summerA = $summerA * $aCount; + $summerB = ($summerB * $summerB); + $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1)); + } + return $returnValue; + } // function VARA() + + + /** + * VARP + * + * Calculates variance based on the entire population + * + * Excel Function: + * VARP(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function VARP() { + // Return value + $returnValue = self::$_errorCodes['divisionbyzero']; + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + $summerA = $summerA * $aCount; + $summerB = ($summerB * $summerB); + $returnValue = ($summerA - $summerB) / ($aCount * $aCount); + } + return $returnValue; + } // function VARP() + + + /** + * VARPA + * + * Calculates variance based on the entire population, including numbers, text, and logical values + * + * Excel Function: + * VARPA(value1[,value2[, ...]]) + * + * @access public + * @category Statistical Functions + * @param mixed $arg,... Data values + * @return float + */ + public static function VARPA() { + // Return value + $returnValue = self::$_errorCodes['divisionbyzero']; + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (integer) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + $summerA = $summerA * $aCount; + $summerB = ($summerB * $summerB); + $returnValue = ($summerA - $summerB) / ($aCount * $aCount); + } + return $returnValue; + } // function VARPA() + + + /** + * RANK + * + * Returns the rank of a number in a list of numbers. + * + * @param number The number whose rank you want to find. + * @param array of number An array of, or a reference to, a list of numbers. + * @param mixed Order to sort the values in the value set + * @return float + */ + public static function RANK($value,$valueSet,$order=0) { + $value = self::flattenSingleValue($value); + $valueSet = self::flattenArray($valueSet); + $order = self::flattenSingleValue($order); + + foreach($valueSet as $key => $valueEntry) { + if (!is_numeric($valueEntry)) { + unset($valueSet[$key]); + } + } + + if ($order == 0) { + rsort($valueSet,SORT_NUMERIC); + } else { + sort($valueSet,SORT_NUMERIC); + } + $pos = array_search($value,$valueSet); + if ($pos === False) { + return self::$_errorCodes['na']; + } + + return ++$pos; + } // function RANK() + + + /** + * PERCENTRANK + * + * Returns the rank of a value in a data set as a percentage of the data set. + * + * @param array of number An array of, or a reference to, a list of numbers. + * @param number The number whose rank you want to find. + * @param number The number of significant digits for the returned percentage value. + * @return float + */ + public static function PERCENTRANK($valueSet,$value,$significance=3) { + $valueSet = self::flattenArray($valueSet); + $value = self::flattenSingleValue($value); + $significance = self::flattenSingleValue($significance); + + foreach($valueSet as $key => $valueEntry) { + if (!is_numeric($valueEntry)) { + unset($valueSet[$key]); + } + } + sort($valueSet,SORT_NUMERIC); + $valueCount = count($valueSet); + if ($valueCount == 0) { + return self::$_errorCodes['num']; + } + + $valueAdjustor = $valueCount - 1; + if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) { + return self::$_errorCodes['na']; + } + + $pos = array_search($value,$valueSet); + if ($pos === False) { + $pos = 0; + $testValue = $valueSet[0]; + while ($testValue < $value) { + $testValue = $valueSet[++$pos]; + } + --$pos; + $pos += (($value - $valueSet[$pos]) / ($testValue - $valueSet[$pos])); + } + + return round($pos / $valueAdjustor,$significance); + } // function PERCENTRANK() + + + private static function _checkTrendArray($values) { + foreach($values as $key => $value) { + if ((is_bool($value)) || ((is_string($value)) && (trim($value) == ''))) { + unset($values[$key]); + } elseif (is_string($value)) { + if (is_numeric($value)) { + $values[$key] = (float) $value; + } else { + unset($values[$key]); + } + } + } + return $values; + } // function _checkTrendArray() + + + /** + * INTERCEPT + * + * Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function INTERCEPT($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getIntersect(); + } // function INTERCEPT() + + + /** + * RSQ + * + * Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function RSQ($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getGoodnessOfFit(); + } // function RSQ() + + + /** + * SLOPE + * + * Returns the slope of the linear regression line through data points in known_y's and known_x's. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function SLOPE($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getSlope(); + } // function SLOPE() + + + /** + * STEYX + * + * Returns the standard error of the predicted y-value for each x in the regression. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function STEYX($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getStdevOfResiduals(); + } // function STEYX() + + + /** + * COVAR + * + * Returns covariance, the average of the products of deviations for each data point pair. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function COVAR($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getCovariance(); + } // function COVAR() + + + /** + * CORREL + * + * Returns covariance, the average of the products of deviations for each data point pair. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function CORREL($yValues,$xValues) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getCorrelation(); + } // function CORREL() + + + /** + * LINEST + * + * Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, + * and then returns an array that describes the line. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @param boolean A logical value specifying whether to force the intersect to equal 0. + * @param boolean A logical value specifying whether to return additional regression statistics. + * @return array + */ + public static function LINEST($yValues,$xValues,$const=True,$stats=False) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + $const = (boolean) self::flattenSingleValue($const); + $stats = (boolean) self::flattenSingleValue($stats); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); + if ($stats) { + return array( array( $bestFitLinear->getSlope(), + $bestFitLinear->getSlopeSE(), + $bestFitLinear->getGoodnessOfFit(), + $bestFitLinear->getF(), + $bestFitLinear->getSSRegression(), + ), + array( $bestFitLinear->getIntersect(), + $bestFitLinear->getIntersectSE(), + $bestFitLinear->getStdevOfResiduals(), + $bestFitLinear->getDFResiduals(), + $bestFitLinear->getSSResiduals() + ) + ); + } else { + return array( $bestFitLinear->getSlope(), + $bestFitLinear->getIntersect() + ); + } + } // function LINEST() + + + /** + * LOGEST + * + * Calculates an exponential curve that best fits the X and Y data series, + * and then returns an array that describes the line. + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @param boolean A logical value specifying whether to force the intersect to equal 0. + * @param boolean A logical value specifying whether to return additional regression statistics. + * @return array + */ + public static function LOGEST($yValues,$xValues,$const=True,$stats=False) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + $const = (boolean) self::flattenSingleValue($const); + $stats = (boolean) self::flattenSingleValue($stats); + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); + if ($stats) { + return array( array( $bestFitExponential->getSlope(), + $bestFitExponential->getSlopeSE(), + $bestFitExponential->getGoodnessOfFit(), + $bestFitExponential->getF(), + $bestFitExponential->getSSRegression(), + ), + array( $bestFitExponential->getIntersect(), + $bestFitExponential->getIntersectSE(), + $bestFitExponential->getStdevOfResiduals(), + $bestFitExponential->getDFResiduals(), + $bestFitExponential->getSSResiduals() + ) + ); + } else { + return array( $bestFitExponential->getSlope(), + $bestFitExponential->getIntersect() + ); + } + } // function LOGEST() + + + /** + * FORECAST + * + * Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. + * + * @param float Value of X for which we want to find Y + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @return float + */ + public static function FORECAST($xValue,$yValues,$xValues) { + $xValue = self::flattenSingleValue($xValue); + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + + if (!is_numeric($xValue)) { + return self::$_errorCodes['value']; + } + + $yValues = self::_checkTrendArray($yValues); + $yValueCount = count($yValues); + $xValues = self::_checkTrendArray($xValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return self::$_errorCodes['na']; + } elseif ($yValueCount == 1) { + return self::$_errorCodes['divisionbyzero']; + } + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); + return $bestFitLinear->getValueOfYForX($xValue); + } // function FORECAST() + + + /** + * TREND + * + * Returns values along a linear trend + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @param array of mixed Values of X for which we want to find Y + * @param boolean A logical value specifying whether to force the intersect to equal 0. + * @return array of float + */ + public static function TREND($yValues,$xValues=array(),$newValues=array(),$const=True) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + $newValues = self::flattenArray($newValues); + $const = (boolean) self::flattenSingleValue($const); + + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); + if (count($newValues) == 0) { + $newValues = $bestFitLinear->getXValues(); + } + + $returnArray = array(); + foreach($newValues as $xValue) { + $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue); + } + + return $returnArray; + } // function TREND() + + + /** + * GROWTH + * + * Returns values along a predicted emponential trend + * + * @param array of mixed Data Series Y + * @param array of mixed Data Series X + * @param array of mixed Values of X for which we want to find Y + * @param boolean A logical value specifying whether to force the intersect to equal 0. + * @return array of float + */ + public static function GROWTH($yValues,$xValues=array(),$newValues=array(),$const=True) { + $yValues = self::flattenArray($yValues); + $xValues = self::flattenArray($xValues); + $newValues = self::flattenArray($newValues); + $const = (boolean) self::flattenSingleValue($const); + + $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); + if (count($newValues) == 0) { + $newValues = $bestFitExponential->getXValues(); + } + + $returnArray = array(); + foreach($newValues as $xValue) { + $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue); + } + + return $returnArray; + } // function GROWTH() + + + private static function _romanCut($num, $n) { + return ($num - ($num % $n ) ) / $n; + } // function _romanCut() + + + public static function ROMAN($aValue, $style=0) { + $aValue = (integer) self::flattenSingleValue($aValue); + if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { + return self::$_errorCodes['value']; + } + if ($aValue == 0) { + return ''; + } + + $mill = Array('', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM'); + $cent = Array('', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'); + $tens = Array('', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'); + $ones = Array('', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'); + + $roman = ''; + while ($aValue > 5999) { + $roman .= 'M'; + $aValue -= 1000; + } + $m = self::_romanCut($aValue, 1000); $aValue %= 1000; + $c = self::_romanCut($aValue, 100); $aValue %= 100; + $t = self::_romanCut($aValue, 10); $aValue %= 10; + + return $roman.$mill[$m].$cent[$c].$tens[$t].$ones[$aValue]; + } // function ROMAN() + + + /** + * SUBTOTAL + * + * Returns a subtotal in a list or database. + * + * @param int the number 1 to 11 that specifies which function to + * use in calculating subtotals within a list. + * @param array of mixed Data Series + * @return float + */ + public static function SUBTOTAL() { + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $subtotal = array_shift($aArgs); + + if ((is_numeric($subtotal)) && (!is_string($subtotal))) { + switch($subtotal) { + case 1 : + return self::AVERAGE($aArgs); + break; + case 2 : + return self::COUNT($aArgs); + break; + case 3 : + return self::COUNTA($aArgs); + break; + case 4 : + return self::MAX($aArgs); + break; + case 5 : + return self::MIN($aArgs); + break; + case 6 : + return self::PRODUCT($aArgs); + break; + case 7 : + return self::STDEV($aArgs); + break; + case 8 : + return self::STDEVP($aArgs); + break; + case 9 : + return self::SUM($aArgs); + break; + case 10 : + return self::VARFunc($aArgs); + break; + case 11 : + return self::VARP($aArgs); + break; + } + } + return self::$_errorCodes['value']; + } // function SUBTOTAL() + + + /** + * SQRTPI + * + * Returns the square root of (number * pi). + * + * @param float $number Number + * @return float Square Root of Number * Pi + */ + public static function SQRTPI($number) { + $number = self::flattenSingleValue($number); + + if (is_numeric($number)) { + if ($number < 0) { + return self::$_errorCodes['num']; + } + return sqrt($number * pi()) ; + } + return self::$_errorCodes['value']; + } // function SQRTPI() + + + /** + * FACT + * + * Returns the factorial of a number. + * + * @param float $factVal Factorial Value + * @return int Factorial + */ + public static function FACT($factVal) { + $factVal = self::flattenSingleValue($factVal); + + if (is_numeric($factVal)) { + if ($factVal < 0) { + return self::$_errorCodes['num']; + } + $factLoop = floor($factVal); + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + if ($factVal > $factLoop) { + return self::$_errorCodes['num']; + } + } + $factorial = 1; + while ($factLoop > 1) { + $factorial *= $factLoop--; + } + return $factorial ; + } + return self::$_errorCodes['value']; + } // function FACT() + + + /** + * FACTDOUBLE + * + * Returns the double factorial of a number. + * + * @param float $factVal Factorial Value + * @return int Double Factorial + */ + public static function FACTDOUBLE($factVal) { + $factLoop = floor(self::flattenSingleValue($factVal)); + + if (is_numeric($factLoop)) { + if ($factVal < 0) { + return self::$_errorCodes['num']; + } + $factorial = 1; + while ($factLoop > 1) { + $factorial *= $factLoop--; + --$factLoop; + } + return $factorial ; + } + return self::$_errorCodes['value']; + } // function FACTDOUBLE() + + + /** + * MULTINOMIAL + * + * Returns the ratio of the factorial of a sum of values to the product of factorials. + * + * @param array of mixed Data Series + * @return float + */ + public static function MULTINOMIAL() { + // Loop through arguments + $aArgs = self::flattenArray(func_get_args()); + $summer = 0; + $divisor = 1; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if (is_numeric($arg)) { + if ($arg < 1) { + return self::$_errorCodes['num']; + } + $summer += floor($arg); + $divisor *= self::FACT($arg); + } else { + return self::$_errorCodes['value']; + } + } + + // Return + if ($summer > 0) { + $summer = self::FACT($summer); + return $summer / $divisor; + } + return 0; + } // function MULTINOMIAL() + + + /** + * CEILING + * + * Returns number rounded up, away from zero, to the nearest multiple of significance. + * + * @param float $number Number to round + * @param float $significance Significance + * @return float Rounded Number + */ + public static function CEILING($number,$significance=null) { + $number = self::flattenSingleValue($number); + $significance = self::flattenSingleValue($significance); + + if ((is_null($significance)) && (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC)) { + $significance = $number/abs($number); + } + + if ((is_numeric($number)) && (is_numeric($significance))) { + if (self::SIGN($number) == self::SIGN($significance)) { + if ($significance == 0.0) { + return 0; + } + return ceil($number / $significance) * $significance; + } else { + return self::$_errorCodes['num']; + } + } + return self::$_errorCodes['value']; + } // function CEILING() + + + /** + * EVEN + * + * Returns number rounded up to the nearest even integer. + * + * @param float $number Number to round + * @return int Rounded Number + */ + public static function EVEN($number) { + $number = self::flattenSingleValue($number); + + if (is_numeric($number)) { + $significance = 2 * self::SIGN($number); + return self::CEILING($number,$significance); + } + return self::$_errorCodes['value']; + } // function EVEN() + + + /** + * ODD + * + * Returns number rounded up to the nearest odd integer. + * + * @param float $number Number to round + * @return int Rounded Number + */ + public static function ODD($number) { + $number = self::flattenSingleValue($number); + + if (is_numeric($number)) { + $significance = self::SIGN($number); + if ($significance == 0) { + return 1; + } + $result = self::CEILING($number,$significance); + if (self::IS_EVEN($result)) { + $result += $significance; + } + return $result; + } + return self::$_errorCodes['value']; + } // function ODD() + + + /** + * INTVALUE + * + * Casts a floating point value to an integer + * + * @param float $number Number to cast to an integer + * @return integer Integer value + */ + public static function INTVALUE($number) { + $number = self::flattenSingleValue($number); + + if (is_numeric($number)) { + return (int) floor($number); + } + return self::$_errorCodes['value']; + } // function INTVALUE() + + + /** + * ROUNDUP + * + * Rounds a number up to a specified number of decimal places + * + * @param float $number Number to round + * @param int $digits Number of digits to which you want to round $number + * @return float Rounded Number + */ + public static function ROUNDUP($number,$digits) { + $number = self::flattenSingleValue($number); + $digits = self::flattenSingleValue($digits); + + if ((is_numeric($number)) && (is_numeric($digits))) { + $significance = pow(10,$digits); + if ($number < 0.0) { + return floor($number * $significance) / $significance; + } else { + return ceil($number * $significance) / $significance; + } + } + return self::$_errorCodes['value']; + } // function ROUNDUP() + + + /** + * ROUNDDOWN + * + * Rounds a number down to a specified number of decimal places + * + * @param float $number Number to round + * @param int $digits Number of digits to which you want to round $number + * @return float Rounded Number + */ + public static function ROUNDDOWN($number,$digits) { + $number = self::flattenSingleValue($number); + $digits = self::flattenSingleValue($digits); + + if ((is_numeric($number)) && (is_numeric($digits))) { + $significance = pow(10,$digits); + if ($number < 0.0) { + return ceil($number * $significance) / $significance; + } else { + return floor($number * $significance) / $significance; + } + } + return self::$_errorCodes['value']; + } // function ROUNDDOWN() + + + /** + * MROUND + * + * Rounds a number to the nearest multiple of a specified value + * + * @param float $number Number to round + * @param int $multiple Multiple to which you want to round $number + * @return float Rounded Number + */ + public static function MROUND($number,$multiple) { + $number = self::flattenSingleValue($number); + $multiple = self::flattenSingleValue($multiple); + + if ((is_numeric($number)) && (is_numeric($multiple))) { + if ($multiple == 0) { + return 0; + } + if ((self::SIGN($number)) == (self::SIGN($multiple))) { + $multiplier = 1 / $multiple; + return round($number * $multiplier) / $multiplier; + } + return self::$_errorCodes['num']; + } + return self::$_errorCodes['value']; + } // function MROUND() + + + /** + * SIGN + * + * Determines the sign of a number. Returns 1 if the number is positive, zero (0) + * if the number is 0, and -1 if the number is negative. + * + * @param float $number Number to round + * @return int sign value + */ + public static function SIGN($number) { + $number = self::flattenSingleValue($number); + + if (is_numeric($number)) { + if ($number == 0.0) { + return 0; + } + return $number / abs($number); + } + return self::$_errorCodes['value']; + } // function SIGN() + + + /** + * FLOOR + * + * Rounds number down, toward zero, to the nearest multiple of significance. + * + * @param float $number Number to round + * @param float $significance Significance + * @return float Rounded Number + */ + public static function FLOOR($number,$significance=null) { + $number = self::flattenSingleValue($number); + $significance = self::flattenSingleValue($significance); + + if ((is_null($significance)) && (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC)) { + $significance = $number/abs($number); + } + + if ((is_numeric($number)) && (is_numeric($significance))) { + if ((float) $significance == 0.0) { + return self::$_errorCodes['divisionbyzero']; + } + if (self::SIGN($number) == self::SIGN($significance)) { + return floor($number / $significance) * $significance; + } else { + return self::$_errorCodes['num']; + } + } + return self::$_errorCodes['value']; + } // function FLOOR() + + + /** + * PERMUT + * + * Returns the number of permutations for a given number of objects that can be + * selected from number objects. A permutation is any set or subset of objects or + * events where internal order is significant. Permutations are different from + * combinations, for which the internal order is not significant. Use this function + * for lottery-style probability calculations. + * + * @param int $numObjs Number of different objects + * @param int $numInSet Number of objects in each permutation + * @return int Number of permutations + */ + public static function PERMUT($numObjs,$numInSet) { + $numObjs = self::flattenSingleValue($numObjs); + $numInSet = self::flattenSingleValue($numInSet); + + if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { + if ($numObjs < $numInSet) { + return self::$_errorCodes['num']; + } + return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)); + } + return self::$_errorCodes['value']; + } // function PERMUT() + + + /** + * COMBIN + * + * Returns the number of combinations for a given number of items. Use COMBIN to + * determine the total possible number of groups for a given number of items. + * + * @param int $numObjs Number of different objects + * @param int $numInSet Number of objects in each combination + * @return int Number of combinations + */ + public static function COMBIN($numObjs,$numInSet) { + $numObjs = self::flattenSingleValue($numObjs); + $numInSet = self::flattenSingleValue($numInSet); + + if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { + if ($numObjs < $numInSet) { + return self::$_errorCodes['num']; + } elseif ($numInSet < 0) { + return self::$_errorCodes['num']; + } + return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet); + } + return self::$_errorCodes['value']; + } // function COMBIN() + + + /** + * SERIESSUM + * + * Returns the sum of a power series + * + * @param float $x Input value to the power series + * @param float $n Initial power to which you want to raise $x + * @param float $m Step by which to increase $n for each term in the series + * @param array of mixed Data Series + * @return float + */ + public static function SERIESSUM() { + // Return value + $returnValue = 0; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + + $x = array_shift($aArgs); + $n = array_shift($aArgs); + $m = array_shift($aArgs); + + if ((is_numeric($x)) && (is_numeric($n)) && (is_numeric($m))) { + // Calculate + $i = 0; + foreach($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += $arg * pow($x,$n + ($m * $i++)); + } else { + return self::$_errorCodes['value']; + } + } + // Return + return $returnValue; + } + return self::$_errorCodes['value']; + } // function SERIESSUM() + + + /** + * STANDARDIZE + * + * Returns a normalized value from a distribution characterized by mean and standard_dev. + * + * @param float $value Value to normalize + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * @return float Standardized value + */ + public static function STANDARDIZE($value,$mean,$stdDev) { + $value = self::flattenSingleValue($value); + $mean = self::flattenSingleValue($mean); + $stdDev = self::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if ($stdDev <= 0) { + return self::$_errorCodes['num']; + } + return ($value - $mean) / $stdDev ; + } + return self::$_errorCodes['value']; + } // function STANDARDIZE() + + + // + // Private method to return an array of the factors of the input value + // + private static function _factors($value) { + $startVal = floor(sqrt($value)); + + $factorArray = array(); + for ($i = $startVal; $i > 1; --$i) { + if (($value % $i) == 0) { + $factorArray = array_merge($factorArray,self::_factors($value / $i)); + $factorArray = array_merge($factorArray,self::_factors($i)); + if ($i <= sqrt($value)) { + break; + } + } + } + if (count($factorArray) > 0) { + rsort($factorArray); + return $factorArray; + } else { + return array((integer) $value); + } + } // function _factors() + + + /** + * LCM + * + * Returns the lowest common multiplier of a series of numbers + * + * @param $array Values to calculate the Lowest Common Multiplier + * @return int Lowest Common Multiplier + */ + public static function LCM() { + $aArgs = self::flattenArray(func_get_args()); + + $returnValue = 1; + $allPoweredFactors = array(); + foreach($aArgs as $value) { + if (!is_numeric($value)) { + return self::$_errorCodes['value']; + } + if ($value == 0) { + return 0; + } elseif ($value < 0) { + return self::$_errorCodes['num']; + } + $myFactors = self::_factors(floor($value)); + $myCountedFactors = array_count_values($myFactors); + $myPoweredFactors = array(); + foreach($myCountedFactors as $myCountedFactor => $myCountedPower) { + $myPoweredFactors[$myCountedFactor] = pow($myCountedFactor,$myCountedPower); + } + foreach($myPoweredFactors as $myPoweredValue => $myPoweredFactor) { + if (array_key_exists($myPoweredValue,$allPoweredFactors)) { + if ($allPoweredFactors[$myPoweredValue] < $myPoweredFactor) { + $allPoweredFactors[$myPoweredValue] = $myPoweredFactor; + } + } else { + $allPoweredFactors[$myPoweredValue] = $myPoweredFactor; + } + } + } + foreach($allPoweredFactors as $allPoweredFactor) { + $returnValue *= (integer) $allPoweredFactor; + } + return $returnValue; + } // function LCM() + + + /** + * GCD + * + * Returns the greatest common divisor of a series of numbers + * + * @param $array Values to calculate the Greatest Common Divisor + * @return int Greatest Common Divisor + */ + public static function GCD() { + $aArgs = self::flattenArray(func_get_args()); + + $returnValue = 1; + $allPoweredFactors = array(); + foreach($aArgs as $value) { + if ($value == 0) { + break; + } + $myFactors = self::_factors($value); + $myCountedFactors = array_count_values($myFactors); + $allValuesFactors[] = $myCountedFactors; + } + $allValuesCount = count($allValuesFactors); + $mergedArray = $allValuesFactors[0]; + for ($i=1;$i < $allValuesCount; ++$i) { + $mergedArray = array_intersect_key($mergedArray,$allValuesFactors[$i]); + } + $mergedArrayValues = count($mergedArray); + if ($mergedArrayValues == 0) { + return $returnValue; + } elseif ($mergedArrayValues > 1) { + foreach($mergedArray as $mergedKey => $mergedValue) { + foreach($allValuesFactors as $highestPowerTest) { + foreach($highestPowerTest as $testKey => $testValue) { + if (($testKey == $mergedKey) && ($testValue < $mergedValue)) { + $mergedArray[$mergedKey] = $testValue; + $mergedValue = $testValue; + } + } + } + } + + $returnValue = 1; + foreach($mergedArray as $key => $value) { + $returnValue *= pow($key,$value); + } + return $returnValue; + } else { + $keys = array_keys($mergedArray); + $key = $keys[0]; + $value = $mergedArray[$key]; + foreach($allValuesFactors as $testValue) { + foreach($testValue as $mergedKey => $mergedValue) { + if (($mergedKey == $key) && ($mergedValue < $value)) { + $value = $mergedValue; + } + } + } + return pow($key,$value); + } + } // function GCD() + + + /** + * BINOMDIST + * + * Returns the individual term binomial distribution probability. Use BINOMDIST in problems with + * a fixed number of tests or trials, when the outcomes of any trial are only success or failure, + * when trials are independent, and when the probability of success is constant throughout the + * experiment. For example, BINOMDIST can calculate the probability that two of the next three + * babies born are male. + * + * @param float $value Number of successes in trials + * @param float $trials Number of trials + * @param float $probability Probability of success on each trial + * @param boolean $cumulative + * @return float + * + * @todo Cumulative distribution function + * + */ + public static function BINOMDIST($value, $trials, $probability, $cumulative) { + $value = floor(self::flattenSingleValue($value)); + $trials = floor(self::flattenSingleValue($trials)); + $probability = self::flattenSingleValue($probability); + + if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) { + if (($value < 0) || ($value > $trials)) { + return self::$_errorCodes['num']; + } + if (($probability < 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + $summer = 0; + for ($i = 0; $i <= $value; ++$i) { + $summer += self::COMBIN($trials,$i) * pow($probability,$i) * pow(1 - $probability,$trials - $i); + } + return $summer; + } else { + return self::COMBIN($trials,$value) * pow($probability,$value) * pow(1 - $probability,$trials - $value) ; + } + } + } + return self::$_errorCodes['value']; + } // function BINOMDIST() + + + /** + * NEGBINOMDIST + * + * Returns the negative binomial distribution. NEGBINOMDIST returns the probability that + * there will be number_f failures before the number_s-th success, when the constant + * probability of a success is probability_s. This function is similar to the binomial + * distribution, except that the number of successes is fixed, and the number of trials is + * variable. Like the binomial, trials are assumed to be independent. + * + * @param float $failures Number of Failures + * @param float $successes Threshold number of Successes + * @param float $probability Probability of success on each trial + * @return float + * + */ + public static function NEGBINOMDIST($failures, $successes, $probability) { + $failures = floor(self::flattenSingleValue($failures)); + $successes = floor(self::flattenSingleValue($successes)); + $probability = self::flattenSingleValue($probability); + + if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) { + if (($failures < 0) || ($successes < 1)) { + return self::$_errorCodes['num']; + } + if (($probability < 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + if (($failures + $successes - 1) <= 0) { + return self::$_errorCodes['num']; + } + } + return (self::COMBIN($failures + $successes - 1,$successes - 1)) * (pow($probability,$successes)) * (pow(1 - $probability,$failures)) ; + } + return self::$_errorCodes['value']; + } // function NEGBINOMDIST() + + + /** + * CRITBINOM + * + * Returns the smallest value for which the cumulative binomial distribution is greater + * than or equal to a criterion value + * + * See http://support.microsoft.com/kb/828117/ for details of the algorithm used + * + * @param float $trials number of Bernoulli trials + * @param float $probability probability of a success on each trial + * @param float $alpha criterion value + * @return int + * + * @todo Warning. This implementation differs from the algorithm detailed on the MS + * web site in that $CumPGuessMinus1 = $CumPGuess - 1 rather than $CumPGuess - $PGuess + * This eliminates a potential endless loop error, but may have an adverse affect on the + * accuracy of the function (although all my tests have so far returned correct results). + * + */ + public static function CRITBINOM($trials, $probability, $alpha) { + $trials = floor(self::flattenSingleValue($trials)); + $probability = self::flattenSingleValue($probability); + $alpha = self::flattenSingleValue($alpha); + + if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) { + if ($trials < 0) { + return self::$_errorCodes['num']; + } + if (($probability < 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + if (($alpha < 0) || ($alpha > 1)) { + return self::$_errorCodes['num']; + } + if ($alpha <= 0.5) { + $t = sqrt(log(1 / pow($alpha,2))); + $trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t)); + } else { + $t = sqrt(log(1 / pow(1 - $alpha,2))); + $trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t); + } + $Guess = floor($trials * $probability + $trialsApprox * sqrt($trials * $probability * (1 - $probability))); + if ($Guess < 0) { + $Guess = 0; + } elseif ($Guess > $trials) { + $Guess = $trials; + } + + $TotalUnscaledProbability = $UnscaledPGuess = $UnscaledCumPGuess = 0.0; + $EssentiallyZero = 10e-12; + + $m = floor($trials * $probability); + ++$TotalUnscaledProbability; + if ($m == $Guess) { ++$UnscaledPGuess; } + if ($m <= $Guess) { ++$UnscaledCumPGuess; } + + $PreviousValue = 1; + $Done = False; + $k = $m + 1; + while ((!$Done) && ($k <= $trials)) { + $CurrentValue = $PreviousValue * ($trials - $k + 1) * $probability / ($k * (1 - $probability)); + $TotalUnscaledProbability += $CurrentValue; + if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } + if ($k <= $Guess) { $UnscaledCumPGuess += $CurrentValue; } + if ($CurrentValue <= $EssentiallyZero) { $Done = True; } + $PreviousValue = $CurrentValue; + ++$k; + } + + $PreviousValue = 1; + $Done = False; + $k = $m - 1; + while ((!$Done) && ($k >= 0)) { + $CurrentValue = $PreviousValue * $k + 1 * (1 - $probability) / (($trials - $k) * $probability); + $TotalUnscaledProbability += $CurrentValue; + if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } + if ($k <= $Guess) { $UnscaledCumPGuess += $CurrentValue; } + if ($CurrentValue <= $EssentiallyZero) { $Done = True; } + $PreviousValue = $CurrentValue; + --$k; + } + + $PGuess = $UnscaledPGuess / $TotalUnscaledProbability; + $CumPGuess = $UnscaledCumPGuess / $TotalUnscaledProbability; + +// $CumPGuessMinus1 = $CumPGuess - $PGuess; + $CumPGuessMinus1 = $CumPGuess - 1; + + while (True) { + if (($CumPGuessMinus1 < $alpha) && ($CumPGuess >= $alpha)) { + return $Guess; + } elseif (($CumPGuessMinus1 < $alpha) && ($CumPGuess < $alpha)) { + $PGuessPlus1 = $PGuess * ($trials - $Guess) * $probability / $Guess / (1 - $probability); + $CumPGuessMinus1 = $CumPGuess; + $CumPGuess = $CumPGuess + $PGuessPlus1; + $PGuess = $PGuessPlus1; + ++$Guess; + } elseif (($CumPGuessMinus1 >= $alpha) && ($CumPGuess >= $alpha)) { + $PGuessMinus1 = $PGuess * $Guess * (1 - $probability) / ($trials - $Guess + 1) / $probability; + $CumPGuess = $CumPGuessMinus1; + $CumPGuessMinus1 = $CumPGuessMinus1 - $PGuess; + $PGuess = $PGuessMinus1; + --$Guess; + } + } + } + return self::$_errorCodes['value']; + } // function CRITBINOM() + + + /** + * CHIDIST + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $value Value for the function + * @param float $degrees degrees of freedom + * @return float + */ + public static function CHIDIST($value, $degrees) { + $value = self::flattenSingleValue($value); + $degrees = floor(self::flattenSingleValue($degrees)); + + if ((is_numeric($value)) && (is_numeric($degrees))) { + if ($degrees < 1) { + return self::$_errorCodes['num']; + } + if ($value < 0) { + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + return 1; + } + return self::$_errorCodes['num']; + } + return 1 - (self::_incompleteGamma($degrees/2,$value/2) / self::_gamma($degrees/2)); + } + return self::$_errorCodes['value']; + } // function CHIDIST() + + + /** + * CHIINV + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $probability Probability for the function + * @param float $degrees degrees of freedom + * @return float + */ + public static function CHIINV($probability, $degrees) { + $probability = self::flattenSingleValue($probability); + $degrees = floor(self::flattenSingleValue($degrees)); + + if ((is_numeric($probability)) && (is_numeric($degrees))) { + $xLo = 100; + $xHi = 0; + $maxIteration = 100; + + $x = $xNew = 1; + $dx = 1; + $i = 0; + + while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $result = self::CHIDIST($x, $degrees); + $error = $result - $probability; + if ($error == 0.0) { + $dx = 0; + } elseif ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + // Avoid division by zero + if ($result != 0.0) { + $dx = $error / $result; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == MAX_ITERATIONS) { + return self::$_errorCodes['na']; + } + return round($x,12); + } + return self::$_errorCodes['value']; + } // function CHIINV() + + + /** + * EXPONDIST + * + * Returns the exponential distribution. Use EXPONDIST to model the time between events, + * such as how long an automated bank teller takes to deliver cash. For example, you can + * use EXPONDIST to determine the probability that the process takes at most 1 minute. + * + * @param float $value Value of the function + * @param float $lambda The parameter value + * @param boolean $cumulative + * @return float + */ + public static function EXPONDIST($value, $lambda, $cumulative) { + $value = self::flattenSingleValue($value); + $lambda = self::flattenSingleValue($lambda); + $cumulative = self::flattenSingleValue($cumulative); + + if ((is_numeric($value)) && (is_numeric($lambda))) { + if (($value < 0) || ($lambda < 0)) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 1 - exp(0-$value*$lambda); + } else { + return $lambda * exp(0-$value*$lambda); + } + } + } + return self::$_errorCodes['value']; + } // function EXPONDIST() + + + /** + * FISHER + * + * Returns the Fisher transformation at x. This transformation produces a function that + * is normally distributed rather than skewed. Use this function to perform hypothesis + * testing on the correlation coefficient. + * + * @param float $value + * @return float + */ + public static function FISHER($value) { + $value = self::flattenSingleValue($value); + + if (is_numeric($value)) { + if (($value <= -1) || ($value >= 1)) { + return self::$_errorCodes['num']; + } + return 0.5 * log((1+$value)/(1-$value)); + } + return self::$_errorCodes['value']; + } // function FISHER() + + + /** + * FISHERINV + * + * Returns the inverse of the Fisher transformation. Use this transformation when + * analyzing correlations between ranges or arrays of data. If y = FISHER(x), then + * FISHERINV(y) = x. + * + * @param float $value + * @return float + */ + public static function FISHERINV($value) { + $value = self::flattenSingleValue($value); + + if (is_numeric($value)) { + return (exp(2 * $value) - 1) / (exp(2 * $value) + 1); + } + return self::$_errorCodes['value']; + } // function FISHERINV() + + + // Function cache for _logBeta function + private static $_logBetaCache_p = 0.0; + private static $_logBetaCache_q = 0.0; + private static $_logBetaCache_result = 0.0; + + /** + * The natural logarithm of the beta function. + * @param p require p>0 + * @param q require q>0 + * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow + * @author Jaco van Kooten + */ + private static function _logBeta($p, $q) { + if ($p != self::$_logBetaCache_p || $q != self::$_logBetaCache_q) { + self::$_logBetaCache_p = $p; + self::$_logBetaCache_q = $q; + if (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) { + self::$_logBetaCache_result = 0.0; + } else { + self::$_logBetaCache_result = self::_logGamma($p) + self::_logGamma($q) - self::_logGamma($p + $q); + } + } + return self::$_logBetaCache_result; + } // function _logBeta() + + + /** + * Evaluates of continued fraction part of incomplete beta function. + * Based on an idea from Numerical Recipes (W.H. Press et al, 1992). + * @author Jaco van Kooten + */ + private static function _betaFraction($x, $p, $q) { + $c = 1.0; + $sum_pq = $p + $q; + $p_plus = $p + 1.0; + $p_minus = $p - 1.0; + $h = 1.0 - $sum_pq * $x / $p_plus; + if (abs($h) < XMININ) { + $h = XMININ; + } + $h = 1.0 / $h; + $frac = $h; + $m = 1; + $delta = 0.0; + while ($m <= MAX_ITERATIONS && abs($delta-1.0) > PRECISION ) { + $m2 = 2 * $m; + // even index for d + $d = $m * ($q - $m) * $x / ( ($p_minus + $m2) * ($p + $m2)); + $h = 1.0 + $d * $h; + if (abs($h) < XMININ) { + $h = XMININ; + } + $h = 1.0 / $h; + $c = 1.0 + $d / $c; + if (abs($c) < XMININ) { + $c = XMININ; + } + $frac *= $h * $c; + // odd index for d + $d = -($p + $m) * ($sum_pq + $m) * $x / (($p + $m2) * ($p_plus + $m2)); + $h = 1.0 + $d * $h; + if (abs($h) < XMININ) { + $h = XMININ; + } + $h = 1.0 / $h; + $c = 1.0 + $d / $c; + if (abs($c) < XMININ) { + $c = XMININ; + } + $delta = $h * $c; + $frac *= $delta; + ++$m; + } + return $frac; + } // function _betaFraction() + + + /** + * logGamma function + * + * @version 1.1 + * @author Jaco van Kooten + * + * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher. + * + * The natural logarithm of the gamma function.
    + * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
    + * Applied Mathematics Division
    + * Argonne National Laboratory
    + * Argonne, IL 60439
    + *

    + * References: + *

      + *
    1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural + * Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
    2. + *
    3. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
    4. + *
    5. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.
    6. + *
    + *

    + *

    + * From the original documentation: + *

    + *

    + * This routine calculates the LOG(GAMMA) function for a positive real argument X. + * Computation is based on an algorithm outlined in references 1 and 2. + * The program uses rational functions that theoretically approximate LOG(GAMMA) + * to at least 18 significant decimal digits. The approximation for X > 12 is from + * reference 3, while approximations for X < 12.0 are similar to those in reference + * 1, but are unpublished. The accuracy achieved depends on the arithmetic system, + * the compiler, the intrinsic functions, and proper selection of the + * machine-dependent constants. + *

    + *

    + * Error returns:
    + * The program returns the value XINF for X .LE. 0.0 or when overflow would occur. + * The computation is believed to be free of underflow and overflow. + *

    + * @return MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305 + */ + + // Function cache for logGamma + private static $_logGammaCache_result = 0.0; + private static $_logGammaCache_x = 0.0; + + private static function _logGamma($x) { + // Log Gamma related constants + static $lg_d1 = -0.5772156649015328605195174; + static $lg_d2 = 0.4227843350984671393993777; + static $lg_d4 = 1.791759469228055000094023; + + static $lg_p1 = array( 4.945235359296727046734888, + 201.8112620856775083915565, + 2290.838373831346393026739, + 11319.67205903380828685045, + 28557.24635671635335736389, + 38484.96228443793359990269, + 26377.48787624195437963534, + 7225.813979700288197698961 ); + static $lg_p2 = array( 4.974607845568932035012064, + 542.4138599891070494101986, + 15506.93864978364947665077, + 184793.2904445632425417223, + 1088204.76946882876749847, + 3338152.967987029735917223, + 5106661.678927352456275255, + 3074109.054850539556250927 ); + static $lg_p4 = array( 14745.02166059939948905062, + 2426813.369486704502836312, + 121475557.4045093227939592, + 2663432449.630976949898078, + 29403789566.34553899906876, + 170266573776.5398868392998, + 492612579337.743088758812, + 560625185622.3951465078242 ); + + static $lg_q1 = array( 67.48212550303777196073036, + 1113.332393857199323513008, + 7738.757056935398733233834, + 27639.87074403340708898585, + 54993.10206226157329794414, + 61611.22180066002127833352, + 36351.27591501940507276287, + 8785.536302431013170870835 ); + static $lg_q2 = array( 183.0328399370592604055942, + 7765.049321445005871323047, + 133190.3827966074194402448, + 1136705.821321969608938755, + 5267964.117437946917577538, + 13467014.54311101692290052, + 17827365.30353274213975932, + 9533095.591844353613395747 ); + static $lg_q4 = array( 2690.530175870899333379843, + 639388.5654300092398984238, + 41355999.30241388052042842, + 1120872109.61614794137657, + 14886137286.78813811542398, + 101680358627.2438228077304, + 341747634550.7377132798597, + 446315818741.9713286462081 ); + + static $lg_c = array( -0.001910444077728, + 8.4171387781295e-4, + -5.952379913043012e-4, + 7.93650793500350248e-4, + -0.002777777777777681622553, + 0.08333333333333333331554247, + 0.0057083835261 ); + + // Rough estimate of the fourth root of logGamma_xBig + static $lg_frtbig = 2.25e76; + static $pnt68 = 0.6796875; + + + if ($x == self::$_logGammaCache_x) { + return self::$_logGammaCache_result; + } + $y = $x; + if ($y > 0.0 && $y <= LOG_GAMMA_X_MAX_VALUE) { + if ($y <= EPS) { + $res = -log(y); + } elseif ($y <= 1.5) { + // --------------------- + // EPS .LT. X .LE. 1.5 + // --------------------- + if ($y < $pnt68) { + $corr = -log($y); + $xm1 = $y; + } else { + $corr = 0.0; + $xm1 = $y - 1.0; + } + if ($y <= 0.5 || $y >= $pnt68) { + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm1 + $lg_p1[$i]; + $xden = $xden * $xm1 + $lg_q1[$i]; + } + $res = $corr + $xm1 * ($lg_d1 + $xm1 * ($xnum / $xden)); + } else { + $xm2 = $y - 1.0; + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm2 + $lg_p2[$i]; + $xden = $xden * $xm2 + $lg_q2[$i]; + } + $res = $corr + $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden)); + } + } elseif ($y <= 4.0) { + // --------------------- + // 1.5 .LT. X .LE. 4.0 + // --------------------- + $xm2 = $y - 2.0; + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm2 + $lg_p2[$i]; + $xden = $xden * $xm2 + $lg_q2[$i]; + } + $res = $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden)); + } elseif ($y <= 12.0) { + // ---------------------- + // 4.0 .LT. X .LE. 12.0 + // ---------------------- + $xm4 = $y - 4.0; + $xden = -1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm4 + $lg_p4[$i]; + $xden = $xden * $xm4 + $lg_q4[$i]; + } + $res = $lg_d4 + $xm4 * ($xnum / $xden); + } else { + // --------------------------------- + // Evaluate for argument .GE. 12.0 + // --------------------------------- + $res = 0.0; + if ($y <= $lg_frtbig) { + $res = $lg_c[6]; + $ysq = $y * $y; + for ($i = 0; $i < 6; ++$i) + $res = $res / $ysq + $lg_c[$i]; + } + $res /= $y; + $corr = log($y); + $res = $res + log(SQRT2PI) - 0.5 * $corr; + $res += $y * ($corr - 1.0); + } + } else { + // -------------------------- + // Return for bad arguments + // -------------------------- + $res = MAX_VALUE; + } + // ------------------------------ + // Final adjustments and return + // ------------------------------ + self::$_logGammaCache_x = $x; + self::$_logGammaCache_result = $res; + return $res; + } // function _logGamma() + + + /** + * Beta function. + * + * @author Jaco van Kooten + * + * @param p require p>0 + * @param q require q>0 + * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow + */ + private static function _beta($p, $q) { + if ($p <= 0.0 || $q <= 0.0 || ($p + $q) > LOG_GAMMA_X_MAX_VALUE) { + return 0.0; + } else { + return exp(self::_logBeta($p, $q)); + } + } // function _beta() + + + /** + * Incomplete beta function + * + * @author Jaco van Kooten + * @author Paul Meagher + * + * The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992). + * @param x require 0<=x<=1 + * @param p require p>0 + * @param q require q>0 + * @return 0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow + */ + private static function _incompleteBeta($x, $p, $q) { + if ($x <= 0.0) { + return 0.0; + } elseif ($x >= 1.0) { + return 1.0; + } elseif (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) { + return 0.0; + } + $beta_gam = exp((0 - self::_logBeta($p, $q)) + $p * log($x) + $q * log(1.0 - $x)); + if ($x < ($p + 1.0) / ($p + $q + 2.0)) { + return $beta_gam * self::_betaFraction($x, $p, $q) / $p; + } else { + return 1.0 - ($beta_gam * self::_betaFraction(1 - $x, $q, $p) / $q); + } + } // function _incompleteBeta() + + + /** + * BETADIST + * + * Returns the beta distribution. + * + * @param float $value Value at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * @param boolean $cumulative + * @return float + * + */ + public static function BETADIST($value,$alpha,$beta,$rMin=0,$rMax=1) { + $value = self::flattenSingleValue($value); + $alpha = self::flattenSingleValue($alpha); + $beta = self::flattenSingleValue($beta); + $rMin = self::flattenSingleValue($rMin); + $rMax = self::flattenSingleValue($rMax); + + if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { + if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) { + return self::$_errorCodes['num']; + } + if ($rMin > $rMax) { + $tmp = $rMin; + $rMin = $rMax; + $rMax = $tmp; + } + $value -= $rMin; + $value /= ($rMax - $rMin); + return self::_incompleteBeta($value,$alpha,$beta); + } + return self::$_errorCodes['value']; + } // function BETADIST() + + + /** + * BETAINV + * + * Returns the inverse of the beta distribution. + * + * @param float $probability Probability at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * @param boolean $cumulative + * @return float + * + */ + public static function BETAINV($probability,$alpha,$beta,$rMin=0,$rMax=1) { + $probability = self::flattenSingleValue($probability); + $alpha = self::flattenSingleValue($alpha); + $beta = self::flattenSingleValue($beta); + $rMin = self::flattenSingleValue($rMin); + $rMax = self::flattenSingleValue($rMax); + + if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { + if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + if ($rMin > $rMax) { + $tmp = $rMin; + $rMin = $rMax; + $rMax = $tmp; + } + $a = 0; + $b = 2; + $maxIteration = 100; + + $i = 0; + while ((($b - $a) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + $guess = ($a + $b) / 2; + $result = self::BETADIST($guess, $alpha, $beta); + if (($result == $probability) || ($result == 0)) { + $b = $a; + } elseif ($result > $probability) { + $b = $guess; + } else { + $a = $guess; + } + } + if ($i == MAX_ITERATIONS) { + return self::$_errorCodes['na']; + } + return round($rMin + $guess * ($rMax - $rMin),12); + } + return self::$_errorCodes['value']; + } // function BETAINV() + + + // + // Private implementation of the incomplete Gamma function + // + private static function _incompleteGamma($a,$x) { + static $max = 32; + $summer = 0; + for ($n=0; $n<=$max; ++$n) { + $divisor = $a; + for ($i=1; $i<=$n; ++$i) { + $divisor *= ($a + $i); + } + $summer += (pow($x,$n) / $divisor); + } + return pow($x,$a) * exp(0-$x) * $summer; + } // function _incompleteGamma() + + + // + // Private implementation of the Gamma function + // + private static function _gamma($data) { + if ($data == 0.0) return 0; + + static $p0 = 1.000000000190015; + static $p = array ( 1 => 76.18009172947146, + 2 => -86.50532032941677, + 3 => 24.01409824083091, + 4 => -1.231739572450155, + 5 => 1.208650973866179e-3, + 6 => -5.395239384953e-6 + ); + + $y = $x = $data; + $tmp = $x + 5.5; + $tmp -= ($x + 0.5) * log($tmp); + + $summer = $p0; + for ($j=1;$j<=6;++$j) { + $summer += ($p[$j] / ++$y); + } + return exp(0 - $tmp + log(2.5066282746310005 * $summer / $x)); + } // function _gamma() + + + /** + * GAMMADIST + * + * Returns the gamma distribution. + * + * @param float $value Value at which you want to evaluate the distribution + * @param float $a Parameter to the distribution + * @param float $b Parameter to the distribution + * @param boolean $cumulative + * @return float + * + */ + public static function GAMMADIST($value,$a,$b,$cumulative) { + $value = self::flattenSingleValue($value); + $a = self::flattenSingleValue($a); + $b = self::flattenSingleValue($b); + + if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) { + if (($value < 0) || ($a <= 0) || ($b <= 0)) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return self::_incompleteGamma($a,$value / $b) / self::_gamma($a); + } else { + return (1 / (pow($b,$a) * self::_gamma($a))) * pow($value,$a-1) * exp(0-($value / $b)); + } + } + } + return self::$_errorCodes['value']; + } // function GAMMADIST() + + + /** + * GAMMAINV + * + * Returns the inverse of the beta distribution. + * + * @param float $probability Probability at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * @param boolean $cumulative + * @return float + * + */ + public static function GAMMAINV($probability,$alpha,$beta) { + $probability = self::flattenSingleValue($probability); + $alpha = self::flattenSingleValue($alpha); + $beta = self::flattenSingleValue($beta); +// $rMin = self::flattenSingleValue($rMin); +// $rMax = self::flattenSingleValue($rMax); + + if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) { + if (($alpha <= 0) || ($beta <= 0) || ($probability <= 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + $xLo = 0; + $xHi = 100; + $maxIteration = 100; + + $x = $xNew = 1; + $dx = 1; + $i = 0; + + while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $result = self::GAMMADIST($x, $alpha, $beta, True); + $error = $result - $probability; + if ($error == 0.0) { + $dx = 0; + } elseif ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + // Avoid division by zero + if ($result != 0.0) { + $dx = $error / $result; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == MAX_ITERATIONS) { + return self::$_errorCodes['na']; + } + return round($x,12); + } + return self::$_errorCodes['value']; + } // function GAMMAINV() + + + /** + * GAMMALN + * + * Returns the natural logarithm of the gamma function. + * + * @param float $value + * @return float + */ + public static function GAMMALN($value) { + $value = self::flattenSingleValue($value); + + if (is_numeric($value)) { + if ($value <= 0) { + return self::$_errorCodes['num']; + } + return log(self::_gamma($value)); + } + return self::$_errorCodes['value']; + } // function GAMMALN() + + + /** + * NORMDIST + * + * Returns the normal distribution for the specified mean and standard deviation. This + * function has a very wide range of applications in statistics, including hypothesis + * testing. + * + * @param float $value + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * @param boolean $cumulative + * @return float + * + */ + public static function NORMDIST($value, $mean, $stdDev, $cumulative) { + $value = self::flattenSingleValue($value); + $mean = self::flattenSingleValue($mean); + $stdDev = self::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if ($stdDev < 0) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 0.5 * (1 + self::_erfVal(($value - $mean) / ($stdDev * sqrt(2)))); + } else { + return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean,2) / (2 * pow($stdDev,2)))); + } + } + } + return self::$_errorCodes['value']; + } // function NORMDIST() + + + /** + * NORMSDIST + * + * Returns the standard normal cumulative distribution function. The distribution has + * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a + * table of standard normal curve areas. + * + * @param float $value + * @return float + */ + public static function NORMSDIST($value) { + $value = self::flattenSingleValue($value); + + return self::NORMDIST($value, 0, 1, True); + } // function NORMSDIST() + + + /** + * LOGNORMDIST + * + * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed + * with parameters mean and standard_dev. + * + * @param float $value + * @return float + */ + public static function LOGNORMDIST($value, $mean, $stdDev) { + $value = self::flattenSingleValue($value); + $mean = self::flattenSingleValue($mean); + $stdDev = self::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($value <= 0) || ($stdDev <= 0)) { + return self::$_errorCodes['num']; + } + return self::NORMSDIST((log($value) - $mean) / $stdDev); + } + return self::$_errorCodes['value']; + } // function LOGNORMDIST() + + + /*************************************************************************** + * inverse_ncdf.php + * ------------------- + * begin : Friday, January 16, 2004 + * copyright : (C) 2004 Michael Nickerson + * email : nickersonm@yahoo.com + * + ***************************************************************************/ + private static function _inverse_ncdf($p) { + // Inverse ncdf approximation by Peter J. Acklam, implementation adapted to + // PHP by Michael Nickerson, using Dr. Thomas Ziegler's C implementation as + // a guide. http://home.online.no/~pjacklam/notes/invnorm/index.html + // I have not checked the accuracy of this implementation. Be aware that PHP + // will truncate the coeficcients to 14 digits. + + // You have permission to use and distribute this function freely for + // whatever purpose you want, but please show common courtesy and give credit + // where credit is due. + + // Input paramater is $p - probability - where 0 < p < 1. + + // Coefficients in rational approximations + static $a = array( 1 => -3.969683028665376e+01, + 2 => 2.209460984245205e+02, + 3 => -2.759285104469687e+02, + 4 => 1.383577518672690e+02, + 5 => -3.066479806614716e+01, + 6 => 2.506628277459239e+00 + ); + + static $b = array( 1 => -5.447609879822406e+01, + 2 => 1.615858368580409e+02, + 3 => -1.556989798598866e+02, + 4 => 6.680131188771972e+01, + 5 => -1.328068155288572e+01 + ); + + static $c = array( 1 => -7.784894002430293e-03, + 2 => -3.223964580411365e-01, + 3 => -2.400758277161838e+00, + 4 => -2.549732539343734e+00, + 5 => 4.374664141464968e+00, + 6 => 2.938163982698783e+00 + ); + + static $d = array( 1 => 7.784695709041462e-03, + 2 => 3.224671290700398e-01, + 3 => 2.445134137142996e+00, + 4 => 3.754408661907416e+00 + ); + + // Define lower and upper region break-points. + $p_low = 0.02425; //Use lower region approx. below this + $p_high = 1 - $p_low; //Use upper region approx. above this + + if (0 < $p && $p < $p_low) { + // Rational approximation for lower region. + $q = sqrt(-2 * log($p)); + return ((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / + (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1); + } elseif ($p_low <= $p && $p <= $p_high) { + // Rational approximation for central region. + $q = $p - 0.5; + $r = $q * $q; + return ((((($a[1] * $r + $a[2]) * $r + $a[3]) * $r + $a[4]) * $r + $a[5]) * $r + $a[6]) * $q / + ((((($b[1] * $r + $b[2]) * $r + $b[3]) * $r + $b[4]) * $r + $b[5]) * $r + 1); + } elseif ($p_high < $p && $p < 1) { + // Rational approximation for upper region. + $q = sqrt(-2 * log(1 - $p)); + return -((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / + (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1); + } + // If 0 < p < 1, return a null value + return self::$_errorCodes['null']; + } // function _inverse_ncdf() + + + private static function _inverse_ncdf2($prob) { + // Approximation of inverse standard normal CDF developed by + // B. Moro, "The Full Monte," Risk 8(2), Feb 1995, 57-58. + + $a1 = 2.50662823884; + $a2 = -18.61500062529; + $a3 = 41.39119773534; + $a4 = -25.44106049637; + + $b1 = -8.4735109309; + $b2 = 23.08336743743; + $b3 = -21.06224101826; + $b4 = 3.13082909833; + + $c1 = 0.337475482272615; + $c2 = 0.976169019091719; + $c3 = 0.160797971491821; + $c4 = 2.76438810333863E-02; + $c5 = 3.8405729373609E-03; + $c6 = 3.951896511919E-04; + $c7 = 3.21767881768E-05; + $c8 = 2.888167364E-07; + $c9 = 3.960315187E-07; + + $y = $prob - 0.5; + if (abs($y) < 0.42) { + $z = pow($y,2); + $z = $y * ((($a4 * $z + $a3) * $z + $a2) * $z + $a1) / (((($b4 * $z + $b3) * $z + $b2) * $z + $b1) * $z + 1); + } else { + if ($y > 0) { + $z = log(-log(1 - $prob)); + } else { + $z = log(-log($prob)); + } + $z = $c1 + $z * ($c2 + $z * ($c3 + $z * ($c4 + $z * ($c5 + $z * ($c6 + $z * ($c7 + $z * ($c8 + $z * $c9))))))); + if ($y < 0) { + $z = -$z; + } + } + return $z; + } // function _inverse_ncdf2() + + + private static function _inverse_ncdf3($p) { + // ALGORITHM AS241 APPL. STATIST. (1988) VOL. 37, NO. 3. + // Produces the normal deviate Z corresponding to a given lower + // tail area of P; Z is accurate to about 1 part in 10**16. + // + // This is a PHP version of the original FORTRAN code that can + // be found at http://lib.stat.cmu.edu/apstat/ + $split1 = 0.425; + $split2 = 5; + $const1 = 0.180625; + $const2 = 1.6; + + // coefficients for p close to 0.5 + $a0 = 3.3871328727963666080; + $a1 = 1.3314166789178437745E+2; + $a2 = 1.9715909503065514427E+3; + $a3 = 1.3731693765509461125E+4; + $a4 = 4.5921953931549871457E+4; + $a5 = 6.7265770927008700853E+4; + $a6 = 3.3430575583588128105E+4; + $a7 = 2.5090809287301226727E+3; + + $b1 = 4.2313330701600911252E+1; + $b2 = 6.8718700749205790830E+2; + $b3 = 5.3941960214247511077E+3; + $b4 = 2.1213794301586595867E+4; + $b5 = 3.9307895800092710610E+4; + $b6 = 2.8729085735721942674E+4; + $b7 = 5.2264952788528545610E+3; + + // coefficients for p not close to 0, 0.5 or 1. + $c0 = 1.42343711074968357734; + $c1 = 4.63033784615654529590; + $c2 = 5.76949722146069140550; + $c3 = 3.64784832476320460504; + $c4 = 1.27045825245236838258; + $c5 = 2.41780725177450611770E-1; + $c6 = 2.27238449892691845833E-2; + $c7 = 7.74545014278341407640E-4; + + $d1 = 2.05319162663775882187; + $d2 = 1.67638483018380384940; + $d3 = 6.89767334985100004550E-1; + $d4 = 1.48103976427480074590E-1; + $d5 = 1.51986665636164571966E-2; + $d6 = 5.47593808499534494600E-4; + $d7 = 1.05075007164441684324E-9; + + // coefficients for p near 0 or 1. + $e0 = 6.65790464350110377720; + $e1 = 5.46378491116411436990; + $e2 = 1.78482653991729133580; + $e3 = 2.96560571828504891230E-1; + $e4 = 2.65321895265761230930E-2; + $e5 = 1.24266094738807843860E-3; + $e6 = 2.71155556874348757815E-5; + $e7 = 2.01033439929228813265E-7; + + $f1 = 5.99832206555887937690E-1; + $f2 = 1.36929880922735805310E-1; + $f3 = 1.48753612908506148525E-2; + $f4 = 7.86869131145613259100E-4; + $f5 = 1.84631831751005468180E-5; + $f6 = 1.42151175831644588870E-7; + $f7 = 2.04426310338993978564E-15; + + $q = $p - 0.5; + + // computation for p close to 0.5 + if (abs($q) <= split1) { + $R = $const1 - $q * $q; + $z = $q * ((((((($a7 * $R + $a6) * $R + $a5) * $R + $a4) * $R + $a3) * $R + $a2) * $R + $a1) * $R + $a0) / + ((((((($b7 * $R + $b6) * $R + $b5) * $R + $b4) * $R + $b3) * $R + $b2) * $R + $b1) * $R + 1); + } else { + if ($q < 0) { + $R = $p; + } else { + $R = 1 - $p; + } + $R = pow(-log($R),2); + + // computation for p not close to 0, 0.5 or 1. + If ($R <= $split2) { + $R = $R - $const2; + $z = ((((((($c7 * $R + $c6) * $R + $c5) * $R + $c4) * $R + $c3) * $R + $c2) * $R + $c1) * $R + $c0) / + ((((((($d7 * $R + $d6) * $R + $d5) * $R + $d4) * $R + $d3) * $R + $d2) * $R + $d1) * $R + 1); + } else { + // computation for p near 0 or 1. + $R = $R - $split2; + $z = ((((((($e7 * $R + $e6) * $R + $e5) * $R + $e4) * $R + $e3) * $R + $e2) * $R + $e1) * $R + $e0) / + ((((((($f7 * $R + $f6) * $R + $f5) * $R + $f4) * $R + $f3) * $R + $f2) * $R + $f1) * $R + 1); + } + if ($q < 0) { + $z = -$z; + } + } + return $z; + } // function _inverse_ncdf3() + + + /** + * NORMINV + * + * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. + * + * @param float $value + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * @return float + * + */ + public static function NORMINV($probability,$mean,$stdDev) { + $probability = self::flattenSingleValue($probability); + $mean = self::flattenSingleValue($mean); + $stdDev = self::flattenSingleValue($stdDev); + + if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($probability < 0) || ($probability > 1)) { + return self::$_errorCodes['num']; + } + if ($stdDev < 0) { + return self::$_errorCodes['num']; + } + return (self::_inverse_ncdf($probability) * $stdDev) + $mean; + } + return self::$_errorCodes['value']; + } // function NORMINV() + + + /** + * NORMSINV + * + * Returns the inverse of the standard normal cumulative distribution + * + * @param float $value + * @return float + */ + public static function NORMSINV($value) { + return self::NORMINV($value, 0, 1); + } // function NORMSINV() + + + /** + * LOGINV + * + * Returns the inverse of the normal cumulative distribution + * + * @param float $value + * @return float + * + * @todo Try implementing P J Acklam's refinement algorithm for greater + * accuracy if I can get my head round the mathematics + * (as described at) http://home.online.no/~pjacklam/notes/invnorm/ + */ + public static function LOGINV($probability, $mean, $stdDev) { + $probability = self::flattenSingleValue($probability); + $mean = self::flattenSingleValue($mean); + $stdDev = self::flattenSingleValue($stdDev); + + if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) { + return self::$_errorCodes['num']; + } + return exp($mean + $stdDev * self::NORMSINV($probability)); + } + return self::$_errorCodes['value']; + } // function LOGINV() + + + /** + * HYPGEOMDIST + * + * Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of + * sample successes, given the sample size, population successes, and population size. + * + * @param float $sampleSuccesses Number of successes in the sample + * @param float $sampleNumber Size of the sample + * @param float $populationSuccesses Number of successes in the population + * @param float $populationNumber Population size + * @return float + * + */ + public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) { + $sampleSuccesses = floor(self::flattenSingleValue($sampleSuccesses)); + $sampleNumber = floor(self::flattenSingleValue($sampleNumber)); + $populationSuccesses = floor(self::flattenSingleValue($populationSuccesses)); + $populationNumber = floor(self::flattenSingleValue($populationNumber)); + + if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) { + if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) { + return self::$_errorCodes['num']; + } + if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) { + return self::$_errorCodes['num']; + } + if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) { + return self::$_errorCodes['num']; + } + return self::COMBIN($populationSuccesses,$sampleSuccesses) * + self::COMBIN($populationNumber - $populationSuccesses,$sampleNumber - $sampleSuccesses) / + self::COMBIN($populationNumber,$sampleNumber); + } + return self::$_errorCodes['value']; + } // function HYPGEOMDIST() + + + /** + * TDIST + * + * Returns the probability of Student's T distribution. + * + * @param float $value Value for the function + * @param float $degrees degrees of freedom + * @param float $tails number of tails (1 or 2) + * @return float + */ + public static function TDIST($value, $degrees, $tails) { + $value = self::flattenSingleValue($value); + $degrees = floor(self::flattenSingleValue($degrees)); + $tails = floor(self::flattenSingleValue($tails)); + + if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) { + if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) { + return self::$_errorCodes['num']; + } + // tdist, which finds the probability that corresponds to a given value + // of t with k degrees of freedom. This algorithm is translated from a + // pascal function on p81 of "Statistical Computing in Pascal" by D + // Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd: + // London). The above Pascal algorithm is itself a translation of the + // fortran algoritm "AS 3" by B E Cooper of the Atlas Computer + // Laboratory as reported in (among other places) "Applied Statistics + // Algorithms", editied by P Griffiths and I D Hill (1985; Ellis + // Horwood Ltd.; W. Sussex, England). +// $ta = 2 / pi(); + $ta = 0.636619772367581; + $tterm = $degrees; + $ttheta = atan2($value,sqrt($tterm)); + $tc = cos($ttheta); + $ts = sin($ttheta); + $tsum = 0; + + if (($degrees % 2) == 1) { + $ti = 3; + $tterm = $tc; + } else { + $ti = 2; + $tterm = 1; + } + + $tsum = $tterm; + while ($ti < $degrees) { + $tterm *= $tc * $tc * ($ti - 1) / $ti; + $tsum += $tterm; + $ti += 2; + } + $tsum *= $ts; + if (($degrees % 2) == 1) { $tsum = $ta * ($tsum + $ttheta); } + $tValue = 0.5 * (1 + $tsum); + if ($tails == 1) { + return 1 - abs($tValue); + } else { + return 1 - abs((1 - $tValue) - $tValue); + } + } + return self::$_errorCodes['value']; + } // function TDIST() + + + /** + * TINV + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $probability Probability for the function + * @param float $degrees degrees of freedom + * @return float + */ + public static function TINV($probability, $degrees) { + $probability = self::flattenSingleValue($probability); + $degrees = floor(self::flattenSingleValue($degrees)); + + if ((is_numeric($probability)) && (is_numeric($degrees))) { + $xLo = 100; + $xHi = 0; + $maxIteration = 100; + + $x = $xNew = 1; + $dx = 1; + $i = 0; + + while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $result = self::TDIST($x, $degrees, 2); + $error = $result - $probability; + if ($error == 0.0) { + $dx = 0; + } elseif ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + // Avoid division by zero + if ($result != 0.0) { + $dx = $error / $result; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == MAX_ITERATIONS) { + return self::$_errorCodes['na']; + } + return round($x,12); + } + return self::$_errorCodes['value']; + } // function TINV() + + + /** + * CONFIDENCE + * + * Returns the confidence interval for a population mean + * + * @param float $alpha + * @param float $stdDev Standard Deviation + * @param float $size + * @return float + * + */ + public static function CONFIDENCE($alpha,$stdDev,$size) { + $alpha = self::flattenSingleValue($alpha); + $stdDev = self::flattenSingleValue($stdDev); + $size = floor(self::flattenSingleValue($size)); + + if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) { + if (($alpha <= 0) || ($alpha >= 1)) { + return self::$_errorCodes['num']; + } + if (($stdDev <= 0) || ($size < 1)) { + return self::$_errorCodes['num']; + } + return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size); + } + return self::$_errorCodes['value']; + } // function CONFIDENCE() + + + /** + * POISSON + * + * Returns the Poisson distribution. A common application of the Poisson distribution + * is predicting the number of events over a specific time, such as the number of + * cars arriving at a toll plaza in 1 minute. + * + * @param float $value + * @param float $mean Mean Value + * @param boolean $cumulative + * @return float + * + */ + public static function POISSON($value, $mean, $cumulative) { + $value = self::flattenSingleValue($value); + $mean = self::flattenSingleValue($mean); + + if ((is_numeric($value)) && (is_numeric($mean))) { + if (($value <= 0) || ($mean <= 0)) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + $summer = 0; + for ($i = 0; $i <= floor($value); ++$i) { + $summer += pow($mean,$i) / self::FACT($i); + } + return exp(0-$mean) * $summer; + } else { + return (exp(0-$mean) * pow($mean,$value)) / self::FACT($value); + } + } + } + return self::$_errorCodes['value']; + } // function POISSON() + + + /** + * WEIBULL + * + * Returns the Weibull distribution. Use this distribution in reliability + * analysis, such as calculating a device's mean time to failure. + * + * @param float $value + * @param float $alpha Alpha Parameter + * @param float $beta Beta Parameter + * @param boolean $cumulative + * @return float + * + */ + public static function WEIBULL($value, $alpha, $beta, $cumulative) { + $value = self::flattenSingleValue($value); + $alpha = self::flattenSingleValue($alpha); + $beta = self::flattenSingleValue($beta); + + if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) { + if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) { + return self::$_errorCodes['num']; + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 1 - exp(0 - pow($value / $beta,$alpha)); + } else { + return ($alpha / pow($beta,$alpha)) * pow($value,$alpha - 1) * exp(0 - pow($value / $beta,$alpha)); + } + } + } + return self::$_errorCodes['value']; + } // function WEIBULL() + + + /** + * SKEW + * + * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry + * of a distribution around its mean. Positive skewness indicates a distribution with an + * asymmetric tail extending toward more positive values. Negative skewness indicates a + * distribution with an asymmetric tail extending toward more negative values. + * + * @param array Data Series + * @return float + */ + public static function SKEW() { + $aArgs = self::flattenArray(func_get_args()); + $mean = self::AVERAGE($aArgs); + $stdDev = self::STDEV($aArgs); + + $count = $summer = 0; + // Loop through arguments + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summer += pow((($arg - $mean) / $stdDev),3) ; + ++$count; + } + } + + // Return + if ($count > 2) { + return $summer * ($count / (($count-1) * ($count-2))); + } + return self::$_errorCodes['divisionbyzero']; + } // function SKEW() + + + /** + * KURT + * + * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness + * or flatness of a distribution compared with the normal distribution. Positive + * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a + * relatively flat distribution. + * + * @param array Data Series + * @return float + */ + public static function KURT() { + $aArgs = self::flattenArray(func_get_args()); + $mean = self::AVERAGE($aArgs); + $stdDev = self::STDEV($aArgs); + + if ($stdDev > 0) { + $count = $summer = 0; + // Loop through arguments + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summer += pow((($arg - $mean) / $stdDev),4) ; + ++$count; + } + } + + // Return + if ($count > 3) { + return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1,2) / (($count-2) * ($count-3))); + } + } + return self::$_errorCodes['divisionbyzero']; + } // function KURT() + + + /** + * RAND + * + * @param int $min Minimal value + * @param int $max Maximal value + * @return int Random number + */ + public static function RAND($min = 0, $max = 0) { + $min = self::flattenSingleValue($min); + $max = self::flattenSingleValue($max); + + if ($min == 0 && $max == 0) { + return (rand(0,10000000)) / 10000000; + } else { + return rand($min, $max); + } + } // function RAND() + + + /** + * MOD + * + * @param int $a Dividend + * @param int $b Divisor + * @return int Remainder + */ + public static function MOD($a = 1, $b = 1) { + $a = self::flattenSingleValue($a); + $b = self::flattenSingleValue($b); + + return fmod($a,$b); + } // function MOD() + + + /** + * CHARACTER + * + * @param string $character Value + * @return int + */ + public static function CHARACTER($character) { + $character = self::flattenSingleValue($character); + + if (function_exists('mb_convert_encoding')) { + return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES'); + } else { + return chr(intval($character)); + } + } + + /** + * ASCIICODE + * + * @param string $character Value + * @return int + */ + public static function ASCIICODE($characters) { + $characters = self::flattenSingleValue($characters); + if (is_bool($characters)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $characters = (int) $characters; + } else { + if ($characters) { + $characters = 'True'; + } else { + $characters = 'False'; + } + } + } + + if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) { + if (mb_strlen($characters, 'UTF-8') > 0) { + $character = mb_substr($characters, 0, 1, 'UTF-8'); + $byteLength = strlen($character); + $xValue = 0; + for ($i = 0; $i < $byteLength; ++$i) { + $xValue = ($xValue * 256) + ord($character{$i}); + } + return $xValue; + } + } else { + if (strlen($characters) > 0) { + return ord(substr($characters, 0, 1)); + } + } + return self::$_errorCodes['value']; + } // function ASCIICODE() + + + /** + * CONCATENATE + * + * @return string + */ + public static function CONCATENATE() { + // Return value + $returnValue = ''; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + if (is_bool($arg)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $arg = (int) $arg; + } else { + if ($arg) { + $arg = 'TRUE'; + } else { + $arg = 'FALSE'; + } + } + } + $returnValue .= $arg; + } + + // Return + return $returnValue; + } // function CONCATENATE() + + + /** + * STRINGLENGTH + * + * @param string $value Value + * @param int $chars Number of characters + * @return string + */ + public static function STRINGLENGTH($value = '') { + $value = self::flattenSingleValue($value); + + if (function_exists('mb_strlen')) { + return mb_strlen($value, 'UTF-8'); + } else { + return strlen($value); + } + } // function STRINGLENGTH() + + + /** + * SEARCHSENSITIVE + * + * @param string $needle The string to look for + * @param string $haystack The string in which to look + * @param int $offset Offset within $haystack + * @return string + */ + public static function SEARCHSENSITIVE($needle,$haystack,$offset=1) { + $needle = (string) self::flattenSingleValue($needle); + $haystack = (string) self::flattenSingleValue($haystack); + $offset = self::flattenSingleValue($offset); + + if (($offset > 0) && (strlen($haystack) > $offset)) { + if (function_exists('mb_strpos')) { + $pos = mb_strpos($haystack, $needle, --$offset,'UTF-8'); + } else { + $pos = strpos($haystack, $needle, --$offset); + } + if ($pos !== false) { + return ++$pos; + } + } + return self::$_errorCodes['value']; + } // function SEARCHSENSITIVE() + + + /** + * SEARCHINSENSITIVE + * + * @param string $needle The string to look for + * @param string $haystack The string in which to look + * @param int $offset Offset within $haystack + * @return string + */ + public static function SEARCHINSENSITIVE($needle,$haystack,$offset=1) { + $needle = (string) self::flattenSingleValue($needle); + $haystack = (string) self::flattenSingleValue($haystack); + $offset = self::flattenSingleValue($offset); + + if (($offset > 0) && (strlen($haystack) > $offset)) { + if (function_exists('mb_stripos')) { + $pos = mb_stripos($haystack, $needle, --$offset,'UTF-8'); + } else { + $pos = stripos($haystack, $needle, --$offset); + } + if ($pos !== false) { + return ++$pos; + } + } + return self::$_errorCodes['value']; + } // function SEARCHINSENSITIVE() + + + /** + * LEFT + * + * @param string $value Value + * @param int $chars Number of characters + * @return string + */ + public static function LEFT($value = '', $chars = 1) { + $value = self::flattenSingleValue($value); + $chars = self::flattenSingleValue($chars); + + if (function_exists('mb_substr')) { + return mb_substr($value, 0, $chars, 'UTF-8'); + } else { + return substr($value, 0, $chars); + } + } // function LEFT() + + + /** + * RIGHT + * + * @param string $value Value + * @param int $chars Number of characters + * @return string + */ + public static function RIGHT($value = '', $chars = 1) { + $value = self::flattenSingleValue($value); + $chars = self::flattenSingleValue($chars); + + if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) { + return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8'); + } else { + return substr($value, strlen($value) - $chars); + } + } // function RIGHT() + + + /** + * MID + * + * @param string $value Value + * @param int $start Start character + * @param int $chars Number of characters + * @return string + */ + public static function MID($value = '', $start = 1, $chars = null) { + $value = self::flattenSingleValue($value); + $start = self::flattenSingleValue($start); + $chars = self::flattenSingleValue($chars); + + if (function_exists('mb_substr')) { + return mb_substr($value, --$start, $chars, 'UTF-8'); + } else { + return substr($value, --$start, $chars); + } + } // function MID() + + + /** + * REPLACE + * + * @param string $value Value + * @param int $start Start character + * @param int $chars Number of characters + * @return string + */ + public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) { + $oldText = self::flattenSingleValue($oldText); + $start = self::flattenSingleValue($start); + $chars = self::flattenSingleValue($chars); + $newText = self::flattenSingleValue($newText); + + $left = self::LEFT($oldText,$start-1); + $right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1); + + return $left.$newText.$right; + } // function REPLACE() + + + /** + * RETURNSTRING + * + * @param mixed $value Value to check + * @return boolean + */ + public static function RETURNSTRING($testValue = '') { + $testValue = self::flattenSingleValue($testValue); + + if (is_string($testValue)) { + return $testValue; + } + return Null; + } // function RETURNSTRING() + + + /** + * FIXEDFORMAT + * + * @param mixed $value Value to check + * @return boolean + */ + public static function FIXEDFORMAT($value,$decimals=2,$no_commas=false) { + $value = self::flattenSingleValue($value); + $decimals = self::flattenSingleValue($decimals); + $no_commas = self::flattenSingleValue($no_commas); + + $valueResult = round($value,$decimals); + if ($decimals < 0) { $decimals = 0; } + if (!$no_commas) { + $valueResult = number_format($valueResult,$decimals); + } + + return (string) $valueResult; + } // function FIXEDFORMAT() + + + /** + * TEXTFORMAT + * + * @param mixed $value Value to check + * @return boolean + */ + public static function TEXTFORMAT($value,$format) { + $value = self::flattenSingleValue($value); + $format = self::flattenSingleValue($format); + + return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format); + } // function TEXTFORMAT() + + + /** + * TRIMSPACES + * + * @param mixed $value Value to check + * @return string + */ + public static function TRIMSPACES($stringValue = '') { + $stringValue = self::flattenSingleValue($stringValue); + + if (is_string($stringValue) || is_numeric($stringValue)) { + return trim(preg_replace('/ +/',' ',$stringValue)); + } + return Null; + } // function TRIMSPACES() + + + private static $_invalidChars = Null; + + /** + * TRIMNONPRINTABLE + * + * @param mixed $value Value to check + * @return string + */ + public static function TRIMNONPRINTABLE($stringValue = '') { + $stringValue = self::flattenSingleValue($stringValue); + + if (self::$_invalidChars == Null) { + self::$_invalidChars = range(chr(0),chr(31)); + } + + if (is_string($stringValue) || is_numeric($stringValue)) { + return str_replace(self::$_invalidChars,'',trim($stringValue,"\x00..\x1F")); + } + return Null; + } // function TRIMNONPRINTABLE() + + + /** + * ERROR_TYPE + * + * @param mixed $value Value to check + * @return boolean + */ + public static function ERROR_TYPE($value = '') { + $value = self::flattenSingleValue($value); + + $i = 1; + foreach(self::$_errorCodes as $errorCode) { + if ($value == $errorCode) { + return $i; + } + ++$i; + } + return self::$_errorCodes['na']; + } // function ERROR_TYPE() + + + /** + * IS_BLANK + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_BLANK($value = null) { + if (!is_null($value)) { + $value = self::flattenSingleValue($value); + } + + return is_null($value); + } // function IS_BLANK() + + + /** + * IS_ERR + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_ERR($value = '') { + $value = self::flattenSingleValue($value); + + return self::IS_ERROR($value) && (!self::IS_NA($value)); + } // function IS_ERR() + + + /** + * IS_ERROR + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_ERROR($value = '') { + $value = self::flattenSingleValue($value); + + return in_array($value, array_values(self::$_errorCodes)); + } // function IS_ERROR() + + + /** + * IS_NA + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_NA($value = '') { + $value = self::flattenSingleValue($value); + + return ($value === self::$_errorCodes['na']); + } // function IS_NA() + + + /** + * IS_EVEN + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_EVEN($value = 0) { + $value = self::flattenSingleValue($value); + + if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return self::$_errorCodes['value']; + } + return ($value % 2 == 0); + } // function IS_EVEN() + + + /** + * IS_ODD + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_ODD($value = null) { + $value = self::flattenSingleValue($value); + + if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return self::$_errorCodes['value']; + } + return (abs($value) % 2 == 1); + } // function IS_ODD() + + + /** + * IS_NUMBER + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_NUMBER($value = 0) { + $value = self::flattenSingleValue($value); + + if (is_string($value)) { + return False; + } + return is_numeric($value); + } // function IS_NUMBER() + + + /** + * IS_LOGICAL + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_LOGICAL($value = true) { + $value = self::flattenSingleValue($value); + + return is_bool($value); + } // function IS_LOGICAL() + + + /** + * IS_TEXT + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_TEXT($value = '') { + $value = self::flattenSingleValue($value); + + return is_string($value); + } // function IS_TEXT() + + + /** + * IS_NONTEXT + * + * @param mixed $value Value to check + * @return boolean + */ + public static function IS_NONTEXT($value = '') { + return !self::IS_TEXT($value); + } // function IS_NONTEXT() + + + /** + * VERSION + * + * @return string Version information + */ + public static function VERSION() { + return 'PHPExcel 1.7.0, 2009-08-10'; + } // function VERSION() + + + /** + * DATE + * + * @param long $year + * @param long $month + * @param long $day + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATE($year = 0, $month = 1, $day = 1) { + $year = (integer) self::flattenSingleValue($year); + $month = (integer) self::flattenSingleValue($month); + $day = (integer) self::flattenSingleValue($day); + + $baseYear = PHPExcel_Shared_Date::getExcelCalendar(); + // Validate parameters + if ($year < ($baseYear-1900)) { + return self::$_errorCodes['num']; + } + if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { + return self::$_errorCodes['num']; + } + + if (($year < $baseYear) && ($year >= ($baseYear-1900))) { + $year += 1900; + } + + if ($month < 1) { + // Handle year/month adjustment if month < 1 + --$month; + $year += ceil($month / 12) - 1; + $month = 13 - abs($month % 12); + } elseif ($month > 12) { + // Handle year/month adjustment if month > 12 + $year += floor($month / 12); + $month = ($month % 12); + } + + // Re-validate the year parameter after adjustments + if (($year < $baseYear) || ($year >= 10000)) { + return self::$_errorCodes['num']; + } + + // Execute function + $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day); + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) $excelDateValue; + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); + break; + case self::RETURNDATE_PHP_OBJECT : return PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue); + break; + } + } // function DATE() + + + /** + * TIME + * + * @param long $hour + * @param long $minute + * @param long $second + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function TIME($hour = 0, $minute = 0, $second = 0) { + $hour = self::flattenSingleValue($hour); + $minute = self::flattenSingleValue($minute); + $second = self::flattenSingleValue($second); + + if ($hour == '') { $hour = 0; } + if ($minute == '') { $minute = 0; } + if ($second == '') { $second = 0; } + + if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) { + return self::$_errorCodes['value']; + } + $hour = (integer) $hour; + $minute = (integer) $minute; + $second = (integer) $second; + + if ($second < 0) { + $minute += floor($second / 60); + $second = 60 - abs($second % 60); + if ($second == 60) { $second = 0; } + } elseif ($second >= 60) { + $minute += floor($second / 60); + $second = $second % 60; + } + if ($minute < 0) { + $hour += floor($minute / 60); + $minute = 60 - abs($minute % 60); + if ($minute == 60) { $minute = 0; } + } elseif ($minute >= 60) { + $hour += floor($minute / 60); + $minute = $minute % 60; + } + + if ($hour > 23) { + $hour = $hour % 24; + } elseif ($hour < 0) { + return self::$_errorCodes['num']; + } + + // Execute function + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : $date = 0; + $calendar = PHPExcel_Shared_Date::getExcelCalendar(); + if ($calendar != PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900) { + $date = 1; + } + return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour-1, $minute, $second)); // -2147468400; // -2147472000 + 3600 + break; + case self::RETURNDATE_PHP_OBJECT : $dayAdjust = 0; + if ($hour < 0) { + $dayAdjust = floor($hour / 24); + $hour = 24 - abs($hour % 24); + if ($hour == 24) { $hour = 0; } + } elseif ($hour >= 24) { + $dayAdjust = floor($hour / 24); + $hour = $hour % 24; + } + $phpDateObject = new DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); + if ($dayAdjust != 0) { + $phpDateObject->modify($dayAdjust.' days'); + } + return $phpDateObject; + break; + } + } // function TIME() + + + /** + * DATEVALUE + * + * @param string $dateValue + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATEVALUE($dateValue = 1) { + $dateValue = str_replace(array('/','.',' '),array('-','-','-'),self::flattenSingleValue(trim($dateValue,'"'))); + + $yearFound = false; + $t1 = explode('-',$dateValue); + foreach($t1 as &$t) { + if ((is_numeric($t)) && (($t > 31) && ($t < 100))) { + if ($yearFound) { + return self::$_errorCodes['value']; + } else { + $t += 1900; + $yearFound = true; + } + } + } + unset($t); + $dateValue = implode('-',$t1); + + $PHPDateArray = date_parse($dateValue); + if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) { + $testVal1 = strtok($dateValue,'- '); + if ($testVal1 !== False) { + $testVal2 = strtok('- '); + if ($testVal2 !== False) { + $testVal3 = strtok('- '); + if ($testVal3 === False) { + $testVal3 = strftime('%Y'); + } + } else { + return self::$_errorCodes['value']; + } + } else { + return self::$_errorCodes['value']; + } + $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); + if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) { + $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); + if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) { + return self::$_errorCodes['value']; + } + } + } + + if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) { + // Execute function + if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); } + if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); } + if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); } + $excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second'])); + + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) $excelDateValue; + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); + break; + case self::RETURNDATE_PHP_OBJECT : return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); + break; + } + } + return self::$_errorCodes['value']; + } // function DATEVALUE() + + + /** + * _getDateValue + * + * @param string $dateValue + * @return mixed Excel date/time serial value, or string if error + */ + private static function _getDateValue($dateValue) { + if (!is_numeric($dateValue)) { + if ((is_string($dateValue)) && (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC)) { + return self::$_errorCodes['value']; + } + if ((is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) { + $dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue); + } else { + $saveReturnDateType = self::getReturnDateType(); + self::setReturnDateType(self::RETURNDATE_EXCEL); + $dateValue = self::DATEVALUE($dateValue); + self::setReturnDateType($saveReturnDateType); + } + } + return $dateValue; + } // function _getDateValue() + + + /** + * TIMEVALUE + * + * @param string $timeValue + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function TIMEVALUE($timeValue) { + $timeValue = self::flattenSingleValue($timeValue); + + if ((($PHPDateArray = date_parse($timeValue)) !== False) && ($PHPDateArray['error_count'] == 0)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']); + } else { + $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900,1,1,$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']) - 1; + } + + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) $excelDateValue; + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;; + break; + case self::RETURNDATE_PHP_OBJECT : return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); + break; + } + } + return self::$_errorCodes['value']; + } // function TIMEVALUE() + + + /** + * _getTimeValue + * + * @param string $timeValue + * @return mixed Excel date/time serial value, or string if error + */ + private static function _getTimeValue($timeValue) { + $saveReturnDateType = self::getReturnDateType(); + self::setReturnDateType(self::RETURNDATE_EXCEL); + $timeValue = self::TIMEVALUE($timeValue); + self::setReturnDateType($saveReturnDateType); + return $timeValue; + } // function _getTimeValue() + + + /** + * DATETIMENOW + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATETIMENOW() { + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $retValue = False; + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : $retValue = (float) PHPExcel_Shared_Date::PHPToExcel(time()); + break; + case self::RETURNDATE_PHP_NUMERIC : $retValue = (integer) time(); + break; + case self::RETURNDATE_PHP_OBJECT : $retValue = new DateTime(); + break; + } + date_default_timezone_set($saveTimeZone); + + return $retValue; + } // function DATETIMENOW() + + + /** + * DATENOW + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATENOW() { + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $retValue = False; + $excelDateTime = floor(PHPExcel_Shared_Date::PHPToExcel(time())); + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : $retValue = (float) $excelDateTime; + break; + case self::RETURNDATE_PHP_NUMERIC : $retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime) - 3600; + break; + case self::RETURNDATE_PHP_OBJECT : $retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime); + break; + } + date_default_timezone_set($saveTimeZone); + + return $retValue; + } // function DATENOW() + + + private static function _isLeapYear($year) { + return ((($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0)); + } // function _isLeapYear() + + + private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) { + if ($startDay == 31) { + --$startDay; + } elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || ($startDay == 28 && !self::_isLeapYear($startYear))))) { + $startDay = 30; + } + if ($endDay == 31) { + if ($methodUS && $startDay != 30) { + $endDay = 1; + if ($endMonth == 12) { + ++$endYear; + $endMonth = 1; + } else { + ++$endMonth; + } + } else { + $endDay = 30; + } + } + + return $endDay + $endMonth * 30 + $endYear * 360 - $startDay - $startMonth * 30 - $startYear * 360; + } // function _dateDiff360() + + + /** + * DAYS360 + * + * @param long $startDate Excel date serial value or a standard date string + * @param long $endDate Excel date serial value or a standard date string + * @param boolean $method US or European Method + * @return long PHP date/time serial + */ + public static function DAYS360($startDate = 0, $endDate = 0, $method = false) { + $startDate = self::flattenSingleValue($startDate); + $endDate = self::flattenSingleValue($endDate); + + if (is_string($startDate = self::_getDateValue($startDate))) { + return self::$_errorCodes['value']; + } + if (is_string($endDate = self::_getDateValue($endDate))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); + $startDay = $PHPStartDateObject->format('j'); + $startMonth = $PHPStartDateObject->format('n'); + $startYear = $PHPStartDateObject->format('Y'); + + $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + $endDay = $PHPEndDateObject->format('j'); + $endMonth = $PHPEndDateObject->format('n'); + $endYear = $PHPEndDateObject->format('Y'); + + return self::_dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method); + } // function DAYS360() + + + /** + * DATEDIF + * + * @param long $startDate Excel date serial value or a standard date string + * @param long $endDate Excel date serial value or a standard date string + * @param string $unit + * @return long Interval between the dates + */ + public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') { + $startDate = self::flattenSingleValue($startDate); + $endDate = self::flattenSingleValue($endDate); + $unit = strtoupper(self::flattenSingleValue($unit)); + + if (is_string($startDate = self::_getDateValue($startDate))) { + return self::$_errorCodes['value']; + } + if (is_string($endDate = self::_getDateValue($endDate))) { + return self::$_errorCodes['value']; + } + + // Validate parameters + if ($startDate >= $endDate) { + return self::$_errorCodes['num']; + } + + // Execute function + $difference = $endDate - $startDate; + + $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); + $startDays = $PHPStartDateObject->format('j'); + $startMonths = $PHPStartDateObject->format('n'); + $startYears = $PHPStartDateObject->format('Y'); + + $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + $endDays = $PHPEndDateObject->format('j'); + $endMonths = $PHPEndDateObject->format('n'); + $endYears = $PHPEndDateObject->format('Y'); + + $retVal = self::$_errorCodes['num']; + switch ($unit) { + case 'D': + $retVal = intval($difference); + break; + case 'M': + $retVal = intval($endMonths - $startMonths) + (intval($endYears - $startYears) * 12); + // We're only interested in full months + if ($endDays < $startDays) { + --$retVal; + } + break; + case 'Y': + $retVal = intval($endYears - $startYears); + // We're only interested in full months + if ($endMonths < $startMonths) { + --$retVal; + } elseif (($endMonths == $startMonths) && ($endDays < $startDays)) { + --$retVal; + } + break; + case 'MD': + if ($endDays < $startDays) { + $retVal = $endDays; + $PHPEndDateObject->modify('-'.$endDays.' days'); + $adjustDays = $PHPEndDateObject->format('j'); + if ($adjustDays > $startDays) { + $retVal += ($adjustDays - $startDays); + } + } else { + $retVal = $endDays - $startDays; + } + break; + case 'YM': + $retVal = abs(intval($endMonths - $startMonths)); + // We're only interested in full months + if ($endDays < $startDays) { + --$retVal; + } + break; + case 'YD': + $retVal = intval($difference); + if ($endYears > $startYears) { + while ($endYears > $startYears) { + $PHPEndDateObject->modify('-1 year'); + $endYears = $PHPEndDateObject->format('Y'); + } + $retVal = abs($PHPEndDateObject->format('z') - $PHPStartDateObject->format('z')); + } + break; + } + return $retVal; + } // function DATEDIF() + + + /** + * YEARFRAC + * + * Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the + * end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations + * to assign to a specific term. + * + * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer) or date object, or a standard date string + * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer) or date object, or a standard date string + * @param integer $method Method used for the calculation + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float fraction of the year + */ + public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) { + $startDate = self::flattenSingleValue($startDate); + $endDate = self::flattenSingleValue($endDate); + $method = self::flattenSingleValue($method); + + if (is_string($startDate = self::_getDateValue($startDate))) { + return self::$_errorCodes['value']; + } + if (is_string($endDate = self::_getDateValue($endDate))) { + return self::$_errorCodes['value']; + } + + if ((is_numeric($method)) && (!is_string($method))) { + switch($method) { + case 0 : + return self::DAYS360($startDate,$endDate) / 360; + break; + case 1 : + $startYear = self::YEAR($startDate); + $endYear = self::YEAR($endDate); + $leapDay = 0; + if (self::_isLeapYear($startYear) || self::_isLeapYear($endYear)) { + $leapDay = 1; + } + return self::DATEDIF($startDate,$endDate) / (365 + $leapDay); + break; + case 2 : + return self::DATEDIF($startDate,$endDate) / 360; + break; + case 3 : + return self::DATEDIF($startDate,$endDate) / 365; + break; + case 4 : + return self::DAYS360($startDate,$endDate,True) / 360; + break; + } + } + return self::$_errorCodes['value']; + } // function YEARFRAC() + + + /** + * NETWORKDAYS + * + * @param mixed Start date + * @param mixed End date + * @param array of mixed Optional Date Series + * @return long Interval between the dates + */ + public static function NETWORKDAYS($startDate,$endDate) { + // Flush the mandatory start and end date that are referenced in the function definition + $dateArgs = self::flattenArray(func_get_args()); + array_shift($dateArgs); + array_shift($dateArgs); + + // Validate the start and end dates + if (is_string($startDate = $sDate = self::_getDateValue($startDate))) { + return self::$_errorCodes['value']; + } + if (is_string($endDate = $eDate = self::_getDateValue($endDate))) { + return self::$_errorCodes['value']; + } + + if ($sDate > $eDate) { + $startDate = $eDate; + $endDate = $sDate; + } + + // Execute function + $startDoW = 6 - self::DAYOFWEEK($startDate,2); + if ($startDoW < 0) { $startDoW = 0; } + $endDoW = self::DAYOFWEEK($endDate,2); + if ($endDoW >= 6) { $endDoW = 0; } + + $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5; + $partWeekDays = $endDoW + $startDoW; + if ($partWeekDays > 5) { + $partWeekDays -= 5; + } + + // Test any extra holiday parameters + $holidayCountedArray = array(); + foreach ($dateArgs as $holidayDate) { + if (is_string($holidayDate = self::_getDateValue($holidayDate))) { + return self::$_errorCodes['value']; + } + if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) { + if ((self::DAYOFWEEK($holidayDate,2) < 6) && (!in_array($holidayDate,$holidayCountedArray))) { + --$partWeekDays; + $holidayCountedArray[] = $holidayDate; + } + } + } + + if ($sDate > $eDate) { + return 0 - ($wholeWeekDays + $partWeekDays); + } + return $wholeWeekDays + $partWeekDays; + } // function NETWORKDAYS() + + + /** + * WORKDAY + * + * @param mixed Start date + * @param mixed number of days for adjustment + * @param array of mixed Optional Date Series + * @return long Interval between the dates + */ + public static function WORKDAY($startDate,$endDays) { + $dateArgs = self::flattenArray(func_get_args()); + + array_shift($dateArgs); + array_shift($dateArgs); + + if (is_string($startDate = self::_getDateValue($startDate))) { + return self::$_errorCodes['value']; + } + if (!is_numeric($endDays)) { + return self::$_errorCodes['value']; + } + $endDate = (float) $startDate + (floor($endDays / 5) * 7) + ($endDays % 5); + if ($endDays < 0) { + $endDate += 7; + } + + $endDoW = self::DAYOFWEEK($endDate,3); + if ($endDoW >= 5) { + if ($endDays >= 0) { + $endDate += (7 - $endDoW); + } else { + $endDate -= ($endDoW - 5); + } + } + + // Test any extra holiday parameters + if (count($dateArgs) > 0) { + $holidayCountedArray = $holidayDates = array(); + foreach ($dateArgs as $holidayDate) { + if (is_string($holidayDate = self::_getDateValue($holidayDate))) { + return self::$_errorCodes['value']; + } + $holidayDates[] = $holidayDate; + } + if ($endDays >= 0) { + sort($holidayDates, SORT_NUMERIC); + } else { + rsort($holidayDates, SORT_NUMERIC); + } + foreach ($holidayDates as $holidayDate) { + if ($endDays >= 0) { + if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) { + if ((self::DAYOFWEEK($holidayDate,2) < 6) && (!in_array($holidayDate,$holidayCountedArray))) { + ++$endDate; + $holidayCountedArray[] = $holidayDate; + } + } + } else { + if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) { + if ((self::DAYOFWEEK($holidayDate,2) < 6) && (!in_array($holidayDate,$holidayCountedArray))) { + --$endDate; + $holidayCountedArray[] = $holidayDate; + } + } + } + $endDoW = self::DAYOFWEEK($endDate,3); + if ($endDoW >= 5) { + if ($endDays >= 0) { + $endDate += (7 - $endDoW); + } else { + $endDate -= ($endDoW - 5); + } + } + } + } + + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) $endDate; + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate); + break; + case self::RETURNDATE_PHP_OBJECT : return PHPExcel_Shared_Date::ExcelToPHPObject($endDate); + break; + } + } // function WORKDAY() + + + /** + * DAYOFMONTH + * + * @param long $dateValue Excel date serial value or a standard date string + * @return int Day + */ + public static function DAYOFMONTH($dateValue = 1) { + $dateValue = self::flattenSingleValue($dateValue); + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = &PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + + return (int) $PHPDateObject->format('j'); + } // function DAYOFMONTH() + + + /** + * DAYOFWEEK + * + * @param long $dateValue Excel date serial value or a standard date string + * @return int Day + */ + public static function DAYOFWEEK($dateValue = 1, $style = 1) { + $dateValue = self::flattenSingleValue($dateValue); + $style = floor(self::flattenSingleValue($style)); + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $DoW = $PHPDateObject->format('w'); + + $firstDay = 1; + switch ($style) { + case 1: ++$DoW; + break; + case 2: if ($DoW == 0) { $DoW = 7; } + break; + case 3: if ($DoW == 0) { $DoW = 7; } + $firstDay = 0; + --$DoW; + break; + default: + } + if (self::$compatibilityMode == self::COMPATIBILITY_EXCEL) { + // Test for Excel's 1900 leap year, and introduce the error as required + if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) { + --$DoW; + if ($DoW < $firstDay) { + $DoW += 7; + } + } + } + + return (int) $DoW; + } // function DAYOFWEEK() + + + /** + * WEEKOFYEAR + * + * @param long $dateValue Excel date serial value or a standard date string + * @param boolean $method Week begins on Sunday or Monday + * @return int Week Number + */ + public static function WEEKOFYEAR($dateValue = 1, $method = 1) { + $dateValue = self::flattenSingleValue($dateValue); + $method = floor(self::flattenSingleValue($method)); + + if (!is_numeric($method)) { + return self::$_errorCodes['value']; + } elseif (($method < 1) || ($method > 2)) { + return self::$_errorCodes['num']; + } + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $dayOfYear = $PHPDateObject->format('z'); + $dow = $PHPDateObject->format('w'); + $PHPDateObject->modify('-'.$dayOfYear.' days'); + $dow = $PHPDateObject->format('w'); + $daysInFirstWeek = 7 - (($dow + (2 - $method)) % 7); + $dayOfYear -= $daysInFirstWeek; + $weekOfYear = ceil($dayOfYear / 7) + 1; + + return (int) $weekOfYear; + } // function WEEKOFYEAR() + + + /** + * MONTHOFYEAR + * + * @param long $dateValue Excel date serial value or a standard date string + * @return int Month + */ + public static function MONTHOFYEAR($dateValue = 1) { + $dateValue = self::flattenSingleValue($dateValue); + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + + return (int) $PHPDateObject->format('n'); + } // function MONTHOFYEAR() + + + /** + * YEAR + * + * @param long $dateValue Excel date serial value or a standard date string + * @return int Year + */ + public static function YEAR($dateValue = 1) { + $dateValue = self::flattenSingleValue($dateValue); + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + + return (int) $PHPDateObject->format('Y'); + } // function YEAR() + + + /** + * HOUROFDAY + * + * @param mixed $timeValue Excel time serial value or a standard time string + * @return int Hour + */ + public static function HOUROFDAY($timeValue = 0) { + $timeValue = self::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue,'/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return self::$_errorCodes['value']; + } + } + $timeValue = self::_getTimeValue($timeValue); + if (is_string($timeValue)) { + return self::$_errorCodes['value']; + } + } + // Execute function + if (is_real($timeValue)) { + if ($timeValue >= 1) { + $timeValue = fmod($timeValue,1); + } elseif ($timeValue < 0.0) { + return self::$_errorCodes['num']; + } + $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + } + return (int) date('G',$timeValue); + } // function HOUROFDAY() + + + /** + * MINUTEOFHOUR + * + * @param long $timeValue Excel time serial value or a standard time string + * @return int Minute + */ + public static function MINUTEOFHOUR($timeValue = 0) { + $timeValue = $timeTester = self::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue,'/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return self::$_errorCodes['value']; + } + } + $timeValue = self::_getTimeValue($timeValue); + if (is_string($timeValue)) { + return self::$_errorCodes['value']; + } + } + // Execute function + if (is_real($timeValue)) { + if ($timeValue >= 1) { + $timeValue = fmod($timeValue,1); + } elseif ($timeValue < 0.0) { + return self::$_errorCodes['num']; + } + $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + } + return (int) date('i',$timeValue); + } // function MINUTEOFHOUR() + + + /** + * SECONDOFMINUTE + * + * @param long $timeValue Excel time serial value or a standard time string + * @return int Second + */ + public static function SECONDOFMINUTE($timeValue = 0) { + $timeValue = self::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue,'/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return self::$_errorCodes['value']; + } + } + $timeValue = self::_getTimeValue($timeValue); + if (is_string($timeValue)) { + return self::$_errorCodes['value']; + } + } + // Execute function + if (is_real($timeValue)) { + if ($timeValue >= 1) { + $timeValue = fmod($timeValue,1); + } elseif ($timeValue < 0.0) { + return self::$_errorCodes['num']; + } + $timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue); + } + return (int) date('s',$timeValue); + } // function SECONDOFMINUTE() + + + private static function _adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0) { + // Execute function + $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $oMonth = (int) $PHPDateObject->format('m'); + $oYear = (int) $PHPDateObject->format('Y'); + + $adjustmentMonthsString = (string) $adjustmentMonths; + if ($adjustmentMonths > 0) { + $adjustmentMonthsString = '+'.$adjustmentMonths; + } + if ($adjustmentMonths != 0) { + $PHPDateObject->modify($adjustmentMonthsString.' months'); + } + $nMonth = (int) $PHPDateObject->format('m'); + $nYear = (int) $PHPDateObject->format('Y'); + + $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); + if ($monthDiff != $adjustmentMonths) { + $adjustDays = (int) $PHPDateObject->format('d'); + $adjustDaysString = '-'.$adjustDays.' days'; + $PHPDateObject->modify($adjustDaysString); + } + return $PHPDateObject; + } // function _adjustDateByMonths() + + + /** + * EDATE + * + * Returns the serial number that represents the date that is the indicated number of months before or after a specified date + * (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue. + * + * @param long $dateValue Excel date serial value or a standard date string + * @param int $adjustmentMonths Number of months to adjust by + * @return long Excel date serial value + */ + public static function EDATE($dateValue = 1, $adjustmentMonths = 0) { + $dateValue = self::flattenSingleValue($dateValue); + $adjustmentMonths = floor(self::flattenSingleValue($adjustmentMonths)); + + if (!is_numeric($adjustmentMonths)) { + return self::$_errorCodes['value']; + } + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths); + + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); + break; + case self::RETURNDATE_PHP_OBJECT : return $PHPDateObject; + break; + } + } // function EDATE() + + + /** + * EOMONTH + * + * Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. + * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. + * + * @param long $dateValue Excel date serial value or a standard date string + * @param int $adjustmentMonths Number of months to adjust by + * @return long Excel date serial value + */ + public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) { + $dateValue = self::flattenSingleValue($dateValue); + $adjustmentMonths = floor(self::flattenSingleValue($adjustmentMonths)); + + if (!is_numeric($adjustmentMonths)) { + return self::$_errorCodes['value']; + } + + if (is_string($dateValue = self::_getDateValue($dateValue))) { + return self::$_errorCodes['value']; + } + + // Execute function + $PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths+1); + $adjustDays = (int) $PHPDateObject->format('d'); + $adjustDaysString = '-'.$adjustDays.' days'; + $PHPDateObject->modify($adjustDaysString); + + switch (self::getReturnDateType()) { + case self::RETURNDATE_EXCEL : return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject); + break; + case self::RETURNDATE_PHP_NUMERIC : return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject)); + break; + case self::RETURNDATE_PHP_OBJECT : return $PHPDateObject; + break; + } + } // function EOMONTH() + + + /** + * TRUNC + * + * Truncates value to the number of fractional digits by number_digits. + * + * @param float $value + * @param int $number_digits + * @return float Truncated value + */ + public static function TRUNC($value = 0, $number_digits = 0) { + $value = self::flattenSingleValue($value); + $number_digits = self::flattenSingleValue($number_digits); + + // Validate parameters + if ($number_digits < 0) { + return self::$_errorCodes['value']; + } + + // Truncate + if ($number_digits > 0) { + $value = $value * pow(10, $number_digits); + } + $value = intval($value); + if ($number_digits > 0) { + $value = $value / pow(10, $number_digits); + } + + // Return + return $value; + } // function TRUNC() + + /** + * POWER + * + * Computes x raised to the power y. + * + * @param float $x + * @param float $y + * @return float + */ + public static function POWER($x = 0, $y = 2) { + $x = self::flattenSingleValue($x); + $y = self::flattenSingleValue($y); + + // Validate parameters + if ($x == 0 && $y <= 0) { + return self::$_errorCodes['divisionbyzero']; + } + + // Return + return pow($x, $y); + } // function POWER() + + + private static function _nbrConversionFormat($xVal,$places) { + if (!is_null($places)) { + if (strlen($xVal) <= $places) { + return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10); + } else { + return self::$_errorCodes['num']; + } + } + + return substr($xVal,-10); + } // function _nbrConversionFormat() + + + /** + * BINTODEC + * + * Return a binary value as Decimal. + * + * @param string $x + * @return string + */ + public static function BINTODEC($x) { + $x = self::flattenSingleValue($x); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { + return self::$_errorCodes['num']; + } + if (strlen($x) > 10) { + return self::$_errorCodes['num']; + } elseif (strlen($x) == 10) { + // Two's Complement + $x = substr($x,-9); + return '-'.(512-bindec($x)); + } + return bindec($x); + } // function BINTODEC() + + + /** + * BINTOHEX + * + * Return a binary value as Hex. + * + * @param string $x + * @return string + */ + public static function BINTOHEX($x, $places=null) { + $x = floor(self::flattenSingleValue($x)); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { + return self::$_errorCodes['num']; + } + if (strlen($x) > 10) { + return self::$_errorCodes['num']; + } elseif (strlen($x) == 10) { + // Two's Complement + return str_repeat('F',8).substr(strtoupper(dechex(bindec(substr($x,-9)))),-2); + } + $hexVal = (string) strtoupper(dechex(bindec($x))); + + return self::_nbrConversionFormat($hexVal,$places); + } // function BINTOHEX() + + + /** + * BINTOOCT + * + * Return a binary value as Octal. + * + * @param string $x + * @return string + */ + public static function BINTOOCT($x, $places=null) { + $x = floor(self::flattenSingleValue($x)); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + if (self::$compatibilityMode == self::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/',$x,$out)) { + return self::$_errorCodes['num']; + } + if (strlen($x) > 10) { + return self::$_errorCodes['num']; + } elseif (strlen($x) == 10) { + // Two's Complement + return str_repeat('7',7).substr(strtoupper(decoct(bindec(substr($x,-9)))),-3); + } + $octVal = (string) decoct(bindec($x)); + + return self::_nbrConversionFormat($octVal,$places); + } // function BINTOOCT() + + + /** + * DECTOBIN + * + * Return an octal value as binary. + * + * @param string $x + * @return string + */ + public static function DECTOBIN($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { + return self::$_errorCodes['value']; + } + $x = (string) floor($x); + $r = decbin($x); + if (strlen($r) == 32) { + // Two's Complement + $r = substr($r,-10); + } elseif (strlen($r) > 11) { + return self::$_errorCodes['num']; + } + + return self::_nbrConversionFormat($r,$places); + } // function DECTOBIN() + + + /** + * DECTOOCT + * + * Return an octal value as binary. + * + * @param string $x + * @return string + */ + public static function DECTOOCT($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { + return self::$_errorCodes['value']; + } + $x = (string) floor($x); + $r = decoct($x); + if (strlen($r) == 11) { + // Two's Complement + $r = substr($r,-10); + } + + return self::_nbrConversionFormat($r,$places); + } // function DECTOOCT() + + + /** + * DECTOHEX + * + * Return an octal value as binary. + * + * @param string $x + * @return string + */ + public static function DECTOHEX($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + if (self::$compatibilityMode == self::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return self::$_errorCodes['value']; + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { + return self::$_errorCodes['value']; + } + $x = (string) floor($x); + $r = strtoupper(dechex($x)); + if (strlen($r) == 8) { + // Two's Complement + $r = 'FF'.$r; + } + + return self::_nbrConversionFormat($r,$places); + } // function DECTOHEX() + + + /** + * HEXTOBIN + * + * Return a hex value as binary. + * + * @param string $x + * @return string + */ + public static function HEXTOBIN($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { + return self::$_errorCodes['num']; + } + $binVal = decbin(hexdec($x)); + + return substr(self::_nbrConversionFormat($binVal,$places),-10); + } // function HEXTOBIN() + + + /** + * HEXTOOCT + * + * Return a hex value as octal. + * + * @param string $x + * @return string + */ + public static function HEXTOOCT($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { + return self::$_errorCodes['num']; + } + $octVal = decoct(hexdec($x)); + + return self::_nbrConversionFormat($octVal,$places); + } // function HEXTOOCT() + + + /** + * HEXTODEC + * + * Return a hex value as octal. + * + * @param string $x + * @return string + */ + public static function HEXTODEC($x) { + $x = self::flattenSingleValue($x); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) { + return self::$_errorCodes['num']; + } + return hexdec($x); + } // function HEXTODEC() + + + /** + * OCTTOBIN + * + * Return an octal value as binary. + * + * @param string $x + * @return string + */ + public static function OCTTOBIN($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { + return self::$_errorCodes['num']; + } + $binVal = decbin(octdec($x)); + + return self::_nbrConversionFormat($binVal,$places); + } // function OCTTOBIN() + + + /** + * OCTTODEC + * + * Return an octal value as binary. + * + * @param string $x + * @return string + */ + public static function OCTTODEC($x) { + $x = self::flattenSingleValue($x); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { + return self::$_errorCodes['num']; + } + return octdec($x); + } // function OCTTODEC() + + + /** + * OCTTOHEX + * + * Return an octal value as hex. + * + * @param string $x + * @return string + */ + public static function OCTTOHEX($x, $places=null) { + $x = self::flattenSingleValue($x); + $places = self::flattenSingleValue($places); + + if (is_bool($x)) { + return self::$_errorCodes['value']; + } + $x = (string) $x; + if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) { + return self::$_errorCodes['num']; + } + $hexVal = strtoupper(dechex(octdec($x))); + + return self::_nbrConversionFormat($hexVal,$places); + } // function OCTTOHEX() + + + public static function _parseComplex($complexNumber) { + $workString = (string) $complexNumber; + + $realNumber = $imaginary = 0; + // Extract the suffix, if there is one + $suffix = substr($workString,-1); + if (!is_numeric($suffix)) { + $workString = substr($workString,0,-1); + } else { + $suffix = ''; + } + + // Split the input into its Real and Imaginary components + $leadingSign = 0; + if (strlen($workString) > 0) { + $leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0; + } + $power = ''; + $realNumber = strtok($workString, '+-'); + if (strtoupper(substr($realNumber,-1)) == 'E') { + $power = strtok('+-'); + ++$leadingSign; + } + + $realNumber = substr($workString,0,strlen($realNumber)+strlen($power)+$leadingSign); + + if ($suffix != '') { + $imaginary = substr($workString,strlen($realNumber)); + + if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) { + $imaginary = $realNumber.'1'; + $realNumber = '0'; + } else if ($imaginary == '') { + $imaginary = $realNumber; + $realNumber = '0'; + } elseif (($imaginary == '+') || ($imaginary == '-')) { + $imaginary .= '1'; + } + } + + $complexArray = array( 'real' => $realNumber, + 'imaginary' => $imaginary, + 'suffix' => $suffix + ); + + return $complexArray; + } // function _parseComplex() + + + private static function _cleanComplex($complexNumber) { + if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1); + if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber,1); + if ($complexNumber{0} == '.') $complexNumber = '0'.$complexNumber; + if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1); + return $complexNumber; + } + + + /** + * COMPLEX + * + * returns a complex number of the form x + yi or x + yj. + * + * @param float $realNumber + * @param float $imaginary + * @param string $suffix + * @return string + */ + public static function COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i') { + $realNumber = self::flattenSingleValue($realNumber); + $imaginary = self::flattenSingleValue($imaginary); + $suffix = self::flattenSingleValue($suffix); + + if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && + (($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) { + if ($realNumber == 0.0) { + if ($imaginary == 0.0) { + return (string) '0'; + } elseif ($imaginary == 1.0) { + return (string) $suffix; + } elseif ($imaginary == -1.0) { + return (string) '-'.$suffix; + } + return (string) $imaginary.$suffix; + } elseif ($imaginary == 0.0) { + return (string) $realNumber; + } elseif ($imaginary == 1.0) { + return (string) $realNumber.'+'.$suffix; + } elseif ($imaginary == -1.0) { + return (string) $realNumber.'-'.$suffix; + } + if ($imaginary > 0) { $imaginary = (string) '+'.$imaginary; } + return (string) $realNumber.$imaginary.$suffix; + } + return self::$_errorCodes['value']; + } // function COMPLEX() + + + /** + * IMAGINARY + * + * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return real + */ + public static function IMAGINARY($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + return $parsedComplex['imaginary']; + } // function IMAGINARY() + + + /** + * IMREAL + * + * Returns the real coefficient of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return real + */ + public static function IMREAL($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + return $parsedComplex['real']; + } // function IMREAL() + + + /** + * IMABS + * + * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return real + */ + public static function IMABS($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + return sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])); + } // function IMABS() + + + /** + * IMARGUMENT + * + * Returns the argument theta of a complex number, i.e. the angle in radians from the real axis to the representation of the number in polar coordinates. + * + * @param string $complexNumber + * @return string + */ + public static function IMARGUMENT($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if ($parsedComplex['real'] == 0.0) { + if ($parsedComplex['imaginary'] == 0.0) { + return 0.0; + } elseif($parsedComplex['imaginary'] < 0.0) { + return pi() / -2; + } else { + return pi() / 2; + } + } elseif ($parsedComplex['real'] > 0.0) { + return atan($parsedComplex['imaginary'] / $parsedComplex['real']); + } elseif ($parsedComplex['imaginary'] < 0.0) { + return 0 - (pi() - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real']))); + } else { + return pi() - atan($parsedComplex['imaginary'] / abs($parsedComplex['real'])); + } + } // function IMARGUMENT() + + + /** + * IMCONJUGATE + * + * Returns the complex conjugate of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMCONJUGATE($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if ($parsedComplex['imaginary'] == 0.0) { + return $parsedComplex['real']; + } else { + return self::_cleanComplex(self::COMPLEX($parsedComplex['real'], 0 - $parsedComplex['imaginary'], $parsedComplex['suffix'])); + } + } // function IMCONJUGATE() + + + /** + * IMCOS + * + * Returns the cosine of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMCOS($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if ($parsedComplex['imaginary'] == 0.0) { + return cos($parsedComplex['real']); + } else { + return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix'])); + } + } // function IMCOS() + + + /** + * IMSIN + * + * Returns the sine of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMSIN($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if ($parsedComplex['imaginary'] == 0.0) { + return sin($parsedComplex['real']); + } else { + return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']); + } + } // function IMSIN() + + + /** + * IMSQRT + * + * Returns the square root of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMSQRT($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + $theta = self::IMARGUMENT($complexNumber); + $d1 = cos($theta / 2); + $d2 = sin($theta / 2); + $r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']))); + + if ($parsedComplex['suffix'] == '') { + return self::COMPLEX($d1 * $r,$d2 * $r); + } else { + return self::COMPLEX($d1 * $r,$d2 * $r,$parsedComplex['suffix']); + } + } // function IMSQRT() + + + /** + * IMLN + * + * Returns the natural logarithm of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMLN($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return self::$_errorCodes['num']; + } + + $logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']))); + $t = self::IMARGUMENT($complexNumber); + + if ($parsedComplex['suffix'] == '') { + return self::COMPLEX($logR,$t); + } else { + return self::COMPLEX($logR,$t,$parsedComplex['suffix']); + } + } // function IMLN() + + + /** + * IMLOG10 + * + * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMLOG10($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return self::$_errorCodes['num']; + } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return log10($parsedComplex['real']); + } + + return self::IMPRODUCT(log10(EULER),self::IMLN($complexNumber)); + } // function IMLOG10() + + + /** + * IMLOG2 + * + * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMLOG2($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return self::$_errorCodes['num']; + } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return log($parsedComplex['real'],2); + } + + return self::IMPRODUCT(log(EULER,2),self::IMLN($complexNumber)); + } // function IMLOG2() + + + /** + * IMEXP + * + * Returns the exponential of a complex number in x + yi or x + yj text format. + * + * @param string $complexNumber + * @return string + */ + public static function IMEXP($complexNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { + return '1'; + } + + $e = exp($parsedComplex['real']); + $eX = $e * cos($parsedComplex['imaginary']); + $eY = $e * sin($parsedComplex['imaginary']); + + if ($parsedComplex['suffix'] == '') { + return self::COMPLEX($eX,$eY); + } else { + return self::COMPLEX($eX,$eY,$parsedComplex['suffix']); + } + } // function IMEXP() + + + /** + * IMPOWER + * + * Returns a complex number in x + yi or x + yj text format raised to a power. + * + * @param string $complexNumber + * @return string + */ + public static function IMPOWER($complexNumber,$realNumber) { + $complexNumber = self::flattenSingleValue($complexNumber); + $realNumber = self::flattenSingleValue($realNumber); + + if (!is_numeric($realNumber)) { + return self::$_errorCodes['value']; + } + + $parsedComplex = self::_parseComplex($complexNumber); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + $r = sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])); + $rPower = pow($r,$realNumber); + $theta = self::IMARGUMENT($complexNumber) * $realNumber; + if ($theta == 0) { + return 1; + } elseif ($parsedComplex['imaginary'] == 0.0) { + return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']); + } else { + return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']); + } + } // function IMPOWER() + + + /** + * IMDIV + * + * Returns the quotient of two complex numbers in x + yi or x + yj text format. + * + * @param string $complexDividend + * @param string $complexDivisor + * @return real + */ + public static function IMDIV($complexDividend,$complexDivisor) { + $complexDividend = self::flattenSingleValue($complexDividend); + $complexDivisor = self::flattenSingleValue($complexDivisor); + + $parsedComplexDividend = self::_parseComplex($complexDividend); + if (!is_array($parsedComplexDividend)) { + return $parsedComplexDividend; + } + + $parsedComplexDivisor = self::_parseComplex($complexDivisor); + if (!is_array($parsedComplexDivisor)) { + return $parsedComplexDividend; + } + + if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') && + ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) { + return self::$_errorCodes['num']; + } + if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) { + $parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix']; + } + + $d1 = ($parsedComplexDividend['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['imaginary']); + $d2 = ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['real']) - ($parsedComplexDividend['real'] * $parsedComplexDivisor['imaginary']); + $d3 = ($parsedComplexDivisor['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDivisor['imaginary'] * $parsedComplexDivisor['imaginary']); + + $r = $d1/$d3; + $i = $d2/$d3; + + if ($i > 0.0) { + return self::_cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']); + } elseif ($i < 0.0) { + return self::_cleanComplex($r.$i.$parsedComplexDivisor['suffix']); + } else { + return $r; + } + } // function IMDIV() + + + /** + * IMSUB + * + * Returns the difference of two complex numbers in x + yi or x + yj text format. + * + * @param string $complexNumber1 + * @param string $complexNumber2 + * @return real + */ + public static function IMSUB($complexNumber1,$complexNumber2) { + $complexNumber1 = self::flattenSingleValue($complexNumber1); + $complexNumber2 = self::flattenSingleValue($complexNumber2); + + $parsedComplex1 = self::_parseComplex($complexNumber1); + if (!is_array($parsedComplex1)) { + return $parsedComplex1; + } + + $parsedComplex2 = self::_parseComplex($complexNumber2); + if (!is_array($parsedComplex2)) { + return $parsedComplex2; + } + + if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) && + ($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) { + return self::$_errorCodes['num']; + } elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) { + $parsedComplex1['suffix'] = $parsedComplex2['suffix']; + } + + $d1 = $parsedComplex1['real'] - $parsedComplex2['real']; + $d2 = $parsedComplex1['imaginary'] - $parsedComplex2['imaginary']; + + return self::COMPLEX($d1,$d2,$parsedComplex1['suffix']); + } // function IMSUB() + + + /** + * IMSUM + * + * Returns the sum of two or more complex numbers in x + yi or x + yj text format. + * + * @param array of mixed Data Series + * @return real + */ + public static function IMSUM() { + // Return value + $returnValue = self::_parseComplex('0'); + $activeSuffix = ''; + + // Loop through the arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + $parsedComplex = self::_parseComplex($arg); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + + if ($activeSuffix == '') { + $activeSuffix = $parsedComplex['suffix']; + } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) { + return self::$_errorCodes['value']; + } + + $returnValue['real'] += $parsedComplex['real']; + $returnValue['imaginary'] += $parsedComplex['imaginary']; + } + + if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; } + return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix); + } // function IMSUM() + + + /** + * IMPRODUCT + * + * Returns the product of two or more complex numbers in x + yi or x + yj text format. + * + * @param array of mixed Data Series + * @return real + */ + public static function IMPRODUCT() { + // Return value + $returnValue = self::_parseComplex('1'); + $activeSuffix = ''; + + // Loop through the arguments + $aArgs = self::flattenArray(func_get_args()); + foreach ($aArgs as $arg) { + $parsedComplex = self::_parseComplex($arg); + if (!is_array($parsedComplex)) { + return $parsedComplex; + } + $workValue = $returnValue; + if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) { + $activeSuffix = $parsedComplex['suffix']; + } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) { + return self::$_errorCodes['num']; + } + $returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']); + $returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']); + } + + if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; } + return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix); + } // function IMPRODUCT() + + + private static $_conversionUnits = array( 'g' => array( 'Group' => 'Mass', 'Unit Name' => 'Gram', 'AllowPrefix' => True ), + 'sg' => array( 'Group' => 'Mass', 'Unit Name' => 'Slug', 'AllowPrefix' => False ), + 'lbm' => array( 'Group' => 'Mass', 'Unit Name' => 'Pound mass (avoirdupois)', 'AllowPrefix' => False ), + 'u' => array( 'Group' => 'Mass', 'Unit Name' => 'U (atomic mass unit)', 'AllowPrefix' => True ), + 'ozm' => array( 'Group' => 'Mass', 'Unit Name' => 'Ounce mass (avoirdupois)', 'AllowPrefix' => False ), + 'm' => array( 'Group' => 'Distance', 'Unit Name' => 'Meter', 'AllowPrefix' => True ), + 'mi' => array( 'Group' => 'Distance', 'Unit Name' => 'Statute mile', 'AllowPrefix' => False ), + 'Nmi' => array( 'Group' => 'Distance', 'Unit Name' => 'Nautical mile', 'AllowPrefix' => False ), + 'in' => array( 'Group' => 'Distance', 'Unit Name' => 'Inch', 'AllowPrefix' => False ), + 'ft' => array( 'Group' => 'Distance', 'Unit Name' => 'Foot', 'AllowPrefix' => False ), + 'yd' => array( 'Group' => 'Distance', 'Unit Name' => 'Yard', 'AllowPrefix' => False ), + 'ang' => array( 'Group' => 'Distance', 'Unit Name' => 'Angstrom', 'AllowPrefix' => True ), + 'Pica' => array( 'Group' => 'Distance', 'Unit Name' => 'Pica (1/72 in)', 'AllowPrefix' => False ), + 'yr' => array( 'Group' => 'Time', 'Unit Name' => 'Year', 'AllowPrefix' => False ), + 'day' => array( 'Group' => 'Time', 'Unit Name' => 'Day', 'AllowPrefix' => False ), + 'hr' => array( 'Group' => 'Time', 'Unit Name' => 'Hour', 'AllowPrefix' => False ), + 'mn' => array( 'Group' => 'Time', 'Unit Name' => 'Minute', 'AllowPrefix' => False ), + 'sec' => array( 'Group' => 'Time', 'Unit Name' => 'Second', 'AllowPrefix' => True ), + 'Pa' => array( 'Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => True ), + 'p' => array( 'Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => True ), + 'atm' => array( 'Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => True ), + 'at' => array( 'Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => True ), + 'mmHg' => array( 'Group' => 'Pressure', 'Unit Name' => 'mm of Mercury', 'AllowPrefix' => True ), + 'N' => array( 'Group' => 'Force', 'Unit Name' => 'Newton', 'AllowPrefix' => True ), + 'dyn' => array( 'Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => True ), + 'dy' => array( 'Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => True ), + 'lbf' => array( 'Group' => 'Force', 'Unit Name' => 'Pound force', 'AllowPrefix' => False ), + 'J' => array( 'Group' => 'Energy', 'Unit Name' => 'Joule', 'AllowPrefix' => True ), + 'e' => array( 'Group' => 'Energy', 'Unit Name' => 'Erg', 'AllowPrefix' => True ), + 'c' => array( 'Group' => 'Energy', 'Unit Name' => 'Thermodynamic calorie', 'AllowPrefix' => True ), + 'cal' => array( 'Group' => 'Energy', 'Unit Name' => 'IT calorie', 'AllowPrefix' => True ), + 'eV' => array( 'Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => True ), + 'ev' => array( 'Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => True ), + 'HPh' => array( 'Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => False ), + 'hh' => array( 'Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => False ), + 'Wh' => array( 'Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => True ), + 'wh' => array( 'Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => True ), + 'flb' => array( 'Group' => 'Energy', 'Unit Name' => 'Foot-pound', 'AllowPrefix' => False ), + 'BTU' => array( 'Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => False ), + 'btu' => array( 'Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => False ), + 'HP' => array( 'Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => False ), + 'h' => array( 'Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => False ), + 'W' => array( 'Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => True ), + 'w' => array( 'Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => True ), + 'T' => array( 'Group' => 'Magnetism', 'Unit Name' => 'Tesla', 'AllowPrefix' => True ), + 'ga' => array( 'Group' => 'Magnetism', 'Unit Name' => 'Gauss', 'AllowPrefix' => True ), + 'C' => array( 'Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => False ), + 'cel' => array( 'Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => False ), + 'F' => array( 'Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => False ), + 'fah' => array( 'Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => False ), + 'K' => array( 'Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => False ), + 'kel' => array( 'Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => False ), + 'tsp' => array( 'Group' => 'Liquid', 'Unit Name' => 'Teaspoon', 'AllowPrefix' => False ), + 'tbs' => array( 'Group' => 'Liquid', 'Unit Name' => 'Tablespoon', 'AllowPrefix' => False ), + 'oz' => array( 'Group' => 'Liquid', 'Unit Name' => 'Fluid Ounce', 'AllowPrefix' => False ), + 'cup' => array( 'Group' => 'Liquid', 'Unit Name' => 'Cup', 'AllowPrefix' => False ), + 'pt' => array( 'Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => False ), + 'us_pt' => array( 'Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => False ), + 'uk_pt' => array( 'Group' => 'Liquid', 'Unit Name' => 'U.K. Pint', 'AllowPrefix' => False ), + 'qt' => array( 'Group' => 'Liquid', 'Unit Name' => 'Quart', 'AllowPrefix' => False ), + 'gal' => array( 'Group' => 'Liquid', 'Unit Name' => 'Gallon', 'AllowPrefix' => False ), + 'l' => array( 'Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => True ), + 'lt' => array( 'Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => True ) + ); + + private static $_conversionMultipliers = array( 'Y' => array( 'multiplier' => 1E24, 'name' => 'yotta' ), + 'Z' => array( 'multiplier' => 1E21, 'name' => 'zetta' ), + 'E' => array( 'multiplier' => 1E18, 'name' => 'exa' ), + 'P' => array( 'multiplier' => 1E15, 'name' => 'peta' ), + 'T' => array( 'multiplier' => 1E12, 'name' => 'tera' ), + 'G' => array( 'multiplier' => 1E9, 'name' => 'giga' ), + 'M' => array( 'multiplier' => 1E6, 'name' => 'mega' ), + 'k' => array( 'multiplier' => 1E3, 'name' => 'kilo' ), + 'h' => array( 'multiplier' => 1E2, 'name' => 'hecto' ), + 'e' => array( 'multiplier' => 1E1, 'name' => 'deka' ), + 'd' => array( 'multiplier' => 1E-1, 'name' => 'deci' ), + 'c' => array( 'multiplier' => 1E-2, 'name' => 'centi' ), + 'm' => array( 'multiplier' => 1E-3, 'name' => 'milli' ), + 'u' => array( 'multiplier' => 1E-6, 'name' => 'micro' ), + 'n' => array( 'multiplier' => 1E-9, 'name' => 'nano' ), + 'p' => array( 'multiplier' => 1E-12, 'name' => 'pico' ), + 'f' => array( 'multiplier' => 1E-15, 'name' => 'femto' ), + 'a' => array( 'multiplier' => 1E-18, 'name' => 'atto' ), + 'z' => array( 'multiplier' => 1E-21, 'name' => 'zepto' ), + 'y' => array( 'multiplier' => 1E-24, 'name' => 'yocto' ) + ); + + private static $_unitConversions = array( 'Mass' => array( 'g' => array( 'g' => 1.0, + 'sg' => 6.85220500053478E-05, + 'lbm' => 2.20462291469134E-03, + 'u' => 6.02217000000000E+23, + 'ozm' => 3.52739718003627E-02 + ), + 'sg' => array( 'g' => 1.45938424189287E+04, + 'sg' => 1.0, + 'lbm' => 3.21739194101647E+01, + 'u' => 8.78866000000000E+27, + 'ozm' => 5.14782785944229E+02 + ), + 'lbm' => array( 'g' => 4.5359230974881148E+02, + 'sg' => 3.10810749306493E-02, + 'lbm' => 1.0, + 'u' => 2.73161000000000E+26, + 'ozm' => 1.60000023429410E+01 + ), + 'u' => array( 'g' => 1.66053100460465E-24, + 'sg' => 1.13782988532950E-28, + 'lbm' => 3.66084470330684E-27, + 'u' => 1.0, + 'ozm' => 5.85735238300524E-26 + ), + 'ozm' => array( 'g' => 2.83495152079732E+01, + 'sg' => 1.94256689870811E-03, + 'lbm' => 6.24999908478882E-02, + 'u' => 1.70725600000000E+25, + 'ozm' => 1.0 + ) + ), + 'Distance' => array( 'm' => array( 'm' => 1.0, + 'mi' => 6.21371192237334E-04, + 'Nmi' => 5.39956803455724E-04, + 'in' => 3.93700787401575E+01, + 'ft' => 3.28083989501312E+00, + 'yd' => 1.09361329797891E+00, + 'ang' => 1.00000000000000E+10, + 'Pica' => 2.83464566929116E+03 + ), + 'mi' => array( 'm' => 1.60934400000000E+03, + 'mi' => 1.0, + 'Nmi' => 8.68976241900648E-01, + 'in' => 6.33600000000000E+04, + 'ft' => 5.28000000000000E+03, + 'yd' => 1.76000000000000E+03, + 'ang' => 1.60934400000000E+13, + 'Pica' => 4.56191999999971E+06 + ), + 'Nmi' => array( 'm' => 1.85200000000000E+03, + 'mi' => 1.15077944802354E+00, + 'Nmi' => 1.0, + 'in' => 7.29133858267717E+04, + 'ft' => 6.07611548556430E+03, + 'yd' => 2.02537182785694E+03, + 'ang' => 1.85200000000000E+13, + 'Pica' => 5.24976377952723E+06 + ), + 'in' => array( 'm' => 2.54000000000000E-02, + 'mi' => 1.57828282828283E-05, + 'Nmi' => 1.37149028077754E-05, + 'in' => 1.0, + 'ft' => 8.33333333333333E-02, + 'yd' => 2.77777777686643E-02, + 'ang' => 2.54000000000000E+08, + 'Pica' => 7.19999999999955E+01 + ), + 'ft' => array( 'm' => 3.04800000000000E-01, + 'mi' => 1.89393939393939E-04, + 'Nmi' => 1.64578833693305E-04, + 'in' => 1.20000000000000E+01, + 'ft' => 1.0, + 'yd' => 3.33333333223972E-01, + 'ang' => 3.04800000000000E+09, + 'Pica' => 8.63999999999946E+02 + ), + 'yd' => array( 'm' => 9.14400000300000E-01, + 'mi' => 5.68181818368230E-04, + 'Nmi' => 4.93736501241901E-04, + 'in' => 3.60000000118110E+01, + 'ft' => 3.00000000000000E+00, + 'yd' => 1.0, + 'ang' => 9.14400000300000E+09, + 'Pica' => 2.59200000085023E+03 + ), + 'ang' => array( 'm' => 1.00000000000000E-10, + 'mi' => 6.21371192237334E-14, + 'Nmi' => 5.39956803455724E-14, + 'in' => 3.93700787401575E-09, + 'ft' => 3.28083989501312E-10, + 'yd' => 1.09361329797891E-10, + 'ang' => 1.0, + 'Pica' => 2.83464566929116E-07 + ), + 'Pica' => array( 'm' => 3.52777777777800E-04, + 'mi' => 2.19205948372629E-07, + 'Nmi' => 1.90484761219114E-07, + 'in' => 1.38888888888898E-02, + 'ft' => 1.15740740740748E-03, + 'yd' => 3.85802469009251E-04, + 'ang' => 3.52777777777800E+06, + 'Pica' => 1.0 + ) + ), + 'Time' => array( 'yr' => array( 'yr' => 1.0, + 'day' => 365.25, + 'hr' => 8766.0, + 'mn' => 525960.0, + 'sec' => 31557600.0 + ), + 'day' => array( 'yr' => 2.73785078713210E-03, + 'day' => 1.0, + 'hr' => 24.0, + 'mn' => 1440.0, + 'sec' => 86400.0 + ), + 'hr' => array( 'yr' => 1.14077116130504E-04, + 'day' => 4.16666666666667E-02, + 'hr' => 1.0, + 'mn' => 60.0, + 'sec' => 3600.0 + ), + 'mn' => array( 'yr' => 1.90128526884174E-06, + 'day' => 6.94444444444444E-04, + 'hr' => 1.66666666666667E-02, + 'mn' => 1.0, + 'sec' => 60.0 + ), + 'sec' => array( 'yr' => 3.16880878140289E-08, + 'day' => 1.15740740740741E-05, + 'hr' => 2.77777777777778E-04, + 'mn' => 1.66666666666667E-02, + 'sec' => 1.0 + ) + ), + 'Pressure' => array( 'Pa' => array( 'Pa' => 1.0, + 'p' => 1.0, + 'atm' => 9.86923299998193E-06, + 'at' => 9.86923299998193E-06, + 'mmHg' => 7.50061707998627E-03 + ), + 'p' => array( 'Pa' => 1.0, + 'p' => 1.0, + 'atm' => 9.86923299998193E-06, + 'at' => 9.86923299998193E-06, + 'mmHg' => 7.50061707998627E-03 + ), + 'atm' => array( 'Pa' => 1.01324996583000E+05, + 'p' => 1.01324996583000E+05, + 'atm' => 1.0, + 'at' => 1.0, + 'mmHg' => 760.0 + ), + 'at' => array( 'Pa' => 1.01324996583000E+05, + 'p' => 1.01324996583000E+05, + 'atm' => 1.0, + 'at' => 1.0, + 'mmHg' => 760.0 + ), + 'mmHg' => array( 'Pa' => 1.33322363925000E+02, + 'p' => 1.33322363925000E+02, + 'atm' => 1.31578947368421E-03, + 'at' => 1.31578947368421E-03, + 'mmHg' => 1.0 + ) + ), + 'Force' => array( 'N' => array( 'N' => 1.0, + 'dyn' => 1.0E+5, + 'dy' => 1.0E+5, + 'lbf' => 2.24808923655339E-01 + ), + 'dyn' => array( 'N' => 1.0E-5, + 'dyn' => 1.0, + 'dy' => 1.0, + 'lbf' => 2.24808923655339E-06 + ), + 'dy' => array( 'N' => 1.0E-5, + 'dyn' => 1.0, + 'dy' => 1.0, + 'lbf' => 2.24808923655339E-06 + ), + 'lbf' => array( 'N' => 4.448222, + 'dyn' => 4.448222E+5, + 'dy' => 4.448222E+5, + 'lbf' => 1.0 + ) + ), + 'Energy' => array( 'J' => array( 'J' => 1.0, + 'e' => 9.99999519343231E+06, + 'c' => 2.39006249473467E-01, + 'cal' => 2.38846190642017E-01, + 'eV' => 6.24145700000000E+18, + 'ev' => 6.24145700000000E+18, + 'HPh' => 3.72506430801000E-07, + 'hh' => 3.72506430801000E-07, + 'Wh' => 2.77777916238711E-04, + 'wh' => 2.77777916238711E-04, + 'flb' => 2.37304222192651E+01, + 'BTU' => 9.47815067349015E-04, + 'btu' => 9.47815067349015E-04 + ), + 'e' => array( 'J' => 1.00000048065700E-07, + 'e' => 1.0, + 'c' => 2.39006364353494E-08, + 'cal' => 2.38846305445111E-08, + 'eV' => 6.24146000000000E+11, + 'ev' => 6.24146000000000E+11, + 'HPh' => 3.72506609848824E-14, + 'hh' => 3.72506609848824E-14, + 'Wh' => 2.77778049754611E-11, + 'wh' => 2.77778049754611E-11, + 'flb' => 2.37304336254586E-06, + 'BTU' => 9.47815522922962E-11, + 'btu' => 9.47815522922962E-11 + ), + 'c' => array( 'J' => 4.18399101363672E+00, + 'e' => 4.18398900257312E+07, + 'c' => 1.0, + 'cal' => 9.99330315287563E-01, + 'eV' => 2.61142000000000E+19, + 'ev' => 2.61142000000000E+19, + 'HPh' => 1.55856355899327E-06, + 'hh' => 1.55856355899327E-06, + 'Wh' => 1.16222030532950E-03, + 'wh' => 1.16222030532950E-03, + 'flb' => 9.92878733152102E+01, + 'BTU' => 3.96564972437776E-03, + 'btu' => 3.96564972437776E-03 + ), + 'cal' => array( 'J' => 4.18679484613929E+00, + 'e' => 4.18679283372801E+07, + 'c' => 1.00067013349059E+00, + 'cal' => 1.0, + 'eV' => 2.61317000000000E+19, + 'ev' => 2.61317000000000E+19, + 'HPh' => 1.55960800463137E-06, + 'hh' => 1.55960800463137E-06, + 'Wh' => 1.16299914807955E-03, + 'wh' => 1.16299914807955E-03, + 'flb' => 9.93544094443283E+01, + 'BTU' => 3.96830723907002E-03, + 'btu' => 3.96830723907002E-03 + ), + 'eV' => array( 'J' => 1.60219000146921E-19, + 'e' => 1.60218923136574E-12, + 'c' => 3.82933423195043E-20, + 'cal' => 3.82676978535648E-20, + 'eV' => 1.0, + 'ev' => 1.0, + 'HPh' => 5.96826078912344E-26, + 'hh' => 5.96826078912344E-26, + 'Wh' => 4.45053000026614E-23, + 'wh' => 4.45053000026614E-23, + 'flb' => 3.80206452103492E-18, + 'BTU' => 1.51857982414846E-22, + 'btu' => 1.51857982414846E-22 + ), + 'ev' => array( 'J' => 1.60219000146921E-19, + 'e' => 1.60218923136574E-12, + 'c' => 3.82933423195043E-20, + 'cal' => 3.82676978535648E-20, + 'eV' => 1.0, + 'ev' => 1.0, + 'HPh' => 5.96826078912344E-26, + 'hh' => 5.96826078912344E-26, + 'Wh' => 4.45053000026614E-23, + 'wh' => 4.45053000026614E-23, + 'flb' => 3.80206452103492E-18, + 'BTU' => 1.51857982414846E-22, + 'btu' => 1.51857982414846E-22 + ), + 'HPh' => array( 'J' => 2.68451741316170E+06, + 'e' => 2.68451612283024E+13, + 'c' => 6.41616438565991E+05, + 'cal' => 6.41186757845835E+05, + 'eV' => 1.67553000000000E+25, + 'ev' => 1.67553000000000E+25, + 'HPh' => 1.0, + 'hh' => 1.0, + 'Wh' => 7.45699653134593E+02, + 'wh' => 7.45699653134593E+02, + 'flb' => 6.37047316692964E+07, + 'BTU' => 2.54442605275546E+03, + 'btu' => 2.54442605275546E+03 + ), + 'hh' => array( 'J' => 2.68451741316170E+06, + 'e' => 2.68451612283024E+13, + 'c' => 6.41616438565991E+05, + 'cal' => 6.41186757845835E+05, + 'eV' => 1.67553000000000E+25, + 'ev' => 1.67553000000000E+25, + 'HPh' => 1.0, + 'hh' => 1.0, + 'Wh' => 7.45699653134593E+02, + 'wh' => 7.45699653134593E+02, + 'flb' => 6.37047316692964E+07, + 'BTU' => 2.54442605275546E+03, + 'btu' => 2.54442605275546E+03 + ), + 'Wh' => array( 'J' => 3.59999820554720E+03, + 'e' => 3.59999647518369E+10, + 'c' => 8.60422069219046E+02, + 'cal' => 8.59845857713046E+02, + 'eV' => 2.24692340000000E+22, + 'ev' => 2.24692340000000E+22, + 'HPh' => 1.34102248243839E-03, + 'hh' => 1.34102248243839E-03, + 'Wh' => 1.0, + 'wh' => 1.0, + 'flb' => 8.54294774062316E+04, + 'BTU' => 3.41213254164705E+00, + 'btu' => 3.41213254164705E+00 + ), + 'wh' => array( 'J' => 3.59999820554720E+03, + 'e' => 3.59999647518369E+10, + 'c' => 8.60422069219046E+02, + 'cal' => 8.59845857713046E+02, + 'eV' => 2.24692340000000E+22, + 'ev' => 2.24692340000000E+22, + 'HPh' => 1.34102248243839E-03, + 'hh' => 1.34102248243839E-03, + 'Wh' => 1.0, + 'wh' => 1.0, + 'flb' => 8.54294774062316E+04, + 'BTU' => 3.41213254164705E+00, + 'btu' => 3.41213254164705E+00 + ), + 'flb' => array( 'J' => 4.21400003236424E-02, + 'e' => 4.21399800687660E+05, + 'c' => 1.00717234301644E-02, + 'cal' => 1.00649785509554E-02, + 'eV' => 2.63015000000000E+17, + 'ev' => 2.63015000000000E+17, + 'HPh' => 1.56974211145130E-08, + 'hh' => 1.56974211145130E-08, + 'Wh' => 1.17055614802000E-05, + 'wh' => 1.17055614802000E-05, + 'flb' => 1.0, + 'BTU' => 3.99409272448406E-05, + 'btu' => 3.99409272448406E-05 + ), + 'BTU' => array( 'J' => 1.05505813786749E+03, + 'e' => 1.05505763074665E+10, + 'c' => 2.52165488508168E+02, + 'cal' => 2.51996617135510E+02, + 'eV' => 6.58510000000000E+21, + 'ev' => 6.58510000000000E+21, + 'HPh' => 3.93015941224568E-04, + 'hh' => 3.93015941224568E-04, + 'Wh' => 2.93071851047526E-01, + 'wh' => 2.93071851047526E-01, + 'flb' => 2.50369750774671E+04, + 'BTU' => 1.0, + 'btu' => 1.0, + ), + 'btu' => array( 'J' => 1.05505813786749E+03, + 'e' => 1.05505763074665E+10, + 'c' => 2.52165488508168E+02, + 'cal' => 2.51996617135510E+02, + 'eV' => 6.58510000000000E+21, + 'ev' => 6.58510000000000E+21, + 'HPh' => 3.93015941224568E-04, + 'hh' => 3.93015941224568E-04, + 'Wh' => 2.93071851047526E-01, + 'wh' => 2.93071851047526E-01, + 'flb' => 2.50369750774671E+04, + 'BTU' => 1.0, + 'btu' => 1.0, + ) + ), + 'Power' => array( 'HP' => array( 'HP' => 1.0, + 'h' => 1.0, + 'W' => 7.45701000000000E+02, + 'w' => 7.45701000000000E+02 + ), + 'h' => array( 'HP' => 1.0, + 'h' => 1.0, + 'W' => 7.45701000000000E+02, + 'w' => 7.45701000000000E+02 + ), + 'W' => array( 'HP' => 1.34102006031908E-03, + 'h' => 1.34102006031908E-03, + 'W' => 1.0, + 'w' => 1.0 + ), + 'w' => array( 'HP' => 1.34102006031908E-03, + 'h' => 1.34102006031908E-03, + 'W' => 1.0, + 'w' => 1.0 + ) + ), + 'Magnetism' => array( 'T' => array( 'T' => 1.0, + 'ga' => 10000.0 + ), + 'ga' => array( 'T' => 0.0001, + 'ga' => 1.0 + ) + ), + 'Liquid' => array( 'tsp' => array( 'tsp' => 1.0, + 'tbs' => 3.33333333333333E-01, + 'oz' => 1.66666666666667E-01, + 'cup' => 2.08333333333333E-02, + 'pt' => 1.04166666666667E-02, + 'us_pt' => 1.04166666666667E-02, + 'uk_pt' => 8.67558516821960E-03, + 'qt' => 5.20833333333333E-03, + 'gal' => 1.30208333333333E-03, + 'l' => 4.92999408400710E-03, + 'lt' => 4.92999408400710E-03 + ), + 'tbs' => array( 'tsp' => 3.00000000000000E+00, + 'tbs' => 1.0, + 'oz' => 5.00000000000000E-01, + 'cup' => 6.25000000000000E-02, + 'pt' => 3.12500000000000E-02, + 'us_pt' => 3.12500000000000E-02, + 'uk_pt' => 2.60267555046588E-02, + 'qt' => 1.56250000000000E-02, + 'gal' => 3.90625000000000E-03, + 'l' => 1.47899822520213E-02, + 'lt' => 1.47899822520213E-02 + ), + 'oz' => array( 'tsp' => 6.00000000000000E+00, + 'tbs' => 2.00000000000000E+00, + 'oz' => 1.0, + 'cup' => 1.25000000000000E-01, + 'pt' => 6.25000000000000E-02, + 'us_pt' => 6.25000000000000E-02, + 'uk_pt' => 5.20535110093176E-02, + 'qt' => 3.12500000000000E-02, + 'gal' => 7.81250000000000E-03, + 'l' => 2.95799645040426E-02, + 'lt' => 2.95799645040426E-02 + ), + 'cup' => array( 'tsp' => 4.80000000000000E+01, + 'tbs' => 1.60000000000000E+01, + 'oz' => 8.00000000000000E+00, + 'cup' => 1.0, + 'pt' => 5.00000000000000E-01, + 'us_pt' => 5.00000000000000E-01, + 'uk_pt' => 4.16428088074541E-01, + 'qt' => 2.50000000000000E-01, + 'gal' => 6.25000000000000E-02, + 'l' => 2.36639716032341E-01, + 'lt' => 2.36639716032341E-01 + ), + 'pt' => array( 'tsp' => 9.60000000000000E+01, + 'tbs' => 3.20000000000000E+01, + 'oz' => 1.60000000000000E+01, + 'cup' => 2.00000000000000E+00, + 'pt' => 1.0, + 'us_pt' => 1.0, + 'uk_pt' => 8.32856176149081E-01, + 'qt' => 5.00000000000000E-01, + 'gal' => 1.25000000000000E-01, + 'l' => 4.73279432064682E-01, + 'lt' => 4.73279432064682E-01 + ), + 'us_pt' => array( 'tsp' => 9.60000000000000E+01, + 'tbs' => 3.20000000000000E+01, + 'oz' => 1.60000000000000E+01, + 'cup' => 2.00000000000000E+00, + 'pt' => 1.0, + 'us_pt' => 1.0, + 'uk_pt' => 8.32856176149081E-01, + 'qt' => 5.00000000000000E-01, + 'gal' => 1.25000000000000E-01, + 'l' => 4.73279432064682E-01, + 'lt' => 4.73279432064682E-01 + ), + 'uk_pt' => array( 'tsp' => 1.15266000000000E+02, + 'tbs' => 3.84220000000000E+01, + 'oz' => 1.92110000000000E+01, + 'cup' => 2.40137500000000E+00, + 'pt' => 1.20068750000000E+00, + 'us_pt' => 1.20068750000000E+00, + 'uk_pt' => 1.0, + 'qt' => 6.00343750000000E-01, + 'gal' => 1.50085937500000E-01, + 'l' => 5.68260698087162E-01, + 'lt' => 5.68260698087162E-01 + ), + 'qt' => array( 'tsp' => 1.92000000000000E+02, + 'tbs' => 6.40000000000000E+01, + 'oz' => 3.20000000000000E+01, + 'cup' => 4.00000000000000E+00, + 'pt' => 2.00000000000000E+00, + 'us_pt' => 2.00000000000000E+00, + 'uk_pt' => 1.66571235229816E+00, + 'qt' => 1.0, + 'gal' => 2.50000000000000E-01, + 'l' => 9.46558864129363E-01, + 'lt' => 9.46558864129363E-01 + ), + 'gal' => array( 'tsp' => 7.68000000000000E+02, + 'tbs' => 2.56000000000000E+02, + 'oz' => 1.28000000000000E+02, + 'cup' => 1.60000000000000E+01, + 'pt' => 8.00000000000000E+00, + 'us_pt' => 8.00000000000000E+00, + 'uk_pt' => 6.66284940919265E+00, + 'qt' => 4.00000000000000E+00, + 'gal' => 1.0, + 'l' => 3.78623545651745E+00, + 'lt' => 3.78623545651745E+00 + ), + 'l' => array( 'tsp' => 2.02840000000000E+02, + 'tbs' => 6.76133333333333E+01, + 'oz' => 3.38066666666667E+01, + 'cup' => 4.22583333333333E+00, + 'pt' => 2.11291666666667E+00, + 'us_pt' => 2.11291666666667E+00, + 'uk_pt' => 1.75975569552166E+00, + 'qt' => 1.05645833333333E+00, + 'gal' => 2.64114583333333E-01, + 'l' => 1.0, + 'lt' => 1.0 + ), + 'lt' => array( 'tsp' => 2.02840000000000E+02, + 'tbs' => 6.76133333333333E+01, + 'oz' => 3.38066666666667E+01, + 'cup' => 4.22583333333333E+00, + 'pt' => 2.11291666666667E+00, + 'us_pt' => 2.11291666666667E+00, + 'uk_pt' => 1.75975569552166E+00, + 'qt' => 1.05645833333333E+00, + 'gal' => 2.64114583333333E-01, + 'l' => 1.0, + 'lt' => 1.0 + ) + ) + ); + + + /** + * getConversionGroups + * + * @return array + */ + public static function getConversionGroups() { + $conversionGroups = array(); + foreach(self::$_conversionUnits as $conversionUnit) { + $conversionGroups[] = $conversionUnit['Group']; + } + return array_merge(array_unique($conversionGroups)); + } // function getConversionGroups() + + + /** + * getConversionGroupUnits + * + * @return array + */ + public static function getConversionGroupUnits($group = NULL) { + $conversionGroups = array(); + foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) { + if ((is_null($group)) || ($conversionGroup['Group'] == $group)) { + $conversionGroups[$conversionGroup['Group']][] = $conversionUnit; + } + } + return $conversionGroups; + } // function getConversionGroupUnits() + + + /** + * getConversionGroupUnitDetails + * + * @return array + */ + public static function getConversionGroupUnitDetails($group = NULL) { + $conversionGroups = array(); + foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) { + if ((is_null($group)) || ($conversionGroup['Group'] == $group)) { + $conversionGroups[$conversionGroup['Group']][] = array( 'unit' => $conversionUnit, + 'description' => $conversionGroup['Unit Name'] + ); + } + } + return $conversionGroups; + } // function getConversionGroupUnitDetails() + + + /** + * getConversionGroups + * + * @return array + */ + public static function getConversionMultipliers() { + return self::$_conversionMultipliers; + } // function getConversionGroups() + + + /** + * CONVERTUOM + * + * @param float $value + * @param string $fromUOM + * @param string $toUOM + * @return float + */ + public static function CONVERTUOM($value, $fromUOM, $toUOM) { + $value = self::flattenSingleValue($value); + $fromUOM = self::flattenSingleValue($fromUOM); + $toUOM = self::flattenSingleValue($toUOM); + + if (!is_numeric($value)) { + return self::$_errorCodes['value']; + } + $fromMultiplier = 1; + if (isset(self::$_conversionUnits[$fromUOM])) { + $unitGroup1 = self::$_conversionUnits[$fromUOM]['Group']; + } else { + $fromMultiplier = substr($fromUOM,0,1); + $fromUOM = substr($fromUOM,1); + if (isset(self::$_conversionMultipliers[$fromMultiplier])) { + $fromMultiplier = self::$_conversionMultipliers[$fromMultiplier]['multiplier']; + } else { + return self::$_errorCodes['na']; + } + if ((isset(self::$_conversionUnits[$fromUOM])) && (self::$_conversionUnits[$fromUOM]['AllowPrefix'])) { + $unitGroup1 = self::$_conversionUnits[$fromUOM]['Group']; + } else { + return self::$_errorCodes['na']; + } + } + $value *= $fromMultiplier; + + $toMultiplier = 1; + if (isset(self::$_conversionUnits[$toUOM])) { + $unitGroup2 = self::$_conversionUnits[$toUOM]['Group']; + } else { + $toMultiplier = substr($toUOM,0,1); + $toUOM = substr($toUOM,1); + if (isset(self::$_conversionMultipliers[$toMultiplier])) { + $toMultiplier = self::$_conversionMultipliers[$toMultiplier]['multiplier']; + } else { + return self::$_errorCodes['na']; + } + if ((isset(self::$_conversionUnits[$toUOM])) && (self::$_conversionUnits[$toUOM]['AllowPrefix'])) { + $unitGroup2 = self::$_conversionUnits[$toUOM]['Group']; + } else { + return self::$_errorCodes['na']; + } + } + if ($unitGroup1 != $unitGroup2) { + return self::$_errorCodes['na']; + } + + if ($fromUOM == $toUOM) { + return 1.0; + } elseif ($unitGroup1 == 'Temperature') { + if (($fromUOM == 'F') || ($fromUOM == 'fah')) { + if (($toUOM == 'F') || ($toUOM == 'fah')) { + return 1.0; + } else { + $value = (($value - 32) / 1.8); + if (($toUOM == 'K') || ($toUOM == 'kel')) { + $value += 273.15; + } + return $value; + } + } elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) && + (($toUOM == 'K') || ($toUOM == 'kel'))) { + return 1.0; + } elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) && + (($toUOM == 'C') || ($toUOM == 'cel'))) { + return 1.0; + } + if (($toUOM == 'F') || ($toUOM == 'fah')) { + if (($fromUOM == 'K') || ($fromUOM == 'kel')) { + $value -= 273.15; + } + return ($value * 1.8) + 32; + } + if (($toUOM == 'C') || ($toUOM == 'cel')) { + return $value - 273.15; + } + return $value + 273.15; + } + return ($value * self::$_unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier; + } // function CONVERTUOM() + + + /** + * BESSELI + * + * Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments + * + * @param float $x + * @param float $n + * @return int + */ + public static function BESSELI($x, $n) { + $x = self::flattenSingleValue($x); + $n = floor(self::flattenSingleValue($n)); + + if ((is_numeric($x)) && (is_numeric($n))) { + if ($n < 0) { + return self::$_errorCodes['num']; + } + $f_2_PI = 2 * pi(); + + if (abs($x) <= 30) { + $fTerm = pow($x / 2, $n) / self::FACT($n); + $nK = 1; + $fResult = $fTerm; + $fSqrX = pow($x,2) / 4; + do { + $fTerm *= $fSqrX; + $fTerm /= ($nK * ($nK + $n)); + $fResult += $fTerm; + } while ((abs($fTerm) > 1e-10) && (++$nK < 100)); + } else { + $fXAbs = abs($x); + $fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs); + if (($n && 1) && ($x < 0)) { + $fResult = -$fResult; + } + } + return $fResult; + } + return self::$_errorCodes['value']; + } // function BESSELI() + + + /** + * BESSELJ + * + * Returns the Bessel function + * + * @param float $x + * @param float $n + * @return int + */ + public static function BESSELJ($x, $n) { + $x = self::flattenSingleValue($x); + $n = floor(self::flattenSingleValue($n)); + + if ((is_numeric($x)) && (is_numeric($n))) { + if ($n < 0) { + return self::$_errorCodes['num']; + } + $f_2_DIV_PI = 2 / pi(); + $f_PI_DIV_2 = pi() / 2; + $f_PI_DIV_4 = pi() / 4; + + $fResult = 0; + if (abs($x) <= 30) { + $fTerm = pow($x / 2, $n) / self::FACT($n); + $nK = 1; + $fResult = $fTerm; + $fSqrX = pow($x,2) / -4; + do { + $fTerm *= $fSqrX; + $fTerm /= ($nK * ($nK + $n)); + $fResult += $fTerm; + } while ((abs($fTerm) > 1e-10) && (++$nK < 100)); + } else { + $fXAbs = abs($x); + $fResult = sqrt($f_2_DIV_PI / $fXAbs) * cos($fXAbs - $n * $f_PI_DIV_2 - $f_PI_DIV_4); + if (($n && 1) && ($x < 0)) { + $fResult = -$fResult; + } + } + return $fResult; + } + return self::$_errorCodes['value']; + } // function BESSELJ() + + + private static function _Besselk0($fNum) { + if ($fNum <= 2) { + $fNum2 = $fNum * 0.5; + $y = pow($fNum2,2); + $fRet = -log($fNum2) * self::BESSELI($fNum, 0) + + (-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y * + (0.10750e-3 + $y * 0.74e-5)))))); + } else { + $y = 2 / $fNum; + $fRet = exp(-$fNum) / sqrt($fNum) * + (1.25331414 + $y * (-0.7832358e-1 + $y * (0.2189568e-1 + $y * (-0.1062446e-1 + $y * + (0.587872e-2 + $y * (-0.251540e-2 + $y * 0.53208e-3)))))); + } + return $fRet; + } // function _Besselk0() + + + private static function _Besselk1($fNum) { + if ($fNum <= 2) { + $fNum2 = $fNum * 0.5; + $y = pow($fNum2,2); + $fRet = log($fNum2) * self::BESSELI($fNum, 1) + + (1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y * + (-0.110404e-2 + $y * (-0.4686e-4))))))) / $fNum; + } else { + $y = 2 / $fNum; + $fRet = exp(-$fNum) / sqrt($fNum) * + (1.25331414 + $y * (0.23498619 + $y * (-0.3655620e-1 + $y * (0.1504268e-1 + $y * (-0.780353e-2 + $y * + (0.325614e-2 + $y * (-0.68245e-3))))))); + } + return $fRet; + } // function _Besselk1() + + + /** + * BESSELK + * + * Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments. + * + * @param float $x + * @param float $ord + * @return float + */ + public static function BESSELK($x, $ord) { + $x = self::flattenSingleValue($x); + $ord = floor(self::flattenSingleValue($ord)); + + if ((is_numeric($x)) && (is_numeric($ord))) { + if ($ord < 0) { + return self::$_errorCodes['num']; + } + + switch($ord) { + case 0 : return self::_Besselk0($x); + break; + case 1 : return self::_Besselk1($x); + break; + default : $fTox = 2 / $x; + $fBkm = self::_Besselk0($x); + $fBk = self::_Besselk1($x); + for ($n = 1; $n < $ord; ++$n) { + $fBkp = $fBkm + $n * $fTox * $fBk; + $fBkm = $fBk; + $fBk = $fBkp; + } + } + return $fBk; + } + return self::$_errorCodes['value']; + } // function BESSELK() + + + private static function _Bessely0($fNum) { + if ($fNum < 8.0) { + $y = pow($fNum,2); + $f1 = -2957821389.0 + $y * (7062834065.0 + $y * (-512359803.6 + $y * (10879881.29 + $y * (-86327.92757 + $y * 228.4622733)))); + $f2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y)))); + $fRet = $f1 / $f2 + 0.636619772 * self::BESSELJ($fNum, 0) * log($fNum); + } else { + $z = 8.0 / $fNum; + $y = pow($z,2); + $xx = $fNum - 0.785398164; + $f1 = 1 + $y * (-0.1098628627e-2 + $y * (0.2734510407e-4 + $y * (-0.2073370639e-5 + $y * 0.2093887211e-6))); + $f2 = -0.1562499995e-1 + $y * (0.1430488765e-3 + $y * (-0.6911147651e-5 + $y * (0.7621095161e-6 + $y * (-0.934945152e-7)))); + $fRet = sqrt(0.636619772 / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2); + } + return $fRet; + } // function _Bessely0() + + + private static function _Bessely1($fNum) { + if ($fNum < 8.0) { + $y = pow($fNum,2); + $f1 = $fNum * (-0.4900604943e13 + $y * (0.1275274390e13 + $y * (-0.5153438139e11 + $y * (0.7349264551e9 + $y * + (-0.4237922726e7 + $y * 0.8511937935e4))))); + $f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y * + (0.1020426050e6 + $y * (0.3549632885e3 + $y))))); + $fRet = $f1 / $f2 + 0.636619772 * ( self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum); + } else { + $z = 8.0 / $fNum; + $y = pow($z,2); + $xx = $fNum - 2.356194491; + $f1 = 1 + $y * (0.183105e-2 + $y * (-0.3516396496e-4 + $y * (0.2457520174e-5 + $y * (-0.240337019e6)))); + $f2 = 0.04687499995 + $y * (-0.2002690873e-3 + $y * (0.8449199096e-5 + $y * (-0.88228987e-6 + $y * 0.105787412e-6))); + $fRet = sqrt(0.636619772 / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2); + #i12430# ...but this seems to work much better. +// $fRet = sqrt(0.636619772 / $fNum) * sin($fNum - 2.356194491); + } + return $fRet; + } // function _Bessely1() + + + /** + * BESSELY + * + * Returns the Bessel function, which is also called the Weber function or the Neumann function. + * + * @param float $x + * @param float $n + * @return int + */ + public static function BESSELY($x, $ord) { + $x = self::flattenSingleValue($x); + $ord = floor(self::flattenSingleValue($ord)); + + if ((is_numeric($x)) && (is_numeric($ord))) { + if ($ord < 0) { + return self::$_errorCodes['num']; + } + + switch($ord) { + case 0 : return self::_Bessely0($x); + break; + case 1 : return self::_Bessely1($x); + break; + default: $fTox = 2 / $x; + $fBym = self::_Bessely0($x); + $fBy = self::_Bessely1($x); + for ($n = 1; $n < $ord; ++$n) { + $fByp = $n * $fTox * $fBy - $fBym; + $fBym = $fBy; + $fBy = $fByp; + } + } + return $fBy; + } + return self::$_errorCodes['value']; + } // function BESSELY() + + + /** + * DELTA + * + * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. + * + * @param float $a + * @param float $b + * @return int + */ + public static function DELTA($a, $b=0) { + $a = self::flattenSingleValue($a); + $b = self::flattenSingleValue($b); + + return (int) ($a == $b); + } // function DELTA() + + + /** + * GESTEP + * + * Returns 1 if number = step; returns 0 (zero) otherwise + * + * @param float $number + * @param float $step + * @return int + */ + public static function GESTEP($number, $step=0) { + $number = self::flattenSingleValue($number); + $step = self::flattenSingleValue($step); + + return (int) ($number >= $step); + } // function GESTEP() + + + // + // Private method to calculate the erf value + // + private static $_two_sqrtpi = 1.128379167095512574; + private static $_rel_error = 1E-15; + + private static function _erfVal($x) { + if (abs($x) > 2.2) { + return 1 - self::_erfcVal($x); + } + $sum = $term = $x; + $xsqr = pow($x,2); + $j = 1; + do { + $term *= $xsqr / $j; + $sum -= $term / (2 * $j + 1); + ++$j; + $term *= $xsqr / $j; + $sum += $term / (2 * $j + 1); + ++$j; + if ($sum == 0) { + break; + } + } while (abs($term / $sum) > self::$_rel_error); + return self::$_two_sqrtpi * $sum; + } // function _erfVal() + + + /** + * ERF + * + * Returns the error function integrated between lower_limit and upper_limit + * + * @param float $lower lower bound for integrating ERF + * @param float $upper upper bound for integrating ERF. + * If omitted, ERF integrates between zero and lower_limit + * @return int + */ + public static function ERF($lower, $upper = null) { + $lower = self::flattenSingleValue($lower); + $upper = self::flattenSingleValue($upper); + + if (is_numeric($lower)) { + if ($lower < 0) { + return self::$_errorCodes['num']; + } + if (is_null($upper)) { + return self::_erfVal($lower); + } + if (is_numeric($upper)) { + if ($upper < 0) { + return self::$_errorCodes['num']; + } + return self::_erfVal($upper) - self::_erfVal($lower); + } + } + return self::$_errorCodes['value']; + } // function ERF() + + + // + // Private method to calculate the erfc value + // + private static $_one_sqrtpi = 0.564189583547756287; + + private static function _erfcVal($x) { + if (abs($x) < 2.2) { + return 1 - self::_erfVal($x); + } + if ($x < 0) { + return 2 - self::erfc(-$x); + } + $a = $n = 1; + $b = $c = $x; + $d = pow($x,2) + 0.5; + $q1 = $q2 = $b / $d; + $t = 0; + do { + $t = $a * $n + $b * $x; + $a = $b; + $b = $t; + $t = $c * $n + $d * $x; + $c = $d; + $d = $t; + $n += 0.5; + $q1 = $q2; + $q2 = $b / $d; + } while ((abs($q1 - $q2) / $q2) > self::$_rel_error); + return self::$_one_sqrtpi * exp(-$x * $x) * $q2; + } // function _erfcVal() + + + /** + * ERFC + * + * Returns the complementary ERF function integrated between x and infinity + * + * @param float $x The lower bound for integrating ERF + * @return int + */ + public static function ERFC($x) { + $x = self::flattenSingleValue($x); + + if (is_numeric($x)) { + if ($x < 0) { + return self::$_errorCodes['num']; + } + return self::_erfcVal($x); + } + return self::$_errorCodes['value']; + } // function ERFC() + + + /** + * LOWERCASE + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * @return string + */ + public static function LOWERCASE($mixedCaseString) { + $mixedCaseString = self::flattenSingleValue($mixedCaseString); + + if (function_exists('mb_convert_case')) { + return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8'); + } else { + return strtoupper($mixedCaseString); + } + } // function LOWERCASE() + + + /** + * UPPERCASE + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * @return string + */ + public static function UPPERCASE($mixedCaseString) { + $mixedCaseString = self::flattenSingleValue($mixedCaseString); + + if (function_exists('mb_convert_case')) { + return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8'); + } else { + return strtoupper($mixedCaseString); + } + } // function UPPERCASE() + + + /** + * PROPERCASE + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * @return string + */ + public static function PROPERCASE($mixedCaseString) { + $mixedCaseString = self::flattenSingleValue($mixedCaseString); + + if (function_exists('mb_convert_case')) { + return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8'); + } else { + return ucwords($mixedCaseString); + } + } // function PROPERCASE() + + + /** + * DOLLAR + * + * This function converts a number to text using currency format, with the decimals rounded to the specified place. + * The format used is $#,##0.00_);($#,##0.00).. + * + * @param float $value The value to format + * @param int $decimals The number of digits to display to the right of the decimal point. + * If decimals is negative, number is rounded to the left of the decimal point. + * If you omit decimals, it is assumed to be 2 + * @return string + */ + public static function DOLLAR($value = 0, $decimals = 2) { + $value = self::flattenSingleValue($value); + $decimals = self::flattenSingleValue($decimals); + + // Validate parameters + if (!is_numeric($value) || !is_numeric($decimals)) { + return self::$_errorCodes['num']; + } + $decimals = floor($decimals); + + if ($decimals > 0) { + return money_format('%.'.$decimals.'n',$value); + } else { + $round = pow(10,abs($decimals)); + if ($value < 0) { $round = 0-$round; } + $value = self::MROUND($value,$round); + // The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0, + // so we display to 1 dp and chop off that character and the decimal separator using substr + return substr(money_format('%.1n',$value),0,-2); + } + } // function DOLLAR() + + + /** + * DOLLARDE + * + * Converts a dollar price expressed as an integer part and a fraction part into a dollar price expressed as a decimal number. + * Fractional dollar numbers are sometimes used for security prices. + * + * @param float $fractional_dollar Fractional Dollar + * @param int $fraction Fraction + * @return float + */ + public static function DOLLARDE($fractional_dollar = Null, $fraction = 0) { + $fractional_dollar = self::flattenSingleValue($fractional_dollar); + $fraction = (int)self::flattenSingleValue($fraction); + + // Validate parameters + if (is_null($fractional_dollar) || $fraction < 0) { + return self::$_errorCodes['num']; + } + if ($fraction == 0) { + return self::$_errorCodes['divisionbyzero']; + } + + $dollars = floor($fractional_dollar); + $cents = fmod($fractional_dollar,1); + $cents /= $fraction; + $cents *= pow(10,ceil(log10($fraction))); + return $dollars + $cents; + } // function DOLLARDE() + + + /** + * DOLLARFR + * + * Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. + * Fractional dollar numbers are sometimes used for security prices. + * + * @param float $decimal_dollar Decimal Dollar + * @param int $fraction Fraction + * @return float + */ + public static function DOLLARFR($decimal_dollar = Null, $fraction = 0) { + $decimal_dollar = self::flattenSingleValue($decimal_dollar); + $fraction = (int)self::flattenSingleValue($fraction); + + // Validate parameters + if (is_null($decimal_dollar) || $fraction < 0) { + return self::$_errorCodes['num']; + } + if ($fraction == 0) { + return self::$_errorCodes['divisionbyzero']; + } + + $dollars = floor($decimal_dollar); + $cents = fmod($decimal_dollar,1); + $cents *= $fraction; + $cents *= pow(10,-ceil(log10($fraction))); + return $dollars + $cents; + } // function DOLLARFR() + + + /** + * EFFECT + * + * Returns the effective interest rate given the nominal rate and the number of compounding payments per year. + * + * @param float $nominal_rate Nominal interest rate + * @param int $npery Number of compounding payments per year + * @return float + */ + public static function EFFECT($nominal_rate = 0, $npery = 0) { + $nominal_rate = self::flattenSingleValue($nominal_rate); + $npery = (int)self::flattenSingleValue($npery); + + // Validate parameters + if ($nominal_rate <= 0 || $npery < 1) { + return self::$_errorCodes['num']; + } + + return pow((1 + $nominal_rate / $npery), $npery) - 1; + } // function EFFECT() + + + /** + * NOMINAL + * + * Returns the nominal interest rate given the effective rate and the number of compounding payments per year. + * + * @param float $effect_rate Effective interest rate + * @param int $npery Number of compounding payments per year + * @return float + */ + public static function NOMINAL($effect_rate = 0, $npery = 0) { + $effect_rate = self::flattenSingleValue($effect_rate); + $npery = (int)self::flattenSingleValue($npery); + + // Validate parameters + if ($effect_rate <= 0 || $npery < 1) { + return self::$_errorCodes['num']; + } + + // Calculate + return $npery * (pow($effect_rate + 1, 1 / $npery) - 1); + } // function NOMINAL() + + + /** + * PV + * + * Returns the Present Value of a cash flow with constant payments and interest rate (annuities). + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pmt Periodic payment (annuity) + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $nper = self::flattenSingleValue($nper); + $pmt = self::flattenSingleValue($pmt); + $fv = self::flattenSingleValue($fv); + $type = self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + + // Calculate + if (!is_null($rate) && $rate != 0) { + return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper); + } else { + return -$fv - $pmt * $nper; + } + } // function PV() + + + /** + * FV + * + * Returns the Future Value of a cash flow with constant payments and interest rate (annuities). + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pmt Periodic payment (annuity) + * @param float $pv Present Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $nper = self::flattenSingleValue($nper); + $pmt = self::flattenSingleValue($pmt); + $pv = self::flattenSingleValue($pv); + $type = self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + + // Calculate + if (!is_null($rate) && $rate != 0) { + return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate; + } else { + return -$pv - $pmt * $nper; + } + } // function FV() + + + /** + * PMT + * + * Returns the constant payment (annuity) for a cash flow with a constant interest rate. + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $nper = self::flattenSingleValue($nper); + $pv = self::flattenSingleValue($pv); + $fv = self::flattenSingleValue($fv); + $type = self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + + // Calculate + if (!is_null($rate) && $rate != 0) { + return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate); + } else { + return (-$pv - $fv) / $nper; + } + } // function PMT() + + + /** + * NPER + * + * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. + * + * @param float $rate Interest rate per period + * @param int $pmt Periodic payment (annuity) + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $pmt = self::flattenSingleValue($pmt); + $pv = self::flattenSingleValue($pv); + $fv = self::flattenSingleValue($fv); + $type = self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + + // Calculate + if (!is_null($rate) && $rate != 0) { + if ($pmt == 0 && $pv == 0) { + return self::$_errorCodes['num']; + } + return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate); + } else { + if ($pmt == 0) { + return self::$_errorCodes['num']; + } + return (-$pv -$fv) / $pmt; + } + } // function NPER() + + + private static function _interestAndPrincipal($rate=0, $per=0, $nper=0, $pv=0, $fv=0, $type=0) { + $pmt = self::PMT($rate, $nper, $pv, $fv, $type); + $capital = $pv; + for ($i = 1; $i<= $per; ++$i) { + $interest = ($type && $i == 1)? 0 : -$capital * $rate; + $principal = $pmt - $interest; + $capital += $principal; + } + return array($interest, $principal); + } // function _interestAndPrincipal() + + + /** + * IPMT + * + * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. + * + * @param float $rate Interest rate per period + * @param int $per Period for which we want to find the interest + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $per = (int) self::flattenSingleValue($per); + $nper = (int) self::flattenSingleValue($nper); + $pv = self::flattenSingleValue($pv); + $fv = self::flattenSingleValue($fv); + $type = (int) self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + if ($per <= 0 || $per > $nper) { + return self::$_errorCodes['value']; + } + + // Calculate + $interestAndPrincipal = self::_interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type); + return $interestAndPrincipal[0]; + } // function IPMT() + + + /** + * CUMIPMT + * + * Returns the cumulative interest paid on a loan between start_period and end_period. + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pv Present Value + * @param int start The first period in the calculation. + * Payment periods are numbered beginning with 1. + * @param int end The last period in the calculation. + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0) { + $rate = self::flattenSingleValue($rate); + $nper = (int) self::flattenSingleValue($nper); + $pv = self::flattenSingleValue($pv); + $start = (int) self::flattenSingleValue($start); + $end = (int) self::flattenSingleValue($end); + $type = (int) self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + if ($start < 1 || $start > $end) { + return self::$_errorCodes['value']; + } + + // Calculate + $interest = 0; + for ($per = $start; $per <= $end; ++$per) { + $interest += self::IPMT($rate, $per, $nper, $pv, 0, $type); + } + + return $interest; + } // function CUMIPMT() + + + /** + * PPMT + * + * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. + * + * @param float $rate Interest rate per period + * @param int $per Period for which we want to find the interest + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) { + $rate = self::flattenSingleValue($rate); + $per = (int) self::flattenSingleValue($per); + $nper = (int) self::flattenSingleValue($nper); + $pv = self::flattenSingleValue($pv); + $fv = self::flattenSingleValue($fv); + $type = (int) self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + if ($per <= 0 || $per > $nper) { + return self::$_errorCodes['value']; + } + + // Calculate + $interestAndPrincipal = self::_interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type); + return $interestAndPrincipal[1]; + } // function PPMT() + + + /** + * CUMPRINC + * + * Returns the cumulative principal paid on a loan between start_period and end_period. + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pv Present Value + * @param int start The first period in the calculation. + * Payment periods are numbered beginning with 1. + * @param int end The last period in the calculation. + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * @return float + */ + public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0) { + $rate = self::flattenSingleValue($rate); + $nper = (int) self::flattenSingleValue($nper); + $pv = self::flattenSingleValue($pv); + $start = (int) self::flattenSingleValue($start); + $end = (int) self::flattenSingleValue($end); + $type = (int) self::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return self::$_errorCodes['num']; + } + if ($start < 1 || $start > $end) { + return self::$_errorCodes['value']; + } + + // Calculate + $principal = 0; + for ($per = $start; $per <= $end; ++$per) { + $principal += self::PPMT($rate, $per, $nper, $pv, 0, $type); + } + + return $principal; + } // function CUMPRINC() + + + /** + * NPV + * + * Returns the Net Present Value of a cash flow series given a discount rate. + * + * @param float Discount interest rate + * @param array Cash flow series + * @return float + */ + public static function NPV() { + // Return value + $returnValue = 0; + + // Loop trough arguments + $aArgs = self::flattenArray(func_get_args()); + + // Calculate + $rate = array_shift($aArgs); + for ($i = 1; $i <= count($aArgs); ++$i) { + // Is it a numeric value? + if (is_numeric($aArgs[$i - 1])) { + $returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i); + } + } + + // Return + return $returnValue; + } // function NPV() + + + /** + * DB + * + * Returns the depreciation of an asset for a specified period using the fixed-declining balance method. + * This form of depreciation is used if you want to get a higher depreciation value at the beginning of the depreciation + * (as opposed to linear depreciation). The depreciation value is reduced with every depreciation period by the + * depreciation already deducted from the initial cost. + * + * @param float cost Initial cost of the asset. + * @param float salvage Value at the end of the depreciation. (Sometimes called the salvage value of the asset) + * @param int life Number of periods over which the asset is depreciated. (Sometimes called the useful life of the asset) + * @param int period The period for which you want to calculate the depreciation. Period must use the same units as life. + * @param float month Number of months in the first year. If month is omitted, it defaults to 12. + * @return float + */ + public static function DB($cost, $salvage, $life, $period, $month=12) { + $cost = (float) self::flattenSingleValue($cost); + $salvage = (float) self::flattenSingleValue($salvage); + $life = (int) self::flattenSingleValue($life); + $period = (int) self::flattenSingleValue($period); + $month = (int) self::flattenSingleValue($month); + + // Validate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) { + if ($cost == 0) { + return 0.0; + } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) { + return self::$_errorCodes['num']; + } + // Set Fixed Depreciation Rate + $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = round($fixedDepreciationRate, 3); + + // Loop through each period calculating the depreciation + $previousDepreciation = 0; + for ($per = 1; $per <= $period; ++$per) { + if ($per == 1) { + $depreciation = $cost * $fixedDepreciationRate * $month / 12; + } elseif ($per == ($life + 1)) { + $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12; + } else { + $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate; + } + $previousDepreciation += $depreciation; + } + return $depreciation; + } + return self::$_errorCodes['value']; + } // function DB() + + + /** + * DDB + * + * Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify. + * + * @param float cost Initial cost of the asset. + * @param float salvage Value at the end of the depreciation. (Sometimes called the salvage value of the asset) + * @param int life Number of periods over which the asset is depreciated. (Sometimes called the useful life of the asset) + * @param int period The period for which you want to calculate the depreciation. Period must use the same units as life. + * @param float factor The rate at which the balance declines. + * If factor is omitted, it is assumed to be 2 (the double-declining balance method). + * @return float + */ + public static function DDB($cost, $salvage, $life, $period, $factor=2.0) { + $cost = (float) self::flattenSingleValue($cost); + $salvage = (float) self::flattenSingleValue($salvage); + $life = (int) self::flattenSingleValue($life); + $period = (int) self::flattenSingleValue($period); + $factor = (float) self::flattenSingleValue($factor); + + // Validate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) { + if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) { + return self::$_errorCodes['num']; + } + // Set Fixed Depreciation Rate + $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = round($fixedDepreciationRate, 3); + + // Loop through each period calculating the depreciation + $previousDepreciation = 0; + for ($per = 1; $per <= $period; ++$per) { + $depreciation = min( ($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation) ); + $previousDepreciation += $depreciation; + } + return $depreciation; + } + return self::$_errorCodes['value']; + } // function DDB() + + + private static function _daysPerYear($year,$basis) { + switch ($basis) { + case 0 : + case 2 : + case 4 : + $daysPerYear = 360; + break; + case 3 : + $daysPerYear = 365; + break; + case 1 : + if (self::_isLeapYear(self::YEAR($year))) { + $daysPerYear = 366; + } else { + $daysPerYear = 365; + } + break; + default : + return self::$_errorCodes['num']; + } + return $daysPerYear; + } // function _daysPerYear() + + + /** + * ACCRINT + * + * Returns the discount rate for a security. + * + * @param mixed issue The security's issue date. + * @param mixed firstinter The security's first interest date. + * @param mixed settlement The security's settlement date. + * @param float rate The security's annual coupon rate. + * @param float par The security's par value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function ACCRINT($issue, $firstinter, $settlement, $rate, $par=1000, $frequency=1, $basis=0) { + $issue = self::flattenSingleValue($issue); + $firstinter = self::flattenSingleValue($firstinter); + $settlement = self::flattenSingleValue($settlement); + $rate = (float) self::flattenSingleValue($rate); + $par = (is_null($par)) ? 1000 : (float) self::flattenSingleValue($par); + $frequency = (is_null($frequency)) ? 1 : (int) self::flattenSingleValue($frequency); + $basis = (is_null($basis)) ? 0 : (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($rate)) && (is_numeric($par))) { + if (($rate <= 0) || ($par <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenIssueAndSettlement = self::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + return $daysBetweenIssueAndSettlement; + } + $daysPerYear = self::_daysPerYear(self::YEAR($issue),$basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + + return $par * $rate * ($daysBetweenIssueAndSettlement / $daysPerYear); + } + return self::$_errorCodes['value']; + } // function ACCRINT() + + + /** + * ACCRINTM + * + * Returns the discount rate for a security. + * + * @param mixed issue The security's issue date. + * @param mixed settlement The security's settlement date. + * @param float rate The security's annual coupon rate. + * @param float par The security's par value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function ACCRINTM($issue, $settlement, $rate, $par=1000, $basis=0) { + $issue = self::flattenSingleValue($issue); + $settlement = self::flattenSingleValue($settlement); + $rate = (float) self::flattenSingleValue($rate); + $par = (is_null($par)) ? 1000 : (float) self::flattenSingleValue($par); + $basis = (is_null($basis)) ? 0 : (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($rate)) && (is_numeric($par))) { + if (($rate <= 0) || ($par <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenIssueAndSettlement = self::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + return $daysBetweenIssueAndSettlement; + } + $daysPerYear = self::_daysPerYear(self::YEAR($issue),$basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + + return $par * $rate * ($daysBetweenIssueAndSettlement / $daysPerYear); + } + return self::$_errorCodes['value']; + } // function ACCRINTM() + + + public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) { + } // function AMORDEGRC() + + + public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) { + } // function AMORLINC() + + + /** + * DISC + * + * Returns the discount rate for a security. + * + * @param mixed settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int price The security's price per $100 face value. + * @param int redemption the security's redemption value per $100 face value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function DISC($settlement, $maturity, $price, $redemption, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $price = (float) self::flattenSingleValue($price); + $redemption = (float) self::flattenSingleValue($redemption); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) { + if (($price <= 0) || ($redemption <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + + return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function DISC() + + + /** + * PRICEDISC + * + * Returns the price per $100 face value of a discounted security. + * + * @param mixed settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int discount The security's discount rate. + * @param int redemption The security's redemption value per $100 face value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $discount = (float) self::flattenSingleValue($discount); + $redemption = (float) self::flattenSingleValue($redemption); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) { + if (($discount <= 0) || ($redemption <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + + return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function PRICEDISC() + + + /** + * PRICEMAT + * + * Returns the price per $100 face value of a security that pays interest at maturity. + * + * @param mixed settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed issue The security's issue date. + * @param int rate The security's interest rate at date of issue. + * @param int yield The security's annual yield. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $issue = self::flattenSingleValue($issue); + $rate = self::flattenSingleValue($rate); + $yield = self::flattenSingleValue($yield); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if (is_numeric($rate) && is_numeric($yield)) { + if (($rate <= 0) || ($yield <= 0)) { + return self::$_errorCodes['num']; + } + $daysPerYear = self::_daysPerYear(self::YEAR($settlement),$basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement = self::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + return $daysBetweenIssueAndSettlement; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + $daysBetweenIssueAndMaturity = self::YEARFRAC($issue, $maturity, $basis); + if (!is_numeric($daysBetweenIssueAndMaturity)) { + return $daysBetweenIssueAndMaturity; + } + $daysBetweenIssueAndMaturity *= $daysPerYear; + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return ((100 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate * 100)) / + (1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) - + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100)); + } + return self::$_errorCodes['value']; + } // function PRICEMAT() + + + /** + * RECEIVED + * + * Returns the price per $100 face value of a discounted security. + * + * @param mixed settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int investment The amount invested in the security. + * @param int discount The security's discount rate. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $investment = (float) self::flattenSingleValue($investment); + $discount = (float) self::flattenSingleValue($discount); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) { + if (($investment <= 0) || ($discount <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + + return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity)); + } + return self::$_errorCodes['value']; + } // function RECEIVED() + + + /** + * INTRATE + * + * Returns the interest rate for a fully invested security. + * + * @param mixed settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int investment The amount invested in the security. + * @param int redemption The amount to be received at maturity. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $investment = (float) self::flattenSingleValue($investment); + $redemption = (float) self::flattenSingleValue($redemption); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) { + if (($investment <= 0) || ($redemption <= 0)) { + return self::$_errorCodes['num']; + } + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + + return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function INTRATE() + + + /** + * TBILLEQ + * + * Returns the bond-equivalent yield for a Treasury bill. + * + * @param mixed settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int discount The Treasury bill's discount rate. + * @return float + */ + public static function TBILLEQ($settlement, $maturity, $discount) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $discount = self::flattenSingleValue($discount); + + // Use TBILLPRICE for validation + $testValue = self::TBILLPRICE($settlement, $maturity, $discount); + if (is_string($testValue)) { + return $testValue; + } + + if (is_string($maturity = self::_getDateValue($maturity))) { + return self::$_errorCodes['value']; + } + ++$maturity; + + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity); + $daysBetweenSettlementAndMaturity *= 360; + + return (365 * $discount) / (360 - ($discount * ($daysBetweenSettlementAndMaturity))); + } // function TBILLEQ() + + + /** + * TBILLPRICE + * + * Returns the yield for a Treasury bill. + * + * @param mixed settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int discount The Treasury bill's discount rate. + * @return float + */ + public static function TBILLPRICE($settlement, $maturity, $discount) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $discount = self::flattenSingleValue($discount); + + if (is_string($maturity = self::_getDateValue($maturity))) { + return self::$_errorCodes['value']; + } + ++$maturity; + + // Validate + if (is_numeric($discount)) { + if ($discount <= 0) { + return self::$_errorCodes['num']; + } + + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= 360; + if ($daysBetweenSettlementAndMaturity > 360) { + return self::$_errorCodes['num']; + } + + $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360)); + if ($price <= 0) { + return self::$_errorCodes['num']; + } + return $price; + } + return self::$_errorCodes['value']; + } // function TBILLPRICE() + + + /** + * TBILLYIELD + * + * Returns the yield for a Treasury bill. + * + * @param mixed settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int price The Treasury bill's price per $100 face value. + * @return float + */ + public static function TBILLYIELD($settlement, $maturity, $price) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $price = self::flattenSingleValue($price); + + // Validate + if (is_numeric($price)) { + if ($price <= 0) { + return self::$_errorCodes['num']; + } + + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + + $daysBetweenSettlementAndMaturity *= 360; +// Sometimes we need to add 1, sometimes not. I haven't yet worked out the rule which determines this. + ++$daysBetweenSettlementAndMaturity; + if ($daysBetweenSettlementAndMaturity > 360) { + return self::$_errorCodes['num']; + } + + return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function TBILLYIELD() + + + /** + * SLN + * + * Returns the straight-line depreciation of an asset for one period + * + * @param cost Initial cost of the asset + * @param salvage Value at the end of the depreciation + * @param life Number of periods over which the asset is depreciated + * @return float + */ + public static function SLN($cost, $salvage, $life) { + $cost = self::flattenSingleValue($cost); + $salvage = self::flattenSingleValue($salvage); + $life = self::flattenSingleValue($life); + + // Calculate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { + if ($life < 0) { + return self::$_errorCodes['num']; + } + return ($cost - $salvage) / $life; + } + return self::$_errorCodes['value']; + } // function SLN() + + + /** + * YIELDMAT + * + * Returns the annual yield of a security that pays interest at maturity. + * + * @param mixed settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed issue The security's issue date. + * @param int rate The security's interest rate at date of issue. + * @param int price The security's price per $100 face value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $issue = self::flattenSingleValue($issue); + $rate = self::flattenSingleValue($rate); + $price = self::flattenSingleValue($price); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if (is_numeric($rate) && is_numeric($price)) { + if (($rate <= 0) || ($price <= 0)) { + return self::$_errorCodes['num']; + } + $daysPerYear = self::_daysPerYear(self::YEAR($settlement),$basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement = self::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + return $daysBetweenIssueAndSettlement; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + $daysBetweenIssueAndMaturity = self::YEARFRAC($issue, $maturity, $basis); + if (!is_numeric($daysBetweenIssueAndMaturity)) { + return $daysBetweenIssueAndMaturity; + } + $daysBetweenIssueAndMaturity *= $daysPerYear; + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) / + (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) * + ($daysPerYear / $daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function YIELDMAT() + + + /** + * YIELDDISC + * + * Returns the annual yield of a security that pays interest at maturity. + * + * @param mixed settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int price The security's price per $100 face value. + * @param int redemption The security's redemption value per $100 face value. + * @param int basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * @return float + */ + public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0) { + $settlement = self::flattenSingleValue($settlement); + $maturity = self::flattenSingleValue($maturity); + $price = self::flattenSingleValue($price); + $redemption = self::flattenSingleValue($redemption); + $basis = (int) self::flattenSingleValue($basis); + + // Validate + if (is_numeric($price) && is_numeric($redemption)) { + if (($price <= 0) || ($redemption <= 0)) { + return self::$_errorCodes['num']; + } + $daysPerYear = self::_daysPerYear(self::YEAR($settlement),$basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenSettlementAndMaturity = self::YEARFRAC($settlement, $maturity,$basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity); + } + return self::$_errorCodes['value']; + } // function YIELDDISC() + + + /** + * CELL_ADDRESS + * + * Returns the straight-line depreciation of an asset for one period + * + * @param row Row number to use in the cell reference + * @param column Column number to use in the cell reference + * @param relativity Flag indicating the type of reference to return + * @param sheetText Name of worksheet to use + * @return string + */ + public static function CELL_ADDRESS($row, $column, $relativity=1, $referenceStyle=True, $sheetText='') { + $row = self::flattenSingleValue($row); + $column = self::flattenSingleValue($column); + $relativity = self::flattenSingleValue($relativity); + $sheetText = self::flattenSingleValue($sheetText); + + if ($sheetText > '') { + if (strpos($sheetText,' ') !== False) { $sheetText = "'".$sheetText."'"; } + $sheetText .='!'; + } + if ((!is_bool($referenceStyle)) || $referenceStyle) { + $rowRelative = $columnRelative = '$'; + $column = PHPExcel_Cell::stringFromColumnIndex($column-1); + if (($relativity == 2) || ($relativity == 4)) { $columnRelative = ''; } + if (($relativity == 3) || ($relativity == 4)) { $rowRelative = ''; } + return $sheetText.$columnRelative.$column.$rowRelative.$row; + } else { + if (($relativity == 2) || ($relativity == 4)) { $column = '['.$column.']'; } + if (($relativity == 3) || ($relativity == 4)) { $row = '['.$row.']'; } + return $sheetText.'R'.$row.'C'.$column; + } + } // function CELL_ADDRESS() + + + public static function COLUMN($cellAddress=Null) { + if (is_null($cellAddress) || $cellAddress === '') { + return 0; + } + + foreach($cellAddress as $columnKey => $value) { + return PHPExcel_Cell::columnIndexFromString($columnKey); + } + } // function COLUMN() + + + public static function ROW($cellAddress=Null) { + if ($cellAddress === Null) { + return 0; + } + + foreach($cellAddress as $columnKey => $rowValue) { + foreach($rowValue as $rowKey => $cellValue) { + return $rowKey; + } + } + } // function ROW() + + + public static function OFFSET($cellAddress=Null,$rows=0,$columns=0,$height=null,$width=null) { + if ($cellAddress == Null) { + return 0; + } + + foreach($cellAddress as $startColumnKey => $rowValue) { + $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumnKey); + foreach($rowValue as $startRowKey => $cellValue) { + break 2; + } + } + + foreach($cellAddress as $endColumnKey => $rowValue) { + foreach($rowValue as $endRowKey => $cellValue) { + } + } + $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumnKey); + + $startColumnIndex += --$columns; + $startRowKey += $rows; + + if ($width == null) { + $endColumnIndex += $columns -1; + } else { + $endColumnIndex = $startColumnIndex + $width; + } + if ($height == null) { + $endRowKey += $rows; + } else { + $endRowKey = $startRowKey + $height -1; + } + + if (($startColumnIndex < 0) || ($startRowKey <= 0)) { + return self::$_errorCodes['reference']; + } + + $startColumnKey = PHPExcel_Cell::stringFromColumnIndex($startColumnIndex); + $endColumnKey = PHPExcel_Cell::stringFromColumnIndex($endColumnIndex); + + $startCell = $startColumnKey.$startRowKey; + $endCell = $endColumnKey.$endRowKey; + + if ($startCell == $endCell) { + return $startColumnKey.$startRowKey; + } else { + return $startColumnKey.$startRowKey.':'.$endColumnKey.$endRowKey; + } + } // function OFFSET() + + + public static function CHOOSE() { + $chooseArgs = func_get_args(); + $chosenEntry = self::flattenSingleValue(array_shift($chooseArgs)); + $entryCount = count($chooseArgs) - 1; + + if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) { + --$chosenEntry; + } else { + return self::$_errorCodes['value']; + } + $chosenEntry = floor($chosenEntry); + if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) { + return self::$_errorCodes['value']; + } + + if (is_array($chooseArgs[$chosenEntry])) { + return self::flattenArray($chooseArgs[$chosenEntry]); + } else { + return $chooseArgs[$chosenEntry]; + } + } // function CHOOSE() + + + /** + * MATCH + * The MATCH function searches for a specified item in a range of cells + * @param lookup_value The value that you want to match in lookup_array + * @param lookup_array The range of cells being searched + * @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered. + * @return integer the relative position of the found item + */ + public static function MATCH($lookup_value, $lookup_array, $match_type=1) { + + // flatten the lookup_array + $lookup_array = self::flattenArray($lookup_array); + + // flatten lookup_value since it may be a cell reference to a value or the value itself + $lookup_value = self::flattenSingleValue($lookup_value); + + // MATCH is not case sensitive + $lookup_value = strtolower($lookup_value); + + /* + echo "--------------------
    looking for $lookup_value in
    "; + print_r($lookup_array); + echo "
    "; + //return 1; + /**/ + + // ** + // check inputs + // ** + // lookup_value type has to be number, text, or logical values + if (!is_numeric($lookup_value) && !is_string($lookup_value) && !is_bool($lookup_value)){ + // error: lookup_array should contain only number, text, or logical values + //echo "error: lookup_array should contain only number, text, or logical values
    "; + return self::$_errorCodes['na']; + } + + // match_type is 0, 1 or -1 + if ($match_type!==0 && $match_type!==-1 && $match_type!==1){ + // error: wrong value for match_type + //echo "error: wrong value for match_type
    "; + return self::$_errorCodes['na']; + } + + // lookup_array should not be empty + if (sizeof($lookup_array)<=0){ + // error: empty range + //echo "error: empty range ".sizeof($lookup_array)."
    "; + return self::$_errorCodes['na']; + } + + // lookup_array should contain only number, text, or logical values + for ($i=0;$i"; + return self::$_errorCodes['na']; + } + // convert tpo lowercase + if (is_string($lookup_array[$i])) + $lookup_array[$i] = strtolower($lookup_array[$i]); + } + + // if match_type is 1 or -1, the list has to be ordered + if($match_type==1 || $match_type==-1){ + // ** + // iniitialization + // store the last value + $iLastValue=$lookup_array[0]; + // ** + // loop on the cells + for ($i=0;$i$iLastValue)){ + // error: list is not ordered correctly + //echo "error: list is not ordered correctly
    "; + return self::$_errorCodes['na']; + } + } + } + // ** + // find the match + // ** + // loop on the cells + for ($i=0; $i < sizeof($lookup_array); ++$i){ + // if match_type is 0 <=> find the first value that is exactly equal to lookup_value + if ($match_type==0 && $lookup_array[$i]==$lookup_value){ + // this is the exact match + return $i+1; + } + // if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value + if ($match_type==-1 && $lookup_array[$i] < $lookup_value){ + if ($i<1){ + // 1st cell was allready smaller than the lookup_value + break; + } + else + // the previous cell was the match + return $i; + } + // if match_type is 1 <=> find the largest value that is less than or equal to lookup_value + if ($match_type==1 && $lookup_array[$i] > $lookup_value){ + if ($i<1){ + // 1st cell was allready bigger than the lookup_value + break; + } + else + // the previous cell was the match + return $i; + } + } + // unsuccessful in finding a match, return #N/A error value + //echo "unsuccessful in finding a match
    "; + return self::$_errorCodes['na']; + } // function MATCH() + + + /** + * Uses an index to choose a value from a reference or array + * implemented: Return the value of a specified cell or array of cells Array form + * not implemented: Return a reference to specified cells Reference form + * + * @param range_array a range of cells or an array constant + * @param row_num selects the row in array from which to return a value. If row_num is omitted, column_num is required. + * @param column_num selects the column in array from which to return a value. If column_num is omitted, row_num is required. + */ + public static function INDEX($arrayValues,$rowNum = 0,$columnNum = 0) { + + if (($rowNum < 0) || ($columnNum < 0)) { + return self::$_errorCodes['value']; + } + + $rowKeys = array_keys($arrayValues); + $columnKeys = array_keys($arrayValues[$rowKeys[0]]); + if ($columnNum > count($columnKeys)) { + return self::$_errorCodes['value']; + } elseif ($columnNum == 0) { + if ($rowNum == 0) { + return $arrayValues; + } + $rowNum = $rowKeys[--$rowNum]; + $returnArray = array(); + foreach($arrayValues as $arrayColumn) { + $returnArray[] = $arrayColumn[$rowNum]; + } + return $returnArray; + } + $columnNum = $columnKeys[--$columnNum]; + if ($rowNum > count($rowKeys)) { + return self::$_errorCodes['value']; + } elseif ($rowNum == 0) { + return $arrayValues[$columnNum]; + } + $rowNum = $rowKeys[--$rowNum]; + + return $arrayValues[$rowNum][$columnNum]; + } // function INDEX() + + + /** + * SYD + * + * Returns the sum-of-years' digits depreciation of an asset for a specified period. + * + * @param cost Initial cost of the asset + * @param salvage Value at the end of the depreciation + * @param life Number of periods over which the asset is depreciated + * @param period Period + * @return float + */ + public static function SYD($cost, $salvage, $life, $period) { + $cost = self::flattenSingleValue($cost); + $salvage = self::flattenSingleValue($salvage); + $life = self::flattenSingleValue($life); + $period = self::flattenSingleValue($period); + + // Calculate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) { + if (($life < 1) || ($salvage < $life) || ($period > $life)) { + return self::$_errorCodes['num']; + } + return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1)); + } + return self::$_errorCodes['value']; + } // function SYD() + + + /** + * TRANSPOSE + * + * @param array $matrixData A matrix of values + * @return array + * + * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix. + */ + public static function TRANSPOSE($matrixData) { + $returnMatrix = array(); + if (!is_array($matrixData)) { $matrixData = array(array($matrixData)); } + + $column = 0; + foreach($matrixData as $matrixRow) { + $row = 0; + foreach($matrixRow as $matrixCell) { + $returnMatrix[$column][$row] = $matrixCell; + ++$row; + } + ++$column; + } + return $returnMatrix; + } // function TRANSPOSE() + + + /** + * MMULT + * + * @param array $matrixData1 A matrix of values + * @param array $matrixData2 A matrix of values + * @return array + */ + public static function MMULT($matrixData1,$matrixData2) { + $matrixAData = $matrixBData = array(); + if (!is_array($matrixData1)) { $matrixData1 = array(array($matrixData1)); } + if (!is_array($matrixData2)) { $matrixData2 = array(array($matrixData2)); } + + $rowA = 0; + foreach($matrixData1 as $matrixRow) { + $columnA = 0; + foreach($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return self::$_errorCodes['value']; + } + $matrixAData[$rowA][$columnA] = $matrixCell; + ++$columnA; + } + ++$rowA; + } + try { + $matrixA = new Matrix($matrixAData); + $rowB = 0; + foreach($matrixData2 as $matrixRow) { + $columnB = 0; + foreach($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return self::$_errorCodes['value']; + } + $matrixBData[$rowB][$columnB] = $matrixCell; + ++$columnB; + } + ++$rowB; + } + $matrixB = new Matrix($matrixBData); + + if (($rowA != $columnB) || ($rowB != $columnA)) { + return self::$_errorCodes['value']; + } + + return $matrixA->times($matrixB)->getArray(); + } catch (Exception $ex) { + return self::$_errorCodes['value']; + } + } // function MMULT() + + + /** + * MINVERSE + * + * @param array $matrixValues A matrix of values + * @return array + */ + public static function MINVERSE($matrixValues) { + $matrixData = array(); + if (!is_array($matrixValues)) { $matrixValues = array(array($matrixValues)); } + + $row = $maxColumn = 0; + foreach($matrixValues as $matrixRow) { + $column = 0; + foreach($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return self::$_errorCodes['value']; + } + $matrixData[$column][$row] = $matrixCell; + ++$column; + } + if ($column > $maxColumn) { $maxColumn = $column; } + ++$row; + } + if ($row != $maxColumn) { return self::$_errorCodes['value']; } + + try { + $matrix = new Matrix($matrixData); + return $matrix->inverse()->getArray(); + } catch (Exception $ex) { + return self::$_errorCodes['value']; + } + } // function MINVERSE() + + + /** + * MDETERM + * + * @param array $matrixValues A matrix of values + * @return float + */ + public static function MDETERM($matrixValues) { + $matrixData = array(); + if (!is_array($matrixValues)) { $matrixValues = array(array($matrixValues)); } + + $row = $maxColumn = 0; + foreach($matrixValues as $matrixRow) { + $column = 0; + foreach($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return self::$_errorCodes['value']; + } + $matrixData[$column][$row] = $matrixCell; + ++$column; + } + if ($column > $maxColumn) { $maxColumn = $column; } + ++$row; + } + if ($row != $maxColumn) { return self::$_errorCodes['value']; } + + try { + $matrix = new Matrix($matrixData); + return $matrix->det(); + } catch (Exception $ex) { + return self::$_errorCodes['value']; + } + } // function MDETERM() + + + /** + * SUMX2MY2 + * + * @param mixed $value Value to check + * @return float + */ + public static function SUMX2MY2($matrixData1,$matrixData2) { + $array1 = self::flattenArray($matrixData1); + $array2 = self::flattenArray($matrixData2); + $count1 = count($array1); + $count2 = count($array2); + if ($count1 < $count2) { + $count = $count1; + } else { + $count = $count2; + } + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] * $array1[$i]) - ($array2[$i] * $array2[$i]); + } + } + + return $result; + } // function SUMX2MY2() + + + /** + * SUMX2PY2 + * + * @param mixed $value Value to check + * @return float + */ + public static function SUMX2PY2($matrixData1,$matrixData2) { + $array1 = self::flattenArray($matrixData1); + $array2 = self::flattenArray($matrixData2); + $count1 = count($array1); + $count2 = count($array2); + if ($count1 < $count2) { + $count = $count1; + } else { + $count = $count2; + } + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] * $array1[$i]) + ($array2[$i] * $array2[$i]); + } + } + + return $result; + } // function SUMX2PY2() + + + /** + * SUMXMY2 + * + * @param mixed $value Value to check + * @return float + */ + public static function SUMXMY2($matrixData1,$matrixData2) { + $array1 = self::flattenArray($matrixData1); + $array2 = self::flattenArray($matrixData2); + $count1 = count($array1); + $count2 = count($array2); + if ($count1 < $count2) { + $count = $count1; + } else { + $count = $count2; + } + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] - $array2[$i]) * ($array1[$i] - $array2[$i]); + } + } + + return $result; + } // function SUMXMY2() + + + /** + * VLOOKUP + * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. + * @param lookup_value The value that you want to match in lookup_array + * @param lookup_array The range of cells being searched + * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. + * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. + * @return mixed The value of the found cell + */ + public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { + // index_number must be greater than or equal to 1 + if ($index_number < 1) { + return self::$_errorCodes['value']; + } + + // index_number must be less than or equal to the number of columns in lookup_array + if ($index_number > count($lookup_array)) { + return self::$_errorCodes['reference']; + } + + // re-index lookup_array with numeric keys starting at 1 + array_unshift($lookup_array, array()); + $lookup_array = array_slice(array_values($lookup_array), 1, count($lookup_array), true); + + // look for an exact match + $row_number = array_search($lookup_value, $lookup_array[1]); + + // if an exact match is required, we have what we need to return an appropriate response + if ($not_exact_match == false) { + if ($row_number === false) { + return self::$_errorCodes['na']; + } else { + return $lookup_array[$index_number][$row_number]; + } + } + + // TODO: The VLOOKUP spec in Excel states that, at this point, we should search for + // the highest value that is less than lookup_value. However, documentation on how string + // values should be treated here is sparse. + return self::$_errorCodes['na']; + } // function VLOOKUP() + + /** + * LOOKUP + * The LOOKUP function searches for value either from a one-row or one-column range or from an array. + * @param lookup_value The value that you want to match in lookup_array + * @param lookup_vector The range of cells being searched + * @param result_vector The column from which the matching value must be returned + * @return mixed The value of the found cell + */ + public static function LOOKUP($lookup_value, $lookup_vector, $result_vector=null) { + + // check for LOOKUP Syntax (view Excel documentation) + if( is_null($result_vector) ) + { + // TODO: Syntax 2 (array) + } else { + // Syntax 1 (vector) + // get key (column or row) of lookup_vector + $kl = key($lookup_vector); + // check if lookup_value exists in lookup_vector + if( in_array($lookup_value, $lookup_vector[$kl]) ) + { + // FOUND IT! Get key of lookup_vector + $k_res = array_search($lookup_value, $lookup_vector[$kl]); + } else { + // value NOT FOUND + // Get the smallest value in lookup_vector + // The LOOKUP spec in Excel states --> IMPORTANT - The values in lookup_vector must be placed in ascending order! + $ksv = key($lookup_vector[$kl]); + $smallest_value = $lookup_vector[$kl][$ksv]; + // If lookup_value is smaller than the smallest value in lookup_vector, LOOKUP gives the #N/A error value. + if( $lookup_value < $smallest_value ) + { + return self::$_errorCodes['na']; + } else { + // If LOOKUP can't find the lookup_value, it matches the largest value in lookup_vector that is less than or equal to lookup_value. + // IMPORTANT : In Excel Documentation is not clear what happen if lookup_value is text! + foreach( $lookup_vector[$kl] AS $kk => $value ) + { + if( $lookup_value >= $value ) + { + $k_res = $kk; + } + } + } + } + + // Returns a value from the same position in result_vector + // get key (column or row) of result_vector + $kr = key($result_vector); + if( isset($result_vector[$kr][$k_res]) ) + { + return $result_vector[$kr][$k_res]; + } else { + // TODO: In Excel Documentation is not clear what happen here... + } + } + } // function LOOKUP() + + + /** + * Flatten multidemensional array + * + * @param array $array Array to be flattened + * @return array Flattened array + */ + public static function flattenArray($array) { + if(!is_array ( $array ) ){ + $array = array ( $array ); + } + + $arrayValues = array(); + + foreach ($array as $value) { + if (is_scalar($value)) { + $arrayValues[] = self::flattenSingleValue($value); + } elseif (is_array($value)) { + $arrayValues = array_merge($arrayValues, self::flattenArray($value)); + } else { + $arrayValues[] = $value; + } + } + + return $arrayValues; + } // function flattenArray() + + + /** + * Convert an array with one element to a flat value + * + * @param mixed $value Array or flat value + * @return mixed + */ + public static function flattenSingleValue($value = '') { + if (is_array($value)) { + $value = self::flattenSingleValue(array_pop($value)); + } + return $value; + } // function flattenSingleValue() + +} // class PHPExcel_Calculation_Functions + + +// +// There are a few mathematical functions that aren't available on all versions of PHP for all platforms +// These functions aren't available in Windows implementations of PHP prior to version 5.3.0 +// So we test if they do exist for this version of PHP/operating platform; and if not we create them +// +if (!function_exists('acosh')) { + function acosh($x) { + return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2)); + } // function acosh() +} + +if (!function_exists('asinh')) { + function asinh($x) { + return log($x + sqrt(1 + $x * $x)); + } // function asinh() +} + +if (!function_exists('atanh')) { + function atanh($x) { + return (log(1 + $x) - log(1 - $x)) / 2; + } // function atanh() +} + +if (!function_exists('money_format')) { + function money_format($format, $number) { + $regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?', + '(?:\.([0-9]+))?([in%])/' + ); + $regex = implode('', $regex); + if (setlocale(LC_MONETARY, null) == '') { + setlocale(LC_MONETARY, ''); + } + $locale = localeconv(); + $number = floatval($number); + if (!preg_match($regex, $format, $fmatch)) { + trigger_error("No format specified or invalid format", E_USER_WARNING); + return $number; + } + $flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ', + 'nogroup' => preg_match('/\^/', $fmatch[1]) > 0, + 'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+', + 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, + 'isleft' => preg_match('/\-/', $fmatch[1]) > 0 + ); + $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; + $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; + $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; + $conversion = $fmatch[5]; + $positive = true; + if ($number < 0) { + $positive = false; + $number *= -1; + } + $letter = $positive ? 'p' : 'n'; + $prefix = $suffix = $cprefix = $csuffix = $signal = ''; + if (!$positive) { + $signal = $locale['negative_sign']; + switch (true) { + case $locale['n_sign_posn'] == 0 || $flags['usesignal'] == '(': + $prefix = '('; + $suffix = ')'; + break; + case $locale['n_sign_posn'] == 1: + $prefix = $signal; + break; + case $locale['n_sign_posn'] == 2: + $suffix = $signal; + break; + case $locale['n_sign_posn'] == 3: + $cprefix = $signal; + break; + case $locale['n_sign_posn'] == 4: + $csuffix = $signal; + break; + } + } + if (!$flags['nosimbol']) { + $currency = $cprefix; + $currency .= ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']); + $currency .= $csuffix; + $currency = iconv('ISO-8859-1','UTF-8',$currency); + } else { + $currency = ''; + } + $space = $locale["{$letter}_sep_by_space"] ? ' ' : ''; + + $number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep'] ); + $number = explode($locale['mon_decimal_point'], $number); + + $n = strlen($prefix) + strlen($currency); + if ($left > 0 && $left > $n) { + if ($flags['isleft']) { + $number[0] .= str_repeat($flags['fillchar'], $left - $n); + } else { + $number[0] = str_repeat($flags['fillchar'], $left - $n) . $number[0]; + } + } + $number = implode($locale['mon_decimal_point'], $number); + if ($locale["{$letter}_cs_precedes"]) { + $number = $prefix . $currency . $space . $number . $suffix; + } else { + $number = $prefix . $number . $space . $currency . $suffix; + } + if ($width > 0) { + $number = str_pad($number, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT); + } + $format = str_replace($fmatch[0], $number, $format); + return $format; + } // function money_format() +} diff --git a/libraries/PHPExcel/PHPExcel/Calculation/functionlist.txt b/libraries/PHPExcel/PHPExcel/Calculation/functionlist.txt new file mode 100644 index 000000000..67dbd49cf --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Calculation/functionlist.txt @@ -0,0 +1,351 @@ +ABS +ACCRINT +ACCRINTM +ACOS +ACOSH +ADDRESS +AMORDEGRC +AMORLINC +AND +AREAS +ASC +ASIN +ASINH +ATAN +ATAN2 +ATANH +AVEDEV +AVERAGE +AVERAGEA +AVERAGEIF +AVERAGEIFS +BAHTTEXT +BESSELI +BESSELJ +BESSELK +BESSELY +BETADIST +BETAINV +BIN2DEC +BIN2HEX +BIN2OCT +BINOMDIST +CEILING +CELL +CHAR +CHIDIST +CHIINV +CHITEST +CHOOSE +CLEAN +CODE +COLUMN +COLUMNS +COMBIN +COMPLEX +CONCATENATE +CONFIDENCE +CONVERT +CORREL +COS +COSH +COUNT +COUNTA +COUNTBLANK +COUNTIF +COUNTIFS +COUPDAYBS +COUPDAYBS +COUPDAYSNC +COUPNCD +COUPNUM +COUPPCD +COVAR +CRITBINOM +CUBEKPIMEMBER +CUBEMEMBER +CUBEMEMBERPROPERTY +CUBERANKEDMEMBER +CUBESET +CUBESETCOUNT +CUBEVALUE +CUMIPMT +CUMPRINC +DATE +DATEDIF +DATEVALUE +DAVERAGE +DAY +DAYS360 +DB +DCOUNT +DCOUNTA +DDB +DEC2BIN +DEC2HEX +DEC2OCT +DEGREES +DELTA +DEVSQ +DGET +DISC +DMAX +DMIN +DOLLAR +DOLLARDE +DOLLARFR +DPRODUCT +DSTDEV +DSTDEVP +DSUM +DURATION +DVAR +DVARP +EDATE +EFFECT +EOMONTH +ERF +ERFC +ERROR.TYPE +EVEN +EXACT +EXP +EXPONDIST +FACT +FACTDOUBLE +FALSE +FDIST +FIND +FINDB +FINV +FISHER +FISHERINV +FIXED +FLOOR +FORECAST +FREQUENCY +FTEST +FV +FVSCHEDULE +GAMAMDIST +GAMMAINV +GAMMALN +GCD +GEOMEAN +GESTEP +GETPIVOTDATA +GROWTH +HARMEAN +HEX2BIN +HEX2OCT +HLOOKUP +HOUR +HYPERLINK +HYPGEOMDIST +IF +IFERROR +IMABS +IMAGINARY +IMARGUMENT +IMCONJUGATE +IMCOS +IMEXP +IMLN +IMLOG10 +IMLOG2 +IMPOWER +IMPRODUCT +IMREAL +IMSIN +IMSQRT +IMSUB +IMSUM +INDEX +INDIRECT +INFO +INT +INTERCEPT +INTRATE +IPMT +IRR +ISBLANK +ISERR +ISERROR +ISEVEN +ISLOGICAL +ISNA +ISNONTEXT +ISNUMBER +ISODD +ISPMT +ISREF +ISTEXT +JIS +KURT +LARGE +LCM +LEFT +LEFTB +LEN +LENB +LINEST +LN +LOG +LOG10 +LOGEST +LOGINV +LOGNORMDIST +LOOKUP +LOWER +MATCH +MAX +MAXA +MDETERM +MDURATION +MEDIAN +MID +MIDB +MIN +MINA +MINUTE +MINVERSE +MIRR +MMULT +MOD +MODE +MONTH +MROUND +MULTINOMIAL +N +NA +NEGBINOMDIST +NETWORKDAYS +NOMINAL +NORMDIST +NORMINV +NORMSDIST +NORMSINV +NOT +NOW +NPER +NPV +OCT2BIN +OCT2DEC +OCT2HEX +ODD +ODDFPRICE +ODDFYIELD +ODDLPRICE +ODDLYIELD +OFFSET +OR +PEARSON +PERCENTILE +PERCENTRANK +PERMUT +PHONETIC +PI +PMT +POISSON +POWER +PPMT +PRICE +PRICEDISC +PRICEMAT +PROB +PRODUCT +PROPER +PV +QUARTILE +QUOTIENT +RADIANS +RAND +RANDBETWEEN +RANK +RATE +RECEIVED +REPLACE +REPLACEB +REPT +RIGHT +RIGHTB +ROMAN +ROUND +ROUNDDOWN +ROUNDUP +ROW +ROWS +RSQ +RTD +SEARCH +SEARCHB +SECOND +SERIESSUM +SIGN +SIN +SINH +SKEW +SLN +SLOPE +SMALL +SQRT +SQRTPI +STANDARDIZE +STDEV +STDEVA +STDEVP +STDEVPA +STEYX +SUBSTITUTE +SUBTOTAL +SUM +SUMIF +SUMIFS +SUMPRODUCT +SUMSQ +SUMX2MY2 +SUMX2PY2 +SUMXMY2 +SYD +T +TAN +TANH +TBILLEQ +TBILLPRICE +TBILLYIELD +TDIST +TEXT +TIME +TIMEVALUE +TINV +TODAY +TRANSPOSE +TREND +TRIM +TRIMMEAN +TRUE +TRUNC +TTEST +TYPE +UPPER +USDOLLAR +VALUE +VAR +VARA +VARP +VARPA +VDB +VERSION +VLOOKUP +WEEKDAY +WEEKNUM +WEIBULL +WORKDAY +XIRR +XNPV +YEAR +YEARFRAC +YIELD +YIELDDISC +YIELDMAT +ZTEST diff --git a/libraries/PHPExcel/PHPExcel/Cell.php b/libraries/PHPExcel/PHPExcel/Cell.php new file mode 100644 index 000000000..9b321822a --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell.php @@ -0,0 +1,801 @@ +_column = strtoupper($pColumn); + $this->_row = $pRow; + + // Initialise cell value + $this->_value = $pValue; + + // Set worksheet + $this->_parent = $pSheet; + + // Set datatype? + if (!is_null($pDataType)) { + $this->_dataType = $pDataType; + } else { + if (!self::getValueBinder()->bindValue($this, $pValue)) { + throw new Exception("Value could not be bound to cell."); + } + } + + // set default index to cellXf + $this->_xfIndex = 0; + } + + /** + * Get cell coordinate column + * + * @return string + */ + public function getColumn() + { + return strtoupper($this->_column); + } + + /** + * Get cell coordinate row + * + * @return int + */ + public function getRow() + { + return $this->_row; + } + + /** + * Get cell coordinate + * + * @return string + */ + public function getCoordinate() + { + return $this->_column . $this->_row; + } + + /** + * Get cell value + * + * @return mixed + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set cell value + * + * This clears the cell formula. + * + * @param mixed $pValue Value + * @return PHPExcel_Cell + */ + public function setValue($pValue = null) + { + if (!self::getValueBinder()->bindValue($this, $pValue)) { + throw new Exception("Value could not be bound to cell."); + } + return $this; + } + + /** + * Set cell value (with explicit data type given) + * + * @param mixed $pValue Value + * @param string $pDataType Explicit data type + * @return PHPExcel_Cell + */ + public function setValueExplicit($pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + { + // check strings that they are ok + // TODO: fix also for RichText + if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING && !($pValue instanceof PHPExcel_RichText)) { + // string must never be longer than 32,767 characters, truncate if necessary + $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767); + + // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" + $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); + } + + $this->_value = $pValue; + $this->_dataType = $pDataType; + return $this; + } + + /** + * Get caluclated cell value + * + * @return mixed + */ + public function getCalculatedValue($resetLog=true) + { +// echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'
    '; + if (!is_null($this->_calculatedValue) && $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { + try { +// echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value
    '; + $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog); + } catch ( Exception $ex ) { +// echo 'Calculation Exception: '.$ex->getMessage().'
    '; + $result = '#N/A'; + } + + if ((is_string($result)) && ($result == '#Not Yet Implemented')) { +// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'
    '; + return $this->_calculatedValue; // Fallback if calculation engine does not support the formula. + } else { +// echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().'
    '; + return $result; + } + } + + if (is_null($this->_value)) { +// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise
    '; + return null; + } else if ($this->_dataType != PHPExcel_Cell_DataType::TYPE_FORMULA) { +// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'
    '; + return $this->_value; + } else { +// echo 'Cell value is a formula: Calculating value
    '; + return PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog); + } + } + + /** + * Set calculated value (used for caching) + * + * @param mixed $pValue Value + * @return PHPExcel_Cell + */ + public function setCalculatedValue($pValue = null) + { + if (!is_null($pValue)) { + $this->_calculatedValue = $pValue; + } + return $this; + } + + /** + * Get old calculated value (cached) + * + * @return mixed + */ + public function getOldCalculatedValue() + { + return $this->_calculatedValue; + } + + /** + * Get cell data type + * + * @return string + */ + public function getDataType() + { + return $this->_dataType; + } + + /** + * Set cell data type + * + * @param string $pDataType + * @return PHPExcel_Cell + */ + public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + { + $this->_dataType = $pDataType; + return $this; + } + + /** + * Has Data validation? + * + * @return boolean + */ + public function hasDataValidation() + { + if (!isset($this->_parent)) { + throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); + } + + return $this->_parent->dataValidationExists($this->getCoordinate()); + } + + /** + * Get Data validation + * + * @return PHPExcel_Cell_DataValidation + */ + public function getDataValidation() + { + if (!isset($this->_parent)) { + throw new Exception('Cannot get data validation for cell that is not bound to a worksheet'); + } + + $dataValidation = $this->_parent->getDataValidation($this->getCoordinate()); + return $dataValidation; + } + + /** + * Set Data validation + * + * @param PHPExcel_Cell_DataValidation $pDataValidation + * @throws Exception + * @return PHPExcel_Cell + */ + public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null) + { + if (!isset($this->_parent)) { + throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); + } + + $this->_parent->setDataValidation($this->getCoordinate(), $pDataValidation); + return $this; + } + + /** + * Has Hyperlink + * + * @return boolean + */ + public function hasHyperlink() + { + if (!isset($this->_parent)) { + throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); + } + + return $this->_parent->hyperlinkExists($this->getCoordinate()); + } + + /** + * Get Hyperlink + * + * @throws Exception + * @return PHPExcel_Cell_Hyperlink + */ + public function getHyperlink() + { + if (!isset($this->_parent)) { + throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); + } + + $hyperlink = $this->_parent->getHyperlink($this->getCoordinate()); + return $hyperlink; + } + + /** + * Set Hyperlink + * + * @param PHPExcel_Cell_Hyperlink $pHyperlink + * @throws Exception + * @return PHPExcel_Cell + */ + public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null) + { + if (!isset($this->_parent)) { + throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); + } + + $this->_parent->setHyperlink($this->getCoordinate(), $pHyperlink); + return $this; + } + + /** + * Get parent + * + * @return PHPExcel_Worksheet + */ + public function getParent() { + return $this->_parent; + } + + /** + * Re-bind parent + * + * @param PHPExcel_Worksheet $parent + * @return PHPExcel_Cell + */ + public function rebindParent(PHPExcel_Worksheet $parent) { + $this->_parent = $parent; + return $this; + } + + /** + * Is cell in a specific range? + * + * @param string $pRange Cell range (e.g. A1:A1) + * @return boolean + */ + public function isInRange($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Extract range + $rangeA = ''; + $rangeB = ''; + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + list($rangeA, $rangeB) = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + + // Translate properties + $myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()) - 1; + $myRow = $this->getRow(); + + // Verify if cell is in range + return ( + ($rangeStart[0] <= $myColumn && $rangeEnd[0] >= $myColumn) && + ($rangeStart[1] <= $myRow && $rangeEnd[1] >= $myRow) + ); + } + + /** + * Coordinate from string + * + * @param string $pCoordinateString + * @return array Array containing column and row (indexes 0 and 1) + * @throws Exception + */ + public static function coordinateFromString($pCoordinateString = 'A1') + { + if (strpos($pCoordinateString,':') !== false) { + throw new Exception('Cell coordinate string can not be a range of cells.'); + } else if ($pCoordinateString == '') { + throw new Exception('Cell coordinate can not be zero-length string.'); + } else { + // Column + $column = ''; + + // Row + $row = ''; + + // Convert a cell reference + if (preg_match("/([$]?[A-Z]+)([$]?\d+)/", $pCoordinateString, $matches)) { + list(, $column, $row) = $matches; + } + + // Return array + return array($column, $row); + } + } + + /** + * Make string coordinate absolute + * + * @param string $pCoordinateString + * @return string Absolute coordinate + * @throws Exception + */ + public static function absoluteCoordinate($pCoordinateString = 'A1') + { + if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) { + // Return value + $returnValue = ''; + + // Create absolute coordinate + list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString); + $returnValue = '$' . $column . '$' . $row; + + // Return + return $returnValue; + } else { + throw new Exception("Coordinate string should not be a cell range."); + } + } + + /** + * Split range into coordinate strings + * + * @param string $pRange + * @return array Array containg one or more arrays containing one or two coordinate strings + */ + public static function splitRange($pRange = 'A1:A1') + { + $exploded = explode(',', $pRange); + for ($i = 0; $i < count($exploded); ++$i) { + $exploded[$i] = explode(':', $exploded[$i]); + } + return $exploded; + } + + /** + * Build range from coordinate strings + * + * @param array $pRange Array containg one or more arrays containing one or two coordinate strings + * @return string String representation of $pRange + * @throws Exception + */ + public static function buildRange($pRange) + { + // Verify range + if (!is_array($pRange) || count($pRange) == 0 || !is_array($pRange[0])) { + throw new Exception('Range does not contain any information.'); + } + + // Build range + $imploded = array(); + for ($i = 0; $i < count($pRange); ++$i) { + $pRange[$i] = implode(':', $pRange[$i]); + } + $imploded = implode(',', $pRange); + + return $imploded; + } + + /** + * Calculate range dimension + * + * @param string $pRange Cell range (e.g. A1:A1) + * @return array Range dimension (width, height) + */ + public static function rangeDimension($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Extract range + $rangeA = ''; + $rangeB = ''; + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + list($rangeA, $rangeB) = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]); + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]); + + return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); + } + + /** + * Column index from string + * + * @param string $pString + * @return int Column index (base 1 !!!) + * @throws Exception + */ + public static function columnIndexFromString($pString = 'A') + { + // Convert to uppercase + $pString = strtoupper($pString); + + $strLen = strlen($pString); + // Convert column to integer + if ($strLen == 1) { + return (ord($pString{0}) - 64); + } elseif ($strLen == 2) { + return $result = ((1 + (ord($pString{0}) - 65)) * 26) + (ord($pString{1}) - 64); + } elseif ($strLen == 3) { + return ((1 + (ord($pString{0}) - 65)) * 676) + ((1 + (ord($pString{1}) - 65)) * 26) + (ord($pString{2}) - 64); + } else { + throw new Exception("Column string index can not be " . ($strLen != 0 ? "longer than 3 characters" : "empty") . "."); + } + } + + /** + * String from columnindex + * + * @param int $pColumnIndex Column index (base 0 !!!) + * @return string + */ + public static function stringFromColumnIndex($pColumnIndex = 0) + { + // Determine column string + if ($pColumnIndex < 26) { + return chr(65 + $pColumnIndex); + } + return PHPExcel_Cell::stringFromColumnIndex((int)($pColumnIndex / 26) -1).chr(65 + $pColumnIndex%26) ; + } + + /** + * Extract all cell references in range + * + * @param string $pRange Range (e.g. A1 or A1:A10 or A1:A10 A100:A1000) + * @return array Array containing single cell references + */ + public static function extractAllCellReferencesInRange($pRange = 'A1') { + // Returnvalue + $returnValue = array(); + + // Explode spaces + $aExplodeSpaces = explode(' ', str_replace('$', '', strtoupper($pRange))); + foreach ($aExplodeSpaces as $explodedSpaces) { + // Single cell? + if (strpos($explodedSpaces,':') === false && strpos($explodedSpaces,',') === false) { + $col = 'A'; + $row = 1; + list($col, $row) = PHPExcel_Cell::coordinateFromString($explodedSpaces); + + if (strlen($col) <= 2) { + $returnValue[] = $explodedSpaces; + } + + continue; + } + + // Range... + $range = PHPExcel_Cell::splitRange($explodedSpaces); + for ($i = 0; $i < count($range); ++$i) { + // Single cell? + if (count($range[$i]) == 1) { + $col = 'A'; + $row = 1; + list($col, $row) = PHPExcel_Cell::coordinateFromString($range[$i]); + + if (strlen($col) <= 2) { + $returnValue[] = $explodedSpaces; + } + } + + // Range... + $rangeStart = $rangeEnd = ''; + $startingCol = $startingRow = $endingCol = $endingRow = 0; + + list($rangeStart, $rangeEnd) = $range[$i]; + list($startingCol, $startingRow) = PHPExcel_Cell::coordinateFromString($rangeStart); + list($endingCol, $endingRow) = PHPExcel_Cell::coordinateFromString($rangeEnd); + + // Conversions... + $startingCol = PHPExcel_Cell::columnIndexFromString($startingCol); + $endingCol = PHPExcel_Cell::columnIndexFromString($endingCol); + + // Current data + $currentCol = --$startingCol; + $currentRow = $startingRow; + + // Loop cells + while ($currentCol < $endingCol) { + $loopColumn = PHPExcel_Cell::stringFromColumnIndex($currentCol); + while ($currentRow <= $endingRow) { + $returnValue[] = $loopColumn.$currentRow; + ++$currentRow; + } + ++$currentCol; + $currentRow = $startingRow; + } + } + } + + // Return value + return $returnValue; + } + + /** + * Compare 2 cells + * + * @param PHPExcel_Cell $a Cell a + * @param PHPExcel_Cell $a Cell b + * @return int Result of comparison (always -1 or 1, never zero!) + */ + public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) + { + if ($a->_row < $b->_row) { + return -1; + } elseif ($a->_row > $b->_row) { + return 1; + } elseif (PHPExcel_Cell::columnIndexFromString($a->_column) < PHPExcel_Cell::columnIndexFromString($b->_column)) { + return -1; + } else { + return 1; + } + } + + /** + * Get value binder to use + * + * @return PHPExcel_Cell_IValueBinder + */ + public static function getValueBinder() { + return self::$_valueBinder; + } + + /** + * Set value binder to use + * + * @param PHPExcel_Cell_IValueBinder $binder + * @throws Exception + */ + public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null) { + if (is_null($binder)) { + throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); + } + + self::$_valueBinder = $binder; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * Get index to cellXf + * + * @return int + */ + public function getXfIndex() + { + return $this->_xfIndex; + } + + /** + * Set index to cellXf + * + * @param int $pValue + * @return PHPExcel_Cell + */ + public function setXfIndex($pValue = 0) + { + $this->_xfIndex = $pValue; + return $this; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php b/libraries/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php new file mode 100644 index 000000000..f2c4019d3 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php @@ -0,0 +1,145 @@ +setValueExplicit( (float)str_replace('%', '', $value) / 100, PHPExcel_Cell_DataType::TYPE_NUMERIC); + + // Set style + $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE ); + + return true; + } + + // Check for time e.g. '9:45', '09:45' + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { + list($h, $m) = explode(':', $value); + $days = $h / 24 + $m / 1440; + + // Convert value to number + $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); + + // Set style + $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 ); + + return true; + } + + // Check for date + if (strtotime($value) !== false) { + // make sure we have UTC for the sake of strtotime + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + + // Convert value to Excel date + $cell->setValueExplicit( PHPExcel_Shared_Date::PHPToExcel(strtotime($value)), PHPExcel_Cell_DataType::TYPE_NUMERIC); + + // Set style + $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2 ); + + // restore original value for timezone + date_default_timezone_set($saveTimeZone); + + return true; + } + } + + // Style logic - Numbers + if ($dataType === PHPExcel_Cell_DataType::TYPE_NUMERIC) { + // Leading zeroes? + if (preg_match('/^\-?[0]+[0-9]*\.?[0-9]*$/', $value)) { + // Convert value to string + $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_STRING); + + // Set style + $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT ); + + return true; + } + } + + // Not bound yet? Use parent... + return parent::bindValue($cell, $value); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/DataType.php b/libraries/PHPExcel/PHPExcel/Cell/DataType.php new file mode 100644 index 000000000..cfe35765f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/DataType.php @@ -0,0 +1,85 @@ + 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6); + + /** + * Get list of error codes + * + * @return array + */ + public static function getErrorCodes() { + return self::$_errorCodes; + } + + /** + * DataType for value + * + * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure + * @param mixed $pValue + * @return int + */ + public static function dataTypeForValue($pValue = null) { + return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/DataValidation.php b/libraries/PHPExcel/PHPExcel/Cell/DataValidation.php new file mode 100644 index 000000000..234a93d6c --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/DataValidation.php @@ -0,0 +1,509 @@ +_formula1 = ''; + $this->_formula2 = ''; + $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; + $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; + $this->_operator = ''; + $this->_allowBlank = false; + $this->_showDropDown = false; + $this->_showInputMessage = false; + $this->_showErrorMessage = false; + $this->_errorTitle = ''; + $this->_error = ''; + $this->_promptTitle = ''; + $this->_prompt = ''; + + // Set cell + $this->_parent = $pCell; + } + + /** + * Get Formula 1 + * + * @return string + */ + public function getFormula1() { + return $this->_formula1; + } + + /** + * Set Formula 1 + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setFormula1($value = '') { + $this->_formula1 = $value; + return $this; + } + + /** + * Get Formula 2 + * + * @return string + */ + public function getFormula2() { + return $this->_formula2; + } + + /** + * Set Formula 2 + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setFormula2($value = '') { + $this->_formula2 = $value; + return $this; + } + + /** + * Get Type + * + * @return string + */ + public function getType() { + return $this->_type; + } + + /** + * Set Type + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) { + $this->_type = $value; + return $this; + } + + /** + * Get Error style + * + * @return string + */ + public function getErrorStyle() { + return $this->_errorStyle; + } + + /** + * Set Error style + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) { + $this->_errorStyle = $value; + return $this; + } + + /** + * Get Operator + * + * @return string + */ + public function getOperator() { + return $this->_operator; + } + + /** + * Set Operator + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setOperator($value = '') { + $this->_operator = $value; + return $this; + } + + /** + * Get Allow Blank + * + * @return boolean + */ + public function getAllowBlank() { + return $this->_allowBlank; + } + + /** + * Set Allow Blank + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setAllowBlank($value = false) { + $this->_allowBlank = $value; + return $this; + } + + /** + * Get Show DropDown + * + * @return boolean + */ + public function getShowDropDown() { + return $this->_showDropDown; + } + + /** + * Set Show DropDown + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowDropDown($value = false) { + $this->_showDropDown = $value; + return $this; + } + + /** + * Get Show InputMessage + * + * @return boolean + */ + public function getShowInputMessage() { + return $this->_showInputMessage; + } + + /** + * Set Show InputMessage + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowInputMessage($value = false) { + $this->_showInputMessage = $value; + return $this; + } + + /** + * Get Show ErrorMessage + * + * @return boolean + */ + public function getShowErrorMessage() { + return $this->_showErrorMessage; + } + + /** + * Set Show ErrorMessage + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowErrorMessage($value = false) { + $this->_showErrorMessage = $value; + return $this; + } + + /** + * Get Error title + * + * @return string + */ + public function getErrorTitle() { + return $this->_errorTitle; + } + + /** + * Set Error title + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setErrorTitle($value = '') { + $this->_errorTitle = $value; + return $this; + } + + /** + * Get Error + * + * @return string + */ + public function getError() { + return $this->_error; + } + + /** + * Set Error + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setError($value = '') { + $this->_error = $value; + return $this; + } + + /** + * Get Prompt title + * + * @return string + */ + public function getPromptTitle() { + return $this->_promptTitle; + } + + /** + * Set Prompt title + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setPromptTitle($value = '') { + $this->_promptTitle = $value; + return $this; + } + + /** + * Get Prompt + * + * @return string + */ + public function getPrompt() { + return $this->_prompt; + } + + /** + * Set Prompt + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setPrompt($value = '') { + $this->_prompt = $value; + return $this; + } + + /** + * Get parent + * + * @return PHPExcel_Cell + */ + public function getParent() { + return $this->_parent; + } + + /** + * Set Parent + * + * @param PHPExcel_Cell $value + * @return PHPExcel_Cell_DataValidation + */ + public function setParent($value = null) { + $this->_parent = $value; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_formula1 + . $this->_formula2 + . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE + . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP + . $this->_operator + . ($this->_allowBlank ? 't' : 'f') + . ($this->_showDropDown ? 't' : 'f') + . ($this->_showInputMessage ? 't' : 'f') + . ($this->_showErrorMessage ? 't' : 'f') + . $this->_errorTitle + . $this->_error + . $this->_promptTitle + . $this->_prompt + . $this->_parent->getCoordinate() + . __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + // unbind parent + $this->setParent(null); + + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value) && $key != '_parent') { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php b/libraries/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php new file mode 100644 index 000000000..29b0f6631 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php @@ -0,0 +1,108 @@ +setValueExplicit( $value, PHPExcel_Cell_DataType::dataTypeForValue($value) ); + + // Done! + return true; + } + + /** + * DataType for value + * + * @param mixed $pValue + * @return int + */ + public static function dataTypeForValue($pValue = null) { + // Match the value against a few data types + if (is_null($pValue)) { + return PHPExcel_Cell_DataType::TYPE_NULL; + } elseif ($pValue === '') { + return PHPExcel_Cell_DataType::TYPE_STRING; + } elseif ($pValue instanceof PHPExcel_RichText) { + return PHPExcel_Cell_DataType::TYPE_STRING; + } elseif ($pValue{0} === '=') { + return PHPExcel_Cell_DataType::TYPE_FORMULA; + } elseif (is_bool($pValue)) { + return PHPExcel_Cell_DataType::TYPE_BOOL; + } elseif (is_float($pValue) || is_int($pValue)) { + return PHPExcel_Cell_DataType::TYPE_NUMERIC; + } elseif (preg_match('/^\-?[0-9]*\\.?[0-9]*$/', $pValue)) { + return PHPExcel_Cell_DataType::TYPE_NUMERIC; + } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { + return PHPExcel_Cell_DataType::TYPE_ERROR; + } else { + return PHPExcel_Cell_DataType::TYPE_STRING; + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/Hyperlink.php b/libraries/PHPExcel/PHPExcel/Cell/Hyperlink.php new file mode 100644 index 000000000..122424490 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/Hyperlink.php @@ -0,0 +1,159 @@ +_url = $pUrl; + $this->_tooltip = $pTooltip; + + // Set cell + $this->_parent = $pCell; + } + + /** + * Get URL + * + * @return string + */ + public function getUrl() { + return $this->_url; + } + + /** + * Set URL + * + * @param string $value + * @return PHPExcel_Cell_Hyperlink + */ + public function setUrl($value = '') { + $this->_url = $value; + return $this; + } + + /** + * Get tooltip + * + * @return string + */ + public function getTooltip() { + return $this->_tooltip; + } + + /** + * Set tooltip + * + * @param string $value + * @return PHPExcel_Cell_Hyperlink + */ + public function setTooltip($value = '') { + $this->_tooltip = $value; + return $this; + } + + /** + * Is this hyperlink internal? (to another sheet) + * + * @return boolean + */ + public function isInternal() { + return strpos($this->_url, 'sheet://') !== false; + } + + /** + * Get parent + * + * @return PHPExcel_Cell + */ + public function getParent() { + return $this->_parent; + } + + /** + * Set Parent + * + * @param PHPExcel_Cell $value + * @return PHPExcel_Cell_Hyperlink + */ + public function setParent($value = null) { + $this->_parent = $value; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_url + . $this->_tooltip + . $this->_parent->getCoordinate() + . __CLASS__ + ); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Cell/IValueBinder.php b/libraries/PHPExcel/PHPExcel/Cell/IValueBinder.php new file mode 100644 index 000000000..479ed6920 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Cell/IValueBinder.php @@ -0,0 +1,58 @@ +_author = 'Author'; + $this->_text = new PHPExcel_RichText(); + $this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); + } + + /** + * Get Author + * + * @return string + */ + public function getAuthor() { + return $this->_author; + } + + /** + * Set Author + * + * @param string $pValue + * @return PHPExcel_Comment + */ + public function setAuthor($pValue = '') { + $this->_author = $pValue; + return $this; + } + + /** + * Get Rich text comment + * + * @return PHPExcel_RichText + */ + public function getText() { + return $this->_text; + } + + /** + * Set Rich text comment + * + * @param PHPExcel_RichText $pValue + * @return PHPExcel_Comment + */ + public function setText(PHPExcel_RichText $pValue) { + $this->_text = $pValue; + return $this; + } + + /** + * Get comment width (CSS style, i.e. XXpx or YYpt) + * + * @return string + */ + public function getWidth() { + return $this->_width; + } + + /** + * Set comment width (CSS style, i.e. XXpx or YYpt) + * + * @param string $value + * @return PHPExcel_Comment + */ + public function setWidth($value = '96pt') { + $this->_width = $value; + return $this; + } + + /** + * Get comment height (CSS style, i.e. XXpx or YYpt) + * + * @return string + */ + public function getHeight() { + return $this->_height; + } + + /** + * Set comment height (CSS style, i.e. XXpx or YYpt) + * + * @param string $value + * @return PHPExcel_Comment + */ + public function setHeight($value = '55.5pt') { + $this->_height = $value; + return $this; + } + + /** + * Get left margin (CSS style, i.e. XXpx or YYpt) + * + * @return string + */ + public function getMarginLeft() { + return $this->_marginLeft; + } + + /** + * Set left margin (CSS style, i.e. XXpx or YYpt) + * + * @param string $value + * @return PHPExcel_Comment + */ + public function setMarginLeft($value = '59.25pt') { + $this->_marginLeft = $value; + return $this; + } + + /** + * Get top margin (CSS style, i.e. XXpx or YYpt) + * + * @return string + */ + public function getMarginTop() { + return $this->_marginTop; + } + + /** + * Set top margin (CSS style, i.e. XXpx or YYpt) + * + * @param string $value + * @return PHPExcel_Comment + */ + public function setMarginTop($value = '1.5pt') { + $this->_marginTop = $value; + return $this; + } + + /** + * Is the comment visible by default? + * + * @return boolean + */ + public function getVisible() { + return $this->_visible; + } + + /** + * Set comment default visibility + * + * @param boolean $value + * @return PHPExcel_Comment + */ + public function setVisible($value = false) { + $this->_visible = $value; + return $this; + } + + /** + * Get fill color + * + * @return PHPExcel_Style_Color + */ + public function getFillColor() { + return $this->_fillColor; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_author + . $this->_text->getHashCode() + . $this->_width + . $this->_height + . $this->_marginLeft + . $this->_marginTop + . ($this->_visible ? 1 : 0) + . $this->_fillColor->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/DocumentProperties.php b/libraries/PHPExcel/PHPExcel/DocumentProperties.php new file mode 100644 index 000000000..609108dd1 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/DocumentProperties.php @@ -0,0 +1,345 @@ +_creator = 'Unknown Creator'; + $this->_lastModifiedBy = $this->_creator; + $this->_created = time(); + $this->_modified = time(); + $this->_title = "Untitled Spreadsheet"; + $this->_subject = ''; + $this->_description = ''; + $this->_keywords = ''; + $this->_category = ''; + $this->_company = 'Microsoft Corporation'; + } + + /** + * Get Creator + * + * @return string + */ + public function getCreator() { + return $this->_creator; + } + + /** + * Set Creator + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCreator($pValue = '') { + $this->_creator = $pValue; + return $this; + } + + /** + * Get Last Modified By + * + * @return string + */ + public function getLastModifiedBy() { + return $this->_lastModifiedBy; + } + + /** + * Set Last Modified By + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setLastModifiedBy($pValue = '') { + $this->_lastModifiedBy = $pValue; + return $this; + } + + /** + * Get Created + * + * @return datetime + */ + public function getCreated() { + return $this->_created; + } + + /** + * Set Created + * + * @param datetime $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCreated($pValue = null) { + if (is_null($pValue)) { + $pValue = time(); + } + $this->_created = $pValue; + return $this; + } + + /** + * Get Modified + * + * @return datetime + */ + public function getModified() { + return $this->_modified; + } + + /** + * Set Modified + * + * @param datetime $pValue + * @return PHPExcel_DocumentProperties + */ + public function setModified($pValue = null) { + if (is_null($pValue)) { + $pValue = time(); + } + $this->_modified = $pValue; + return $this; + } + + /** + * Get Title + * + * @return string + */ + public function getTitle() { + return $this->_title; + } + + /** + * Set Title + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setTitle($pValue = '') { + $this->_title = $pValue; + return $this; + } + + /** + * Get Description + * + * @return string + */ + public function getDescription() { + return $this->_description; + } + + /** + * Set Description + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setDescription($pValue = '') { + $this->_description = $pValue; + return $this; + } + + /** + * Get Subject + * + * @return string + */ + public function getSubject() { + return $this->_subject; + } + + /** + * Set Subject + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setSubject($pValue = '') { + $this->_subject = $pValue; + return $this; + } + + /** + * Get Keywords + * + * @return string + */ + public function getKeywords() { + return $this->_keywords; + } + + /** + * Set Keywords + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setKeywords($pValue = '') { + $this->_keywords = $pValue; + return $this; + } + + /** + * Get Category + * + * @return string + */ + public function getCategory() { + return $this->_category; + } + + /** + * Set Category + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCategory($pValue = '') { + $this->_category = $pValue; + return $this; + } + + /** + * Get Company + * + * @return string + */ + public function getCompany() { + return $this->_company; + } + + /** + * Set Company + * + * @param string $pValue + * @return PHPPowerPoint_DocumentProperties + */ + public function setCompany($pValue = '') { + $this->_company = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/DocumentSecurity.php b/libraries/PHPExcel/PHPExcel/DocumentSecurity.php new file mode 100644 index 000000000..65c64742f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/DocumentSecurity.php @@ -0,0 +1,230 @@ +_lockRevision = false; + $this->_lockStructure = false; + $this->_lockWindows = false; + $this->_revisionsPassword = ''; + $this->_workbookPassword = ''; + } + + /** + * Is some sort of dcument security enabled? + * + * @return boolean + */ + function isSecurityEnabled() { + return $this->_lockRevision || + $this->_lockStructure || + $this->_lockWindows; + } + + /** + * Get LockRevision + * + * @return boolean + */ + function getLockRevision() { + return $this->_lockRevision; + } + + /** + * Set LockRevision + * + * @param boolean $pValue + * @return PHPExcel_DocumentSecurity + */ + function setLockRevision($pValue = false) { + $this->_lockRevision = $pValue; + return $this; + } + + /** + * Get LockStructure + * + * @return boolean + */ + function getLockStructure() { + return $this->_lockStructure; + } + + /** + * Set LockStructure + * + * @param boolean $pValue + * @return PHPExcel_DocumentSecurity + */ + function setLockStructure($pValue = false) { + $this->_lockStructure = $pValue; + return $this; + } + + /** + * Get LockWindows + * + * @return boolean + */ + function getLockWindows() { + return $this->_lockWindows; + } + + /** + * Set LockWindows + * + * @param boolean $pValue + * @return PHPExcel_DocumentSecurity + */ + function setLockWindows($pValue = false) { + $this->_lockWindows = $pValue; + return $this; + } + + /** + * Get RevisionsPassword (hashed) + * + * @return string + */ + function getRevisionsPassword() { + return $this->_revisionsPassword; + } + + /** + * Set RevisionsPassword + * + * @param string $pValue + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @return PHPExcel_DocumentSecurity + */ + function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { + if (!$pAlreadyHashed) { + $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + } + $this->_revisionsPassword = $pValue; + return $this; + } + + /** + * Get WorkbookPassword (hashed) + * + * @return string + */ + function getWorkbookPassword() { + return $this->_workbookPassword; + } + + /** + * Set WorkbookPassword + * + * @param string $pValue + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @return PHPExcel_DocumentSecurity + */ + function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { + if (!$pAlreadyHashed) { + $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + } + $this->_workbookPassword = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/HashTable.php b/libraries/PHPExcel/PHPExcel/HashTable.php new file mode 100644 index 000000000..b516f7998 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/HashTable.php @@ -0,0 +1,228 @@ +addFromSource($pSource); + } + } + + /** + * Add HashTable items from source + * + * @param PHPExcel_IComparable[] $pSource Source array to create HashTable from + * @throws Exception + */ + public function addFromSource($pSource = null) { + // Check if an array was passed + if ($pSource == null) { + return; + } else if (!is_array($pSource)) { + throw new Exception('Invalid array parameter passed.'); + } + + foreach ($pSource as $item) { + $this->add($item); + } + } + + /** + * Add HashTable item + * + * @param PHPExcel_IComparable $pSource Item to add + * @throws Exception + */ + public function add(PHPExcel_IComparable $pSource = null) { + // Determine hashcode + $hashCode = null; + $hashIndex = $pSource->getHashIndex(); + if ( is_null ( $hashIndex ) ) { + $hashCode = $pSource->getHashCode(); + } else if ( isset ( $this->_keyMap[$hashIndex] ) ) { + $hashCode = $this->_keyMap[$hashIndex]; + } else { + $hashCode = $pSource->getHashCode(); + } + + // Add value + if (!isset($this->_items[ $hashCode ])) { + $this->_items[ $hashCode ] = $pSource; + $index = count($this->_items) - 1; + $this->_keyMap[ $index ] = $hashCode; + $pSource->setHashIndex( $index ); + } else { + $pSource->setHashIndex( $this->_items[ $hashCode ]->getHashIndex() ); + } + } + + /** + * Remove HashTable item + * + * @param PHPExcel_IComparable $pSource Item to remove + * @throws Exception + */ + public function remove(PHPExcel_IComparable $pSource = null) { + if (isset($this->_items[ $pSource->getHashCode() ])) { + unset($this->_items[ $pSource->getHashCode() ]); + + $deleteKey = -1; + foreach ($this->_keyMap as $key => $value) { + if ($deleteKey >= 0) { + $this->_keyMap[$key - 1] = $value; + } + + if ($value == $pSource->getHashCode()) { + $deleteKey = $key; + } + } + unset($this->_keyMap[ count($this->_keyMap) - 1 ]); + } + } + + /** + * Clear HashTable + * + */ + public function clear() { + $this->_items = array(); + $this->_keyMap = array(); + } + + /** + * Count + * + * @return int + */ + public function count() { + return count($this->_items); + } + + /** + * Get index for hash code + * + * @param string $pHashCode + * @return int Index + */ + public function getIndexForHashCode($pHashCode = '') { + return array_search($pHashCode, $this->_keyMap); + } + + /** + * Get by index + * + * @param int $pIndex + * @return PHPExcel_IComparable + * + */ + public function getByIndex($pIndex = 0) { + if (isset($this->_keyMap[$pIndex])) { + return $this->getByHashCode( $this->_keyMap[$pIndex] ); + } + + return null; + } + + /** + * Get by hashcode + * + * @param string $pHashCode + * @return PHPExcel_IComparable + * + */ + public function getByHashCode($pHashCode = '') { + if (isset($this->_items[$pHashCode])) { + return $this->_items[$pHashCode]; + } + + return null; + } + + /** + * HashTable to array + * + * @return PHPExcel_IComparable[] + */ + public function toArray() { + return $this->_items; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/IComparable.php b/libraries/PHPExcel/PHPExcel/IComparable.php new file mode 100644 index 000000000..f02271fca --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/IComparable.php @@ -0,0 +1,62 @@ + 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), + array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) + ); + + /** + * Autoresolve classes + * + * @var array + */ + private static $_autoResolveClasses = array( + 'Excel2007', + 'Excel5', + 'Serialized', + 'CSV' + ); + + /** + * Private constructor for PHPExcel_IOFactory + */ + private function __construct() { } + + /** + * Get search locations + * + * @return array + */ + public static function getSearchLocations() { + return self::$_searchLocations; + } + + /** + * Set search locations + * + * @param array $value + * @throws Exception + */ + public static function setSearchLocations($value) { + if (is_array($value)) { + self::$_searchLocations = $value; + } else { + throw new Exception('Invalid parameter passed.'); + } + } + + /** + * Add search location + * + * @param string $type Example: IWriter + * @param string $location Example: PHPExcel/Writer/{0}.php + * @param string $classname Example: PHPExcel_Writer_{0} + */ + public static function addSearchLocation($type = '', $location = '', $classname = '') { + self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); + } + + /** + * Create PHPExcel_Writer_IWriter + * + * @param PHPExcel $phpExcel + * @param string $writerType Example: Excel2007 + * @return PHPExcel_Writer_IWriter + */ + public static function createWriter(PHPExcel $phpExcel, $writerType = '') { + // Search type + $searchType = 'IWriter'; + + // Include class + foreach (self::$_searchLocations as $searchLocation) { + if ($searchLocation['type'] == $searchType) { + $className = str_replace('{0}', $writerType, $searchLocation['class']); + $classFile = str_replace('{0}', $writerType, $searchLocation['path']); + + if (!class_exists($className)) { + require_once PHPEXCEL_ROOT . $classFile; + } + + $instance = new $className($phpExcel); + if (!is_null($instance)) { + return $instance; + } + } + } + + // Nothing found... + throw new Exception("No $searchType found for type $writerType"); + } + + /** + * Create PHPExcel_Reader_IReader + * + * @param string $readerType Example: Excel2007 + * @return PHPExcel_Reader_IReader + */ + public static function createReader($readerType = '') { + // Search type + $searchType = 'IReader'; + + // Include class + foreach (self::$_searchLocations as $searchLocation) { + if ($searchLocation['type'] == $searchType) { + $className = str_replace('{0}', $readerType, $searchLocation['class']); + $classFile = str_replace('{0}', $readerType, $searchLocation['path']); + + if (!class_exists($className)) { + require_once PHPEXCEL_ROOT . $classFile; + } + + $instance = new $className(); + if (!is_null($instance)) { + return $instance; + } + } + } + + // Nothing found... + throw new Exception("No $searchType found for type $readerType"); + } + + /** + * Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution + * + * @param string $pFileName + * @return PHPExcel + */ + public static function load($pFilename) { + $reader = self::createReaderForFile($pFilename); + return $reader->load($pFilename); + } + + /** + * Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution + * + * @param string $pFileName + * @return PHPExcel_Reader_IReader + * @throws Exception + */ + public static function createReaderForFile($pFilename) { + // Try loading using self::$_autoResolveClasses + foreach (self::$_autoResolveClasses as $autoResolveClass) { + $reader = self::createReader($autoResolveClass); + if ($reader->canRead($pFilename)) { + return $reader; + } + } + + throw new Exception("Could not automatically determine PHPExcel_Reader_IReader for file."); + } +} diff --git a/libraries/PHPExcel/PHPExcel/NamedRange.php b/libraries/PHPExcel/PHPExcel/NamedRange.php new file mode 100644 index 000000000..ba6ad281e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/NamedRange.php @@ -0,0 +1,231 @@ +_worksheet) + * + * @var bool + */ + private $_localOnly; + + /** + * Create a new NamedRange + * + * @param string $pName + * @param PHPExcel_Worksheet $pWorksheet + * @param string $pRange + * @param bool $pLocalOnly + */ + public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false) + { + // Validate data + if (is_null($pName) || is_null($pWorksheet)|| is_null($pRange)) { + throw new Exception('Parameters can not be null.'); + } + + // Set local members + $this->_name = $pName; + $this->_worksheet = $pWorksheet; + $this->_range = $pRange; + $this->_localOnly = $pLocalOnly; + } + + /** + * Get name + * + * @return string + */ + public function getName() { + return $this->_name; + } + + /** + * Set name + * + * @param string $value + * @return PHPExcel_NamedRange + */ + public function setName($value = null) { + if (!is_null($value)) { + // Old title + $oldTitle = $this->_name; + + // Re-attach + if (!is_null($this->_worksheet)) { + $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); + } + $this->_name = $value; + + if (!is_null($this->_worksheet)) { + $this->_worksheet->getParent()->addNamedRange($this); + } + + // New title + $newTitle = $this->_name; + PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); + } + return $this; + } + + /** + * Get worksheet + * + * @return PHPExcel_Worksheet + */ + public function getWorksheet() { + return $this->_worksheet; + } + + /** + * Set worksheet + * + * @param PHPExcel_Worksheet $value + * @return PHPExcel_NamedRange + */ + public function setWorksheet(PHPExcel_Worksheet $value = null) { + if (!is_null($value)) { + $this->_worksheet = $value; + } + return $this; + } + + /** + * Get range + * + * @return string + */ + public function getRange() { + return $this->_range; + } + + /** + * Set range + * + * @param string $value + * @return PHPExcel_NamedRange + */ + public function setRange($value = null) { + if (!is_null($value)) { + $this->_range = $value; + } + return $this; + } + + /** + * Get localOnly + * + * @return bool + */ + public function getLocalOnly() { + return $this->_localOnly; + } + + /** + * Set localOnly + * + * @param bool $value + * @return PHPExcel_NamedRange + */ + public function setLocalOnly($value = false) { + $this->_localOnly = $value; + return $this; + } + + /** + * Resolve a named range to a regular cell range + * + * @param string $pNamedRange Named range + * @param PHPExcel_Worksheet $pSheet Worksheet + * @return PHPExcel_NamedRange + */ + public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { + return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/CSV.php b/libraries/PHPExcel/PHPExcel/Reader/CSV.php new file mode 100644 index 000000000..30e894b6b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/CSV.php @@ -0,0 +1,294 @@ +_delimiter = ','; + $this->_enclosure = '"'; + $this->_lineEnding = PHP_EOL; + $this->_sheetIndex = 0; + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + } + + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFileName + * @return boolean + */ + public function canRead($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Check if it is a CSV file (using file name) + return (substr(strtolower($pFilename), -3) == 'csv'); + } + + /** + * Loads PHPExcel from file + * + * @param string $pFilename + * @throws Exception + */ + public function load($pFilename) + { + // Create new PHPExcel + $objPHPExcel = new PHPExcel(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $objPHPExcel); + } + + /** + * Read filter + * + * @return PHPExcel_Reader_IReadFilter + */ + public function getReadFilter() { + return $this->_readFilter; + } + + /** + * Set read filter + * + * @param PHPExcel_Reader_IReadFilter $pValue + */ + public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { + $this->_readFilter = $pValue; + } + + /** + * Loads PHPExcel from file into PHPExcel instance + * + * @param string $pFilename + * @param PHPExcel $objPHPExcel + * @throws Exception + */ + public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Create new PHPExcel + while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { + $objPHPExcel->createSheet(); + } + $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); + + // Open file + $fileHandle = fopen($pFilename, 'r'); + if ($fileHandle === false) { + throw new Exception("Could not open file $pFilename for reading."); + } + + // Loop trough file + $currentRow = 0; + $rowData = array(); + while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { + ++$currentRow; + $rowDataCount = count($rowData); + for ($i = 0; $i < $rowDataCount; ++$i) { + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($i); + if ($rowData[$i] != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { + // Unescape enclosures + $rowData[$i] = str_replace("\\" . $this->_enclosure, $this->_enclosure, $rowData[$i]); + $rowData[$i] = str_replace($this->_enclosure . $this->_enclosure, $this->_enclosure, $rowData[$i]); + + // Set cell value + $objPHPExcel->getActiveSheet()->setCellValue( + $columnLetter . $currentRow, $rowData[$i] + ); + } + } + } + + // Close file + fclose($fileHandle); + + // Return + return $objPHPExcel; + } + + /** + * Get delimiter + * + * @return string + */ + public function getDelimiter() { + return $this->_delimiter; + } + + /** + * Set delimiter + * + * @param string $pValue Delimiter, defaults to , + * @return PHPExcel_Reader_CSV + */ + public function setDelimiter($pValue = ',') { + $this->_delimiter = $pValue; + return $this; + } + + /** + * Get enclosure + * + * @return string + */ + public function getEnclosure() { + return $this->_enclosure; + } + + /** + * Set enclosure + * + * @param string $pValue Enclosure, defaults to " + * @return PHPExcel_Reader_CSV + */ + public function setEnclosure($pValue = '"') { + if ($pValue == '') { + $pValue = '"'; + } + $this->_enclosure = $pValue; + return $this; + } + + /** + * Get line ending + * + * @return string + */ + public function getLineEnding() { + return $this->_lineEnding; + } + + /** + * Set line ending + * + * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) + * @return PHPExcel_Reader_CSV + */ + public function setLineEnding($pValue = PHP_EOL) { + $this->_lineEnding = $pValue; + return $this; + } + + /** + * Get sheet index + * + * @return int + */ + public function getSheetIndex() { + return $this->_sheetIndex; + } + + /** + * Set sheet index + * + * @param int $pValue Sheet index + * @return PHPExcel_Reader_CSV + */ + public function setSheetIndex($pValue = 0) { + $this->_sheetIndex = $pValue; + return $this; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php b/libraries/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php new file mode 100644 index 000000000..8d8d83488 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php @@ -0,0 +1,61 @@ +_readDataOnly; + } + + /** + * Set read data only + * + * @param boolean $pValue + * @return PHPExcel_Reader_Excel2007 + */ + public function setReadDataOnly($pValue = false) { + $this->_readDataOnly = $pValue; + return $this; + } + + /** + * Get which sheets to load + * + * @return mixed + */ + public function getLoadSheetsOnly() + { + return $this->_loadSheetsOnly; + } + + /** + * Set which sheets to load + * + * @param mixed $value + * @return PHPExcel_Reader_Excel2007 + */ + public function setLoadSheetsOnly($value = null) + { + $this->_loadSheetsOnly = is_array($value) ? + $value : array($value); + return $this; + } + + /** + * Set all sheets to load + * + * @return PHPExcel_Reader_Excel2007 + */ + public function setLoadAllSheets() + { + $this->_loadSheetsOnly = null; + return $this; + } + + /** + * Read filter + * + * @return PHPExcel_Reader_IReadFilter + */ + public function getReadFilter() { + return $this->_readFilter; + } + + /** + * Set read filter + * + * @param PHPExcel_Reader_IReadFilter $pValue + * @return PHPExcel_Reader_Excel2007 + */ + public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { + $this->_readFilter = $pValue; + return $this; + } + + /** + * Create a new PHPExcel_Reader_Excel2007 instance + */ + public function __construct() { + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + } + + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFileName + * @return boolean + */ + public function canRead($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Load file + $zip = new ZipArchive; + if ($zip->open($pFilename) === true) { + // check if it is an OOXML archive + $rels = simplexml_load_string($zip->getFromName("_rels/.rels")); + + $zip->close(); + + return ($rels !== false); + } + + return false; + } + + + private function _castToBool($c) { +// echo 'Initial Cast to Boolean
    '; + $value = isset($c->v) ? (string) $c->v : null; + if ($value == '0') { + $value = false; + } elseif ($value == '1') { + $value = true; + } else { + $value = (bool)$c->v; + } + return $value; + } // function _castToBool() + + private function _castToError($c) { +// echo 'Initial Cast to Error
    '; + return isset($c->v) ? (string) $c->v : null;; + } // function _castToError() + + private function _castToString($c) { +// echo 'Initial Cast to String
    '; + return isset($c->v) ? (string) $c->v : null;; + } // function _castToString() + + private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { +// echo 'Formula
    '; +// echo '$c->f is '.$c->f.'
    '; + $cellDataType = 'f'; + $value = "={$c->f}"; + $calculatedValue = $this->$castBaseType($c); + + // Shared formula? + if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') { +// echo 'SHARED FORMULA
    '; + $instance = (string)$c->f['si']; + +// echo 'Instance ID = '.$instance.'
    '; +// +// echo 'Shared Formula Array:
    ';
    +//			print_r($sharedFormulas);
    +//			echo '
    '; + if (!isset($sharedFormulas[(string)$c->f['si']])) { +// echo 'SETTING NEW SHARED FORMULA
    '; +// echo 'Master is '.$r.'
    '; +// echo 'Formula is '.$value.'
    '; + $sharedFormulas[$instance] = array( 'master' => $r, + 'formula' => $value + ); +// echo 'New Shared Formula Array:
    ';
    +//				print_r($sharedFormulas);
    +//				echo '
    '; + } else { +// echo 'GETTING SHARED FORMULA
    '; +// echo 'Master is '.$sharedFormulas[$instance]['master'].'
    '; +// echo 'Formula is '.$sharedFormulas[$instance]['formula'].'
    '; + $master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']); + $current = PHPExcel_Cell::coordinateFromString($r); + + $difference = array(0, 0); + $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); + $difference[1] = $current[1] - $master[1]; + + $helper = PHPExcel_ReferenceHelper::getInstance(); + $value = $helper->updateFormulaReferences( $sharedFormulas[$instance]['formula'], + 'A1', + $difference[0], + $difference[1] + ); +// echo 'Adjusted Formula is '.$value.'
    '; + } + } + } + + + /** + * Loads PHPExcel from file + * + * @param string $pFilename + * @throws Exception + */ + public function load($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Initialisations + $excel = new PHPExcel; + $excel->removeSheetByIndex(0); + if (!$this->_readDataOnly) { + $excel->removeCellStyleXfByIndex(0); // remove the default style + $excel->removeCellXfByIndex(0); // remove the default style + } + $zip = new ZipArchive; + $zip->open($pFilename); + + $rels = simplexml_load_string($zip->getFromName("_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + foreach ($rels->Relationship as $rel) { + switch ($rel["Type"]) { + case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties": + $xmlCore = simplexml_load_string($zip->getFromName("{$rel['Target']}")); + if ($xmlCore === false) { // Apache POI hack + $xmlCore = simplexml_load_string($zip->getFromName(substr("{$rel['Target']}", 1))); + } + if ($xmlCore) { + $xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/"); + $xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/"); + $xmlCore->registerXPathNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"); + $docProps = $excel->getProperties(); + $docProps->setCreator((string) self::array_item($xmlCore->xpath("dc:creator"))); + $docProps->setLastModifiedBy((string) self::array_item($xmlCore->xpath("cp:lastModifiedBy"))); + $docProps->setCreated(strtotime(self::array_item($xmlCore->xpath("dcterms:created")))); //! respect xsi:type + $docProps->setModified(strtotime(self::array_item($xmlCore->xpath("dcterms:modified")))); //! respect xsi:type + $docProps->setTitle((string) self::array_item($xmlCore->xpath("dc:title"))); + $docProps->setDescription((string) self::array_item($xmlCore->xpath("dc:description"))); + $docProps->setSubject((string) self::array_item($xmlCore->xpath("dc:subject"))); + $docProps->setKeywords((string) self::array_item($xmlCore->xpath("cp:keywords"))); + $docProps->setCategory((string) self::array_item($xmlCore->xpath("cp:category"))); + } + break; + + case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": + $dir = dirname($rel["Target"]); + $relsWorkbook = simplexml_load_string($zip->getFromName("$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + if ($relsWorkbook === false) { // Apache POI hack + $relsWorkbook = simplexml_load_string($zip->getFromName(substr("$dir/_rels/" . basename($rel["Target"]) . ".rels", 1))); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + } + $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); + + $sharedStrings = array(); + $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); + $xmlStrings = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + if (isset($xmlStrings) && isset($xmlStrings->si)) { + foreach ($xmlStrings->si as $val) { + if (isset($val->t)) { + $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $val->t ); + } elseif (isset($val->r)) { + $sharedStrings[] = $this->_parseRichText($val); + } + } + } + + $worksheets = array(); + foreach ($relsWorkbook->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") { + $worksheets[(string) $ele["Id"]] = $ele["Target"]; + } + } + + $styles = array(); + $cellStyles = array(); + $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); + $xmlStyles = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $numFmts = null; + if ($xmlStyles && $xmlStyles->numFmts[0]) { + $numFmts = $xmlStyles->numFmts[0]; + } + if (isset($numFmts) && !is_null($numFmts)) { + $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + } + if (!$this->_readDataOnly && $xmlStyles) { + foreach ($xmlStyles->cellXfs->xf as $xf) { + $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + + if ($xf["numFmtId"]) { + if (isset($numFmts)) { + $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + + if (isset($tmpNumFmt["formatCode"])) { + $numFmt = (string) $tmpNumFmt["formatCode"]; + } + } + + if ((int)$xf["numFmtId"] < 164) { + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); + } + } + //$numFmt = str_replace('mm', 'i', $numFmt); + //$numFmt = str_replace('h', 'H', $numFmt); + + $style = (object) array( + "numFmt" => $numFmt, + "font" => $xmlStyles->fonts->font[intval($xf["fontId"])], + "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])], + "border" => $xmlStyles->borders->border[intval($xf["borderId"])], + "alignment" => $xf->alignment, + "protection" => $xf->protection, + "applyAlignment" => (isset($xf["applyAlignment"]) && ((string)$xf["applyAlignment"] == 'true' || (string)$xf["applyAlignment"] == '1')), + "applyBorder" => (isset($xf["applyBorder"]) && ((string)$xf["applyBorder"] == 'true' || (string)$xf["applyBorder"] == '1')), + "applyFill" => (isset($xf["applyFill"]) && ((string)$xf["applyFill"] == 'true' || (string)$xf["applyFill"] == '1')), + "applyFont" => (isset($xf["applyFont"]) && ((string)$xf["applyFont"] == 'true' || (string)$xf["applyFont"] == '1')), + "applyNumberFormat" => (isset($xf["applyNumberFormat"]) && ((string)$xf["applyNumberFormat"] == 'true' || (string)$xf["applyNumberFormat"] == '1')), + "applyProtection" => (isset($xf["applyProtection"]) && ((string)$xf["applyProtection"] == 'true' || (string)$xf["applyProtection"] == '1')) + ); + $styles[] = $style; + + // add style to cellXf collection + $objStyle = new PHPExcel_Style; + $this->_readStyle($objStyle, $style); + $excel->addCellXf($objStyle); + } + + foreach ($xmlStyles->cellStyleXfs->xf as $xf) { + $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + if ($numFmts && $xf["numFmtId"]) { + $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + if (isset($tmpNumFmt["formatCode"])) { + $numFmt = (string) $tmpNumFmt["formatCode"]; + } else if ((int)$xf["numFmtId"] < 165) { + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); + } + } + + $cellStyle = (object) array( + "numFmt" => $numFmt, + "font" => $xmlStyles->fonts->font[intval($xf["fontId"])], + "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])], + "border" => $xmlStyles->borders->border[intval($xf["borderId"])], + "alignment" => $xf->alignment, + "protection" => $xf->protection, + "applyAlignment" => true, + "applyBorder" => true, + "applyFill" => true, + "applyFont" => true, + "applyNumberFormat" => true, + "applyProtection" => true + ); + $cellStyles[] = $cellStyle; + + // add style to cellStyleXf collection + $objStyle = new PHPExcel_Style; + $this->_readStyle($objStyle, $cellStyle); + $excel->addCellStyleXf($objStyle); + } + } + + $dxfs = array(); + if (!$this->_readDataOnly && $xmlStyles) { + foreach ($xmlStyles->dxfs->dxf as $dxf) { + $style = new PHPExcel_Style; + $this->_readStyle($style, $dxf); + $dxfs[] = $style; + } + + foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) { + if (intval($cellStyle['builtinId']) == 0) { + if (isset($cellStyles[intval($cellStyle['xfId'])])) { + // Set default style + $style = new PHPExcel_Style; + $this->_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); + + // normal style, currently not using it for anything + } + } + } + } + + $xmlWorkbook = simplexml_load_string($zip->getFromName("{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + if ($xmlWorkbook === false) { // Apache POI hack + $xmlWorkbook = simplexml_load_string($zip->getFromName(substr("{$rel['Target']}", 1))); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + } + // Set base date + if ($xmlWorkbook->workbookPr) { + PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + if (isset($xmlWorkbook->workbookPr['date1904'])) { + $date1904 = (string)$xmlWorkbook->workbookPr['date1904']; + if ($date1904 == "true" || $date1904 == "1") { + PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); + } + } + } + + $sheetId = 0; // keep track of new sheet id in final workbook + $oldSheetId = -1; // keep track of old sheet id in final workbook + $countSkippedSheets = 0; // keep track of number of skipped sheets + $mapSheetId = array(); // mapping of sheet ids from old to new + + foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { + ++$oldSheetId; + + // Check if sheet should be skipped + if (isset($this->_loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { + ++$countSkippedSheets; + $mapSheetId[$oldSheetId] = null; + continue; + } + + // Map old sheet id in original workbook to new sheet id. + // They will differ if loadSheetsOnly() is being used + $mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets; + + // Load sheet + $docSheet = $excel->createSheet(); + $docSheet->setTitle((string) $eleSheet["name"]); + $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; + $xmlSheet = simplexml_load_string($zip->getFromName("$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + + $sharedFormulas = array(); + + if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { + if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { + $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); + } + + if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { + $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); + } + + if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { + $docSheet->setShowGridLines((string)$xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); + } + + if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { + $docSheet->setRightToLeft((string)$xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); + } + + if (isset($xmlSheet->sheetViews->sheetView->pane)) { + if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { + $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); + } else { + $xSplit = 0; + $ySplit = 0; + + if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { + $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); + } + + if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { + $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); + } + + $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); + } + } + } + + if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) { + if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) && $xmlSheet->sheetPr->outlinePr['summaryRight'] == false) { + $docSheet->setShowSummaryRight(false); + } else { + $docSheet->setShowSummaryRight(true); + } + + if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) && $xmlSheet->sheetPr->outlinePr['summaryBelow'] == false) { + $docSheet->setShowSummaryBelow(false); + } else { + $docSheet->setShowSummaryBelow(true); + } + } + + if (isset($xmlSheet->sheetFormatPr)) { + if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { + $docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] ); + } + if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { + $docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] ); + } + } + + if (isset($xmlSheet->cols) && !$this->_readDataOnly) { + foreach ($xmlSheet->cols->col as $col) { + for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { + if ($col["bestFit"]) { + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true); + } + if ($col["hidden"]) { + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(false); + } + if ($col["collapsed"]) { + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(true); + } + if ($col["outlineLevel"] > 0) { + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"])); + } + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setWidth(floatval($col["width"])); + + if (intval($col["max"]) == 16384) { + break; + } + } + } + } + + if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { + if ($xmlSheet->printOptions['gridLinesSet'] == 'true' && $xmlSheet->printOptions['gridLinesSet'] == '1') { + $docSheet->setShowGridlines(true); + } + + if ($xmlSheet->printOptions['gridLines'] == 'true' || $xmlSheet->printOptions['gridLines'] == '1') { + $docSheet->setPrintGridlines(true); + } + + if ($xmlSheet->printOptions['horizontalCentered']) { + $docSheet->getPageSetup()->setHorizontalCentered(true); + } + if ($xmlSheet->printOptions['verticalCentered']) { + $docSheet->getPageSetup()->setVerticalCentered(true); + } + } + + if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { + foreach ($xmlSheet->sheetData->row as $row) { + if ($row["ht"] && !$this->_readDataOnly) { + $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); + } + if ($row["hidden"] && !$this->_readDataOnly) { + $docSheet->getRowDimension(intval($row["r"]))->setVisible(false); + } + if ($row["collapsed"]) { + $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(true); + } + if ($row["outlineLevel"] > 0) { + $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); + } + + foreach ($row->c as $c) { + $r = (string) $c["r"]; + $cellDataType = (string) $c["t"]; + $value = null; + $calculatedValue = null; + + // Read cell? + if (!is_null($this->getReadFilter())) { + $coordinates = PHPExcel_Cell::coordinateFromString($r); + + if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { + break; + } + } + +// echo 'Reading cell '.$coordinates[0].$coordinates[1].'
    '; +// print_r($c); +// echo '
    '; +// echo 'Cell Data Type is '.$cellDataType.': '; +// + // Read cell! + switch ($cellDataType) { + case "s": +// echo 'String
    '; + if ((string)$c->v != '') { + $value = $sharedStrings[intval($c->v)]; + + if ($value instanceof PHPExcel_RichText) { + $value = clone $value; + } + } else { + $value = ''; + } + + break; + case "b": +// echo 'Boolean
    '; + if (!isset($c->f)) { + $value = $this->_castToBool($c); + } else { + // Formula + $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool'); +// echo '$calculatedValue = '.$calculatedValue.'
    '; + } + break; + case "inlineStr": +// echo 'Inline String
    '; + $value = $this->_parseRichText($c->is); + + break; + case "e": +// echo 'Error
    '; + if (!isset($c->f)) { + $value = $this->_castToError($c); + } else { + // Formula + $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError'); +// echo '$calculatedValue = '.$calculatedValue.'
    '; + } + + break; + + default: +// echo 'Default
    '; + if (!isset($c->f)) { +// echo 'Not a Formula
    '; + $value = $this->_castToString($c); + } else { +// echo 'Treat as Formula
    '; + // Formula + $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString'); +// echo '$calculatedValue = '.$calculatedValue.'
    '; + } + + break; + } +// echo 'Value is '.$value.'
    '; + + // Check for numeric values + if (is_numeric($value) && $cellDataType != 's') { + if ($value == (int)$value) $value = (int)$value; + elseif ($value == (float)$value) $value = (float)$value; + elseif ($value == (double)$value) $value = (double)$value; + } + + // Rich text? + if ($value instanceof PHPExcel_RichText && $this->_readDataOnly) { + $value = $value->getPlainText(); + } + + // Assign value + if ($cellDataType != '') { + $docSheet->setCellValueExplicit($r, $value, $cellDataType); + } else { + $docSheet->setCellValue($r, $value); + } + if (!is_null($calculatedValue)) { + $docSheet->getCell($r)->setCalculatedValue($calculatedValue); + } + + // Style information? + if ($c["s"] && !$this->_readDataOnly) { + // no style index means 0, it seems + $docSheet->getCell($r)->setXfIndex(isset($styles[intval($c["s"])]) ? + intval($c["s"]) : 0); + } + + // Set rich text parent + if ($value instanceof PHPExcel_RichText && !$this->_readDataOnly) { + $value->setParent($docSheet->getCell($r)); + } + } + } + } + + $conditionals = array(); + if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { + foreach ($xmlSheet->conditionalFormatting as $conditional) { + foreach ($conditional->cfRule as $cfRule) { + if ( + ( + (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || + (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || + (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT + ) && isset($dxfs[intval($cfRule["dxfId"])]) + ) { + $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; + } + } + } + + foreach ($conditionals as $ref => $cfRules) { + ksort($cfRules); + $conditionalStyles = array(); + foreach ($cfRules as $cfRule) { + $objConditional = new PHPExcel_Style_Conditional(); + $objConditional->setConditionType((string)$cfRule["type"]); + $objConditional->setOperatorType((string)$cfRule["operator"]); + + if ((string)$cfRule["text"] != '') { + $objConditional->setText((string)$cfRule["text"]); + } + + if (count($cfRule->formula) > 1) { + foreach ($cfRule->formula as $formula) { + $objConditional->addCondition((string)$formula); + } + } else { + $objConditional->addCondition((string)$cfRule->formula); + } + $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]); + $conditionalStyles[] = $objConditional; + } + + // Extract all cell references in $ref + $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($ref); + foreach ($aReferences as $reference) { + $docSheet->getStyle($reference)->setConditionalStyles($conditionalStyles); + } + } + } + + $aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells"); + if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + foreach ($aKeys as $key) { + $method = "set" . ucfirst($key); + $docSheet->getProtection()->$method($xmlSheet->sheetProtection[$key] == "true"); + } + } + + if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true); + if ($xmlSheet->protectedRanges->protectedRange) { + foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { + $docSheet->protectCells((string) $protectedRange["sqref"], (string) $protectedRange["password"], true); + } + } + } + + if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) { + $docSheet->setAutoFilter((string) $xmlSheet->autoFilter["ref"]); + } + + if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) { + foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { + $docSheet->mergeCells((string) $mergeCell["ref"]); + } + } + + if ($xmlSheet && $xmlSheet->pageMargins && !$this->_readDataOnly) { + $docPageMargins = $docSheet->getPageMargins(); + $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"])); + $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"])); + $docPageMargins->setTop(floatval($xmlSheet->pageMargins["top"])); + $docPageMargins->setBottom(floatval($xmlSheet->pageMargins["bottom"])); + $docPageMargins->setHeader(floatval($xmlSheet->pageMargins["header"])); + $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"])); + } + + if ($xmlSheet && $xmlSheet->pageSetup && !$this->_readDataOnly) { + $docPageSetup = $docSheet->getPageSetup(); + + if (isset($xmlSheet->pageSetup["orientation"])) { + $docPageSetup->setOrientation((string) $xmlSheet->pageSetup["orientation"]); + } + if (isset($xmlSheet->pageSetup["paperSize"])) { + $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"])); + } + if (isset($xmlSheet->pageSetup["scale"])) { + $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"])); + } + if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) > 0) { + $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"])); + } + if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) > 0) { + $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"])); + } + } + + if ($xmlSheet && $xmlSheet->headerFooter && !$this->_readDataOnly) { + $docHeaderFooter = $docSheet->getHeaderFooter(); + + if (isset($xmlSheet->headerFooter["differentOddEven"]) && + ((string)$xmlSheet->headerFooter["differentOddEven"] == 'true' || (string)$xmlSheet->headerFooter["differentOddEven"] == '1')) { + $docHeaderFooter->setDifferentOddEven(true); + } else { + $docHeaderFooter->setDifferentOddEven(false); + } + if (isset($xmlSheet->headerFooter["differentFirst"]) && + ((string)$xmlSheet->headerFooter["differentFirst"] == 'true' || (string)$xmlSheet->headerFooter["differentFirst"] == '1')) { + $docHeaderFooter->setDifferentFirst(true); + } else { + $docHeaderFooter->setDifferentFirst(false); + } + if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && + ((string)$xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string)$xmlSheet->headerFooter["scaleWithDoc"] == '0')) { + $docHeaderFooter->setScaleWithDocument(false); + } else { + $docHeaderFooter->setScaleWithDocument(true); + } + if (isset($xmlSheet->headerFooter["alignWithMargins"]) && + ((string)$xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string)$xmlSheet->headerFooter["alignWithMargins"] == '0')) { + $docHeaderFooter->setAlignWithMargins(false); + } else { + $docHeaderFooter->setAlignWithMargins(true); + } + + $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader); + $docHeaderFooter->setOddFooter((string) $xmlSheet->headerFooter->oddFooter); + $docHeaderFooter->setEvenHeader((string) $xmlSheet->headerFooter->evenHeader); + $docHeaderFooter->setEvenFooter((string) $xmlSheet->headerFooter->evenFooter); + $docHeaderFooter->setFirstHeader((string) $xmlSheet->headerFooter->firstHeader); + $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter); + } + + if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) { + foreach ($xmlSheet->rowBreaks->brk as $brk) { + if ($brk["man"]) { + $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW); + } + } + } + if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) { + foreach ($xmlSheet->colBreaks->brk as $brk) { + if ($brk["man"]) { + $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN); + } + } + } + + if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { + foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { + // Uppercase coordinate + $range = strtoupper($dataValidation["sqref"]); + + // Extract all cell references in $range + $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($range); + foreach ($aReferences as $reference) { + // Create validation + $docValidation = $docSheet->getCell($reference)->getDataValidation(); + $docValidation->setType((string) $dataValidation["type"]); + $docValidation->setErrorStyle((string) $dataValidation["errorStyle"]); + $docValidation->setOperator((string) $dataValidation["operator"]); + $docValidation->setAllowBlank($dataValidation["allowBlank"] != 0); + $docValidation->setShowDropDown($dataValidation["showDropDown"] == 0); + $docValidation->setShowInputMessage($dataValidation["showInputMessage"] != 0); + $docValidation->setShowErrorMessage($dataValidation["showErrorMessage"] != 0); + $docValidation->setErrorTitle((string) $dataValidation["errorTitle"]); + $docValidation->setError((string) $dataValidation["error"]); + $docValidation->setPromptTitle((string) $dataValidation["promptTitle"]); + $docValidation->setPrompt((string) $dataValidation["prompt"]); + $docValidation->setFormula1((string) $dataValidation->formula1); + $docValidation->setFormula2((string) $dataValidation->formula2); + } + } + } + + // Add hyperlinks + $hyperlinks = array(); + if (!$this->_readDataOnly) { + // Locate hyperlink relations + if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { + $relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { + $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; + } + } + } + + // Loop trough hyperlinks + if ($xmlSheet && $xmlSheet->hyperlinks) { + foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink) { + // Link url + $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { + if (isset($linkRel['id'])) { + $docSheet->getCell( $cellReference )->getHyperlink()->setUrl( $hyperlinks[ (string)$linkRel['id'] ] ); + } + if (isset($hyperlink['location'])) { + $docSheet->getCell( $cellReference )->getHyperlink()->setUrl( 'sheet://' . (string)$hyperlink['location'] ); + } + + // Tooltip + if (isset($hyperlink['tooltip'])) { + $docSheet->getCell( $cellReference )->getHyperlink()->setTooltip( (string)$hyperlink['tooltip'] ); + } + } + } + } + } + + // Add comments + $comments = array(); + $vmlComments = array(); + if (!$this->_readDataOnly) { + // Locate comment relations + if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { + $relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { + $comments[(string)$ele["Id"]] = (string)$ele["Target"]; + } + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { + $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; + } + } + } + + // Loop trough comments + foreach ($comments as $relName => $relPath) { + // Load comments file + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); + $commentsFile = simplexml_load_string($zip->getFromName($relPath) ); + + // Utility variables + $authors = array(); + + // Loop trough authors + foreach ($commentsFile->authors->author as $author) { + $authors[] = (string)$author; + } + + // Loop trough contents + foreach ($commentsFile->commentList->comment as $comment) { + $docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] ); + $docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) ); + } + } + + // Loop trough VML comments + foreach ($vmlComments as $relName => $relPath) { + // Load VML comments file + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); + $vmlCommentsFile = simplexml_load_string( $zip->getFromName($relPath) ); + $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + + $shapes = $vmlCommentsFile->xpath('//v:shape'); + foreach ($shapes as $shape) { + $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + + if (isset($shape['style'])) { + $style = (string)$shape['style']; + $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); + $column = null; + $row = null; + + $clientData = $shape->xpath('.//x:ClientData'); + if (is_array($clientData)) { + $clientData = $clientData[0]; + + if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { + $temp = $clientData->xpath('.//x:Row'); + if (is_array($temp)) $row = $temp[0]; + + $temp = $clientData->xpath('.//x:Column'); + if (is_array($temp)) $column = $temp[0]; + } + } + + if (!is_null($column) && !is_null($row)) { + // Set comment properties + $comment = $docSheet->getCommentByColumnAndRow($column, $row + 1); + $comment->getFillColor()->setRGB( $fillColor ); + + // Parse style + $styleArray = explode(';', str_replace(' ', '', $style)); + foreach ($styleArray as $stylePair) { + $stylePair = explode(':', $stylePair); + + if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); + if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); + if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); + if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); + if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); + + } + } + } + } + } + + // Header/footer images + if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) { + if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { + $relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $vmlRelationship = ''; + + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { + $vmlRelationship = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); + } + } + + if ($vmlRelationship != '') { + // Fetch linked images + $relsVML = simplexml_load_string($zip->getFromName( dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $drawings = array(); + foreach ($relsVML->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { + $drawings[(string) $ele["Id"]] = self::dir_add($vmlRelationship, $ele["Target"]); + } + } + + // Fetch VML document + $vmlDrawing = simplexml_load_string($zip->getFromName($vmlRelationship)); + $vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + + $hfImages = array(); + + $shapes = $vmlDrawing->xpath('//v:shape'); + foreach ($shapes as $shape) { + $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + $imageData = $shape->xpath('//v:imagedata'); + $imageData = $imageData[0]; + + $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); + $style = self::toCSSArray( (string)$shape['style'] ); + + $hfImages[ (string)$shape['id'] ] = new PHPExcel_Worksheet_HeaderFooterDrawing(); + if (isset($imageData['title'])) { + $hfImages[ (string)$shape['id'] ]->setName( (string)$imageData['title'] ); + } + + $hfImages[ (string)$shape['id'] ]->setPath("zip://$pFilename#" . $drawings[(string)$imageData['relid']], false); + $hfImages[ (string)$shape['id'] ]->setResizeProportional(false); + $hfImages[ (string)$shape['id'] ]->setWidth($style['width']); + $hfImages[ (string)$shape['id'] ]->setHeight($style['height']); + $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']); + $hfImages[ (string)$shape['id'] ]->setOffsetY($style['margin-top']); + $hfImages[ (string)$shape['id'] ]->setResizeProportional(true); + } + + $docSheet->getHeaderFooter()->setImages($hfImages); + } + } + } + + } + +// TODO: Make sure drawings and graph are loaded differently! + if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { + $relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $drawings = array(); + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") { + $drawings[(string) $ele["Id"]] = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); + } + } + if ($xmlSheet->drawing && !$this->_readDataOnly) { + foreach ($xmlSheet->drawing as $drawing) { + $fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; + $relsDrawing = simplexml_load_string($zip->getFromName( dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $images = array(); + + if ($relsDrawing && $relsDrawing->Relationship) { + foreach ($relsDrawing->Relationship as $ele) { + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { + $images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]); + } + } + } + $xmlDrawing = simplexml_load_string($zip->getFromName($fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); + + if ($xmlDrawing->oneCellAnchor) { + foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) { + if ($oneCellAnchor->pic->blipFill) { + $blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip; + $xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; + $outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; + $objDrawing = new PHPExcel_Worksheet_Drawing; + $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); + $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); + $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); + $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); + $objDrawing->setResizeProportional(false); + $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"))); + $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"))); + if ($xfrm) { + $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + } + if ($outerShdw) { + $shadow = $objDrawing->getShadow(); + $shadow->setVisible(true); + $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); + $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); + $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); + $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); + $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); + } + $objDrawing->setWorksheet($docSheet); + } + } + } + if ($xmlDrawing->twoCellAnchor) { + foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) { + if ($twoCellAnchor->pic->blipFill) { + $blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip; + $xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; + $outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; + $objDrawing = new PHPExcel_Worksheet_Drawing; + $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); + $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); + $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); + $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); + $objDrawing->setResizeProportional(false); + + $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx"))); + $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy"))); + + if ($xfrm) { + $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + } + if ($outerShdw) { + $shadow = $objDrawing->getShadow(); + $shadow->setVisible(true); + $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); + $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); + $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); + $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); + $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); + } + $objDrawing->setWorksheet($docSheet); + } + } + } + + } + } + } + + // Loop trough definedNames + if ($xmlWorkbook->definedNames) { + foreach ($xmlWorkbook->definedNames->definedName as $definedName) { + // Extract range + $extractedRange = (string)$definedName; + $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); + $extractedRange = str_replace('$', '', $extractedRange); + + // Valid range? + if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { + continue; + } + + // Some definedNames are only applicable if we are on the same sheet... + if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) { + // Switch on type + switch ((string)$definedName['name']) { + + case '_xlnm._FilterDatabase': + $docSheet->setAutoFilter($extractedRange); + break; + + case '_xlnm.Print_Titles': + // Split $extractedRange + $extractedRange = explode(',', $extractedRange); + + // Set print titles + if (isset($extractedRange[0])) { + $range = explode(':', $extractedRange[0]); + + if (PHPExcel_Worksheet::extractSheetTitle($range[0]) != '') + $range[0] = PHPExcel_Worksheet::extractSheetTitle($range[0]); + $range[0] = str_replace('$', '', $range[0]); + if (PHPExcel_Worksheet::extractSheetTitle($range[1]) != '') + $range[1] = PHPExcel_Worksheet::extractSheetTitle($range[1]); + $range[1] = str_replace('$', '', $range[1]); + + $docSheet->getPageSetup()->setColumnsToRepeatAtLeft( $range ); + } + if (isset($extractedRange[1])) { + $range = explode(':', $extractedRange[1]); + + if (PHPExcel_Worksheet::extractSheetTitle($range[0]) != '') + $range[0] = PHPExcel_Worksheet::extractSheetTitle($range[0]); + $range[0] = str_replace('$', '', $range[0]); + if (PHPExcel_Worksheet::extractSheetTitle($range[1]) != '') + $range[1] = PHPExcel_Worksheet::extractSheetTitle($range[1]); + $range[1] = str_replace('$', '', $range[1]); + + $docSheet->getPageSetup()->setRowsToRepeatAtTop( $range ); + } + + break; + + case '_xlnm.Print_Area': + $range = explode('!', $extractedRange); + $extractedRange = isset($range[1]) ? $range[1] : $range[0]; + + $docSheet->getPageSetup()->setPrintArea($extractedRange); + break; + + default: + $range = explode('!', $extractedRange); + $extractedRange = isset($range[1]) ? $range[1] : $range[0]; + + $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, true) ); + break; + } + } else { + // "Global" definedNames + $locatedSheet = null; + $extractedSheetName = ''; + if (strpos( (string)$definedName, '!' ) !== false) { + // Extract sheet name + $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle( (string)$definedName, true ); + $extractedSheetName = $extractedSheetName[0]; + + // Locate sheet + $locatedSheet = $excel->getSheetByName($extractedSheetName); + + // Modify range + $range = explode('!', $extractedRange); + $extractedRange = isset($range[1]) ? $range[1] : $range[0]; + } + + if (!is_null($locatedSheet)) { + $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) ); + } + } + } + } + + // Next sheet id + ++$sheetId; + } + + if (!$this->_readDataOnly) { + // active sheet index + $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index + + // keep active sheet index if sheet is still loaded, else first sheet is set as the active + if ($mapSheetId[$activeTab] !== null) { + $excel->setActiveSheetIndex($mapSheetId[$activeTab]); + } else { + $excel->setActiveSheetIndex(0); + } + } + break; + } + + } + + return $excel; + } + + private function _readColor($color) { + if (isset($color["rgb"])) { + return (string)$color["rgb"]; + } else if (isset($color["indexed"])) { + return PHPExcel_Style_Color::indexedColor($color["indexed"])->getARGB(); + } + } + + private function _readStyle($docStyle, $style) { + // format code + if ($style->applyNumberFormat) $docStyle->getNumberFormat()->setFormatCode($style->numFmt); + + // font + if (isset($style->font)) { + $docStyle->getFont()->setName((string) $style->font->name["val"]); + $docStyle->getFont()->setSize((string) $style->font->sz["val"]); + if (isset($style->font->b)) { + $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || $style->font->b["val"] == 'true'); + } + if (isset($style->font->i)) { + $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || $style->font->i["val"] == 'true'); + } + if (isset($style->font->strike)) { + $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true'); + } + $docStyle->getFont()->getColor()->setARGB($this->_readColor($style->font->color)); + + if (isset($style->font->u) && !isset($style->font->u["val"])) { + $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + } else if (isset($style->font->u) && isset($style->font->u["val"])) { + $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); + } + + if (isset($style->font->vertAlign) && isset($style->font->vertAlign["val"])) { + $vertAlign = strtolower((string)$style->font->vertAlign["val"]); + if ($vertAlign == 'superscript') { + $docStyle->getFont()->setSuperScript(true); + } + if ($vertAlign == 'subscript') { + $docStyle->getFont()->setSubScript(true); + } + } + } + + // fill + if (isset($style->fill) && ($style->applyFill || $style instanceof SimpleXMLElement)) { + if ($style->fill->gradientFill) { + $gradientFill = $style->fill->gradientFill[0]; + $docStyle->getFill()->setFillType((string) $gradientFill["type"]); + $docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); + $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $docStyle->getFill()->getStartColor()->setARGB($this->_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) ); + $docStyle->getFill()->getEndColor()->setARGB($this->_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) ); + } elseif ($style->fill->patternFill) { + $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; + $docStyle->getFill()->setFillType($patternType); + if ($style->fill->patternFill->fgColor) { + $docStyle->getFill()->getStartColor()->setARGB($this->_readColor($style->fill->patternFill->fgColor)); + } else { + $docStyle->getFill()->getStartColor()->setARGB('FF000000'); + } + if ($style->fill->patternFill->bgColor) { + $docStyle->getFill()->getEndColor()->setARGB($this->_readColor($style->fill->patternFill->bgColor)); + } + } + } + + // border + if (isset($style->border) && ($style->applyBorder || $style instanceof SimpleXMLElement)) { + if ($style->border["diagonalUp"] == 'true') { + $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP); + } elseif ($style->border["diagonalDown"] == 'true') { + $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN); + } + $this->_readBorder($docStyle->getBorders()->getLeft(), $style->border->left); + $this->_readBorder($docStyle->getBorders()->getRight(), $style->border->right); + $this->_readBorder($docStyle->getBorders()->getTop(), $style->border->top); + $this->_readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom); + $this->_readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal); + } + + // alignment + if (isset($style->alignment) && ($style->applyAlignment || $style instanceof SimpleXMLElement)) { + $docStyle->getAlignment()->setHorizontal((string) $style->alignment["horizontal"]); + $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]); + + $textRotation = 0; + if ((int)$style->alignment["textRotation"] <= 90) { + $textRotation = (int)$style->alignment["textRotation"]; + } else if ((int)$style->alignment["textRotation"] > 90) { + $textRotation = 90 - (int)$style->alignment["textRotation"]; + } + + $docStyle->getAlignment()->setTextRotation(intval($textRotation)); + $docStyle->getAlignment()->setWrapText( (string)$style->alignment["wrapText"] == "true" || (string)$style->alignment["wrapText"] == "1" ); + $docStyle->getAlignment()->setShrinkToFit( (string)$style->alignment["shrinkToFit"] == "true" || (string)$style->alignment["shrinkToFit"] == "1" ); + $docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 ); + } + + // protection + if (isset($style->protection) && $style->applyProtection) { + if (isset($style->protection['locked'])) { + if ((string)$style->protection['locked'] == 'true') { + $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + } + } + + if (isset($style->protection['hidden'])) { + if ((string)$style->protection['hidden'] == 'true') { + $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + } + } + } + } + + private function _readBorder($docBorder, $eleBorder) { + if (isset($eleBorder["style"])) { + $docBorder->setBorderStyle((string) $eleBorder["style"]); + } + if (isset($eleBorder->color)) { + $docBorder->getColor()->setARGB($this->_readColor($eleBorder->color)); + } + } + + private function _parseRichText($is = null) { + $value = new PHPExcel_RichText(); + + if (isset($is->t)) { + $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) ); + } else { + foreach ($is->r as $run) { + $objText = $value->createTextRun( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); + + if (isset($run->rPr)) { + if (isset($run->rPr->rFont["val"])) { + $objText->getFont()->setName((string) $run->rPr->rFont["val"]); + } + + if (isset($run->rPr->sz["val"])) { + $objText->getFont()->setSize((string) $run->rPr->sz["val"]); + } + + if (isset($run->rPr->color)) { + $objText->getFont()->setColor( new PHPExcel_Style_Color( $this->_readColor($run->rPr->color) ) ); + } + + if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) + || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { + $objText->getFont()->setBold(true); + } + + if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) + || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { + $objText->getFont()->setItalic(true); + } + + if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { + $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); + if ($vertAlign == 'superscript') { + $objText->getFont()->setSuperScript(true); + } + if ($vertAlign == 'subscript') { + $objText->getFont()->setSubScript(true); + } + } + + if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { + $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + } else if (isset($run->rPr->u) && isset($run->rPr->u["val"])) { + $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); + } + + if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) + || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { + $objText->getFont()->setStrikethrough(true); + } + } + } + } + + return $value; + } + + private static function array_item($array, $key = 0) { + return (isset($array[$key]) ? $array[$key] : null); + } + + private static function dir_add($base, $add) { + return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); + } + + private static function toCSSArray($style) { + $style = str_replace("\r", "", $style); + $style = str_replace("\n", "", $style); + + $temp = explode(';', $style); + + $style = array(); + foreach ($temp as $item) { + $item = explode(':', $item); + + if (strpos($item[1], 'px') !== false) { + $item[1] = str_replace('px', '', $item[1]); + } + if (strpos($item[1], 'pt') !== false) { + $item[1] = str_replace('pt', '', $item[1]); + $item[1] = PHPExcel_Shared_Font::fontSizeToPixels($item[1]); + } + if (strpos($item[1], 'in') !== false) { + $item[1] = str_replace('in', '', $item[1]); + $item[1] = PHPExcel_Shared_Font::inchSizeToPixels($item[1]); + } + if (strpos($item[1], 'cm') !== false) { + $item[1] = str_replace('cm', '', $item[1]); + $item[1] = PHPExcel_Shared_Font::centimeterSizeToPixels($item[1]); + } + + $style[$item[0]] = $item[1]; + } + + return $style; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/Excel5.php b/libraries/PHPExcel/PHPExcel/Reader/Excel5.php new file mode 100644 index 000000000..0dcaa2941 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/Excel5.php @@ -0,0 +1,5246 @@ +_data + * + * @var int + */ + private $_dataSize; + + /** + * Current position in stream + * + * @var integer + */ + private $_pos; + + /** + * Workbook to be returned by the reader. + * + * @var PHPExcel + */ + private $_phpExcel; + + /** + * Worksheet that is currently being built by the reader. + * + * @var PHPExcel_Worksheet + */ + private $_phpSheet; + + /** + * BIFF version + * + * @var int + */ + private $_version; + + /** + * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95) + * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE' + * + * @var string + */ + private $_codepage; + + /** + * Shared formats + * + * @var array + */ + private $_formats; + + /** + * Shared fonts + * + * @var array + */ + private $_objFonts; + + /** + * Color palette + * + * @var array + */ + private $_palette; + + /** + * Worksheets + * + * @var array + */ + private $_sheets; + + /** + * External books + * + * @var array + */ + private $_externalBooks; + + /** + * REF structures. Only applies to BIFF8. + * + * @var array + */ + private $_ref; + + /** + * Defined names + * + * @var array + */ + private $_definedname; + + /** + * Shared strings. Only applies to BIFF8. + * + * @var array + */ + private $_sst; + + /** + * Panes are frozen? (in sheet currently being read). See WINDOW2 record. + * + * @var boolean + */ + private $_frozen; + + /** + * Fit printout to number of pages? (in sheet currently being read). See SHEETPR record. + * + * @var boolean + */ + private $_isFitToPages; + + /** + * Objects. One OBJ record contributes with one entry. + * + * @var array + */ + private $_objs; + + /** + * The combined MSODRAWINGGROUP data + * + * @var string + */ + private $_drawingGroupData; + + /** + * The combined MSODRAWING data (per sheet) + * + * @var string + */ + private $_drawingData; + + /** + * Keep track of XF index + * + * @var int + */ + private $_xfIndex; + + /** + * Mapping of XF index (that is a cell XF) to final index in cellXf collection + * + * @var array + */ + private $_mapCellXfIndex; + + /** + * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection + * + * @var array + */ + private $_mapCellStyleXfIndex; + + /** + * The shared formulas in a sheet. One SHAREDFMLA record contributes with one value. + * + * @var array + */ + private $_sharedFormulas; + + /** + * The shared formula parts in a sheet. One FORMULA record contributes with one value if it + * refers to a shared formula. + * + * @var array + */ + private $_sharedFormulaParts; + + /** + * Read data only? + * + * @return boolean + */ + public function getReadDataOnly() + { + return $this->_readDataOnly; + } + + /** + * Set read data only + * + * @param boolean $pValue + * @return PHPExcel_Reader_Excel5 + */ + public function setReadDataOnly($pValue = false) + { + $this->_readDataOnly = $pValue; + return $this; + } + + /** + * Get which sheets to load + * + * @return mixed + */ + public function getLoadSheetsOnly() + { + return $this->_loadSheetsOnly; + } + + /** + * Set which sheets to load + * + * @param mixed $value + * @return PHPExcel_Reader_Excel5 + */ + public function setLoadSheetsOnly($value = null) + { + $this->_loadSheetsOnly = is_array($value) ? + $value : array($value); + return $this; + } + + /** + * Set all sheets to load + * + * @return PHPExcel_Reader_Excel5 + */ + public function setLoadAllSheets() + { + $this->_loadSheetsOnly = null; + return $this; + } + + /** + * Read filter + * + * @return PHPExcel_Reader_IReadFilter + */ + public function getReadFilter() { + return $this->_readFilter; + } + + /** + * Set read filter + * + * @param PHPExcel_Reader_IReadFilter $pValue + * @return PHPExcel_Reader_Excel5 + */ + public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { + $this->_readFilter = $pValue; + return $this; + } + + /** + * Create a new PHPExcel_Reader_Excel5 instance + */ + public function __construct() { + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + } + + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFileName + * @return boolean + */ + public function canRead($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + try { + // Use ParseXL for the hard work. + $this->_ole = new PHPExcel_Shared_OLERead(); + + // get excel data + $res = $this->_ole->read($pFilename); + return true; + + } catch (Exception $e) { + return false; + } + } + + /** + * Loads PHPExcel from file + * + * @param string $pFilename + * @throws Exception + */ + public function load($pFilename) + { + // Initialisations + $this->_phpExcel = new PHPExcel; + $this->_phpExcel->removeSheetByIndex(0); // remove 1st sheet + if (!$this->_readDataOnly) { + $this->_phpExcel->removeCellStyleXfByIndex(0); // remove the default style + $this->_phpExcel->removeCellXfByIndex(0); // remove the default style + } + + // Use ParseXL for the hard work. + $this->_ole = new PHPExcel_Shared_OLERead(); + + // get excel data + $res = $this->_ole->read($pFilename); + $this->_data = $this->_ole->getWorkBook(); + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->_dataSize = strlen($this->_data); + + // initialize + $this->_pos = 0; + $this->_codepage = 'CP1252'; + $this->_formats = array(); + $this->_objFonts = array(); + $this->_palette = array(); + $this->_sheets = array(); + $this->_externalBooks = array(); + $this->_ref = array(); + $this->_definedname = array(); + $this->_sst = array(); + $this->_drawingGroupData = ''; + $this->_xfIndex = ''; + $this->_mapCellXfIndex = array(); + $this->_mapCellStyleXfIndex = array(); + + // Parse Workbook Global Substream + while ($this->_pos < $this->_dataSize) { + $code = $this->_GetInt2d($this->_data, $this->_pos); + + switch ($code) { + case self::XLS_Type_BOF: + $pos = $this->_pos; + $length = $this->_GetInt2d($this->_data, $pos + 2); + $recordData = substr($this->_data, $pos + 4, $length); + + // offset: 0; size: 2; BIFF version + $this->_version = $this->_GetInt2d($this->_data, $pos + 4); + + if (($this->_version != self::XLS_BIFF8) && ($this->_version != self::XLS_BIFF7)) { + return false; + } + + // offset: 2; size: 2; type of stream + $substreamType = $this->_GetInt2d($this->_data, $pos + 6); + if ($substreamType != self::XLS_WorkbookGlobals) { + return false; + } + $this->_pos += 4 + $length; + break; + + case self::XLS_Type_FILEPASS: $this->_readFilepass(); break; + case self::XLS_Type_CODEPAGE: $this->_readCodepage(); break; + case self::XLS_Type_DATEMODE: $this->_readDateMode(); break; + case self::XLS_Type_FONT: $this->_readFont(); break; + case self::XLS_Type_FORMAT: $this->_readFormat(); break; + case self::XLS_Type_XF: $this->_readXf(); break; + case self::XLS_Type_STYLE: $this->_readStyle(); break; + case self::XLS_Type_PALETTE: $this->_readPalette(); break; + case self::XLS_Type_SHEET: $this->_readSheet(); break; + case self::XLS_Type_EXTERNALBOOK: $this->_readExternalBook(); break; + case self::XLS_Type_EXTERNSHEET: $this->_readExternSheet(); break; + case self::XLS_Type_DEFINEDNAME: $this->_readDefinedName(); break; + case self::XLS_Type_MSODRAWINGGROUP: $this->_readMsoDrawingGroup(); break; + case self::XLS_Type_SST: $this->_readSst(); break; + case self::XLS_Type_EOF: $this->_readDefault(); break 2; + default: $this->_readDefault(); break; + } + } + + // Resolve indexed colors for font, fill, and border colors + // Cannot be resolved already in XF record, because PALETTE record comes afterwards + if (!$this->_readDataOnly) { + foreach ($this->_objFonts as $objFont) { + $color = $this->_readColor($objFont->colorIndex); + $objFont->getColor()->setRGB($color['rgb']); + } + + foreach ($this->_phpExcel->getCellXfCollection() as $objStyle) { + // fill start and end color + $startColor = $this->_readColor($objStyle->getFill()->startcolorIndex); + $objStyle->getFill()->getStartColor()->setRGB($startColor['rgb']); + + $endColor = $this->_readColor($objStyle->getFill()->endcolorIndex); + $objStyle->getFill()->getEndColor()->setRGB($endColor['rgb']); + + // border colors + $borderTopColor = $this->_readColor($objStyle->getBorders()->getTop()->colorIndex); + $objStyle->getBorders()->getTop()->getColor()->setRGB($borderTopColor['rgb']); + + $borderRightColor = $this->_readColor($objStyle->getBorders()->getRight()->colorIndex); + $objStyle->getBorders()->getRight()->getColor()->setRGB($borderRightColor['rgb']); + + $borderBottomColor = $this->_readColor($objStyle->getBorders()->getBottom()->colorIndex); + $objStyle->getBorders()->getBottom()->getColor()->setRGB($borderBottomColor['rgb']); + + $borderLeftColor = $this->_readColor($objStyle->getBorders()->getLeft()->colorIndex); + $objStyle->getBorders()->getLeft()->getColor()->setRGB($borderLeftColor['rgb']); + } + } + + // treat MSODRAWINGGROUP records, workbook-level Escher + if (!$this->_readDataOnly && $this->_drawingGroupData) { + $escherWorkbook = new PHPExcel_Shared_Escher(); + $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook); + $escherWorkbook = $reader->load($this->_drawingGroupData); + + // debug Escher stream + //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); + //$debug->load($this->_drawingGroupData); + } + + // Parse the individual sheets + foreach ($this->_sheets as $sheet) { + + // check if sheet should be skipped + if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) { + continue; + } + + // add sheet to PHPExcel object + $this->_phpSheet = $this->_phpExcel->createSheet(); + $this->_phpSheet->setTitle($sheet['name']); + + $this->_pos = $sheet['offset']; + + // Initialize isFitToPages. May change after reading SHEETPR record. + $this->_isFitToPages = false; + + // Initialize drawingData + $this->_drawingData = ''; + + // Initialize objs + $this->_objs = array(); + + // Initialize shared formula parts + $this->_sharedFormulaParts = array(); + + // Initialize shared formulas + $this->_sharedFormulas = array(); + + while ($this->_pos < $this->_dataSize) { + $code = $this->_GetInt2d($this->_data, $this->_pos); + + switch ($code) { + case self::XLS_Type_BOF: + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // do not use this version information for anything + // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream + + // offset: 2; size: 2; type of the following data + $substreamType = $this->_GetInt2d($recordData, 2); + if ($substreamType != self::XLS_Worksheet) { + break 2; + } + break; + + case self::XLS_Type_PRINTGRIDLINES: $this->_readPrintGridlines(); break; + case self::XLS_Type_DEFAULTROWHEIGHT: $this->_readDefaultRowHeight(); break; + case self::XLS_Type_SHEETPR: $this->_readSheetPr(); break; + case self::XLS_Type_HORIZONTALPAGEBREAKS: $this->_readHorizontalPageBreaks(); break; + case self::XLS_Type_VERTICALPAGEBREAKS: $this->_readVerticalPageBreaks(); break; + case self::XLS_Type_HEADER: $this->_readHeader(); break; + case self::XLS_Type_FOOTER: $this->_readFooter(); break; + case self::XLS_Type_HCENTER: $this->_readHcenter(); break; + case self::XLS_Type_VCENTER: $this->_readVcenter(); break; + case self::XLS_Type_LEFTMARGIN: $this->_readLeftMargin(); break; + case self::XLS_Type_RIGHTMARGIN: $this->_readRightMargin(); break; + case self::XLS_Type_TOPMARGIN: $this->_readTopMargin(); break; + case self::XLS_Type_BOTTOMMARGIN: $this->_readBottomMargin(); break; + case self::XLS_Type_PAGESETUP: $this->_readPageSetup(); break; + case self::XLS_Type_PROTECT: $this->_readProtect(); break; + case self::XLS_Type_PASSWORD: $this->_readPassword(); break; + case self::XLS_Type_DEFCOLWIDTH: $this->_readDefColWidth(); break; + case self::XLS_Type_COLINFO: $this->_readColInfo(); break; + case self::XLS_Type_DIMENSION: $this->_readDefault(); break; + case self::XLS_Type_ROW: $this->_readRow(); break; + case self::XLS_Type_DBCELL: $this->_readDefault(); break; + case self::XLS_Type_RK: $this->_readRk(); break; + case self::XLS_Type_LABELSST: $this->_readLabelSst(); break; + case self::XLS_Type_MULRK: $this->_readMulRk(); break; + case self::XLS_Type_NUMBER: $this->_readNumber(); break; + case self::XLS_Type_FORMULA: $this->_readFormula(); break; + case self::XLS_Type_SHAREDFMLA: $this->_readSharedFmla(); break; + case self::XLS_Type_BOOLERR: $this->_readBoolErr(); break; + case self::XLS_Type_MULBLANK: $this->_readMulBlank(); break; + case self::XLS_Type_LABEL: $this->_readLabel(); break; + case self::XLS_Type_BLANK: $this->_readBlank(); break; + case self::XLS_Type_MSODRAWING: $this->_readMsoDrawing(); break; + case self::XLS_Type_OBJ: $this->_readObj(); break; + case self::XLS_Type_WINDOW2: $this->_readWindow2(); break; + case self::XLS_Type_SCL: $this->_readScl(); break; + case self::XLS_Type_PANE: $this->_readPane(); break; + case self::XLS_Type_MERGEDCELLS: $this->_readMergedCells(); break; + case self::XLS_Type_HYPERLINK: $this->_readHyperLink(); break; + case self::XLS_Type_RANGEPROTECTION: $this->_readRangeProtection(); break; + //case self::XLS_Type_IMDATA: $this->_readImData(); break; + case self::XLS_Type_CONTINUE: $this->_readContinue(); break; + case self::XLS_Type_EOF: $this->_readDefault(); break 2; + default: $this->_readDefault(); break; + } + + } + + // treat MSODRAWING records, sheet-level Escher + if (!$this->_readDataOnly && $this->_drawingData) { + $escherWorksheet = new PHPExcel_Shared_Escher(); + $reader = new PHPExcel_Reader_Excel5_Escher($escherWorksheet); + $escherWorksheet = $reader->load($this->_drawingData); + + // debug Escher stream + //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); + //$debug->load($this->_drawingData); + + // get all spContainers in one long array, so they can be mapped to OBJ records + $allSpContainers = $escherWorksheet->getDgContainer()->getSpgrContainer()->getAllSpContainers(); + } + + // treat OBJ records + foreach ($this->_objs as $n => $obj) { + + // the first shape container never has a corresponding OBJ record, hence $n + 1 + $spContainer = $allSpContainers[$n + 1]; + + // we skip all spContainers that are a part of a group shape since we cannot yet handle those + if ($spContainer->getNestingLevel() > 1) { + continue; + } + + // calculate the width and height of the shape + list($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($spContainer->getStartCoordinates()); + list($endColumn, $endRow) = PHPExcel_Cell::coordinateFromString($spContainer->getEndCoordinates()); + + $startOffsetX = $spContainer->getStartOffsetX(); + $startOffsetY = $spContainer->getStartOffsetY(); + $endOffsetX = $spContainer->getEndOffsetX(); + $endOffsetY = $spContainer->getEndOffsetY(); + + $width = PHPExcel_Shared_Excel5::getDistanceX($this->_phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); + $height = PHPExcel_Shared_Excel5::getDistanceY($this->_phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); + + // calculate offsetX and offsetY of the shape + $offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, $startColumn) / 1024; + $offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256; + + switch ($obj['type']) { + + case 0x08: + // picture + + // get index to BSE entry (1-based) + $BSEindex = $spContainer->getOPT(0x0104); + $BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection(); + $BSE = $BSECollection[$BSEindex - 1]; + $blipType = $BSE->getBlipType(); + + // need check because some blip types are not supported by Escher reader such as EMF + if ($blip = $BSE->getBlip()) { + $ih = imagecreatefromstring($blip->getData()); + $drawing = new PHPExcel_Worksheet_MemoryDrawing(); + $drawing->setImageResource($ih); + + // width, height, offsetX, offsetY + $drawing->setResizeProportional(false); + $drawing->setWidth($width); + $drawing->setHeight($height); + $drawing->setOffsetX($offsetX); + $drawing->setOffsetY($offsetY); + + switch ($blipType) { + + case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: + $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG); + $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG); + break; + + case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: + $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG); + $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG); + break; + } + + $drawing->setWorksheet($this->_phpSheet); + $drawing->setCoordinates($spContainer->getStartCoordinates()); + } + + break; + + default: + // other object type + break; + + } + } + + // treat SHAREDFMLA records + if ($this->_version == self::XLS_BIFF8) { + foreach ($this->_sharedFormulaParts as $cell => $baseCell) { + $formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell); + $this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + } + } + } + + // add the named ranges (defined names) + foreach ($this->_definedname as $definedName) { + if ($definedName['isBuiltInName']) { + switch ($definedName['name']) { + + case pack('C', 0x06): + // print area + // in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2 + + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? + + foreach ($ranges as $range) { + // $range should look like this one of these + // Foo!$C$7:$J$66 + // Bar!$A$1:$IV$2 + + $explodes = explode('!', $range); + + if (count($explodes) == 2) { + if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { + $extractedRange = $explodes[1]; + $extractedRange = str_replace('$', '', $extractedRange); + $docSheet->getPageSetup()->setPrintArea($extractedRange); + } + } + } + break; + + case pack('C', 0x07): + // print titles (repeating rows) + // Assuming BIFF8, there are 3 cases + // 1. repeating rows + // formula looks like this: Sheet!$A$1:$IV$2 + // rows 1-2 repeat + // 2. repeating columns + // formula looks like this: Sheet!$A$1:$B$65536 + // columns A-B repeat + // 3. both repeating rows and repeating columns + // formula looks like this: Sheet!$A$1:$B$65536,Sheet!$A$1:$IV$2 + + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? + + foreach ($ranges as $range) { + // $range should look like this one of these + // Sheet!$A$1:$B$65536 + // Sheet!$A$1:$IV$2 + + $explodes = explode('!', $range); + + if (count($explodes) == 2) { + if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { + + $extractedRange = $explodes[1]; + $extractedRange = str_replace('$', '', $extractedRange); + + $coordinateStrings = explode(':', $extractedRange); + if (count($coordinateStrings) == 2) { + list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[0]); + list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[1]); + + if ($firstColumn == 'A' and $lastColumn == 'IV') { + // then we have repeating rows + $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($firstRow, $lastRow)); + } elseif ($firstRow == 1 and $lastRow == 65536) { + // then we have repeating columns + $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($firstColumn, $lastColumn)); + } + } + } + } + } + break; + + } + } else { + // Extract range + $explodes = explode('!', $definedName['formula']); + + if (count($explodes) == 2) { + if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { + $extractedRange = $explodes[1]; + $extractedRange = str_replace('$', '', $extractedRange); + + $this->_phpExcel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, false) ); + } + } + } + } + + return $this->_phpExcel; + } + + /** + * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record. + */ + private function _readDefault() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + } + + /** + * FILEPASS + * + * This record is part of the File Protection Block. It + * contains information about the read/write password of the + * file. All record contents following this record will be + * encrypted. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readFilepass() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + throw new Exception('Cannot read encrypted file'); + } + + /** + * CODEPAGE + * + * This record stores the text encoding used to write byte + * strings, stored as MS Windows code page identifier. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readCodepage() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; code page identifier + $codepage = $this->_GetInt2d($recordData, 0); + + switch ($codepage) { + + case 367: // ASCII + $this->_codepage ="ASCII"; + break; + + case 437: //OEM US + $this->_codepage ="CP437"; + break; + + case 720: //OEM Arabic + // currently not supported by libiconv + $this->_codepage = ""; + break; + + case 737: //OEM Greek + $this->_codepage ="CP737"; + break; + + case 775: //OEM Baltic + $this->_codepage ="CP775"; + break; + + case 850: //OEM Latin I + $this->_codepage ="CP850"; + break; + + case 852: //OEM Latin II (Central European) + $this->_codepage ="CP852"; + break; + + case 855: //OEM Cyrillic + $this->_codepage ="CP855"; + break; + + case 857: //OEM Turkish + $this->_codepage ="CP857"; + break; + + case 858: //OEM Multilingual Latin I with Euro + $this->_codepage ="CP858"; + break; + + case 860: //OEM Portugese + $this->_codepage ="CP860"; + break; + + case 861: //OEM Icelandic + $this->_codepage ="CP861"; + break; + + case 862: //OEM Hebrew + $this->_codepage ="CP862"; + break; + + case 863: //OEM Canadian (French) + $this->_codepage ="CP863"; + break; + + case 864: //OEM Arabic + $this->_codepage ="CP864"; + break; + + case 865: //OEM Nordic + $this->_codepage ="CP865"; + break; + + case 866: //OEM Cyrillic (Russian) + $this->_codepage ="CP866"; + break; + + case 869: //OEM Greek (Modern) + $this->_codepage ="CP869"; + break; + + case 874: //ANSI Thai + $this->_codepage ="CP874"; + break; + + case 932: //ANSI Japanese Shift-JIS + $this->_codepage ="CP932"; + break; + + case 936: //ANSI Chinese Simplified GBK + $this->_codepage ="CP936"; + break; + + case 949: //ANSI Korean (Wansung) + $this->_codepage ="CP949"; + break; + + case 950: //ANSI Chinese Traditional BIG5 + $this->_codepage ="CP950"; + break; + + case 1200: //UTF-16 (BIFF8) + $this->_codepage ="UTF-16LE"; + break; + + case 1250:// ANSI Latin II (Central European) + $this->_codepage ="CP1250"; + break; + + case 1251: //ANSI Cyrillic + $this->_codepage ="CP1251"; + break; + + case 1252: //ANSI Latin I (BIFF4-BIFF7) + $this->_codepage ="CP1252"; + break; + + case 1253: //ANSI Greek + $this->_codepage ="CP1253"; + break; + + case 1254: //ANSI Turkish + $this->_codepage ="CP1254"; + break; + + case 1255: //ANSI Hebrew + $this->_codepage ="CP1255"; + break; + + case 1256: //ANSI Arabic + $this->_codepage ="CP1256"; + break; + + case 1257: //ANSI Baltic + $this->_codepage ="CP1257"; + break; + + case 1258: //ANSI Vietnamese + $this->_codepage ="CP1258"; + break; + + case 1361: //ANSI Korean (Johab) + $this->_codepage ="CP1361"; + break; + + case 10000: //Apple Roman + $this->_codepage = 'MAC'; + break; + + case 32768: //Apple Roman + $this->_codepage = 'MAC'; + break; + + case 32769: //ANSI Latin I (BIFF2-BIFF3) + // currently not supported by libiconv + $this->_codepage = ""; + break; + + } + } + + /** + * DATEMODE + * + * This record specifies the base date for displaying date + * values. All dates are stored as count of days past this + * base date. In BIFF2-BIFF4 this record is part of the + * Calculation Settings Block. In BIFF5-BIFF8 it is + * stored in the Workbook Globals Substream. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readDateMode() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; 0 = base 1900, 1 = base 1904 + PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + if (ord($recordData{0}) == 1) { + PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); + } + } + + /** + * Read a FONT record + */ + private function _readFont() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + $objFont = new PHPExcel_Style_Font(); + + // offset: 0; size: 2; height of the font (in twips = 1/20 of a point) + $size = $this->_GetInt2d($recordData, 0); + $objFont->setSize($size / 20); + + // offset: 2; size: 2; option flags + // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8) + // bit: 1; mask 0x0002; italic + $isItalic = (0x0002 & $this->_GetInt2d($recordData, 2)) >> 1; + if ($isItalic) $objFont->setItalic(true); + + // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8) + // bit: 3; mask 0x0008; strike + $isStrike = (0x0008 & $this->_GetInt2d($recordData, 2)) >> 3; + if ($isStrike) $objFont->setStriketrough(true); + + // offset: 4; size: 2; colour index + $colorIndex = $this->_GetInt2d($recordData, 4); + $objFont->colorIndex = $colorIndex; + + // offset: 6; size: 2; font weight + $weight = $this->_GetInt2d($recordData, 6); + switch ($weight) { + case 0x02BC: + $objFont->setBold(true); + break; + } + + // offset: 8; size: 2; escapement type + $escapement = $this->_GetInt2d($recordData, 8); + switch ($escapement) { + case 0x0001: + $objFont->setSuperScript(true); + break; + case 0x0002: + $objFont->setSubScript(true); + break; + } + + // offset: 10; size: 1; underline type + $underlineType = ord($recordData{10}); + switch ($underlineType) { + case 0x00: + break; // no underline + case 0x01: + $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); + break; + case 0x02: + $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); + break; + case 0x21: + $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING); + break; + case 0x22: + $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING); + break; + } + + // offset: 11; size: 1; font family + // offset: 12; size: 1; character set + // offset: 13; size: 1; not used + // offset: 14; size: var; font name + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringShort(substr($recordData, 14)); + } else { + $string = $this->_readByteStringShort(substr($recordData, 14)); + } + $objFont->setName($string['value']); + + $this->_objFonts[] = $objFont; + } + } + + /** + * FORMAT + * + * This record contains information about a number format. + * All FORMAT records occur together in a sequential list. + * + * In BIFF2-BIFF4 other records referencing a FORMAT record + * contain a zero-based index into this list. From BIFF5 on + * the FORMAT record contains the index itself that will be + * used by other records. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readFormat() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + $indexCode = $this->_GetInt2d($recordData, 0); + + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringLong(substr($recordData, 2)); + } else { + // BIFF7 + $string = $this->_readByteStringShort(substr($recordData, 2)); + } + + $formatString = $string['value']; + $this->_formats[$indexCode] = $formatString; + } + } + + /** + * XF - Extended Format + * + * This record contains formatting information for cells, rows, columns or styles. + * According to http://support.microsoft.com/kb/147732 there are always at least 15 cell style XF + * and 1 cell XF. + * Inspection of Excel files generated by MS Office Excel shows that XF records 0-14 are cell style XF + * and XF record 15 is a cell XF + * We only read the first cell style XF and skip the remaining cell style XF records + * We read all cell XF records. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readXf() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + $objStyle = new PHPExcel_Style(); + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; Index to FONT record + if ($this->_GetInt2d($recordData, 0) < 4) { + $fontIndex = $this->_GetInt2d($recordData, 0); + } else { + // this has to do with that index 4 is omitted in all BIFF versions for some strange reason + // check the OpenOffice documentation of the FONT record + $fontIndex = $this->_GetInt2d($recordData, 0) - 1; + } + $objStyle->setFont($this->_objFonts[$fontIndex]); + + // offset: 2; size: 2; Index to FORMAT record + $numberFormatIndex = $this->_GetInt2d($recordData, 2); + if (isset($this->_formats[$numberFormatIndex])) { + // then we have user-defined format code + $numberformat = array('code' => $this->_formats[$numberFormatIndex]); + } elseif (($code = PHPExcel_Style_NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { + // then we have built-in format code + $numberformat = array('code' => $code); + } else { + // we set the general format code + $numberformat = array('code' => 'General'); + } + $objStyle->getNumberFormat()->setFormatCode($numberformat['code']); + + // offset: 4; size: 2; XF type, cell protection, and parent style XF + // bit 2-0; mask 0x0007; XF_TYPE_PROT + $xfTypeProt = $this->_GetInt2d($recordData, 4); + // bit 0; mask 0x01; 1 = cell is locked + $isLocked = (0x01 & $xfTypeProt) >> 0; + $objStyle->getProtection()->setLocked($isLocked ? + PHPExcel_Style_Protection::PROTECTION_INHERIT : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + + // bit 1; mask 0x02; 1 = Formula is hidden + $isHidden = (0x02 & $xfTypeProt) >> 1; + $objStyle->getProtection()->setHidden($isHidden ? + PHPExcel_Style_Protection::PROTECTION_PROTECTED : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); + + // bit 2; mask 0x04; 0 = Cell XF, 1 = Cell Style XF + $isCellStyleXf = (0x04 & $xfTypeProt) >> 2; + + // offset: 6; size: 1; Alignment and text break + // bit 2-0, mask 0x07; horizontal alignment + $horAlign = (0x07 & ord($recordData{6})) >> 0; + switch ($horAlign) { + case 0: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL); + break; + case 1: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); + break; + case 2: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + break; + case 3: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + break; + case 5: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY); + break; + case 6: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS); + break; + } + // bit 3, mask 0x08; wrap text + $wrapText = (0x08 & ord($recordData{6})) >> 3; + switch ($wrapText) { + case 0: + $objStyle->getAlignment()->setWrapText(false); + break; + case 1: + $objStyle->getAlignment()->setWrapText(true); + break; + } + // bit 6-4, mask 0x70; vertical alignment + $vertAlign = (0x70 & ord($recordData{6})) >> 4; + switch ($vertAlign) { + case 0: + $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP); + break; + case 1: + $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); + break; + case 2: + $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_BOTTOM); + break; + case 3: + $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY); + break; + } + + if ($this->_version == self::XLS_BIFF8) { + // offset: 7; size: 1; XF_ROTATION: Text rotation angle + $angle = ord($recordData{7}); + $rotation = 0; + if ($angle <= 90) { + $rotation = $angle; + } else if ($angle <= 180) { + $rotation = 90 - $angle; + } else if ($angle == 255) { + $rotation = -165; + } + $objStyle->getAlignment()->setTextRotation($rotation); + + // offset: 8; size: 1; Indentation, shrink to cell size, and text direction + // bit: 3-0; mask: 0x0F; indent level + $indent = (0x0F & ord($recordData{8})) >> 0; + $objStyle->getAlignment()->setIndent($indent); + + // bit: 4; mask: 0x10; 1 = shrink content to fit into cell + $shrinkToFit = (0x10 & ord($recordData{8})) >> 4; + switch ($shrinkToFit) { + case 0: + $objStyle->getAlignment()->setShrinkToFit(false); + break; + case 1: + $objStyle->getAlignment()->setShrinkToFit(true); + break; + } + + // offset: 9; size: 1; Flags used for attribute groups + + // offset: 10; size: 4; Cell border lines and background area + // bit: 3-0; mask: 0x0000000F; left style + if ($bordersLeftStyle = $this->_mapBorderStyle((0x0000000F & $this->_GetInt4d($recordData, 10)) >> 0)) { + $objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle); + } + // bit: 7-4; mask: 0x000000F0; right style + if ($bordersRightStyle = $this->_mapBorderStyle((0x000000F0 & $this->_GetInt4d($recordData, 10)) >> 4)) { + $objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle); + } + // bit: 11-8; mask: 0x00000F00; top style + if ($bordersTopStyle = $this->_mapBorderStyle((0x00000F00 & $this->_GetInt4d($recordData, 10)) >> 8)) { + $objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle); + } + // bit: 15-12; mask: 0x0000F000; bottom style + if ($bordersBottomStyle = $this->_mapBorderStyle((0x0000F000 & $this->_GetInt4d($recordData, 10)) >> 12)) { + $objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle); + } + // bit: 22-16; mask: 0x007F0000; left color + $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & $this->_GetInt4d($recordData, 10)) >> 16; + + // bit: 29-23; mask: 0x3F800000; right color + $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & $this->_GetInt4d($recordData, 10)) >> 23; + + // offset: 14; size: 4; + // bit: 6-0; mask: 0x0000007F; top color + $objStyle->getBorders()->getTop()->colorIndex = (0x0000007F & $this->_GetInt4d($recordData, 14)) >> 0; + + // bit: 13-7; mask: 0x00003F80; bottom color + $objStyle->getBorders()->getBottom()->colorIndex = (0x00003F80 & $this->_GetInt4d($recordData, 14)) >> 7; + + // bit: 31-26; mask: 0xFC000000 fill pattern + if ($fillType = $this->_mapFillPattern((0xFC000000 & $this->_GetInt4d($recordData, 14)) >> 26)) { + $objStyle->getFill()->setFillType($fillType); + } + // offset: 18; size: 2; pattern and background colour + // bit: 6-0; mask: 0x007F; color index for pattern color + $objStyle->getFill()->startcolorIndex = (0x007F & $this->_GetInt2d($recordData, 18)) >> 0; + + // bit: 13-7; mask: 0x3F80; color index for pattern background + $objStyle->getFill()->endcolorIndex = (0x3F80 & $this->_GetInt2d($recordData, 18)) >> 7; + } else { + // BIFF5 + + // offset: 7; size: 1; Text orientation and flags + $orientationAndFlags = ord($recordData{7}); + + // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation + $xfOrientation = (0x03 & $orientationAndFlags) >> 0; + switch ($xfOrientation) { + case 0: + $objStyle->getAlignment()->setTextRotation(0); + break; + case 1: + $objStyle->getAlignment()->setTextRotation(-165); + break; + case 2: + $objStyle->getAlignment()->setTextRotation(90); + break; + case 3: + $objStyle->getAlignment()->setTextRotation(-90); + break; + } + + // offset: 8; size: 4; cell border lines and background area + $borderAndBackground = $this->_GetInt4d($recordData, 8); + + // bit: 6-0; mask: 0x0000007F; color index for pattern color + $objStyle->getFill()->startcolorIndex = (0x0000007F & $borderAndBackground) >> 0; + + // bit: 13-7; mask: 0x00003F80; color index for pattern background + $objStyle->getFill()->endcolorIndex = (0x00003F80 & $borderAndBackground) >> 7; + + // bit: 21-16; mask: 0x003F0000; fill pattern + $objStyle->getFill()->setFillType($this->_mapFillPattern((0x003F0000 & $borderAndBackground) >> 16)); + + // bit: 24-22; mask: 0x01C00000; bottom line style + $objStyle->getBorders()->getBottom()->setBorderStyle($this->_mapBorderStyle((0x01C00000 & $borderAndBackground) >> 22)); + + // bit: 31-25; mask: 0xFE000000; bottom line color + $objStyle->getBorders()->getBottom()->colorIndex = (0xFE000000 & $borderAndBackground) >> 25; + + // offset: 12; size: 4; cell border lines + $borderLines = $this->_GetInt4d($recordData, 12); + + // bit: 2-0; mask: 0x00000007; top line style + $objStyle->getBorders()->getTop()->setBorderStyle($this->_mapBorderStyle((0x00000007 & $borderLines) >> 0)); + + // bit: 5-3; mask: 0x00000038; left line style + $objStyle->getBorders()->getLeft()->setBorderStyle($this->_mapBorderStyle((0x00000038 & $borderLines) >> 3)); + + // bit: 8-6; mask: 0x000001C0; right line style + $objStyle->getBorders()->getRight()->setBorderStyle($this->_mapBorderStyle((0x000001C0 & $borderLines) >> 6)); + + // bit: 15-9; mask: 0x0000FE00; top line color index + $objStyle->getBorders()->getTop()->colorIndex = (0x0000FE00 & $borderLines) >> 9; + + // bit: 22-16; mask: 0x007F0000; left line color index + $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & $borderLines) >> 16; + + // bit: 29-23; mask: 0x3F800000; right line color index + $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & $borderLines) >> 23; + } + + // add cellStyleXf or cellXf and update mapping + if ($isCellStyleXf) { + // we only read one style XF record which is always the first + if ($this->_xfIndex == 0) { + $this->_phpExcel->addCellStyleXf($objStyle); + $this->_mapCellStyleXfIndex[$this->_xfIndex] = 0; + } + } else { + // we read all cell XF records + $this->_phpExcel->addCellXf($objStyle); + $this->_mapCellXfIndex[$this->_xfIndex] = count($this->_phpExcel->getCellXfCollection()) - 1; + } + + // update XF index for when we read next record + ++$this->_xfIndex; + } + } + + /** + * Read STYLE record + */ + private function _readStyle() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; index to XF record and flag for built-in style + $ixfe = $this->_GetInt2d($recordData, 0); + + // bit: 11-0; mask 0x0FFF; index to XF record + $xfIndex = (0x0FFF & $ixfe) >> 0; + + // bit: 15; mask 0x8000; 0 = user-defined style, 1 = built-in style + $isBuiltIn = (bool) ((0x8000 & $ixfe) >> 15); + + if ($isBuiltIn) { + // offset: 2; size: 1; identifier for built-in style + $builtInId = ord($recordData{2}); + + switch ($builtInId) { + case 0x00: + // currently, we are not using this for anything + break; + + default: + break; + } + + } else { + // user-defined; not supported by PHPExcel + } + } + } + + /** + * Read PALETTE record + */ + private function _readPalette() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; number of following colors + $nm = $this->_GetInt2d($recordData, 0); + + // list of RGB colors + for ($i = 0; $i < $nm; ++$i) { + $rgb = substr($recordData, 2 + 4 * $i, 4); + $this->_palette[] = $this->_readRGB($rgb); + } + } + } + + /** + * SHEET + * + * This record is located in the Workbook Globals + * Substream and represents a sheet inside the workbook. + * One SHEET record is written for each sheet. It stores the + * sheet name and a stream offset to the BOF record of the + * respective Sheet Substream within the Workbook Stream. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readSheet() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 4; absolute stream position of the BOF record of the sheet + $rec_offset = $this->_GetInt4d($recordData, 0); + + // offset: 4; size: 1; sheet state + $rec_typeFlag = ord($recordData{4}); + + // offset: 5; size: 1; sheet type + $rec_visibilityFlag = ord($recordData{5}); + + // offset: 6; size: var; sheet name + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringShort(substr($recordData, 6)); + $rec_name = $string['value']; + } elseif ($this->_version == self::XLS_BIFF7) { + $string = $this->_readByteStringShort(substr($recordData, 6)); + $rec_name = $string['value']; + } + $this->_sheets[] = array( + 'name' => $rec_name, + 'offset' => $rec_offset + ); + } + + /** + * Read EXTERNALBOOK record + */ + private function _readExternalBook() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset within record data + $offset = 0; + + // there are 4 types of records + if (strlen($recordData) > 4) { + // external reference + // offset: 0; size: 2; number of sheet names ($nm) + $nm = $this->_GetInt2d($recordData, 0); + $offset += 2; + + // offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length) + $encodedUrlString = $this->_readUnicodeStringLong(substr($recordData, 2)); + $offset += $encodedUrlString['size']; + + // offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length) + $externalSheetNames = array(); + for ($i = 0; $i < $nm; ++$i) { + $externalSheetNameString = $this->_readUnicodeStringLong(substr($recordData, $offset)); + $externalSheetNames[] = $externalSheetNameString['value']; + $offset += $externalSheetNameString['size']; + } + + // store the record data + $this->_externalBooks[] = array( + 'type' => 'external', + 'encodedUrl' => $encodedUrlString['value'], + 'externalSheetNames' => $externalSheetNames, + ); + + } elseif (substr($recordData, 2, 2) == pack('CC', 0x01, 0x04)) { + // internal reference + // offset: 0; size: 2; number of sheet in this document + // offset: 2; size: 2; 0x01 0x04 + $this->_externalBooks[] = array( + 'type' => 'internal', + ); + } elseif (substr($recordData, 0, 4) == pack('VCC', 0x0001, 0x01, 0x3A)) { + // add-in function + // offset: 0; size: 2; 0x0001 + $this->_externalBooks[] = array( + 'type' => 'addInFunction', + ); + } elseif (substr($recordData, 0, 2) == pack('V', 0x0000)) { + // DDE links, OLE links + // offset: 0; size: 2; 0x0000 + // offset: 2; size: var; encoded source document name + $this->_externalBooks[] = array( + 'type' => 'DDEorOLE', + ); + } + } + + /** + * Read EXTERNSHEET record + */ + private function _readExternSheet() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // external sheet references provided for named cells + if ($this->_version == self::XLS_BIFF8) { + // offset: 0; size: 2; number of following ref structures + $nm = $this->_GetInt2d($recordData, 0); + for ($i = 0; $i < $nm; ++$i) { + $this->_ref[] = array( + // offset: 2 + 6 * $i; index to EXTERNALBOOK record + 'externalBookIndex' => $this->_GetInt2d($recordData, 2 + 6 * $i), + // offset: 4 + 6 * $i; index to first sheet in EXTERNALBOOK record + 'firstSheetIndex' => $this->_GetInt2d($recordData, 4 + 6 * $i), + // offset: 6 + 6 * $i; index to last sheet in EXTERNALBOOK record + 'lastSheetIndex' => $this->_GetInt2d($recordData, 6 + 6 * $i), + ); + } + } + } + + /** + * DEFINEDNAME + * + * This record is part of a Link Table. It contains the name + * and the token array of an internal defined name. Token + * arrays of defined names contain tokens with aberrant + * token classes. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readDefinedName() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8) { + // retrieves named cells + + // offset: 0; size: 2; option flags + $opts = $this->_GetInt2d($recordData, 0); + + // bit: 5; mask: 0x0020; 0 = user-defined name, 1 = built-in-name + $isBuiltInName = (0x0020 & $opts) >> 5; + + // offset: 2; size: 1; keyboard shortcut + + // offset: 3; size: 1; length of the name (character count) + $nlen = ord($recordData{3}); + + // offset: 4; size: 2; size of the formula data (it can happen that this is zero) + $flen = $this->_GetInt2d($recordData, 4); + + // offset: 14; size: var; Name (Unicode string without length field) + $string = $this->_readUnicodeString(substr($recordData, 14), $nlen); + + // offset: var; size: $flen; formula data + $offset = 14 + $string['size']; + $formulaStructure = pack('v', $flen) . substr($recordData, $offset, $flen); + + try { + $formula = $this->_getFormulaFromStructure($formulaStructure); + } catch (Exception $e) { + $formula = ''; + } + + $this->_definedname[] = array( + 'isBuiltInName' => $isBuiltInName, + 'name' => $string['value'], + 'formula' => $formula, + ); + } + } + + /** + * Read MSODRAWINGGROUP record + */ + private function _readMsoDrawingGroup() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + + // get spliced record data + $splicedRecordData = $this->_getSplicedRecordData(); + $recordData = $splicedRecordData['recordData']; + + $this->_drawingGroupData .= $recordData; + } + + /** + * SST - Shared String Table + * + * This record contains a list of all strings used anywhere + * in the workbook. Each string occurs only once. The + * workbook uses indexes into the list to reference the + * strings. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + **/ + private function _readSst() + { + // offset within (spliced) record data + $pos = 0; + + // get spliced record data + $splicedRecordData = $this->_getSplicedRecordData(); + + $recordData = $splicedRecordData['recordData']; + $spliceOffsets = $splicedRecordData['spliceOffsets']; + + // offset: 0; size: 4; total number of strings in the workbook + $pos += 4; + + // offset: 4; size: 4; number of following strings ($nm) + $nm = $this->_GetInt4d($recordData, 4); + $pos += 4; + + // loop through the Unicode strings (16-bit length) + for ($i = 0; $i < $nm; ++$i) { + + // number of characters in the Unicode string + $numChars = $this->_GetInt2d($recordData, $pos); + $pos += 2; + + // option flags + $optionFlags = ord($recordData{$pos}); + ++$pos; + + // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed + $isCompressed = (($optionFlags & 0x01) == 0) ; + + // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic + $hasAsian = (($optionFlags & 0x04) != 0); + + // bit: 3; mask: 0x03; 0 = ordinary; 1 = Rich-Text + $hasRichText = (($optionFlags & 0x08) != 0); + + if ($hasRichText) { + // number of Rich-Text formatting runs + $formattingRuns = $this->_GetInt2d($recordData, $pos); + $pos += 2; + } + + if ($hasAsian) { + // size of Asian phonetic setting + $extendedRunLength = $this->_GetInt4d($recordData, $pos); + $pos += 4; + } + + // expected byte length of character array if not split + $len = ($isCompressed) ? $numChars : $numChars * 2; + + // look up limit position + foreach ($spliceOffsets as $spliceOffset) { + if ($pos < $spliceOffset) { + $limitpos = $spliceOffset; + break; + } + } + + if ($pos + $len <= $limitpos) { + // character array is not split between records + + $retstr = substr($recordData, $pos, $len); + $pos += $len; + + } else { + // character array is split between records + + // first part of character array + $retstr = substr($recordData, $pos, $limitpos - $pos); + + $bytesRead = $limitpos - $pos; + + // remaining characters in Unicode string + $charsLeft = $numChars - (($isCompressed) ? $bytesRead : ($bytesRead / 2)); + + $pos = $limitpos; + + // keep reading the characters + while ($charsLeft > 0) { + + // look up next limit position, in case the string span more than one continue record + foreach ($spliceOffsets as $spliceOffset) { + if ($pos < $spliceOffset) { + $limitpos = $spliceOffset; + break; + } + } + + // repeated option flags + // OpenOffice.org documentation 5.21 + $option = ord($recordData{$pos}); + ++$pos; + + if ($isCompressed && ($option == 0)) { + // 1st fragment compressed + // this fragment compressed + $len = min($charsLeft, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len; + $isCompressed = true; + + } elseif (!$isCompressed && ($option != 0)) { + // 1st fragment uncompressed + // this fragment uncompressed + $len = min($charsLeft * 2, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len / 2; + $isCompressed = false; + + } elseif (!$isCompressed && ($option == 0)) { + // 1st fragment uncompressed + // this fragment compressed + $len = min($charsLeft, $limitpos - $pos); + for ($j = 0; $j < $len; ++$j) { + $retstr .= $recordData{$pos + $j} . chr(0); + } + $charsLeft -= $len; + $isCompressed = false; + + } else { + // 1st fragment compressed + // this fragment uncompressed + $newstr = ''; + for ($j = 0; $j < strlen($retstr); ++$j) { + $newstr .= $retstr[$j] . chr(0); + } + $retstr = $newstr; + $len = min($charsLeft * 2, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len / 2; + $isCompressed = false; + } + + $pos += $len; + } + } + + // convert to UTF-8 + $retstr = $this->_encodeUTF16($retstr, $isCompressed); + + // read additional Rich-Text information, if any + $fmtRuns = array(); + if ($hasRichText) { + // list of formatting runs + for ($j = 0; $j < $formattingRuns; ++$j) { + // first formatted character; zero-based + $charPos = $this->_GetInt2d($recordData, $pos + $j * 4); + + // index to font record + $fontIndex = $this->_GetInt2d($recordData, $pos + 2 + $j * 4); + + $fmtRuns[] = array( + 'charPos' => $charPos, + 'fontIndex' => $fontIndex, + ); + } + $pos += 4 * $formattingRuns; + } + + // read additional Asian phonetics information, if any + if ($hasAsian) { + // For Asian phonetic settings, we skip the extended string data + $pos += $extendedRunLength; + } + + // store the shared sting + $this->_sst[] = array( + 'value' => $retstr, + 'fmtRuns' => $fmtRuns, + ); + } + + // _getSplicedRecordData() takes care of moving current position in data stream + } + + /** + * Read PRINTGRIDLINES record + */ + private function _readPrintGridlines() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + // offset: 0; size: 2; 0 = do not print sheet grid lines; 1 = print sheet gridlines + $printGridlines = (bool) $this->_GetInt2d($recordData, 0); + $this->_phpSheet->setPrintGridlines($printGridlines); + } + } + + /** + * Read DEFAULTROWHEIGHT record + */ + private function _readDefaultRowHeight() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; option flags + // offset: 2; size: 2; default height for unused rows, (twips 1/20 point) + $height = $this->_GetInt2d($recordData, 2); + $this->_phpSheet->getDefaultRowDimension()->setRowHeight($height / 20); + } + + /** + * Read SHEETPR record + */ + private function _readSheetPr() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2 + + // bit: 6; mask: 0x0040; 0 = outline buttons above outline group + $isSummaryBelow = (0x0040 & $this->_GetInt2d($recordData, 0)) >> 6; + $this->_phpSheet->setShowSummaryBelow($isSummaryBelow); + + // bit: 7; mask: 0x0080; 0 = outline buttons left of outline group + $isSummaryRight = (0x0080 & $this->_GetInt2d($recordData, 0)) >> 7; + $this->_phpSheet->setShowSummaryRight($isSummaryRight); + + // bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages + // this corresponds to radio button setting in page setup dialog in Excel + $this->_isFitToPages = (bool) ((0x0100 & $this->_GetInt2d($recordData, 0)) >> 8); + } + + /** + * Read HORIZONTALPAGEBREAKS record + */ + private function _readHorizontalPageBreaks() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + + // offset: 0; size: 2; number of the following row index structures + $nm = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 6 * $nm; list of $nm row index structures + for ($i = 0; $i < $nm; ++$i) { + $r = $this->_GetInt2d($recordData, 2 + 6 * $i); + $cf = $this->_GetInt2d($recordData, 2 + 6 * $i + 2); + $cl = $this->_GetInt2d($recordData, 2 + 6 * $i + 4); + + // not sure why two column indexes are necessary? + $this->_phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW); + } + } + } + + /** + * Read VERTICALPAGEBREAKS record + */ + private function _readVerticalPageBreaks() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + // offset: 0; size: 2; number of the following column index structures + $nm = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 6 * $nm; list of $nm row index structures + for ($i = 0; $i < $nm; ++$i) { + $c = $this->_GetInt2d($recordData, 2 + 6 * $i); + $rf = $this->_GetInt2d($recordData, 2 + 6 * $i + 2); + $rl = $this->_GetInt2d($recordData, 2 + 6 * $i + 4); + + // not sure why two row indexes are necessary? + $this->_phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN); + } + } + } + + /** + * Read HEADER record + */ + private function _readHeader() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: var + // realized that $recordData can be empty even when record exists + if ($recordData) { + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringLong($recordData); + } else { + $string = $this->_readByteStringShort($recordData); + } + + $this->_phpSheet->getHeaderFooter()->setOddHeader($string['value']); + $this->_phpSheet->getHeaderFooter()->setEvenHeader($string['value']); + } + } + } + + /** + * Read FOOTER record + */ + private function _readFooter() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: var + // realized that $recordData can be empty even when record exists + if ($recordData) { + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringLong($recordData); + } else { + $string = $this->_readByteStringShort($recordData); + } + $this->_phpSheet->getHeaderFooter()->setOddFooter($string['value']); + $this->_phpSheet->getHeaderFooter()->setEvenFooter($string['value']); + } + } + } + + /** + * Read HCENTER record + */ + private function _readHcenter() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally + $isHorizontalCentered = (bool) $this->_GetInt2d($recordData, 0); + + $this->_phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); + } + } + + /** + * Read VCENTER record + */ + private function _readVcenter() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered + $isVerticalCentered = (bool) $this->_GetInt2d($recordData, 0); + + $this->_phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered); + } + } + + /** + * Read LEFTMARGIN record + */ + private function _readLeftMargin() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 8 + $this->_phpSheet->getPageMargins()->setLeft($this->_extractNumber($recordData)); + } + } + + /** + * Read RIGHTMARGIN record + */ + private function _readRightMargin() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 8 + $this->_phpSheet->getPageMargins()->setRight($this->_extractNumber($recordData)); + } + } + + /** + * Read TOPMARGIN record + */ + private function _readTopMargin() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 8 + $this->_phpSheet->getPageMargins()->setTop($this->_extractNumber($recordData)); + } + } + + /** + * Read BOTTOMMARGIN record + */ + private function _readBottomMargin() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 8 + $this->_phpSheet->getPageMargins()->setBottom($this->_extractNumber($recordData)); + } + } + + /** + * Read PAGESETUP record + */ + private function _readPageSetup() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; paper size + $paperSize = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; scaling factor + $scale = $this->_GetInt2d($recordData, 2); + + // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed + $fitToWidth = $this->_GetInt2d($recordData, 6); + + // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed + $fitToHeight = $this->_GetInt2d($recordData, 8); + + // offset: 10; size: 2; option flags + + // bit: 1; mask: 0x0002; 0=landscape, 1=portrait + $isPortrait = (0x0002 & $this->_GetInt2d($recordData, 10)) >> 1; + + // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init + // when this bit is set, do not use flags for those properties + $isNotInit = (0x0004 & $this->_GetInt2d($recordData, 10)) >> 2; + + if (!$isNotInit) { + $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); + switch ($isPortrait) { + case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; + case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; + } + + if (!$this->_isFitToPages) { + $this->_phpSheet->getPageSetup()->setScale($scale); + } else { + $this->_phpSheet->getPageSetup()->setFitToWidth($fitToWidth); + $this->_phpSheet->getPageSetup()->setFitToHeight($fitToHeight); + } + } + + // offset: 16; size: 8; header margin (IEEE 754 floating-point value) + $marginHeader = $this->_extractNumber(substr($recordData, 16, 8)); + $this->_phpSheet->getPageMargins()->setHeader($marginHeader); + + // offset: 24; size: 8; footer margin (IEEE 754 floating-point value) + $marginFooter = $this->_extractNumber(substr($recordData, 24, 8)); + $this->_phpSheet->getPageMargins()->setFooter($marginFooter); + } + } + + /** + * PROTECT - Sheet protection (BIFF2 through BIFF8) + * if this record is omitted, then it also means no sheet protection + */ + private function _readProtect() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; + + // bit 0, mask 0x01; sheet protection + $isSheetProtected = (0x01 & $this->_GetInt2d($recordData, 0)) >> 0; + switch ($isSheetProtected) { + case 0: break; + case 1: $this->_phpSheet->getProtection()->setSheet(true); break; + } + } + } + + /** + * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8) + */ + private function _readPassword() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; 16-bit hash value of password + $password = strtoupper(dechex($this->_GetInt2d($recordData, 0))); // the hashed password + $this->_phpSheet->getProtection()->setPassword($password, true); + } + } + + /** + * Read DEFCOLWIDTH record + */ + private function _readDefColWidth() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; default column width + $width = $this->_GetInt2d($recordData, 0); + if ($width != 8) { + $this->_phpSheet->getDefaultColumnDimension()->setWidth($width); + } + } + + /** + * Read COLINFO record + */ + private function _readColInfo() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; index to first column in range + $fc = $this->_GetInt2d($recordData, 0); // first column index + + // offset: 2; size: 2; index to last column in range + $lc = $this->_GetInt2d($recordData, 2); // first column index + + // offset: 4; size: 2; width of the column in 1/256 of the width of the zero character + $width = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 2; index to XF record for default column formatting + $xfIndex = $this->_GetInt2d($recordData, 6); + + // offset: 8; size: 2; option flags + + // bit: 0; mask: 0x0001; 1= columns are hidden + $isHidden = (0x0001 & $this->_GetInt2d($recordData, 8)) >> 0; + + // bit: 10-8; mask: 0x0700; outline level of the columns (0 = no outline) + $level = (0x0700 & $this->_GetInt2d($recordData, 8)) >> 8; + + // bit: 12; mask: 0x1000; 1 = collapsed + $isCollapsed = (0x1000 & $this->_GetInt2d($recordData, 8)) >> 12; + + // offset: 10; size: 2; not used + + for ($i = $fc; $i <= $lc; ++$i) { + if ($lc == 255 || $lc == 256) { + $this->_phpSheet->getDefaultColumnDimension()->setWidth($width / 256); + break; + } + $this->_phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256); + $this->_phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); + $this->_phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); + $this->_phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); + } + } + } + + /** + * ROW + * + * This record contains the properties of a single row in a + * sheet. Rows and cells in a sheet are divided into blocks + * of 32 rows. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readRow() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; index of this row + $r = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to column of the first cell which is described by a cell record + + // offset: 4; size: 2; index to column of the last cell which is described by a cell record, increased by 1 + + // offset: 6; size: 2; + + // bit: 14-0; mask: 0x7FF; height of the row, in twips = 1/20 of a point + $height = (0x7FF & $this->_GetInt2d($recordData, 6)) >> 0; + + // bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height + $useDefaultHeight = (0x8000 & $this->_GetInt2d($recordData, 6)) >> 15; + + if (!$useDefaultHeight) { + $this->_phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20); + } + + // offset: 8; size: 2; not used + + // offset: 10; size: 2; not used in BIFF5-BIFF8 + + // offset: 12; size: 4; option flags and default row formatting + + // bit: 2-0: mask: 0x00000007; outline level of the row + $level = (0x00000007 & $this->_GetInt4d($recordData, 12)) >> 0; + $this->_phpSheet->getRowDimension($r + 1)->setOutlineLevel($level); + + // bit: 4; mask: 0x00000010; 1 = outline group start or ends here... and is collapsed + $isCollapsed = (0x00000010 & $this->_GetInt4d($recordData, 12)) >> 4; + $this->_phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed); + + // bit: 5; mask: 0x00000020; 1 = row is hidden + $isHidden = (0x00000020 & $this->_GetInt4d($recordData, 12)) >> 5; + $this->_phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden); + + // bit: 7; mask: 0x00000080; 1 = row has explicit default format + $hasDefaultFormat = (0x00000080 & $this->_GetInt4d($recordData, 12)) >> 7; + + // bit: 27-16; mask: 0x0FFF0000; only applies when hasDefaultFormat = 1; index to XF record + $xfIndex = (0x0FFF0000 & $this->_GetInt4d($recordData, 12)) >> 16; + } + } + + /** + * Read RK record + * This record represents a cell that contains an RK value + * (encoded integer or floating-point value). If a + * floating-point value cannot be encoded to an RK value, + * a NUMBER record will be written. This record replaces the + * record INTEGER written in BIFF2. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readRk() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset: 4; size: 2; index to XF record + $xfindex = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 4; RK value + $rknum = $this->_GetInt4d($recordData, 6); + $numValue = $this->_GetIEEE754($rknum); + + // add style information + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + + // add cell + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + } + } + + /** + * Read LABELSST record + * This record represents a cell that contains a string. It + * replaces the LABEL record and RSTRING record used in + * BIFF2-BIFF5. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readLabelSst() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset: 4; size: 2; index to XF record + $xfindex = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 4; index to SST record + $index = $this->_GetInt4d($recordData, 6); + + // add cell + if (($fmtRuns = $this->_sst[$index]['fmtRuns']) && !$this->_readDataOnly) { + // then we should treat as rich text + $richText = new PHPExcel_RichText($this->_phpSheet->getCell($columnString . ($row + 1))); + $charPos = 0; + for ($i = 0; $i <= count($this->_sst[$index]['fmtRuns']); ++$i) { + if (isset($fmtRuns[$i])) { + $text = mb_substr($this->_sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos, 'UTF-8'); + $charPos = $fmtRuns[$i]['charPos']; + } else { + $text = mb_substr($this->_sst[$index]['value'], $charPos, mb_strlen($this->_sst[$index]['value']), 'UTF-8'); + } + + if (mb_strlen($text) > 0) { + if ($i == 0) { // first text run, no style + $richText->createText($text); + } else { + $textRun = $richText->createTextRun($text); + if (isset($fmtRuns[$i - 1])) { + if ($fmtRuns[$i - 1]['fontIndex'] < 4) { + $fontIndex = $fmtRuns[$i - 1]['fontIndex']; + } else { + // this has to do with that index 4 is omitted in all BIFF versions for some strange reason + // check the OpenOffice documentation of the FONT record + $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1; + } + $textRun->setFont(clone $this->_objFonts[$fontIndex]); + } + } + } + } + } else { + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $this->_sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING); + } + + // add style information + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + } + } + + /** + * Read MULRK record + * This record represents a cell range containing RK value + * cells. All cells are located in the same row. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readMulRk() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to first column + $colFirst = $this->_GetInt2d($recordData, 2); + + // offset: var; size: 2; index to last column + $colLast = $this->_GetInt2d($recordData, $length - 2); + $columns = $colLast - $colFirst + 1; + + // offset within record data + $offset = 4; + + for ($i = 0; $i < $columns; ++$i) { + $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + + // offset: var; size: 2; index to XF record + $xfindex = $this->_GetInt2d($recordData, $offset); + + // offset: var; size: 4; RK value + $numValue = $this->_GetIEEE754($this->_GetInt4d($recordData, $offset + 2)); + if (!$this->_readDataOnly) { + // add style + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + + // add cell value + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + } + + $offset += 6; + } + } + + /** + * Read NUMBER record + * This record represents a cell that contains a + * floating-point value. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readNumber() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size 2; index to column + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset 4; size: 2; index to XF record + $xfindex = $this->_GetInt2d($recordData, 4); + + $numValue = $this->_extractNumber(substr($recordData, 6, 8)); + + // add cell style + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + + // add cell value + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $numValue, PHPExcel_Cell_DataType::TYPE_NUMERIC); + } + } + + /** + * Read FORMULA record + perhaps a following STRING record if formula result is a string + * This record contains the token array and the result of a + * formula cell. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readFormula() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; col index + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + + // offset: 20: size: variable; formula structure + $formulaStructure = substr($recordData, 20); + + // offset: 14: size: 2; option flags, recalculate always, recalculate on open etc. + $options = $this->_GetInt2d($recordData, 14); + + // bit: 0; mask: 0x0001; 1 = recalculate always + // bit: 1; mask: 0x0002; 1 = calculate on open + // bit: 2; mask: 0x0008; 1 = part of a shared formula + $isPartOfSharedFormula = (bool) (0x0008 & $options); + if ($isPartOfSharedFormula) { + // part of shared formula which means there will be a formula with a tExp token and nothing else + // get the base cell, grab tExp token + $baseRow = $this->_GetInt2d($formulaStructure, 3); + $baseCol = $this->_GetInt2d($formulaStructure, 5); + $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); + + // formula is added to this cell after the sheet has been read + $this->_sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell; + } + + // offset: 16: size: 4; not used + + // offset: 4; size: 2; XF index + $xfindex = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 8; result of the formula + if ( (ord($recordData{6}) == 0) + && (ord($recordData{12}) == 255) + && (ord($recordData{13}) == 255) ) { + + // String formula. Result follows in appended STRING record + $dataType = PHPExcel_Cell_DataType::TYPE_STRING; + + // read possible SHAREDFMLA record + $code = $this->_GetInt2d($this->_data, $this->_pos); + if ($code == self::XLS_Type_SHAREDFMLA) { + $this->_readSharedFmla(); + } + + // read STRING record + $value = $this->_readString(); + + } elseif ((ord($recordData{6}) == 1) + && (ord($recordData{12}) == 255) + && (ord($recordData{13}) == 255)) { + + // Boolean formula. Result is in +2; 0=false, 1=true + $dataType = PHPExcel_Cell_DataType::TYPE_BOOL; + $value = (bool) ord($recordData{8}); + + } elseif ((ord($recordData{6}) == 2) + && (ord($recordData{12}) == 255) + && (ord($recordData{13}) == 255)) { + + // Error formula. Error code is in +2 + $dataType = PHPExcel_Cell_DataType::TYPE_ERROR; + $value = $this->_mapErrorCode(ord($recordData{8})); + + } elseif ((ord($recordData{6}) == 3) + && (ord($recordData{12}) == 255) + && (ord($recordData{13}) == 255)) { + + // Formula result is a null string + $dataType = PHPExcel_Cell_DataType::TYPE_NULL; + $value = ''; + + } else { + + // forumla result is a number, first 14 bytes like _NUMBER record + $dataType = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $value = $this->_extractNumber(substr($recordData, 6, 8)); + + } + + // add cell style + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + + // store the formula + if (!$isPartOfSharedFormula) { + // not part of shared formula + // add cell value. If we can read formula, populate with formula, otherwise just used cached value + try { + if ($this->_version != self::XLS_BIFF8) { + throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); + } + $formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language + $this->_phpSheet->getCell($columnString . ($row + 1))->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + + } catch (Exception $e) { + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $value, $dataType); + } + } else { + if ($this->_version == self::XLS_BIFF8) { + // do nothing at this point, formula id added later in the code + } else { + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $value, $dataType); + } + } + + // store the cached calculated value + $this->_phpSheet->getCell($columnString . ($row + 1))->setCalculatedValue($value); + } + } + + /** + * Read a SHAREDFMLA record. This function just stores the binary shared formula in the reader, + * which usually contains relative references. + * These will be used to construct the formula in each shared formula part after the sheet is read. + */ + private function _readSharedFmla() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0, size: 6; cell range address of the area used by the shared formula, not used for anything + $cellRange = substr($recordData, 0, 6); + $cellRange = $this->_readBIFF5CellRangeAddressFixed($cellRange); // note: even BIFF8 uses BIFF5 syntax + + // offset: 6, size: 1; not used + + // offset: 7, size: 1; number of existing FORMULA records for this shared formula + $no = ord($recordData{7}); + + // offset: 8, size: var; Binary token array of the shared formula + $formula = substr($recordData, 8); + + // at this point we only store the shared formula for later use + $this->_sharedFormulas[$this->_baseCell] = $formula; + + } + + /** + * Read a STRING record from current stream position and advance the stream pointer to next record + * This record is used for storing result from FORMULA record when it is a string, and + * it occurs directly after the FORMULA record + * + * @return string The string contents as UTF-8 + */ + private function _readString() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringLong($recordData); + $value = $string['value']; + } else { + $string = $this->_readByteStringLong($recordData); + $value = $string['value']; + } + + return $value; + } + + /** + * Read BOOLERR record + * This record represents a Boolean value or error value + * cell. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readBoolErr() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; column index + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset: 4; size: 2; index to XF record + $xfindex = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 1; the boolean value or error value + $boolErr = ord($recordData{6}); + + // offset: 7; size: 1; 0=boolean; 1=error + $isError = ord($recordData{7}); + + switch ($isError) { + case 0: // boolean + $value = (bool) $boolErr; + + // add cell value + $this->_phpSheet->getCell($columnString . ($row + 1))->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_BOOL); + break; + + case 1: // error type + $value = $this->_mapErrorCode($boolErr); + + // add cell value + $this->_phpSheet->getCell($columnString . ($row + 1))->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_ERROR); + break; + } + + // add cell style + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + } + } + + /** + * Read MULBLANK record + * This record represents a cell range of empty cells. All + * cells are located in the same row + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readMulBlank() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to first column + $fc = $this->_GetInt2d($recordData, 2); + + // offset: 4; size: 2 x nc; list of indexes to XF records + // add style information + if (!$this->_readDataOnly) { + for ($i = 0; $i < $length / 2 - 3; ++$i) { + $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + $xfindex = $this->_GetInt2d($recordData, 4 + 2 * $i); + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + } + } + + // offset: 6; size 2; index to last column (not needed) + } + + /** + * Read LABEL record + * This record represents a cell that contains a string. In + * BIFF8 it is usually replaced by the LABELSST record. + * Excel still uses this record, if it copies unformatted + * text cells to the clipboard. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readLabel() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($column); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset: 4; size: 2; XF index + $xfindex = $this->_GetInt2d($recordData, 4); + + // add cell value + // todo: what if string is very long? continue record + if ($this->_version == self::XLS_BIFF8) { + $string = $this->_readUnicodeStringLong(substr($recordData, 6)); + $value = $string['value']; + } else { + $string = $this->_readByteStringLong(substr($recordData, 6)); + $value = $string['value']; + } + $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $value, PHPExcel_Cell_DataType::TYPE_STRING); + + // add cell style + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + } + } + + /** + * Read BLANK record + */ + private function _readBlank() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; col index + $col = $this->_GetInt2d($recordData, 2); + $columnString = PHPExcel_Cell::stringFromColumnIndex($col); + + // Read cell? + if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { + // offset: 4; size: 2; XF index + $xfindex = $this->_GetInt2d($recordData, 4); + + // add style information + if (!$this->_readDataOnly) { + $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfindex]); + } + } + + } + + /** + * Read MSODRAWING record + */ + private function _readMsoDrawing() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + $this->_drawingData .= $recordData; + } + + /** + * Read OBJ record + */ + private function _readObj() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_readDataOnly || $this->_version != self::XLS_BIFF8) { + return; + } + + // recordData consists of an array of subrecords looking like this: + // ft: 2 bytes; id number + // cb: 2 bytes; size in bytes of following data + // data: var; subrecord data + + // for now, we are just interested in the second subrecord containing the object type + $ot = $this->_GetInt2d($recordData, 4); + + $this->_objs[] = array( + 'type' => $ot, + ); + } + + /** + * Read WINDOW2 record + */ + private function _readWindow2() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; option flags + $options = $this->_GetInt2d($recordData, 0); + + // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines + $showGridlines = (bool) ((0x0002 & $options) >> 1); + $this->_phpSheet->setShowGridlines($showGridlines); + + // bit: 3; mask: 0x0008; 0 = panes are not frozen, 1 = panes are frozen + $this->_frozen = (bool) ((0x0008 & $options) >> 3); + + // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left + $this->_phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); + + // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active + $isActive = (bool) ((0x0400 & $options) >> 10); + if ($isActive) { + $this->_phpExcel->setActiveSheetIndex($this->_phpExcel->getIndex($this->_phpSheet)); + } + } + + /** + * Read SCL record + */ + private function _readScl() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // offset: 0; size: 2; numerator of the view magnification + $numerator = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; numerator of the view magnification + $denumerator = $this->_GetInt2d($recordData, 2); + + // set the zoom scale (in percent) + $this->_phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator); + } + + /** + * Read PANE record + */ + private function _readPane() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 2; position of vertical split + $px = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; position of horizontal split + $py = $this->_GetInt2d($recordData, 2); + + if ($this->_frozen) { + // frozen panes + $this->_phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1)); + } else { + // unfrozen panes; split windows; not supported by PHPExcel core + } + } + } + + /** + * MERGEDCELLS + * + * This record contains the addresses of merged cell ranges + * in the current sheet. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function _readMergedCells() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData); + foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) { + $this->_phpSheet->mergeCells($cellRangeAddress); + } + } + } + + /** + * Read HYPERLINK record + */ + private function _readHyperLink() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer forward to next record + $this->_pos += 4 + $length; + + if (!$this->_readDataOnly) { + // offset: 0; size: 8; cell range address of all cells containing this hyperlink + try { + $cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8); + } catch (Exception $e) { + return; + } + + // offset: 8, size: 16; GUID of StdLink + + // offset: 24, size: 4; unknown value + + // offset: 28, size: 4; option flags + + // bit: 0; mask: 0x00000001; 0 = no link or extant, 1 = file link or URL + $isFileLinkOrUrl = (0x00000001 & $this->_GetInt2d($recordData, 28)) >> 0; + + // bit: 1; mask: 0x00000002; 0 = relative path, 1 = absolute path or URL + $isAbsPathOrUrl = (0x00000001 & $this->_GetInt2d($recordData, 28)) >> 1; + + // bit: 2 (and 4); mask: 0x00000014; 0 = no description + $hasDesc = (0x00000014 & $this->_GetInt2d($recordData, 28)) >> 2; + + // bit: 3; mask: 0x00000008; 0 = no text, 1 = has text + $hasText = (0x00000008 & $this->_GetInt2d($recordData, 28)) >> 3; + + // bit: 7; mask: 0x00000080; 0 = no target frame, 1 = has target frame + $hasFrame = (0x00000080 & $this->_GetInt2d($recordData, 28)) >> 7; + + // bit: 8; mask: 0x00000100; 0 = file link or URL, 1 = UNC path (inc. server name) + $isUNC = (0x00000100 & $this->_GetInt2d($recordData, 28)) >> 8; + + // offset within record data + $offset = 32; + + if ($hasDesc) { + // offset: 32; size: var; character count of description text + $dl = $this->_GetInt4d($recordData, 32); + // offset: 36; size: var; character array of description text, no Unicode string header, always 16-bit characters, zero terminated + $desc = $this->_encodeUTF16(substr($recordData, 36, 2 * ($dl - 1)), false); + $offset += 4 + 2 * $dl; + } + if ($hasFrame) { + $fl = $this->_GetInt4d($recordData, $offset); + $offset += 4 + 2 * $fl; + } + + // detect type of hyperlink (there are 4 types) + $hyperlinkType = null; + + if ($isUNC) { + $hyperlinkType = 'UNC'; + } else if (!$isFileLinkOrUrl) { + $hyperlinkType = 'workbook'; + } else if (ord($recordData{$offset}) == 0x03) { + $hyperlinkType = 'local'; + } else if (ord($recordData{$offset}) == 0xE0) { + $hyperlinkType = 'URL'; + } + + switch ($hyperlinkType) { + case 'URL': + // offset: var; size: 16; GUID of URL Moniker + $offset += 16; + // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word + $us = $this->_GetInt4d($recordData, $offset); + $offset += 4; + // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated + $url = $this->_encodeUTF16(substr($recordData, $offset, $us - 2), false); + $url .= $hasText ? '#' : ''; + $offset += $us; + break; + + case 'workbook': + // section 5.58.5: Hyperlink to the Current Workbook + // e.g. Sheet2!B1:C2, stored in text mark field + $url = 'sheet://'; + break; + + case 'local': + // section 5.58.2: Hyperlink containing a URL + // e.g. http://example.org/index.php + // todo: implement + + case 'UNC': + // section 5.58.4: Hyperlink to a File with UNC (Universal Naming Convention) Path + // todo: implement + + default: + return; + + } + + if ($hasText) { + // offset: var; size: 4; character count of text mark including trailing zero word + $tl = $this->_GetInt4d($recordData, $offset); + $offset += 4; + // offset: var; size: var; character array of the text mark without the # sign, no Unicode header, always 16-bit characters, zero-terminated + $text = $this->_encodeUTF16(substr($recordData, $offset, 2 * ($tl - 1)), false); + $url .= $text; + } + + // apply the hyperlink to all the relevant cells + foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cellRange) as $coordinate) { + $this->_phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url); + } + } + } + + /** + * Read RANGEPROTECTION record + * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, + * where it is referred to as FEAT record + */ + private function _readRangeProtection() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // local pointer in record data + $offset = 0; + + if (!$this->_readDataOnly) { + $offset += 12; + + // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag + $isf = $this->_GetInt2d($recordData, 12); + if ($isf != 2) { + // we only read FEAT records of type 2 + return; + } + $offset += 2; + + $offset += 5; + + // offset: 19; size: 2; count of ref ranges this feature is on + $cref = $this->_GetInt2d($recordData, 19); + $offset += 2; + + $offset += 6; + + // offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record) + $cellRanges = array(); + for ($i = 0; $i < $cref; ++$i) { + try { + $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); + } catch (Exception $e) { + return; + } + $cellRanges[] = $cellRange; + $offset += 8; + } + + // offset: var; size: var; variable length of feature specific data + $rgbFeat = substr($recordData, $offset); + $offset += 4; + + // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit) + $wPassword = $this->_GetInt4d($recordData, $offset); + $offset += 4; + + // Apply range protection to sheet + if ($cellRanges) { + $this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); + } + } + } + + /** + * Read IMDATA record + */ + private function _readImData() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + + // get spliced record data + $splicedRecordData = $this->_getSplicedRecordData(); + $recordData = $splicedRecordData['recordData']; + + // UNDER CONSTRUCTION + + // offset: 0; size: 2; image format + $cf = $this->_GetInt2d($recordData, 0); + + // offset: 2; size: 2; environment from which the file was written + $env = $this->_GetInt2d($recordData, 2); + + // offset: 4; size: 4; length of the image data + $lcb = $this->_GetInt4d($recordData, 4); + + // offset: 8; size: var; image data + $iData = substr($recordData, 8); + + switch ($cf) { + case 0x09: // Windows bitmap format + // BITMAPCOREINFO + // 1. BITMAPCOREHEADER + // offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure + $bcSize = $this->_GetInt4d($iData, 0); + var_dump($bcSize); + + // offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels + $bcWidth = $this->_GetInt2d($iData, 4); + var_dump($bcWidth); + + // offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels. + $bcHeight = $this->_GetInt2d($iData, 6); + var_dump($bcHeight); + $ih = imagecreatetruecolor($bcWidth, $bcHeight); + + // offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1 + + // offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24 + $bcBitCount = $this->_GetInt2d($iData, 10); + var_dump($bcBitCount); + + $rgbString = substr($iData, 12); + $rgbTriples = array(); + while (strlen($rgbString) > 0) { + $rgbTriples[] = unpack('Cb/Cg/Cr', $rgbString); + $rgbString = substr($rgbString, 3); + } + $x = 0; + $y = 0; + foreach ($rgbTriples as $i => $rgbTriple) { + $color = imagecolorallocate($ih, $rgbTriple['r'], $rgbTriple['g'], $rgbTriple['b']); + imagesetpixel($ih, $x, $bcHeight - 1 - $y, $color); + $x = ($x + 1) % $bcWidth; + $y = $y + floor(($x + 1) / $bcWidth); + } + //imagepng($ih, 'image.png'); + + $drawing = new PHPExcel_Worksheet_Drawing(); + $drawing->setPath($filename); + $drawing->setWorksheet($this->_phpSheet); + + break; + + case 0x02: // Windows metafile or Macintosh PICT format + case 0x0e: // native format + default; + break; + + } + + // _getSplicedRecordData() takes care of moving current position in data stream + } + + /** + * Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record + * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. + * In this case, we must treat the CONTINUE record as a MSODRAWING record + */ + private function _readContinue() + { + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + // check if we are reading drawing data + // this is in case a free CONTINUE record occurs in other circumstances we are unaware of + if ($this->_drawingData == '') { + return; + } + + // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data + if (strlen($recordData) < 4) { + return; + } + + // dirty check to see if CONTINUE record could be a camouflaged MSODRAWING record + // look inside CONTINUE record to see if it looks like a part of an Escher stream + // we know that Escher stream may be split at least at + // 0xF004 MsofbtSpContainer + // 0xF00D MsofbtClientTextbox + $validSplitPoints = array(0xF004, 0xF00D); // add identifiers if we find more + + $splitPoint = $this->_GetInt2d($recordData, 2); + if (in_array($splitPoint, $validSplitPoints)) { + $this->_drawingData .= $recordData; + } + } + + + /** + * Reads a record from current position in data stream and continues reading data as long as CONTINUE + * records are found. Splices the record data pieces and returns the combined string as if record data + * is in one piece. + * Moves to next current position in data stream to start of next record different from a CONtINUE record + * + * @return array + */ + private function _getSplicedRecordData() + { + $data = ''; + $spliceOffsets = array(); + + $i = 0; + $spliceOffsets[0] = 0; + + do { + ++$i; + + // offset: 0; size: 2; identifier + $identifier = $this->_GetInt2d($this->_data, $this->_pos); + // offset: 2; size: 2; length + $length = $this->_GetInt2d($this->_data, $this->_pos + 2); + $data .= substr($this->_data, $this->_pos + 4, $length); + + $spliceOffsets[$i] = $spliceOffsets[$i - 1] + $length; + + $this->_pos += 4 + $length; + $nextIdentifier = $this->_GetInt2d($this->_data, $this->_pos); + } + while ($nextIdentifier == self::XLS_Type_CONTINUE); + + $splicedData = array( + 'recordData' => $data, + 'spliceOffsets' => $spliceOffsets, + ); + + return $splicedData; + + } + + /** + * Convert formula structure into human readable Excel formula like 'A3+A5*5' + * + * @param string $formulaStructure The complete binary data for the formula + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * @return string Human readable formula + */ + private function _getFormulaFromStructure($formulaStructure, $baseCell = 'A1') + { + // offset: 0; size: 2; size of the following formula data + $sz = $this->_GetInt2d($formulaStructure, 0); + + // offset: 2; size: sz + $formulaData = substr($formulaStructure, 2, $sz); + + // for debug: dump the formula data + //echo ''; + //echo 'size: ' . $sz . "\n"; + //echo 'the entire formula data: '; + //Debug::dump($formulaData); + //echo "\n----\n"; + + // offset: 2 + sz; size: variable (optional) + if (strlen($formulaStructure) > 2 + $sz) { + $additionalData = substr($formulaStructure, 2 + $sz); + + // for debug: dump the additional data + //echo 'the entire additional data: '; + //Debug::dump($additionalData); + //echo "\n----\n"; + + } else { + $additionalData = ''; + } + + return $this->_getFormulaFromData($formulaData, $additionalData, $baseCell); + } + + /** + * Take formula data and additional data for formula and return human readable formula + * + * @param string $formulaData The binary data for the formula itself + * @param string $additionalData Additional binary data going with the formula + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * @return string Human readable formula + */ + private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') + { + // start parsing the formula data + $tokens = array(); + + while (strlen($formulaData) > 0 and $token = $this->_getNextToken($formulaData, $baseCell)) { + $tokens[] = $token; + $formulaData = substr($formulaData, $token['size']); + + // for debug: dump the token + //var_dump($token); + } + + $formulaString = $this->_createFormulaFromTokens($tokens, $additionalData); + + return $formulaString; + } + + /** + * Take array of tokens together with additional data for formula and return human readable formula + * + * @param array $tokens + * @param array $additionalData Additional binary data going with the formula + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * @return string Human readable formula + */ + private function _createFormulaFromTokens($tokens, $additionalData) + { + // empty formula? + if (count($tokens) == 0) { + return ''; + } + + $formulaStrings = array(); + foreach ($tokens as $token) { + // initialize spaces + $space0 = isset($space0) ? $space0 : ''; // spaces before next token, not tParen + $space1 = isset($space1) ? $space1 : ''; // carriage returns before next token, not tParen + $space2 = isset($space2) ? $space2 : ''; // spaces before opening parenthesis + $space3 = isset($space3) ? $space3 : ''; // carriage returns before opening parenthesis + $space4 = isset($space4) ? $space4 : ''; // spaces before closing parenthesis + $space5 = isset($space5) ? $space5 : ''; // carriage returns before closing parenthesis + + switch ($token['name']) { + case 'tAdd': // addition + case 'tConcat': // addition + case 'tDiv': // division + case 'tEQ': // equaltiy + case 'tGE': // greater than or equal + case 'tGT': // greater than + case 'tIsect': // intersection + case 'tLE': // less than or equal + case 'tList': // less than or equal + case 'tLT': // less than + case 'tMul': // multiplication + case 'tNE': // multiplication + case 'tPower': // power + case 'tRange': // range + case 'tSub': // subtraction + $op2 = array_pop($formulaStrings); + $op1 = array_pop($formulaStrings); + $formulaStrings[] = "$op1$space1$space0{$token['data']}$op2"; + unset($space0, $space1); + break; + case 'tUplus': // unary plus + case 'tUminus': // unary minus + $op = array_pop($formulaStrings); + $formulaStrings[] = "$space1$space0{$token['data']}$op"; + unset($space0, $space1); + break; + case 'tPercent': // percent sign + $op = array_pop($formulaStrings); + $formulaStrings[] = "$op$space1$space0{$token['data']}"; + unset($space0, $space1); + break; + case 'tAttrVolatile': // indicates volatile function + case 'tAttrIf': + case 'tAttrSkip': + case 'tAttrChoose': + // token is only important for Excel formula evaluator + // do nothing + break; + case 'tAttrSpace': // space / carriage return + // space will be used when next token arrives, do not alter formulaString stack + switch ($token['data']['spacetype']) { + case 'type0': + $space0 = str_repeat(' ', $token['data']['spacecount']); + break; + case 'type1': + $space1 = str_repeat("\n", $token['data']['spacecount']); + break; + case 'type2': + $space2 = str_repeat(' ', $token['data']['spacecount']); + break; + case 'type3': + $space3 = str_repeat("\n", $token['data']['spacecount']); + break; + case 'type4': + $space4 = str_repeat(' ', $token['data']['spacecount']); + break; + case 'type5': + $space5 = str_repeat("\n", $token['data']['spacecount']); + break; + } + break; + case 'tAttrSum': // SUM function with one parameter + $op = array_pop($formulaStrings); + $formulaStrings[] = "{$space1}{$space0}SUM($op)"; + unset($space0, $space1); + break; + case 'tFunc': // function with fixed number of arguments + case 'tFuncV': // function with variable number of arguments + $ops = array(); // array of operators + for ($i = 0; $i < $token['data']['args']; ++$i) { + $ops[] = array_pop($formulaStrings); + } + $ops = array_reverse($ops); + $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ")"; + unset($space0, $space1); + break; + case 'tParen': // parenthesis + $expression = array_pop($formulaStrings); + $formulaStrings[] = "$space3$space2($expression$space5$space4)"; + unset($space2, $space3, $space4, $space5); + break; + case 'tArray': // array constant + $constantArray = $this->_readBIFF8ConstantArray($additionalData); + $formulaStrings[] = $space1 . $space0 . $constantArray['value']; + $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data + unset($space0, $space1); + break; + case 'tMemArea': + // bite off chunk of additional data + $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($additionalData); + $additionalData = substr($additionalData, $cellRangeAddressList['size']); + $formulaStrings[] = "$space1$space0{$token['data']}"; + unset($space0, $space1); + break; + case 'tArea': // cell range address + case 'tBool': // boolean + case 'tErr': // error code + case 'tInt': // integer + case 'tMemErr': + case 'tMemFunc': + case 'tMissArg': + case 'tName': + case 'tNum': // number + case 'tRef': // single cell reference + case 'tRef3d': // 3d cell reference + case 'tArea3d': // 3d cell range reference + case 'tRefN': + case 'tStr': // string + $formulaStrings[] = "$space1$space0{$token['data']}"; + unset($space0, $space1); + break; + } + } + $formulaString = $formulaStrings[0]; + + // for debug: dump the human readable formula + //echo '----' . "\n"; + //echo 'Formula: ' . $formulaString; + + return $formulaString; + } + + /** + * Fetch next token from binary formula data + * + * @param string Formula data + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * @return array + * @throws Exception + */ + private function _getNextToken($formulaData, $baseCell = 'A1') + { + // offset: 0; size: 1; token id + $id = ord($formulaData[0]); // token id + $name = false; // initialize token name + + switch ($id) { + case 0x03: $name = 'tAdd'; $size = 1; $data = '+'; break; + case 0x04: $name = 'tSub'; $size = 1; $data = '-'; break; + case 0x05: $name = 'tMul'; $size = 1; $data = '*'; break; + case 0x06: $name = 'tDiv'; $size = 1; $data = '/'; break; + case 0x07: $name = 'tPower'; $size = 1; $data = '^'; break; + case 0x08: $name = 'tConcat'; $size = 1; $data = '&'; break; + case 0x09: $name = 'tLT'; $size = 1; $data = '<'; break; + case 0x0A: $name = 'tLE'; $size = 1; $data = '<='; break; + case 0x0B: $name = 'tEQ'; $size = 1; $data = '='; break; + case 0x0C: $name = 'tGE'; $size = 1; $data = '>='; break; + case 0x0D: $name = 'tGT'; $size = 1; $data = '>'; break; + case 0x0E: $name = 'tNE'; $size = 1; $data = '<>'; break; + case 0x0F: $name = 'tIsect'; $size = 1; $data = ' '; break; + case 0x10: $name = 'tList'; $size = 1; $data = ','; break; + case 0x11: $name = 'tRange'; $size = 1; $data = ':'; break; + case 0x12: $name = 'tUplus'; $size = 1; $data = '+'; break; + case 0x13: $name = 'tUminus'; $size = 1; $data = '-'; break; + case 0x14: $name = 'tPercent'; $size = 1; $data = '%'; break; + case 0x15: // parenthesis + $name = 'tParen'; + $size = 1; + $data = null; + break; + case 0x16: // missing argument + $name = 'tMissArg'; + $size = 1; + $data = ''; + break; + case 0x17: // string + $name = 'tStr'; + // offset: 1; size: var; Unicode string, 8-bit string length + $string = $this->_readUnicodeStringShort(substr($formulaData, 1)); + $size = 1 + $string['size']; + $data = $this->_UTF8toExcelDoubleQuoted($string['value']); + break; + case 0x19: // Special attribute + // offset: 1; size: 1; attribute type flags: + switch (ord($formulaData[1])) { + case 0x01: + $name = 'tAttrVolatile'; + $size = 4; + $data = null; + break; + case 0x02: + $name = 'tAttrIf'; + $size = 4; + $data = null; + break; + case 0x04: + $name = 'tAttrChoose'; + // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1) + $nc = $this->_GetInt2d($formulaData, 2); + // offset: 4; size: 2 * $nc + // offset: 4 + 2 * $nc; size: 2 + $size = 2 * $nc + 6; + $data = null; + break; + case 0x08: + $name = 'tAttrSkip'; + $size = 4; + $data = null; + break; + case 0x10: + $name = 'tAttrSum'; + $size = 4; + $data = null; + break; + case 0x40: + case 0x41: + $name = 'tAttrSpace'; + $size = 4; + // offset: 2; size: 2; space type and position + switch (ord($formulaData[2])) { + case 0x00: + $spacetype = 'type0'; + break; + case 0x01: + $spacetype = 'type1'; + break; + case 0x02: + $spacetype = 'type2'; + break; + case 0x03: + $spacetype = 'type3'; + break; + case 0x04: + $spacetype = 'type4'; + break; + case 0x05: + $spacetype = 'type5'; + break; + default: + throw new Exception('Unrecognized space type in tAttrSpace token'); + break; + } + // offset: 3; size: 1; number of inserted spaces/carriage returns + $spacecount = ord($formulaData[3]); + + $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount); + break; + default: + throw new Exception('Unrecognized attribute flag in tAttr token'); + break; + } + break; + case 0x1C: // error code + // offset: 1; size: 1; error code + $name = 'tErr'; + $size = 2; + $data = $this->_mapErrorCode(ord($formulaData[1])); + break; + case 0x1D: // boolean + // offset: 1; size: 1; 0 = false, 1 = true; + $name = 'tBool'; + $size = 2; + $data = ord($formulaData[1]) ? 'TRUE' : 'FALSE'; + break; + case 0x1E: // integer + // offset: 1; size: 2; unsigned 16-bit integer + $name = 'tInt'; + $size = 3; + $data = $this->_GetInt2d($formulaData, 1); + break; + case 0x1F: // number + // offset: 1; size: 8; + $name = 'tNum'; + $size = 9; + $data = $this->_extractNumber(substr($formulaData, 1)); + $data = str_replace(',', '.', (string)$data); // in case non-English locale + break; + case 0x40: // array constant + case 0x60: // array constant + // offset: 1; size: 7; not used + $name = 'tArray'; + $size = 8; + $data = null; + break; + case 0x41: // function with fixed number of arguments + $name = 'tFunc'; + $size = 3; + // offset: 1; size: 2; index to built-in sheet function + switch ($this->_GetInt2d($formulaData, 1)) { + case 2: $function = 'ISNA'; $args = 1; break; + case 3: $function = 'ISERROR'; $args = 1; break; + case 10: $function = 'NA'; $args = 0; break; + case 15: $function = 'SIN'; $args = 1; break; + case 16: $function = 'COS'; $args = 1; break; + case 17: $function = 'TAN'; $args = 1; break; + case 18: $function = 'ATAN'; $args = 1; break; + case 19: $function = 'PI'; $args = 0; break; + case 20: $function = 'SQRT'; $args = 1; break; + case 21: $function = 'EXP'; $args = 1; break; + case 22: $function = 'LN'; $args = 1; break; + case 23: $function = 'LOG10'; $args = 1; break; + case 24: $function = 'ABS'; $args = 1; break; + case 25: $function = 'INT'; $args = 1; break; + case 26: $function = 'SIGN'; $args = 1; break; + case 27: $function = 'ROUND'; $args = 2; break; + case 30: $function = 'REPT'; $args = 2; break; + case 31: $function = 'MID'; $args = 3; break; + case 32: $function = 'LEN'; $args = 1; break; + case 33: $function = 'VALUE'; $args = 1; break; + case 34: $function = 'TRUE'; $args = 0; break; + case 35: $function = 'FALSE'; $args = 0; break; + case 38: $function = 'NOT'; $args = 1; break; + case 39: $function = 'MOD'; $args = 2; break; + case 40: $function = 'DCOUNT'; $args = 3; break; + case 41: $function = 'DSUM'; $args = 3; break; + case 42: $function = 'DAVERAGE'; $args = 3; break; + case 43: $function = 'DMIN'; $args = 3; break; + case 44: $function = 'DMAX'; $args = 3; break; + case 45: $function = 'DSTDEV'; $args = 3; break; + case 48: $function = 'TEXT'; $args = 2; break; + case 61: $function = 'MIRR'; $args = 3; break; + case 63: $function = 'RAND'; $args = 0; break; + case 65: $function = 'DATE'; $args = 3; break; + case 66: $function = 'TIME'; $args = 3; break; + case 67: $function = 'DAY'; $args = 1; break; + case 68: $function = 'MONTH'; $args = 1; break; + case 69: $function = 'YEAR'; $args = 1; break; + case 71: $function = 'HOUR'; $args = 1; break; + case 72: $function = 'MINUTE'; $args = 1; break; + case 73: $function = 'SECOND'; $args = 1; break; + case 74: $function = 'NOW'; $args = 0; break; + case 75: $function = 'AREAS'; $args = 1; break; + case 76: $function = 'ROWS'; $args = 1; break; + case 77: $function = 'COLUMNS'; $args = 1; break; + case 83: $function = 'TRANSPOSE'; $args = 1; break; + case 86: $function = 'TYPE'; $args = 1; break; + case 97: $function = 'ATAN2'; $args = 2; break; + case 98: $function = 'ASIN'; $args = 1; break; + case 99: $function = 'ACOS'; $args = 1; break; + case 105: $function = 'ISREF'; $args = 1; break; + case 111: $function = 'CHAR'; $args = 1; break; + case 112: $function = 'LOWER'; $args = 1; break; + case 113: $function = 'UPPER'; $args = 1; break; + case 114: $function = 'PROPER'; $args = 1; break; + case 117: $function = 'EXACT'; $args = 2; break; + case 118: $function = 'TRIM'; $args = 1; break; + case 119: $function = 'REPLACE'; $args = 4; break; + case 121: $function = 'CODE'; $args = 1; break; + case 126: $function = 'ISERR'; $args = 1; break; + case 127: $function = 'ISTEXT'; $args = 1; break; + case 128: $function = 'ISNUMBER'; $args = 1; break; + case 129: $function = 'ISBLANK'; $args = 1; break; + case 130: $function = 'T'; $args = 1; break; + case 131: $function = 'N'; $args = 1; break; + case 140: $function = 'DATEVALUE'; $args = 1; break; + case 141: $function = 'TIMEVALUE'; $args = 1; break; + case 142: $function = 'SLN'; $args = 3; break; + case 143: $function = 'SYD'; $args = 4; break; + case 162: $function = 'CLEAN'; $args = 1; break; + case 163: $function = 'MDETERM'; $args = 1; break; + case 164: $function = 'MINVERSE'; $args = 1; break; + case 165: $function = 'MMULT'; $args = 2; break; + case 184: $function = 'FACT'; $args = 1; break; + case 189: $function = 'DPRODUCT'; $args = 3; break; + case 190: $function = 'ISNONTEXT'; $args = 1; break; + case 195: $function = 'DSTDEVP'; $args = 3; break; + case 196: $function = 'DVARP'; $args = 3; break; + case 198: $function = 'ISLOGICAL'; $args = 1; break; + case 199: $function = 'DCOUNTA'; $args = 3; break; + case 207: $function = 'REPLACEB'; $args = 4; break; + case 210: $function = 'MIDB'; $args = 3; break; + case 211: $function = 'LENB'; $args = 1; break; + case 212: $function = 'ROUNDUP'; $args = 2; break; + case 213: $function = 'ROUNDDOWN'; $args = 2; break; + case 214: $function = 'ASC'; $args = 1; break; + case 215: $function = 'DBCS'; $args = 1; break; + case 221: $function = 'TODAY'; $args = 0; break; + case 229: $function = 'SINH'; $args = 1; break; + case 230: $function = 'COSH'; $args = 1; break; + case 231: $function = 'TANH'; $args = 1; break; + case 232: $function = 'ASINH'; $args = 1; break; + case 233: $function = 'ACOSH'; $args = 1; break; + case 234: $function = 'ATANH'; $args = 1; break; + case 235: $function = 'DGET'; $args = 3; break; + case 244: $function = 'INFO'; $args = 1; break; + case 252: $function = 'FREQUENCY'; $args = 2; break; + case 261: $function = 'ERROR.TYPE'; $args = 1; break; + case 271: $function = 'GAMMALN'; $args = 1; break; + case 273: $function = 'BINOMDIST'; $args = 4; break; + case 274: $function = 'CHIDIST'; $args = 2; break; + case 275: $function = 'CHIINV'; $args = 2; break; + case 276: $function = 'COMBIN'; $args = 2; break; + case 277: $function = 'CONFIDENCE'; $args = 3; break; + case 278: $function = 'CRITBINOM'; $args = 3; break; + case 279: $function = 'EVEN'; $args = 1; break; + case 280: $function = 'EXPONDIST'; $args = 3; break; + case 281: $function = 'FDIST'; $args = 3; break; + case 282: $function = 'FINV'; $args = 3; break; + case 283: $function = 'FISHER'; $args = 1; break; + case 284: $function = 'FISHERINV'; $args = 1; break; + case 285: $function = 'FLOOR'; $args = 2; break; + case 286: $function = 'GAMMADIST'; $args = 4; break; + case 287: $function = 'GAMMAINV'; $args = 3; break; + case 288: $function = 'CEILING'; $args = 2; break; + case 289: $function = 'HYPGEOMDIST'; $args = 4; break; + case 290: $function = 'LOGNORMDIST'; $args = 3; break; + case 291: $function = 'LOGINV'; $args = 3; break; + case 292: $function = 'NEGBINOMDIST'; $args = 3; break; + case 293: $function = 'NORMDIST'; $args = 4; break; + case 294: $function = 'NORMSDIST'; $args = 1; break; + case 295: $function = 'NORMINV'; $args = 3; break; + case 296: $function = 'NORMSINV'; $args = 1; break; + case 297: $function = 'STANDARDIZE'; $args = 3; break; + case 298: $function = 'ODD'; $args = 1; break; + case 299: $function = 'PERMUT'; $args = 2; break; + case 300: $function = 'POISSON'; $args = 3; break; + case 301: $function = 'TDIST'; $args = 3; break; + case 302: $function = 'WEIBULL'; $args = 4; break; + case 303: $function = 'SUMXMY2'; $args = 2; break; + case 304: $function = 'SUMX2MY2'; $args = 2; break; + case 305: $function = 'SUMX2PY2'; $args = 2; break; + case 306: $function = 'CHITEST'; $args = 2; break; + case 307: $function = 'CORREL'; $args = 2; break; + case 308: $function = 'COVAR'; $args = 2; break; + case 309: $function = 'FORECAST'; $args = 3; break; + case 310: $function = 'FTEST'; $args = 2; break; + case 311: $function = 'INTERCEPT'; $args = 2; break; + case 312: $function = 'PEARSON'; $args = 2; break; + case 313: $function = 'RSQ'; $args = 2; break; + case 314: $function = 'STEYX'; $args = 2; break; + case 315: $function = 'SLOPE'; $args = 2; break; + case 316: $function = 'TTEST'; $args = 4; break; + case 325: $function = 'LARGE'; $args = 2; break; + case 326: $function = 'SMALL'; $args = 2; break; + case 327: $function = 'QUARTILE'; $args = 2; break; + case 328: $function = 'PERCENTILE'; $args = 2; break; + case 331: $function = 'TRIMMEAN'; $args = 2; break; + case 332: $function = 'TINV'; $args = 2; break; + case 337: $function = 'POWER'; $args = 2; break; + case 342: $function = 'RADIANS'; $args = 1; break; + case 343: $function = 'DEGREES'; $args = 1; break; + case 346: $function = 'COUNTIF'; $args = 2; break; + case 347: $function = 'COUNTBLANK'; $args = 1; break; + case 350: $function = 'ISPMT'; $args = 4; break; + case 351: $function = 'DATEDIF'; $args = 3; break; + case 352: $function = 'DATESTRING'; $args = 1; break; + case 353: $function = 'NUMBERSTRING'; $args = 2; break; + case 360: $function = 'PHONETIC'; $args = 1; break; + default: + throw new Exception('Unrecognized function in formula'); + break; + } + $data = array('function' => $function, 'args' => $args); + break; + case 0x22: // function with variable number of arguments + case 0x42: // function with variable number of arguments + case 0x62: // function with variable number of arguments + $name = 'tFuncV'; + $size = 4; + // offset: 1; size: 1; number of arguments + $args = ord($formulaData[1]); + // offset: 2: size: 2; index to built-in sheet function + switch ($this->_GetInt2d($formulaData, 2)) { + case 0: $function = 'COUNT'; break; + case 1: $function = 'IF'; break; + case 4: $function = 'SUM'; break; + case 5: $function = 'AVERAGE'; break; + case 6: $function = 'MIN'; break; + case 7: $function = 'MAX'; break; + case 8: $function = 'ROW'; break; + case 9: $function = 'COLUMN'; break; + case 11: $function = 'NPV'; break; + case 12: $function = 'STDEV'; break; + case 13: $function = 'DOLLAR'; break; + case 14: $function = 'FIXED'; break; + case 28: $function = 'LOOKUP'; break; + case 29: $function = 'INDEX'; break; + case 36: $function = 'AND'; break; + case 37: $function = 'OR'; break; + case 46: $function = 'VAR'; break; + case 49: $function = 'LINEST'; break; + case 50: $function = 'TREND'; break; + case 51: $function = 'LOGEST'; break; + case 52: $function = 'GROWTH'; break; + case 56: $function = 'PV'; break; + case 57: $function = 'FV'; break; + case 58: $function = 'NPER'; break; + case 59: $function = 'PMT'; break; + case 60: $function = 'RATE'; break; + case 62: $function = 'IRR'; break; + case 64: $function = 'MATCH'; break; + case 70: $function = 'WEEKDAY'; break; + case 78: $function = 'OFFSET'; break; + case 82: $function = 'SEARCH'; break; + case 100: $function = 'CHOOSE'; break; + case 101: $function = 'HLOOKUP'; break; + case 102: $function = 'VLOOKUP'; break; + case 109: $function = 'LOG'; break; + case 115: $function = 'LEFT'; break; + case 116: $function = 'RIGHT'; break; + case 120: $function = 'SUBSTITUTE'; break; + case 124: $function = 'FIND'; break; + case 125: $function = 'CELL'; break; + case 144: $function = 'DDB'; break; + case 148: $function = 'INDIRECT'; break; + case 167: $function = 'IPMT'; break; + case 168: $function = 'PPMT'; break; + case 169: $function = 'COUNTA'; break; + case 183: $function = 'PRODUCT'; break; + case 193: $function = 'STDEVP'; break; + case 194: $function = 'VARP'; break; + case 197: $function = 'TRUNC'; break; + case 204: $function = 'USDOLLAR'; break; + case 205: $function = 'FINDB'; break; + case 206: $function = 'SEARCHB'; break; + case 208: $function = 'LEFTB'; break; + case 209: $function = 'RIGHTB'; break; + case 216: $function = 'RANK'; break; + case 219: $function = 'ADDRESS'; break; + case 220: $function = 'DAYS360'; break; + case 222: $function = 'VDB'; break; + case 227: $function = 'MEDIAN'; break; + case 228: $function = 'SUMPRODUCT'; break; + case 247: $function = 'DB'; break; + case 269: $function = 'AVEDEV'; break; + case 270: $function = 'BETADIST'; break; + case 272: $function = 'BETAINV'; break; + case 317: $function = 'PROB'; break; + case 318: $function = 'DEVSQ'; break; + case 319: $function = 'GEOMEAN'; break; + case 320: $function = 'HARMEAN'; break; + case 321: $function = 'SUMSQ'; break; + case 322: $function = 'KURT'; break; + case 323: $function = 'SKEW'; break; + case 324: $function = 'ZTEST'; break; + case 329: $function = 'PERCENTRANK'; break; + case 330: $function = 'MODE'; break; + case 336: $function = 'CONCATENATE'; break; + case 344: $function = 'SUBTOTAL'; break; + case 345: $function = 'SUMIF'; break; + case 354: $function = 'ROMAN'; break; + case 358: $function = 'GETPIVOTDATA'; break; + case 359: $function = 'HYPERLINK'; break; + case 361: $function = 'AVERAGEA'; break; + case 362: $function = 'MAXA'; break; + case 363: $function = 'MINA'; break; + case 364: $function = 'STDEVPA'; break; + case 365: $function = 'VARPA'; break; + case 366: $function = 'STDEVA'; break; + case 367: $function = 'VARA'; break; + default: + throw new Exception('Unrecognized function in formula'); + break; + } + $data = array('function' => $function, 'args' => $args); + break; + case 0x23: // index to defined name + case 0x43: + $name = 'tName'; + $size = 5; + // offset: 1; size: 2; one-based index to definedname record + $definedNameIndex = $this->_GetInt2d($formulaData, 1) - 1; + // offset: 2; size: 2; not used + $data = $this->_definedname[$definedNameIndex]['name']; + break; + case 0x24: // single cell reference e.g. A5 + case 0x44: + case 0x64: + $name = 'tRef'; + $size = 5; + $data = $this->_readBIFF8CellAddress(substr($formulaData, 1, 4)); + break; + case 0x25: // cell range reference to cells in the same sheet + case 0x45: + case 0x65: + $name = 'tArea'; + $size = 9; + $data = $this->_readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); + break; + case 0x26: + case 0x46: + $name = 'tMemArea'; + // offset: 1; size: 4; not used + // offset: 5; size: 2; size of the following subexpression + $subSize = $this->_GetInt2d($formulaData, 5); + $size = 7 + $subSize; + $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); + break; + case 0x47: + $name = 'tMemErr'; + // offset: 1; size: 4; not used + // offset: 5; size: 2; size of the following subexpression + $subSize = $this->_GetInt2d($formulaData, 5); + $size = 7 + $subSize; + $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); + break; + case 0x29: + case 0x49: + $name = 'tMemFunc'; + // offset: 1; size: 2; size of the following subexpression + $subSize = $this->_GetInt2d($formulaData, 1); + $size = 3 + $subSize; + $data = $this->_getFormulaFromData(substr($formulaData, 3, $subSize)); + break; + + case 0x4C: // Relative reference, used in shared formulas and some other places + $name = 'tRefN'; + $size = 5; + $data = $this->_readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); + break; + + case 0x3A: // 3d reference to cell + case 0x5A: + $name = 'tRef3d'; + $size = 7; + // offset: 1; size: 2; index to REF entry + $sheetRange = $this->_readSheetRangeByRefIndex($this->_GetInt2d($formulaData, 1)); + // offset: 3; size: 4; cell address + $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); + + $data = "$sheetRange!$cellAddress"; + + break; + case 0x3B: // 3d reference to cell range + case 0x5B: + $name = 'tArea3d'; + $size = 11; + // offset: 1; size: 2; index to REF entry + $sheetRange = $this->_readSheetRangeByRefIndex($this->_GetInt2d($formulaData, 1)); + // offset: 3; size: 8; cell address + $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); + + $data = "$sheetRange!$cellRangeAddress"; + + break; + // case 0x39: // don't know how to deal with + default: + throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); + break; + } + + return array( + 'id' => $id, + 'name' => $name, + 'size' => $size, + 'data' => $data, + ); + } + + /** + * Reads a cell address in BIFF8 e.g. 'A2' or '$A$2' + * section 3.3.4 + * + * @param string $cellAddressStructure + * @return string + */ + private function _readBIFF8CellAddress($cellAddressStructure) + { + // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) + $row = $this->_GetInt2d($cellAddressStructure, 0) + 1; + + // offset: 2; size: 2; index to column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & $this->_GetInt2d($cellAddressStructure, 2)); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & $this->_GetInt2d($cellAddressStructure, 2))) { + $column = '$' . $column; + } + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & $this->_GetInt2d($cellAddressStructure, 2))) { + $row = '$' . $row; + } + + return $column . $row; + } + + /** + * Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column + * to indicate offsets from a base cell + * section 3.3.4 + * + * @param string $cellAddressStructure + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * @return string + */ + private function _readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') + { + list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell); + $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1; + + // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) + $rowIndex = $this->_GetInt2d($cellAddressStructure, 0); + $row = $this->_GetInt2d($cellAddressStructure, 0) + 1; + + // offset: 2; size: 2; index to column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $colIndex = 0x00FF & $this->_GetInt2d($cellAddressStructure, 2); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & $this->_GetInt2d($cellAddressStructure, 2))) { + $column = PHPExcel_Cell::stringFromColumnIndex($colIndex); + $column = '$' . $column; + } else { + $colIndex = ($colIndex <= 127) ? $colIndex : $colIndex - 256; + $column = PHPExcel_Cell::stringFromColumnIndex($baseCol + $colIndex); + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & $this->_GetInt2d($cellAddressStructure, 2))) { + $row = '$' . $row; + } else { + $rowIndex = ($rowIndex <= 32767) ? $rowIndex : $rowIndex - 65536; + $row = $baseRow + $rowIndex; + } + + return $column . $row; + } + + /** + * Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1' + * always fixed range + * section 2.5.14 + * + * @param string $subData + * @return string + * @throws Exception + */ + private function _readBIFF5CellRangeAddressFixed($subData) + { + // offset: 0; size: 2; index to first row + $fr = $this->_GetInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row + $lr = $this->_GetInt2d($subData, 2) + 1; + + // offset: 4; size: 1; index to first column + $fc = ord($subData{4}); + + // offset: 5; size: 1; index to last column + $lc = ord($subData{5}); + + // check values + if ($fr > $lr || $fc > $lc) { + throw new Exception('Not a cell range address'); + } + + // column index to letter + $fc = PHPExcel_Cell::stringFromColumnIndex($fc); + $lc = PHPExcel_Cell::stringFromColumnIndex($lc); + + if ($fr == $lr and $fc == $lc) { + return "$fc$fr"; + } + return "$fc$fr:$lc$lr"; + } + + /** + * Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1' + * always fixed range + * section 2.5.14 + * + * @param string $subData + * @return string + * @throws Exception + */ + private function _readBIFF8CellRangeAddressFixed($subData) + { + // offset: 0; size: 2; index to first row + $fr = $this->_GetInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row + $lr = $this->_GetInt2d($subData, 2) + 1; + + // offset: 4; size: 2; index to first column + $fc = $this->_GetInt2d($subData, 4); + + // offset: 6; size: 2; index to last column + $lc = $this->_GetInt2d($subData, 6); + + // check values + if ($fr > $lr || $fc > $lc) { + throw new Exception('Not a cell range address'); + } + + // column index to letter + $fc = PHPExcel_Cell::stringFromColumnIndex($fc); + $lc = PHPExcel_Cell::stringFromColumnIndex($lc); + + if ($fr == $lr and $fc == $lc) { + return "$fc$fr"; + } + return "$fc$fr:$lc$lr"; + } + + /** + * Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6' + * there are flags indicating whether column/row index is relative + * section 3.3.4 + * + * @param string $subData + * @return string + */ + private function _readBIFF8CellRangeAddress($subData) + { + // todo: if cell range is just a single cell, should this funciton + // not just return e.g. 'A1' and not 'A1:A1' ? + + // offset: 0; size: 2; index to first row (0... 65535) (or offset (-32768... 32767)) + $fr = $this->_GetInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row (0... 65535) (or offset (-32768... 32767)) + $lr = $this->_GetInt2d($subData, 2) + 1; + + // offset: 4; size: 2; index to first column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & $this->_GetInt2d($subData, 4)); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & $this->_GetInt2d($subData, 4))) { + $fc = '$' . $fc; + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & $this->_GetInt2d($subData, 4))) { + $fr = '$' . $fr; + } + + // offset: 6; size: 2; index to last column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & $this->_GetInt2d($subData, 6)); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & $this->_GetInt2d($subData, 6))) { + $lc = '$' . $lc; + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & $this->_GetInt2d($subData, 6))) { + $lr = '$' . $lr; + } + + return "$fc$fr:$lc$lr"; + } + + /** + * Read BIFF8 cell range address list + * section 2.5.15 + * + * @param string $subData + * @return array + */ + private function _readBIFF8CellRangeAddressList($subData) + { + $cellRangeAddresses = array(); + + // offset: 0; size: 2; number of the following cell range addresses + $nm = $this->_GetInt2d($subData, 0); + + $offset = 2; + // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses + for ($i = 0; $i < $nm; ++$i) { + $cellRangeAddresses[] = $this->_readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8)); + $offset += 8; + } + + return array( + 'size' => 2 + 8 * $nm, + 'cellRangeAddresses' => $cellRangeAddresses, + ); + } + + /** + * Get a sheet range like Sheet1:Sheet3 from REF index + * Note: If there is only one sheet in the range, one gets e.g Sheet1 + * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets, + * in which case an exception is thrown + * + * @param int $index + * @return string|false + * @throws Exception + */ + private function _readSheetRangeByRefIndex($index) + { + if (isset($this->_ref[$index])) { + + $type = $this->_externalBooks[$this->_ref[$index]['externalBookIndex']]['type']; + + switch ($type) { + case 'internal': + // check if we have a deleted 3d reference + if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) { + throw new Exception('Deleted sheet reference'); + } + + // we have normal sheet range (collapsed or uncollapsed) + $firstSheetName = $this->_sheets[$this->_ref[$index]['firstSheetIndex']]['name']; + $lastSheetName = $this->_sheets[$this->_ref[$index]['lastSheetIndex']]['name']; + + if ($firstSheetName == $lastSheetName) { + // collapsed sheet range + $sheetRange = $firstSheetName; + } else { + $sheetRange = "$firstSheetName:$lastSheetName"; + } + + // escape the single-quotes + $sheetRange = str_replace("'", "''", $sheetRange); + + // if there are special characters, we need to enclose the range in single-quotes + // todo: check if we have identified the whole set of special characters + // it seems that the following characters are not accepted for sheet names + // and we may assume that they are not present: []*/:\? + if (preg_match("/[ !\"@#£$%&{()}<>=+'|^,;-]/", $sheetRange)) { + $sheetRange = "'$sheetRange'"; + } + + return $sheetRange; + break; + + default: + // TODO: external sheet support + throw new Exception('Excel5 reader only supports internal sheets in fomulas'); + break; + } + } + return false; + } + + /** + * read BIFF8 constant value array from array data + * returns e.g. array('value' => '{1,2;3,4}', 'size' => 40} + * section 2.5.8 + * + * @param string $arrayData + * @return array + */ + private function _readBIFF8ConstantArray($arrayData) + { + // offset: 0; size: 1; number of columns decreased by 1 + $nc = ord($arrayData[0]); + + // offset: 1; size: 2; number of rows decreased by 1 + $nr = $this->_GetInt2d($arrayData, 1); + $size = 3; // initialize + $arrayData = substr($arrayData, 3); + + // offset: 3; size: var; list of ($nc + 1) * ($nr + 1) constant values + $matrixChunks = array(); + for ($r = 1; $r <= $nr + 1; ++$r) { + $items = array(); + for ($c = 1; $c <= $nc + 1; ++$c) { + $constant = $this->_readBIFF8Constant($arrayData); + $items[] = $constant['value']; + $arrayData = substr($arrayData, $constant['size']); + $size += $constant['size']; + } + $matrixChunks[] = implode(',', $items); // looks like e.g. '1,"hello"' + } + $matrix = '{' . implode(';', $matrixChunks) . '}'; + + return array( + 'value' => $matrix, + 'size' => $size, + ); + } + + /** + * read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value' + * section 2.5.7 + * returns e.g. array('value' => '5', 'size' => 9) + * + * @param string $valueData + * @return array + */ + private function _readBIFF8Constant($valueData) + { + // offset: 0; size: 1; identifier for type of constant + $identifier = ord($valueData[0]); + + switch ($identifier) { + case 0x00: // empty constant (what is this?) + $value = ''; + $size = 9; + break; + case 0x01: // number + // offset: 1; size: 8; IEEE 754 floating-point value + $value = $this->_extractNumber(substr($valueData, 1, 8)); + $size = 9; + break; + case 0x02: // string value + // offset: 1; size: var; Unicode string, 16-bit string length + $string = $this->_readUnicodeStringLong(substr($valueData, 1)); + $value = '"' . $string['value'] . '"'; + $size = 1 + $string['size']; + break; + case 0x04: // boolean + // offset: 1; size: 1; 0 = FALSE, 1 = TRUE + if (ord($valueData[1])) { + $value = 'TRUE'; + } else { + $value = 'FALSE'; + } + $size = 9; + break; + case 0x10: // error code + // offset: 1; size: 1; error code + $value = $this->_mapErrorCode(ord($valueData[1])); + $size = 9; + break; + } + return array( + 'value' => $value, + 'size' => $size, + ); + } + + /** + * Extract RGB color + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4 + * + * @param string $rgb Encoded RGB value (4 bytes) + * @return array + */ + private function _readRGB($rgb) + { + // offset: 0; size 1; Red component + $r = ord($rgb{0}); + + // offset: 1; size: 1; Green component + $g = ord($rgb{1}); + + // offset: 2; size: 1; Blue component + $b = ord($rgb{2}); + + // HEX notation, e.g. 'FF00FC' + $rgb = sprintf('%02X', $r) . sprintf('%02X', $g) . sprintf('%02X', $b); + + return array('rgb' => $rgb); + } + + /** + * Read byte string (8-bit string length) + * OpenOffice documentation: 2.5.2 + * + * @param string $subData + * @return array + */ + private function _readByteStringShort($subData) + { + // offset: 0; size: 1; length of the string (character count) + $ln = ord($subData[0]); + + // offset: 1: size: var; character array (8-bit characters) + $value = $this->_decodeCodepage(substr($subData, 1, $ln)); + + return array( + 'value' => $value, + 'size' => 1 + $ln, // size in bytes of data structure + ); + } + + /** + * Read byte string (16-bit string length) + * OpenOffice documentation: 2.5.2 + * + * @param string $subData + * @return array + */ + private function _readByteStringLong($subData) + { + // offset: 0; size: 2; length of the string (character count) + $ln = $this->_GetInt2d($subData, 0); + + // offset: 2: size: var; character array (8-bit characters) + $value = $this->_decodeCodepage(substr($subData, 2)); + + //return $string; + return array( + 'value' => $value, + 'size' => 2 + $ln, // size in bytes of data structure + ); + } + + /** + * Extracts an Excel Unicode short string (8-bit string length) + * OpenOffice documentation: 2.5.3 + * function will automatically find out where the Unicode string ends. + * + * @param string $subData + * @return array + */ + private function _readUnicodeStringShort($subData) + { + $value = ''; + + // offset: 0: size: 1; length of the string (character count) + $characterCount = ord($subData[0]); + + $string = $this->_readUnicodeString(substr($subData, 1), $characterCount); + + // add 1 for the string length + $string['size'] += 1; + + return $string; + } + + /** + * Extracts an Excel Unicode long string (16-bit string length) + * OpenOffice documentation: 2.5.3 + * this function is under construction, needs to support rich text, and Asian phonetic settings + * + * @param string $subData + * @return array + */ + private function _readUnicodeStringLong($subData) + { + $value = ''; + + // offset: 0: size: 2; length of the string (character count) + $characterCount = $this->_GetInt2d($subData, 0); + + $string = $this->_readUnicodeString(substr($subData, 2), $characterCount); + + // add 2 for the string length + $string['size'] += 2; + + return $string; + } + + /** + * Read Unicode string with no string length field, but with known character count + * this function is under construction, needs to support rich text, and Asian phonetic settings + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3 + * + * @param string $subData + * @param int $characterCount + * @return array + */ + private function _readUnicodeString($subData, $characterCount) + { + $value = ''; + + // offset: 0: size: 1; option flags + + // bit: 0; mask: 0x01; character compression (0 = compressed 8-bit, 1 = uncompressed 16-bit) + $isCompressed = !((0x01 & ord($subData[0])) >> 0); + + // bit: 2; mask: 0x04; Asian phonetic settings + $hasAsian = (0x04) & ord($subData[0]) >> 2; + + // bit: 3; mask: 0x08; Rich-Text settings + $hasRichText = (0x08) & ord($subData[0]) >> 3; + + // offset: 1: size: var; character array + // this offset assumes richtext and Asian phonetic settings are off which is generally wrong + // needs to be fixed + $value = $this->_encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed); + + return array( + 'value' => $value, + 'size' => $isCompressed ? 1 + $characterCount : 1 + 2 * $characterCount, // the size in bytes including the option flags + ); + } + + /** + * Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas. + * Example: hello"world --> "hello""world" + * + * @param string $value UTF-8 encoded string + * @return string + */ + private function _UTF8toExcelDoubleQuoted($value) + { + return '"' . str_replace('"', '""', $value) . '"'; + } + + /** + * Reads first 8 bytes of a string and return IEEE 754 float + * + * @param string $data Binary string that is at least 8 bytes long + * @return float + */ + private function _extractNumber($data) + { + $rknumhigh = $this->_GetInt4d($data, 4); + $rknumlow = $this->_GetInt4d($data, 0); + $sign = ($rknumhigh & 0x80000000) >> 31; + $exp = ($rknumhigh & 0x7ff00000) >> 20; + $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); + $mantissalow1 = ($rknumlow & 0x80000000) >> 31; + $mantissalow2 = ($rknumlow & 0x7fffffff); + $value = $mantissa / pow( 2 , (20 - ($exp - 1023))); + + if ($mantissalow1 != 0) { + $value += 1 / pow (2 , (21 - ($exp - 1023))); + } + + $value += $mantissalow2 / pow (2 , (52 - ($exp - 1023))); + if ($sign) { + $value = -1 * $value; + } + + return $value; + } + + private function _GetIEEE754($rknum) + { + if (($rknum & 0x02) != 0) { + $value = $rknum >> 2; + } + else { + // changes by mmp, info on IEEE754 encoding from + // research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html + // The RK format calls for using only the most significant 30 bits + // of the 64 bit floating point value. The other 34 bits are assumed + // to be 0 so we use the upper 30 bits of $rknum as follows... + $sign = ($rknum & 0x80000000) >> 31; + $exp = ($rknum & 0x7ff00000) >> 20; + $mantissa = (0x100000 | ($rknum & 0x000ffffc)); + $value = $mantissa / pow( 2 , (20- ($exp - 1023))); + if ($sign) { + $value = -1 * $value; + } + //end of changes by mmp + } + if (($rknum & 0x01) != 0) { + $value /= 100; + } + return $value; + } + + /** + * Get UTF-8 string from (compressed or uncompressed) UTF-16 string + * + * @param string $string + * @param bool $compressed + * @return string + */ + private function _encodeUTF16($string, $compressed = '') + { + if ($compressed) { + $string = $this->_uncompressByteString($string); + } + + $result = PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); + + return $result; + } + + /** + * Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8. + * + * @param string $string + * @return string + */ + private function _uncompressByteString($string) + { + $uncompressedString = ''; + for ($i = 0; $i < strlen($string); ++$i) { + $uncompressedString .= $string[$i] . "\0"; + } + + return $uncompressedString; + } + + /** + * Convert string to UTF-8. Only used for BIFF5. + * + * @param string $string + * @return string + */ + private function _decodeCodepage($string) + { + $result = PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage); + return $result; + } + + /** + * Read 16-bit unsigned integer + * + * @param string $data + * @param int $pos + * @return int + */ + private function _GetInt2d($data, $pos) + { + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); + } + + /** + * Read 32-bit signed integer + * + * @param string $data + * @param int $pos + * @return int + */ + private function _GetInt4d($data, $pos) + { + //return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | + // (ord($data[$pos + 2]) << 16) | (ord($data[$pos + 3]) << 24); + + // FIX: represent numbers correctly on 64-bit system + // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 + $_or_24 = ord($data[$pos + 3]); + if ($_or_24 >= 128) { + // negative number + $_ord_24 = -abs((256 - $_or_24) << 24); + } else { + $_ord_24 = ($_or_24 & 127) << 24; + } + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; + } + + /** + * Read color + * + * @param int $color Indexed color + * @return array RGB color value, example: array('rgb' => 'FF0000') + */ + private function _readColor($color) + { + if ($color <= 0x07 || $color >= 0x40) { + // special built-in color + $color = $this->_mapBuiltInColor($color); + } else if (isset($this->_palette) && isset($this->_palette[$color - 8])) { + // palette color, color index 0x08 maps to pallete index 0 + $color = $this->_palette[$color - 8]; + } else { + // default color table + if ($this->_version == self::XLS_BIFF8) { + $color = $this->_mapColor($color); + } else { + // BIFF5 + $color = $this->_mapColorBIFF5($color); + } + } + + return $color; + } + + + /** + * Map border style + * OpenOffice documentation: 2.5.11 + * + * @param int $index + * @return string + */ + private function _mapBorderStyle($index) + { + switch ($index) { + case 0x00: return PHPExcel_Style_Border::BORDER_NONE; + case 0x01: return PHPExcel_Style_Border::BORDER_THIN; + case 0x02: return PHPExcel_Style_Border::BORDER_MEDIUM; + case 0x03: return PHPExcel_Style_Border::BORDER_DASHED; + case 0x04: return PHPExcel_Style_Border::BORDER_DOTTED; + case 0x05: return PHPExcel_Style_Border::BORDER_THICK; + case 0x06: return PHPExcel_Style_Border::BORDER_DOUBLE; + case 0x07: return PHPExcel_Style_Border::BORDER_HAIR; + case 0x08: return PHPExcel_Style_Border::BORDER_MEDIUMDASHED; + case 0x09: return PHPExcel_Style_Border::BORDER_DASHDOT; + case 0x0A: return PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT; + case 0x0B: return PHPExcel_Style_Border::BORDER_DASHDOTDOT; + case 0x0C: return PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; + case 0x0D: return PHPExcel_Style_Border::BORDER_SLANTDASHDOT; + default: return PHPExcel_Style_Border::BORDER_NONE; + } + } + + /** + * Get fill pattern from index + * OpenOffice documentation: 2.5.12 + * + * @param int $index + * @return string + */ + private function _mapFillPattern($index) + { + switch ($index) { + case 0x00: return PHPExcel_Style_Fill::FILL_NONE; + case 0x01: return PHPExcel_Style_Fill::FILL_SOLID; + case 0x02: return PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY; + case 0x03: return PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY; + case 0x04: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY; + case 0x05: return PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL; + case 0x06: return PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL; + case 0x07: return PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN; + case 0x08: return PHPExcel_Style_Fill::FILL_PATTERN_DARKUP; + case 0x09: return PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID; + case 0x0A: return PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS; + case 0x0B: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; + case 0x0C: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL; + case 0x0D: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN; + case 0x0E: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP; + case 0x0F: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID; + case 0x10: return PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS; + case 0x11: return PHPExcel_Style_Fill::FILL_PATTERN_GRAY125; + case 0x12: return PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625; + default: return PHPExcel_Style_Fill::FILL_NONE; + } + } + + /** + * Map error code, e.g. '#N/A' + * + * @param int $subData + * @return string + */ + private function _mapErrorCode($subData) + { + switch ($subData) { + case 0x00: return '#NULL!'; break; + case 0x07: return '#DIV/0!'; break; + case 0x0F: return '#VALUE!'; break; + case 0x17: return '#REF!'; break; + case 0x1D: return '#NAME?'; break; + case 0x24: return '#NUM!'; break; + case 0x2A: return '#N/A'; break; + default: return false; + } + } + + /** + * Map built-in color to RGB value + * + * @param int $color Indexed color + * @return array + */ + private function _mapBuiltInColor($color) + { + switch ($color) { + case 0x00: return array('rgb' => '000000'); + case 0x01: return array('rgb' => 'FFFFFF'); + case 0x02: return array('rgb' => 'FF0000'); + case 0x03: return array('rgb' => '00FF00'); + case 0x04: return array('rgb' => '0000FF'); + case 0x05: return array('rgb' => 'FFFF00'); + case 0x06: return array('rgb' => 'FF00FF'); + case 0x07: return array('rgb' => '00FFFF'); + case 0x40: return array('rgb' => '000000'); // system window text color + case 0x41: return array('rgb' => 'FFFFFF'); // system window background color + default: return array('rgb' => '000000'); + } + } + + /** + * Map color array from BIFF5 built-in color index + * + * @param int $subData + * @return array + */ + private function _mapColorBIFF5($subData) + { + switch ($subData) { + case 0x08: return array('rgb' => '000000'); + case 0x09: return array('rgb' => 'FFFFFF'); + case 0x0A: return array('rgb' => 'FF0000'); + case 0x0B: return array('rgb' => '00FF00'); + case 0x0C: return array('rgb' => '0000FF'); + case 0x0D: return array('rgb' => 'FFFF00'); + case 0x0E: return array('rgb' => 'FF00FF'); + case 0x0F: return array('rgb' => '00FFFF'); + case 0x10: return array('rgb' => '800000'); + case 0x11: return array('rgb' => '008000'); + case 0x12: return array('rgb' => '000080'); + case 0x13: return array('rgb' => '808000'); + case 0x14: return array('rgb' => '800080'); + case 0x15: return array('rgb' => '008080'); + case 0x16: return array('rgb' => 'C0C0C0'); + case 0x17: return array('rgb' => '808080'); + case 0x18: return array('rgb' => '8080FF'); + case 0x19: return array('rgb' => '802060'); + case 0x1A: return array('rgb' => 'FFFFC0'); + case 0x1B: return array('rgb' => 'A0E0F0'); + case 0x1C: return array('rgb' => '600080'); + case 0x1D: return array('rgb' => 'FF8080'); + case 0x1E: return array('rgb' => '0080C0'); + case 0x1F: return array('rgb' => 'C0C0FF'); + case 0x20: return array('rgb' => '000080'); + case 0x21: return array('rgb' => 'FF00FF'); + case 0x22: return array('rgb' => 'FFFF00'); + case 0x23: return array('rgb' => '00FFFF'); + case 0x24: return array('rgb' => '800080'); + case 0x25: return array('rgb' => '800000'); + case 0x26: return array('rgb' => '008080'); + case 0x27: return array('rgb' => '0000FF'); + case 0x28: return array('rgb' => '00CFFF'); + case 0x29: return array('rgb' => '69FFFF'); + case 0x2A: return array('rgb' => 'E0FFE0'); + case 0x2B: return array('rgb' => 'FFFF80'); + case 0x2C: return array('rgb' => 'A6CAF0'); + case 0x2D: return array('rgb' => 'DD9CB3'); + case 0x2E: return array('rgb' => 'B38FEE'); + case 0x2F: return array('rgb' => 'E3E3E3'); + case 0x30: return array('rgb' => '2A6FF9'); + case 0x31: return array('rgb' => '3FB8CD'); + case 0x32: return array('rgb' => '488436'); + case 0x33: return array('rgb' => '958C41'); + case 0x34: return array('rgb' => '8E5E42'); + case 0x35: return array('rgb' => 'A0627A'); + case 0x36: return array('rgb' => '624FAC'); + case 0x37: return array('rgb' => '969696'); + case 0x38: return array('rgb' => '1D2FBE'); + case 0x39: return array('rgb' => '286676'); + case 0x3A: return array('rgb' => '004500'); + case 0x3B: return array('rgb' => '453E01'); + case 0x3C: return array('rgb' => '6A2813'); + case 0x3D: return array('rgb' => '85396A'); + case 0x3E: return array('rgb' => '4A3285'); + case 0x3F: return array('rgb' => '424242'); + default: return array('rgb' => '000000'); + } + } + + /** + * Map color array from BIFF8 built-in color index + * + * @param int $subData + * @return array + */ + private function _mapColor($subData) + { + switch ($subData) { + case 0x08: return array('rgb' => '000000'); + case 0x09: return array('rgb' => 'FFFFFF'); + case 0x0A: return array('rgb' => 'FF0000'); + case 0x0B: return array('rgb' => '00FF00'); + case 0x0C: return array('rgb' => '0000FF'); + case 0x0D: return array('rgb' => 'FFFF00'); + case 0x0E: return array('rgb' => 'FF00FF'); + case 0x0F: return array('rgb' => '00FFFF'); + case 0x10: return array('rgb' => '800000'); + case 0x11: return array('rgb' => '008000'); + case 0x12: return array('rgb' => '000080'); + case 0x13: return array('rgb' => '808000'); + case 0x14: return array('rgb' => '800080'); + case 0x15: return array('rgb' => '008080'); + case 0x16: return array('rgb' => 'C0C0C0'); + case 0x17: return array('rgb' => '808080'); + case 0x18: return array('rgb' => '9999FF'); + case 0x19: return array('rgb' => '993366'); + case 0x1A: return array('rgb' => 'FFFFCC'); + case 0x1B: return array('rgb' => 'CCFFFF'); + case 0x1C: return array('rgb' => '660066'); + case 0x1D: return array('rgb' => 'FF8080'); + case 0x1E: return array('rgb' => '0066CC'); + case 0x1F: return array('rgb' => 'CCCCFF'); + case 0x20: return array('rgb' => '000080'); + case 0x21: return array('rgb' => 'FF00FF'); + case 0x22: return array('rgb' => 'FFFF00'); + case 0x23: return array('rgb' => '00FFFF'); + case 0x24: return array('rgb' => '800080'); + case 0x25: return array('rgb' => '800000'); + case 0x26: return array('rgb' => '008080'); + case 0x27: return array('rgb' => '0000FF'); + case 0x28: return array('rgb' => '00CCFF'); + case 0x29: return array('rgb' => 'CCFFFF'); + case 0x2A: return array('rgb' => 'CCFFCC'); + case 0x2B: return array('rgb' => 'FFFF99'); + case 0x2C: return array('rgb' => '99CCFF'); + case 0x2D: return array('rgb' => 'FF99CC'); + case 0x2E: return array('rgb' => 'CC99FF'); + case 0x2F: return array('rgb' => 'FFCC99'); + case 0x30: return array('rgb' => '3366FF'); + case 0x31: return array('rgb' => '33CCCC'); + case 0x32: return array('rgb' => '99CC00'); + case 0x33: return array('rgb' => 'FFCC00'); + case 0x34: return array('rgb' => 'FF9900'); + case 0x35: return array('rgb' => 'FF6600'); + case 0x36: return array('rgb' => '666699'); + case 0x37: return array('rgb' => '969696'); + case 0x38: return array('rgb' => '003366'); + case 0x39: return array('rgb' => '339966'); + case 0x3A: return array('rgb' => '003300'); + case 0x3B: return array('rgb' => '333300'); + case 0x3C: return array('rgb' => '993300'); + case 0x3D: return array('rgb' => '993366'); + case 0x3E: return array('rgb' => '333399'); + case 0x3F: return array('rgb' => '333333'); + default: return array('rgb' => '000000'); + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/Excel5/Escher.php b/libraries/PHPExcel/PHPExcel/Reader/Excel5/Escher.php new file mode 100644 index 000000000..3cdc38449 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/Excel5/Escher.php @@ -0,0 +1,709 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Reader_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Shared_Escher_DggContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php'; + +/** PHPExcel_Shared_Escher_DgContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer.php'; + +/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php'; + +/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php'; + +/** + * PHPExcel_Reader_Excel5_Escher + * + * @category PHPExcel + * @package PHPExcel_Reader_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Reader_Excel5_Escher +{ + const DGGCONTAINER = 0xF000; + const BSTORECONTAINER = 0xF001; + const DGCONTAINER = 0xF002; + const SPGRCONTAINER = 0xF003; + const SPCONTAINER = 0xF004; + const DGG = 0xF006; + const BSE = 0xF007; + const DG = 0xF008; + const SPGR = 0xF009; + const SP = 0xF00A; + const OPT = 0xF00B; + const CLIENTTEXTBOX = 0xF00D; + const CLIENTANCHOR = 0xF010; + const CLIENTDATA = 0xF011; + const BLIPJPEG = 0xF01D; + const BLIPPNG = 0xF01E; + const SPLITMENUCOLORS = 0xF11E; + const TERTIARYOPT = 0xF122; + + /** + * Escher stream data (binary) + * + * @var string + */ + private $_data; + + /** + * Size in bytes of the Escher stream data + * + * @var int + */ + private $_dataSize; + + /** + * Current position of stream pointer in Escher stream data + * + * @var int + */ + private $_pos; + + /** + * The object to be returned by the reader. Modified during load. + * + * @var mixed + */ + private $_object; + + /** + * Create a new PHPExcel_Reader_Excel5_Escher instance + * + * @param mixed $object + */ + public function __construct($object) + { + $this->_object = $object; + } + + /** + * Load Escher stream data. May be a partial Escher stream. + * + * @param string $data + */ + public function load($data) + { + $this->_data = $data; + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->_dataSize = strlen($this->_data); + + $this->_pos = 0; + + // Parse Escher stream + while ($this->_pos < $this->_dataSize) { + + + // offset: 2; size: 2: Record Type + $fbt = $this->_GetInt2d($this->_data, $this->_pos + 2); + + switch ($fbt) { + case self::DGGCONTAINER: $this->_readDggContainer(); break; + case self::DGG: $this->_readDgg(); break; + case self::BSTORECONTAINER: $this->_readBstoreContainer(); break; + case self::BSE: $this->_readBSE(); break; + case self::BLIPJPEG: $this->_readBlipJPEG(); break; + case self::BLIPPNG: $this->_readBlipPNG(); break; + case self::OPT: $this->_readOPT(); break; + case self::TERTIARYOPT: $this->_readTertiaryOPT(); break; + case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break; + case self::DGCONTAINER: $this->_readDgContainer(); break; + case self::DG: $this->_readDg(); break; + case self::SPGRCONTAINER: $this->_readSpgrContainer(); break; + case self::SPCONTAINER: $this->_readSpContainer(); break; + case self::SPGR: $this->_readSpgr(); break; + case self::SP: $this->_readSp(); break; + case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break; + case self::CLIENTANCHOR: $this->_readClientAnchor(); break; + case self::CLIENTDATA: $this->_readClientData(); break; + default: $this->_readDefault(); break; + } + } + + return $this->_object; + } + + /** + * Read a generic record + */ + private function _readDefault() + { + // offset 0; size: 2; recVer and recInstance + $verInstance = $this->_GetInt2d($this->_data, $this->_pos); + + // offset: 2; size: 2: Record Type + $fbt = $this->_GetInt2d($this->_data, $this->_pos + 2); + + // bit: 0-3; mask: 0x000F; recVer + $recVer = (0x000F & $verInstance) >> 0; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read DggContainer record (Drawing Group Container) + */ + private function _readDggContainer() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // record is a container, read contents + $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); + $this->_object->setDggContainer($dggContainer); + $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); + $reader->load($recordData); + } + + /** + * Read Dgg record (Drawing Group) + */ + private function _readDgg() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read BstoreContainer record (Blip Store Container) + */ + private function _readBstoreContainer() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // record is a container, read contents + $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); + $this->_object->setBstoreContainer($bstoreContainer); + $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); + $reader->load($recordData); + } + + /** + * Read BSE record + */ + private function _readBSE() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // add BSE to BstoreContainer + $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $this->_object->addBSE($BSE); + + $BSE->setBLIPType($recInstance); + + // offset: 0; size: 1; btWin32 (MSOBLIPTYPE) + $btWin32 = ord($recordData[0]); + + // offset: 1; size: 1; btWin32 (MSOBLIPTYPE) + $btMacOS = ord($recordData[1]); + + // offset: 2; size: 16; MD4 digest + $rgbUid = substr($recordData, 2, 16); + + // offset: 18; size: 2; tag + $tag = $this->_GetInt2d($recordData, 18); + + // offset: 20; size: 4; size of BLIP in bytes + $size = $this->_GetInt4d($recordData, 20); + + // offset: 24; size: 4; number of references to this BLIP + $cRef = $this->_GetInt4d($recordData, 24); + + // offset: 28; size: 4; MSOFO file offset + $foDelay = $this->_GetInt4d($recordData, 28); + + // offset: 32; size: 1; unused1 + $unused1 = ord($recordData{32}); + + // offset: 33; size: 1; size of nameData in bytes (including null terminator) + $cbName = ord($recordData{33}); + + // offset: 34; size: 1; unused2 + $unused2 = ord($recordData{34}); + + // offset: 35; size: 1; unused3 + $unused3 = ord($recordData{35}); + + // offset: 36; size: $cbName; nameData + $nameData = substr($recordData, 36, $cbName); + + // offset: 36 + $cbName, size: var; the BLIP data + $blipData = substr($recordData, 36 + $cbName); + + // record is a container, read contents + $reader = new PHPExcel_Reader_Excel5_Escher($BSE); + $reader->load($blipData); + } + + /** + * Read BlipJPEG record. Holds raw JPEG image data + */ + private function _readBlipJPEG() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + $pos = 0; + + // offset: 0; size: 16; rgbUid1 (MD4 digest of) + $rgbUid1 = substr($recordData, 0, 16); + $pos += 16; + + // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 + if (in_array($recInstance, array(0x046B, 0x06E3))) { + $rgbUid2 = substr($recordData, 16, 16); + $pos += 16; + } + + // offset: var; size: 1; tag + $tag = ord($recordData{$pos}); + $pos += 1; + + // offset: var; size: var; the raw image data + $data = substr($recordData, $pos); + + $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip->setData($data); + + $this->_object->setBlip($blip); + } + + /** + * Read BlipPNG record. Holds raw PNG image data + */ + private function _readBlipPNG() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + $pos = 0; + + // offset: 0; size: 16; rgbUid1 (MD4 digest of) + $rgbUid1 = substr($recordData, 0, 16); + $pos += 16; + + // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 + if ($recInstance == 0x06E1) { + $rgbUid2 = substr($recordData, 16, 16); + $pos += 16; + } + + // offset: var; size: 1; tag + $tag = ord($recordData{$pos}); + $pos += 1; + + // offset: var; size: var; the raw image data + $data = substr($recordData, $pos); + + $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip->setData($data); + + $this->_object->setBlip($blip); + } + + /** + * Read OPT record. This record may occur within DggContainer record or SpContainer + */ + private function _readOPT() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + $this->_readOfficeArtRGFOPTE($recordData, $recInstance); + } + + /** + * Read TertiaryOPT record + */ + private function _readTertiaryOPT() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read SplitMenuColors record + */ + private function _readSplitMenuColors() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read DgContainer record (Drawing Container) + */ + private function _readDgContainer() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // record is a container, read contents + $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); + $this->_object->setDgContainer($dgContainer); + $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); + $escher = $reader->load($recordData); + } + + /** + * Read Dg record (Drawing) + */ + private function _readDg() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read SpgrContainer record (Shape Group Container) + */ + private function _readSpgrContainer() + { + // context is either context DgContainer or SpgrContainer + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // record is a container, read contents + $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); + + if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) { + // DgContainer + $this->_object->setSpgrContainer($spgrContainer); + } else { + // SpgrContainer + $this->_object->addChild($spgrContainer); + } + + $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); + $escher = $reader->load($recordData); + } + + /** + * Read SpContainer record (Shape Container) + */ + private function _readSpContainer() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // add spContainer to spgrContainer + $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $this->_object->addChild($spContainer); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // record is a container, read contents + $reader = new PHPExcel_Reader_Excel5_Escher($spContainer); + $escher = $reader->load($recordData); + } + + /** + * Read Spgr record (Shape Group) + */ + private function _readSpgr() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read Sp record (Shape) + */ + private function _readSp() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read ClientTextbox record + */ + private function _readClientTextbox() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4; + + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet + */ + private function _readClientAnchor() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + + // offset: 2; size: 2; upper-left corner column index (0-based) + $c1 = $this->_GetInt2d($recordData, 2); + + // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width + $startOffsetX = $this->_GetInt2d($recordData, 4); + + // offset: 6; size: 2; upper-left corner row index (0-based) + $r1 = $this->_GetInt2d($recordData, 6); + + // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height + $startOffsetY = $this->_GetInt2d($recordData, 8); + + // offset: 10; size: 2; bottom-right corner column index (0-based) + $c2 = $this->_GetInt2d($recordData, 10); + + // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width + $endOffsetX = $this->_GetInt2d($recordData, 12); + + // offset: 14; size: 2; bottom-right corner row index (0-based) + $r2 = $this->_GetInt2d($recordData, 14); + + // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height + $endOffsetY = $this->_GetInt2d($recordData, 16); + + // set the start coordinates + $this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); + + // set the start offsetX + $this->_object->setStartOffsetX($startOffsetX); + + // set the start offsetY + $this->_object->setStartOffsetY($startOffsetY); + + // set the end coordinates + $this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); + + // set the end offsetX + $this->_object->setEndOffsetX($endOffsetX); + + // set the end offsetY + $this->_object->setEndOffsetY($endOffsetY); + } + + /** + * Read ClientData record + */ + private function _readClientData() + { + $length = $this->_GetInt4d($this->_data, $this->_pos + 4); + $recordData = substr($this->_data, $this->_pos + 8, $length); + + // move stream pointer to next record + $this->_pos += 8 + $length; + } + + /** + * Read OfficeArtRGFOPTE table of property-value pairs + * + * @param string $data Binary data + * @param int $n Number of properties + */ + private function _readOfficeArtRGFOPTE($data, $n) { + + $splicedComplexData = substr($data, 6 * $n); + + // loop through property-value pairs + for ($i = 0; $i < $n; ++$i) { + // read 6 bytes at a time + $fopte = substr($data, 6 * $i, 6); + + // offset: 0; size: 2; opid + $opid = $this->_GetInt2d($fopte, 0); + + // bit: 0-13; mask: 0x3FFF; opid.opid + $opidOpid = (0x3FFF & $opid) >> 0; + + // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier + $opidFBid = (0x4000 & $opid) >> 14; + + // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data + $opidFComplex = (0x8000 & $opid) >> 15; + + // offset: 2; size: 4; the value for this property + $op = $this->_GetInt4d($fopte, 2); + + if ($opidFComplex) { + $complexData = substr($splicedComplexData, 0, $op); + $splicedComplexData = substr($splicedComplexData, $op); + + // we store string value with complex data + $value = $complexData; + } else { + // we store integer value + $value = $op; + } + + $this->_object->setOPT($opidOpid, $value); + } + } + + /** + * Read 16-bit unsigned integer + * + * @param string $data + * @param int $pos + * @return int + */ + private function _GetInt2d($data, $pos) + { + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); + } + + /** + * Read 32-bit signed integer + * + * @param string $data + * @param int $pos + * @return int + */ + private function _GetInt4d($data, $pos) + { + //return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | + // (ord($data[$pos + 2]) << 16) | (ord($data[$pos + 3]) << 24); + + // FIX: represent numbers correctly on 64-bit system + // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 + $_or_24 = ord($data[$pos + 3]); + if ($_or_24 >= 128) { + // negative number + $_ord_24 = -abs((256 - $_or_24) << 24); + } else { + $_ord_24 = ($_or_24 & 127) << 24; + } + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/IReadFilter.php b/libraries/PHPExcel/PHPExcel/Reader/IReadFilter.php new file mode 100644 index 000000000..a173b3f0f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/IReadFilter.php @@ -0,0 +1,47 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Reader_IReadFilter + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +interface PHPExcel_Reader_IReadFilter +{ + /** + * Should this cell be read? + * + * @param $column String column index + * @param $row Row index + * @param $worksheetName Optional worksheet name + * @return boolean + */ + public function readCell($column, $row, $worksheetName = ''); +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/IReader.php b/libraries/PHPExcel/PHPExcel/Reader/IReader.php new file mode 100644 index 000000000..df758e0d1 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/IReader.php @@ -0,0 +1,53 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Reader_IReader + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +interface PHPExcel_Reader_IReader +{ + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFileName + * @return boolean + */ + public function canRead($pFilename); + + /** + * Loads PHPExcel from file + * + * @param string $pFileName + * @throws Exception + */ + public function load($pFilename); +} diff --git a/libraries/PHPExcel/PHPExcel/Reader/Serialized.php b/libraries/PHPExcel/PHPExcel/Reader/Serialized.php new file mode 100644 index 000000000..b95204ce8 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Reader/Serialized.php @@ -0,0 +1,133 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Reader_IReader */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php'; + +/** PHPExcel_Shared_File */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/File.php'; + + +/** + * PHPExcel_Reader_Serialized + * + * @category PHPExcel + * @package PHPExcel_Reader + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Reader_Serialized implements PHPExcel_Reader_IReader +{ + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFileName + * @return boolean + */ + public function canRead($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + return $this->fileSupportsUnserializePHPExcel($pFilename); + } + + /** + * Loads PHPExcel Serialized file + * + * @param string $pFilename + * @return PHPExcel + * @throws Exception + */ + public function load($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Unserialize... First make sure the file supports it! + if (!$this->fileSupportsUnserializePHPExcel($pFilename)) { + throw new Exception("Invalid file format for PHPExcel_Reader_Serialized: " . $pFilename . "."); + } + + return $this->_loadSerialized($pFilename); + } + + /** + * Load PHPExcel Serialized file + * + * @param string $pFilename + * @return PHPExcel + */ + private function _loadSerialized($pFilename) { + $xmlData = simplexml_load_string(file_get_contents("zip://$pFilename#phpexcel.xml")); + $excel = unserialize(base64_decode((string)$xmlData->data)); + + // Update media links + for ($i = 0; $i < $excel->getSheetCount(); ++$i) { + for ($j = 0; $j < $excel->getSheet($i)->getDrawingCollection()->count(); ++$j) { + if ($excel->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcl_Worksheet_BaseDrawing) { + $imgTemp =& $excel->getSheet($i)->getDrawingCollection()->offsetGet($j); + $imgTemp->setPath('zip://' . $pFilename . '#media/' . $imgTemp->getFilename(), false); + } + } + } + + return $excel; + } + + /** + * Does a file support UnserializePHPExcel ? + * + * @param string $pFilename + * @throws Exception + * @return boolean + */ + public function fileSupportsUnserializePHPExcel($pFilename = '') { + // Check if file exists + if (!file_exists($pFilename)) { + throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // File exists, does it contain phpexcel.xml? + return PHPExcel_Shared_File::file_exists("zip://$pFilename#phpexcel.xml"); + } +} diff --git a/libraries/PHPExcel/PHPExcel/ReferenceHelper.php b/libraries/PHPExcel/PHPExcel/ReferenceHelper.php new file mode 100644 index 000000000..886ce286c --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/ReferenceHelper.php @@ -0,0 +1,546 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); +} + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Cell_DataType */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell/DataType.php'; + +/** PHPExcel_Style */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php'; + +/** PHPExcel_Worksheet_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing.php'; + +/** PHPExcel_Calculation_FormulaParser */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/FormulaParser.php'; + +/** PHPExcel_Calculation_FormulaToken */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/FormulaToken.php'; + + +/** + * PHPExcel_ReferenceHelper (Singleton) + * + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_ReferenceHelper +{ + /** + * Instance of this class + * + * @var PHPExcel_ReferenceHelper + */ + private static $_instance; + + /** + * Get an instance of this class + * + * @return PHPExcel_ReferenceHelper + */ + public static function getInstance() { + if (!isset(self::$_instance) || is_null(self::$_instance)) { + self::$_instance = new PHPExcel_ReferenceHelper(); + } + + return self::$_instance; + } + + /** + * Create a new PHPExcel_Calculation + */ + protected function __construct() { + } + + /** + * Insert a new column, updating all possible related data + * + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to insert + * @param int $pNumRows Number of rows to insert + * @throws Exception + */ + public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null) { + // Get a copy of the cell collection + /*$aTemp = $pSheet->getCellCollection(); + $aCellCollection = array(); + foreach ($aTemp as $key => $value) { + $aCellCollection[$key] = clone $value; + }*/ + $aCellCollection = $pSheet->getCellCollection(); + + // Get coordinates of $pBefore + $beforeColumn = 'A'; + $beforeRow = 1; + list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); + + + // Clear cells if we are removing columns or rows + $highestColumn = $pSheet->getHighestColumn(); + $highestRow = $pSheet->getHighestRow(); + + // 1. Clear column strips if we are removing columns + if ($pNumCols < 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols > 0) { + for ($i = 1; $i <= $highestRow - 1; ++$i) { + for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1 + $pNumCols; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2; ++$j) { + $coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i; + $pSheet->removeConditionalStyles($coordinate); + if ($pSheet->cellExists($coordinate)) { + $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setXfIndex(0); + } + } + } + } + + // 2. Clear row strips if we are removing rows + if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { + for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { + $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j; + $pSheet->removeConditionalStyles($coordinate); + if ($pSheet->cellExists($coordinate)) { + $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setXfIndex(0); + } + } + } + } + + + // Loop through cells, bottom-up, and change cell coordinates + while ( ($cell = ($pNumCols < 0 || $pNumRows < 0) ? array_shift($aCellCollection) : array_pop($aCellCollection)) ) { + // New coordinates + $newCoordinates = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols ) . ($cell->getRow() + $pNumRows); + + // Should the cell be updated? Move value and cellXf index from one cell to another. + if ( + (PHPExcel_Cell::columnIndexFromString( $cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) && + ($cell->getRow() >= $beforeRow) + ) { + + // Update cell styles + $pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex()); + $cell->setXfIndex(0); + + // Insert this cell at its new location + if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { + // Formula should be adjusted + $pSheet->setCellValue( + $newCoordinates + , $this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows) + ); + } else { + // Formula should not be adjusted + $pSheet->setCellValue($newCoordinates, $cell->getValue()); + } + + // Clear the original cell + $pSheet->setCellValue($cell->getCoordinate(), ''); + } + } + + + // Duplicate styles for the newly inserted cells + $highestColumn = $pSheet->getHighestColumn(); + $highestRow = $pSheet->getHighestRow(); + + if ($pNumCols > 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 > 0) { + for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { + + // Style + $coordinate = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 ) . $i; + if ($pSheet->cellExists($coordinate)) { + $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); + $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? + $pSheet->getConditionalStyles($coordinate) : false; + for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols; ++$j) { + $pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex); + if ($conditionalStyles) { + $cloned = array(); + foreach ($conditionalStyles as $conditionalStyle) { + $cloned[] = clone $conditionalStyle; + } + $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j) . $i, $cloned); + } + } + } + + } + } + + if ($pNumRows > 0 && $beforeRow - 1 > 0) { + for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + + // Style + $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1); + if ($pSheet->cellExists($coordinate)) { + $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); + $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? + $pSheet->getConditionalStyles($coordinate) : false; + for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { + $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); + if ($conditionalStyles) { + $cloned = array(); + foreach ($conditionalStyles as $conditionalStyle) { + $cloned[] = clone $conditionalStyle; + } + $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $cloned); + } + } + } + } + } + + + // Update worksheet: column dimensions + $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); + if (count($aColumnDimensions) > 0) { + foreach ($aColumnDimensions as $objColumnDimension) { + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); + list($newReference) = PHPExcel_Cell::coordinateFromString($newReference); + if ($objColumnDimension->getColumnIndex() != $newReference) { + $objColumnDimension->setColumnIndex($newReference); + } + } + $pSheet->refreshColumnDimensions(); + } + + + // Update worksheet: row dimensions + $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); + if (count($aRowDimensions) > 0) { + foreach ($aRowDimensions as $objRowDimension) { + $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); + list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference); + if ($objRowDimension->getRowIndex() != $newReference) { + $objRowDimension->setRowIndex($newReference); + } + } + $pSheet->refreshRowDimensions(); + + $copyDimension = $pSheet->getRowDimension($beforeRow - 1); + for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) { + $newDimension = $pSheet->getRowDimension($i); + $newDimension->setRowHeight($copyDimension->getRowHeight()); + $newDimension->setVisible($copyDimension->getVisible()); + $newDimension->setOutlineLevel($copyDimension->getOutlineLevel()); + $newDimension->setCollapsed($copyDimension->getCollapsed()); + } + } + + + // Update worksheet: breaks + $aBreaks = array_reverse($pSheet->getBreaks(), true); + foreach ($aBreaks as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setBreak( $newReference, $value ); + $pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE ); + } + } + + + // Update worksheet: hyperlinks + $aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true); + foreach ($aHyperlinkCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setHyperlink( $newReference, $value ); + $pSheet->setHyperlink( $key, null ); + } + } + + + // Update worksheet: data validations + $aDataValidationCollection = array_reverse($pSheet->getDataValidationCollection(), true); + foreach ($aDataValidationCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setDataValidation( $newReference, $value ); + $pSheet->setDataValidation( $key, null ); + } + } + + + // Update worksheet: merge cells + $aMergeCells = array_reverse($pSheet->getMergeCells(), true); + foreach ($aMergeCells as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->mergeCells( $newReference ); + $pSheet->unmergeCells( $key ); + } + } + + + // Update worksheet: protected cells + $aProtectedCells = array_reverse($pSheet->getProtectedCells(), true); + foreach ($aProtectedCells as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->protectCells( $newReference, $value, true ); + $pSheet->unprotectCells( $key ); + } + } + + + // Update worksheet: autofilter + if ($pSheet->getAutoFilter() != '') { + $pSheet->setAutoFilter( $this->updateCellReference($pSheet->getAutoFilter(), $pBefore, $pNumCols, $pNumRows) ); + } + + + // Update worksheet: freeze pane + if ($pSheet->getFreezePane() != '') { + $pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) ); + } + + + // Page setup + if ($pSheet->getPageSetup()->isPrintAreaSet()) { + $pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) ); + } + + + // Update worksheet: drawings + $aDrawings = $pSheet->getDrawingCollection(); + foreach ($aDrawings as $objDrawing) { + $newReference = $this->updateCellReference($objDrawing->getCoordinates(), $pBefore, $pNumCols, $pNumRows); + if ($objDrawing->getCoordinates() != $newReference) { + $objDrawing->setCoordinates($newReference); + } + } + + + // Update workbook: named ranges + if (count($pSheet->getParent()->getNamedRanges()) > 0) { + foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) { + if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) { + $namedRange->setRange( + $this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows) + ); + } + } + } + + // Garbage collect + $pSheet->garbageCollect(); + } + + /** + * Update references within formulas + * + * @param string $pFormula Formula to update + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to insert + * @param int $pNumRows Number of rows to insert + * @return string Updated formula + * @throws Exception + */ + public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { + // Formula stack + $executableFormulaArray = array(); + + // Parse formula into a tree of tokens + $tokenisedFormula = PHPExcel_Calculation::getInstance()->parseFormula($pFormula); + $newCellTokens = $cellTokens = array(); + // Build the translation table of cell tokens + foreach($tokenisedFormula as $token) { + if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { + $newCellTokens[] = $this->updateCellReference($token, $pBefore, $pNumCols, $pNumRows); + $cellTokens[] = '/'.$token.'/'; + } + } + + // Update cell references in the formula + $formulaBlocks = explode('"',$pFormula); + $i = 0; + foreach($formulaBlocks as $formulaBlockKey => $formulaBlock) { + // Only count/replace in alternate array entries + if (($i++ % 2) == 0) { + $formulaBlocks[$formulaBlockKey] = preg_replace($cellTokens,$newCellTokens,$formulaBlock); + } + } + // Then rebuild the formula string + return implode('"',$formulaBlocks); + } + + /** + * Update cell reference + * + * @param string $pCellRange Cell range + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * @return string Updated cell range + * @throws Exception + */ + public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { + // Is it in another worksheet? Will not have to update anything. + if (strpos($pCellRange, "!") !== false) { + return $pCellRange; + // Is it a range or a single cell? + } elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) { + // Single cell + return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); + } else if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { + // Range + return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); + } else { + // Return original + return $pCellRange; + } + } + + /** + * Update named formulas (i.e. containing worksheet references / named ranges) + * + * @param PHPExcel $pPhpExcel Object to update + * @param string $oldName Old name (name to replace) + * @param string $newName New name + */ + public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') { + foreach ($pPhpExcel->getWorksheetIterator() as $sheet) { + foreach ($sheet->getCellCollection(false) as $cell) { + if (!is_null($cell) && $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { + $formula = $cell->getValue(); + if (strpos($formula, $oldName) !== false) { + $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); + $formula = str_replace($oldName . "!", $newName . "!", $formula); + $cell->setValueExplicit($formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + } + } + } + } + } + + /** + * Update cell range + * + * @param string $pCellRange Cell range + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * @return string Updated cell range + * @throws Exception + */ + private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { + if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) { + // Update range + $range = PHPExcel_Cell::splitRange($pCellRange); + for ($i = 0; $i < count($range); $i++) { + for ($j = 0; $j < count($range[$i]); $j++) { + $range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); + } + } + + // Recreate range string + return PHPExcel_Cell::buildRange($range); + } else { + throw new Exception("Only cell ranges may be passed to this method."); + } + } + + /** + * Update single cell reference + * + * @param string $pCellReference Single cell reference + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * @return string Updated cell reference + * @throws Exception + */ + private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { + if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { + // Get coordinates of $pBefore + $beforeColumn = 'A'; + $beforeRow = 1; + list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); + + // Get coordinates + $newColumn = 'A'; + $newRow = 1; + list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference ); + + // Make sure the reference can be used + if ($newColumn == '' && $newRow == '') + { + return $pCellReference; + } + + // Verify which parts should be updated + $updateColumn = (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) + && (strpos($newColumn, '$') === false) + && (strpos($beforeColumn, '$') === false); + + $updateRow = ($newRow >= $beforeRow) + && (strpos($newRow, '$') === false) + && (strpos($beforeRow, '$') === false); + + // Create new column reference + if ($updateColumn) { + $newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols ); + } + + // Create new row reference + if ($updateRow) { + $newRow = $newRow + $pNumRows; + } + + // Return new reference + return $newColumn . $newRow; + } else { + throw new Exception("Only single cell references may be passed to this method."); + } + } + + /** + * __clone implementation. Cloning should not be allowed in a Singleton! + * + * @throws Exception + */ + public final function __clone() { + throw new Exception("Cloning a Singleton is not allowed!"); + } +} diff --git a/libraries/PHPExcel/PHPExcel/RichText.php b/libraries/PHPExcel/PHPExcel/RichText.php new file mode 100644 index 000000000..ad78f112b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/RichText.php @@ -0,0 +1,306 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Cell_DataType */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell/DataType.php'; + +/** PHPExcel_RichText_ITextElement */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/ITextElement.php'; + +/** PHPExcel_RichText_TextElement */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/TextElement.php'; + +/** PHPExcel_RichText_Run */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/Run.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + +/** + * PHPExcel_RichText + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_RichText implements PHPExcel_IComparable +{ + /** + * Rich text elements + * + * @var PHPExcel_RichText_ITextElement[] + */ + private $_richTextElements; + + /** + * Parent cell + * + * @var PHPExcel_Cell + */ + private $_parent; + + /** + * Create a new PHPExcel_RichText instance + * + * @param PHPExcel_Cell $pParent + * @throws Exception + */ + public function __construct(PHPExcel_Cell $pCell = null) + { + // Initialise variables + $this->_richTextElements = array(); + + // Set parent? + if (!is_null($pCell)) { + // Set parent cell + $this->_parent = $pCell; + + // Add cell text and style + if ($this->_parent->getValue() != "") { + $objRun = new PHPExcel_RichText_Run($this->_parent->getValue()); + $objRun->setFont(clone $this->_parent->getParent()->getStyle($this->_parent->getCoordinate())->getFont()); + $this->addText($objRun); + } + + // Set parent value + $this->_parent->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); + } + } + + /** + * Add text + * + * @param PHPExcel_RichText_ITextElement $pText Rich text element + * @throws Exception + * @return PHPExcel_RichText + */ + public function addText(PHPExcel_RichText_ITextElement $pText = null) + { + $this->_richTextElements[] = $pText; + return $this; + } + + /** + * Create text + * + * @param string $pText Text + * @return PHPExcel_RichText_TextElement + * @throws Exception + */ + public function createText($pText = '') + { + $objText = new PHPExcel_RichText_TextElement($pText); + $this->addText($objText); + return $objText; + } + + /** + * Create text run + * + * @param string $pText Text + * @return PHPExcel_RichText_Run + * @throws Exception + */ + public function createTextRun($pText = '') + { + $objText = new PHPExcel_RichText_Run($pText); + $this->addText($objText); + return $objText; + } + + /** + * Get plain text + * + * @return string + */ + public function getPlainText() + { + // Return value + $returnValue = ''; + + // Loop trough all PHPExcel_RichText_ITextElement + foreach ($this->_richTextElements as $text) { + $returnValue .= $text->getText(); + } + + // Return + return $returnValue; + } + + /** + * Convert to string + * + * @return string + */ + public function __toString() { + return $this->getPlainText(); + } + + /** + * Get Rich Text elements + * + * @return PHPExcel_RichText_ITextElement[] + */ + public function getRichTextElements() + { + return $this->_richTextElements; + } + + /** + * Set Rich Text elements + * + * @param PHPExcel_RichText_ITextElement[] $pElements Array of elements + * @throws Exception + * @return PHPExcel_RichText + */ + public function setRichTextElements($pElements = null) + { + if (is_array($pElements)) { + $this->_richTextElements = $pElements; + } else { + throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed."); + } + return $this; + } + + /** + * Get parent + * + * @return PHPExcel_Cell + */ + public function getParent() { + return $this->_parent; + } + + /** + * Set parent + * + * @param PHPExcel_Cell $value + * @return PHPExcel_RichText + */ + public function setParent(PHPExcel_Cell $value) { + // Set parent + $this->_parent = $value; + + // Set parent value + $this->_parent->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); + + // Verify style information + + $sheet = $this->_parent->getParent(); + $cellFont = $sheet->getStyle($this->_parent->getCoordinate())->getFont()->getSharedComponent(); + foreach ($this->getRichTextElements() as $element) { + if (!($element instanceof PHPExcel_RichText_Run)) continue; + + if ($element->getFont()->getHashCode() == $sheet->getDefaultStyle()->getFont()->getHashCode()) { + if ($element->getFont()->getHashCode() != $cellFont->getHashCode()) { + $element->setFont(clone $cellFont); + } + } + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + $hashElements = ''; + foreach ($this->_richTextElements as $element) { + $hashElements .= $element->getHashCode(); + } + + return md5( + $hashElements + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ($key == '_parent') continue; + + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/RichText/ITextElement.php b/libraries/PHPExcel/PHPExcel/RichText/ITextElement.php new file mode 100644 index 000000000..32948f79e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/RichText/ITextElement.php @@ -0,0 +1,76 @@ +<?php +/** + * PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + + +/** + * PHPExcel_RichText_ITextElement + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +interface PHPExcel_RichText_ITextElement +{ + /** + * Get text + * + * @return string Text + */ + public function getText(); + + /** + * Set text + * + * @param $pText string Text + * @return PHPExcel_RichText_ITextElement + */ + public function setText($pText = ''); + + /** + * Get font + * + * @return PHPExcel_Style_Font + */ + public function getFont(); + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode(); +} diff --git a/libraries/PHPExcel/PHPExcel/RichText/Run.php b/libraries/PHPExcel/PHPExcel/RichText/Run.php new file mode 100644 index 000000000..e1297fcdd --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/RichText/Run.php @@ -0,0 +1,120 @@ +<?php +/** + * PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_RichText_ITextElement */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/ITextElement.php'; + +/** PHPExcel_RichText_TextElement */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/TextElement.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + + +/** + * PHPExcel_RichText_Run + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement +{ + /** + * Font + * + * @var PHPExcel_Style_Font + */ + private $_font; + + /** + * Create a new PHPExcel_RichText_Run instance + * + * @param string $pText Text + */ + public function __construct($pText = '') + { + // Initialise variables + $this->setText($pText); + $this->_font = new PHPExcel_Style_Font(); + } + + /** + * Get font + * + * @return PHPExcel_Style_Font + */ + public function getFont() { + return $this->_font; + } + + /** + * Set font + * + * @param PHPExcel_Style_Font $pFont Font + * @throws Exception + * @return PHPExcel_RichText_ITextElement + */ + public function setFont(PHPExcel_Style_Font $pFont = null) { + $this->_font = $pFont; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->getText() + . $this->_font->getHashCode() + . __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/RichText/TextElement.php b/libraries/PHPExcel/PHPExcel/RichText/TextElement.php new file mode 100644 index 000000000..11b7cf120 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/RichText/TextElement.php @@ -0,0 +1,123 @@ +<?php +/** + * PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_RichText_ITextElement */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText/ITextElement.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + + +/** + * PHPExcel_RichText_TextElement + * + * @category PHPExcel + * @package PHPExcel_RichText + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement +{ + /** + * Text + * + * @var string + */ + private $_text; + + /** + * Create a new PHPExcel_RichText_TextElement instance + * + * @param string $pText Text + */ + public function __construct($pText = '') + { + // Initialise variables + $this->_text = $pText; + } + + /** + * Get text + * + * @return string Text + */ + public function getText() { + return $this->_text; + } + + /** + * Set text + * + * @param $pText string Text + * @return PHPExcel_RichText_ITextElement + */ + public function setText($pText = '') { + $this->_text = $pText; + return $this; + } + + /** + * Get font + * + * @return PHPExcel_Style_Font + */ + public function getFont() { + return null; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_text + . __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Date.php b/libraries/PHPExcel/PHPExcel/Shared/Date.php new file mode 100644 index 000000000..f5e2ec8c2 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Date.php @@ -0,0 +1,277 @@ +<?php + +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Style_NumberFormat */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php'; + + +/** + * PHPExcel_Shared_Date + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Date +{ + /** constants */ + const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0 + const CALENDAR_MAC_1904 = 1904; // Base date of 2nd Jan 1904 = 1.0 + + private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900; + + public static $dateTimeObjectType = 'DateTime'; + + + /** + * Set the Excel calendar (Windows 1900 or Mac 1904) + * + * @param integer $baseDate Excel base date + * @return boolean Success or failure + */ + public static function setExcelCalendar($baseDate) { + if (($baseDate == self::CALENDAR_WINDOWS_1900) || + ($baseDate == self::CALENDAR_MAC_1904)) { + self::$ExcelBaseDate = $baseDate; + return True; + } + return False; + } // function setExcelCalendar() + + + /** + * Return the Excel calendar (Windows 1900 or Mac 1904) + * + * @return integer $baseDate Excel base date + */ + public static function getExcelCalendar() { + return self::$ExcelBaseDate; + } // function getExcelCalendar() + + + /** + * Convert a date from Excel to PHP + * + * @param long $dateValue Excel date/time value + * @return long PHP serialized date/time + */ + public static function ExcelToPHP($dateValue = 0) { + if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) { + $myExcelBaseDate = 25569; + // Adjust for the spurious 29-Feb-1900 (Day 60) + if ($dateValue < 60) { + --$myExcelBaseDate; + } + } else { + $myExcelBaseDate = 24107; + } + + // Perform conversion + if ($dateValue >= 1) { + $utcDays = $dateValue - $myExcelBaseDate; + $returnValue = (integer) round($utcDays * 24 * 60 * 60); + } else { + $hours = round($dateValue * 24); + $mins = round($dateValue * 24 * 60) - round($hours * 60); + $secs = round($dateValue * 24 * 60 * 60) - round($hours * 60 * 60) - round($mins * 60); + $returnValue = (integer) mktime($hours, $mins, $secs); + } + + // Return + return $returnValue; + } // function ExcelToPHP() + + + /** + * Convert a date from Excel to a PHP Date/Time object + * + * @param long $dateValue Excel date/time value + * @return long PHP date/time object + */ + public static function ExcelToPHPObject($dateValue = 0) { + $dateTime = self::ExcelToPHP($dateValue); + $days = floor($dateTime / 86400); + $time = round((($dateTime / 86400) - $days) * 86400); + $hours = round($time / 3600); + $minutes = round($time / 60) - ($hours * 60); + $seconds = round($time) - ($hours * 3600) - ($minutes * 60); + $dateObj = date_create('1-Jan-1970+'.$days.' days'); + $dateObj->setTime($hours,$minutes,$seconds); + return $dateObj; + } // function ExcelToPHPObject() + + + /** + * Convert a date from PHP to Excel + * + * @param mixed $dateValue PHP serialized date/time or date object + * @return mixed Excel date/time value + * or boolean False on failure + */ + public static function PHPToExcel($dateValue = 0) { + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $retValue = False; + if ((is_object($dateValue)) && ($dateValue instanceof self::$dateTimeObjectType)) { + $retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), + $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s') + ); + } elseif (is_numeric($dateValue)) { + $retValue = self::FormattedPHPToExcel( date('Y',$dateValue), date('m',$dateValue), date('d',$dateValue), + date('H',$dateValue), date('i',$dateValue), date('s',$dateValue) + ); + } + date_default_timezone_set($saveTimeZone); + + return $retValue; + } // function PHPToExcel() + + + /** + * FormattedPHPToExcel + * + * @param long $year + * @param long $month + * @param long $day + * @param long $hours + * @param long $minutes + * @param long $seconds + * @return long Excel date/time value + */ + public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) { + if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) { + // + // Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel + // This affects every date following 28th February 1900 + // + $excel1900isLeapYear = True; + if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = False; } + $myExcelBaseDate = 2415020; + } else { + $myExcelBaseDate = 2416481; + $excel1900isLeapYear = False; + } + + // Julian base date Adjustment + if ($month > 2) { + $month = $month - 3; + } else { + $month = $month + 9; + --$year; + } + + // Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0) + $century = substr($year,0,2); + $decade = substr($year,2,2); + $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myExcelBaseDate + $excel1900isLeapYear; + + $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400; + + return (float) $excelDate + $excelTime; + } // function FormattedPHPToExcel() + + + /** + * Is a given cell a date/time? + * + * @param PHPExcel_Cell $pCell + * @return boolean + */ + public static function isDateTime(PHPExcel_Cell $pCell) { + return self::isDateTimeFormat($pCell->getParent()->getStyle($pCell->getCoordinate())->getNumberFormat()); + } // function isDateTime() + + + /** + * Is a given number format a date/time? + * + * @param PHPExcel_Style_NumberFormat $pFormat + * @return boolean + */ + public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) { + return self::isDateTimeFormatCode($pFormat->getFormatCode()); + } // function isDateTimeFormat() + + + private static $possibleDateFormatCharacters = 'ymdHis'; + + /** + * Is a given number format code a date/time? + * + * @param string $pFormatCode + * @return boolean + */ + public static function isDateTimeFormatCode($pFormatCode = '') { + // Switch on formatcode + switch ($pFormatCode) { + case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17: + case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22: + return true; + } + + // Try checking for any of the date formatting characters that don't appear within square braces + if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) { + return true; + } + + // No date... + return false; + } // function isDateTimeFormatCode() +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Drawing.php b/libraries/PHPExcel/PHPExcel/Shared/Drawing.php new file mode 100644 index 000000000..b56bbfd76 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Drawing.php @@ -0,0 +1,137 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_Drawing + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Drawing +{ + /** + * Convert pixels to EMU + * + * @param int $pValue Value in pixels + * @return int Value in EMU + */ + public static function pixelsToEMU($pValue = 0) { + return round($pValue * 9525); + } + + /** + * Convert EMU to pixels + * + * @param int $pValue Value in EMU + * @return int Value in pixels + */ + public static function EMUToPixels($pValue = 0) { + if ($pValue != 0) { + return round($pValue / 9525); + } else { + return 0; + } + } + + /** + * Convert pixels to cell dimension. Exact algorithm not known. + * By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875 + * This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional. + * + * @param int $pValue Value in pixels + * @param int $pFontSize Default font size of workbook + * @return int Value in cell dimension + */ + public static function pixelsToCellDimension($pValue = 0, $pFontSize = 11) { + return $pValue * $pFontSize / 11 / 7; + } + + /** + * Convert cell width to pixels + * + * @param int $pValue Value in cell dimension + * @param int $pFontSize Default font size of workbook + * @return int Value in pixels + */ + public static function cellDimensionToPixels($pValue = 0, $pFontSize = 11) { + if ($pValue != 0) { + return $pValue * 7 * $pFontSize / 11; + } else { + return 0; + } + } + + /** + * Convert pixels to points + * + * @param int $pValue Value in pixels + * @return int Value in points + */ + public static function pixelsToPoints($pValue = 0) { + return $pValue * 0.67777777; + } + + /** + * Convert points to pixels + * + * @param int $pValue Value in points + * @return int Value in pixels + */ + public static function pointsToPixels($pValue = 0) { + if ($pValue != 0) { + return (int) ceil($pValue * 1.333333333); + } else { + return 0; + } + } + + /** + * Convert degrees to angle + * + * @param int $pValue Degrees + * @return int Angle + */ + public static function degreesToAngle($pValue = 0) { + return (int)round($pValue * 60000); + } + + /** + * Convert angle to degrees + * + * @param int $pValue Angle + * @return int Degrees + */ + public static function angleToDegrees($pValue = 0) { + if ($pValue != 0) { + return round($pValue / 60000); + } else { + return 0; + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher.php b/libraries/PHPExcel/PHPExcel/Shared/Escher.php new file mode 100644 index 000000000..f0244eb60 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher.php @@ -0,0 +1,91 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +/** + * PHPExcel_Shared_Escher + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher +{ + /** + * Drawing Group Container + * + * @var PHPExcel_Shared_Escher_DggContainer + */ + private $_dggContainer; + + /** + * Drawing Container + * + * @var PHPExcel_Shared_Escher_DgContainer + */ + private $_dgContainer; + + /** + * Get Drawing Group Container + * + * @return PHPExcel_Shared_Escher_DgContainer + */ + public function getDggContainer() + { + return $this->_dggContainer; + } + + /** + * Set Drawing Group Container + * + * @param PHPExcel_Shared_Escher_DggContainer $dggContainer + */ + public function setDggContainer($dggContainer) + { + return $this->_dggContainer = $dggContainer; + } + + /** + * Get Drawing Container + * + * @return PHPExcel_Shared_Escher_DgContainer + */ + public function getDgContainer() + { + return $this->_dgContainer; + } + + /** + * Set Drawing Container + * + * @param PHPExcel_Shared_Escher_DgContainer $dgContainer + */ + public function setDgContainer($dgContainer) + { + return $this->_dgContainer = $dgContainer; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer.php new file mode 100644 index 000000000..588cae727 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer.php @@ -0,0 +1,83 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DgContainer + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DgContainer +{ + /** + * Drawing index, 1-based. + * + * @var int + */ + private $_dgId; + + /** + * Last shape index in this drawing + * + * @var int + */ + private $_lastSpId; + + private $_spgrContainer = null; + + public function getDgId() + { + return $this->_dgId; + } + + public function setDgId($value) + { + $this->_dgId = $value; + } + + public function getLastSpId() + { + return $this->_lastSpId; + } + + public function setLastSpId($value) + { + $this->_lastSpId = $value; + } + + public function getSpgrContainer() + { + return $this->_spgrContainer; + } + + public function setSpgrContainer($spgrContainer) + { + return $this->_spgrContainer = $spgrContainer; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php new file mode 100644 index 000000000..3114f9c62 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php @@ -0,0 +1,109 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DgContainer_SpgrContainer + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DgContainer_SpgrContainer +{ + /** + * Parent Shape Group Container + * + * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer + */ + private $_parent; + + /** + * Shape Container collection + * + * @var array + */ + private $_children = array(); + + /** + * Set parent Shape Group Container + * + * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent + */ + public function setParent($parent) + { + $this->_parent = $parent; + } + + /** + * Get the parent Shape Group Container if any + * + * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null + */ + public function getParent() + { + return $this->_parent; + } + + /** + * Add a child. This will be either spgrContainer or spContainer + * + * @param mixed $child + */ + public function addChild($child) + { + $this->_children[] = $child; + $child->setParent($this); + } + + /** + * Get collection of Shape Containers + */ + public function getChildren() + { + return $this->_children; + } + + /** + * Recursively get all spContainers within this spgrContainer + * + * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[] + */ + public function getAllSpContainers() + { + $allSpContainers = array(); + + foreach ($this->_children as $child) { + if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); + } else { + $allSpContainers[] = $child; + } + } + + return $allSpContainers; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php new file mode 100644 index 000000000..e05188b74 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -0,0 +1,368 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer +{ + /** + * Parent Shape Group Container + * + * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer + */ + private $_parent; + + /** + * Is this a group shape? + * + * @var boolean + */ + private $_spgr = false; + + /** + * Shape type + * + * @var int + */ + private $_spType; + + /** + * Shape index (usually group shape has index 0, and the rest: 1,2,3...) + * + * @var boolean + */ + private $_spId; + + /** + * Array of options + * + * @var array + */ + private $_OPT; + + /** + * Cell coordinates of upper-left corner of shape, e.g. 'A1' + * + * @var string + */ + private $_startCoordinates; + + /** + * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width + * + * @var int + */ + private $_startOffsetX; + + /** + * Vertical offset of upper-left corner of shape measured in 1/256 of row height + * + * @var int + */ + private $_startOffsetY; + + /** + * Cell coordinates of bottom-right corner of shape, e.g. 'B2' + * + * @var string + */ + private $_endCoordinates; + + /** + * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width + * + * @var int + */ + private $_endOffsetX; + + /** + * Vertical offset of bottom-right corner of shape measured in 1/256 of row height + * + * @var int + */ + private $_endOffsetY; + + /** + * Set parent Shape Group Container + * + * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent + */ + public function setParent($parent) + { + $this->_parent = $parent; + } + + /** + * Get the parent Shape Group Container + * + * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer + */ + public function getParent() + { + return $this->_parent; + } + + /** + * Set whether this is a group shape + * + * @param boolean $value + */ + public function setSpgr($value = false) + { + $this->_spgr = $value; + } + + /** + * Get whether this is a group shape + * + * @return boolean + */ + public function getSpgr() + { + return $this->_spgr; + } + + /** + * Set the shape type + * + * @param int $value + */ + public function setSpType($value) + { + $this->_spType = $value; + } + + /** + * Get the shape type + * + * @return int + */ + public function getSpType() + { + return $this->_spType; + } + + /** + * Set the shape index + * + * @param int $value + */ + public function setSpId($value) + { + $this->_spId = $value; + } + + /** + * Get the shape index + * + * @return int + */ + public function getSpId() + { + return $this->_spId; + } + + /** + * Set an option for the Shape Group Container + * + * @param int $property The number specifies the option + * @param mixed $value + */ + public function setOPT($property, $value) + { + $this->_OPT[$property] = $value; + } + + /** + * Get an option for the Shape Group Container + * + * @param int $property The number specifies the option + * @return mixed + */ + public function getOPT($property) + { + if (isset($this->_OPT[$property])) { + return $this->_OPT[$property]; + } + return null; + } + + /** + * Get the collection of options + * + * @return array + */ + public function getOPTCollection() + { + return $this->_OPT; + } + + /** + * Set cell coordinates of upper-left corner of shape + * + * @param string $value + */ + public function setStartCoordinates($value = 'A1') + { + $this->_startCoordinates = $value; + } + + /** + * Get cell coordinates of upper-left corner of shape + * + * @return string + */ + public function getStartCoordinates() + { + return $this->_startCoordinates; + } + + /** + * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width + * + * @param int $startOffsetX + */ + public function setStartOffsetX($startOffsetX = 0) + { + $this->_startOffsetX = $startOffsetX; + } + + /** + * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width + * + * @return int + */ + public function getStartOffsetX() + { + return $this->_startOffsetX; + } + + /** + * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height + * + * @param int $startOffsetY + */ + public function setStartOffsetY($startOffsetY = 0) + { + $this->_startOffsetY = $startOffsetY; + } + + /** + * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height + * + * @return int + */ + public function getStartOffsetY() + { + return $this->_startOffsetY; + } + + /** + * Set cell coordinates of bottom-right corner of shape + * + * @param string $value + */ + public function setEndCoordinates($value = 'A1') + { + $this->_endCoordinates = $value; + } + + /** + * Get cell coordinates of bottom-right corner of shape + * + * @return string + */ + public function getEndCoordinates() + { + return $this->_endCoordinates; + } + + /** + * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width + * + * @param int $startOffsetX + */ + public function setEndOffsetX($endOffsetX = 0) + { + $this->_endOffsetX = $endOffsetX; + } + + /** + * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width + * + * @return int + */ + public function getEndOffsetX() + { + return $this->_endOffsetX; + } + + /** + * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height + * + * @param int $endOffsetY + */ + public function setEndOffsetY($endOffsetY = 0) + { + $this->_endOffsetY = $endOffsetY; + } + + /** + * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height + * + * @return int + */ + public function getEndOffsetY() + { + return $this->_endOffsetY; + } + + /** + * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and + * the dgContainer. A value of 1 = immediately within first spgrContainer + * Higher nesting level occurs if and only if spContainer is part of a shape group + * + * @return int Nesting level + */ + public function getNestingLevel() + { + $nestingLevel = 0; + + $parent = $this->getParent(); + while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { + ++$nestingLevel; + $parent = $parent->getParent(); + } + + return $nestingLevel; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer.php new file mode 100644 index 000000000..7b1741c82 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer.php @@ -0,0 +1,177 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DggContainer + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DggContainer +{ + /** + * Maximum shape index of all shapes in all drawings increased by one + * + * @var int + */ + private $_spIdMax; + + /** + * Total number of drawings saved + * + * @var int + */ + private $_cDgSaved; + + /** + * Total number of shapes saved (including group shapes) + * + * @var int + */ + private $_cSpSaved; + + /** + * BLIP Store Container + * + * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer + */ + private $_bstoreContainer; + + /** + * Array of options for the drawing group + * + * @var array + */ + private $_OPT = array(); + + /** + * Get maximum shape index of all shapes in all drawings (plus one) + * + * @return int + */ + public function getSpIdMax() + { + return $this->_spIdMax; + } + + /** + * Set maximum shape index of all shapes in all drawings (plus one) + * + * @param int + */ + public function setSpIdMax($value) + { + $this->_spIdMax = $value; + } + + /** + * Get total number of drawings saved + * + * @return int + */ + public function getCDgSaved() + { + return $this->_cDgSaved; + } + + /** + * Set total number of drawings saved + * + * @param int + */ + public function setCDgSaved($value) + { + $this->_cDgSaved = $value; + } + + /** + * Get total number of shapes saved (including group shapes) + * + * @return int + */ + public function getCSpSaved() + { + return $this->_cSpSaved; + } + + /** + * Set total number of shapes saved (including group shapes) + * + * @param int + */ + public function setCSpSaved($value) + { + $this->_cSpSaved = $value; + } + + /** + * Get BLIP Store Container + * + * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer + */ + public function getBstoreContainer() + { + return $this->_bstoreContainer; + } + + /** + * Set BLIP Store Container + * + * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $bstoreContainer + */ + public function setBstoreContainer($bstoreContainer) + { + $this->_bstoreContainer = $bstoreContainer; + } + + /** + * Set an option for the drawing group + * + * @param int $property The number specifies the option + * @param mixed $value + */ + public function setOPT($property, $value) + { + $this->_OPT[$property] = $value; + } + + /** + * Get an option for the drawing group + * + * @param int $property The number specifies the option + * @return mixed + */ + public function getOPT($property) + { + if (isset($this->_OPT[$property])) { + return $this->_OPT[$property]; + } + return null; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php new file mode 100644 index 000000000..4c26bb384 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php @@ -0,0 +1,65 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DggContainer_BstoreContainer +{ + /** + * BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture) + * + * @var array + */ + private $_BSECollection = array(); + + /** + * Add a BLIP Store Entry + * + * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $BSE + */ + public function addBSE($BSE) + { + $this->_BSECollection[] = $BSE; + $BSE->setParent($this); + } + + /** + * Get the collection of BLIP Store Entries + * + * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[] + */ + public function getBSECollection() + { + return $this->_BSECollection; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php new file mode 100644 index 000000000..ae0f246d2 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -0,0 +1,120 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE +{ + const BLIPTYPE_ERROR = 0x00; + const BLIPTYPE_UNKNOWN = 0x01; + const BLIPTYPE_EMF = 0x02; + const BLIPTYPE_WMF = 0x03; + const BLIPTYPE_PICT = 0x04; + const BLIPTYPE_JPEG = 0x05; + const BLIPTYPE_PNG = 0x06; + const BLIPTYPE_DIB = 0x07; + const BLIPTYPE_TIFF = 0x11; + const BLIPTYPE_CMYKJPEG = 0x12; + + /** + * The parent BLIP Store Entry Container + * + * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer + */ + private $_parent; + + /** + * The BLIP (Big Large Image or Picture) + * + * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + */ + private $_blip; + + /** + * The BLIP type + * + * @var int + */ + private $_blipType; + + /** + * Set parent BLIP Store Entry Container + * + * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $parent + */ + public function setParent($parent) + { + $this->_parent = $parent; + } + + /** + * Get the BLIP + * + * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + */ + public function getBlip() + { + return $this->_blip; + } + + /** + * Set the BLIP + * + * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip + */ + public function setBlip($blip) + { + $this->_blip = $blip; + $blip->setParent($this); + } + + /** + * Get the BLIP type + * + * @return int + */ + public function getBlipType() + { + return $this->_blipType; + } + + /** + * Set the BLIP type + * + * @param int + */ + public function setBlipType($blipType) + { + $this->_blipType = $blipType; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php new file mode 100644 index 000000000..41d095657 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -0,0 +1,91 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.6.7, 2009-04-22 + */ + +/** + * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip + * + * @category PHPExcel + * @package PHPExcel_Shared_Escher + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip +{ + /** + * The parent BSE + * + * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE + */ + private $_parent; + + /** + * Raw image data + * + * @var string + */ + private $_data; + + /** + * Get the raw image data + * + * @return string + */ + public function getData() + { + return $this->_data; + } + + /** + * Set the raw image data + * + * @param string + */ + public function setData($data) + { + $this->_data = $data; + } + + /** + * Set parent BSE + * + * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent + */ + public function setParent($parent) + { + $this->_parent = $parent; + } + + /** + * Get parent BSE + * + * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent + */ + public function getParent() + { + return $this->_parent; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Excel5.php b/libraries/PHPExcel/PHPExcel/Shared/Excel5.php new file mode 100644 index 000000000..b8e2050ee --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Excel5.php @@ -0,0 +1,322 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Shared_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php'; + +/** + * PHPExcel_Shared_Excel5 + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Excel5 +{ + /** + * Get the width of a column in pixels. We use the relationship y = ceil(7x) where + * x is the width in intrinsic Excel units (measuring width in number of normal characters) + * This holds for Arial 10 + * + * @param PHPExcel_Worksheet $sheet The sheet + * @param integer $col The column + * @return integer The width in pixels + */ + public static function sizeCol($sheet, $col = 'A') + { + // default font size of workbook + $fontSize = $sheet->getParent()->getDefaultStyle()->getFont()->getSize(); + + $columnDimensions = $sheet->getColumnDimensions(); + + // first find the true column width in pixels (uncollapsed and unhidden) + if ( isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1 ) { + + // then we have column dimension with explicit width + $columnDimension = $columnDimensions[$col]; + $width = $columnDimension->getWidth(); + $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $fontSize); + + } else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) { + + // then we have default column dimension with explicit width + $defaultColumnDimension = $sheet->getDefaultColumnDimension(); + $width = $defaultColumnDimension->getWidth(); + $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $fontSize); + + } else { + $pixelWidth = (int) 64 * $fontSize / 11; // here we interpolate from Calibri 11 + } + + // now find the effective column width in pixels + if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) { + $effectivePixelWidth = 0; + } else { + $effectivePixelWidth = $pixelWidth; + } + + return $effectivePixelWidth; + } + + /** + * Convert the height of a cell from user's units to pixels. By interpolation + * the relationship is: y = 4/3x. If the height hasn't been set by the user we + * use the default value. If the row is hidden we use a value of zero. + * + * @param PHPExcel_Worksheet $sheet The sheet + * @param integer $row The row index (1-based) + * @return integer The width in pixels + */ + public static function sizeRow($sheet, $row = 1) + { + $rowDimensions = $sheet->getRowDimensions(); + + // first find the true row height in pixels (uncollapsed and unhidden) + if ( isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) { + + // then we have a row dimension + $rowDimension = $rowDimensions[$row]; + $rowHeight = $rowDimension->getRowHeight(); + $pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10 + + } else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) { + + // then we have a default row dimension with explicit height + $defaultRowDimension = $sheet->getDefaultRowDimension(); + $rowHeight = $defaultRowDimension->getRowHeight(); + $pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight); + + } else { + $pixelRowHeight = 20; // here we assume Calibri 11 + } + + // now find the effective row height in pixels + if ( isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible() ) { + $effectivePixelRowHeight = 0; + } else { + $effectivePixelRowHeight = $pixelRowHeight; + } + + return $effectivePixelRowHeight; + } + + /** + * Get the horizontal distance in pixels between two anchors + * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets + * + * @param PHPExcel_Worksheet $sheet + * @param string $startColumn + * @param integer $startOffset Offset within start cell measured in 1/1024 of the cell width + * @param string $endColumn + * @param integer $endOffset Offset within end cell measured in 1/1024 of the cell width + * @return integer Horizontal measured in pixels + */ + public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) + { + $distanceX = 0; + + // add the widths of the spanning columns + $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based + $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based + for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) { + $distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i)); + } + + // correct for offsetX in startcell + $distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024); + + // correct for offsetX in endcell + $distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024)); + + return $distanceX; + } + + /** + * Get the vertical distance in pixels between two anchors + * The distanceY is found as sum of all the spanning rows minus two offsets + * + * @param PHPExcel_Worksheet $sheet + * @param string $startRow (1-based) + * @param integer $startOffset Offset within start cell measured in 1/256 of the cell height + * @param string $endRow (1-based) + * @param integer $endOffset Offset within end cell measured in 1/256 of the cell height + * @return integer Vertical distance measured in pixels + */ + public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) + { + $distanceY = 0; + + // add the widths of the spanning rows + for ($row = $startRow; $row <= $endRow; ++$row) { + $distanceY += self::sizeRow($sheet, $row); + } + + // correct for offsetX in startcell + $distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256); + + // correct for offsetX in endcell + $distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256)); + + return $distanceY; + } + + /** + * Convert 1-cell anchor coordinates to 2-cell anchor coordinates + * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications + * + * Calculate the vertices that define the position of the image as required by + * the OBJ record. + * + * +------------+------------+ + * | A | B | + * +-----+------------+------------+ + * | |(x1,y1) | | + * | 1 |(A1)._______|______ | + * | | | | | + * | | | | | + * +-----+----| BITMAP |-----+ + * | | | | | + * | 2 | |______________. | + * | | | (B2)| + * | | | (x2,y2)| + * +---- +------------+------------+ + * + * Example of a bitmap that covers some of the area from cell A1 to cell B2. + * + * Based on the width and height of the bitmap we need to calculate 8 vars: + * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. + * The width and height of the cells are also variable and have to be taken into + * account. + * The values of $col_start and $row_start are passed in from the calling + * function. The values of $col_end and $row_end are calculated by subtracting + * the width and height of the bitmap from the width and height of the + * underlying cells. + * The vertices are expressed as a percentage of the underlying cell width as + * follows (rhs values are in pixels): + * + * x1 = X / W *1024 + * y1 = Y / H *256 + * x2 = (X-1) / W *1024 + * y2 = (Y-1) / H *256 + * + * Where: X is distance from the left side of the underlying cell + * Y is distance from the top of the underlying cell + * W is the width of the cell + * H is the height of the cell + * + * @param PHPExcel_Worksheet $sheet + * @param string $coordinates E.g. 'A1' + * @param integer $offsetX Horizontal offset in pixels + * @param integer $offsetY Vertical offset in pixels + * @param integer $width Width in pixels + * @param integer $height Height in pixels + * @return array + */ + public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) + { + list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates); + $col_start = PHPExcel_Cell::columnIndexFromString($column) - 1; + $row_start = $row - 1; + + $x1 = $offsetX; + $y1 = $offsetY; + + // Initialise end cell to the same as the start cell + $col_end = $col_start; // Col containing lower right corner of object + $row_end = $row_start; // Row containing bottom right corner of object + + // Zero the specified offset if greater than the cell dimensions + if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { + $x1 = 0; + } + if ($y1 >= self::sizeRow($sheet, $row_start + 1)) { + $y1 = 0; + } + + $width = $width + $x1 -1; + $height = $height + $y1 -1; + + // Subtract the underlying cell widths to find the end cell of the image + while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { + $width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)); + ++$col_end; + } + + // Subtract the underlying cell heights to find the end cell of the image + while ($height >= self::sizeRow($sheet, $row_end + 1)) { + $height -= self::sizeRow($sheet, $row_end + 1); + ++$row_end; + } + + // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell + // with zero height or width. + if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { + return; + } + if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { + return; + } + if (self::sizeRow($sheet, $row_start + 1) == 0) { + return; + } + if (self::sizeRow($sheet, $row_end + 1) == 0) { + return; + } + + // Convert the pixel values to the percentage value expected by Excel + $x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; + $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256; + $x2 = $width / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $y2 = $height / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object + + $startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1); + $endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1); + + $twoAnchor = array( + 'startCoordinates' => $startCoordinates, + 'startOffsetX' => $x1, + 'startOffsetY' => $y1, + 'endCoordinates' => $endCoordinates, + 'endOffsetX' => $x2, + 'endOffsetY' => $y2, + ); + + return $twoAnchor; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/File.php b/libraries/PHPExcel/PHPExcel/Shared/File.php new file mode 100644 index 000000000..3c24520a9 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/File.php @@ -0,0 +1,98 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_File + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_File +{ + /** + * Verify if a file exists + * + * @param string $pFilename Filename + * @return bool + */ + public static function file_exists($pFilename) { + // Sick construction, but it seems that + // file_exists returns strange values when + // doing the original file_exists on ZIP archives... + if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) { + // Open ZIP file and verify if the file exists + $zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6); + $archiveFile = substr($pFilename, strpos($pFilename, '#') + 1); + + $zip = new ZipArchive(); + if ($zip->open($zipFile) === true) { + $returnValue = ($zip->getFromName($archiveFile) !== false); + $zip->close(); + return $returnValue; + } else { + return false; + } + } else { + // Regular file_exists + return file_exists($pFilename); + } + } + + /** + * Returns canonicalized absolute pathname, also for ZIP archives + * + * @param string $pFilename + * @return string + */ + public static function realpath($pFilename) { + // Returnvalue + $returnValue = ''; + + // Try using realpath() + $returnValue = realpath($pFilename); + + // Found something? + if ($returnValue == '' || is_null($returnValue)) { + $pathArray = split('/' , $pFilename); + while(in_array('..', $pathArray) && $pathArray[0] != '..') { + for ($i = 0; $i < count($pathArray); ++$i) { + if ($pathArray[$i] == '..' && $i > 0) { + unset($pathArray[$i]); + unset($pathArray[$i - 1]); + break; + } + } + } + $returnValue = implode('/', $pathArray); + } + + // Return + return $returnValue; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/Font.php b/libraries/PHPExcel/PHPExcel/Shared/Font.php new file mode 100644 index 000000000..9bc8484fa --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/Font.php @@ -0,0 +1,155 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_Font + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_Font +{ + /** Character set codes used by BIFF5-8 in Font records */ + const CHARSET_ANSI_LATIN = 0x00; + const CHARSET_SYSTEM_DEFAULT = 0x01; + const CHARSET_SYMBOL = 0x02; + const CHARSET_APPLE_ROMAN = 0x4D; + const CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80; + const CHARSET_ANSI_KOREAN_HANGUL = 0x81; + const CHARSET_ANSI_KOREAN_JOHAB = 0x82; + const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; + const CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88; + const CHARSET_ANSI_GREEK = 0xA1; + const CHARSET_ANSI_TURKISH = 0xA2; + const CHARSET_ANSI_VIETNAMESE = 0xA3; + const CHARSET_ANSI_HEBREW = 0xB1; + const CHARSET_ANSI_ARABIC = 0xB2; + const CHARSET_ANSI_BALTIC = 0xBA; + const CHARSET_ANSI_CYRILLIC = 0xCC; + const CHARSET_ANSI_THAI = 0xDE; + const CHARSET_ANSI_LATIN_II = 0xEE; + const CHARSET_OEM_LATIN_I = 0xFF; + + /** + * Calculate an (approximate) OpenXML column width, based on font size and text contained + * + * @param int $fontSize Font size (in pixels or points) + * @param bool $fontSizeInPixels Is the font size specified in pixels (true) or in points (false) ? + * @param string $columnText Text to calculate width + * @param int $rotation Rotation angle + * @return int Column width + */ + public static function calculateColumnWidth($fontSize = 9, $fontSizeInPixels = false, $columnText = '', $rotation = 0) { + if (!$fontSizeInPixels) { + // Translate points size to pixel size + $fontSize = PHPExcel_Shared_Font::fontSizeToPixels($fontSize); + } + + // If it is rich text, use rich text... + if ($columnText instanceof PHPExcel_RichText) { + $columnText = $columnText->getPlainText(); + } + + // Only measure the part before the first newline character + if (strpos($columnText, "\r") !== false) { + $columnText = substr($columnText, 0, strpos($columnText, "\r")); + } + if (strpos($columnText, "\n") !== false) { + $columnText = substr($columnText, 0, strpos($columnText, "\n")); + } + + // Calculate column width + // values 1.025 and 0.584 found via interpolation by inspecting real Excel files with + // Calibri font. May need further adjustment + $columnWidth = 1.025 * strlen($columnText) + 0.584; // Excel adds some padding + + // Calculate approximate rotated column width + if ($rotation !== 0) { + if ($rotation == -165) { + // stacked text + $columnWidth = 4; // approximation + } else { + // rotated text + $columnWidth = $columnWidth * cos(deg2rad($rotation)) + + $fontSize * abs(sin(deg2rad($rotation))) / 5; // approximation + } + } + + // Return + return round($columnWidth, 6); + } + + /** + * Calculate an (approximate) pixel size, based on a font points size + * + * @param int $fontSizeInPoints Font size (in points) + * @return int Font size (in pixels) + */ + public static function fontSizeToPixels($fontSizeInPoints = 12) { + return ((16 / 12) * $fontSizeInPoints); + } + + /** + * Calculate an (approximate) pixel size, based on inch size + * + * @param int $sizeInInch Font size (in inch) + * @return int Size (in pixels) + */ + public static function inchSizeToPixels($sizeInInch = 1) { + return ($sizeInInch * 96); + } + + /** + * Calculate an (approximate) pixel size, based on centimeter size + * + * @param int $sizeInCm Font size (in centimeters) + * @return int Size (in pixels) + */ + public static function centimeterSizeToPixels($sizeInCm = 1) { + return ($sizeInCm * 37.795275591); + } + + /** + * Returns the associated charset for the font name. + * + * @param string $name Font name + * @return int Character set code + */ + public static function getCharsetFromFontName($name) + { + switch ($name) { + // Add more cases. Check FONT records in real Excel files. + case 'Wingdings': return self::CHARSET_SYMBOL; + case 'Wingdings 2': return self::CHARSET_SYMBOL; + case 'Wingdings 3': return self::CHARSET_SYMBOL; + default: return self::CHARSET_ANSI_LATIN; + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/CHANGELOG.TXT b/libraries/PHPExcel/PHPExcel/Shared/JAMA/CHANGELOG.TXT new file mode 100644 index 000000000..1c18a5da3 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/CHANGELOG.TXT @@ -0,0 +1,16 @@ +Mar 1, 2005 11:15 AST by PM + ++ For consistency, renamed Math.php to Maths.java, utils to util, + tests to test, docs to doc - + ++ Removed conditional logic from top of Matrix class. + ++ Switched to using hypo function in Maths.php for all php-hypot calls. + NOTE TO SELF: Need to make sure that all decompositions have been + switched over to using the bundled hypo. + +Feb 25, 2005 at 10:00 AST by PM + ++ Recommend using simpler Error.php instead of JAMA_Error.php but + can be persuaded otherwise. + diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php new file mode 100644 index 000000000..b401b8491 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php @@ -0,0 +1,133 @@ +<?php +/** +* @package JAMA +* +* Cholesky decomposition class +* +* For a symmetric, positive definite matrix A, the Cholesky decomposition +* is an lower triangular matrix L so that A = L*L'. +* +* If the matrix is not symmetric or positive definite, the constructor +* returns a partial decomposition and sets an internal flag that may +* be queried by the isSPD() method. +* +* @author Paul Meagher +* @author Michael Bommarito +* @version 1.2 +*/ +class CholeskyDecomposition { + /** + * Decomposition storage + * @var array + * @access private + */ + var $L = array(); + + /** + * Matrix row and column dimension + * @var int + * @access private + */ + var $m; + + /** + * Symmetric positive definite flag + * @var boolean + * @access private + */ + var $isspd = true; + + /** + * CholeskyDecomposition + * Class constructor - decomposes symmetric positive definite matrix + * @param mixed Matrix square symmetric positive definite matrix + */ + function CholeskyDecomposition( $A = null ) { + if( is_a($A, 'Matrix') ) { + $this->L = $A->getArray(); + $this->m = $A->getRowDimension(); + + for( $i = 0; $i < $this->m; $i++ ) { + for( $j = $i; $j < $this->m; $j++ ) { + for( $sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; $k-- ) + $sum -= $this->L[$i][$k] * $this->L[$j][$k]; + + if( $i == $j ) { + if( $sum >= 0 ) { + $this->L[$i][$i] = sqrt( $sum ); + } else { + $this->isspd = false; + } + } else { + if( $this->L[$i][$i] != 0 ) + $this->L[$j][$i] = $sum / $this->L[$i][$i]; + } + } + + for ($k = $i+1; $k < $this->m; $k++) + $this->L[$i][$k] = 0.0; + } + } else { + trigger_error(ArgumentTypeException, ERROR); + } + } + + /** + * Is the matrix symmetric and positive definite? + * @return boolean + */ + function isSPD () { + return $this->isspd; + } + + /** + * getL + * Return triangular factor. + * @return Matrix Lower triangular matrix + */ + function getL () { + return new Matrix($this->L); + } + + /** + * Solve A*X = B + * @param $B Row-equal matrix + * @return Matrix L * L' * X = B + */ + function solve ( $B = null ) { + if( is_a($B, 'Matrix') ) { + if ($B->getRowDimension() == $this->m) { + if ($this->isspd) { + $X = $B->getArrayCopy(); + $nx = $B->getColumnDimension(); + + for ($k = 0; $k < $this->m; $k++) { + for ($i = $k + 1; $i < $this->m; $i++) + for ($j = 0; $j < $nx; $j++) + $X[$i][$j] -= $X[$k][$j] * $this->L[$i][$k]; + + for ($j = 0; $j < $nx; $j++) + $X[$k][$j] /= $this->L[$k][$k]; + } + + for ($k = $this->m - 1; $k >= 0; $k--) { + for ($j = 0; $j < $nx; $j++) + $X[$k][$j] /= $this->L[$k][$k]; + + for ($i = 0; $i < $k; $i++) + for ($j = 0; $j < $nx; $j++) + $X[$i][$j] -= $X[$k][$j] * $this->L[$k][$i]; + } + + return new Matrix($X, $this->m, $nx); + } else { + trigger_error(MatrixSPDException, ERROR); + } + } else { + trigger_error(MatrixDimensionException, ERROR); + } + } else { + trigger_error(ArgumentTypeException, ERROR); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php new file mode 100644 index 000000000..a010884b7 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php @@ -0,0 +1,789 @@ +<?php +/** +* @package JAMA +* +* Class to obtain eigenvalues and eigenvectors of a real matrix. +* +* If A is symmetric, then A = V*D*V' where the eigenvalue matrix D +* is diagonal and the eigenvector matrix V is orthogonal (i.e. +* A = V.times(D.times(V.transpose())) and V.times(V.transpose()) +* equals the identity matrix). +* +* If A is not symmetric, then the eigenvalue matrix D is block diagonal +* with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, +* lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The +* columns of V represent the eigenvectors in the sense that A*V = V*D, +* i.e. A.times(V) equals V.times(D). The matrix V may be badly +* conditioned, or even singular, so the validity of the equation +* A = V*D*inverse(V) depends upon V.cond(). +* +* @author Paul Meagher +* @license PHP v3.0 +* @version 1.1 +*/ +class EigenvalueDecomposition { + + /** + * Row and column dimension (square matrix). + * @var int + */ + var $n; + + /** + * Internal symmetry flag. + + * @var int + */ + var $issymmetric; + + /** + * Arrays for internal storage of eigenvalues. + * @var array + */ + var $d = array(); + var $e = array(); + + /** + * Array for internal storage of eigenvectors. + * @var array + */ + var $V = array(); + + /** + * Array for internal storage of nonsymmetric Hessenberg form. + * @var array + */ + var $H = array(); + + /** + * Working storage for nonsymmetric algorithm. + * @var array + */ + var $ort; + + /** + * Used for complex scalar division. + * @var float + */ + var $cdivr; + var $cdivi; + + /** + * Symmetric Householder reduction to tridiagonal form. + * @access private + */ + function tred2 () { + // This is derived from the Algol procedures tred2 by + // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for + // Auto. Comp., Vol.ii-Linear Algebra, and the corresponding + // Fortran subroutine in EISPACK. + $this->d = $this->V[$this->n-1]; + // Householder reduction to tridiagonal form. + for ($i = $this->n-1; $i > 0; $i--) { + $i_ = $i -1; + // Scale to avoid under/overflow. + $h = $scale = 0.0; + $scale += array_sum(array_map(abs, $this->d)); + if ($scale == 0.0) { + $this->e[$i] = $this->d[$i_]; + $this->d = array_slice($this->V[$i_], 0, $i_); + for ($j = 0; $j < $i; $j++) { + $this->V[$j][$i] = $this->V[$i][$j] = 0.0; + } + } else { + // Generate Householder vector. + for ($k = 0; $k < $i; $k++) { + $this->d[$k] /= $scale; + $h += pow($this->d[$k], 2); + } + $f = $this->d[$i_]; + $g = sqrt($h); + if ($f > 0) + $g = -$g; + $this->e[$i] = $scale * $g; + $h = $h - $f * $g; + $this->d[$i_] = $f - $g; + for ($j = 0; $j < $i; $j++) + $this->e[$j] = 0.0; + // Apply similarity transformation to remaining columns. + for ($j = 0; $j < $i; $j++) { + $f = $this->d[$j]; + $this->V[$j][$i] = $f; + $g = $this->e[$j] + $this->V[$j][$j] * $f; + for ($k = $j+1; $k <= $i_; $k++) { + $g += $this->V[$k][$j] * $this->d[$k]; + $this->e[$k] += $this->V[$k][$j] * $f; + } + $this->e[$j] = $g; + } + $f = 0.0; + for ($j = 0; $j < $i; $j++) { + $this->e[$j] /= $h; + $f += $this->e[$j] * $this->d[$j]; + } + $hh = $f / (2 * $h); + for ($j=0; $j < $i; $j++) + $this->e[$j] -= $hh * $this->d[$j]; + for ($j = 0; $j < $i; $j++) { + $f = $this->d[$j]; + $g = $this->e[$j]; + for ($k = $j; $k <= $i_; $k++) + $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]); + $this->d[$j] = $this->V[$i-1][$j]; + $this->V[$i][$j] = 0.0; + } + } + $this->d[$i] = $h; + } + // Accumulate transformations. + for ($i = 0; $i < $this->n-1; $i++) { + $this->V[$this->n-1][$i] = $this->V[$i][$i]; + $this->V[$i][$i] = 1.0; + $h = $this->d[$i+1]; + if ($h != 0.0) { + for ($k = 0; $k <= $i; $k++) + $this->d[$k] = $this->V[$k][$i+1] / $h; + for ($j = 0; $j <= $i; $j++) { + $g = 0.0; + for ($k = 0; $k <= $i; $k++) + $g += $this->V[$k][$i+1] * $this->V[$k][$j]; + for ($k = 0; $k <= $i; $k++) + $this->V[$k][$j] -= $g * $this->d[$k]; + } + } + for ($k = 0; $k <= $i; $k++) + $this->V[$k][$i+1] = 0.0; + } + + $this->d = $this->V[$this->n-1]; + $this->V[$this->n-1] = array_fill(0, $j, 0.0); + $this->V[$this->n-1][$this->n-1] = 1.0; + $this->e[0] = 0.0; + } + + /** + * Symmetric tridiagonal QL algorithm. + * + * This is derived from the Algol procedures tql2, by + * Bowdler, Martin, Reinsch, and Wilkinson, Handbook for + * Auto. Comp., Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutine in EISPACK. + * + * @access private + */ + function tql2 () { + for ($i = 1; $i < $this->n; $i++) + $this->e[$i-1] = $this->e[$i]; + $this->e[$this->n-1] = 0.0; + $f = 0.0; + $tst1 = 0.0; + $eps = pow(2.0,-52.0); + for ($l = 0; $l < $this->n; $l++) { + // Find small subdiagonal element + $tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l])); + $m = $l; + while ($m < $this->n) { + if (abs($this->e[$m]) <= $eps * $tst1) + break; + $m++; + } + // If m == l, $this->d[l] is an eigenvalue, + // otherwise, iterate. + if ($m > $l) { + $iter = 0; + do { + // Could check iteration count here. + $iter += 1; + // Compute implicit shift + $g = $this->d[$l]; + $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]); + $r = hypo($p, 1.0); + if ($p < 0) + $r *= -1; + $this->d[$l] = $this->e[$l] / ($p + $r); + $this->d[$l+1] = $this->e[$l] * ($p + $r); + $dl1 = $this->d[$l+1]; + $h = $g - $this->d[$l]; + for ($i = $l + 2; $i < $this->n; $i++) + $this->d[$i] -= $h; + $f += $h; + // Implicit QL transformation. + $p = $this->d[$m]; + $c = 1.0; + $c2 = $c3 = $c; + $el1 = $this->e[$l + 1]; + $s = $s2 = 0.0; + for ($i = $m-1; $i >= $l; $i--) { + $c3 = $c2; + $c2 = $c; + $s2 = $s; + $g = $c * $this->e[$i]; + $h = $c * $p; + $r = hypo($p, $this->e[$i]); + $this->e[$i+1] = $s * $r; + $s = $this->e[$i] / $r; + $c = $p / $r; + $p = $c * $this->d[$i] - $s * $g; + $this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]); + // Accumulate transformation. + for ($k = 0; $k < $this->n; $k++) { + $h = $this->V[$k][$i+1]; + $this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h; + $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h; + } + } + $p = -$s * $s2 * $c3 * $el1 * $this->e[$l] / $dl1; + $this->e[$l] = $s * $p; + $this->d[$l] = $c * $p; + // Check for convergence. + } while (abs($this->e[$l]) > $eps * $tst1); + } + $this->d[$l] = $this->d[$l] + $f; + $this->e[$l] = 0.0; + } + // Sort eigenvalues and corresponding vectors. + for ($i = 0; $i < $this->n - 1; $i++) { + $k = $i; + $p = $this->d[$i]; + for ($j = $i+1; $j < $this->n; $j++) { + if ($this->d[$j] < $p) { + $k = $j; + $p = $this->d[$j]; + } + } + if ($k != $i) { + $this->d[$k] = $this->d[$i]; + $this->d[$i] = $p; + for ($j = 0; $j < $this->n; $j++) { + $p = $this->V[$j][$i]; + $this->V[$j][$i] = $this->V[$j][$k]; + $this->V[$j][$k] = $p; + } + } + } + } + + /** + * Nonsymmetric reduction to Hessenberg form. + * + * This is derived from the Algol procedures orthes and ortran, + * by Martin and Wilkinson, Handbook for Auto. Comp., + * Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutines in EISPACK. + * + * @access private + */ + function orthes () { + $low = 0; + $high = $this->n-1; + for ($m = $low+1; $m <= $high-1; $m++) { + // Scale column. + $scale = 0.0; + for ($i = $m; $i <= $high; $i++) + $scale = $scale + abs($this->H[$i][$m-1]); + if ($scale != 0.0) { + // Compute Householder transformation. + $h = 0.0; + for ($i = $high; $i >= $m; $i--) { + $this->ort[$i] = $this->H[$i][$m-1]/$scale; + $h += $this->ort[$i] * $this->ort[$i]; + } + $g = sqrt($h); + if ($this->ort[$m] > 0) + $g *= -1; + $h -= $this->ort[$m] * $g; + $this->ort[$m] -= $g; + // Apply Householder similarity transformation + // H = (I-u*u'/h)*H*(I-u*u')/h) + for ($j = $m; $j < $this->n; $j++) { + $f = 0.0; + for ($i = $high; $i >= $m; $i--) + $f += $this->ort[$i] * $this->H[$i][$j]; + $f /= $h; + for ($i = $m; $i <= $high; $i++) + $this->H[$i][$j] -= $f * $this->ort[$i]; + } + for ($i = 0; $i <= $high; $i++) { + $f = 0.0; + for ($j = $high; $j >= $m; $j--) + $f += $this->ort[$j] * $this->H[$i][$j]; + $f = $f/$h; + for ($j = $m; $j <= $high; $j++) + $this->H[$i][$j] -= $f * $this->ort[$j]; + } + $this->ort[$m] = $scale * $this->ort[$m]; + $this->H[$m][$m-1] = $scale * $g; + } + } + // Accumulate transformations (Algol's ortran). + for ($i = 0; $i < $this->n; $i++) + for ($j = 0; $j < $this->n; $j++) + $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0); + for ($m = $high-1; $m >= $low+1; $m--) { + if ($this->H[$m][$m-1] != 0.0) { + for ($i = $m+1; $i <= $high; $i++) + $this->ort[$i] = $this->H[$i][$m-1]; + for ($j = $m; $j <= $high; $j++) { + $g = 0.0; + for ($i = $m; $i <= $high; $i++) + $g += $this->ort[$i] * $this->V[$i][$j]; + // Double division avoids possible underflow + $g = ($g / $this->ort[$m]) / $this->H[$m][$m-1]; + for ($i = $m; $i <= $high; $i++) + $this->V[$i][$j] += $g * $this->ort[$i]; + } + } + } + } + + /** + * Performs complex division. + * @access private + */ + function cdiv($xr, $xi, $yr, $yi) { + if (abs($yr) > abs($yi)) { + $r = $yi / $yr; + $d = $yr + $r * $yi; + $this->cdivr = ($xr + $r * $xi) / $d; + $this->cdivi = ($xi - $r * $xr) / $d; + } else { + $r = $yr / $yi; + $d = $yi + $r * $yr; + $this->cdivr = ($r * $xr + $xi) / $d; + $this->cdivi = ($r * $xi - $xr) / $d; + } + } + + /** + * Nonsymmetric reduction from Hessenberg to real Schur form. + * + * Code is derived from the Algol procedure hqr2, + * by Martin and Wilkinson, Handbook for Auto. Comp., + * Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutine in EISPACK. + * + * @access private + */ + function hqr2 () { + // Initialize + $nn = $this->n; + $n = $nn - 1; + $low = 0; + $high = $nn - 1; + $eps = pow(2.0, -52.0); + $exshift = 0.0; + $p = $q = $r = $s = $z = 0; + // Store roots isolated by balanc and compute matrix norm + $norm = 0.0; + for ($i = 0; $i < $nn; $i++) { + if (($i < $low) OR ($i > $high)) { + $this->d[$i] = $this->H[$i][$i]; + $this->e[$i] = 0.0; + } + for ($j = max($i-1, 0); $j < $nn; $j++) + $norm = $norm + abs($this->H[$i][$j]); + } + // Outer loop over eigenvalue index + $iter = 0; + while ($n >= $low) { + // Look for single small sub-diagonal element + $l = $n; + while ($l > $low) { + $s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]); + if ($s == 0.0) + $s = $norm; + if (abs($this->H[$l][$l-1]) < $eps * $s) + break; + $l--; + } + // Check for convergence + // One root found + if ($l == $n) { + $this->H[$n][$n] = $this->H[$n][$n] + $exshift; + $this->d[$n] = $this->H[$n][$n]; + $this->e[$n] = 0.0; + $n--; + $iter = 0; + // Two roots found + } else if ($l == $n-1) { + $w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; + $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0; + $q = $p * $p + $w; + $z = sqrt(abs($q)); + $this->H[$n][$n] = $this->H[$n][$n] + $exshift; + $this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift; + $x = $this->H[$n][$n]; + // Real pair + if ($q >= 0) { + if ($p >= 0) + $z = $p + $z; + else + $z = $p - $z; + $this->d[$n-1] = $x + $z; + $this->d[$n] = $this->d[$n-1]; + if ($z != 0.0) + $this->d[$n] = $x - $w / $z; + $this->e[$n-1] = 0.0; + $this->e[$n] = 0.0; + $x = $this->H[$n][$n-1]; + $s = abs($x) + abs($z); + $p = $x / $s; + $q = $z / $s; + $r = sqrt($p * $p + $q * $q); + $p = $p / $r; + $q = $q / $r; + // Row modification + for ($j = $n-1; $j < $nn; $j++) { + $z = $this->H[$n-1][$j]; + $this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j]; + $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z; + } + // Column modification + for ($i = 0; $i <= n; $i++) { + $z = $this->H[$i][$n-1]; + $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n]; + $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z; + } + // Accumulate transformations + for ($i = $low; $i <= $high; $i++) { + $z = $this->V[$i][$n-1]; + $this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n]; + $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z; + } + // Complex pair + } else { + $this->d[$n-1] = $x + $p; + $this->d[$n] = $x + $p; + $this->e[$n-1] = $z; + $this->e[$n] = -$z; + } + $n = $n - 2; + $iter = 0; + // No convergence yet + } else { + // Form shift + $x = $this->H[$n][$n]; + $y = 0.0; + $w = 0.0; + if ($l < $n) { + $y = $this->H[$n-1][$n-1]; + $w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; + } + // Wilkinson's original ad hoc shift + if ($iter == 10) { + $exshift += $x; + for ($i = $low; $i <= $n; $i++) + $this->H[$i][$i] -= $x; + $s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]); + $x = $y = 0.75 * $s; + $w = -0.4375 * $s * $s; + } + // MATLAB's new ad hoc shift + if ($iter == 30) { + $s = ($y - $x) / 2.0; + $s = $s * $s + $w; + if ($s > 0) { + $s = sqrt($s); + if ($y < $x) + $s = -$s; + $s = $x - $w / (($y - $x) / 2.0 + $s); + for ($i = $low; $i <= $n; $i++) + $this->H[$i][$i] -= $s; + $exshift += $s; + $x = $y = $w = 0.964; + } + } + // Could check iteration count here. + $iter = $iter + 1; + // Look for two consecutive small sub-diagonal elements + $m = $n - 2; + while ($m >= $l) { + $z = $this->H[$m][$m]; + $r = $x - $z; + $s = $y - $z; + $p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1]; + $q = $this->H[$m+1][$m+1] - $z - $r - $s; + $r = $this->H[$m+2][$m+1]; + $s = abs($p) + abs($q) + abs($r); + $p = $p / $s; + $q = $q / $s; + $r = $r / $s; + if ($m == $l) + break; + if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) < $eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) + break; + $m--; + } + for ($i = $m + 2; $i <= $n; $i++) { + $this->H[$i][$i-2] = 0.0; + if ($i > $m+2) + $this->H[$i][$i-3] = 0.0; + } + // Double QR step involving rows l:n and columns m:n + for ($k = $m; $k <= $n-1; $k++) { + $notlast = ($k != $n-1); + if ($k != $m) { + $p = $this->H[$k][$k-1]; + $q = $this->H[$k+1][$k-1]; + $r = ($notlast ? $this->H[$k+2][$k-1] : 0.0); + $x = abs($p) + abs($q) + abs($r); + if ($x != 0.0) { + $p = $p / $x; + $q = $q / $x; + $r = $r / $x; + } + } + if ($x == 0.0) + break; + $s = sqrt($p * $p + $q * $q + $r * $r); + if ($p < 0) + $s = -$s; + if ($s != 0) { + if ($k != $m) + $this->H[$k][$k-1] = -$s * $x; + else if ($l != $m) + $this->H[$k][$k-1] = -$this->H[$k][$k-1]; + $p = $p + $s; + $x = $p / $s; + $y = $q / $s; + $z = $r / $s; + $q = $q / $p; + $r = $r / $p; + // Row modification + for ($j = $k; $j < $nn; $j++) { + $p = $this->H[$k][$j] + $q * $this->H[$k+1][$j]; + if ($notlast) { + $p = $p + $r * $this->H[$k+2][$j]; + $this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z; + } + $this->H[$k][$j] = $this->H[$k][$j] - $p * $x; + $this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y; + } + // Column modification + for ($i = 0; $i <= min($n, $k+3); $i++) { + $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1]; + if ($notlast) { + $p = $p + $z * $this->H[$i][$k+2]; + $this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r; + } + $this->H[$i][$k] = $this->H[$i][$k] - $p; + $this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q; + } + // Accumulate transformations + for ($i = $low; $i <= $high; $i++) { + $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1]; + if ($notlast) { + $p = $p + $z * $this->V[$i][$k+2]; + $this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r; + } + $this->V[$i][$k] = $this->V[$i][$k] - $p; + $this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q; + } + } // ($s != 0) + } // k loop + } // check convergence + } // while ($n >= $low) + // Backsubstitute to find vectors of upper triangular form + if ($norm == 0.0) + return; + for ($n = $nn-1; $n >= 0; $n--) { + $p = $this->d[$n]; + $q = $this->e[$n]; + // Real vector + if ($q == 0) { + $l = $n; + $this->H[$n][$n] = 1.0; + for ($i = $n-1; $i >= 0; $i--) { + $w = $this->H[$i][$i] - $p; + $r = 0.0; + for ($j = $l; $j <= $n; $j++) + $r = $r + $this->H[$i][$j] * $this->H[$j][$n]; + if ($this->e[$i] < 0.0) { + $z = $w; + $s = $r; + } else { + $l = $i; + if ($this->e[$i] == 0.0) { + if ($w != 0.0) + $this->H[$i][$n] = -$r / $w; + else + $this->H[$i][$n] = -$r / ($eps * $norm); + // Solve real equations + } else { + $x = $this->H[$i][$i+1]; + $y = $this->H[$i+1][$i]; + $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i]; + $t = ($x * $s - $z * $r) / $q; + $this->H[$i][$n] = $t; + if (abs($x) > abs($z)) + $this->H[$i+1][$n] = (-$r - $w * $t) / $x; + else + $this->H[$i+1][$n] = (-$s - $y * $t) / $z; + } + // Overflow control + $t = abs($this->H[$i][$n]); + if (($eps * $t) * $t > 1) { + for ($j = $i; $j <= $n; $j++) + $this->H[$j][$n] = $this->H[$j][$n] / $t; + } + } + } + // Complex vector + } else if ($q < 0) { + $l = $n-1; + // Last vector component imaginary so matrix is triangular + if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) { + $this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1]; + $this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1]; + } else { + $this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q); + $this->H[$n-1][$n-1] = $this->cdivr; + $this->H[$n-1][$n] = $this->cdivi; + } + $this->H[$n][$n-1] = 0.0; + $this->H[$n][$n] = 1.0; + for ($i = $n-2; $i >= 0; $i--) { + // double ra,sa,vr,vi; + $ra = 0.0; + $sa = 0.0; + for ($j = $l; $j <= $n; $j++) { + $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1]; + $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n]; + } + $w = $this->H[$i][$i] - $p; + if ($this->e[$i] < 0.0) { + $z = $w; + $r = $ra; + $s = $sa; + } else { + $l = $i; + if ($this->e[$i] == 0) { + $this->cdiv(-$ra, -$sa, $w, $q); + $this->H[$i][$n-1] = $this->cdivr; + $this->H[$i][$n] = $this->cdivi; + } else { + // Solve complex equations + $x = $this->H[$i][$i+1]; + $y = $this->H[$i+1][$i]; + $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q; + $vi = ($this->d[$i] - $p) * 2.0 * $q; + if ($vr == 0.0 & $vi == 0.0) + $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z)); + $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi); + $this->H[$i][$n-1] = $this->cdivr; + $this->H[$i][$n] = $this->cdivi; + if (abs($x) > (abs($z) + abs($q))) { + $this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x; + $this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x; + } else { + $this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q); + $this->H[$i+1][$n-1] = $this->cdivr; + $this->H[$i+1][$n] = $this->cdivi; + } + } + // Overflow control + $t = max(abs($this->H[$i][$n-1]),abs($this->H[$i][$n])); + if (($eps * $t) * $t > 1) { + for ($j = $i; $j <= $n; $j++) { + $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t; + $this->H[$j][$n] = $this->H[$j][$n] / $t; + } + } + } // end else + } // end for + } // end else for complex case + } // end for + // Vectors of isolated roots + for ($i = 0; $i < $nn; $i++) { + if ($i < $low | $i > $high) { + for ($j = $i; $j < $nn; $j++) + $this->V[$i][$j] = $this->H[$i][$j]; + } + } + // Back transformation to get eigenvectors of original matrix + for ($j = $nn-1; $j >= $low; $j--) { + for ($i = $low; $i <= $high; $i++) { + $z = 0.0; + for ($k = $low; $k <= min($j,$high); $k++) + $z = $z + $this->V[$i][$k] * $this->H[$k][$j]; + $this->V[$i][$j] = $z; + } + } + } // end hqr2 + + /** + * Constructor: Check for symmetry, then construct the eigenvalue decomposition + * @access public + * @param A Square matrix + * @return Structure to access D and V. + */ + function EigenvalueDecomposition($Arg) { + $this->A = $Arg->getArray(); + $this->n = $Arg->getColumnDimension(); + $this->V = array(); + $this->d = array(); + $this->e = array(); + $issymmetric = true; + for ($j = 0; ($j < $this->n) & $issymmetric; $j++) + for ($i = 0; ($i < $this->n) & $issymmetric; $i++) + $issymmetric = ($this->A[$i][$j] == $this->A[$j][$i]); + if ($issymmetric) { + $this->V = $this->A; + // Tridiagonalize. + $this->tred2(); + // Diagonalize. + $this->tql2(); + } else { + $this->H = $this->A; + $this->ort = array(); + // Reduce to Hessenberg form. + $this->orthes(); + // Reduce Hessenberg to real Schur form. + $this->hqr2(); + } + } + + /** + * Return the eigenvector matrix + * @access public + * @return V + */ + function getV() { + return new Matrix($this->V, $this->n, $this->n); + } + + /** + * Return the real parts of the eigenvalues + * @access public + * @return real(diag(D)) + */ + function getRealEigenvalues() { + return $this->d; + } + + /** + * Return the imaginary parts of the eigenvalues + * @access public + * @return imag(diag(D)) + */ + function getImagEigenvalues() { + return $this->e; + } + + /** + * Return the block diagonal eigenvalue matrix + * @access public + * @return D + */ + function getD() { + for ($i = 0; $i < $this->n; $i++) { + $D[$i] = array_fill(0, $this->n, 0.0); + $D[$i][$i] = $this->d[$i]; + if ($this->e[$i] == 0) + continue; + $o = ($this->e[$i] > 0) ? $i + 1 : $i - 1; + $D[$i][$o] = $this->e[$i]; + } + return new Matrix($D); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/LUDecomposition.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/LUDecomposition.php new file mode 100644 index 000000000..de177a5f6 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/LUDecomposition.php @@ -0,0 +1,222 @@ +<?php +/** +* @package JAMA +* +* For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n +* unit lower triangular matrix L, an n-by-n upper triangular matrix U, +* and a permutation vector piv of length m so that A(piv,:) = L*U. +* If m < n, then L is m-by-m and U is m-by-n. +* +* The LU decompostion with pivoting always exists, even if the matrix is +* singular, so the constructor will never fail. The primary use of the +* LU decomposition is in the solution of square systems of simultaneous +* linear equations. This will fail if isNonsingular() returns false. +* +* @author Paul Meagher +* @author Bartosz Matosiuk +* @author Michael Bommarito +* @version 1.1 +* @license PHP v3.0 +*/ +class LUDecomposition { + /** + * Decomposition storage + * @var array + */ + var $LU = array(); + + /** + * Row dimension. + * @var int + */ + var $m; + + /** + * Column dimension. + * @var int + */ + var $n; + + /** + * Pivot sign. + * @var int + */ + var $pivsign; + + /** + * Internal storage of pivot vector. + * @var array + */ + var $piv = array(); + + /** + * LU Decomposition constructor. + * @param $A Rectangular matrix + * @return Structure to access L, U and piv. + */ + function LUDecomposition ($A) { + if( is_a($A, 'Matrix') ) { + // Use a "left-looking", dot-product, Crout/Doolittle algorithm. + $this->LU = $A->getArrayCopy(); + $this->m = $A->getRowDimension(); + $this->n = $A->getColumnDimension(); + for ($i = 0; $i < $this->m; $i++) + $this->piv[$i] = $i; + $this->pivsign = 1; + $LUrowi = array(); + $LUcolj = array(); + // Outer loop. + for ($j = 0; $j < $this->n; $j++) { + // Make a copy of the j-th column to localize references. + for ($i = 0; $i < $this->m; $i++) + $LUcolj[$i] = &$this->LU[$i][$j]; + // Apply previous transformations. + for ($i = 0; $i < $this->m; $i++) { + $LUrowi = $this->LU[$i]; + // Most of the time is spent in the following dot product. + $kmax = min($i,$j); + $s = 0.0; + for ($k = 0; $k < $kmax; $k++) + $s += $LUrowi[$k]*$LUcolj[$k]; + $LUrowi[$j] = $LUcolj[$i] -= $s; + } + // Find pivot and exchange if necessary. + $p = $j; + for ($i = $j+1; $i < $this->m; $i++) { + if (abs($LUcolj[$i]) > abs($LUcolj[$p])) + $p = $i; + } + if ($p != $j) { + for ($k = 0; $k < $this->n; $k++) { + $t = $this->LU[$p][$k]; + $this->LU[$p][$k] = $this->LU[$j][$k]; + $this->LU[$j][$k] = $t; + } + $k = $this->piv[$p]; + $this->piv[$p] = $this->piv[$j]; + $this->piv[$j] = $k; + $this->pivsign = $this->pivsign * -1; + } + // Compute multipliers. + if ( ($j < $this->m) AND ($this->LU[$j][$j] != 0.0) ) { + for ($i = $j+1; $i < $this->m; $i++) + $this->LU[$i][$j] /= $this->LU[$j][$j]; + } + } + } else { + trigger_error(ArgumentTypeException, ERROR); + } + } + + /** + * Get lower triangular factor. + * @return array Lower triangular factor + */ + function getL () { + for ($i = 0; $i < $this->m; $i++) { + for ($j = 0; $j < $this->n; $j++) { + if ($i > $j) + $L[$i][$j] = $this->LU[$i][$j]; + else if($i == $j) + $L[$i][$j] = 1.0; + else + $L[$i][$j] = 0.0; + } + } + return new Matrix($L); + } + + /** + * Get upper triangular factor. + * @return array Upper triangular factor + */ + function getU () { + for ($i = 0; $i < $this->n; $i++) { + for ($j = 0; $j < $this->n; $j++) { + if ($i <= $j) + $U[$i][$j] = $this->LU[$i][$j]; + else + $U[$i][$j] = 0.0; + } + } + return new Matrix($U); + } + + /** + * Return pivot permutation vector. + * @return array Pivot vector + */ + function getPivot () { + return $this->piv; + } + + /** + * Alias for getPivot + * @see getPivot + */ + function getDoublePivot () { + return $this->getPivot(); + } + + /** + * Is the matrix nonsingular? + * @return true if U, and hence A, is nonsingular. + */ + function isNonsingular () { + for ($j = 0; $j < $this->n; $j++) { + if ($this->LU[$j][$j] == 0) + return false; + } + return true; + } + + /** + * Count determinants + * @return array d matrix deterninat + */ + function det() { + if ($this->m == $this->n) { + $d = $this->pivsign; + for ($j = 0; $j < $this->n; $j++) + $d *= $this->LU[$j][$j]; + return $d; + } else { + trigger_error(MatrixDimensionException, ERROR); + } + } + + /** + * Solve A*X = B + * @param $B A Matrix with as many rows as A and any number of columns. + * @return X so that L*U*X = B(piv,:) + * @exception IllegalArgumentException Matrix row dimensions must agree. + * @exception RuntimeException Matrix is singular. + */ + function solve($B) { + if ($B->getRowDimension() == $this->m) { + if ($this->isNonsingular()) { + // Copy right hand side with pivoting + $nx = $B->getColumnDimension(); + $X = $B->getMatrix($this->piv, 0, $nx-1); + // Solve L*Y = B(piv,:) + for ($k = 0; $k < $this->n; $k++) + for ($i = $k+1; $i < $this->n; $i++) + for ($j = 0; $j < $nx; $j++) + $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k]; + // Solve U*X = Y; + for ($k = $this->n-1; $k >= 0; $k--) { + for ($j = 0; $j < $nx; $j++) + $X->A[$k][$j] /= $this->LU[$k][$k]; + for ($i = 0; $i < $k; $i++) + for ($j = 0; $j < $nx; $j++) + $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k]; + } + return $X; + } else { + trigger_error(MatrixSingularException, ERROR); + } + } else { + trigger_error(MatrixSquareException, ERROR); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/Matrix.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/Matrix.php new file mode 100644 index 000000000..c1b79ae04 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/Matrix.php @@ -0,0 +1,1331 @@ +<?php +/** +* @package JAMA +*/ + +define('RAND_MAX', mt_getrandmax()); +define('RAND_MIN', 0); + +require_once 'PHPExcel/Shared/JAMA/utils/Error.php'; +require_once 'PHPExcel/Shared/JAMA/utils/Maths.php'; +require_once 'PHPExcel/Shared/JAMA/CholeskyDecomposition.php'; +require_once 'PHPExcel/Shared/JAMA/LUDecomposition.php'; +require_once 'PHPExcel/Shared/JAMA/QRDecomposition.php'; +require_once 'PHPExcel/Shared/JAMA/EigenvalueDecomposition.php'; +require_once 'PHPExcel/Shared/JAMA/SingularValueDecomposition.php'; + +/* +* Matrix class +* @author Paul Meagher +* @author Michael Bommarito +* @author Lukasz Karapuda +* @author Bartek Matosiuk +* @version 1.8 +* @license PHP v3.0 +* @see http://math.nist.gov/javanumerics/jama/ +*/ +class Matrix { + /** + * Matrix storage + * @var array + * @access private + */ + var $A = array(); + + /** + * Matrix row dimension + * @var int + * @access private + */ + var $m; + + /** + * Matrix column dimension + * @var int + * @access private + */ + var $n; + + /** + * Polymorphic constructor + * As PHP has no support for polymorphic constructors, we hack our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor. + * @return + */ + function Matrix() { + if( func_num_args() > 0 ) { + + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + + //Square matrix - n x n + case 'integer': + $this->m = $args[0]; + $this->n = $args[0]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0)); + break; + + //Rectangular matrix - m x n + case 'integer,integer': + $this->m = $args[0]; + $this->n = $args[1]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0)); + break; + + //Rectangular matrix constant-filled - m x n filled with c + case 'integer,integer,integer': + $this->m = $args[0]; + $this->n = $args[1]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, $args[2])); + break; + + //Rectangular matrix constant-filled - m x n filled with c + case 'integer,integer,double': + $this->m = $args[0]; + $this->n = $args[1]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, $args[2])); + break; + + //Rectangular matrix - m x n initialized from 2D array + case 'array': + $this->m = count($args[0]); + $this->n = count($args[0][0]); + $this->A = $args[0]; + break; + + //Rectangular matrix - m x n initialized from 2D array + case 'array,integer,integer': + $this->m = $args[1]; + $this->n = $args[2]; + $this->A = $args[0]; + break; + + //Rectangular matrix - m x n initialized from packed array + case 'array,integer': + $this->m = $args[1]; + + if ($this->m != 0) + $this->n = count($args[0]) / $this->m; + else + $this->n = 0; + + if ($this->m * $this->n == count($args[0])) + for($i = 0; $i < $this->m; $i++) + for($j = 0; $j < $this->n; $j++) + $this->A[$i][$j] = $args[0][$i + $j * $this->m]; + else + trigger_error(ArrayLengthException, ERROR); + + break; + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else + trigger_error(PolymorphicArgumentException, ERROR); + } + + /** + * getArray + * @return array Matrix array + */ + function &getArray() { + return $this->A; + } + + /** + * getArrayCopy + * @return array Matrix array copy + */ + function getArrayCopy() { + return $this->A; + } + + /** Construct a matrix from a copy of a 2-D array. + * @param double A[][] Two-dimensional array of doubles. + * @exception IllegalArgumentException All rows must have the same length + */ + function constructWithCopy($A) { + $this->m = count($A); + $this->n = count($A[0]); + $X = new Matrix($this->m, $this->n); + for ($i = 0; $i < $this->m; $i++) { + if (count($A[$i]) != $this->n) + trigger_error(RowLengthException, ERROR); + for ($j = 0; $j < $this->n; $j++) + $X->A[$i][$j] = $A[$i][$j]; + } + return $X; + } + + /** + * getColumnPacked + * Get a column-packed array + * @return array Column-packed matrix array + */ + function getColumnPackedCopy() { + $P = array(); + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + array_push($P, $this->A[$j][$i]); + } + } + return $P; + } + + /** + * getRowPacked + * Get a row-packed array + * @return array Row-packed matrix array + */ + function getRowPackedCopy() { + $P = array(); + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + array_push($P, $this->A[$i][$j]); + } + } + return $P; + } + + /** + * getRowDimension + * @return int Row dimension + */ + function getRowDimension() { + return $this->m; + } + + /** + * getColumnDimension + * @return int Column dimension + */ + function getColumnDimension() { + return $this->n; + } + + /** + * get + * Get the i,j-th element of the matrix. + * @param int $i Row position + * @param int $j Column position + * @return mixed Element (int/float/double) + */ + function get( $i = null, $j = null ) { + return $this->A[$i][$j]; + } + + /** + * getMatrix + * Get a submatrix + * @param int $i0 Initial row index + * @param int $iF Final row index + * @param int $j0 Initial column index + * @param int $jF Final column index + * @return Matrix Submatrix + */ + function getMatrix() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + switch( $match ) { + + //A($i0...; $j0...) + case 'integer,integer': + list($i0, $j0) = $args; + $m = $i0 >= 0 ? $this->m - $i0 : trigger_error(ArgumentBoundsException, ERROR); + $n = $j0 >= 0 ? $this->n - $j0 : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m, $n); + + for($i = $i0; $i < $this->m; $i++) + for($j = $j0; $j < $this->n; $j++) + $R->set($i, $j, $this->A[$i][$j]); + + return $R; + break; + + //A($i0...$iF; $j0...$jF) + case 'integer,integer,integer,integer': + list($i0, $iF, $j0, $jF) = $args; + $m = ( ($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0) ) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR); + $n = ( ($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0) ) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m+1, $n+1); + + for($i = $i0; $i <= $iF; $i++) + for($j = $j0; $j <= $jF; $j++) + $R->set($i - $i0, $j - $j0, $this->A[$i][$j]); + + return $R; + break; + + //$R = array of row indices; $C = array of column indices + case 'array,array': + list($RL, $CL) = $args; + $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR); + $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m, $n); + + for($i = 0; $i < $m; $i++) + for($j = 0; $j < $n; $j++) + $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]); + + return $R; + break; + + //$RL = array of row indices; $CL = array of column indices + case 'array,array': + list($RL, $CL) = $args; + $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR); + $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m, $n); + + for($i = 0; $i < $m; $i++) + for($j = 0; $j < $n; $j++) + $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]); + + return $R; + break; + + //A($i0...$iF); $CL = array of column indices + case 'integer,integer,array': + list($i0, $iF, $CL) = $args; + $m = ( ($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0) ) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR); + $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m, $n); + + for($i = $i0; $i < $iF; $i++) + for($j = 0; $j < $n; $j++) + $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]); + + return $R; + break; + + //$RL = array of row indices + case 'array,integer,integer': + list($RL, $j0, $jF) = $args; + $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR); + $n = ( ($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0) ) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR); + $R = new Matrix($m, $n+1); + + for($i = 0; $i < $m; $i++) + for($j = $j0; $j <= $jF; $j++) + $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]); + + return $R; + break; + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * setMatrix + * Set a submatrix + * @param int $i0 Initial row index + * @param int $j0 Initial column index + * @param mixed $S Matrix/Array submatrix + * ($i0, $j0, $S) $S = Matrix + * ($i0, $j0, $S) $S = Array + */ + function setMatrix( ) { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'integer,integer,object': + $M = is_a($args[2], 'Matrix') ? $args[2] : trigger_error(ArgumentTypeException, ERROR); + $i0 = ( ($args[0] + $M->m) <= $this->m ) ? $args[0] : trigger_error(ArgumentBoundsException, ERROR); + $j0 = ( ($args[1] + $M->n) <= $this->n ) ? $args[1] : trigger_error(ArgumentBoundsException, ERROR); + + for($i = $i0; $i < $i0 + $M->m; $i++) { + for($j = $j0; $j < $j0 + $M->n; $j++) { + $this->A[$i][$j] = $M->get($i - $i0, $j - $j0); + } + } + + break; + + case 'integer,integer,array': + $M = new Matrix($args[2]); + $i0 = ( ($args[0] + $M->m) <= $this->m ) ? $args[0] : trigger_error(ArgumentBoundsException, ERROR); + $j0 = ( ($args[1] + $M->n) <= $this->n ) ? $args[1] : trigger_error(ArgumentBoundsException, ERROR); + + for($i = $i0; $i < $i0 + $M->m; $i++) { + for($j = $j0; $j < $j0 + $M->n; $j++) { + $this->A[$i][$j] = $M->get($i - $i0, $j - $j0); + } + } + + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * checkMatrixDimensions + * Is matrix B the same size? + * @param Matrix $B Matrix B + * @return boolean + */ + function checkMatrixDimensions( $B = null ) { + if( is_a($B, 'Matrix') ) + if( ($this->m == $B->m) && ($this->n == $B->n) ) + return true; + else + trigger_error(MatrixDimensionException, ERROR); + + else + trigger_error(ArgumentTypeException, ERROR); + } + + + + /** + * set + * Set the i,j-th element of the matrix. + * @param int $i Row position + * @param int $j Column position + * @param mixed $c Int/float/double value + * @return mixed Element (int/float/double) + */ + function set( $i = null, $j = null, $c = null ) { + // Optimized set version just has this + $this->A[$i][$j] = $c; + /* + if( is_int($i) && is_int($j) && is_numeric($c) ) { + if( ( $i < $this->m ) && ( $j < $this->n ) ) { + $this->A[$i][$j] = $c; + } else { + echo "A[$i][$j] = $c<br />"; + trigger_error(ArgumentBoundsException, WARNING); + } + } else { + trigger_error(ArgumentTypeException, WARNING); + } + */ + } + + /** + * identity + * Generate an identity matrix. + * @param int $m Row dimension + * @param int $n Column dimension + * @return Matrix Identity matrix + */ + function &identity( $m = null, $n = null ) { + return Matrix::diagonal($m, $n, 1); + } + + /** + * diagonal + * Generate a diagonal matrix + * @param int $m Row dimension + * @param int $n Column dimension + * @param mixed $c Diagonal value + * @return Matrix Diagonal matrix + */ + function &diagonal( $m = null, $n = null, $c = 1 ) { + $R = new Matrix($m, $n); + for($i = 0; $i < $m; $i++) + $R->set($i, $i, $c); + return $R; + } + + /** + * filled + * Generate a filled matrix + * @param int $m Row dimension + * @param int $n Column dimension + * @param int $c Fill constant + * @return Matrix Filled matrix + */ + function &filled( $m = null, $n = null, $c = 0 ) { + if( is_int($m) && is_int($n) && is_numeric($c) ) { + $R = new Matrix($m, $n, $c); + return $R; + } else { + trigger_error(ArgumentTypeException, ERROR); + } + } + + /** + * random + * Generate a random matrix + * @param int $m Row dimension + * @param int $n Column dimension + * @return Matrix Random matrix + */ + function &random( $m = null, $n = null, $a = RAND_MIN, $b = RAND_MAX ) { + if( is_int($m) && is_int($n) && is_numeric($a) && is_numeric($b) ) { + $R = new Matrix($m, $n); + + for($i = 0; $i < $m; $i++) + for($j = 0; $j < $n; $j++) + $R->set($i, $j, mt_rand($a, $b)); + + return $R; + } else { + trigger_error(ArgumentTypeException, ERROR); + } + } + + /** + * packed + * Alias for getRowPacked + * @return array Packed array + */ + function &packed() { + return $this->getRowPacked(); + } + + + /** + * getMatrixByRow + * Get a submatrix by row index/range + * @param int $i0 Initial row index + * @param int $iF Final row index + * @return Matrix Submatrix + */ + function getMatrixByRow( $i0 = null, $iF = null ) { + if( is_int($i0) ) { + if( is_int($iF) ) + return $this->getMatrix($i0, 0, $iF + 1, $this->n); + else + return $this->getMatrix($i0, 0, $i0 + 1, $this->n); + } else + trigger_error(ArgumentTypeException, ERROR); + } + + /** + * getMatrixByCol + * Get a submatrix by column index/range + * @param int $i0 Initial column index + * @param int $iF Final column index + * @return Matrix Submatrix + */ + function getMatrixByCol( $j0 = null, $jF = null ) { + if( is_int($j0) ) { + if( is_int($jF) ) + return $this->getMatrix(0, $j0, $this->m, $jF + 1); + else + return $this->getMatrix(0, $j0, $this->m, $j0 + 1); + } else + trigger_error(ArgumentTypeException, ERROR); + } + + /** + * transpose + * Tranpose matrix + * @return Matrix Transposed matrix + */ + function transpose() { + $R = new Matrix($this->n, $this->m); + + for($i = 0; $i < $this->m; $i++) + for($j = 0; $j < $this->n; $j++) + $R->set($j, $i, $this->A[$i][$j]); + + return $R; + } + +/* + public Matrix transpose () { + Matrix X = new Matrix(n,m); + double[][] C = X.getArray(); + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + C[j][i] = A[i][j]; + } + } + return X; + } +*/ + + /** + * norm1 + * One norm + * @return float Maximum column sum + */ + function norm1() { + $r = 0; + + for($j = 0; $j < $this->n; $j++) { + $s = 0; + + for($i = 0; $i < $this->m; $i++) { + $s += abs($this->A[$i][$j]); + } + + $r = ( $r > $s ) ? $r : $s; + } + + return $r; + } + + + /** + * norm2 + * Maximum singular value + * @return float Maximum singular value + */ + function norm2() { + + } + + /** + * normInf + * Infinite norm + * @return float Maximum row sum + */ + function normInf() { + $r = 0; + + for($i = 0; $i < $this->m; $i++) { + $s = 0; + + for($j = 0; $j < $this->n; $j++) { + $s += abs($this->A[$i][$j]); + } + + $r = ( $r > $s ) ? $r : $s; + } + + return $r; + } + + /** + * normF + * Frobenius norm + * @return float Square root of the sum of all elements squared + */ + function normF() { + $f = 0; + for ($i = 0; $i < $this->m; $i++) + for ($j = 0; $j < $this->n; $j++) + $f = hypo($f,$this->A[$i][$j]); + return $f; + } + + /** + * Matrix rank + * @return effective numerical rank, obtained from SVD. + */ + function rank () { + $svd = new SingularValueDecomposition($this); + return $svd->rank(); + } + + /** + * Matrix condition (2 norm) + * @return ratio of largest to smallest singular value. + */ + function cond () { + $svd = new SingularValueDecomposition($this); + return $svd->cond(); + } + + /** + * trace + * Sum of diagonal elements + * @return float Sum of diagonal elements + */ + function trace() { + $s = 0; + $n = min($this->m, $this->n); + + for($i = 0; $i < $n; $i++) + $s += $this->A[$i][$i]; + + return $s; + } + + + /** + * uminus + * Unary minus matrix -A + * @return Matrix Unary minus matrix + */ + function uminus() { + + } + + /** + * plus + * A + B + * @param mixed $B Matrix/Array + * @return Matrix Sum + */ + function plus() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + //$this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + //$this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * plusEquals + * A = A + B + * @param mixed $B Matrix/Array + * @return Matrix Sum + */ + function &plusEquals() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] += $M->get($i, $j); + } + } + + return $this; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] += $M->get($i, $j); + } + } + + return $this; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * minus + * A - B + * @param mixed $B Matrix/Array + * @return Matrix Sum + */ + function minus() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * minusEquals + * A = A - B + * @param mixed $B Matrix/Array + * @return Matrix Sum + */ + function &minusEquals() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] -= $M->get($i, $j); + } + } + + return $this; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] -= $M->get($i, $j); + } + } + + return $this; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * arrayTimes + * Element-by-element multiplication + * Cij = Aij * Bij + * @param mixed $B Matrix/Array + * @return Matrix Matrix Cij + */ + function arrayTimes() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + + /** + * arrayTimesEquals + * Element-by-element multiplication + * Aij = Aij * Bij + * @param mixed $B Matrix/Array + * @return Matrix Matrix Aij + */ + function &arrayTimesEquals() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] *= $M->get($i, $j); + } + } + + return $this; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] *= $M->get($i, $j); + } + } + + return $this; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * arrayRightDivide + * Element-by-element right division + * A / B + * @param Matrix $B Matrix B + * @return Matrix Division result + */ + function arrayRightDivide() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $this->A[$i][$j] / $M->get($i, $j) ); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $this->A[$i][$j] / $M->get($i, $j)); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * arrayRightDivideEquals + * Element-by-element right division + * Aij = Aij / Bij + * @param mixed $B Matrix/Array + * @return Matrix Matrix Aij + */ + function &arrayRightDivideEquals() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * arrayLeftDivide + * Element-by-element Left division + * A / B + * @param Matrix $B Matrix B + * @return Matrix Division result + */ + function arrayLeftDivide() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j] ); + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j] ); + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * arrayLeftDivideEquals + * Element-by-element Left division + * Aij = Aij / Bij + * @param mixed $B Matrix/Array + * @return Matrix Matrix Aij + */ + function &arrayLeftDivideEquals() { + if( func_num_args() > 0 ) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + + switch( $match ) { + case 'object': + $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j]; + } + } + + return $M; + break; + + case 'array': + $M = new Matrix($args[0]); + $this->checkMatrixDimensions($M); + + for($i = 0; $i < $this->m; $i++) { + for($j = 0; $j < $this->n; $j++) { + $this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j]; + } + } + + return $M; + break; + + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else { + trigger_error(PolymorphicArgumentException, ERROR); + } + } + + /** + * times + * Matrix multiplication + * @param mixed $n Matrix/Array/Scalar + * @return Matrix Product + */ + function times() { + if(func_num_args() > 0) { + $args = func_get_args(); + $match = implode(",", array_map('gettype', $args)); + switch($match) { + case 'object': + $B = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR); + if($this->n == $B->m) { + $C = new Matrix($this->m, $B->n); + for($j = 0; $j < $B->n; $j++ ) { + for ($k = 0; $k < $this->n; $k++) + $Bcolj[$k] = $B->A[$k][$j]; + for($i = 0; $i < $this->m; $i++ ) { + $Arowi = $this->A[$i]; + $s = 0; + for( $k = 0; $k < $this->n; $k++ ) + $s += $Arowi[$k] * $Bcolj[$k]; + $C->A[$i][$j] = $s; + } + } + return $C; + } else + trigger_error(MatrixDimensionMismatch, FATAL); + break; + + case 'array': + $B = new Matrix($args[0]); + if($this->n == $B->m) { + $C = new Matrix($this->m, $B->n); + for($i = 0; $i < $C->m; $i++) { + for($j = 0; $j < $C->n; $j++) { + $s = "0"; + for($k = 0; $k < $C->n; $k++) + $s += $this->A[$i][$k] * $B->A[$k][$j]; + $C->A[$i][$j] = $s; + } + } + return $C; + } else + trigger_error(MatrixDimensionMismatch, FATAL); + return $M; + break; + case 'integer': + $C = new Matrix($this->A); + for($i = 0; $i < $C->m; $i++) + for($j = 0; $j < $C->n; $j++) + $C->A[$i][$j] *= $args[0]; + return $C; + break; + case 'double': + $C = new Matrix($this->m, $this->n); + for($i = 0; $i < $C->m; $i++) + for($j = 0; $j < $C->n; $j++) + $C->A[$i][$j] = $args[0] * $this->A[$i][$j]; + return $C; + break; + case 'float': + $C = new Matrix($this->A); + for($i = 0; $i < $C->m; $i++) + for($j = 0; $j < $C->n; $j++) + $C->A[$i][$j] *= $args[0]; + return $C; + break; + default: + trigger_error(PolymorphicArgumentException, ERROR); + break; + } + } else + trigger_error(PolymorphicArgumentException, ERROR); + } + + /** + * chol + * Cholesky decomposition + * @return Matrix Cholesky decomposition + */ + function chol() { + return new CholeskyDecomposition($this); + } + + /** + * lu + * LU decomposition + * @return Matrix LU decomposition + */ + function lu() { + return new LUDecomposition($this); + } + + /** + * qr + * QR decomposition + * @return Matrix QR decomposition + */ + function qr() { + return new QRDecomposition($this); + } + + + /** + * eig + * Eigenvalue decomposition + * @return Matrix Eigenvalue decomposition + */ + function eig() { + return new EigenvalueDecomposition($this); + } + + /** + * svd + * Singular value decomposition + * @return Singular value decomposition + */ + function svd() { + return new SingularValueDecomposition($this); + } + + /** + * Solve A*X = B. + * @param Matrix $B Right hand side + * @return Matrix ... Solution if A is square, least squares solution otherwise + */ + function solve($B) { + if ($this->m == $this->n) { + $LU = new LUDecomposition($this); + return $LU->solve($B); + } else { + $QR = new QRDecomposition($this); + return $QR->solve($B); + } + } + + /** + * Matrix inverse or pseudoinverse. + * @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise. + */ + function inverse() { + return $this->solve($this->identity($this->m, $this->m)); + } + + + /** + * det + * Calculate determinant + * @return float Determinant + */ + function det() { + $L = new LUDecomposition($this); + return $L->det(); + } + + /** + * Older debugging utility for backwards compatability. + * @return html version of matrix + */ + function mprint($A, $format="%01.2f", $width=2) { + $spacing = ""; + $m = count($A); + $n = count($A[0]); + for($i = 0; $i < $width; $i++) + $spacing .= "&nbsp;"; + for ($i = 0; $i < $m; $i++) { + for ($j = 0; $j < $n; $j++) { + $formatted = sprintf($format, $A[$i][$j]); + echo $formatted . $spacing; + } + echo "<br />"; + } + } + + /** + * Debugging utility. + * @return Output HTML representation of matrix + */ + function toHTML($width=2) { + print( '<table style="background-color:#eee;">'); + for( $i = 0; $i < $this->m; $i++ ) { + print( '<tr>' ); + for( $j = 0; $j < $this->n; $j++ ) + print( '<td style="background-color:#fff;border:1px solid #000;padding:2px;text-align:center;vertical-align:middle;">' . $this->A[$i][$j] . '</td>' ); + print( '</tr>'); + } + print( '</table>' ); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/QRDecomposition.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/QRDecomposition.php new file mode 100644 index 000000000..f86b4e0f8 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/QRDecomposition.php @@ -0,0 +1,195 @@ +<?php +/** +* @package JAMA +* +* For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n +* orthogonal matrix Q and an n-by-n upper triangular matrix R so that +* A = Q*R. +* +* The QR decompostion always exists, even if the matrix does not have +* full rank, so the constructor will never fail. The primary use of the +* QR decomposition is in the least squares solution of nonsquare systems +* of simultaneous linear equations. This will fail if isFullRank() +* returns false. +* +* @author Paul Meagher +* @license PHP v3.0 +* @version 1.1 +*/ +class QRDecomposition { + /** + * Array for internal storage of decomposition. + * @var array + */ + var $QR = array(); + + /** + * Row dimension. + * @var integer + */ + var $m; + + /** + * Column dimension. + * @var integer + */ + var $n; + + /** + * Array for internal storage of diagonal of R. + * @var array + */ + var $Rdiag = array(); + + /** + * QR Decomposition computed by Householder reflections. + * @param matrix $A Rectangular matrix + * @return Structure to access R and the Householder vectors and compute Q. + */ + function QRDecomposition($A) { + if( is_a($A, 'Matrix') ) { + // Initialize. + $this->QR = $A->getArrayCopy(); + $this->m = $A->getRowDimension(); + $this->n = $A->getColumnDimension(); + // Main loop. + for ($k = 0; $k < $this->n; $k++) { + // Compute 2-norm of k-th column without under/overflow. + $nrm = 0.0; + for ($i = $k; $i < $this->m; $i++) + $nrm = hypo($nrm, $this->QR[$i][$k]); + if ($nrm != 0.0) { + // Form k-th Householder vector. + if ($this->QR[$k][$k] < 0) + $nrm = -$nrm; + for ($i = $k; $i < $this->m; $i++) + $this->QR[$i][$k] /= $nrm; + $this->QR[$k][$k] += 1.0; + // Apply transformation to remaining columns. + for ($j = $k+1; $j < $this->n; $j++) { + $s = 0.0; + for ($i = $k; $i < $this->m; $i++) + $s += $this->QR[$i][$k] * $this->QR[$i][$j]; + $s = -$s/$this->QR[$k][$k]; + for ($i = $k; $i < $this->m; $i++) + $this->QR[$i][$j] += $s * $this->QR[$i][$k]; + } + } + $this->Rdiag[$k] = -$nrm; + } + } else + trigger_error(ArgumentTypeException, ERROR); + } + + /** + * Is the matrix full rank? + * @return boolean true if R, and hence A, has full rank, else false. + */ + function isFullRank() { + for ($j = 0; $j < $this->n; $j++) + if ($this->Rdiag[$j] == 0) + return false; + return true; + } + + /** + * Return the Householder vectors + * @return Matrix Lower trapezoidal matrix whose columns define the reflections + */ + function getH() { + for ($i = 0; $i < $this->m; $i++) { + for ($j = 0; $j < $this->n; $j++) { + if ($i >= $j) + $H[$i][$j] = $this->QR[$i][$j]; + else + $H[$i][$j] = 0.0; + } + } + return new Matrix($H); + } + + /** + * Return the upper triangular factor + * @return Matrix upper triangular factor + */ + function getR() { + for ($i = 0; $i < $this->n; $i++) { + for ($j = 0; $j < $this->n; $j++) { + if ($i < $j) + $R[$i][$j] = $this->QR[$i][$j]; + else if ($i == $j) + $R[$i][$j] = $this->Rdiag[$i]; + else + $R[$i][$j] = 0.0; + } + } + return new Matrix($R); + } + + /** + * Generate and return the (economy-sized) orthogonal factor + * @return Matrix orthogonal factor + */ + function getQ() { + for ($k = $this->n-1; $k >= 0; $k--) { + for ($i = 0; $i < $this->m; $i++) + $Q[$i][$k] = 0.0; + $Q[$k][$k] = 1.0; + for ($j = $k; $j < $this->n; $j++) { + if ($this->QR[$k][$k] != 0) { + $s = 0.0; + for ($i = $k; $i < $this->m; $i++) + $s += $this->QR[$i][$k] * $Q[$i][$j]; + $s = -$s/$this->QR[$k][$k]; + for ($i = $k; $i < $this->m; $i++) + $Q[$i][$j] += $s * $this->QR[$i][$k]; + } + } + } + /* + for( $i = 0; $i < count($Q); $i++ ) + for( $j = 0; $j < count($Q); $j++ ) + if(! isset($Q[$i][$j]) ) + $Q[$i][$j] = 0; + */ + return new Matrix($Q); + } + + /** + * Least squares solution of A*X = B + * @param Matrix $B A Matrix with as many rows as A and any number of columns. + * @return Matrix Matrix that minimizes the two norm of Q*R*X-B. + */ + function solve($B) { + if ($B->getRowDimension() == $this->m) { + if ($this->isFullRank()) { + // Copy right hand side + $nx = $B->getColumnDimension(); + $X = $B->getArrayCopy(); + // Compute Y = transpose(Q)*B + for ($k = 0; $k < $this->n; $k++) { + for ($j = 0; $j < $nx; $j++) { + $s = 0.0; + for ($i = $k; $i < $this->m; $i++) + $s += $this->QR[$i][$k] * $X[$i][$j]; + $s = -$s/$this->QR[$k][$k]; + for ($i = $k; $i < $this->m; $i++) + $X[$i][$j] += $s * $this->QR[$i][$k]; + } + } + // Solve R*X = Y; + for ($k = $this->n-1; $k >= 0; $k--) { + for ($j = 0; $j < $nx; $j++) + $X[$k][$j] /= $this->Rdiag[$k]; + for ($i = 0; $i < $k; $i++) + for ($j = 0; $j < $nx; $j++) + $X[$i][$j] -= $X[$k][$j]* $this->QR[$i][$k]; + } + $X = new Matrix($X); + return ($X->getMatrix(0, $this->n-1, 0, $nx)); + } else + trigger_error(MatrixRankException, ERROR); + } else + trigger_error(MatrixDimensionException, ERROR); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/SingularValueDecomposition.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/SingularValueDecomposition.php new file mode 100644 index 000000000..4fec7116f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/SingularValueDecomposition.php @@ -0,0 +1,501 @@ +<?php +/** +* @package JAMA +* +* For an m-by-n matrix A with m >= n, the singular value decomposition is +* an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and +* an n-by-n orthogonal matrix V so that A = U*S*V'. +* +* The singular values, sigma[$k] = S[$k][$k], are ordered so that +* sigma[0] >= sigma[1] >= ... >= sigma[n-1]. +* +* The singular value decompostion always exists, so the constructor will +* never fail. The matrix condition number and the effective numerical +* rank can be computed from this decomposition. +* +* @author Paul Meagher +* @license PHP v3.0 +* @version 1.1 +*/ +class SingularValueDecomposition { + + /** + * Internal storage of U. + * @var array + */ + var $U = array(); + + /** + * Internal storage of V. + * @var array + */ + var $V = array(); + + /** + * Internal storage of singular values. + * @var array + */ + var $s = array(); + + /** + * Row dimension. + * @var int + */ + var $m; + + /** + * Column dimension. + * @var int + */ + var $n; + + /** + * Construct the singular value decomposition + * + * Derived from LINPACK code. + * + * @param $A Rectangular matrix + * @return Structure to access U, S and V. + */ + function SingularValueDecomposition ($Arg) { + + // Initialize. + + $A = $Arg->getArrayCopy(); + $this->m = $Arg->getRowDimension(); + $this->n = $Arg->getColumnDimension(); + $nu = min($this->m, $this->n); + $e = array(); + $work = array(); + $wantu = true; + $wantv = true; + $nct = min($this->m - 1, $this->n); + $nrt = max(0, min($this->n - 2, $this->m)); + + // Reduce A to bidiagonal form, storing the diagonal elements + // in s and the super-diagonal elements in e. + + for ($k = 0; $k < max($nct,$nrt); $k++) { + + if ($k < $nct) { + // Compute the transformation for the k-th column and + // place the k-th diagonal in s[$k]. + // Compute 2-norm of k-th column without under/overflow. + $this->s[$k] = 0; + for ($i = $k; $i < $this->m; $i++) + $this->s[$k] = hypo($this->s[$k], $A[$i][$k]); + if ($this->s[$k] != 0.0) { + if ($A[$k][$k] < 0.0) + $this->s[$k] = -$this->s[$k]; + for ($i = $k; $i < $this->m; $i++) + $A[$i][$k] /= $this->s[$k]; + $A[$k][$k] += 1.0; + } + $this->s[$k] = -$this->s[$k]; + } + + for ($j = $k + 1; $j < $this->n; $j++) { + if (($k < $nct) & ($this->s[$k] != 0.0)) { + // Apply the transformation. + $t = 0; + for ($i = $k; $i < $this->m; $i++) + $t += $A[$i][$k] * $A[$i][$j]; + $t = -$t / $A[$k][$k]; + for ($i = $k; $i < $this->m; $i++) + $A[$i][$j] += $t * $A[$i][$k]; + // Place the k-th row of A into e for the + // subsequent calculation of the row transformation. + $e[$j] = $A[$k][$j]; + } + } + + if ($wantu AND ($k < $nct)) { + // Place the transformation in U for subsequent back + // multiplication. + for ($i = $k; $i < $this->m; $i++) + $this->U[$i][$k] = $A[$i][$k]; + } + + if ($k < $nrt) { + // Compute the k-th row transformation and place the + // k-th super-diagonal in e[$k]. + // Compute 2-norm without under/overflow. + $e[$k] = 0; + for ($i = $k + 1; $i < $this->n; $i++) + $e[$k] = hypo($e[$k], $e[$i]); + if ($e[$k] != 0.0) { + if ($e[$k+1] < 0.0) + $e[$k] = -$e[$k]; + for ($i = $k + 1; $i < $this->n; $i++) + $e[$i] /= $e[$k]; + $e[$k+1] += 1.0; + } + $e[$k] = -$e[$k]; + if (($k+1 < $this->m) AND ($e[$k] != 0.0)) { + // Apply the transformation. + for ($i = $k+1; $i < $this->m; $i++) + $work[$i] = 0.0; + for ($j = $k+1; $j < $this->n; $j++) + for ($i = $k+1; $i < $this->m; $i++) + $work[$i] += $e[$j] * $A[$i][$j]; + for ($j = $k + 1; $j < $this->n; $j++) { + $t = -$e[$j] / $e[$k+1]; + for ($i = $k + 1; $i < $this->m; $i++) + $A[$i][$j] += $t * $work[$i]; + } + } + if ($wantv) { + // Place the transformation in V for subsequent + // back multiplication. + for ($i = $k + 1; $i < $this->n; $i++) + $this->V[$i][$k] = $e[$i]; + } + } + } + + // Set up the final bidiagonal matrix or order p. + $p = min($this->n, $this->m + 1); + if ($nct < $this->n) + $this->s[$nct] = $A[$nct][$nct]; + if ($this->m < $p) + $this->s[$p-1] = 0.0; + if ($nrt + 1 < $p) + $e[$nrt] = $A[$nrt][$p-1]; + $e[$p-1] = 0.0; + // If required, generate U. + if ($wantu) { + for ($j = $nct; $j < $nu; $j++) { + for ($i = 0; $i < $this->m; $i++) + $this->U[$i][$j] = 0.0; + $this->U[$j][$j] = 1.0; + } + for ($k = $nct - 1; $k >= 0; $k--) { + if ($this->s[$k] != 0.0) { + for ($j = $k + 1; $j < $nu; $j++) { + $t = 0; + for ($i = $k; $i < $this->m; $i++) + $t += $this->U[$i][$k] * $this->U[$i][$j]; + $t = -$t / $this->U[$k][$k]; + for ($i = $k; $i < $this->m; $i++) + $this->U[$i][$j] += $t * $this->U[$i][$k]; + } + for ($i = $k; $i < $this->m; $i++ ) + $this->U[$i][$k] = -$this->U[$i][$k]; + $this->U[$k][$k] = 1.0 + $this->U[$k][$k]; + for ($i = 0; $i < $k - 1; $i++) + $this->U[$i][$k] = 0.0; + } else { + for ($i = 0; $i < $this->m; $i++) + $this->U[$i][$k] = 0.0; + $this->U[$k][$k] = 1.0; + } + } + } + + // If required, generate V. + if ($wantv) { + for ($k = $this->n - 1; $k >= 0; $k--) { + if (($k < $nrt) AND ($e[$k] != 0.0)) { + for ($j = $k + 1; $j < $nu; $j++) { + $t = 0; + for ($i = $k + 1; $i < $this->n; $i++) + $t += $this->V[$i][$k]* $this->V[$i][$j]; + $t = -$t / $this->V[$k+1][$k]; + for ($i = $k + 1; $i < $this->n; $i++) + $this->V[$i][$j] += $t * $this->V[$i][$k]; + } + } + for ($i = 0; $i < $this->n; $i++) + $this->V[$i][$k] = 0.0; + $this->V[$k][$k] = 1.0; + } + } + + // Main iteration loop for the singular values. + $pp = $p - 1; + $iter = 0; + $eps = pow(2.0, -52.0); + while ($p > 0) { + + // Here is where a test for too many iterations would go. + // This section of the program inspects for negligible + // elements in the s and e arrays. On completion the + // variables kase and k are set as follows: + // kase = 1 if s(p) and e[k-1] are negligible and k<p + // kase = 2 if s(k) is negligible and k<p + // kase = 3 if e[k-1] is negligible, k<p, and + // s(k), ..., s(p) are not negligible (qr step). + // kase = 4 if e(p-1) is negligible (convergence). + + for ($k = $p - 2; $k >= -1; $k--) { + if ($k == -1) + break; + if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) { + $e[$k] = 0.0; + break; + } + } + if ($k == $p - 2) + $kase = 4; + else { + for ($ks = $p - 1; $ks >= $k; $ks--) { + if ($ks == $k) + break; + $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.); + if (abs($this->s[$ks]) <= $eps * $t) { + $this->s[$ks] = 0.0; + break; + } + } + if ($ks == $k) + $kase = 3; + else if ($ks == $p-1) + $kase = 1; + else { + $kase = 2; + $k = $ks; + } + } + $k++; + + // Perform the task indicated by kase. + switch ($kase) { + // Deflate negligible s(p). + case 1: + $f = $e[$p-2]; + $e[$p-2] = 0.0; + for ($j = $p - 2; $j >= $k; $j--) { + $t = hypo($this->s[$j],$f); + $cs = $this->s[$j] / $t; + $sn = $f / $t; + $this->s[$j] = $t; + if ($j != $k) { + $f = -$sn * $e[$j-1]; + $e[$j-1] = $cs * $e[$j-1]; + } + if ($wantv) { + for ($i = 0; $i < $this->n; $i++) { + $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1]; + $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1]; + $this->V[$i][$j] = $t; + } + } + } + break; + // Split at negligible s(k). + case 2: + $f = $e[$k-1]; + $e[$k-1] = 0.0; + for ($j = $k; $j < $p; $j++) { + $t = hypo($this->s[$j], $f); + $cs = $this->s[$j] / $t; + $sn = $f / $t; + $this->s[$j] = $t; + $f = -$sn * $e[$j]; + $e[$j] = $cs * $e[$j]; + if ($wantu) { + for ($i = 0; $i < $this->m; $i++) { + $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1]; + $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1]; + $this->U[$i][$j] = $t; + } + } + } + break; + // Perform one qr step. + case 3: + // Calculate the shift. + $scale = max(max(max(max( + abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])), + abs($this->s[$k])), abs($e[$k])); + $sp = $this->s[$p-1] / $scale; + $spm1 = $this->s[$p-2] / $scale; + $epm1 = $e[$p-2] / $scale; + $sk = $this->s[$k] / $scale; + $ek = $e[$k] / $scale; + $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0; + $c = ($sp * $epm1) * ($sp * $epm1); + $shift = 0.0; + if (($b != 0.0) || ($c != 0.0)) { + $shift = sqrt($b * $b + $c); + if ($b < 0.0) + $shift = -$shift; + $shift = $c / ($b + $shift); + } + $f = ($sk + $sp) * ($sk - $sp) + $shift; + $g = $sk * $ek; + // Chase zeros. + for ($j = $k; $j < $p-1; $j++) { + $t = hypo($f,$g); + $cs = $f/$t; + $sn = $g/$t; + if ($j != $k) + $e[$j-1] = $t; + $f = $cs * $this->s[$j] + $sn * $e[$j]; + $e[$j] = $cs * $e[$j] - $sn * $this->s[$j]; + $g = $sn * $this->s[$j+1]; + $this->s[$j+1] = $cs * $this->s[$j+1]; + if ($wantv) { + for ($i = 0; $i < $this->n; $i++) { + $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1]; + $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1]; + $this->V[$i][$j] = $t; + } + } + $t = hypo($f,$g); + $cs = $f/$t; + $sn = $g/$t; + $this->s[$j] = $t; + $f = $cs * $e[$j] + $sn * $this->s[$j+1]; + $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1]; + $g = $sn * $e[$j+1]; + $e[$j+1] = $cs * $e[$j+1]; + if ($wantu && ($j < $this->m - 1)) { + for ($i = 0; $i < $this->m; $i++) { + $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1]; + $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1]; + $this->U[$i][$j] = $t; + } + } + } + $e[$p-2] = $f; + $iter = $iter + 1; + break; + // Convergence. + case 4: + // Make the singular values positive. + if ($this->s[$k] <= 0.0) { + $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0); + if ($wantv) { + for ($i = 0; $i <= $pp; $i++) + $this->V[$i][$k] = -$this->V[$i][$k]; + } + } + // Order the singular values. + while ($k < $pp) { + if ($this->s[$k] >= $this->s[$k+1]) + break; + $t = $this->s[$k]; + $this->s[$k] = $this->s[$k+1]; + $this->s[$k+1] = $t; + if ($wantv AND ($k < $this->n - 1)) { + for ($i = 0; $i < $this->n; $i++) { + $t = $this->V[$i][$k+1]; + $this->V[$i][$k+1] = $this->V[$i][$k]; + $this->V[$i][$k] = $t; + } + } + if ($wantu AND ($k < $this->m-1)) { + for ($i = 0; $i < $this->m; $i++) { + $t = $this->U[$i][$k+1]; + $this->U[$i][$k+1] = $this->U[$i][$k]; + $this->U[$i][$k] = $t; + } + } + $k++; + } + $iter = 0; + $p--; + break; + } // end switch + } // end while + + /* + echo "<p>Output A</p>"; + $A = new Matrix($A); + $A->toHTML(); + + echo "<p>Matrix U</p>"; + echo "<pre>"; + print_r($this->U); + echo "</pre>"; + + echo "<p>Matrix V</p>"; + echo "<pre>"; + print_r($this->V); + echo "</pre>"; + + echo "<p>Vector S</p>"; + echo "<pre>"; + print_r($this->s); + echo "</pre>"; + exit; + */ + + } // end constructor + + /** + * Return the left singular vectors + * @access public + * @return U + */ + function getU() { + return new Matrix($this->U, $this->m, min($this->m + 1, $this->n)); + } + + /** + * Return the right singular vectors + * @access public + * @return V + */ + function getV() { + return new Matrix($this->V); + } + + /** + * Return the one-dimensional array of singular values + * @access public + * @return diagonal of S. + */ + function getSingularValues() { + return $this->s; + } + + /** + * Return the diagonal matrix of singular values + * @access public + * @return S + */ + function getS() { + for ($i = 0; $i < $this->n; $i++) { + for ($j = 0; $j < $this->n; $j++) + $S[$i][$j] = 0.0; + $S[$i][$i] = $this->s[$i]; + } + return new Matrix($S); + } + + /** + * Two norm + * @access public + * @return max(S) + */ + function norm2() { + return $this->s[0]; + } + + /** + * Two norm condition number + * @access public + * @return max(S)/min(S) + */ + function cond() { + return $this->s[0] / $this->s[min($this->m, $this->n) - 1]; + } + + /** + * Effective numerical matrix rank + * @access public + * @return Number of nonnegligible singular values. + */ + function rank() { + $eps = pow(2.0, -52.0); + $tol = max($this->m, $this->n) * $this->s[0] * $eps; + $r = 0; + for ($i = 0; $i < count($this->s); $i++) { + if ($this->s[$i] > $tol) + $r++; + } + return $r; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Error.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Error.php new file mode 100644 index 000000000..29628a8e7 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Error.php @@ -0,0 +1,120 @@ +<?php +/** +* @package JAMA +* +* Error handling +* @author Michael Bommarito +* @version 01292005 +*/ + +//Language constant +define('LANG', 'EN'); + + +//Error type constants +define('ERROR', E_USER_ERROR); +define('WARNING', E_USER_WARNING); +define('NOTICE', E_USER_NOTICE); + +//All errors may be defined by the following format: +//define('ExceptionName', N); +//$error['lang'][N] = 'Error message'; +$error = array(); + +/* +I've used Babelfish and a little poor knowledge of Romance/Germanic languages for the translations +here. Feel free to correct anything that looks amiss to you. +*/ + +define('PolymorphicArgumentException', -1); +$error['EN'][-1] = "Invalid argument pattern for polymorphic function."; +$error['FR'][-1] = "Modèle inadmissible d'argument pour la fonction polymorphe.". +$error['DE'][-1] = "Unzulässiges Argumentmuster für polymorphe Funktion."; + +define('ArgumentTypeException', -2); +$error['EN'][-2] = "Invalid argument type."; +$error['FR'][-2] = "Type inadmissible d'argument."; +$error['DE'][-2] = "Unzulässige Argumentart."; + +define('ArgumentBoundsException', -3); +$error['EN'][-3] = "Invalid argument range."; +$error['FR'][-3] = "Gamme inadmissible d'argument."; +$error['DE'][-3] = "Unzulässige Argumentstrecke."; + +define('MatrixDimensionException', -4); +$error['EN'][-4] = "Matrix dimensions are not equal."; +$error['FR'][-4] = "Les dimensions de Matrix ne sont pas égales."; +$error['DE'][-4] = "Matrixmaße sind nicht gleich."; + +define('PrecisionLossException', -5); +$error['EN'][-5] = "Significant precision loss detected."; +$error['FR'][-5] = "Perte significative de précision détectée."; +$error['DE'][-5] = "Bedeutender Präzision Verlust ermittelte."; + +define('MatrixSPDException', -6); +$error['EN'][-6] = "Can only perform operation on symmetric positive definite matrix."; +$error['FR'][-6] = "Perte significative de précision détectée."; +$error['DE'][-6] = "Bedeutender Präzision Verlust ermittelte."; + +define('MatrixSingularException', -7); +$error['EN'][-7] = "Can only perform operation on singular matrix."; + +define('MatrixRankException', -8); +$error['EN'][-8] = "Can only perform operation on full-rank matrix."; + +define('ArrayLengthException', -9); +$error['EN'][-9] = "Array length must be a multiple of m."; + +define('RowLengthException', -10); +$error['EN'][-10] = "All rows must have the same length."; + +/** +* Custom error handler +* @param int $type Error type: {ERROR, WARNING, NOTICE} +* @param int $num Error number +* @param string $file File in which the error occured +* @param int $line Line on which the error occured +*/ +function JAMAError( $type = null, $num = null, $file = null, $line = null, $context = null ) { + global $error; + + $lang = LANG; + if( isset($type) && isset($num) && isset($file) && isset($line) ) { + switch( $type ) { + case ERROR: + echo '<div class="errror"><b>Error:</b> ' . $error[$lang][$num] . '<br />' . $file . ' @ L' . $line . '</div>'; + die(); + break; + + case WARNING: + echo '<div class="warning"><b>Warning:</b> ' . $error[$lang][$num] . '<br />' . $file . ' @ L' . $line . '</div>'; + break; + + case NOTICE: + //echo '<div class="notice"><b>Notice:</b> ' . $error[$lang][$num] . '<br />' . $file . ' @ L' . $line . '</div>'; + break; + + case E_NOTICE: + //echo '<div class="errror"><b>Notice:</b> ' . $error[$lang][$num] . '<br />' . $file . ' @ L' . $line . '</div>'; + break; + + case E_STRICT: + break; + + case E_WARNING: + break; + + default: + echo "<div class=\"error\"><b>Unknown Error Type:</b> $type - $file @ L{$line}</div>"; + die(); + break; + } + } else { + die( "Invalid arguments to JAMAError()" ); + } +} + +// TODO MarkBaker +//set_error_handler('JAMAError'); +//error_reporting(ERROR | WARNING); + diff --git a/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Maths.php b/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Maths.php new file mode 100644 index 000000000..dfe7733cb --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/JAMA/utils/Maths.php @@ -0,0 +1,40 @@ +<?php +/** +* @package JAMA +* +* Pythagorean Theorem: +* +* a = 3 +* b = 4 +* r = sqrt(square(a) + square(b)) +* r = 5 +* +* r = sqrt(a^2 + b^2) without under/overflow. +*/ +function hypo($a, $b) { + if (abs($a) > abs($b)) { + $r = $b/$a; + $r = abs($a)* sqrt(1+$r*$r); + } else if ($b != 0) { + $r = $a/$b; + $r = abs($b)*sqrt(1+$r*$r); + } else + $r = 0.0; + return $r; +} + +/** +* Mike Bommarito's version. +* Compute n-dimensional hyotheneuse. +* +function hypot() { + $s = 0; + foreach (func_get_args() as $d) { + if (is_numeric($d)) + $s += pow($d, 2); + else + trigger_error(ArgumentTypeException, ERROR); + } + return sqrt($s); +} +*/ diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLE.php b/libraries/PHPExcel/PHPExcel/Shared/OLE.php new file mode 100644 index 000000000..f65c24fad --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLE.php @@ -0,0 +1,555 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Author: Xavier Noguer <xnoguer@php.net> | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +// $Id: OLE.php,v 1.13 2007/03/07 14:38:25 schmidt Exp $ + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_PPS.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_File.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_Root.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/ChainedBlockStream.php'; + +/** +* Array for storing OLE instances that are accessed from +* OLE_ChainedBlockStream::stream_open(). +* @var array +*/ +$GLOBALS['_OLE_INSTANCES'] = array(); + +/** +* OLE package base class. +* +* @author Xavier Noguer <xnoguer@php.net> +* @author Christian Schmidt <schmidt@php.net> +* @category PHPExcel +* @package PHPExcel_Shared_OLE +*/ +class PHPExcel_Shared_OLE +{ + const OLE_PPS_TYPE_ROOT = 5; + const OLE_PPS_TYPE_DIR = 1; + const OLE_PPS_TYPE_FILE = 2; + const OLE_DATA_SIZE_SMALL = 0x1000; + const OLE_LONG_INT_SIZE = 4; + const OLE_PPS_SIZE = 0x80; + + /** + * The file handle for reading an OLE container + * @var resource + */ + public $_file_handle; + + /** + * Array of PPS's found on the OLE container + * @var array + */ + public $_list = array(); + + /** + * Root directory of OLE container + * @var OLE_PPS_Root + */ + public $root; + + /** + * Big Block Allocation Table + * @var array (blockId => nextBlockId) + */ + public $bbat; + + /** + * Short Block Allocation Table + * @var array (blockId => nextBlockId) + */ + public $sbat; + + /** + * Size of big blocks. This is usually 512. + * @var int number of octets per block. + */ + public $bigBlockSize; + + /** + * Size of small blocks. This is usually 64. + * @var int number of octets per block + */ + public $smallBlockSize; + + /** + * Reads an OLE container from the contents of the file given. + * + * @acces public + * @param string $file + * @return mixed true on success, PEAR_Error on failure + */ + public function read($file) + { + $fh = fopen($file, "r"); + if (!$fh) { + throw new Exception("Can't open file $file"); + } + $this->_file_handle = $fh; + + $signature = fread($fh, 8); + if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) { + throw new Exception("File doesn't seem to be an OLE container."); + } + fseek($fh, 28); + if (fread($fh, 2) != "\xFE\xFF") { + // This shouldn't be a problem in practice + throw new Exception("Only Little-Endian encoding is supported."); + } + // Size of blocks and short blocks in bytes + $this->bigBlockSize = pow(2, $this->_readInt2($fh)); + $this->smallBlockSize = pow(2, $this->_readInt2($fh)); + + // Skip UID, revision number and version number + fseek($fh, 44); + // Number of blocks in Big Block Allocation Table + $bbatBlockCount = $this->_readInt4($fh); + + // Root chain 1st block + $directoryFirstBlockId = $this->_readInt4($fh); + + // Skip unused bytes + fseek($fh, 56); + // Streams shorter than this are stored using small blocks + $this->bigBlockThreshold = $this->_readInt4($fh); + // Block id of first sector in Short Block Allocation Table + $sbatFirstBlockId = $this->_readInt4($fh); + // Number of blocks in Short Block Allocation Table + $sbbatBlockCount = $this->_readInt4($fh); + // Block id of first sector in Master Block Allocation Table + $mbatFirstBlockId = $this->_readInt4($fh); + // Number of blocks in Master Block Allocation Table + $mbbatBlockCount = $this->_readInt4($fh); + $this->bbat = array(); + + // Remaining 4 * 109 bytes of current block is beginning of Master + // Block Allocation Table + $mbatBlocks = array(); + for ($i = 0; $i < 109; ++$i) { + $mbatBlocks[] = $this->_readInt4($fh); + } + + // Read rest of Master Block Allocation Table (if any is left) + $pos = $this->_getBlockOffset($mbatFirstBlockId); + for ($i = 0; $i < $mbbatBlockCount; ++$i) { + fseek($fh, $pos); + for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) { + $mbatBlocks[] = $this->_readInt4($fh); + } + // Last block id in each block points to next block + $pos = $this->_getBlockOffset($this->_readInt4($fh)); + } + + // Read Big Block Allocation Table according to chain specified by + // $mbatBlocks + for ($i = 0; $i < $bbatBlockCount; ++$i) { + $pos = $this->_getBlockOffset($mbatBlocks[$i]); + fseek($fh, $pos); + for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) { + $this->bbat[] = $this->_readInt4($fh); + } + } + + // Read short block allocation table (SBAT) + $this->sbat = array(); + $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4; + $sbatFh = $this->getStream($sbatFirstBlockId); + for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) { + $this->sbat[$blockId] = $this->_readInt4($sbatFh); + } + fclose($sbatFh); + + $this->_readPpsWks($directoryFirstBlockId); + + return true; + } + + /** + * @param int block id + * @param int byte offset from beginning of file + * @access public + */ + public function _getBlockOffset($blockId) + { + return 512 + $blockId * $this->bigBlockSize; + } + + /** + * Returns a stream for use with fread() etc. External callers should + * use PHPExcel_Shared_OLE_PPS_File::getStream(). + * @param int|PPS block id or PPS + * @return resource read-only stream + */ + public function getStream($blockIdOrPps) + { + static $isRegistered = false; + if (!$isRegistered) { + stream_wrapper_register('ole-chainedblockstream', + 'PHPExcel_Shared_OLE_ChainedBlockStream'); + $isRegistered = true; + } + + // Store current instance in global array, so that it can be accessed + // in OLE_ChainedBlockStream::stream_open(). + // Object is removed from self::$instances in OLE_Stream::close(). + $GLOBALS['_OLE_INSTANCES'][] = $this; + $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES'])); + + $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; + if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) { + $path .= '&blockId=' . $blockIdOrPps->_StartBlock; + $path .= '&size=' . $blockIdOrPps->Size; + } else { + $path .= '&blockId=' . $blockIdOrPps; + } + return fopen($path, 'r'); + } + + /** + * Reads a signed char. + * @param resource file handle + * @return int + * @access public + */ + public function _readInt1($fh) + { + list(, $tmp) = unpack("c", fread($fh, 1)); + return $tmp; + } + + /** + * Reads an unsigned short (2 octets). + * @param resource file handle + * @return int + * @access public + */ + public function _readInt2($fh) + { + list(, $tmp) = unpack("v", fread($fh, 2)); + return $tmp; + } + + /** + * Reads an unsigned long (4 octets). + * @param resource file handle + * @return int + * @access public + */ + public function _readInt4($fh) + { + list(, $tmp) = unpack("V", fread($fh, 4)); + return $tmp; + } + + /** + * Gets information about all PPS's on the OLE container from the PPS WK's + * creates an OLE_PPS object for each one. + * + * @access public + * @param integer the block id of the first block + * @return mixed true on success, PEAR_Error on failure + */ + public function _readPpsWks($blockId) + { + $fh = $this->getStream($blockId); + for ($pos = 0; ; $pos += 128) { + fseek($fh, $pos, SEEK_SET); + $nameUtf16 = fread($fh, 64); + $nameLength = $this->_readInt2($fh); + $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2); + // Simple conversion from UTF-16LE to ISO-8859-1 + $name = str_replace("\x00", "", $nameUtf16); + $type = $this->_readInt1($fh); + switch ($type) { + case self::OLE_PPS_TYPE_ROOT: + $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array()); + $this->root = $pps; + break; + case self::OLE_PPS_TYPE_DIR: + $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, + null, null, null, null, array()); + break; + case self::OLE_PPS_TYPE_FILE: + $pps = new PHPExcel_Shared_OLE_PPS_File($name); + break; + default: + continue; + } + fseek($fh, 1, SEEK_CUR); + $pps->Type = $type; + $pps->Name = $name; + $pps->PrevPps = $this->_readInt4($fh); + $pps->NextPps = $this->_readInt4($fh); + $pps->DirPps = $this->_readInt4($fh); + fseek($fh, 20, SEEK_CUR); + $pps->Time1st = self::OLE2LocalDate(fread($fh, 8)); + $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8)); + $pps->_StartBlock = $this->_readInt4($fh); + $pps->Size = $this->_readInt4($fh); + $pps->No = count($this->_list); + $this->_list[] = $pps; + + // check if the PPS tree (starting from root) is complete + if (isset($this->root) && + $this->_ppsTreeComplete($this->root->No)) { + + break; + } + } + fclose($fh); + + // Initialize $pps->children on directories + foreach ($this->_list as $pps) { + if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) { + $nos = array($pps->DirPps); + $pps->children = array(); + while ($nos) { + $no = array_pop($nos); + if ($no != -1) { + $childPps = $this->_list[$no]; + $nos[] = $childPps->PrevPps; + $nos[] = $childPps->NextPps; + $pps->children[] = $childPps; + } + } + } + } + + return true; + } + + /** + * It checks whether the PPS tree is complete (all PPS's read) + * starting with the given PPS (not necessarily root) + * + * @access public + * @param integer $index The index of the PPS from which we are checking + * @return boolean Whether the PPS tree for the given PPS is complete + */ + public function _ppsTreeComplete($index) + { + return isset($this->_list[$index]) && + ($pps = $this->_list[$index]) && + ($pps->PrevPps == -1 || + $this->_ppsTreeComplete($pps->PrevPps)) && + ($pps->NextPps == -1 || + $this->_ppsTreeComplete($pps->NextPps)) && + ($pps->DirPps == -1 || + $this->_ppsTreeComplete($pps->DirPps)); + } + + /** + * Checks whether a PPS is a File PPS or not. + * If there is no PPS for the index given, it will return false. + * + * @access public + * @param integer $index The index for the PPS + * @return bool true if it's a File PPS, false otherwise + */ + public function isFile($index) + { + if (isset($this->_list[$index])) { + return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE); + } + return false; + } + + /** + * Checks whether a PPS is a Root PPS or not. + * If there is no PPS for the index given, it will return false. + * + * @access public + * @param integer $index The index for the PPS. + * @return bool true if it's a Root PPS, false otherwise + */ + public function isRoot($index) + { + if (isset($this->_list[$index])) { + return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT); + } + return false; + } + + /** + * Gives the total number of PPS's found in the OLE container. + * + * @access public + * @return integer The total number of PPS's found in the OLE container + */ + public function ppsTotal() + { + return count($this->_list); + } + + /** + * Gets data from a PPS + * If there is no PPS for the index given, it will return an empty string. + * + * @access public + * @param integer $index The index for the PPS + * @param integer $position The position from which to start reading + * (relative to the PPS) + * @param integer $length The amount of bytes to read (at most) + * @return string The binary string containing the data requested + * @see OLE_PPS_File::getStream() + */ + public function getData($index, $position, $length) + { + // if position is not valid return empty string + if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) { + return ''; + } + $fh = $this->getStream($this->_list[$index]); + $data = stream_get_contents($fh, $length, $position); + fclose($fh); + return $data; + } + + /** + * Gets the data length from a PPS + * If there is no PPS for the index given, it will return 0. + * + * @access public + * @param integer $index The index for the PPS + * @return integer The amount of bytes in data the PPS has + */ + public function getDataLength($index) + { + if (isset($this->_list[$index])) { + return $this->_list[$index]->Size; + } + return 0; + } + + /** + * Utility function to transform ASCII text to Unicode + * + * @access public + * @static + * @param string $ascii The ASCII string to transform + * @return string The string in Unicode + */ + public static function Asc2Ucs($ascii) + { + $rawname = ''; + for ($i = 0; $i < strlen($ascii); ++$i) { + $rawname .= $ascii{$i} . "\x00"; + } + return $rawname; + } + + /** + * Utility function + * Returns a string for the OLE container with the date given + * + * @access public + * @static + * @param integer $date A timestamp + * @return string The string for the OLE container + */ + public static function LocalDate2OLE($date = null) + { + if (!isset($date)) { + return "\x00\x00\x00\x00\x00\x00\x00\x00"; + } + + // factor used for separating numbers into 4 bytes parts + $factor = pow(2, 32); + + // days from 1-1-1601 until the beggining of UNIX era + $days = 134774; + // calculate seconds + $big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date), + date("m",$date),date("d",$date),date("Y",$date)); + // multiply just to make MS happy + $big_date *= 10000000; + + $high_part = floor($big_date / $factor); + // lower 4 bytes + $low_part = floor((($big_date / $factor) - $high_part) * $factor); + + // Make HEX string + $res = ''; + + for ($i = 0; $i < 4; ++$i) { + $hex = $low_part % 0x100; + $res .= pack('c', $hex); + $low_part /= 0x100; + } + for ($i = 0; $i < 4; ++$i) { + $hex = $high_part % 0x100; + $res .= pack('c', $hex); + $high_part /= 0x100; + } + return $res; + } + + /** + * Returns a timestamp from an OLE container's date + * + * @access public + * @static + * @param integer $string A binary string with the encoded date + * @return string The timestamp corresponding to the string + */ + public static function OLE2LocalDate($string) + { + if (strlen($string) != 8) { + return new PEAR_Error("Expecting 8 byte string"); + } + + // factor used for separating numbers into 4 bytes parts + $factor = pow(2,32); + $high_part = 0; + for ($i = 0; $i < 4; ++$i) { + list(, $high_part) = unpack('C', $string{(7 - $i)}); + if ($i < 3) { + $high_part *= 0x100; + } + } + $low_part = 0; + for ($i = 4; $i < 8; ++$i) { + list(, $low_part) = unpack('C', $string{(7 - $i)}); + if ($i < 7) { + $low_part *= 0x100; + } + } + $big_date = ($high_part * $factor) + $low_part; + // translate to seconds + $big_date /= 10000000; + + // days from 1-1-1601 until the beggining of UNIX era + $days = 134774; + + // translate to seconds from beggining of UNIX era + $big_date -= $days * 24 * 3600; + return floor($big_date); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLE/ChainedBlockStream.php b/libraries/PHPExcel/PHPExcel/Shared/OLE/ChainedBlockStream.php new file mode 100644 index 000000000..f9673f071 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLE/ChainedBlockStream.php @@ -0,0 +1,234 @@ +<?php +/** + * PHPExcel + * + * Copyright (C) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_OLE + * @copyright Copyright (c) 2006 - 2007 Christian Schmidt + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE.php'; + +/** + * PHPExcel_Shared_OLE_ChainedBlockStream + * + * Stream wrapper for reading data stored in an OLE file. Implements methods + * for PHP's stream_wrapper_register(). For creating streams using this + * wrapper, use PHPExcel_Shared_OLE_PPS_File::getStream(). + * + * @category PHPExcel + * @package PHPExcel_Shared_OLE + */ +class PHPExcel_Shared_OLE_ChainedBlockStream +{ + /** + * The OLE container of the file that is being read. + * @var OLE + */ + public $ole; + + /** + * Parameters specified by fopen(). + * @var array + */ + public $params; + + /** + * The binary data of the file. + * @var string + */ + public $data; + + /** + * The file pointer. + * @var int byte offset + */ + public $pos; + + /** + * Implements support for fopen(). + * For creating streams using this wrapper, use OLE_PPS_File::getStream(). + * @param string resource name including scheme, e.g. + * ole-chainedblockstream://oleInstanceId=1 + * @param string only "r" is supported + * @param int mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH + * @param string absolute path of the opened stream (out parameter) + * @return bool true on success + */ + public function stream_open($path, $mode, $options, &$openedPath) + { + if ($mode != 'r') { + if ($options & STREAM_REPORT_ERRORS) { + trigger_error('Only reading is supported', E_USER_WARNING); + } + return false; + } + + // 25 is length of "ole-chainedblockstream://" + parse_str(substr($path, 25), $this->params); + if (!isset($this->params['oleInstanceId'], + $this->params['blockId'], + $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) { + + if ($options & STREAM_REPORT_ERRORS) { + trigger_error('OLE stream not found', E_USER_WARNING); + } + return false; + } + $this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']]; + + $blockId = $this->params['blockId']; + $this->data = ''; + if (isset($this->params['size']) && + $this->params['size'] < $this->ole->bigBlockThreshold && + $blockId != $this->ole->root->_StartBlock) { + + // Block id refers to small blocks + $rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock); + while ($blockId != -2) { + $pos = $rootPos + $blockId * $this->ole->bigBlockSize; + $blockId = $this->ole->sbat[$blockId]; + fseek($this->ole->_file_handle, $pos); + $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize); + } + } else { + // Block id refers to big blocks + while ($blockId != -2) { + $pos = $this->ole->_getBlockOffset($blockId); + fseek($this->ole->_file_handle, $pos); + $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize); + $blockId = $this->ole->bbat[$blockId]; + } + } + if (isset($this->params['size'])) { + $this->data = substr($this->data, 0, $this->params['size']); + } + + if ($options & STREAM_USE_PATH) { + $openedPath = $path; + } + + return true; + } + + /** + * Implements support for fclose(). + * @return string + */ + public function stream_close() + { + $this->ole = null; + unset($GLOBALS['_OLE_INSTANCES']); + } + + /** + * Implements support for fread(), fgets() etc. + * @param int maximum number of bytes to read + * @return string + */ + public function stream_read($count) + { + if ($this->stream_eof()) { + return false; + } + $s = substr($this->data, $this->pos, $count); + $this->pos += $count; + return $s; + } + + /** + * Implements support for feof(). + * @return bool TRUE if the file pointer is at EOF; otherwise FALSE + */ + public function stream_eof() + { + $eof = $this->pos >= strlen($this->data); + // Workaround for bug in PHP 5.0.x: http://bugs.php.net/27508 + if (version_compare(PHP_VERSION, '5.0', '>=') && + version_compare(PHP_VERSION, '5.1', '<')) { + + $eof = !$eof; + } + return $eof; + } + + /** + * Returns the position of the file pointer, i.e. its offset into the file + * stream. Implements support for ftell(). + * @return int + */ + public function stream_tell() + { + return $this->pos; + } + + /** + * Implements support for fseek(). + * @param int byte offset + * @param int SEEK_SET, SEEK_CUR or SEEK_END + * @return bool + */ + public function stream_seek($offset, $whence) + { + if ($whence == SEEK_SET && $offset >= 0) { + $this->pos = $offset; + } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) { + $this->pos += $offset; + } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) { + $this->pos = strlen($this->data) + $offset; + } else { + return false; + } + return true; + } + + /** + * Implements support for fstat(). Currently the only supported field is + * "size". + * @return array + */ + public function stream_stat() + { + return array( + 'size' => strlen($this->data), + ); + } + + // Methods used by stream_wrapper_register() that are not implemented: + // bool stream_flush ( void ) + // int stream_write ( string data ) + // bool rename ( string path_from, string path_to ) + // bool mkdir ( string path, int mode, int options ) + // bool rmdir ( string path, int options ) + // bool dir_opendir ( string path, int options ) + // array url_stat ( string path, int flags ) + // string dir_readdir ( void ) + // bool dir_rewinddir ( void ) + // bool dir_closedir ( void ) +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php new file mode 100644 index 000000000..02ec4c97f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php @@ -0,0 +1,130 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Author: Xavier Noguer <xnoguer@php.net> | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +// $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_PPS.php'; + +/** +* Class for creating File PPS's for OLE containers +* +* @author Xavier Noguer <xnoguer@php.net> +* @category PHPExcel +* @package PHPExcel_Shared_OLE +*/ +class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS + { + /** + * The temporary dir for storing the OLE file + * @var string + */ + public $_tmp_dir; + + /** + * The constructor + * + * @access public + * @param string $name The name of the file (in Unicode) + * @see OLE::Asc2Ucs() + */ + public function __construct($name) + { + $this->_tmp_dir = ''; + parent::__construct( + null, + $name, + PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, + null, + null, + null, + null, + null, + '', + array()); + } + + /** + * Sets the temp dir used for storing the OLE file + * + * @access public + * @param string $dir The dir to be used as temp dir + * @return true if given dir is valid, false otherwise + */ + public function setTempDir($dir) + { + if (is_dir($dir)) { + $this->_tmp_dir = $dir; + return true; + } + return false; + } + + /** + * Initialization method. Has to be called right after OLE_PPS_File(). + * + * @access public + * @return mixed true on success + */ + public function init() + { + $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File"); + $fh = fopen($this->_tmp_filename, "w+b"); + if ($fh === false) { + throw new Exception("Can't create temporary file"); + } + $this->_PPS_FILE = $fh; + if ($this->_PPS_FILE) { + fseek($this->_PPS_FILE, 0); + } + return true; + } + + /** + * Append data to PPS + * + * @access public + * @param string $data The data to append + */ + public function append($data) + { + if ($this->_PPS_FILE) { + fwrite($this->_PPS_FILE, $data); + } else { + $this->_data .= $data; + } + } + + /** + * Returns a stream for reading this file using fread() etc. + * @return resource a read-only stream + */ + public function getStream() + { + $this->ole->getStream($this); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_PPS.php b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_PPS.php new file mode 100644 index 000000000..a0d6ad292 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_PPS.php @@ -0,0 +1,228 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Author: Xavier Noguer <xnoguer@php.net> | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +// $Id: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE.php'; + +/** +* Class for creating PPS's for OLE containers +* +* @author Xavier Noguer <xnoguer@php.net> +* @category PHPExcel +* @package PHPExcel_Shared_OLE +*/ +class PHPExcel_Shared_OLE_PPS +{ + /** + * The PPS index + * @var integer + */ + public $No; + + /** + * The PPS name (in Unicode) + * @var string + */ + public $Name; + + /** + * The PPS type. Dir, Root or File + * @var integer + */ + public $Type; + + /** + * The index of the previous PPS + * @var integer + */ + public $PrevPps; + + /** + * The index of the next PPS + * @var integer + */ + public $NextPps; + + /** + * The index of it's first child if this is a Dir or Root PPS + * @var integer + */ + public $DirPps; + + /** + * A timestamp + * @var integer + */ + public $Time1st; + + /** + * A timestamp + * @var integer + */ + public $Time2nd; + + /** + * Starting block (small or big) for this PPS's data inside the container + * @var integer + */ + public $_StartBlock; + + /** + * The size of the PPS's data (in bytes) + * @var integer + */ + public $Size; + + /** + * The PPS's data (only used if it's not using a temporary file) + * @var string + */ + public $_data; + + /** + * Array of child PPS's (only used by Root and Dir PPS's) + * @var array + */ + public $children = array(); + + /** + * Pointer to OLE container + * @var OLE + */ + public $ole; + + /** + * The constructor + * + * @access public + * @param integer $No The PPS index + * @param string $name The PPS name + * @param integer $type The PPS type. Dir, Root or File + * @param integer $prev The index of the previous PPS + * @param integer $next The index of the next PPS + * @param integer $dir The index of it's first child if this is a Dir or Root PPS + * @param integer $time_1st A timestamp + * @param integer $time_2nd A timestamp + * @param string $data The (usually binary) source data of the PPS + * @param array $children Array containing children PPS for this PPS + */ + public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children) + { + $this->No = $No; + $this->Name = $name; + $this->Type = $type; + $this->PrevPps = $prev; + $this->NextPps = $next; + $this->DirPps = $dir; + $this->Time1st = $time_1st; + $this->Time2nd = $time_2nd; + $this->_data = $data; + $this->children = $children; + if ($data != '') { + $this->Size = strlen($data); + } else { + $this->Size = 0; + } + } + + /** + * Returns the amount of data saved for this PPS + * + * @access public + * @return integer The amount of data (in bytes) + */ + public function _DataLen() + { + if (!isset($this->_data)) { + return 0; + } + if (isset($this->_PPS_FILE)) { + fseek($this->_PPS_FILE, 0); + $stats = fstat($this->_PPS_FILE); + return $stats[7]; + } else { + return strlen($this->_data); + } + } + + /** + * Returns a string with the PPS's WK (What is a WK?) + * + * @access public + * @return string The binary string + */ + public function _getPpsWk() + { + $ret = $this->Name; + for ($i = 0; $i < (64 - strlen($this->Name)); ++$i) { + $ret .= "\x00"; + } + $ret .= pack("v", strlen($this->Name) + 2) // 66 + . pack("c", $this->Type) // 67 + . pack("c", 0x00) //UK // 68 + . pack("V", $this->PrevPps) //Prev // 72 + . pack("V", $this->NextPps) //Next // 76 + . pack("V", $this->DirPps) //Dir // 80 + . "\x00\x09\x02\x00" // 84 + . "\x00\x00\x00\x00" // 88 + . "\xc0\x00\x00\x00" // 92 + . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root + . "\x00\x00\x00\x00" // 100 + . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108 + . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116 + . pack("V", isset($this->_StartBlock)? + $this->_StartBlock:0) // 120 + . pack("V", $this->Size) // 124 + . pack("V", 0); // 128 + return $ret; + } + + /** + * Updates index and pointers to previous, next and children PPS's for this + * PPS. I don't think it'll work with Dir PPS's. + * + * @access public + * @param array &$pps_array Reference to the array of PPS's for the whole OLE + * container + * @return integer The index for this PPS + */ + public function _savePpsSetPnt(&$pps_array) + { + $pps_array[count($pps_array)] = &$this; + $this->No = count($pps_array) - 1; + $this->PrevPps = 0xFFFFFFFF; + $this->NextPps = 0xFFFFFFFF; + if (count($this->children) > 0) { + $this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array); + } else { + $this->DirPps = 0xFFFFFFFF; + } + return $this->No; + } + } diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_Root.php b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_Root.php new file mode 100644 index 000000000..fd4bc947b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_Root.php @@ -0,0 +1,489 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Author: Xavier Noguer <xnoguer@php.net> | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +// $Id: Root.php,v 1.9 2005/04/23 21:53:49 dufuz Exp $ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_PPS.php'; + +/** +* Class for creating Root PPS's for OLE containers +* +* @author Xavier Noguer <xnoguer@php.net> +* @category PHPExcel +* @package PHPExcel_Shared_OLE +*/ +class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS + { + /** + * The temporary dir for storing the OLE file + * @var string + */ + public $_tmp_dir; + + /** + * @param integer $time_1st A timestamp + * @param integer $time_2nd A timestamp + */ + public function __construct($time_1st, $time_2nd, $raChild) + { + $this->_tmp_dir = ''; + parent::__construct( + null, + PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'), + PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT, + null, + null, + null, + $time_1st, + $time_2nd, + null, + $raChild); + } + + /** + * Sets the temp dir used for storing the OLE file + * + * @access public + * @param string $dir The dir to be used as temp dir + * @return true if given dir is valid, false otherwise + */ + public function setTempDir($dir) + { + if (is_dir($dir)) { + $this->_tmp_dir = $dir; + return true; + } + return false; + } + + /** + * Method for saving the whole OLE container (including files). + * In fact, if called with an empty argument (or '-'), it saves to a + * temporary file and then outputs it's contents to stdout. + * + * @param string $filename The name of the file where to save the OLE container + * @access public + * @return mixed true on success + */ + public function save($filename) + { + // Initial Setting for saving + $this->_BIG_BLOCK_SIZE = pow(2, + ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); + $this->_SMALL_BLOCK_SIZE= pow(2, + ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); + + // Open temp file if we are sending output to stdout + if ($filename == '-' || $filename == '') { + $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); + $this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); + if ($this->_FILEH_ == false) { + throw new Exception("Can't create temporary file."); + } + } else { + $this->_FILEH_ = fopen($filename, "wb"); + if ($this->_FILEH_ == false) { + throw new Exception("Can't open $filename. It may be in use or protected."); + } + } + // Make an array of PPS's (for Save) + $aList = array(); + $this->_savePpsSetPnt($aList); + // calculate values for header + list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo); + // Save Header + $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt); + + // Make Small Data string (write SBD) + $this->_data = $this->_makeSmallData($aList); + + // Write BB + $this->_saveBigData($iSBDcnt, $aList); + // Write PPS + $this->_savePps($aList); + // Write Big Block Depot and BDList and Adding Header informations + $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt); + // Close File, send it to stdout if necessary + if (($filename == '-') || ($filename == '')) { + fseek($this->_FILEH_, 0); + fpassthru($this->_FILEH_); + fclose($this->_FILEH_); + // Delete the temporary file. + unlink($this->_tmp_filename); + } else { + fclose($this->_FILEH_); + } + + return true; + } + + /** + * Calculate some numbers + * + * @access public + * @param array $raList Reference to an array of PPS's + * @return array The array of numbers + */ + public function _calcSize(&$raList) + { + // Calculate Basic Setting + list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0); + $iSmallLen = 0; + $iSBcnt = 0; + for ($i = 0; $i < count($raList); ++$i) { + if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + $raList[$i]->Size = $raList[$i]->_DataLen(); + if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); + } else { + $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); + } + } + } + $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; + $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0); + $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + + (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); + $iCnt = count($raList); + $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; + $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); + + return array($iSBDcnt, $iBBcnt, $iPPScnt); + } + + /** + * Helper function for caculating a magic value for block sizes + * + * @access public + * @param integer $i2 The argument + * @see save() + * @return integer + */ + public function _adjust2($i2) + { + $iWk = log($i2)/log(2); + return ($iWk > floor($iWk))? floor($iWk)+1:$iWk; + } + + /** + * Save OLE header + * + * @access public + * @param integer $iSBDcnt + * @param integer $iBBcnt + * @param integer $iPPScnt + */ + public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) + { + $FILE = $this->_FILEH_; + + // Calculate Basic Setting + $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + + $iBdExL = 0; + $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; + $iAllW = $iAll; + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); + + // Calculate BD count + if ($iBdCnt > $i1stBdL) { + while (1) { + ++$iBdExL; + ++$iAllW; + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); + if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) { + break; + } + } + } + + // Save Header + fwrite($FILE, + "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . pack("v", 0x3b) + . pack("v", 0x03) + . pack("v", -2) + . pack("v", 9) + . pack("v", 6) + . pack("v", 0) + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . pack("V", $iBdCnt) + . pack("V", $iBBcnt+$iSBDcnt) //ROOT START + . pack("V", 0) + . pack("V", 0x1000) + . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot + . pack("V", 1) + ); + // Extra BDList Start, Count + if ($iBdCnt < $i1stBdL) { + fwrite($FILE, + pack("V", -2). // Extra BDList Start + pack("V", 0) // Extra BDList Count + ); + } else { + fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); + } + + // BDList + for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) { + fwrite($FILE, pack("V", $iAll+$i)); + } + if ($i < $i1stBdL) { + for ($j = 0; $j < ($i1stBdL-$i); ++$j) { + fwrite($FILE, (pack("V", -1))); + } + } + } + + /** + * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * + * @access public + * @param integer $iStBlk + * @param array &$raList Reference to array of PPS's + */ + public function _saveBigData($iStBlk, &$raList) + { + $FILE = $this->_FILEH_; + + // cycle through PPS's + for ($i = 0; $i < count($raList); ++$i) { + if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) { + $raList[$i]->Size = $raList[$i]->_DataLen(); + if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || + (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) + { + // Write Data + if (isset($raList[$i]->_PPS_FILE)) { + $iLen = 0; + fseek($raList[$i]->_PPS_FILE, 0); // To The Top + while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) { + $iLen += strlen($sBuff); + fwrite($FILE, $sBuff); + } + } else { + fwrite($FILE, $raList[$i]->_data); + } + + if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) { + for ($j = 0; $j < ($this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)); ++$j) { + fwrite($FILE, "\x00"); + } + } + // Set For PPS + $raList[$i]->_StartBlock = $iStBlk; + $iStBlk += + (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); + } + // Close file for each PPS, and unlink it + if (isset($raList[$i]->_PPS_FILE)) { + fclose($raList[$i]->_PPS_FILE); + $raList[$i]->_PPS_FILE = null; + unlink($raList[$i]->_tmp_filename); + } + } + } + } + + /** + * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) + * + * @access public + * @param array &$raList Reference to array of PPS's + */ + public function _makeSmallData(&$raList) + { + $sRes = ''; + $FILE = $this->_FILEH_; + $iSmBlk = 0; + + for ($i = 0; $i < count($raList); ++$i) { + // Make SBD, small data string + if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Size <= 0) { + continue; + } + if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) { + $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); + // Add to SBD + for ($j = 0; $j < ($iSmbCnt-1); ++$j) { + fwrite($FILE, pack("V", $j+$iSmBlk+1)); + } + fwrite($FILE, pack("V", -2)); + + // Add to Data String(this will be written for RootEntry) + if ($raList[$i]->_PPS_FILE) { + fseek($raList[$i]->_PPS_FILE, 0); // To The Top + while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) { + $sRes .= $sBuff; + } + } else { + $sRes .= $raList[$i]->_data; + } + if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) { + for ($j = 0; $j < ($this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)); ++$j) { + $sRes .= "\x00"; + } + } + // Set for PPS + $raList[$i]->_StartBlock = $iSmBlk; + $iSmBlk += $iSmbCnt; + } + } + } + $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE); + if ($iSmBlk % $iSbCnt) { + for ($i = 0; $i < ($iSbCnt - ($iSmBlk % $iSbCnt)); ++$i) { + fwrite($FILE, pack("V", -1)); + } + } + return $sRes; + } + + /** + * Saves all the PPS's WKs + * + * @access public + * @param array $raList Reference to an array with all PPS's + */ + public function _savePps(&$raList) + { + // Save each PPS WK + for ($i = 0; $i < count($raList); ++$i) { + fwrite($this->_FILEH_, $raList[$i]->_getPpsWk()); + } + // Adjust for Block + $iCnt = count($raList); + $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; + if ($iCnt % $iBCnt) { + for ($i = 0; $i < (($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE); ++$i) { + fwrite($this->_FILEH_, "\x00"); + } + } + } + + /** + * Saving Big Block Depot + * + * @access public + * @param integer $iSbdSize + * @param integer $iBsize + * @param integer $iPpsCnt + */ + public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) + { + $FILE = $this->_FILEH_; + // Calculate Basic Setting + $iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE; + + $iBdExL = 0; + $iAll = $iBsize + $iPpsCnt + $iSbdSize; + $iAllW = $iAll; + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); + // Calculate BD count + if ($iBdCnt >$i1stBdL) { + while (1) { + ++$iBdExL; + ++$iAllW; + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); + if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) { + break; + } + } + } + + // Making BD + // Set for SBD + if ($iSbdSize > 0) { + for ($i = 0; $i < ($iSbdSize - 1); ++$i) { + fwrite($FILE, pack("V", $i+1)); + } + fwrite($FILE, pack("V", -2)); + } + // Set for B + for ($i = 0; $i < ($iBsize - 1); ++$i) { + fwrite($FILE, pack("V", $i+$iSbdSize+1)); + } + fwrite($FILE, pack("V", -2)); + + // Set for PPS + for ($i = 0; $i < ($iPpsCnt - 1); ++$i) { + fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1)); + } + fwrite($FILE, pack("V", -2)); + // Set for BBD itself ( 0xFFFFFFFD : BBD) + for ($i = 0; $i < $iBdCnt; ++$i) { + fwrite($FILE, pack("V", 0xFFFFFFFD)); + } + // Set for ExtraBDList + for ($i = 0; $i < $iBdExL; ++$i) { + fwrite($FILE, pack("V", 0xFFFFFFFC)); + } + // Adjust for Block + if (($iAllW + $iBdCnt) % $iBbCnt) { + for ($i = 0; $i < ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt)); ++$i) { + fwrite($FILE, pack("V", -1)); + } + } + // Extra BDList + if ($iBdCnt > $i1stBdL) { + $iN=0; + $iNb=0; + for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) { + if ($iN >= ($iBbCnt - 1)) { + $iN = 0; + ++$iNb; + fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb)); + } + fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i)); + } + if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) { + for ($i = 0; $i < (($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1))); ++$i) { + fwrite($FILE, pack("V", -1)); + } + } + fwrite($FILE, pack("V", -2)); + } + } + } diff --git a/libraries/PHPExcel/PHPExcel/Shared/OLERead.php b/libraries/PHPExcel/PHPExcel/Shared/OLERead.php new file mode 100644 index 000000000..6ccaab9b8 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/OLERead.php @@ -0,0 +1,305 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); + +class PHPExcel_Shared_OLERead { + private $data = ''; + + // OLE identifier + const IDENTIFIER_OLE = IDENTIFIER_OLE; + + // Size of a sector = 512 bytes + const BIG_BLOCK_SIZE = 0x200; + + // Size of a short sector = 64 bytes + const SMALL_BLOCK_SIZE = 0x40; + + // Size of a directory entry always = 128 bytes + const PROPERTY_STORAGE_BLOCK_SIZE = 0x80; + + // Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams + const SMALL_BLOCK_THRESHOLD = 0x1000; + + // header offsets + const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c; + const ROOT_START_BLOCK_POS = 0x30; + const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c; + const EXTENSION_BLOCK_POS = 0x44; + const NUM_EXTENSION_BLOCK_POS = 0x48; + const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c; + + // property storage offsets (directory offsets) + const SIZE_OF_NAME_POS = 0x40; + const TYPE_POS = 0x42; + const START_BLOCK_POS = 0x74; + const SIZE_POS = 0x78; + + /** + * Read the file + * + * @param $sFileName string Filename + * @throws Exception + */ + public function read($sFileName) + { + // Check if file exists and is readable + if(!is_readable($sFileName)) { + throw new Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); + } + + // Get the file data + $this->data = file_get_contents($sFileName); + + // Check OLE identifier + if (substr($this->data, 0, 8) != self::IDENTIFIER_OLE) { + throw new Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); + } + + // Total number of sectors used for the SAT + $this->numBigBlockDepotBlocks = $this->_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); + + // SecID of the first sector of the directory stream + $this->rootStartBlock = $this->_GetInt4d($this->data, self::ROOT_START_BLOCK_POS); + + // SecID of the first sector of the SSAT (or -2 if not extant) + $this->sbdStartBlock = $this->_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); + + // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) + $this->extensionBlock = $this->_GetInt4d($this->data, self::EXTENSION_BLOCK_POS); + + // Total number of sectors used by MSAT + $this->numExtensionBlocks = $this->_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); + + $bigBlockDepotBlocks = array(); + $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; + + $bbdBlocks = $this->numBigBlockDepotBlocks; + + if ($this->numExtensionBlocks != 0) { + $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; + } + + for ($i = 0; $i < $bbdBlocks; ++$i) { + $bigBlockDepotBlocks[$i] = $this->_GetInt4d($this->data, $pos); + $pos += 4; + } + + for ($j = 0; $j < $this->numExtensionBlocks; ++$j) { + $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE; + $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); + + for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { + $bigBlockDepotBlocks[$i] = $this->_GetInt4d($this->data, $pos); + $pos += 4; + } + + $bbdBlocks += $blocksToRead; + if ($bbdBlocks < $this->numBigBlockDepotBlocks) { + $this->extensionBlock = $this->_GetInt4d($this->data, $pos); + } + } + + $pos = 0; + $index = 0; + $this->bigBlockChain = array(); + + for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) { + $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; + + for ($j = 0 ; $j < self::BIG_BLOCK_SIZE / 4; ++$j) { + $this->bigBlockChain[$index] = $this->_GetInt4d($this->data, $pos); + $pos += 4 ; + ++$index; + } + } + + $pos = 0; + $index = 0; + $sbdBlock = $this->sbdStartBlock; + $this->smallBlockChain = array(); + + while ($sbdBlock != -2) { + $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; + + for ($j = 0; $j < self::BIG_BLOCK_SIZE / 4; ++$j) { + $this->smallBlockChain[$index] = $this->_GetInt4d($this->data, $pos); + $pos += 4; + ++$index; + } + + $sbdBlock = $this->bigBlockChain[$sbdBlock]; + } + + $block = $this->rootStartBlock; + $pos = 0; + + // read the directory stream + $this->entry = $this->_readData($block); + + $this->_readPropertySets(); + + } + + /** + * Extract binary stream data, workbook stream + sheet streams + * + * @return string + */ + public function getWorkBook() + { + if ($this->props[$this->wrkbook]['size'] < self::SMALL_BLOCK_THRESHOLD){ + $rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']); + + $streamData = ''; + $block = $this->props[$this->wrkbook]['startBlock']; + + $pos = 0; + while ($block != -2) { + $pos = $block * self::SMALL_BLOCK_SIZE; + $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); + + $block = $this->smallBlockChain[$block]; + } + + return $streamData; + + + } else { + $numBlocks = $this->props[$this->wrkbook]['size'] / self::BIG_BLOCK_SIZE; + if ($this->props[$this->wrkbook]['size'] % self::BIG_BLOCK_SIZE != 0) { + ++$numBlocks; + } + + if ($numBlocks == 0) return ''; + + + $streamData = ''; + $block = $this->props[$this->wrkbook]['startBlock']; + + $pos = 0; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = $this->bigBlockChain[$block]; + } + + return $streamData; + } + } + + /** + * Read a standard stream (by joining sectors using information from SAT) + * + * @param int $bl Sector ID where the stream starts + * @return string Data for standard stream + */ + private function _readData($bl) + { + $block = $bl; + $pos = 0; + $data = ''; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $data = $data . substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = $this->bigBlockChain[$block]; + } + return $data; + } + + /** + * Read entries in the directory stream. + */ + private function _readPropertySets() + { + $offset = 0; + + // loop through entires, each entry is 128 bytes + while ($offset < strlen($this->entry)) { + // entry data (128 bytes) + $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE); + + // size in bytes of name + $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8); + + // type of entry + $type = ord($d[self::TYPE_POS]); + + // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook) + // sectorID of first sector of the short-stream container stream, if this entry is root entry + $startBlock = $this->_GetInt4d($d, self::START_BLOCK_POS); + + $size = $this->_GetInt4d($d, self::SIZE_POS); + + $name = ''; + for ($i = 0; $i < $nameSize ; ++$i) { + $name .= $d[$i]; + } + + $name = str_replace("\x00", "", $name); + + $this->props[] = array ( + 'name' => $name, + 'type' => $type, + 'startBlock' => $startBlock, + 'size' => $size); + + // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) + if (($name == 'Workbook') || ($name == 'Book') || ($name == 'WORKBOOK')) { + $this->wrkbook = count($this->props) - 1; + } + + // Root entry + if ($name == 'Root Entry' || $name == 'ROOT ENTRY' || $name == 'R') { + $this->rootentry = count($this->props) - 1; + } + + $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; + } + + } + + /** + * Read 4 bytes of data at specified position + * + * @param string $data + * @param int $pos + * @return int + */ + private function _GetInt4d($data, $pos) + { + // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems + $_or_24 = ord($data[$pos+3]); + if ($_or_24>=128) $_ord_24 = -abs((256-$_or_24) << 24); + else $_ord_24 = ($_or_24&127) << 24; + + return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/PDF.php b/libraries/PHPExcel/PHPExcel/Shared/PDF.php new file mode 100644 index 000000000..8d1416054 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/PDF.php @@ -0,0 +1,39 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** Require FPDF library */ +$k_path_url = dirname(__FILE__) . '/PDF'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PDF/tcpdf.php'; diff --git a/libraries/PHPExcel/PHPExcel/Shared/PasswordHasher.php b/libraries/PHPExcel/PHPExcel/Shared/PasswordHasher.php new file mode 100644 index 000000000..e8d11510b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/PasswordHasher.php @@ -0,0 +1,67 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_PasswordHasher + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_PasswordHasher +{ + /** + * Create a password hash from a given string. + * + * This method is based on the algorithm provided by + * Daniel Rentz of OpenOffice and the PEAR package + * Spreadsheet_Excel_Writer by Xavier Noguer <xnoguer@rezebra.com>. + * + * @param string $pPassword Password to hash + * @return string Hashed password + */ + public static function hashPassword($pPassword = '') { + $password = 0x0000; + $i = 1; // char position + + // split the plain text password in its component characters + $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); + foreach ($chars as $char) { + $value = ord($char) << $i; // shifted ASCII value + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 + $value &= 0x7fff; // first 15 bits + $password ^= ($value | $rotated_bits); + ++$i; + } + + $password ^= strlen($pPassword); + $password ^= 0xCE4B; + + return(strtoupper(dechex($password))); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/String.php b/libraries/PHPExcel/PHPExcel/Shared/String.php new file mode 100644 index 000000000..b6a17a371 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/String.php @@ -0,0 +1,321 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_String + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_String +{ + /** + * Control characters array + * + * @var string[] + */ + private static $_controlCharacters = array(); + + /** + * Is mbstring extension avalable? + * + * @var boolean + */ + private static $_isMbstringEnabled; + + /** + * Is iconv extension avalable? + * + * @var boolean + */ + private static $_isIconvEnabled; + + /** + * Build control characters array + */ + private static function _buildControlCharacters() { + for ($i = 0; $i <= 19; ++$i) { + if ($i != 9 && $i != 10 && $i != 13) { + $find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_'; + $replace = chr($i); + self::$_controlCharacters[$find] = $replace; + } + } + } + + /** + * Get whether mbstring extension is available + * + * @return boolean + */ + public static function getIsMbstringEnabled() + { + if (isset(self::$_isMbstringEnabled)) { + return self::$_isMbstringEnabled; + } + + self::$_isMbstringEnabled = function_exists('mb_convert_encoding') ? + true : false; + + return self::$_isMbstringEnabled; + } + + /** + * Get whether iconv extension is available + * + * @return boolean + */ + public static function getIsIconvEnabled() + { + if (isset(self::$_isIconvEnabled)) { + return self::$_isIconvEnabled; + } + + self::$_isIconvEnabled = function_exists('iconv') ? + true : false; + + return self::$_isIconvEnabled; + } + + /** + * Convert from OpenXML escaped control character to PHP control character + * + * Excel 2007 team: + * ---------------- + * That's correct, control characters are stored directly in the shared-strings table. + * We do encode characters that cannot be represented in XML using the following escape sequence: + * _xHHHH_ where H represents a hexadecimal character in the character's value... + * So you could end up with something like _x0008_ in a string (either in a cell value (<v>) + * element or in the shared string <t> element. + * + * @param string $value Value to unescape + * @return string + */ + public static function ControlCharacterOOXML2PHP($value = '') { + if(empty(self::$_controlCharacters)) { + self::_buildControlCharacters(); + } + + return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value ); + } + + /** + * Convert from PHP control character to OpenXML escaped control character + * + * Excel 2007 team: + * ---------------- + * That's correct, control characters are stored directly in the shared-strings table. + * We do encode characters that cannot be represented in XML using the following escape sequence: + * _xHHHH_ where H represents a hexadecimal character in the character's value... + * So you could end up with something like _x0008_ in a string (either in a cell value (<v>) + * element or in the shared string <t> element. + * + * @param string $value Value to escape + * @return string + */ + public static function ControlCharacterPHP2OOXML($value = '') { + if(empty(self::$_controlCharacters)) { + self::_buildControlCharacters(); + } + + return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value ); + } + + /** + * Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters. + * + * @param string $value + * @return string + */ + public static function SanitizeUTF8($value) + { + if (self::getIsIconvEnabled()) { + $value = @iconv('UTF-8', 'UTF-8', $value); + return $value; + } + + if (self::getIsMbstringEnabled()) { + $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8'); + return $value; + } + + // else, no conversion + return $value; + } + + /** + * Check if a string contains UTF8 data + * + * @param string $value + * @return boolean + */ + public static function IsUTF8($value = '') { + return utf8_encode(utf8_decode($value)) === $value; + } + + /** + * Formats a numeric value as a string for output in various output writers forcing + * point as decimal separator in case locale is other than English. + * + * @param mixed $value + * @return string + */ + public static function FormatNumber($value) { + if (is_float($value)) { + return str_replace(',', '.', $value); + } + return (string) $value; + } + + /** + * Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) + * Writes the string using uncompressed notation, no rich text, no Asian phonetics + * If mbstring extension is not available, ASCII is assumed, and compressed notation is used + * although this will give wrong results for non-ASCII strings + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 + * + * @param string $value UTF-8 encoded string + * @return string + */ + public static function UTF8toBIFF8UnicodeShort($value) + { + // character count + $ln = self::CountCharacters($value, 'UTF-8'); + + // option flags + $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ? + 0x0001 : 0x0000; + + // characters + $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8'); + + $data = pack('CC', $ln, $opt) . $chars; + return $data; + } + + /** + * Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) + * Writes the string using uncompressed notation, no rich text, no Asian phonetics + * If mbstring extension is not available, ASCII is assumed, and compressed notation is used + * although this will give wrong results for non-ASCII strings + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 + * + * @param string $value UTF-8 encoded string + * @return string + */ + public static function UTF8toBIFF8UnicodeLong($value) + { + // character count + $ln = self::CountCharacters($value, 'UTF-8'); + + // option flags + $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ? + 0x0001 : 0x0000; + + // characters + $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8'); + + $data = pack('vC', $ln, $opt) . $chars; + return $data; + } + + /** + * Convert string from one encoding to another. First try mbstring, then iconv, or no convertion + * + * @param string $value + * @param string $to Encoding to convert to, e.g. 'UTF-8' + * @param string $from Encoding to convert from, e.g. 'UTF-16LE' + * @return string + */ + public static function ConvertEncoding($value, $to, $from) + { + if (self::getIsIconvEnabled()) { + $value = iconv($from, $to, $value); + return $value; + } + + if (self::getIsMbstringEnabled()) { + $value = mb_convert_encoding($value, $to, $from); + return $value; + } + + // else, no conversion + return $value; + } + + /** + * Get character count. First try mbstring, then iconv, finally strlen + * + * @param string $value + * @param string $enc Encoding + * @return int Character count + */ + public static function CountCharacters($value, $enc = 'UTF-8') + { + if (self::getIsIconvEnabled()) { + $count = iconv_strlen($value, $enc); + return $count; + } + + if (self::getIsMbstringEnabled()) { + $count = mb_strlen($value, $enc); + return $count; + } + + // else strlen + $count = strlen($value); + return $count; + } + + /** + * Get a substring of a UTF-8 encoded string + * + * @param string $pValue UTF-8 encoded string + * @param int $start Start offset + * @param int $length Maximum number of characters in substring + * @return string + */ + public static function Substring($pValue = '', $pStart = 0, $pLength = 0) + { + if (self::getIsIconvEnabled()) { + $string = iconv_substr($pValue, $pStart, $pLength, 'UTF-8'); + return $string; + } + + if (self::getIsMbstringEnabled()) { + $string = mb_substr($pValue, $pStart, $pLength, 'UTF-8'); + return $string; + } + + // else substr + $string = substr($pValue, $pStart, $pLength); + return $string; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/XMLWriter.php b/libraries/PHPExcel/PHPExcel/Shared/XMLWriter.php new file mode 100644 index 000000000..9600a731d --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/XMLWriter.php @@ -0,0 +1,141 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +if (!defined('DATE_W3C')) { + define('DATE_W3C', 'Y-m-d\TH:i:sP'); +} + +/** + * PHPExcel_Shared_XMLWriter + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_XMLWriter { + /** Temporary storage method */ + const STORAGE_MEMORY = 1; + const STORAGE_DISK = 2; + + /** + * Internal XMLWriter + * + * @var XMLWriter + */ + private $_xmlWriter; + + /** + * Temporary filename + * + * @var string + */ + private $_tempFileName = ''; + + /** + * Create a new PHPExcel_Shared_XMLWriter instance + * + * @param int $pTemporaryStorage Temporary storage location + * @param string $pTemporaryStorageFolder Temporary storage folder + */ + public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') { + // Create internal XMLWriter + $this->_xmlWriter = new XMLWriter(); + + // Open temporary storage + if ($pTemporaryStorage == self::STORAGE_MEMORY) { + $this->_xmlWriter->openMemory(); + } else { + // Create temporary filename + $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); + + // Open storage + if ($this->_xmlWriter->openUri($this->_tempFileName) === false) { + // Fallback to memory... + $this->_xmlWriter->openMemory(); + } + } + + // Set default values + $this->_xmlWriter->setIndent(true); + } + + /** + * Destructor + */ + public function __destruct() { + // Desctruct XMLWriter + unset($this->_xmlWriter); + + // Unlink temporary files + if ($this->_tempFileName != '') { + @unlink($this->_tempFileName); + } + } + + /** + * Get written data + * + * @return $data + */ + public function getData() { + if ($this->_tempFileName == '') { + return $this->_xmlWriter->outputMemory(true); + } else { + $this->_xmlWriter->flush(); + return file_get_contents($this->_tempFileName); + } + } + + /** + * Catch function calls (and pass them to internal XMLWriter) + * + * @param unknown_type $function + * @param unknown_type $args + */ + public function __call($function, $args) { + try { + @call_user_func_array(array($this->_xmlWriter, $function), $args); + } catch (Exception $ex) { + // Do nothing! + } + } + + /** + * Fallback method for writeRaw, introduced in PHP 5.2 + * + * @param string $text + * @return string + */ + public function writeRaw($text) + { + if (isset($this->_xmlWriter) && is_object($this->_xmlWriter) && (method_exists($this->_xmlWriter, 'writeRaw'))) { + return $this->_xmlWriter->writeRaw(htmlspecialchars($text)); + } + + return $this->text($text); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/ZipStreamWrapper.php b/libraries/PHPExcel/PHPExcel/Shared/ZipStreamWrapper.php new file mode 100644 index 000000000..ebcfcb00f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/ZipStreamWrapper.php @@ -0,0 +1,182 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** Register new zip wrapper */ +PHPExcel_Shared_ZipStreamWrapper::register(); + + +/** + * PHPExcel_Shared_ZipStreamWrapper + * + * @category PHPExcel + * @package PHPExcel_Shared + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Shared_ZipStreamWrapper { + /** + * Internal ZipAcrhive + * + * @var ZipAcrhive + */ + private $_archive; + + /** + * Filename in ZipAcrhive + * + * @var string + */ + private $_fileNameInArchive = ''; + + /** + * Position in file + * + * @var int + */ + private $_position = 0; + + /** + * Data + * + * @var mixed + */ + private $_data = ''; + + /** + * Register wrapper + */ + public static function register() { + @stream_wrapper_unregister("zip"); + @stream_wrapper_register("zip", __CLASS__); + } + + /** + * Open stream + */ + public function stream_open($path, $mode, $options, &$opened_path) { + // Check for mode + if ($mode{0} != 'r') { + throw new Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); + } + + // Parse URL + $url = @parse_url($path); + + // Fix URL + if (!is_array($url)) { + $url['host'] = substr($path, strlen('zip://')); + $url['path'] = ''; + } + if (strpos($url['host'], '#') !== false) { + if (!isset($url['fragment'])) { + $url['fragment'] = substr($url['host'], strpos($url['host'], '#') + 1) . $url['path']; + $url['host'] = substr($url['host'], 0, strpos($url['host'], '#')); + unset($url['path']); + } + } else { + $url['host'] = $url['host'] . $url['path']; + unset($url['path']); + } + + // Open archive + $this->_archive = new ZipArchive(); + $this->_archive->open($url['host']); + + $this->_fileNameInArchive = $url['fragment']; + $this->_position = 0; + $this->_data = $this->_archive->getFromName( $this->_fileNameInArchive ); + + return true; + } + + /** + * Stat stream + */ + public function stream_stat() { + return $this->_archive->statName( $this->_fileNameInArchive ); + } + + /** + * Read stream + */ + function stream_read($count) { + $ret = substr($this->_data, $this->_position, $count); + $this->_position += strlen($ret); + return $ret; + } + + /** + * Tell stream + */ + public function stream_tell() { + return $this->_position; + } + + /** + * EOF stream + */ + public function stream_eof() { + return $this->_position >= strlen($this->_data); + } + + /** + * Seek stream + */ + public function stream_seek($offset, $whence) { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($this->_data) && $offset >= 0) { + $this->_position = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->_position += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($this->_data) + $offset >= 0) { + $this->_position = strlen($this->_data) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/bestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/bestFitClass.php new file mode 100644 index 000000000..00791da84 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/bestFitClass.php @@ -0,0 +1,319 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Best_Fit +{ + protected $_error = False; + + protected $_bestFitType = 'undetermined'; + + protected $_valueCount = 0; + + protected $_xValues = array(); + + protected $_yValues = array(); + + protected $_adjustToZero = False; + + protected $_yBestFitValues = array(); + + protected $_goodnessOfFit = 1; + + protected $_stdevOfResiduals = 0; + + protected $_covariance = 0; + + protected $_correlation = 0; + + protected $_SSRegression = 0; + + protected $_SSResiduals = 0; + + protected $_DFResiduals = 0; + + protected $_F = 0; + + protected $_slope = 0; + + protected $_slopeSE = 0; + + protected $_intersect = 0; + + protected $_intersectSE = 0; + + protected $_Xoffset = 0; + + protected $_Yoffset = 0; + + + public function getError() { + return $this->_error; + } // function getBestFitType() + + + public function getBestFitType() { + return $this->_bestFitType; + } // function getBestFitType() + + + public function getValueOfYForX($xValue) { + return False; + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return False; + } // function getValueOfXForY() + + + public function getXValues() { + return $this->_xValues; + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + return False; + } // function getEquation() + + + public function getSlope($dp=0) { + if ($dp != 0) { + return round($this->_slope,$dp); + } + return $this->_slope; + } // function getSlope() + + + public function getSlopeSE($dp=0) { + if ($dp != 0) { + return round($this->_slopeSE,$dp); + } + return $this->_slopeSE; + } // function getSlopeSE() + + + public function getIntersect($dp=0) { + if ($dp != 0) { + return round($this->_intersect,$dp); + } + return $this->_intersect; + } // function getIntersect() + + + public function getIntersectSE($dp=0) { + if ($dp != 0) { + return round($this->_intersectSE,$dp); + } + return $this->_intersectSE; + } // function getIntersectSE() + + + public function getGoodnessOfFit($dp=0) { + if ($dp != 0) { + return round($this->_goodnessOfFit,$dp); + } + return $this->_goodnessOfFit; + } // function getGoodnessOfFit() + + + public function getGoodnessOfFitPercent($dp=0) { + if ($dp != 0) { + return round($this->_goodnessOfFit * 100,$dp); + } + return $this->_goodnessOfFit * 100; + } // function getGoodnessOfFitPercent() + + + public function getStdevOfResiduals($dp=0) { + if ($dp != 0) { + return round($this->_stdevOfResiduals,$dp); + } + return $this->_stdevOfResiduals; + } // function getStdevOfResiduals() + + + public function getSSRegression($dp=0) { + if ($dp != 0) { + return round($this->_SSRegression,$dp); + } + return $this->_SSRegression; + } // function getSSRegression() + + + public function getSSResiduals($dp=0) { + if ($dp != 0) { + return round($this->_SSResiduals,$dp); + } + return $this->_SSResiduals; + } // function getSSResiduals() + + + public function getDFResiduals($dp=0) { + if ($dp != 0) { + return round($this->_DFResiduals,$dp); + } + return $this->_DFResiduals; + } // function getDFResiduals() + + + public function getF($dp=0) { + if ($dp != 0) { + return round($this->_F,$dp); + } + return $this->_F; + } // function getF() + + + public function getCovariance($dp=0) { + if ($dp != 0) { + return round($this->_covariance,$dp); + } + return $this->_covariance; + } // function getCovariance() + + + public function getCorrelation($dp=0) { + if ($dp != 0) { + return round($this->_correlation,$dp); + } + return $this->_correlation; + } // function getCorrelation() + + + public function getYBestFitValues() { + return $this->_yBestFitValues; + } // function getYBestFitValues() + + + protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) { + $SSres = $SScov = $SScor = $SStot = $SSsex = 0.0; + foreach($this->_xValues as $xKey => $xValue) { + $bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue); + + $SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY); + if ($const) { + $SStot += ($this->_yValues[$xKey] - $meanY) * ($this->_yValues[$xKey] - $meanY); + } else { + $SStot += $this->_yValues[$xKey] * $this->_yValues[$xKey]; + } + $SScov += ($this->_xValues[$xKey] - $meanX) * ($this->_yValues[$xKey] - $meanY); + if ($const) { + $SSsex += ($this->_xValues[$xKey] - $meanX) * ($this->_xValues[$xKey] - $meanX); + } else { + $SSsex += $this->_xValues[$xKey] * $this->_xValues[$xKey]; + } + } + + $this->_SSResiduals = $SSres; + $this->_DFResiduals = $this->_valueCount - 1 - $const; + + $this->_stdevOfResiduals = sqrt($SSres / $this->_DFResiduals); + if (($SStot == 0.0) || ($SSres == $SStot)) { + $this->_goodnessOfFit = 1; + } else { + $this->_goodnessOfFit = 1 - ($SSres / $SStot); + } + + $this->_SSRegression = $this->_goodnessOfFit * $SStot; + $this->_covariance = $SScov / $this->_valueCount; + $this->_correlation = ($this->_valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->_valueCount * $sumX2 - pow($sumX,2)) * ($this->_valueCount * $sumY2 - pow($sumY,2))); + $this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex); + $this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2)); + if ($this->_SSResiduals != 0.0) { + $this->_F = $this->_SSRegression / ($this->_SSResiduals / $this->_DFResiduals); + } else { + $this->_F = $this->_SSRegression / $this->_DFResiduals; + } + } // function _calculateGoodnessOfFit() + + + protected function _leastSquareFit($yValues, $xValues, $const) { + // calculate sums + $x_sum = array_sum($xValues); + $y_sum = array_sum($yValues); + $meanX = $x_sum / $this->_valueCount; + $meanY = $y_sum / $this->_valueCount; + $mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0; + for($i = 0; $i < $this->_valueCount; ++$i) { + $xy_sum += $xValues[$i] * $yValues[$i]; + $xx_sum += $xValues[$i] * $xValues[$i]; + $yy_sum += $yValues[$i] * $yValues[$i]; + + if ($const) { + $mBase += ($xValues[$i] - $meanX) * ($yValues[$i] - $meanY); + $mDivisor += ($xValues[$i] - $meanX) * ($xValues[$i] - $meanX); + } else { + $mBase += $xValues[$i] * $yValues[$i]; + $mDivisor += $xValues[$i] * $xValues[$i]; + } + } + + // calculate slope +// $this->_slope = (($this->_valueCount * $xy_sum) - ($x_sum * $y_sum)) / (($this->_valueCount * $xx_sum) - ($x_sum * $x_sum)); + $this->_slope = $mBase / $mDivisor; + + // calculate intersect +// $this->_intersect = ($y_sum - ($this->_slope * $x_sum)) / $this->_valueCount; + if ($const) { + $this->_intersect = $meanY - ($this->_slope * $meanX); + } else { + $this->_intersect = 0; + } + + $this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const); + } // function _leastSquareFit() + + + function __construct($yValues, $xValues=array(), $const=True) { + // Calculate number of points + $nY = count($yValues); + $nX = count($xValues); + + // Define X Values if necessary + if ($nX == 0) { + $xValues = range(1,$nY); + $nX = $nY; + } elseif ($nY != $nX) { + // Ensure both arrays of points are the same size + $this->_error = True; + return False; + } + + $this->_valueCount = $nY; + $this->_xValues = $xValues; + $this->_yValues = $yValues; + } // function __construct() + +} // class bestFit diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/exponentialBestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/exponentialBestFitClass.php new file mode 100644 index 000000000..498c47050 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/exponentialBestFitClass.php @@ -0,0 +1,100 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); + + +/** + * PHPExcel_Exponential_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit +{ + protected $_bestFitType = 'exponential'; + + + public function getValueOfYForX($xValue) { + return $this->getIntersect() * pow($this->getSlope(),($xValue - $this->_Xoffset)); + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return log(($yValue + $this->_Yoffset) / $this->getIntersect()) / log($this->getSlope()); + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = '.$intersect.' * '.$slope.'^X'; + } // function getEquation() + + + public function getSlope($dp=0) { + if ($dp != 0) { + return round(exp($this->_slope),$dp); + } + return exp($this->_slope); + } // function getSlope() + + + public function getIntersect($dp=0) { + if ($dp != 0) { + return round(exp($this->_intersect),$dp); + } + return exp($this->_intersect); + } // function getIntersect() + + + private function _exponential_regression($yValues, $xValues, $const) { + $mArray = $xValues; + $yValues = array_map('log',$yValues); + + $this->_leastSquareFit($yValues, $xValues, $const); + } // function _exponential_regression() + + + function __construct($yValues, $xValues=array(), $const=True) { + if (parent::__construct($yValues, $xValues) !== False) { + $this->_exponential_regression($yValues, $xValues, $const); + } + } // function __construct() + +} // class exponentialBestFit \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/linearBestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/linearBestFitClass.php new file mode 100644 index 000000000..2808fb4f3 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/linearBestFitClass.php @@ -0,0 +1,81 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); + + +/** + * PHPExcel_Linear_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit +{ + protected $_bestFitType = 'linear'; + + + public function getValueOfYForX($xValue) { + return $this->getIntersect() + $this->getSlope() * $xValue; + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return ($yValue - $this->getIntersect()) / $this->getSlope(); + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = '.$intersect.' + '.$slope.' * X'; + } // function getEquation() + + + private function _linear_regression($yValues, $xValues, $const) { + $this->_leastSquareFit($yValues, $xValues,$const); + } // function _linear_regression() + + + function __construct($yValues, $xValues=array(), $const=True) { + if (parent::__construct($yValues, $xValues) !== False) { + $this->_linear_regression($yValues, $xValues, $const); + } + } // function __construct() + +} // class linearBestFit \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php new file mode 100644 index 000000000..ba28dd833 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php @@ -0,0 +1,84 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); + + +/** + * PHPExcel_Logarithmic_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit +{ + protected $_bestFitType = 'logarithmic'; + + + public function getValueOfYForX($xValue) { + return $this->getIntersect() + $this->getSlope() * log($xValue - $this->_Xoffset); + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return exp(($yValue - $this->getIntersect()) / $this->getSlope()); + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = '.$intersect.' + '.$slope.' * log(X)'; + } // function getEquation() + + + private function _logarithmic_regression($yValues, $xValues, $const) { + $mArray = $xValues; + $xValues = array_map('log',$xValues); + + $this->_leastSquareFit($yValues, $xValues, $const); + } // function _logarithmic_regression() + + + function __construct($yValues, $xValues=array(), $const=True) { + if (parent::__construct($yValues, $xValues) !== False) { + $this->_logarithmic_regression($yValues, $xValues, $const); + } + } // function __construct() + +} // class logarithmicBestFit \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/polynomialBestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/polynomialBestFitClass.php new file mode 100644 index 000000000..65b8eee69 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/polynomialBestFitClass.php @@ -0,0 +1,175 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php'; + + +/** + * PHPExcel_Polynomial_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit +{ + protected $_bestFitType = 'polynomial'; + + protected $_order = 0; + + + public function getOrder() { + return $this->_order; + } // function getOrder() + + + public function getValueOfYForX($xValue) { + $retVal = $this->getIntersect(); + $slope = $this->getSlope(); + foreach($slope as $key => $value) { + if ($value != 0.0) { + $retVal += $value * pow($xValue, $key + 1); + } + } + return $retVal; + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return ($yValue - $this->getIntersect()) / $this->getSlope(); + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + $equation = 'Y = '.$intersect; + foreach($slope as $key => $value) { + if ($value != 0.0) { + $equation .= ' + '.$value.' * X'; + if ($key > 0) { + $equation .= '^'.($key + 1); + } + } + } + return $equation; + } // function getEquation() + + + public function getSlope($dp=0) { + if ($dp != 0) { + $coefficients = array(); + foreach($this->_slope as $coefficient) { + $coefficients[] = round($coefficient,$dp); + } + return $coefficients; + } + return $this->_slope; + } // function getSlope() + + + public function getCoefficients($dp=0) { + return array_merge(array($this->getIntersect($dp)),$this->getSlope($dp)); + } // function getCoefficients() + + + private function _polynomial_regression($order, $yValues, $xValues, $const) { + // calculate sums + $x_sum = array_sum($xValues); + $y_sum = array_sum($yValues); + $xx_sum = $xy_sum = 0; + for($i = 0; $i < $this->_valueCount; ++$i) { + $xy_sum += $xValues[$i] * $yValues[$i]; + $xx_sum += $xValues[$i] * $xValues[$i]; + $yy_sum += $yValues[$i] * $yValues[$i]; + } + /* + * This routine uses logic from the PHP port of polyfit version 0.1 + * written by Michael Bommarito and Paul Meagher + * + * The function fits a polynomial function of order $order through + * a series of x-y data points using least squares. + * + */ + for ($i = 0; $i < $this->_valueCount; ++$i) { + for ($j = 0; $j <= $order; ++$j) { + $A[$i][$j] = pow($xValues[$i], $j); + } + } + for ($i=0; $i < $this->_valueCount; ++$i) { + $B[$i] = array($yValues[$i]); + } + $matrixA = new Matrix($A); + $matrixB = new Matrix($B); + $C = $matrixA->solve($matrixB); + + $coefficients = array(); + for($i = 0; $i < $C->m; ++$i) { + $r = $C->get($i, 0); + if (abs($r) <= pow(10, -9)) { + $r = 0; + } + $coefficients[] = $r; + } + + $this->_intersect = array_shift($coefficients); + $this->_slope = $coefficients; + + $this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum); + foreach($this->_xValues as $xKey => $xValue) { + $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue); + } + } // function _polynomial_regression() + + + function __construct($order, $yValues, $xValues=array(), $const=True) { + if (parent::__construct($yValues, $xValues) !== False) { + if ($order < $this->_valueCount) { + $this->_bestFitType .= '_'.$order; + $this->_order = $order; + $this->_polynomial_regression($order, $yValues, $xValues, $const); + if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) { + $this->_error = True; + } + } else { + $this->_error = True; + } + } + } // function __construct() + +} // class polynomialBestFit \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/powerBestFitClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/powerBestFitClass.php new file mode 100644 index 000000000..2a1b10c1f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/powerBestFitClass.php @@ -0,0 +1,94 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'; + + +/** + * PHPExcel_Power_Best_Fit + * + * @category PHPExcel + * @package PHPExcel_Shared_Best_Fit + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit +{ + protected $_bestFitType = 'power'; + + + public function getValueOfYForX($xValue) { + return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope()); + } // function getValueOfYForX() + + + public function getValueOfXForY($yValue) { + return pow((($yValue + $this->_Yoffset) / $this->getIntersect()),(1 / $this->getSlope())); + } // function getValueOfXForY() + + + public function getEquation($dp=0) { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = '.$intersect.' * X^'.$slope; + } // function getEquation() + + + public function getIntersect($dp=0) { + if ($dp != 0) { + return round(exp($this->_intersect),$dp); + } + return exp($this->_intersect); + } // function getIntersect() + + + private function _power_regression($yValues, $xValues, $const) { + $mArray = $xValues; + sort($mArray,SORT_NUMERIC); + $xValues = array_map('log',$xValues); + $yValues = array_map('log',$yValues); + + $this->_leastSquareFit($yValues, $xValues, $const); + } // function _power_regression() + + + function __construct($yValues, $xValues=array(), $const=True) { + if (parent::__construct($yValues, $xValues) !== False) { + $this->_power_regression($yValues, $xValues, $const); + } + } // function __construct() + +} // class powerBestFit \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Shared/trend/trendClass.php b/libraries/PHPExcel/PHPExcel/Shared/trend/trendClass.php new file mode 100644 index 000000000..12ae7c6ac --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Shared/trend/trendClass.php @@ -0,0 +1,116 @@ +<?php + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/linearBestFitClass.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/logarithmicBestFitClass.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/exponentialBestFitClass.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/powerBestFitClass.php'; +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php'; + + +class trendClass +{ + const TREND_LINEAR = 'Linear'; + const TREND_LOGARITHMIC = 'Logarithmic'; + const TREND_EXPONENTIAL = 'Exponential'; + const TREND_POWER = 'Power'; + const TREND_POLYNOMIAL_2 = 'Polynomial_2'; + const TREND_POLYNOMIAL_3 = 'Polynomial_3'; + const TREND_POLYNOMIAL_4 = 'Polynomial_4'; + const TREND_POLYNOMIAL_5 = 'Polynomial_5'; + const TREND_POLYNOMIAL_6 = 'Polynomial_6'; + const TREND_BEST_FIT = 'Bestfit'; + const TREND_BEST_FIT_NO_POLY = 'Bestfit_no_Polynomials'; + + private static $_trendTypes = array( self::TREND_LINEAR, + self::TREND_LOGARITHMIC, + self::TREND_EXPONENTIAL, + self::TREND_POWER + ); + private static $_trendTypePolyOrders = array( self::TREND_POLYNOMIAL_2, + self::TREND_POLYNOMIAL_3, + self::TREND_POLYNOMIAL_4, + self::TREND_POLYNOMIAL_5, + self::TREND_POLYNOMIAL_6 + ); + + private static $_trendCache = array(); + + + public static function calculate($trendType=self::TREND_BEST_FIT, $yValues, $xValues=array(), $const=True) { + // Calculate number of points in each dataset + $nY = count($yValues); + $nX = count($xValues); + + // Define X Values if necessary + if ($nX == 0) { + $xValues = range(1,$nY); + $nX = $nY; + } elseif ($nY != $nX) { + // Ensure both arrays of points are the same size + trigger_error("trend(): Number of elements in coordinate arrays do not match.", E_USER_ERROR); + } + + $key = md5($trendType.$const.serialize($yValues).serialize($xValues)); + // Determine which trend method has been requested + switch ($trendType) { + // Instantiate and return the class for the requested trend method + case self::TREND_LINEAR : + case self::TREND_LOGARITHMIC : + case self::TREND_EXPONENTIAL : + case self::TREND_POWER : + if (!isset(self::$_trendCache[$key])) { + $className = 'PHPExcel_'.$trendType.'_Best_Fit'; + self::$_trendCache[$key] = new $className($yValues,$xValues,$const); + } + return self::$_trendCache[$key]; + break; + case self::TREND_POLYNOMIAL_2 : + case self::TREND_POLYNOMIAL_3 : + case self::TREND_POLYNOMIAL_4 : + case self::TREND_POLYNOMIAL_5 : + case self::TREND_POLYNOMIAL_6 : + if (!isset(self::$_trendCache[$key])) { + $order = substr($trendType,-1); + self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const); + } + return self::$_trendCache[$key]; + break; + case self::TREND_BEST_FIT : + case self::TREND_BEST_FIT_NO_POLY : + // If the request is to determine the best fit regression, then we test each trend line in turn + // Start by generating an instance of each available trend method + foreach(self::$_trendTypes as $trendMethod) { + $className = 'PHPExcel_'.$trendMethod.'BestFit'; + $bestFit[$trendMethod] = new $className($yValues,$xValues,$const); + $bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit(); + } + if ($trendType != self::TREND_BEST_FIT_NO_POLY) { + foreach(self::$_trendTypePolyOrders as $trendMethod) { + $order = substr($trendMethod,-1); + $bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const); + if ($bestFit[$trendMethod]->getError()) { + unset($bestFit[$trendMethod]); + } else { + $bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit(); + } + } + } + // Determine which of our trend lines is the best fit, and then we return the instance of that trend class + arsort($bestFitValue); + $bestFitType = key($bestFitValue); + return $bestFit[$bestFitType]; + break; + default : + return false; + } + } // function calculate() + +} // class trendClass \ No newline at end of file diff --git a/libraries/PHPExcel/PHPExcel/Style.php b/libraries/PHPExcel/PHPExcel/Style.php new file mode 100644 index 000000000..874747749 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style.php @@ -0,0 +1,702 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); +} + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + +/** PHPExcel_Style_Fill */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php'; + +/** PHPExcel_Style_Borders */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Borders.php'; + +/** PHPExcel_Style_Alignment */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Alignment.php'; + +/** PHPExcel_Style_NumberFormat */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php'; + +/** PHPExcel_Style_Conditional */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Conditional.php'; + +/** PHPExcel_Style_Protection */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Protection.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** + * PHPExcel_Style + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style implements PHPExcel_IComparable +{ + /** + * Font + * + * @var PHPExcel_Style_Font + */ + private $_font; + + /** + * Fill + * + * @var PHPExcel_Style_Fill + */ + private $_fill; + + /** + * Borders + * + * @var PHPExcel_Style_Borders + */ + private $_borders; + + /** + * Alignment + * + * @var PHPExcel_Style_Alignment + */ + private $_alignment; + + /** + * Number Format + * + * @var PHPExcel_Style_NumberFormat + */ + private $_numberFormat; + + /** + * Conditional styles + * + * @var PHPExcel_Style_Conditional[] + */ + private $_conditionalStyles; + + /** + * Protection + * + * @var PHPExcel_Style_Protection + */ + private $_protection; + + /** + * Style supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for style supervisor + * + * @var PHPExcel + */ + private $_parent; + + /** + * Index of style in collection. Only used for real style. + * + * @var int + */ + private $_index; + + /** + * Create a new PHPExcel_Style + * + * @param boolean $isSupervisor + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_conditionalStyles = array(); + $this->_font = new PHPExcel_Style_Font($isSupervisor); + $this->_fill = new PHPExcel_Style_Fill($isSupervisor); + $this->_borders = new PHPExcel_Style_Borders($isSupervisor); + $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor); + $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor); + $this->_protection = new PHPExcel_Style_Protection($isSupervisor); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->_font->bindParent($this); + $this->_fill->bindParent($this); + $this->_borders->bindParent($this); + $this->_alignment->bindParent($this); + $this->_numberFormat->bindParent($this); + $this->_protection->bindParent($this); + } + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel $parent + * @return PHPExcel_Style + */ + public function bindParent($parent) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style + */ + public function getSharedComponent() + { + $activeSheet = $this->getActiveSheet(); + $selectedCell = $this->getXActiveCell(); // e.g. 'A1' + + if ($activeSheet->cellExists($selectedCell)) { + $cell = $activeSheet->getCell($selectedCell); + $xfIndex = $cell->getXfIndex(); + } else { + $xfIndex = 0; + } + + $activeStyle = $this->_parent->getCellXfByIndex($xfIndex); + return $activeStyle; + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->_parent->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->_parent->getActiveSheet()->getXActiveCell(); + } + + /** + * Get parent. Only used for style supervisor + * + * @return PHPExcel + */ + public function getParent() + { + return $this->_parent; + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray( + * array( + * 'font' => array( + * 'name' => 'Arial', + * 'bold' => true, + * 'italic' => false, + * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, + * 'strike' => false, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ), + * 'borders' => array( + * 'bottom' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ), + * 'top' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ) + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @param boolean $pAdvanced Advanced mode for setting borders. + * @throws Exception + * @return PHPExcel_Style + */ + public function applyFromArray($pStyles = null, $pAdvanced = true) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + + $pRange = $this->getXSelectedCells(); + + if (is_array($pStyles)) { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Is it a cell range or a single cell? + $rangeA = ''; + $rangeB = ''; + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + list($rangeA, $rangeB) = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Advanced mode + if ($pAdvanced && isset($pStyles['borders'])) { + + // 'allborders' is a shorthand property for 'outline' and 'inside' and + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['allborders'])) { + foreach (array('outline', 'inside') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['allborders']; + } + } + unset($pStyles['borders']['allborders']); // not needed any more + } + + // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['outline'])) { + foreach (array('top', 'right', 'bottom', 'left') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['outline']; + } + } + unset($pStyles['borders']['outline']); // not needed any more + } + + // 'inside' is a shorthand property for 'vertical' and 'horizontal' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['inside'])) { + foreach (array('vertical', 'horizontal') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['inside']; + } + } + unset($pStyles['borders']['inside']); // not needed any more + } + + // width and height characteristics of selection, 1, 2, or 3 (for 3 or more) + $xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3); + $yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3); + + // loop through up to 3 x 3 = 9 regions + for ($x = 1; $x <= $xMax; ++$x) { + // start column index for region + $colStart = ($x == 3) ? + PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]) + : PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); + + // end column index for region + $colEnd = ($x == 1) ? + PHPExcel_Cell::stringFromColumnIndex($rangeStart[0]) + : PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); + + for ($y = 1; $y <= $yMax; ++$y) { + + // which edges are touching the region + $edges = array(); + + // are we at left edge + if ($x == 1) { + $edges[] = 'left'; + } + + // are we at right edge + if ($x == $xMax) { + $edges[] = 'right'; + } + + // are we at top edge? + if ($y == 1) { + $edges[] = 'top'; + } + + // are we at bottom edge? + if ($y == $yMax) { + $edges[] = 'bottom'; + } + + // start row index for region + $rowStart = ($y == 3) ? + $rangeEnd[1] : $rangeStart[1] + $y - 1; + + // end row index for region + $rowEnd = ($y == 1) ? + $rangeStart[1] : $rangeEnd[1] - $yMax + $y; + + // build range for region + $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; + + // retrieve relevant style array for region + $regionStyles = $pStyles; + unset($regionStyles['borders']['inside']); + + // what are the inner edges of the region when looking at the selection + $innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); + + // inner edges that are not touching the region should take the 'inside' border properties if they have been set + foreach ($innerEdges as $innerEdge) { + switch ($innerEdge) { + case 'top': + case 'bottom': + // should pick up 'horizontal' border property if set + if (isset($pStyles['borders']['horizontal'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + break; + case 'left': + case 'right': + // should pick up 'vertical' border property if set + if (isset($pStyles['borders']['vertical'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + break; + } + } + + // apply region style to region by calling applyFromArray() in simple mode + $this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false); + } + } + return; + } + + // Simple mode + + // First loop through cells to find out which styles are affected by this operation + $oldXfIndexes = array(); + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true; + } + } + + // clone each of the affected styles, apply the style arrray, and add the new styles to the workbook + $workbook = $this->getActiveSheet()->getParent(); + foreach ($oldXfIndexes as $oldXfIndex => $dummy) { + $style = $workbook->getCellXfByIndex($oldXfIndex); + $newStyle = clone $style; + $newStyle->applyFromArray($pStyles); + + if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) { + // there is already such cell Xf in our collection + $newXfIndexes[$oldXfIndex] = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($newStyle); + $newXfIndexes[$oldXfIndex] = $newStyle->getIndex(); + } + } + + // Loop through cells again and update the XF index + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row); + $oldXfIndex = $cell->getXfIndex(); + $cell->setXfIndex($newXfIndexes[$oldXfIndex]); + } + } + + } else { + throw new Exception("Invalid style array passed."); + } + + } else { + if (array_key_exists('fill', $pStyles)) { + $this->getFill()->applyFromArray($pStyles['fill']); + } + if (array_key_exists('font', $pStyles)) { + $this->getFont()->applyFromArray($pStyles['font']); + } + if (array_key_exists('borders', $pStyles)) { + $this->getBorders()->applyFromArray($pStyles['borders']); + } + if (array_key_exists('alignment', $pStyles)) { + $this->getAlignment()->applyFromArray($pStyles['alignment']); + } + if (array_key_exists('numberformat', $pStyles)) { + $this->getNumberFormat()->applyFromArray($pStyles['numberformat']); + } + if (array_key_exists('protection', $pStyles)) { + $this->getProtection()->applyFromArray($pStyles['protection']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Fill + * + * @return PHPExcel_Style_Fill + */ + public function getFill() { + return $this->_fill; + } + + /** + * Get Font + * + * @return PHPExcel_Style_Font + */ + public function getFont() { + return $this->_font; + } + + /** + * Set font + * + * @param PHPExcel_Style_Font $font + * @return PHPExcel_Style + */ + public function setFont(PHPExcel_Style_Font $font) + { + $this->_font = $font; + return $this; + } + + /** + * Get Borders + * + * @return PHPExcel_Style_Borders + */ + public function getBorders() { + return $this->_borders; + } + + /** + * Get Alignment + * + * @return PHPExcel_Style_Alignment + */ + public function getAlignment() { + return $this->_alignment; + } + + /** + * Get Number Format + * + * @return PHPExcel_Style_NumberFormat + */ + public function getNumberFormat() { + return $this->_numberFormat; + } + + /** + * Get Conditional Styles. Only used on supervisor. + * + * @return PHPExcel_Style_Conditional[] + */ + public function getConditionalStyles() { + return $this->getActiveSheet()->getConditionalStyles($this->getXActiveCell()); + } + + /** + * Set Conditional Styles. Only used on supervisor. + * + * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles + * @return PHPExcel_Style + */ + public function setConditionalStyles($pValue = null) { + if (is_array($pValue)) { + foreach (PHPExcel_Cell::extractAllCellReferencesInRange($this->getXSelectedCells()) as $cellReference) { + $this->getActiveSheet()->setConditionalStyles($cellReference, $pValue); + } + } + return $this; + } + + /** + * Get Protection + * + * @return PHPExcel_Style_Protection + */ + public function getProtection() { + return $this->_protection; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + $hashConditionals = ''; + foreach ($this->_conditionalStyles as $conditional) { + $hashConditionals .= $conditional->getHashCode(); + } + + return md5( + $this->getFill()->getHashCode() + . $this->getFont()->getHashCode() + . $this->getBorders()->getHashCode() + . $this->getAlignment()->getHashCode() + . $this->getNumberFormat()->getHashCode() + . $hashConditionals + . $this->getProtection()->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Get own index in style collection + * + * @return int + */ + public function getIndex() + { + return $this->_index; + } + + /** + * Set own index in style collection + * + * @param int $pValue + */ + public function setIndex($pValue) + { + $this->_index = $pValue; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Alignment.php b/libraries/PHPExcel/PHPExcel/Style/Alignment.php new file mode 100644 index 000000000..6958b6a8a --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Alignment.php @@ -0,0 +1,532 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Alignment + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Alignment implements PHPExcel_IComparable +{ + /* Horizontal alignment styles */ + const HORIZONTAL_GENERAL = 'general'; + const HORIZONTAL_LEFT = 'left'; + const HORIZONTAL_RIGHT = 'right'; + const HORIZONTAL_CENTER = 'center'; + const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; + const HORIZONTAL_JUSTIFY = 'justify'; + + /* Vertical alignment styles */ + const VERTICAL_BOTTOM = 'bottom'; + const VERTICAL_TOP = 'top'; + const VERTICAL_CENTER = 'center'; + const VERTICAL_JUSTIFY = 'justify'; + + /** + * Horizontal + * + * @var string + */ + private $_horizontal; + + /** + * Vertical + * + * @var string + */ + private $_vertical; + + /** + * Text rotation + * + * @var int + */ + private $_textRotation; + + /** + * Wrap text + * + * @var boolean + */ + private $_wrapText; + + /** + * Shrink to fit + * + * @var boolean + */ + private $_shrinkToFit; + + /** + * Indent - only possible with horizontal alignment left and right + * + * @var int + */ + private $_indent; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_Alignment + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + $this->_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + $this->_textRotation = 0; + $this->_wrapText = false; + $this->_shrinkToFit = false; + $this->_indent = 0; + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel $parent + * @return PHPExcel_Style_Alignment + */ + public function bindParent($parent) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Alignment + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getAlignment(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('alignment' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( + * array( + * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, + * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, + * 'rotation' => 0, + * 'wrap' => true + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Alignment + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('horizontal', $pStyles)) { + $this->setHorizontal($pStyles['horizontal']); + } + if (array_key_exists('vertical', $pStyles)) { + $this->setVertical($pStyles['vertical']); + } + if (array_key_exists('rotation', $pStyles)) { + $this->setTextRotation($pStyles['rotation']); + } + if (array_key_exists('wrap', $pStyles)) { + $this->setWrapText($pStyles['wrap']); + } + if (array_key_exists('shrinkToFit', $pStyles)) { + $this->setShrinkToFit($pStyles['shrinkToFit']); + } + if (array_key_exists('indent', $pStyles)) { + $this->setIndent($pStyles['indent']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Horizontal + * + * @return string + */ + public function getHorizontal() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHorizontal(); + } + return $this->_horizontal; + } + + /** + * Set Horizontal + * + * @param string $pValue + * @return PHPExcel_Style_Alignment + */ + public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + } + + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('horizontal' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } + else { + $this->_horizontal = $pValue; + } + return $this; + } + + /** + * Get Vertical + * + * @return string + */ + public function getVertical() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getVertical(); + } + return $this->_vertical; + } + + /** + * Set Vertical + * + * @param string $pValue + * @return PHPExcel_Style_Alignment + */ + public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + } + + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('vertical' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_vertical = $pValue; + } + return $this; + } + + /** + * Get TextRotation + * + * @return int + */ + public function getTextRotation() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getTextRotation(); + } + return $this->_textRotation; + } + + /** + * Set TextRotation + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Style_Alignment + */ + public function setTextRotation($pValue = 0) { + // Excel2007 value 255 => PHPExcel value -165 + if ($pValue == 255) { + $pValue = -165; + } + + // Set rotation + if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) { + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('rotation' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_textRotation = $pValue; + } + } else { + throw new Exception("Text rotation should be a value between -90 and 90."); + } + + return $this; + } + + /** + * Get Wrap Text + * + * @return boolean + */ + public function getWrapText() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getWrapText(); + } + return $this->_wrapText; + } + + /** + * Set Wrap Text + * + * @param boolean $pValue + * @return PHPExcel_Style_Alignment + */ + public function setWrapText($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('wrap' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_wrapText = $pValue; + } + return $this; + } + + /** + * Get Shrink to fit + * + * @return boolean + */ + public function getShrinkToFit() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getShrinkToFit(); + } + return $this->_shrinkToFit; + } + + /** + * Set Shrink to fit + * + * @param boolean $pValue + * @return PHPExcel_Style_Alignment + */ + public function setShrinkToFit($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_shrinkToFit = $pValue; + } + return $this; + } + + /** + * Get indent + * + * @return int + */ + public function getIndent() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getIndent(); + } + return $this->_indent; + } + + /** + * Set indent + * + * @param int $pValue + * @return PHPExcel_Style_Alignment + */ + public function setIndent($pValue = 0) { + if ($pValue > 0) { + if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) { + $pValue = 0; // indent not supported + } + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('indent' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_indent = $pValue; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_horizontal + . $this->_vertical + . $this->_textRotation + . ($this->_wrapText ? 't' : 'f') + . ($this->_shrinkToFit ? 't' : 'f') + . $this->_indent + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Border.php b/libraries/PHPExcel/PHPExcel/Style/Border.php new file mode 100644 index 000000000..2509d71c6 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Border.php @@ -0,0 +1,428 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Border + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Border implements PHPExcel_IComparable +{ + /* Border style */ + const BORDER_NONE = 'none'; + const BORDER_DASHDOT = 'dashDot'; + const BORDER_DASHDOTDOT = 'dashDotDot'; + const BORDER_DASHED = 'dashed'; + const BORDER_DOTTED = 'dotted'; + const BORDER_DOUBLE = 'double'; + const BORDER_HAIR = 'hair'; + const BORDER_MEDIUM = 'medium'; + const BORDER_MEDIUMDASHDOT = 'mediumDashDot'; + const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'; + const BORDER_MEDIUMDASHED = 'mediumDashed'; + const BORDER_SLANTDASHDOT = 'slantDashDot'; + const BORDER_THICK = 'thick'; + const BORDER_THIN = 'thin'; + + /** + * Border style + * + * @var string + */ + private $_borderStyle; + + /** + * Border color + * + * @var PHPExcel_Style_Color + */ + private $_color; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style_Borders + */ + private $_parent; + + /** + * Parent property name + * + * @var string + */ + private $_parentPropertyName; + + /** + * Create a new PHPExcel_Style_Border + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_borderStyle = PHPExcel_Style_Border::BORDER_NONE; + $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->_color->bindParent($this, '_color'); + } + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style_Borders $parent + * @param string $parentPropertyName + * @return PHPExcel_Style_Border + */ + public function bindParent($parent, $parentPropertyName) + { + $this->_parent = $parent; + $this->_parentPropertyName = $parentPropertyName; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Border + * @throws Exception + */ + public function getSharedComponent() + { + switch ($this->_parentPropertyName) { + case '_allBorders': + case '_horizontal': + case '_inside': + case '_outline': + case '_vertical': + throw new Exception('Cannot get shared component for a pseudo-border.'); + break; + + case '_bottom': + return $this->_parent->getSharedComponent()->getBottom(); + break; + + case '_diagonal': + return $this->_parent->getSharedComponent()->getDiagonal(); + break; + + case '_left': + return $this->_parent->getSharedComponent()->getLeft(); + break; + + case '_right': + return $this->_parent->getSharedComponent()->getRight(); + break; + + case '_top': + return $this->_parent->getSharedComponent()->getTop(); + break; + + } + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + switch ($this->_parentPropertyName) { + case '_allBorders': + $key = 'allborders'; + break; + + case '_bottom': + $key = 'bottom'; + break; + + case '_diagonal': + $key = 'diagonal'; + break; + + case '_horizontal': + $key = 'horizontal'; + break; + + case '_inside': + $key = 'inside'; + break; + + case '_left': + $key = 'left'; + break; + + case '_outline': + $key = 'outline'; + break; + + case '_right': + $key = 'right'; + break; + + case '_top': + $key = 'top'; + break; + + case '_vertical': + $key = 'vertical'; + break; + } + return $this->_parent->getStyleArray(array($key => $array)); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( + * array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Border + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('style', $pStyles)) { + $this->setBorderStyle($pStyles['style']); + } + if (array_key_exists('color', $pStyles)) { + $this->getColor()->applyFromArray($pStyles['color']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Border style + * + * @return string + */ + public function getBorderStyle() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getBorderStyle(); + } + return $this->_borderStyle; + } + + /** + * Set Border style + * + * @param string $pValue + * @return PHPExcel_Style_Border + */ + public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) { + + if ($pValue == '') { + $pValue = PHPExcel_Style_Border::BORDER_NONE; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('style' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_borderStyle = $pValue; + } + return $this; + } + + /** + * Get Border Color + * + * @return PHPExcel_Style_Color + */ + public function getColor() { + return $this->_color; + } + + /** + * Set Border Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Border + */ + public function setColor(PHPExcel_Style_Color $pValue = null) { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->_isSupervisor) { + $styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB())); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_color = $color; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_borderStyle + . $this->_color->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Borders.php b/libraries/PHPExcel/PHPExcel/Style/Borders.php new file mode 100644 index 000000000..7b6ae30b9 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Borders.php @@ -0,0 +1,544 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style_Border */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Border.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Borders + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Borders implements PHPExcel_IComparable +{ + /* Diagonal directions */ + const DIAGONAL_NONE = 0; + const DIAGONAL_UP = 1; + const DIAGONAL_DOWN = 2; + + /** + * Left + * + * @var PHPExcel_Style_Border + */ + private $_left; + + /** + * Right + * + * @var PHPExcel_Style_Border + */ + private $_right; + + /** + * Top + * + * @var PHPExcel_Style_Border + */ + private $_top; + + /** + * Bottom + * + * @var PHPExcel_Style_Border + */ + private $_bottom; + + /** + * Diagonal + * + * @var PHPExcel_Style_Border + */ + private $_diagonal; + + /** + * DiagonalDirection + * + * @var int + */ + private $_diagonalDirection; + + /** + * All borders psedo-border. Only applies to supervisor. + * + * @var PHPExcel_Style_Border + */ + private $_allBorders; + + /** + * Outline psedo-border. Only applies to supervisor. + * + * @var PHPExcel_Style_Border + */ + private $_outline; + + /** + * Inside psedo-border. Only applies to supervisor. + * + * @var PHPExcel_Style_Border + */ + private $_inside; + + /** + * Vertical pseudo-border. Only applies to supervisor. + * + * @var PHPExcel_Style_Border + */ + private $_vertical; + + /** + * Horizontal pseudo-border. Only applies to supervisor. + * + * @var PHPExcel_Style_Border + */ + private $_horizontal; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_Borders + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_left = new PHPExcel_Style_Border($isSupervisor); + $this->_right = new PHPExcel_Style_Border($isSupervisor); + $this->_top = new PHPExcel_Style_Border($isSupervisor); + $this->_bottom = new PHPExcel_Style_Border($isSupervisor); + $this->_diagonal = new PHPExcel_Style_Border($isSupervisor); + $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE; + + // Specially for supervisor + if ($isSupervisor) { + // Initialize pseudo-borders + $this->_allBorders = new PHPExcel_Style_Border(true); + $this->_outline = new PHPExcel_Style_Border(true); + $this->_inside = new PHPExcel_Style_Border(true); + $this->_vertical = new PHPExcel_Style_Border(true); + $this->_horizontal = new PHPExcel_Style_Border(true); + + // bind parent if we are a supervisor + $this->_left->bindParent($this, '_left'); + $this->_right->bindParent($this, '_right'); + $this->_top->bindParent($this, '_top'); + $this->_bottom->bindParent($this, '_bottom'); + $this->_diagonal->bindParent($this, '_diagonal'); + $this->_allBorders->bindParent($this, '_allBorders'); + $this->_outline->bindParent($this, '_outline'); + $this->_inside->bindParent($this, '_inside'); + $this->_vertical->bindParent($this, '_vertical'); + $this->_horizontal->bindParent($this, '_horizontal'); + } + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style $parent + * @return PHPExcel_Style_Borders + */ + public function bindParent($parent) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Borders + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getBorders(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('borders' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( + * array( + * 'bottom' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ), + * 'top' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ) + * ); + * </code> + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( + * array( + * 'allborders' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Borders + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('left', $pStyles)) { + $this->getLeft()->applyFromArray($pStyles['left']); + } + if (array_key_exists('right', $pStyles)) { + $this->getRight()->applyFromArray($pStyles['right']); + } + if (array_key_exists('top', $pStyles)) { + $this->getTop()->applyFromArray($pStyles['top']); + } + if (array_key_exists('bottom', $pStyles)) { + $this->getBottom()->applyFromArray($pStyles['bottom']); + } + if (array_key_exists('diagonal', $pStyles)) { + $this->getDiagonal()->applyFromArray($pStyles['diagonal']); + } + if (array_key_exists('diagonaldirection', $pStyles)) { + $this->setDiagonalDirection($pStyles['diagonaldirection']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Left + * + * @return PHPExcel_Style_Border + */ + public function getLeft() { + return $this->_left; + } + + /** + * Get Right + * + * @return PHPExcel_Style_Border + */ + public function getRight() { + return $this->_right; + } + + /** + * Get Top + * + * @return PHPExcel_Style_Border + */ + public function getTop() { + return $this->_top; + } + + /** + * Get Bottom + * + * @return PHPExcel_Style_Border + */ + public function getBottom() { + return $this->_bottom; + } + + /** + * Get Diagonal + * + * @return PHPExcel_Style_Border + */ + public function getDiagonal() { + return $this->_diagonal; + } + + /** + * Get AllBorders (pseudo-border). Only applies to supervisor. + * + * @return PHPExcel_Style_Border + * @throws Exception + */ + public function getAllBorders() { + if (!$this->_isSupervisor) { + throw new Exception('Can only get pseudo-border for supervisor.'); + } + return $this->_allBorders; + } + + /** + * Get Outline (pseudo-border). Only applies to supervisor. + * + * @return boolean + * @throws Exception + */ + public function getOutline() { + if (!$this->_isSupervisor) { + throw new Exception('Can only get pseudo-border for supervisor.'); + } + return $this->_outline; + } + + /** + * Get Inside (pseudo-border). Only applies to supervisor. + * + * @return boolean + * @throws Exception + */ + public function getInside() { + if (!$this->_isSupervisor) { + throw new Exception('Can only get pseudo-border for supervisor.'); + } + return $this->_inside; + } + + /** + * Get Vertical (pseudo-border). Only applies to supervisor. + * + * @return PHPExcel_Style_Border + * @throws Exception + */ + public function getVertical() { + if (!$this->_isSupervisor) { + throw new Exception('Can only get pseudo-border for supervisor.'); + } + return $this->_vertical; + } + + /** + * Get Horizontal (pseudo-border). Only applies to supervisor. + * + * @return PHPExcel_Style_Border + * @throws Exception + */ + public function getHorizontal() { + if (!$this->_isSupervisor) { + throw new Exception('Can only get pseudo-border for supervisor.'); + } + return $this->_horizontal; + } + + /** + * Get DiagonalDirection + * + * @return int + */ + public function getDiagonalDirection() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getDiagonalDirection(); + } + return $this->_diagonalDirection; + } + + /** + * Set DiagonalDirection + * + * @param int $pValue + * @return PHPExcel_Style_Borders + */ + public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_diagonalDirection = $pValue; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashcode(); + } + return md5( + $this->getLeft()->getHashCode() + . $this->getRight()->getHashCode() + . $this->getTop()->getHashCode() + . $this->getBottom()->getHashCode() + . $this->getDiagonal()->getHashCode() + . $this->getDiagonalDirection() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Color.php b/libraries/PHPExcel/PHPExcel/Style/Color.php new file mode 100644 index 000000000..22840cd65 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Color.php @@ -0,0 +1,451 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Color + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Color implements PHPExcel_IComparable +{ + /* Colors */ + const COLOR_BLACK = 'FF000000'; + const COLOR_WHITE = 'FFFFFFFF'; + const COLOR_RED = 'FFFF0000'; + const COLOR_DARKRED = 'FF800000'; + const COLOR_BLUE = 'FF0000FF'; + const COLOR_DARKBLUE = 'FF000080'; + const COLOR_GREEN = 'FF00FF00'; + const COLOR_DARKGREEN = 'FF008000'; + const COLOR_YELLOW = 'FFFFFF00'; + const COLOR_DARKYELLOW = 'FF808000'; + + /** + * Indexed colors array + * + * @var array + */ + private static $_indexedColors; + + /** + * ARGB - Alpha RGB + * + * @var string + */ + private $_argb; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var mixed + */ + private $_parent; + + /** + * Parent property name + * + * @var string + */ + private $_parentPropertyName; + + /** + * Create a new PHPExcel_Style_Color + * + * @param string $pARGB + */ + public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_argb = $pARGB; + } + + /** + * Bind parent. Only used for supervisor + * + * @param mixed $parent + * @param string $parentPropertyName + * @return PHPExcel_Style_Color + */ + public function bindParent($parent, $parentPropertyName) + { + $this->_parent = $parent; + $this->_parentPropertyName = $parentPropertyName; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Color + */ + public function getSharedComponent() + { + switch ($this->_parentPropertyName) { + case '_endColor': + return $this->_parent->getSharedComponent()->getEndColor(); + break; + + case '_color': + return $this->_parent->getSharedComponent()->getColor(); + break; + + case '_startColor': + return $this->_parent->getSharedComponent()->getStartColor(); + break; + } + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + switch ($this->_parentPropertyName) { + case '_endColor': + $key = 'endcolor'; + break; + + case '_color': + $key = 'color'; + break; + + case '_startColor': + $key = 'startcolor'; + break; + + } + return $this->_parent->getStyleArray(array($key => $array)); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Color + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('rgb', $pStyles)) { + $this->setRGB($pStyles['rgb']); + } + if (array_key_exists('argb', $pStyles)) { + $this->setARGB($pStyles['argb']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get ARGB + * + * @return string + */ + public function getARGB() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getARGB(); + } + return $this->_argb; + } + + /** + * Set ARGB + * + * @param string $pValue + * @return PHPExcel_Style_Color + */ + public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Color::COLOR_BLACK; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('argb' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_argb = $pValue; + } + return $this; + } + + /** + * Get RGB + * + * @return string + */ + public function getRGB() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getRGB(); + } + return substr($this->_argb, 2); + } + + /** + * Set RGB + * + * @param string $pValue + * @return PHPExcel_Style_Color + */ + public function setRGB($pValue = '000000') { + if ($pValue == '') { + $pValue = '000000'; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_argb = 'FF' . $pValue; + } + return $this; + } + + /** + * Get indexed color + * + * @param int $pIndex + * @return PHPExcel_Style_Color + */ + public static function indexedColor($pIndex) { + // Clean parameter + $pIndex = intval($pIndex); + + // Indexed colors + if (is_null(self::$_indexedColors)) { + self::$_indexedColors = array(); + self::$_indexedColors[] = '00000000'; + self::$_indexedColors[] = '00FFFFFF'; + self::$_indexedColors[] = '00FF0000'; + self::$_indexedColors[] = '0000FF00'; + self::$_indexedColors[] = '000000FF'; + self::$_indexedColors[] = '00FFFF00'; + self::$_indexedColors[] = '00FF00FF'; + self::$_indexedColors[] = '0000FFFF'; + self::$_indexedColors[] = '00000000'; + self::$_indexedColors[] = '00FFFFFF'; + self::$_indexedColors[] = '00FF0000'; + self::$_indexedColors[] = '0000FF00'; + self::$_indexedColors[] = '000000FF'; + self::$_indexedColors[] = '00FFFF00'; + self::$_indexedColors[] = '00FF00FF'; + self::$_indexedColors[] = '0000FFFF'; + self::$_indexedColors[] = '00800000'; + self::$_indexedColors[] = '00008000'; + self::$_indexedColors[] = '00000080'; + self::$_indexedColors[] = '00808000'; + self::$_indexedColors[] = '00800080'; + self::$_indexedColors[] = '00008080'; + self::$_indexedColors[] = '00C0C0C0'; + self::$_indexedColors[] = '00808080'; + self::$_indexedColors[] = '009999FF'; + self::$_indexedColors[] = '00993366'; + self::$_indexedColors[] = '00FFFFCC'; + self::$_indexedColors[] = '00CCFFFF'; + self::$_indexedColors[] = '00660066'; + self::$_indexedColors[] = '00FF8080'; + self::$_indexedColors[] = '000066CC'; + self::$_indexedColors[] = '00CCCCFF'; + self::$_indexedColors[] = '00000080'; + self::$_indexedColors[] = '00FF00FF'; + self::$_indexedColors[] = '00FFFF00'; + self::$_indexedColors[] = '0000FFFF'; + self::$_indexedColors[] = '00800080'; + self::$_indexedColors[] = '00800000'; + self::$_indexedColors[] = '00008080'; + self::$_indexedColors[] = '000000FF'; + self::$_indexedColors[] = '0000CCFF'; + self::$_indexedColors[] = '00CCFFFF'; + self::$_indexedColors[] = '00CCFFCC'; + self::$_indexedColors[] = '00FFFF99'; + self::$_indexedColors[] = '0099CCFF'; + self::$_indexedColors[] = '00FF99CC'; + self::$_indexedColors[] = '00CC99FF'; + self::$_indexedColors[] = '00FFCC99'; + self::$_indexedColors[] = '003366FF'; + self::$_indexedColors[] = '0033CCCC'; + self::$_indexedColors[] = '0099CC00'; + self::$_indexedColors[] = '00FFCC00'; + self::$_indexedColors[] = '00FF9900'; + self::$_indexedColors[] = '00FF6600'; + self::$_indexedColors[] = '00666699'; + self::$_indexedColors[] = '00969696'; + self::$_indexedColors[] = '00003366'; + self::$_indexedColors[] = '00339966'; + self::$_indexedColors[] = '00003300'; + self::$_indexedColors[] = '00333300'; + self::$_indexedColors[] = '00993300'; + self::$_indexedColors[] = '00993366'; + self::$_indexedColors[] = '00333399'; + self::$_indexedColors[] = '00333333'; + } + + if (array_key_exists($pIndex, self::$_indexedColors)) { + return new PHPExcel_Style_Color(self::$_indexedColors[$pIndex]); + } + + return new PHPExcel_Style_Color(); + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_argb + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Conditional.php b/libraries/PHPExcel/PHPExcel/Style/Conditional.php new file mode 100644 index 000000000..e389ec222 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Conditional.php @@ -0,0 +1,323 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Conditional + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Conditional implements PHPExcel_IComparable +{ + /* Condition types */ + const CONDITION_NONE = 'none'; + const CONDITION_CELLIS = 'cellIs'; + const CONDITION_CONTAINSTEXT = 'containsText'; + const CONDITION_EXPRESSION = 'expression'; + + /* Operator types */ + const OPERATOR_NONE = ''; + const OPERATOR_BEGINSWITH = 'beginsWith'; + const OPERATOR_ENDSWITH = 'endsWith'; + const OPERATOR_EQUAL = 'equal'; + const OPERATOR_GREATERTHAN = 'greaterThan'; + const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; + const OPERATOR_LESSTHAN = 'lessThan'; + const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; + const OPERATOR_NOTEQUAL = 'notEqual'; + const OPERATOR_CONTAINSTEXT = 'containsText'; + const OPERATOR_NOTCONTAINS = 'notContains'; + const OPERATOR_BETWEEN = 'between'; + + /** + * Condition type + * + * @var int + */ + private $_conditionType; + + /** + * Operator type + * + * @var int + */ + private $_operatorType; + + /** + * Text + * + * @var string + */ + private $_text; + + /** + * Condition + * + * @var string[] + */ + private $_condition = array(); + + /** + * Style + * + * @var PHPExcel_Style + */ + private $_style; + + /** + * Create a new PHPExcel_Style_Conditional + */ + public function __construct() + { + // Initialise values + $this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE; + $this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE; + $this->_text = null; + $this->_condition = array(); + $this->_style = new PHPExcel_Style(); + } + + /** + * Get Condition type + * + * @return string + */ + public function getConditionType() { + return $this->_conditionType; + } + + /** + * Set Condition type + * + * @param string $pValue PHPExcel_Style_Conditional condition type + * @return PHPExcel_Style_Conditional + */ + public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE) { + $this->_conditionType = $pValue; + return $this; + } + + /** + * Get Operator type + * + * @return string + */ + public function getOperatorType() { + return $this->_operatorType; + } + + /** + * Set Operator type + * + * @param string $pValue PHPExcel_Style_Conditional operator type + * @return PHPExcel_Style_Conditional + */ + public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE) { + $this->_operatorType = $pValue; + return $this; + } + + /** + * Get text + * + * @return string + */ + public function getText() { + return $this->_text; + } + + /** + * Set text + * + * @param string $value + * @return PHPExcel_Style_Conditional + */ + public function setText($value = null) { + $this->_text = $value; + return $this; + } + + /** + * Get Condition + * + * @deprecated Deprecated, use getConditions instead + * @return string + */ + public function getCondition() { + if (isset($this->_condition[0])) { + return $this->_condition[0]; + } + + return ''; + } + + /** + * Set Condition + * + * @deprecated Deprecated, use setConditions instead + * @param string $pValue Condition + * @return PHPExcel_Style_Conditional + */ + public function setCondition($pValue = '') { + if (!is_array($pValue)) + $pValue = array($pValue); + + return $this->setConditions($pValue); + } + + /** + * Get Conditions + * + * @return string[] + */ + public function getConditions() { + return $this->_condition; + } + + /** + * Set Conditions + * + * @param string[] $pValue Condition + * @return PHPExcel_Style_Conditional + */ + public function setConditions($pValue) { + if (!is_array($pValue)) + $pValue = array($pValue); + + $this->_condition = $pValue; + return $this; + } + + /** + * Add Condition + * + * @param string $pValue Condition + * @return PHPExcel_Style_Conditional + */ + public function addCondition($pValue = '') { + $this->_condition[] = $pValue; + return $this; + } + + /** + * Get Style + * + * @return PHPExcel_Style + */ + public function getStyle() { + return $this->_style; + } + + /** + * Set Style + * + * @param PHPExcel_Style $pValue + * @throws Exception + * @return PHPExcel_Style_Conditional + */ + public function setStyle(PHPExcel_Style $pValue = null) { + $this->_style = $pValue; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_conditionType + . $this->_operatorType + . implode(';', $this->_condition) + . $this->_style->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Fill.php b/libraries/PHPExcel/PHPExcel/Style/Fill.php new file mode 100644 index 000000000..6875b31dc --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Fill.php @@ -0,0 +1,447 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Fill + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Fill implements PHPExcel_IComparable +{ + /* Fill types */ + const FILL_NONE = 'none'; + const FILL_SOLID = 'solid'; + const FILL_GRADIENT_LINEAR = 'linear'; + const FILL_GRADIENT_PATH = 'path'; + const FILL_PATTERN_DARKDOWN = 'darkDown'; + const FILL_PATTERN_DARKGRAY = 'darkGray'; + const FILL_PATTERN_DARKGRID = 'darkGrid'; + const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal'; + const FILL_PATTERN_DARKTRELLIS = 'darkTrellis'; + const FILL_PATTERN_DARKUP = 'darkUp'; + const FILL_PATTERN_DARKVERTICAL = 'darkVertical'; + const FILL_PATTERN_GRAY0625 = 'gray0625'; + const FILL_PATTERN_GRAY125 = 'gray125'; + const FILL_PATTERN_LIGHTDOWN = 'lightDown'; + const FILL_PATTERN_LIGHTGRAY = 'lightGray'; + const FILL_PATTERN_LIGHTGRID = 'lightGrid'; + const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal'; + const FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis'; + const FILL_PATTERN_LIGHTUP = 'lightUp'; + const FILL_PATTERN_LIGHTVERTICAL = 'lightVertical'; + const FILL_PATTERN_MEDIUMGRAY = 'mediumGray'; + + /** + * Fill type + * + * @var string + */ + private $_fillType; + + /** + * Rotation + * + * @var double + */ + private $_rotation; + + /** + * Start color + * + * @var PHPExcel_Style_Color + */ + private $_startColor; + + /** + * End color + * + * @var PHPExcel_Style_Color + */ + private $_endColor; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_Fill + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_fillType = PHPExcel_Style_Fill::FILL_NONE; + $this->_rotation = 0; + $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor); + $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->_startColor->bindParent($this, '_startColor'); + $this->_endColor->bindParent($this, '_endColor'); + } + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style $parent + * @return PHPExcel_Style_Fill + */ + public function bindParent($parent) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Fill + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getFill(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('fill' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( + * array( + * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, + * 'rotation' => 0, + * 'startcolor' => array( + * 'rgb' => '000000' + * ), + * 'endcolor' => array( + * 'argb' => 'FFFFFFFF' + * ) + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Fill + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('type', $pStyles)) { + $this->setFillType($pStyles['type']); + } + if (array_key_exists('rotation', $pStyles)) { + $this->setRotation($pStyles['rotation']); + } + if (array_key_exists('startcolor', $pStyles)) { + $this->getStartColor()->applyFromArray($pStyles['startcolor']); + } + if (array_key_exists('endcolor', $pStyles)) { + $this->getEndColor()->applyFromArray($pStyles['endcolor']); + } + if (array_key_exists('color', $pStyles)) { + $this->getStartColor()->applyFromArray($pStyles['color']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Fill Type + * + * @return string + */ + public function getFillType() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getFillType(); + } + return $this->_fillType; + } + + /** + * Set Fill Type + * + * @param string $pValue PHPExcel_Style_Fill fill type + * @return PHPExcel_Style_Fill + */ + public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) { + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('type' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_fillType = $pValue; + } + return $this; + } + + /** + * Get Rotation + * + * @return double + */ + public function getRotation() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getRotation(); + } + return $this->_rotation; + } + + /** + * Set Rotation + * + * @param double $pValue + * @return PHPExcel_Style_Fill + */ + public function setRotation($pValue = 0) { + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('rotation' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_rotation = $pValue; + } + return $this; + } + + /** + * Get Start Color + * + * @return PHPExcel_Style_Color + */ + public function getStartColor() { + return $this->_startColor; + } + + /** + * Set Start Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Fill + */ + public function setStartColor(PHPExcel_Style_Color $pValue = null) { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->_isSupervisor) { + $styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB())); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_startColor = $color; + } + return $this; + } + + /** + * Get End Color + * + * @return PHPExcel_Style_Color + */ + public function getEndColor() { + return $this->_endColor; + } + + /** + * Set End Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Fill + */ + public function setEndColor(PHPExcel_Style_Color $pValue = null) { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->_isSupervisor) { + $styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB())); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_endColor = $color; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->getFillType() + . $this->getRotation() + . $this->getStartColor()->getHashCode() + . $this->getEndColor()->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Font.php b/libraries/PHPExcel/PHPExcel/Style/Font.php new file mode 100644 index 000000000..1caa8be3b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Font.php @@ -0,0 +1,665 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Font + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Font implements PHPExcel_IComparable +{ + /* Underline types */ + const UNDERLINE_NONE = 'none'; + const UNDERLINE_DOUBLE = 'double'; + const UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'; + const UNDERLINE_SINGLE = 'single'; + const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'; + + /** + * Name + * + * @var string + */ + private $_name; + + /** + * Bold + * + * @var boolean + */ + private $_bold; + + /** + * Italic + * + * @var boolean + */ + private $_italic; + + /** + * Superscript + * + * @var boolean + */ + private $_superScript; + + /** + * Subscript + * + * @var boolean + */ + private $_subScript; + + /** + * Underline + * + * @var string + */ + private $_underline; + + /** + * Strikethrough + * + * @var boolean + */ + private $_strikethrough; + + /** + * Foreground color + * + * @var PHPExcel_Style_Color + */ + private $_color; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_Font + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_name = 'Calibri'; + $this->_size = 11; + $this->_bold = false; + $this->_italic = false; + $this->_superScript = false; + $this->_subScript = false; + $this->_underline = PHPExcel_Style_Font::UNDERLINE_NONE; + $this->_strikethrough = false; + $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->_color->bindParent($this, '_color'); + } + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style $parent + * @return PHPExcel_Style_Font + */ + public function bindParent($parent) + { + $this->_parent = $parent; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Font + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getFont(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('font' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( + * array( + * 'name' => 'Arial', + * 'bold' => true, + * 'italic' => false, + * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, + * 'strike' => false, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Font + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('name', $pStyles)) { + $this->setName($pStyles['name']); + } + if (array_key_exists('bold', $pStyles)) { + $this->setBold($pStyles['bold']); + } + if (array_key_exists('italic', $pStyles)) { + $this->setItalic($pStyles['italic']); + } + if (array_key_exists('superScript', $pStyles)) { + $this->setSuperScript($pStyles['superScript']); + } + if (array_key_exists('subScript', $pStyles)) { + $this->setSubScript($pStyles['subScript']); + } + if (array_key_exists('underline', $pStyles)) { + $this->setUnderline($pStyles['underline']); + } + if (array_key_exists('strike', $pStyles)) { + $this->setStrikethrough($pStyles['strike']); + } + if (array_key_exists('color', $pStyles)) { + $this->getColor()->applyFromArray($pStyles['color']); + } + if (array_key_exists('size', $pStyles)) { + $this->setSize($pStyles['size']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Name + * + * @return string + */ + public function getName() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getName(); + } + return $this->_name; + } + + /** + * Set Name + * + * @param string $pValue + * @return PHPExcel_Style_Font + */ + public function setName($pValue = 'Calibri') { + if ($pValue == '') { + $pValue = 'Calibri'; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('name' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_name = $pValue; + } + return $this; + } + + /** + * Get Size + * + * @return double + */ + public function getSize() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getSize(); + } + return $this->_size; + } + + /** + * Set Size + * + * @param double $pValue + * @return PHPExcel_Style_Font + */ + public function setSize($pValue = 10) { + if ($pValue == '') { + $pValue = 10; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('size' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_size = $pValue; + } + return $this; + } + + /** + * Get Bold + * + * @return boolean + */ + public function getBold() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getBold(); + } + return $this->_bold; + } + + /** + * Set Bold + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setBold($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('bold' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_bold = $pValue; + } + return $this; + } + + /** + * Get Italic + * + * @return boolean + */ + public function getItalic() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getItalic(); + } + return $this->_italic; + } + + /** + * Set Italic + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setItalic($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('italic' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_italic = $pValue; + } + return $this; + } + + /** + * Get SuperScript + * + * @return boolean + */ + public function getSuperScript() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getSuperScript(); + } + return $this->_superScript; + } + + /** + * Set SuperScript + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setSuperScript($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('superScript' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_superScript = $pValue; + $this->_subScript = !$pValue; + } + return $this; + } + + /** + * Get SubScript + * + * @return boolean + */ + public function getSubScript() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getSubScript(); + } + return $this->_subScript; + } + + /** + * Set SubScript + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setSubScript($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('subScript' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_subScript = $pValue; + $this->_superScript = !$pValue; + } + return $this; + } + + /** + * Get Underline + * + * @return string + */ + public function getUnderline() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getUnderline(); + } + return $this->_underline; + } + + /** + * Set Underline + * + * @param string $pValue PHPExcel_Style_Font underline type + * @return PHPExcel_Style_Font + */ + public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Font::UNDERLINE_NONE; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('underline' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_underline = $pValue; + } + return $this; + } + + /** + * Get Striketrough + * + * @deprecated Use getStrikethrough() instead. + * @return boolean + */ + public function getStriketrough() { + return $this->getStrikethrough(); + } + + /** + * Set Striketrough + * + * @deprecated Use setStrikethrough() instead. + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setStriketrough($pValue = false) { + return $this->setStrikethrough($pValue); + } + + /** + * Get Strikethrough + * + * @return boolean + */ + public function getStrikethrough() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getStrikethrough(); + } + return $this->_strikethrough; + } + + /** + * Set Strikethrough + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setStrikethrough($pValue = false) { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('strike' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_strikethrough = $pValue; + } + return $this; + } + + /** + * Get Color + * + * @return PHPExcel_Style_Color + */ + public function getColor() { + return $this->_color; + } + + /** + * Set Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Font + */ + public function setColor(PHPExcel_Style_Color $pValue = null) { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->_isSupervisor) { + $styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB())); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_color = $color; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_name + . $this->_size + . ($this->_bold ? 't' : 'f') + . ($this->_italic ? 't' : 'f') + . ($this->_superScript ? 't' : 'f') + . ($this->_subScript ? 't' : 'f') + . $this->_underline + . ($this->_strikethrough ? 't' : 'f') + . $this->_color->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/NumberFormat.php b/libraries/PHPExcel/PHPExcel/Style/NumberFormat.php new file mode 100644 index 000000000..a9df568ec --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/NumberFormat.php @@ -0,0 +1,658 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Shared_Date */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Date.php'; + +/** PHPExcel_Calculation_Functions */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Functions.php'; + + +/** + * PHPExcel_Style_NumberFormat + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable +{ + /* Pre-defined formats */ + const FORMAT_GENERAL = 'General'; + + const FORMAT_TEXT = '@'; + + const FORMAT_NUMBER = '0'; + const FORMAT_NUMBER_00 = '0.00'; + const FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'; + const FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'; + + const FORMAT_PERCENTAGE = '0%'; + const FORMAT_PERCENTAGE_00 = '0.00%'; + + const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; + const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd'; + const FORMAT_DATE_DDMMYYYY = 'dd/mm/yy'; + const FORMAT_DATE_DMYSLASH = 'd/m/y'; + const FORMAT_DATE_DMYMINUS = 'd-m-y'; + const FORMAT_DATE_DMMINUS = 'd-m'; + const FORMAT_DATE_MYMINUS = 'm-y'; + const FORMAT_DATE_XLSX14 = 'mm-dd-yy'; + const FORMAT_DATE_XLSX15 = 'd-mmm-yy'; + const FORMAT_DATE_XLSX16 = 'd-mmm'; + const FORMAT_DATE_XLSX17 = 'mmm-yy'; + const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'; + const FORMAT_DATE_DATETIME = 'd/m/y h:mm'; + const FORMAT_DATE_TIME1 = 'h:mm AM/PM'; + const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'; + const FORMAT_DATE_TIME3 = 'h:mm'; + const FORMAT_DATE_TIME4 = 'h:mm:ss'; + const FORMAT_DATE_TIME5 = 'mm:ss'; + const FORMAT_DATE_TIME6 = 'h:mm:ss'; + const FORMAT_DATE_TIME7 = 'i:s.S'; + const FORMAT_DATE_TIME8 = 'h:mm:ss;@'; + const FORMAT_DATE_YYYYMMDDSLASH = 'yy/mm/dd;@'; + + const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'; + const FORMAT_CURRENCY_USD = '$#,##0_-'; + const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'; + + /** + * Excel built-in number formats + * + * @var array + */ + private static $_builtInFormats; + + /** + * Excel built-in number formats (flipped, for faster lookups) + * + * @var array + */ + private static $_flippedBuiltInFormats; + + /** + * Format Code + * + * @var string + */ + private $_formatCode; + + /** + * Built-in format Code + * + * @var string + */ + private $_builtInFormatCode; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_NumberFormat + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + $this->_builtInFormatCode = 0; + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style $parent + * @return PHPExcel_Style_NumberFormat + */ + public function bindParent($parent) + { + $this->_parent = $parent; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_NumberFormat + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getNumberFormat(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('numberformat' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( + * array( + * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE + * ) + * ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_NumberFormat + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('code', $pStyles)) { + $this->setFormatCode($pStyles['code']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get Format Code + * + * @return string + */ + public function getFormatCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getFormatCode(); + } + if ($this->_builtInFormatCode !== false) + { + return self::builtInFormatCode($this->_builtInFormatCode); + } + return $this->_formatCode; + } + + /** + * Set Format Code + * + * @param string $pValue + * @return PHPExcel_Style_NumberFormat + */ + public function setFormatCode($pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL) { + if ($pValue == '') { + $pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + } + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('code' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_formatCode = $pValue; + $this->_builtInFormatCode = self::builtInFormatCodeIndex($pValue); + } + return $this; + } + + /** + * Get Built-In Format Code + * + * @return int + */ + public function getBuiltInFormatCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getBuiltInFormatCode(); + } + return $this->_builtInFormatCode; + } + + /** + * Set Built-In Format Code + * + * @param int $pValue + * @return PHPExcel_Style_NumberFormat + */ + public function setBuiltInFormatCode($pValue = 0) { + + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue))); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_builtInFormatCode = $pValue; + $this->_formatCode = self::builtInFormatCode($pValue); + } + return $this; + } + + /** + * Fill built-in format codes + */ + private static function fillBuiltInFormatCodes() + { + // Built-in format codes + if (is_null(self::$_builtInFormats)) { + self::$_builtInFormats = array(); + + // General + self::$_builtInFormats[0] = 'General'; + self::$_builtInFormats[1] = '0'; + self::$_builtInFormats[2] = '0.00'; + self::$_builtInFormats[3] = '#,##0'; + self::$_builtInFormats[4] = '#,##0.00'; + + self::$_builtInFormats[9] = '0%'; + self::$_builtInFormats[10] = '0.00%'; + self::$_builtInFormats[11] = '0.00E+00'; + self::$_builtInFormats[12] = '# ?/?'; + self::$_builtInFormats[13] = '# ??/??'; + self::$_builtInFormats[14] = 'mm-dd-yy'; + self::$_builtInFormats[15] = 'd-mmm-yy'; + self::$_builtInFormats[16] = 'd-mmm'; + self::$_builtInFormats[17] = 'mmm-yy'; + self::$_builtInFormats[18] = 'h:mm AM/PM'; + self::$_builtInFormats[19] = 'h:mm:ss AM/PM'; + self::$_builtInFormats[20] = 'h:mm'; + self::$_builtInFormats[21] = 'h:mm:ss'; + self::$_builtInFormats[22] = 'm/d/yy h:mm'; + + self::$_builtInFormats[37] = '#,##0 ;(#,##0)'; + self::$_builtInFormats[38] = '#,##0 ;[Red](#,##0)'; + self::$_builtInFormats[39] = '#,##0.00;(#,##0.00)'; + self::$_builtInFormats[40] = '#,##0.00;[Red](#,##0.00)'; + + self::$_builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'; + self::$_builtInFormats[45] = 'mm:ss'; + self::$_builtInFormats[46] = '[h]:mm:ss'; + self::$_builtInFormats[47] = 'mmss.0'; + self::$_builtInFormats[48] = '##0.0E+0'; + self::$_builtInFormats[49] = '@'; + + // CHT + self::$_builtInFormats[27] = '[$-404]e/m/d'; + self::$_builtInFormats[30] = 'm/d/yy'; + self::$_builtInFormats[36] = '[$-404]e/m/d'; + self::$_builtInFormats[50] = '[$-404]e/m/d'; + self::$_builtInFormats[57] = '[$-404]e/m/d'; + + // THA + self::$_builtInFormats[59] = 't0'; + self::$_builtInFormats[60] = 't0.00'; + self::$_builtInFormats[61] = 't#,##0'; + self::$_builtInFormats[62] = 't#,##0.00'; + self::$_builtInFormats[67] = 't0%'; + self::$_builtInFormats[68] = 't0.00%'; + self::$_builtInFormats[69] = 't# ?/?'; + self::$_builtInFormats[70] = 't# ??/??'; + + // Flip array (for faster lookups) + self::$_flippedBuiltInFormats = array_flip(self::$_builtInFormats); + } + } + + /** + * Get built-in format code + * + * @param int $pIndex + * @return string + */ + public static function builtInFormatCode($pIndex) { + // Clean parameter + $pIndex = intval($pIndex); + + // Ensure built-in format codes are available + self::fillBuiltInFormatCodes(); + + // Lookup format code + if (array_key_exists($pIndex, self::$_builtInFormats)) { + return self::$_builtInFormats[$pIndex]; + } + + return ''; + } + + /** + * Get built-in format code index + * + * @param string $formatCode + * @return int|boolean + */ + public static function builtInFormatCodeIndex($formatCode) { + // Ensure built-in format codes are available + self::fillBuiltInFormatCodes(); + + // Lookup format code + if (array_key_exists($formatCode, self::$_flippedBuiltInFormats)) { + return self::$_flippedBuiltInFormats[$formatCode]; + } + + return false; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_formatCode + . $this->_builtInFormatCode + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * Convert a value in a pre-defined format to a PHP string + * + * @param mixed $value Value to format + * @param string $format Format code + * @return string Formatted string + */ + public static function toFormattedString($value = '', $format = '') { + // For now we do not treat strings although part 4 of a format code affects strings + if (!is_numeric($value)) return $value; + + // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, + // it seems to round numbers to a total of 10 digits. + if ($format === 'General') { + return $value; + } + + // Get the parts, there can be up to four parts + $parts = explode(';', $format); + + // We should really fetch the relevant part depending on whether we have a positive number, + // negative number, zero, or text. But for now we just use first part + $format = $parts[0]; + + if (preg_match("/^[hmsdy]/i", $format)) { // custom datetime format + // dvc: convert Excel formats to PHP date formats + // first remove escapes related to non-format characters + + // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case + $format = strtolower($format); + + $format = str_replace('\\', '', $format); + + // 4-digit year + $format = str_replace('yyyy', 'Y', $format); + // 2-digit year + $format = str_replace('yy', 'y', $format); + // first letter of month - no php equivalent + $format = str_replace('mmmmm', 'M', $format); + // full month name + $format = str_replace('mmmm', 'F', $format); + // short month name + $format = str_replace('mmm', 'M', $format); + // mm is minutes if time or month w/leading zero + $format = str_replace(':mm', ':i', $format); + // tmp place holder + $format = str_replace('mm', 'x', $format); + // month no leading zero + $format = str_replace('m', 'n', $format); + // month leading zero + $format = str_replace('x', 'm', $format); + // 12-hour suffix + $format = str_replace('am/pm', 'A', $format); + // full day of week name + $format = str_replace('dddd', 'l', $format); + // short day of week name + $format = str_replace('ddd', 'D', $format); + // tmp place holder + $format = str_replace('dd', 'x', $format); + // days no leading zero + $format = str_replace('d', 'j', $format); + // days leading zero + $format = str_replace('x', 'd', $format); + // seconds + $format = str_replace('ss', 's', $format); + // fractional seconds - no php equivalent + $format = str_replace('.s', '', $format); + + if (!strpos($format,'A')) { // 24-hour format + $format = str_replace('h', 'H', $format); + } + + return gmdate($format, PHPExcel_Shared_Date::ExcelToPHP($value)); + + } else if (preg_match('/%$/', $format)) { // % number format + if ($format === self::FORMAT_PERCENTAGE) { + return round( (100 * $value), 0) . '%'; + } + if (preg_match('/\.[#0]+/i', $format, $m)) { + $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1); + $format = str_replace($m[0], $s, $format); + } + if (preg_match('/^[#0]+/', $format, $m)) { + $format = str_replace($m[0], strlen($m[0]), $format); + } + $format = '%' . str_replace('%', 'f%%', $format); + + return sprintf($format, 100 * $value); + + } else { + if (preg_match ("/^([0-9.,-]+)$/", $value)) { + if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) { + return 'EUR ' . sprintf('%1.2f', $value); + + } else { + // In Excel formats, "_" is used to add spacing, which we can't do in HTML + $format = preg_replace('/_./', '', $format); + + // Some non-number characters are escaped with \, which we don't need + $format = preg_replace("/\\\\/", '', $format); + + // Some non-number strings are quoted, so we'll get rid of the quotes + $format = preg_replace('/"/', '', $format); + + // TEMPORARY - Convert # to 0 + $format = preg_replace('/\\#/', '0', $format); + + // Find out if we need thousands separator + $useThousands = preg_match('/,/', $format); + if ($useThousands) { + $format = preg_replace('/,/', '', $format); + } + + if (preg_match('/0?.*\?\/\?/', $format, $m)) { + //echo 'Format mask is fractional '.$format.' <br />'; + $sign = ($value < 0) ? '-' : ''; + + $integerPart = floor(abs($value)); + $decimalPart = trim(fmod(abs($value),1),'0.'); + $decimalLength = strlen($decimalPart); + $decimalDivisor = pow(10,$decimalLength); + + $GCD = PHPExcel_Calculation_Functions::GCD($decimalPart,$decimalDivisor); + + $adjustedDecimalPart = $decimalPart/$GCD; + $adjustedDecimalDivisor = $decimalDivisor/$GCD; + + if (strpos($format,'0') !== false) { + $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor"; + } else { + $adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor; + $value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor"; + } + + } else { + // Handle the number itself + $number_regex = "/(\d+)(\.?)(\d*)/"; + if (preg_match($number_regex, $format, $matches)) { + $left = $matches[1]; + $dec = $matches[2]; + $right = $matches[3]; + if ($useThousands) { + $localeconv = localeconv(); + if (($localeconv['thousands_sep'] == '') || ($localeconv['decimal_point'] == '')) { + $value = number_format($value, strlen($right), $localeconv['mon_decimal_point'], $localeconv['mon_thousands_sep']); + } else { + $value = number_format($value, strlen($right), $localeconv['decimal_point'], $localeconv['thousands_sep']); + } + } else { + $sprintf_pattern = "%1." . strlen($right) . "f"; + $value = sprintf($sprintf_pattern, $value); + } + $value = preg_replace($number_regex, $value, $format); + } + } + + return $value; + + } + } + + return $value; + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Style/Protection.php b/libraries/PHPExcel/PHPExcel/Style/Protection.php new file mode 100644 index 000000000..57e974d33 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Style/Protection.php @@ -0,0 +1,324 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.4.5, 2007-08-23 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + + +/** + * PHPExcel_Style_Protection + * + * @category PHPExcel + * @package PHPExcel_Style + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Style_Protection implements PHPExcel_IComparable +{ + /** Protection styles */ + const PROTECTION_INHERIT = 'inherit'; + const PROTECTION_PROTECTED = 'protected'; + const PROTECTION_UNPROTECTED = 'unprotected'; + + /** + * Locked + * + * @var string + */ + private $_locked; + + /** + * Hidden + * + * @var string + */ + private $_hidden; + + /** + * Parent Borders + * + * @var _parentPropertyName string + */ + private $_parentPropertyName; + + /** + * Supervisor? + * + * @var boolean + */ + private $_isSupervisor; + + /** + * Parent. Only used for supervisor + * + * @var PHPExcel_Style + */ + private $_parent; + + /** + * Create a new PHPExcel_Style_Protection + */ + public function __construct($isSupervisor = false) + { + // Supervisor? + $this->_isSupervisor = $isSupervisor; + + // Initialise values + $this->_locked = self::PROTECTION_INHERIT; + $this->_hidden = self::PROTECTION_INHERIT; + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel_Style $parent + * @return PHPExcel_Style_Protection + */ + public function bindParent($parent) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a real style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style_Protection + */ + public function getSharedComponent() + { + return $this->_parent->getSharedComponent()->getProtection(); + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXSelectedCells() + { + return $this->getActiveSheet()->getXSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getXActiveCell() + { + return $this->getActiveSheet()->getXActiveCell(); + } + + /** + * Build style array from subcomponents + * + * @param array $array + * @return array + */ + public function getStyleArray($array) + { + return array('protection' => $array); + } + + /** + * Apply styles from array + * + * <code> + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) ); + * </code> + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Protection + */ + public function applyFromArray($pStyles = null) { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (array_key_exists('locked', $pStyles)) { + $this->setLocked($pStyles['locked']); + } + if (array_key_exists('hidden', $pStyles)) { + $this->setHidden($pStyles['hidden']); + } + } + } else { + throw new Exception("Invalid style array passed."); + } + return $this; + } + + /** + * Get locked + * + * @return string + */ + public function getLocked() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getLocked(); + } + return $this->_locked; + } + + /** + * Set locked + * + * @param string $pValue + * @return PHPExcel_Style_Protection + */ + public function setLocked($pValue = self::PROTECTION_INHERIT) { + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('locked' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_locked = $pValue; + } + return $this; + } + + /** + * Get hidden + * + * @return string + */ + public function getHidden() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHidden(); + } + return $this->_hidden; + } + + /** + * Set hidden + * + * @param string $pValue + * @return PHPExcel_Style_Protection + */ + public function setHidden($pValue = self::PROTECTION_INHERIT) { + if ($this->_isSupervisor) { + $styleArray = $this->getStyleArray(array('hidden' => $pValue)); + $this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray); + } else { + $this->_hidden = $pValue; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + return md5( + $this->_locked + . $this->_hidden + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet.php b/libraries/PHPExcel/PHPExcel/Worksheet.php new file mode 100644 index 000000000..c54ab702f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet.php @@ -0,0 +1,2378 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Cell_DataType */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell/DataType.php'; + +/** PHPExcel_Worksheet_RowDimension */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/RowDimension.php'; + +/** PHPExcel_Worksheet_ColumnDimension */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/ColumnDimension.php'; + +/** PHPExcel_Worksheet_PageSetup */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/PageSetup.php'; + +/** PHPExcel_Worksheet_PageMargins */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/PageMargins.php'; + +/** PHPExcel_Worksheet_HeaderFooter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/HeaderFooter.php'; + +/** PHPExcel_Worksheet_BaseDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/BaseDrawing.php'; + +/** PHPExcel_Worksheet_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing.php'; + +/** PHPExcel_Worksheet_MemoryDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/MemoryDrawing.php'; + +/** PHPExcel_Worksheet_HeaderFooterDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/HeaderFooterDrawing.php'; + +/** PHPExcel_Worksheet_SheetView */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/SheetView.php'; + +/** PHPExcel_Worksheet_Protection */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Protection.php'; + +/** PHPExcel_Worksheet_RowIterator */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/RowIterator.php'; + +/** PHPExcel_Comment */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Comment.php'; + +/** PHPExcel_Style */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php'; + +/** PHPExcel_Style_Fill */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php'; + +/** PHPExcel_Style_NumberFormat */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Shared_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Font.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_Shared_PasswordHasher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PasswordHasher.php'; + +/** PHPExcel_ReferenceHelper */ +require_once PHPEXCEL_ROOT . 'PHPExcel/ReferenceHelper.php'; + + +/** + * PHPExcel_Worksheet + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet implements PHPExcel_IComparable +{ + /* Break types */ + const BREAK_NONE = 0; + const BREAK_ROW = 1; + const BREAK_COLUMN = 2; + + /** + * Parent spreadsheet + * + * @var PHPExcel + */ + private $_parent; + + /** + * Collection of cells + * + * @var PHPExcel_Cell[] + */ + private $_cellCollection = array(); + + /** + * Collection of row dimensions + * + * @var PHPExcel_Worksheet_RowDimension[] + */ + private $_rowDimensions = array(); + + /** + * Default row dimension + * + * @var PHPExcel_Worksheet_RowDimension + */ + private $_defaultRowDimension = null; + + /** + * Collection of column dimensions + * + * @var PHPExcel_Worksheet_ColumnDimension[] + */ + private $_columnDimensions = array(); + + /** + * Default column dimension + * + * @var PHPExcel_Worksheet_ColumnDimension + */ + private $_defaultColumnDimension = null; + + /** + * Collection of drawings + * + * @var PHPExcel_Worksheet_BaseDrawing[] + */ + private $_drawingCollection = null; + + /** + * Worksheet title + * + * @var string + */ + private $_title; + + /** + * Page setup + * + * @var PHPExcel_Worksheet_PageSetup + */ + private $_pageSetup; + + /** + * Page margins + * + * @var PHPExcel_Worksheet_PageMargins + */ + private $_pageMargins; + + /** + * Page header/footer + * + * @var PHPExcel_Worksheet_HeaderFooter + */ + private $_headerFooter; + + /** + * Sheet view + * + * @var PHPExcel_Worksheet_SheetView + */ + private $_sheetView; + + /** + * Protection + * + * @var PHPExcel_Worksheet_Protection + */ + private $_protection; + + /** + * Collection of styles + * + * @var PHPExcel_Style[] + */ + private $_styles = array(); + + /** + * Conditional styles. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_conditionalStylesCollection = array(); + + /** + * Is the current cell collection sorted already? + * + * @var boolean + */ + private $_cellCollectionIsSorted = false; + + /** + * Collection of breaks + * + * @var array + */ + private $_breaks = array(); + + /** + * Collection of merged cell ranges + * + * @var array + */ + private $_mergeCells = array(); + + /** + * Collection of protected cell ranges + * + * @var array + */ + private $_protectedCells = array(); + + /** + * Autofilter Range + * + * @var string + */ + private $_autoFilter = ''; + + /** + * Freeze pane + * + * @var string + */ + private $_freezePane = ''; + + /** + * Show gridlines? + * + * @var boolean + */ + private $_showGridlines = true; + + /** + * Print gridlines? + * + * @var boolean + */ + private $_printGridlines = false; + + /** + * Show summary below? (Row/Column outline) + * + * @var boolean + */ + private $_showSummaryBelow = true; + + /** + * Show summary right? (Row/Column outline) + * + * @var boolean + */ + private $_showSummaryRight = true; + + /** + * Collection of comments + * + * @var PHPExcel_Comment[] + */ + private $_comments = array(); + + /** + * Selected cell + * + * @var string + */ + private $_selectedCell = 'A1'; + + /** + * Temporary property used by style supervisor. Will be removed + * + * @var string + */ + private $_xActiveCell = 'A1'; + + /** + * Temporary property used by style supervisor. Will be removed + * + * @var string + */ + private $_xSelectedCells = 'A1:A1'; + + /** + * Cached highest column + * + * @var string + */ + private $_cachedHighestColumn = null; + + /** + * Cached highest row + * + * @var int + */ + private $_cachedHighestRow = null; + + /** + * Right-to-left? + * + * @var boolean + */ + private $_rightToLeft = false; + + /** + * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_hyperlinkCollection = array(); + + /** + * Data validation objects. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_dataValidationCollection = array(); + + /** + * Create a new worksheet + * + * @param PHPExcel $pParent + * @param string $pTitle + */ + public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet') + { + // Set parent and title + $this->_parent = $pParent; + $this->setTitle($pTitle); + + // Set page setup + $this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); + + // Set page margins + $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); + + // Set page header/footer + $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); + + // Set sheet view + $this->_sheetView = new PHPExcel_Worksheet_SheetView(); + + // Drawing collection + $this->_drawingCollection = new ArrayObject(); + + // Protection + $this->_protection = new PHPExcel_Worksheet_Protection(); + + // Gridlines + $this->_showGridlines = true; + $this->_printGridlines = false; + + // Outline summary + $this->_showSummaryBelow = true; + $this->_showSummaryRight = true; + + // Default row dimension + $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null); + + // Default column dimension + $this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null); + } + + /** + * Get collection of cells + * + * @param boolean $pSorted Also sort the cell collection? + * @return PHPExcel_Cell[] + */ + public function getCellCollection($pSorted = true) + { + if ($pSorted) { + // Re-order cell collection + $this->sortCellCollection(); + } + + return $this->_cellCollection; + } + + /** + * Sort collection of cells + * + * @return PHPExcel_Worksheet + */ + public function sortCellCollection() + { + if (!$this->_cellCollectionIsSorted) { + // Re-order cell collection + // uasort($this->_cellCollection, array('PHPExcel_Cell', 'compareCells')); <-- slow + + $indexed = array(); + foreach (array_keys($this->_cellCollection) as $index) { + $rowNum = $this->_cellCollection[$index]->getRow(); + $colNum = PHPExcel_Cell::columnIndexFromString($this->_cellCollection[$index]->getColumn()); + + // Columns are limited to ZZZ (18278), so 20000 is plenty to assure no conflicts + $key = $rowNum * 20000 + $colNum; + + $indexed[$key] = $index; // &$this->_cellCollection[$index]; + } + ksort($indexed); + + // Rebuild cellCollection from the sorted index + $newCellCollection = array(); + foreach ($indexed as $index) { + $newCellCollection[$index] = $this->_cellCollection[$index]; + } + + $this->_cellCollection = $newCellCollection; + + $this->_cellCollectionIsSorted = true; + } + return $this; + } + + /** + * Get collection of row dimensions + * + * @return PHPExcel_Worksheet_RowDimension[] + */ + public function getRowDimensions() + { + return $this->_rowDimensions; + } + + /** + * Get default row dimension + * + * @return PHPExcel_Worksheet_RowDimension + */ + public function getDefaultRowDimension() + { + return $this->_defaultRowDimension; + } + + /** + * Get collection of column dimensions + * + * @return PHPExcel_Worksheet_ColumnDimension[] + */ + public function getColumnDimensions() + { + return $this->_columnDimensions; + } + + /** + * Get default column dimension + * + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getDefaultColumnDimension() + { + return $this->_defaultColumnDimension; + } + + /** + * Get collection of drawings + * + * @return PHPExcel_Worksheet_BaseDrawing[] + */ + public function getDrawingCollection() + { + return $this->_drawingCollection; + } + + /** + * Refresh column dimensions + * + * @return PHPExcel_Worksheet + */ + public function refreshColumnDimensions() + { + $currentColumnDimensions = $this->getColumnDimensions(); + $newColumnDimensions = array(); + + foreach ($currentColumnDimensions as $objColumnDimension) { + $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension; + } + + $this->_columnDimensions = $newColumnDimensions; + + return $this; + } + + /** + * Refresh row dimensions + * + * @return PHPExcel_Worksheet + */ + public function refreshRowDimensions() + { + $currentRowDimensions = $this->getRowDimensions(); + $newRowDimensions = array(); + + foreach ($currentRowDimensions as $objRowDimension) { + $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension; + } + + $this->_rowDimensions = $newRowDimensions; + + return $this; + } + + /** + * Calculate worksheet dimension + * + * @return string String containing the dimension of this worksheet + */ + public function calculateWorksheetDimension() + { + // Return + return 'A1' . ':' . $this->getHighestColumn() . $this->getHighestRow(); + } + + /** + * Calculate widths for auto-size columns + * + * @param boolean $calculateMergeCells Calculate merge cell width + * @return PHPExcel_Worksheet; + */ + public function calculateColumnWidths($calculateMergeCells = false) + { + $autoSizes = array(); + foreach ($this->getColumnDimensions() as $colDimension) { + if ($colDimension->getAutoSize()) { + $autoSizes[$colDimension->getColumnIndex()] = -1; + } + } + + foreach ($this->getCellCollection() as $cell) { + if (isset($autoSizes[$cell->getColumn()])) { + $cellValue = $cell->getCalculatedValue(); + + foreach ($this->getMergeCells() as $cells) { + if ($cell->isInRange($cells) && !$calculateMergeCells) { + $cellValue = ''; // do not calculate merge cells + } + } + + $autoSizes[$cell->getColumn()] = max( + (float)$autoSizes[$cell->getColumn()], + (float)PHPExcel_Shared_Font::calculateColumnWidth( + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSize(), + false, + $cellValue, + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation() + ) + ); + } + } + foreach ($autoSizes as $columnIndex => $width) { + if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth(); + $this->getColumnDimension($columnIndex)->setWidth($width); + } + + return $this; + } + + /** + * Get parent + * + * @return PHPExcel + */ + public function getParent() { + return $this->_parent; + } + + /** + * Re-bind parent + * + * @param PHPExcel $parent + * @return PHPExcel_Worksheet + */ + public function rebindParent(PHPExcel $parent) { + $namedRanges = $this->_parent->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + $parent->addNamedRange($namedRange); + } + + $this->_parent->removeSheetByIndex( + $this->_parent->getIndex($this) + ); + $this->_parent = $parent; + + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->_title; + } + + /** + * Set title + * + * @param string $pValue String containing the dimension of this worksheet + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setTitle($pValue = 'Worksheet') + { + // Is this a 'rename' or not? + if ($this->getTitle() == $pValue) { + return; + } + + // Maximum 31 characters allowed for sheet title + if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) { + throw new Exception('Maximum 31 characters allowed in sheet title.'); + } + + // Old title + $oldTitle = $this->getTitle(); + + // Is there already such sheet name? + if ($this->getParent()->getSheetByName($pValue)) { + // Use name, but append with lowest possible integer + + $i = 1; + while ($this->getParent()->getSheetByName($pValue . ' ' . $i)) { + ++$i; + } + + $altTitle = $pValue . ' ' . $i; + $this->setTitle($altTitle); + + return; + } + + // Set title + $this->_title = $pValue; + + // New title + $newTitle = $this->getTitle(); + PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->getParent(), $oldTitle, $newTitle); + + return $this; + } + + /** + * Get page setup + * + * @return PHPExcel_Worksheet_PageSetup + */ + public function getPageSetup() + { + return $this->_pageSetup; + } + + /** + * Set page setup + * + * @param PHPExcel_Worksheet_PageSetup $pValue + * @return PHPExcel_Worksheet + */ + public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue) + { + $this->_pageSetup = $pValue; + return $this; + } + + /** + * Get page margins + * + * @return PHPExcel_Worksheet_PageMargins + */ + public function getPageMargins() + { + return $this->_pageMargins; + } + + /** + * Set page margins + * + * @param PHPExcel_Worksheet_PageMargins $pValue + * @return PHPExcel_Worksheet + */ + public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue) + { + $this->_pageMargins = $pValue; + return $this; + } + + /** + * Get page header/footer + * + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function getHeaderFooter() + { + return $this->_headerFooter; + } + + /** + * Set page header/footer + * + * @param PHPExcel_Worksheet_HeaderFooter $pValue + * @return PHPExcel_Worksheet + */ + public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue) + { + $this->_headerFooter = $pValue; + return $this; + } + + /** + * Get sheet view + * + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function getSheetView() + { + return $this->_sheetView; + } + + /** + * Set sheet view + * + * @param PHPExcel_Worksheet_SheetView $pValue + * @return PHPExcel_Worksheet + */ + public function setSheetView(PHPExcel_Worksheet_SheetView $pValue) + { + $this->_sheetView = $pValue; + return $this; + } + + /** + * Get Protection + * + * @return PHPExcel_Worksheet_Protection + */ + public function getProtection() + { + return $this->_protection; + } + + /** + * Set Protection + * + * @param PHPExcel_Worksheet_Protection $pValue + * @return PHPExcel_Worksheet + */ + public function setProtection(PHPExcel_Worksheet_Protection $pValue) + { + $this->_protection = $pValue; + return $this; + } + + /** + * Get highest worksheet column + * + * @return string Highest column name + */ + public function getHighestColumn() + { + // Cached? + if (!is_null($this->_cachedHighestColumn)) { + return $this->_cachedHighestColumn; + } + + // Highest column + $highestColumn = -1; + + // Loop trough cells + foreach ($this->_cellCollection as $cell) { + if ($highestColumn < PHPExcel_Cell::columnIndexFromString($cell->getColumn())) { + $highestColumn = PHPExcel_Cell::columnIndexFromString($cell->getColumn()); + } + } + + // Loop trough column dimensions + foreach ($this->_columnDimensions as $dimension) { + if ($highestColumn < PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())) { + $highestColumn = PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex()); + } + } + + // Return & cache + if ($highestColumn < 0) { + $this->_cachedHighestColumn = 'A'; + } else { + $this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn); + } + + return $this->_cachedHighestColumn; + } + + /** + * Get highest worksheet row + * + * @return int Highest row number + */ + public function getHighestRow() + { + // Cached? + if (!is_null($this->_cachedHighestRow)) { + return $this->_cachedHighestRow; + } + + // Highest row + $highestRow = 1; + + // Loop trough cells + foreach ($this->_cellCollection as $cell) { + if ($cell->getRow() > $highestRow) { + $highestRow = $cell->getRow(); + } + } + + // Loop trough row dimensions + foreach ($this->_rowDimensions as $dimension) { + if ($highestRow < $dimension->getRowIndex()) { + $highestRow = $dimension->getRowIndex(); + } + } + + // Cache + $this->_cachedHighestRow = $highestRow; + + // Return + return $highestRow; + } + + /** + * Set a cell value + * + * @param string $pCoordinate Coordinate of the cell + * @param mixed $pValue Value of the cell + * @return PHPExcel_Worksheet + */ + public function setCellValue($pCoordinate = 'A1', $pValue = null) + { + // Set value + $this->getCell($pCoordinate)->setValue($pValue); + + return $this; + } + + /** + * Set a cell value by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @param mixed $pValue Value of the cell + * @return PHPExcel_Worksheet + */ + public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null) + { + return $this->setCellValue(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pValue); + } + + /** + * Set a cell value + * + * @param string $pCoordinate Coordinate of the cell + * @param mixed $pValue Value of the cell + * @param string $pDataType Explicit data type + * @return PHPExcel_Worksheet + */ + public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + { + // Set value + $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); + return $this; + } + + /** + * Set a cell value by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @param mixed $pValue Value of the cell + * @param string $pDataType Explicit data type + * @return PHPExcel_Worksheet + */ + public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) + { + return $this->setCellValueExplicit(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pValue, $pDataType); + } + + /** + * Get cell at a specific coordinate + * + * @param string $pCoordinate Coordinate of the cell + * @throws Exception + * @return PHPExcel_Cell Cell that was found + */ + public function getCell($pCoordinate = 'A1') + { + // Check cell collection + if (isset($this->_cellCollection[$pCoordinate])) { + return $this->_cellCollection[$pCoordinate]; + } + + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + return $this->getParent()->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]); + } + + // Named range? + if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches))) { + $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if (!is_null($namedRange)) { + $pCoordinate = $namedRange->getRange(); + if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { + if (!$namedRange->getLocalOnly()) { + return $namedRange->getWorksheet()->getCell($pCoordinate); + } else { + throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); + } + } + } + } + + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + throw new Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate,'$') !== false) { + throw new Exception('Cell coordinate must not be absolute.'); + } else { + // Coordinates + $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); + + $this->_cellCollection[$pCoordinate] = new PHPExcel_Cell($aCoordinates[0], $aCoordinates[1], null, PHPExcel_Cell_DataType::TYPE_NULL, $this); + $this->_cellCollectionIsSorted = false; + + $this->_cachedHighestColumn = null; + $this->_cachedHighestRow = null; + + return $this->_cellCollection[$pCoordinate]; + } + } + + /** + * Get cell at a specific coordinate by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @return PHPExcel_Cell Cell that was found + */ + public function getCellByColumnAndRow($pColumn = 0, $pRow = 0) + { + $coordinate = PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow; + + if (!isset($this->_cellCollection[$coordinate])) { + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn); + + $this->_cellCollection[$coordinate] = new PHPExcel_Cell($columnLetter, $pRow, null, PHPExcel_Cell_DataType::TYPE_NULL, $this); + $this->_cellCollectionIsSorted = false; + + $this->_cachedHighestColumn = null; + $this->_cachedHighestRow = null; + } + + return $this->_cellCollection[$coordinate]; + } + + /** + * Cell at a specific coordinate exists? + * + * @param string $pCoordinate Coordinate of the cell + * @throws Exception + * @return boolean + */ + public function cellExists($pCoordinate = 'A1') + { + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + return $this->getParent()->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]); + } + + // Named range? + if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches))) { + $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if (!is_null($namedRange)) { + $pCoordinate = $namedRange->getRange(); + if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { + if (!$namedRange->getLocalOnly()) { + return $namedRange->getWorksheet()->cellExists($pCoordinate); + } else { + throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); + } + } + } + } + + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + throw new Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate,'$') !== false) { + throw new Exception('Cell coordinate must not be absolute.'); + } else { + // Coordinates + $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); + + // Cell exists? + return isset($this->_cellCollection[$pCoordinate]); + } + } + + /** + * Cell at a specific coordinate by using numeric cell coordinates exists? + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @return boolean + */ + public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 0) + { + return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get row dimension at a specific row + * + * @param int $pRow Numeric index of the row + * @return PHPExcel_Worksheet_RowDimension + */ + public function getRowDimension($pRow = 0) + { + // Found + $found = null; + + // Get row dimension + if (!isset($this->_rowDimensions[$pRow])) { + $this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow); + $this->_cachedHighestRow = null; + } + return $this->_rowDimensions[$pRow]; + } + + /** + * Get column dimension at a specific column + * + * @param string $pColumn String index of the column + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getColumnDimension($pColumn = 'A') + { + // Uppercase coordinate + $pColumn = strtoupper($pColumn); + + // Fetch dimensions + if (!isset($this->_columnDimensions[$pColumn])) { + $this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn); + $this->_cachedHighestColumn = null; + } + return $this->_columnDimensions[$pColumn]; + } + + /** + * Get column dimension at a specific column by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getColumnDimensionByColumn($pColumn = 0) + { + return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn)); + } + + /** + * Get styles + * + * @return PHPExcel_Style[] + */ + public function getStyles() + { + return $this->_styles; + } + + /** + * Get default style of workbork. + * + * @deprecated + * @return PHPExcel_Style + * @throws Exception + */ + public function getDefaultStyle() + { + return $this->_parent->getDefaultStyle(); + } + + /** + * Set default style - should only be used by PHPExcel_IReader implementations! + * + * @deprecated + * @param PHPExcel_Style $value + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setDefaultStyle(PHPExcel_Style $value) + { + $this->_parent->setDefaultStyle($value); + return $this; + } + + /** + * Get style for cell + * + * @param string $pCellCoordinate Cell coordinate to get style for + * @return PHPExcel_Style + * @throws Exception + */ + public function getStyle($pCellCoordinate = 'A1') + { + // set this sheet as active + $this->_parent->setActiveSheetIndex($this->_parent->getIndex($this)); + + // set cell coordinate as active + $this->setXSelectedCells($pCellCoordinate); + + return $this->_parent->getCellXfSupervisor(); + } + + /** + * Get conditional styles for a cell + * + * @param string $pCoordinate + * @return PHPExcel_Style_Conditional[] + */ + public function getConditionalStyles($pCoordinate = 'A1') + { + if (!isset($this->_conditionalStylesCollection[$pCoordinate])) { + $this->_conditionalStylesCollection[$pCoordinate] = array(); + } + return $this->_conditionalStylesCollection[$pCoordinate]; + } + + /** + * Do conditional styles exist for this cell? + * + * @param string $pCoordinate + * @return boolean + */ + public function conditionalStylesExists($pCoordinate = 'A1') + { + if (isset($this->_conditionalStylesCollection[$pCoordinate])) { + return true; + } + return false; + } + + /** + * Removes conditional styles for a cell + * + * @param string $pCoordinate + * @return PHPExcel_Worksheet + */ + public function removeConditionalStyles($pCoordinate = 'A1') + { + unset($this->_conditionalStylesCollection[$pCoordinate]); + return $this; + } + + /** + * Get collection of conditional styles + * + * @return array + */ + public function getConditionalStylesCollection() + { + return $this->_conditionalStylesCollection; + } + + /** + * Set conditional styles + * + * @param $pCoordinate string E.g. 'A1' + * @param $pValue PHPExcel_Style_Conditional[] + * @return PHPExcel_Worksheet + */ + public function setConditionalStyles($pCoordinate = 'A1', $pValue) + { + $this->_conditionalStylesCollection[$pCoordinate] = $pValue; + return $this; + } + + /** + * Get style for cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @return PHPExcel_Style + */ + public function getStyleByColumnAndRow($pColumn = 0, $pRow = 0) + { + return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Set shared cell style to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @deprecated + * @param PHPExcel_Style $pSharedCellStyle Cell style to share + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '') + { + $this->duplicateStyle($pSharedCellStyle, $pRange); + return $this; + } + + /** + * Duplicate cell style to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @param PHPExcel_Style $pCellStyle Cell style to duplicate + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '') + { + // make sure we have a real style and not supervisor + $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle; + + // Add the style to the workbook if necessary + $workbook = $this->_parent; + if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) { + // there is already such cell Xf in our collection + $xfIndex = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($pCellStyle); + $xfIndex = $pCellStyle->getIndex(); + } + + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Is it a cell range or a single cell? + $rangeA = ''; + $rangeB = ''; + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + list($rangeA, $rangeB) = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Loop trough cells and apply styles + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex); + } + } + + return $this; + } + + /** + * Duplicate cell style array to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range, + * if they are in the styles array. For example, if you decide to set a range of + * cells to font bold, only include font bold in the styles array. + * + * @deprecated + * @param array $pStyles Array containing style information + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @param boolean $pAdvanced Advanced mode for setting borders. + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) + { + $this->getStyle($pRange)->applyFromArray($pStyles, $pAdvanced); + return $this; + } + + /** + * Set break on a cell + * + * @param string $pCell Cell coordinate (e.g. A1) + * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE) + { + // Uppercase coordinate + $pCell = strtoupper($pCell); + + if ($pCell != '') { + $this->_breaks[$pCell] = $pBreak; + } else { + throw new Exception('No cell coordinate specified.'); + } + + return $this; + } + + /** + * Set break on a cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setBreakByColumnAndRow($pColumn = 0, $pRow = 0, $pBreak = PHPExcel_Worksheet::BREAK_NONE) + { + return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); + } + + /** + * Get breaks + * + * @return array[] + */ + public function getBreaks() + { + return $this->_breaks; + } + + /** + * Set merge on a cell range + * + * @param string $pRange Cell range (e.g. A1:E1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function mergeCells($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange,':') !== false) { + $this->_mergeCells[$pRange] = $pRange; + } else { + throw new Exception('Merge must be set on a range of cells.'); + } + + return $this; + } + + /** + * Set merge on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->mergeCells($cellRange); + } + + /** + * Remove merge on a cell range + * + * @param string $pRange Cell range (e.g. A1:E1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function unmergeCells($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange,':') !== false) { + if (isset($this->_mergeCells[$pRange])) { + unset($this->_mergeCells[$pRange]); + } else { + throw new Exception('Cell range ' . $pRange . ' not known as merged.'); + } + } else { + throw new Exception('Merge can only be removed from a range of cells.'); + } + + return $this; + } + + /** + * Remove merge on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->unmergeCells($cellRange); + } + + /** + * Get merge cells + * + * @return array[] + */ + public function getMergeCells() + { + return $this->_mergeCells; + } + + /** + * Set protection on a cell range + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (!$pAlreadyHashed) { + $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword); + } + $this->_protectedCells[$pRange] = $pPassword; + + return $this; + } + + /** + * Set protection on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed); + } + + /** + * Remove protection on a cell range + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function unprotectCells($pRange = 'A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (isset($this->_protectedCells[$pRange])) { + unset($this->_protectedCells[$pRange]); + } else { + throw new Exception('Cell range ' . $pRange . ' not known as protected.'); + } + return $this; + } + + /** + * Remove protection on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed); + } + + /** + * Get protected cells + * + * @return array[] + */ + public function getProtectedCells() + { + return $this->_protectedCells; + } + + /** + * Get Autofilter Range + * + * @return string + */ + public function getAutoFilter() + { + return $this->_autoFilter; + } + + /** + * Set Autofilter Range + * + * @param string $pRange Cell range (i.e. A1:E10) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setAutoFilter($pRange = '') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange,':') !== false) { + $this->_autoFilter = $pRange; + } else { + throw new Exception('Autofilter must be set on a range of cells.'); + } + return $this; + } + + /** + * Set Autofilter Range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the second cell + * @param int $pRow2 Numeric row coordinate of the second cell + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) + { + return $this->setAutoFilter( + PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 + . ':' . + PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2 + ); + } + + /** + * Get Freeze Pane + * + * @return string + */ + public function getFreezePane() + { + return $this->_freezePane; + } + + /** + * Freeze Pane + * + * @param string $pCell Cell (i.e. A1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function freezePane($pCell = '') + { + // Uppercase coordinate + $pCell = strtoupper($pCell); + + if (strpos($pCell,':') === false && strpos($pCell,',') === false) { + $this->_freezePane = $pCell; + } else { + throw new Exception('Freeze pane can not be set on a range of cells.'); + } + return $this; + } + + /** + * Freeze Pane by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 0) + { + return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Unfreeze Pane + * + * @return PHPExcel_Worksheet + */ + public function unfreezePane() + { + return $this->freezePane(''); + } + + /** + * Insert a new row, updating all possible related data + * + * @param int $pBefore Insert before this one + * @param int $pNumRows Number of rows to insert + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) { + if ($pBefore >= 1) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this); + } else { + throw new Exception("Rows can only be inserted before at least row 1."); + } + return $this; + } + + /** + * Insert a new column, updating all possible related data + * + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to insert + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) { + if (!is_numeric($pBefore)) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this); + } else { + throw new Exception("Column references should not be numeric."); + } + return $this; + } + + /** + * Insert a new column, updating all possible related data + * + * @param int $pBefore Insert before this one (numeric column coordinate of the cell) + * @param int $pNumCols Number of columns to insert + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) { + if ($pBefore >= 0) { + return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols); + } else { + throw new Exception("Columns can only be inserted before at least column A (0)."); + } + } + + /** + * Delete a row, updating all possible related data + * + * @param int $pRow Remove starting with this one + * @param int $pNumRows Number of rows to remove + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function removeRow($pRow = 1, $pNumRows = 1) { + if ($pRow >= 1) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this); + } else { + throw new Exception("Rows to be deleted should at least start from row 1."); + } + return $this; + } + + /** + * Remove a column, updating all possible related data + * + * @param int $pColumn Remove starting with this one + * @param int $pNumCols Number of columns to remove + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function removeColumn($pColumn = 'A', $pNumCols = 1) { + if (!is_numeric($pColumn)) { + $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols); + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this); + } else { + throw new Exception("Column references should not be numeric."); + } + return $this; + } + + /** + * Remove a column, updating all possible related data + * + * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) + * @param int $pNumCols Number of columns to remove + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) { + if ($pColumn >= 0) { + return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols); + } else { + throw new Exception("Columns can only be inserted before at least column A (0)."); + } + } + + /** + * Show gridlines? + * + * @return boolean + */ + public function getShowGridlines() { + return $this->_showGridlines; + } + + /** + * Set show gridlines + * + * @param boolean $pValue Show gridlines (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowGridlines($pValue = false) { + $this->_showGridlines = $pValue; + return $this; + } + + /** + * Print gridlines? + * + * @return boolean + */ + public function getPrintGridlines() { + return $this->_printGridlines; + } + + /** + * Set print gridlines + * + * @param boolean $pValue Print gridlines (true/false) + * @return PHPExcel_Worksheet + */ + public function setPrintGridlines($pValue = false) { + $this->_printGridlines = $pValue; + return $this; + } + + /** + * Show summary below? (Row/Column outlining) + * + * @return boolean + */ + public function getShowSummaryBelow() { + return $this->_showSummaryBelow; + } + + /** + * Set show summary below + * + * @param boolean $pValue Show summary below (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowSummaryBelow($pValue = true) { + $this->_showSummaryBelow = $pValue; + return $this; + } + + /** + * Show summary right? (Row/Column outlining) + * + * @return boolean + */ + public function getShowSummaryRight() { + return $this->_showSummaryRight; + } + + /** + * Set show summary right + * + * @param boolean $pValue Show summary right (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowSummaryRight($pValue = true) { + $this->_showSummaryRight = $pValue; + return $this; + } + + /** + * Get comments + * + * @return PHPExcel_Comment[] + */ + public function getComments() + { + return $this->_comments; + } + + /** + * Get comment for cell + * + * @param string $pCellCoordinate Cell coordinate to get comment for + * @return PHPExcel_Comment + * @throws Exception + */ + public function getComment($pCellCoordinate = 'A1') + { + // Uppercase coordinate + $pCellCoordinate = strtoupper($pCellCoordinate); + + if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) { + throw new Exception('Cell coordinate string can not be a range of cells.'); + } else if (strpos($pCellCoordinate,'$') !== false) { + throw new Exception('Cell coordinate string must not be absolute.'); + } else if ($pCellCoordinate == '') { + throw new Exception('Cell coordinate can not be zero-length string.'); + } else { + // Check if we already have a comment for this cell. + // If not, create a new comment. + if (isset($this->_comments[$pCellCoordinate])) { + return $this->_comments[$pCellCoordinate]; + } else { + $newComment = new PHPExcel_Comment(); + $this->_comments[$pCellCoordinate] = $newComment; + return $newComment; + } + } + } + + /** + * Get comment for cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @return PHPExcel_Comment + */ + public function getCommentByColumnAndRow($pColumn = 0, $pRow = 0) + { + return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get selected cell + * + * @return string + */ + public function getSelectedCell() + { + return $this->_selectedCell; + } + + /** + * Temporary method used by style supervisor. Will be removed + * + * @return string + */ + public function getXActiveCell() + { + return $this->_xActiveCell; + } + + /** + * Temporary method used by style supervisor. Will be removed + * + * @return string + */ + public function getXSelectedCells() + { + return $this->_xSelectedCells; + } + + /** + * Selected cell + * + * @param string $pCell Cell (i.e. A1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setSelectedCell($pCell = '') + { + // Uppercase coordinate + $pCell = strtoupper($pCell); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + $this->_selectedCell = $pCell; + } else { + throw new Exception('Selected cell can not be set on a range of cells.'); + } + return $this; + } + + /** + * Temporary method used by style supervisor. Will be removed + * + * @param string $pCell Cell (i.e. A1) + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setXSelectedCells($pCoordinate = 'A1:A1') + { + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + list($first, ) = PHPExcel_Cell::splitRange($pCoordinate); + $this->_xActiveCell = $first[0]; + } else { + $this->_xActiveCell = $pCoordinate; + } + $this->_xSelectedCells = $pCoordinate; + return $this; + } + + /** + * Selected cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 0) + { + return $this->setSelectedCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get right-to-left + * + * @return boolean + */ + public function getRightToLeft() { + return $this->_rightToLeft; + } + + /** + * Set right-to-left + * + * @param boolean $value Right-to-left true/false + * @return PHPExcel_Worksheet + */ + public function setRightToLeft($value = false) { + $this->_rightToLeft = $value; + return $this; + } + + /** + * Fill worksheet from values in array + * + * @param array $source Source array + * @param mixed $nullValue Value treated as "null" + * @throws Exception + * @return PHPExcel_Worksheet + */ + public function fromArray($source = null, $nullValue = null, $pCell = 'A1') { + if (is_array($source)) { + // start coordinate + list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($pCell); + $startColumn = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; + + // Loop trough $source + $currentRow = $startRow - 1; + $rowData = null; + foreach ($source as $rowData) { + ++$currentRow; + + $rowCount = count($rowData); + for ($i = 0; $i < $rowCount; ++$i) { + if ($rowData[$i] != $nullValue) { + // Set cell value + $this->setCellValue( + PHPExcel_Cell::stringFromColumnIndex($i + $startColumn) . $currentRow, $rowData[$i] + ); + } + } + } + } else { + throw new Exception("Parameter \$source should be an array."); + } + return $this; + } + + /** + * Create array from worksheet + * + * @param mixed $nullValue Value treated as "null" + * @param boolean $calculateFormulas Should formulas be calculated? + * @return array + */ + public function toArray($nullValue = null, $calculateFormulas = true) { + // Returnvalue + $returnValue = array(); + + // Garbage collect... + $this->garbageCollect(); + + // Get worksheet dimension + $dimension = explode(':', $this->calculateWorksheetDimension()); + $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]); + $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1; + $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]); + $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1; + + // Loop trough cells + for ($row = $dimension[0][1]; $row <= $dimension[1][1]; ++$row) { + for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) { + // Cell exists? + if ($this->cellExistsByColumnAndRow($column, $row)) { + $cell = $this->getCellByColumnAndRow($column, $row); + + if ($cell->getValue() instanceof PHPExcel_RichText) { + $returnValue[$row][$column] = $cell->getValue()->getPlainText(); + } else { + if ($calculateFormulas) { + $returnValue[$row][$column] = $cell->getCalculatedValue(); + } else { + $returnValue[$row][$column] = $cell->getValue(); + } + } + + $style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); + + $returnValue[$row][$column] = PHPExcel_Style_NumberFormat::toFormattedString($returnValue[$row][$column], $style->getNumberFormat()->getFormatCode()); + } else { + $returnValue[$row][$column] = $nullValue; + } + } + } + + // Return + return $returnValue; + } + + /** + * Get row iterator + * + * @return PHPExcel_Worksheet_RowIterator + */ + public function getRowIterator() { + return new PHPExcel_Worksheet_RowIterator($this); + } + + /** + * Run PHPExcel garabage collector. + * + * @return PHPExcel_Worksheet + */ + public function garbageCollect() { + // Build a reference table from images + $imageCoordinates = array(); + $iterator = $this->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + $imageCoordinates[$iterator->current()->getCoordinates()] = true; + + $iterator->next(); + } + + // Find cells that can be cleaned + foreach ($this->_cellCollection as $coordinate => $cell) { + // Can be cleaned? + $canBeCleaned = false; + + // Empty value? + if (is_null($cell->getValue()) || (!is_object($cell->getValue()) && $cell->getValue() === '' && !$cell->hasHyperlink())) { + // default style ? + if ($cell->getXfIndex() == 0) { + $canBeCleaned = true; + } + } + + // Referenced in image? + if (isset($imageCoordinates[$coordinate]) && $imageCoordinates[$coordinate] === true) { + $canBeCleaned = false; + } + + // Clean? + if ($canBeCleaned) { + unset($this->_cellCollection[$coordinate]); + } + } + + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_title + . $this->_autoFilter + . ($this->_protection->isProtectionEnabled() ? 't' : 'f') + //. $this->calculateWorksheetDimension() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Extract worksheet title from range. + * + * Example: extractSheetTitle('test!A1') ==> 'A1' + * Example: extractSheetTitle('test!A1', true) ==> array('test', 'A1'); + * + * @param string $pRange Range to extract title from + * @param bool $returnRange Return range? (see example) + * @return mixed + */ + public static function extractSheetTitle($pRange, $returnRange = false) { + // Sheet title included? + if (strpos($pRange, '!') === false) { + return ''; + } + + // Position of separator exclamation mark + $sep = strrpos($pRange, '!'); + + // Extract sheet title + $reference[0] = substr($pRange, 0, $sep); + $reference[1] = substr($pRange, $sep + 1); + + // Strip possible enclosing single quotes + if (strpos($reference[0], '\'') === 0) { + $reference[0] = substr($reference[0], 1); + } + if (strrpos($reference[0], '\'') === strlen($reference[0]) - 1) { + $reference[0] = substr($reference[0], 0, strlen($reference[0]) - 1); + } + + if ($returnRange) { + return $reference; + } else { + return $reference[1]; + } + } + + /** + * Get hyperlink + * + * @param string $pCellCoordinate Cell coordinate to get hyperlink for + */ + public function getHyperlink($pCellCoordinate = 'A1') + { + // return hyperlink if we already have one + if (isset($this->_hyperlinkCollection[$pCellCoordinate])) { + return $this->_hyperlinkCollection[$pCellCoordinate]; + } + + // else create hyperlink + $cell = $this->getCell($pCellCoordinate); + $this->_hyperlinkCollection[$pCellCoordinate] = new PHPExcel_Cell_Hyperlink($cell); + return $this->_hyperlinkCollection[$pCellCoordinate]; + } + + /** + * Set hyperlnk + * + * @param string $pCellCoordinate Cell coordinate to insert hyperlink + * @param PHPExcel_Cell_Hyperlink $pHyperlink + * @return PHPExcel_Worksheet + */ + public function setHyperlink($pCellCoordinate = 'A1', PHPExcel_Cell_Hyperlink $pHyperlink = null) + { + if ($pHyperlink === null) { + unset($this->_hyperlinkCollection[$pCellCoordinate]); + } else { + $this->_hyperlinkCollection[$pCellCoordinate] = $pHyperlink; + $pHyperlink->setParent($this->getCell($pCellCoordinate)); + } + return $this; + } + + /** + * Hyperlink at a specific coordinate exists? + * + * @param string $pCellCoordinate + * @return boolean + */ + public function hyperlinkExists($pCoordinate = 'A1') + { + return isset($this->_hyperlinkCollection[$pCoordinate]); + } + + /** + * Get collection of hyperlinks + * + * @return PHPExcel_Cell_Hyperlink[] + */ + public function getHyperlinkCollection() + { + return $this->_hyperlinkCollection; + } + + /** + * Get data validation + * + * @param string $pCellCoordinate Cell coordinate to get data validation for + */ + public function getDataValidation($pCellCoordinate = 'A1') + { + // return data validation if we already have one + if (isset($this->_dataValidationCollection[$pCellCoordinate])) { + return $this->_dataValidationCollection[$pCellCoordinate]; + } + + // else create data validation + $cell = $this->getCell($pCellCoordinate); + $this->_dataValidationCollection[$pCellCoordinate] = new PHPExcel_Cell_DataValidation($cell); + return $this->_dataValidationCollection[$pCellCoordinate]; + } + + /** + * Set data validation + * + * @param string $pCellCoordinate Cell coordinate to insert data validation + * @param PHPExcel_Cell_DataValidation $pDataValidation + * @return PHPExcel_Worksheet + */ + public function setDataValidation($pCellCoordinate = 'A1', PHPExcel_Cell_DataValidation $pDataValidation = null) + { + if ($pDataValidation === null) { + unset($this->_dataValidationCollection[$pCellCoordinate]); + } else { + $this->_dataValidationCollection[$pCellCoordinate] = $pDataValidation; + $pDataValidation->setParent($this->getCell($pCellCoordinate)); + } + return $this; + } + + /** + * Data validation at a specific coordinate exists? + * + * @param string $pCellCoordinate + * @return boolean + */ + public function dataValidationExists($pCoordinate = 'A1') + { + return isset($this->_dataValidationCollection[$pCoordinate]); + } + + /** + * Get collection of data validations + * + * @return PHPExcel_Cell_DataValidation[] + */ + public function getDataValidationCollection() + { + return $this->_dataValidationCollection; + } + + /** + * Copy worksheet (!= clone!) + * + * @return PHPExcel_Worksheet + */ + public function copy() { + $copied = clone $this; + + return $copied; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + foreach ($this as $key => $val) { + if ($key == '_parent') { + continue; + } + + if (is_object($val) || (is_array($val))) { + $this->{$key} = unserialize(serialize($val)); + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/BaseDrawing.php b/libraries/PHPExcel/PHPExcel/Worksheet/BaseDrawing.php new file mode 100644 index 000000000..364689863 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/BaseDrawing.php @@ -0,0 +1,533 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_Drawing_Shadow */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php'; + +/** + * PHPExcel_Worksheet_BaseDrawing + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +{ + /** + * Image counter + * + * @var int + */ + private static $_imageCounter = 0; + + /** + * Image index + * + * @var int + */ + private $_imageIndex = 0; + + /** + * Name + * + * @var string + */ + protected $_name; + + /** + * Description + * + * @var string + */ + protected $_description; + + /** + * Worksheet + * + * @var PHPExcel_Worksheet + */ + protected $_worksheet; + + /** + * Coordinates + * + * @var string + */ + protected $_coordinates; + + /** + * Offset X + * + * @var int + */ + protected $_offsetX; + + /** + * Offset Y + * + * @var int + */ + protected $_offsetY; + + /** + * Width + * + * @var int + */ + protected $_width; + + /** + * Height + * + * @var int + */ + protected $_height; + + /** + * Proportional resize + * + * @var boolean + */ + protected $_resizeProportional; + + /** + * Rotation + * + * @var int + */ + protected $_rotation; + + /** + * Shadow + * + * @var PHPExcel_Worksheet_Drawing_Shadow + */ + protected $_shadow; + + /** + * Create a new PHPExcel_Worksheet_BaseDrawing + */ + public function __construct() + { + // Initialise values + $this->_name = ''; + $this->_description = ''; + $this->_worksheet = null; + $this->_coordinates = 'A1'; + $this->_offsetX = 0; + $this->_offsetY = 0; + $this->_width = 0; + $this->_height = 0; + $this->_resizeProportional = true; + $this->_rotation = 0; + $this->_shadow = new PHPExcel_Worksheet_Drawing_Shadow(); + + // Set image index + self::$_imageCounter++; + $this->_imageIndex = self::$_imageCounter; + } + + /** + * Get image index + * + * @return int + */ + public function getImageIndex() { + return $this->_imageIndex; + } + + /** + * Get Name + * + * @return string + */ + public function getName() { + return $this->_name; + } + + /** + * Set Name + * + * @param string $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setName($pValue = '') { + $this->_name = $pValue; + return $this; + } + + /** + * Get Description + * + * @return string + */ + public function getDescription() { + return $this->_description; + } + + /** + * Set Description + * + * @param string $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setDescription($pValue = '') { + $this->_description = $pValue; + return $this; + } + + /** + * Get Worksheet + * + * @return PHPExcel_Worksheet + */ + public function getWorksheet() { + return $this->_worksheet; + } + + /** + * Set Worksheet + * + * @param PHPExcel_Worksheet $pValue + * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? + * @throws Exception + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) { + if (is_null($this->_worksheet)) { + // Add drawing to PHPExcel_Worksheet + $this->_worksheet = $pValue; + $this->_worksheet->getCell($this->_coordinates); + $this->_worksheet->getDrawingCollection()->append($this); + } else { + if ($pOverrideOld) { + // Remove drawing from old PHPExcel_Worksheet + $iterator = $this->_worksheet->getDrawingCollection()->getIterator(); + + while ($iterator->valid()) { + if ($iterator->current()->getHashCode() == $this->getHashCode()) { + $this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() ); + $this->_worksheet = null; + break; + } + } + + // Set new PHPExcel_Worksheet + $this->setWorksheet($pValue); + } else { + throw new Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); + } + } + return $this; + } + + /** + * Get Coordinates + * + * @return string + */ + public function getCoordinates() { + return $this->_coordinates; + } + + /** + * Set Coordinates + * + * @param string $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setCoordinates($pValue = 'A1') { + $this->_coordinates = $pValue; + return $this; + } + + /** + * Get OffsetX + * + * @return int + */ + public function getOffsetX() { + return $this->_offsetX; + } + + /** + * Set OffsetX + * + * @param int $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setOffsetX($pValue = 0) { + $this->_offsetX = $pValue; + return $this; + } + + /** + * Get OffsetY + * + * @return int + */ + public function getOffsetY() { + return $this->_offsetY; + } + + /** + * Set OffsetY + * + * @param int $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setOffsetY($pValue = 0) { + $this->_offsetY = $pValue; + return $this; + } + + /** + * Get Width + * + * @return int + */ + public function getWidth() { + return $this->_width; + } + + /** + * Set Width + * + * @param int $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setWidth($pValue = 0) { + // Resize proportional? + if ($this->_resizeProportional && $pValue != 0) { + $ratio = $this->_height / $this->_width; + $this->_height = round($ratio * $pValue); + } + + // Set width + $this->_width = $pValue; + + return $this; + } + + /** + * Get Height + * + * @return int + */ + public function getHeight() { + return $this->_height; + } + + /** + * Set Height + * + * @param int $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setHeight($pValue = 0) { + // Resize proportional? + if ($this->_resizeProportional && $pValue != 0) { + $ratio = $this->_width / $this->_height; + $this->_width = round($ratio * $pValue); + } + + // Set height + $this->_height = $pValue; + + return $this; + } + + /** + * Set width and height with proportional resize + * Example: + * <code> + * $objDrawing->setResizeProportional(true); + * $objDrawing->setWidthAndHeight(160,120); + * </code> + * + * @author Vincent@luo MSN:kele_100@hotmail.com + * @param int $width + * @param int $height + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setWidthAndHeight($width = 0, $height = 0) { + $xratio = $width / $this->_width; + $yratio = $height / $this->_height; + if ($this->_resizeProportional && !($width == 0 || $height == 0)) { + if (($xratio * $this->_height) < $height) { + $this->_height = ceil($xratio * $this->_height); + $this->_width = $width; + } else { + $this->_width = ceil($yratio * $this->_width); + $this->_height = $height; + } + } + return $this; + } + + /** + * Get ResizeProportional + * + * @return boolean + */ + public function getResizeProportional() { + return $this->_resizeProportional; + } + + /** + * Set ResizeProportional + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setResizeProportional($pValue = true) { + $this->_resizeProportional = $pValue; + return $this; + } + + /** + * Get Rotation + * + * @return int + */ + public function getRotation() { + return $this->_rotation; + } + + /** + * Set Rotation + * + * @param int $pValue + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setRotation($pValue = 0) { + $this->_rotation = $pValue; + return $this; + } + + /** + * Get Shadow + * + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function getShadow() { + return $this->_shadow; + } + + /** + * Set Shadow + * + * @param PHPExcel_Worksheet_Drawing_Shadow $pValue + * @throws Exception + * @return PHPExcel_Worksheet_BaseDrawing + */ + public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) { + $this->_shadow = $pValue; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_name + . $this->_description + . $this->_worksheet->getHashCode() + . $this->_coordinates + . $this->_offsetX + . $this->_offsetY + . $this->_width + . $this->_height + . $this->_rotation + . $this->_shadow->getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/CellIterator.php b/libraries/PHPExcel/PHPExcel/Worksheet/CellIterator.php new file mode 100644 index 000000000..6581cab62 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/CellIterator.php @@ -0,0 +1,176 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + + +/** + * PHPExcel_Worksheet_CellIterator + * + * Used to iterate rows in a PHPExcel_Worksheet + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_CellIterator extends IteratorIterator +{ + /** + * PHPExcel_Worksheet to iterate + * + * @var PHPExcel_Worksheet + */ + private $_subject; + + /** + * Row index + * + * @var int + */ + private $_rowIndex; + + /** + * Current iterator position + * + * @var int + */ + private $_position = 0; + + /** + * Loop only existing cells + * + * @var boolean + */ + private $_onlyExistingCells = true; + + /** + * Create a new cell iterator + * + * @param PHPExcel_Worksheet $subject + * @param int $rowIndex + */ + public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1) { + // Set subject and row index + $this->_subject = $subject; + $this->_rowIndex = $rowIndex; + } + + /** + * Destructor + */ + public function __destruct() { + unset($this->_subject); + } + + /** + * Rewind iterator + */ + public function rewind() { + $this->_position = 0; + } + + /** + * Current PHPExcel_Cell + * + * @return PHPExcel_Cell + */ + public function current() { + $cellExists = $this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex); + if ( ($this->_onlyExistingCells && $cellExists) || (!$this->_onlyExistingCells) ) { + return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex); + } else if ($this->_onlyExistingCells && !$cellExists) { + // Loop untill we find one + while ($this->valid()) { + $this->next(); + if ($this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) { + return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex); + } + } + } + + return null; + } + + /** + * Current key + * + * @return int + */ + public function key() { + return $this->_position; + } + + /** + * Next value + */ + public function next() { + ++$this->_position; + } + + /** + * More PHPExcel_Cell instances available? + * + * @return boolean + */ + public function valid() { + return $this->_position < PHPExcel_Cell::columnIndexFromString( $this->_subject->getHighestColumn() ); + } + + /** + * Get loop only existing cells + * + * @return boolean + */ + public function getIterateOnlyExistingCells() { + return $this->_onlyExistingCells; + } + + /** + * Set loop only existing cells + * + * @return boolean + */ + public function setIterateOnlyExistingCells($value = true) { + $this->_onlyExistingCells = $value; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/ColumnDimension.php b/libraries/PHPExcel/PHPExcel/Worksheet/ColumnDimension.php new file mode 100644 index 000000000..ada5bf166 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/ColumnDimension.php @@ -0,0 +1,238 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Worksheet_ColumnDimension + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_ColumnDimension +{ + /** + * Column index + * + * @var int + */ + private $_columnIndex; + + /** + * Column width + * + * When this is set to a negative value, the column width should be ignored by IWriter + * + * @var double + */ + private $_width; + + /** + * Auto size? + * + * @var bool + */ + private $_autoSize; + + /** + * Visible? + * + * @var bool + */ + private $_visible; + + /** + * Outline level + * + * @var int + */ + private $_outlineLevel = 0; + + /** + * Collapsed + * + * @var bool + */ + private $_collapsed; + + /** + * Create a new PHPExcel_Worksheet_RowDimension + * + * @param string $pIndex Character column index + */ + public function __construct($pIndex = 'A') + { + // Initialise values + $this->_columnIndex = $pIndex; + $this->_width = -1; + $this->_autoSize = false; + $this->_visible = true; + $this->_outlineLevel = 0; + $this->_collapsed = false; + } + + /** + * Get ColumnIndex + * + * @return string + */ + public function getColumnIndex() { + return $this->_columnIndex; + } + + /** + * Set ColumnIndex + * + * @param string $pValue + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setColumnIndex($pValue) { + $this->_columnIndex = $pValue; + return $this; + } + + /** + * Get Width + * + * @return double + */ + public function getWidth() { + return $this->_width; + } + + /** + * Set Width + * + * @param double $pValue + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setWidth($pValue = -1) { + $this->_width = $pValue; + return $this; + } + + /** + * Get Auto Size + * + * @return bool + */ + public function getAutoSize() { + return $this->_autoSize; + } + + /** + * Set Auto Size + * + * @param bool $pValue + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setAutoSize($pValue = false) { + $this->_autoSize = $pValue; + return $this; + } + + /** + * Get Visible + * + * @return bool + */ + public function getVisible() { + return $this->_visible; + } + + /** + * Set Visible + * + * @param bool $pValue + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setVisible($pValue = true) { + $this->_visible = $pValue; + return $this; + } + + /** + * Get Outline Level + * + * @return int + */ + public function getOutlineLevel() { + return $this->_outlineLevel; + } + + /** + * Set Outline Level + * + * Value must be between 0 and 7 + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setOutlineLevel($pValue) { + if ($pValue < 0 || $pValue > 7) { + throw new Exception("Outline level must range between 0 and 7."); + } + + $this->_outlineLevel = $pValue; + return $this; + } + + /** + * Get Collapsed + * + * @return bool + */ + public function getCollapsed() { + return $this->_collapsed; + } + + /** + * Set Collapsed + * + * @param bool $pValue + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function setCollapsed($pValue = true) { + $this->_collapsed = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/Drawing.php b/libraries/PHPExcel/PHPExcel/Worksheet/Drawing.php new file mode 100644 index 000000000..780662e9e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/Drawing.php @@ -0,0 +1,200 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet_Drawing + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_BaseDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/BaseDrawing.php'; + +/** PHPExcel_Worksheet_Drawing_Shadow */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php'; + + +/** + * PHPExcel_Worksheet_Drawing + * + * @category PHPExcel + * @package PHPExcel_Worksheet_Drawing + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +{ + /** + * Path + * + * @var string + */ + private $_path; + + /** + * Create a new PHPExcel_Worksheet_Drawing + */ + public function __construct() + { + // Initialise values + $this->_path = ''; + + // Initialize parent + parent::__construct(); + } + + /** + * Get Filename + * + * @return string + */ + public function getFilename() { + return basename($this->_path); + } + + /** + * Get indexed filename (using image index) + * + * @return string + */ + public function getIndexedFilename() { + $fileName = $this->getFilename(); + $fileName = str_replace(' ', '_', $fileName); + return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension(); + } + + /** + * Get Extension + * + * @return string + */ + public function getExtension() { + $exploded = explode(".", basename($this->_path)); + return $exploded[count($exploded) - 1]; + } + + /** + * Get Path + * + * @return string + */ + public function getPath() { + return $this->_path; + } + + /** + * Set Path + * + * @param string $pValue File path + * @param boolean $pVerifyFile Verify file + * @throws Exception + * @return PHPExcel_Worksheet_Drawing + */ + public function setPath($pValue = '', $pVerifyFile = true) { + if ($pVerifyFile) { + if (file_exists($pValue)) { + $this->_path = $pValue; + + if ($this->_width == 0 && $this->_height == 0) { + // Get width/height + list($this->_width, $this->_height) = getimagesize($pValue); + } + } else { + throw new Exception("File $pValue not found!"); + } + } else { + $this->_path = $pValue; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_path + . parent::getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/Drawing/Shadow.php b/libraries/PHPExcel/PHPExcel/Worksheet/Drawing/Shadow.php new file mode 100644 index 000000000..c931671fd --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/Drawing/Shadow.php @@ -0,0 +1,336 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet_Drawing + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** + * PHPExcel_Worksheet_Drawing_Shadow + * + * @category PHPExcel + * @package PHPExcel_Worksheet_Drawing + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable +{ + /* Shadow alignment */ + const SHADOW_BOTTOM = 'b'; + const SHADOW_BOTTOM_LEFT = 'bl'; + const SHADOW_BOTTOM_RIGHT = 'br'; + const SHADOW_CENTER = 'ctr'; + const SHADOW_LEFT = 'l'; + const SHADOW_TOP = 't'; + const SHADOW_TOP_LEFT = 'tl'; + const SHADOW_TOP_RIGHT = 'tr'; + + /** + * Visible + * + * @var boolean + */ + private $_visible; + + /** + * Blur radius + * + * Defaults to 6 + * + * @var int + */ + private $_blurRadius; + + /** + * Shadow distance + * + * Defaults to 2 + * + * @var int + */ + private $_distance; + + /** + * Shadow direction (in degrees) + * + * @var int + */ + private $_direction; + + /** + * Shadow alignment + * + * @var int + */ + private $_alignment; + + /** + * Color + * + * @var PHPExcel_Style_Color + */ + private $_color; + + /** + * Alpha + * + * @var int + */ + private $_alpha; + + /** + * Create a new PHPExcel_Worksheet_Drawing_Shadow + */ + public function __construct() + { + // Initialise values + $this->_visible = false; + $this->_blurRadius = 6; + $this->_distance = 2; + $this->_direction = 0; + $this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; + $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); + $this->_alpha = 50; + } + + /** + * Get Visible + * + * @return boolean + */ + public function getVisible() { + return $this->_visible; + } + + /** + * Set Visible + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setVisible($pValue = false) { + $this->_visible = $pValue; + return $this; + } + + /** + * Get Blur radius + * + * @return int + */ + public function getBlurRadius() { + return $this->_blurRadius; + } + + /** + * Set Blur radius + * + * @param int $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setBlurRadius($pValue = 6) { + $this->_blurRadius = $pValue; + return $this; + } + + /** + * Get Shadow distance + * + * @return int + */ + public function getDistance() { + return $this->_distance; + } + + /** + * Set Shadow distance + * + * @param int $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setDistance($pValue = 2) { + $this->_distance = $pValue; + return $this; + } + + /** + * Get Shadow direction (in degrees) + * + * @return int + */ + public function getDirection() { + return $this->_direction; + } + + /** + * Set Shadow direction (in degrees) + * + * @param int $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setDirection($pValue = 0) { + $this->_direction = $pValue; + return $this; + } + + /** + * Get Shadow alignment + * + * @return int + */ + public function getAlignment() { + return $this->_alignment; + } + + /** + * Set Shadow alignment + * + * @param int $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setAlignment($pValue = 0) { + $this->_alignment = $pValue; + return $this; + } + + /** + * Get Color + * + * @return PHPExcel_Style_Color + */ + public function getColor() { + return $this->_color; + } + + /** + * Set Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setColor(PHPExcel_Style_Color $pValue = null) { + $this->_color = $pValue; + return $this; + } + + /** + * Get Alpha + * + * @return int + */ + public function getAlpha() { + return $this->_alpha; + } + + /** + * Set Alpha + * + * @param int $pValue + * @return PHPExcel_Worksheet_Drawing_Shadow + */ + public function setAlpha($pValue = 0) { + $this->_alpha = $pValue; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + ($this->_visible ? 't' : 'f') + . $this->_blurRadius + . $this->_distance + . $this->_direction + . $this->_alignment + . $this->_color->getHashCode() + . $this->_alpha + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooter.php b/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooter.php new file mode 100644 index 000000000..b985bf8b3 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooter.php @@ -0,0 +1,489 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Worksheet_HeaderFooterDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/HeaderFooterDrawing.php'; + + +/** + * PHPExcel_Worksheet_HeaderFooter + * + * <code> + * Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference, page 1970: + * + * There are a number of formatting codes that can be written inline with the actual header / footer text, which + * affect the formatting in the header or footer. + * + * Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on + * the second line (center section). + * &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D + * + * General Rules: + * There is no required order in which these codes must appear. + * + * The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again: + * - strikethrough + * - superscript + * - subscript + * Superscript and subscript cannot both be ON at same time. Whichever comes first wins and the other is ignored, + * while the first is ON. + * &L - code for "left section" (there are three header / footer locations, "left", "center", and "right"). When + * two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the + * order of appearance, and placed into the left section. + * &P - code for "current page #" + * &N - code for "total pages" + * &font size - code for "text font size", where font size is a font size in points. + * &K - code for "text font color" + * RGB Color is specified as RRGGBB + * Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade + * value, NN is the tint/shade value. + * &S - code for "text strikethrough" on / off + * &X - code for "text super script" on / off + * &Y - code for "text subscript" on / off + * &C - code for "center section". When two or more occurrences of this section marker exist, the contents + * from all markers are concatenated, in the order of appearance, and placed into the center section. + * + * &D - code for "date" + * &T - code for "time" + * &G - code for "picture as background" + * &U - code for "text single underline" + * &E - code for "double underline" + * &R - code for "right section". When two or more occurrences of this section marker exist, the contents + * from all markers are concatenated, in the order of appearance, and placed into the right section. + * &Z - code for "this workbook's file path" + * &F - code for "this workbook's file name" + * &A - code for "sheet tab name" + * &+ - code for add to page #. + * &- - code for subtract from page #. + * &"font name,font type" - code for "text font name" and "text font type", where font name and font type + * are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font + * name, it means "none specified". Both of font name and font type can be localized values. + * &"-,Bold" - code for "bold font style" + * &B - also means "bold font style". + * &"-,Regular" - code for "regular font style" + * &"-,Italic" - code for "italic font style" + * &I - also means "italic font style" + * &"-,Bold Italic" code for "bold italic font style" + * &O - code for "outline style" + * &H - code for "shadow style" + * </code> + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_HeaderFooter +{ + /* Header/footer image location */ + const IMAGE_HEADER_LEFT = 'LH'; + const IMAGE_HEADER_CENTER = 'CH'; + const IMAGE_HEADER_RIGHT = 'RH'; + const IMAGE_FOOTER_LEFT = 'LF'; + const IMAGE_FOOTER_CENTER = 'CF'; + const IMAGE_FOOTER_RIGHT = 'RF'; + + /** + * OddHeader + * + * @var string + */ + private $_oddHeader; + + /** + * OddFooter + * + * @var string + */ + private $_oddFooter; + + /** + * EvenHeader + * + * @var string + */ + private $_evenHeader; + + /** + * EvenFooter + * + * @var string + */ + private $_evenFooter; + + /** + * FirstHeader + * + * @var string + */ + private $_firstHeader; + + /** + * FirstFooter + * + * @var string + */ + private $_firstFooter; + + /** + * Different header for Odd/Even, defaults to false + * + * @var boolean + */ + private $_differentOddEven; + + /** + * Different header for first page, defaults to false + * + * @var boolean + */ + private $_differentFirst; + + /** + * Scale with document, defaults to true + * + * @var boolean + */ + private $_scaleWithDocument; + + /** + * Align with margins, defaults to true + * + * @var boolean + */ + private $_alignWithMargins; + + /** + * Header/footer images + * + * @var PHPExcel_Worksheet_HeaderFooterDrawing[] + */ + private $_headerFooterImages = array(); + + /** + * Create a new PHPExcel_Worksheet_HeaderFooter + */ + public function __construct() + { + // Initialise values + $this->_oddHeader = ''; + $this->_oddFooter = ''; + $this->_evenHeader = ''; + $this->_evenFooter = ''; + $this->_firstHeader = ''; + $this->_firstFooter = ''; + $this->_differentOddEven = false; + $this->_differentFirst = false; + $this->_scaleWithDocument = true; + $this->_alignWithMargins = true; + $this->_headerFooterImages = array(); + } + + /** + * Get OddHeader + * + * @return string + */ + public function getOddHeader() { + return $this->_oddHeader; + } + + /** + * Set OddHeader + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setOddHeader($pValue) { + $this->_oddHeader = $pValue; + return $this; + } + + /** + * Get OddFooter + * + * @return string + */ + public function getOddFooter() { + return $this->_oddFooter; + } + + /** + * Set OddFooter + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setOddFooter($pValue) { + $this->_oddFooter = $pValue; + return $this; + } + + /** + * Get EvenHeader + * + * @return string + */ + public function getEvenHeader() { + return $this->_evenHeader; + } + + /** + * Set EvenHeader + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setEvenHeader($pValue) { + $this->_evenHeader = $pValue; + return $this; + } + + /** + * Get EvenFooter + * + * @return string + */ + public function getEvenFooter() { + return $this->_evenFooter; + } + + /** + * Set EvenFooter + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setEvenFooter($pValue) { + $this->_evenFooter = $pValue; + return $this; + } + + /** + * Get FirstHeader + * + * @return string + */ + public function getFirstHeader() { + return $this->_firstHeader; + } + + /** + * Set FirstHeader + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setFirstHeader($pValue) { + $this->_firstHeader = $pValue; + return $this; + } + + /** + * Get FirstFooter + * + * @return string + */ + public function getFirstFooter() { + return $this->_firstFooter; + } + + /** + * Set FirstFooter + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setFirstFooter($pValue) { + $this->_firstFooter = $pValue; + return $this; + } + + /** + * Get DifferentOddEven + * + * @return boolean + */ + public function getDifferentOddEven() { + return $this->_differentOddEven; + } + + /** + * Set DifferentOddEven + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setDifferentOddEven($pValue = false) { + $this->_differentOddEven = $pValue; + return $this; + } + + /** + * Get DifferentFirst + * + * @return boolean + */ + public function getDifferentFirst() { + return $this->_differentFirst; + } + + /** + * Set DifferentFirst + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setDifferentFirst($pValue = false) { + $this->_differentFirst = $pValue; + return $this; + } + + /** + * Get ScaleWithDocument + * + * @return boolean + */ + public function getScaleWithDocument() { + return $this->_scaleWithDocument; + } + + /** + * Set ScaleWithDocument + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setScaleWithDocument($pValue = true) { + $this->_scaleWithDocument = $pValue; + return $this; + } + + /** + * Get AlignWithMargins + * + * @return boolean + */ + public function getAlignWithMargins() { + return $this->_alignWithMargins; + } + + /** + * Set AlignWithMargins + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setAlignWithMargins($pValue = true) { + $this->_alignWithMargins = $pValue; + return $this; + } + + /** + * Add header/footer image + * + * @param PHPExcel_Worksheet_HeaderFooterDrawing $image + * @param string $location + * @throws Exception + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) { + $this->_headerFooterImages[$location] = $image; + return $this; + } + + /** + * Remove header/footer image + * + * @param string $location + * @throws Exception + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function removeImage($location = self::IMAGE_HEADER_LEFT) { + if (isset($this->_headerFooterImages[$location])) { + unset($this->_headerFooterImages[$location]); + } + return $this; + } + + /** + * Set header/footer images + * + * @param PHPExcel_Worksheet_HeaderFooterDrawing[] $images + * @throws Exception + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function setImages($images) { + if (!is_array($images)) { + throw new Exception('Invalid parameter!'); + } + + $this->_headerFooterImages = $images; + return $this; + } + + /** + * Get header/footer images + * + * @return HPExcel_Worksheet_HeaderFooterDrawing[] + */ + public function getImages() { + // Sort array + $images = array(); + if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT]; + if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER]; + if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT]; + if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT]; + if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER]; + if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT]; + $this->_headerFooterImages = $images; + + return $this->_headerFooterImages; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooterDrawing.php b/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooterDrawing.php new file mode 100644 index 000000000..3589cde4e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/HeaderFooterDrawing.php @@ -0,0 +1,401 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_BaseDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/BaseDrawing.php'; + +/** PHPExcel_Worksheet_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing.php'; + + +/** + * PHPExcel_Worksheet_HeaderFooterDrawing + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable +{ + /** + * Path + * + * @var string + */ + private $_path; + + /** + * Name + * + * @var string + */ + protected $_name; + + /** + * Offset X + * + * @var int + */ + protected $_offsetX; + + /** + * Offset Y + * + * @var int + */ + protected $_offsetY; + + /** + * Width + * + * @var int + */ + protected $_width; + + /** + * Height + * + * @var int + */ + protected $_height; + + /** + * Proportional resize + * + * @var boolean + */ + protected $_resizeProportional; + + /** + * Create a new PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function __construct() + { + // Initialise values + $this->_path = ''; + $this->_name = ''; + $this->_offsetX = 0; + $this->_offsetY = 0; + $this->_width = 0; + $this->_height = 0; + $this->_resizeProportional = true; + } + + /** + * Get Name + * + * @return string + */ + public function getName() { + return $this->_name; + } + + /** + * Set Name + * + * @param string $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setName($pValue = '') { + $this->_name = $pValue; + return $this; + } + + /** + * Get OffsetX + * + * @return int + */ + public function getOffsetX() { + return $this->_offsetX; + } + + /** + * Set OffsetX + * + * @param int $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setOffsetX($pValue = 0) { + $this->_offsetX = $pValue; + return $this; + } + + /** + * Get OffsetY + * + * @return int + */ + public function getOffsetY() { + return $this->_offsetY; + } + + /** + * Set OffsetY + * + * @param int $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setOffsetY($pValue = 0) { + $this->_offsetY = $pValue; + return $this; + } + + /** + * Get Width + * + * @return int + */ + public function getWidth() { + return $this->_width; + } + + /** + * Set Width + * + * @param int $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setWidth($pValue = 0) { + // Resize proportional? + if ($this->_resizeProportional && $pValue != 0) { + $ratio = $this->_width / $this->_height; + $this->_height = round($ratio * $pValue); + } + + // Set width + $this->_width = $pValue; + + return $this; + } + + /** + * Get Height + * + * @return int + */ + public function getHeight() { + return $this->_height; + } + + /** + * Set Height + * + * @param int $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setHeight($pValue = 0) { + // Resize proportional? + if ($this->_resizeProportional && $pValue != 0) { + $ratio = $this->_width / $this->_height; + $this->_width = round($ratio * $pValue); + } + + // Set height + $this->_height = $pValue; + + return $this; + } + + /** + * Set width and height with proportional resize + * Example: + * <code> + * $objDrawing->setResizeProportional(true); + * $objDrawing->setWidthAndHeight(160,120); + * </code> + * + * @author Vincent@luo MSN:kele_100@hotmail.com + * @param int $width + * @param int $height + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setWidthAndHeight($width = 0, $height = 0) { + $xratio = $width / $this->_width; + $yratio = $height / $this->_height; + if ($this->_resizeProportional && !($width == 0 || $height == 0)) { + if (($xratio * $this->_height) < $height) { + $this->_height = ceil($xratio * $this->_height); + $this->_width = $width; + } else { + $this->_width = ceil($yratio * $this->_width); + $this->_height = $height; + } + } + return $this; + } + + /** + * Get ResizeProportional + * + * @return boolean + */ + public function getResizeProportional() { + return $this->_resizeProportional; + } + + /** + * Set ResizeProportional + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setResizeProportional($pValue = true) { + $this->_resizeProportional = $pValue; + return $this; + } + + /** + * Get Filename + * + * @return string + */ + public function getFilename() { + return basename($this->_path); + } + + /** + * Get Extension + * + * @return string + */ + public function getExtension() { + return end(explode(".", basename($this->_path))); + } + + /** + * Get Path + * + * @return string + */ + public function getPath() { + return $this->_path; + } + + /** + * Set Path + * + * @param string $pValue File path + * @param boolean $pVerifyFile Verify file + * @throws Exception + * @return PHPExcel_Worksheet_HeaderFooterDrawing + */ + public function setPath($pValue = '', $pVerifyFile = true) { + if ($pVerifyFile) { + if (file_exists($pValue)) { + $this->_path = $pValue; + + if ($this->_width == 0 && $this->_height == 0) { + // Get width/height + list($this->_width, $this->_height) = getimagesize($pValue); + } + } else { + throw new Exception("File $pValue not found!"); + } + } else { + $this->_path = $pValue; + } + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_path + . $this->_name + . $this->_offsetX + . $this->_offsetY + . $this->_width + . $this->_height + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/MemoryDrawing.php b/libraries/PHPExcel/PHPExcel/Worksheet/MemoryDrawing.php new file mode 100644 index 000000000..5d80d7a57 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/MemoryDrawing.php @@ -0,0 +1,252 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_BaseDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/BaseDrawing.php'; + +/** PHPExcel_Worksheet_Drawing_Shadow */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php'; + + +/** + * PHPExcel_Worksheet_MemoryDrawing + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable +{ + /* Rendering functions */ + const RENDERING_DEFAULT = 'imagepng'; + const RENDERING_PNG = 'imagepng'; + const RENDERING_GIF = 'imagegif'; + const RENDERING_JPEG = 'imagejpeg'; + + /* MIME types */ + const MIMETYPE_DEFAULT = 'image/png'; + const MIMETYPE_PNG = 'image/png'; + const MIMETYPE_GIF = 'image/gif'; + const MIMETYPE_JPEG = 'image/jpeg'; + + /** + * Image resource + * + * @var resource + */ + private $_imageResource; + + /** + * Rendering function + * + * @var string + */ + private $_renderingFunction; + + /** + * Mime type + * + * @var string + */ + private $_mimeType; + + /** + * Unique name + * + * @var string + */ + private $_uniqueName; + + /** + * Create a new PHPExcel_Worksheet_MemoryDrawing + */ + public function __construct() + { + // Initialise values + $this->_imageResource = null; + $this->_renderingFunction = self::RENDERING_DEFAULT; + $this->_mimeType = self::MIMETYPE_DEFAULT; + $this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999)); + + // Initialize parent + parent::__construct(); + } + + /** + * Get image resource + * + * @return resource + */ + public function getImageResource() { + return $this->_imageResource; + } + + /** + * Set image resource + * + * @param $value resource + * @return PHPExcel_Worksheet_MemoryDrawing + */ + public function setImageResource($value = null) { + $this->_imageResource = $value; + + if (!is_null($this->_imageResource)) { + // Get width/height + $this->_width = imagesx($this->_imageResource); + $this->_height = imagesy($this->_imageResource); + } + return $this; + } + + /** + * Get rendering function + * + * @return string + */ + public function getRenderingFunction() { + return $this->_renderingFunction; + } + + /** + * Set rendering function + * + * @param string $value + * @return PHPExcel_Worksheet_MemoryDrawing + */ + public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) { + $this->_renderingFunction = $value; + return $this; + } + + /** + * Get mime type + * + * @return string + */ + public function getMimeType() { + return $this->_mimeType; + } + + /** + * Set mime type + * + * @param string $value + * @return PHPExcel_Worksheet_MemoryDrawing + */ + public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) { + $this->_mimeType = $value; + return $this; + } + + /** + * Get indexed filename (using image index) + * + * @return string + */ + public function getIndexedFilename() { + $extension = strtolower($this->getMimeType()); + $extension = explode('/', $extension); + $extension = $extension[1]; + + return $this->_uniqueName . $this->getImageIndex() . '.' . $extension; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_renderingFunction + . $this->_mimeType + . $this->_uniqueName + . parent::getHashCode() + . __CLASS__ + ); + } + + /** + * Hash index + * + * @var string + */ + private $_hashIndex; + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() { + return $this->_hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) { + $this->_hashIndex = $value; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/PageMargins.php b/libraries/PHPExcel/PHPExcel/Worksheet/PageMargins.php new file mode 100644 index 000000000..aad7d2091 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/PageMargins.php @@ -0,0 +1,227 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Worksheet_PageMargins + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_PageMargins +{ + /** + * Left + * + * @var double + */ + private $_left; + + /** + * Right + * + * @var double + */ + private $_right; + + /** + * Top + * + * @var double + */ + private $_top; + + /** + * Bottom + * + * @var double + */ + private $_bottom; + + /** + * Header + * + * @var double + */ + private $_header; + + /** + * Footer + * + * @var double + */ + private $_footer; + + /** + * Create a new PHPExcel_Worksheet_PageMargins + */ + public function __construct() + { + // Initialise values + $this->_left = 0.7; + $this->_right = 0.7; + $this->_top = 0.75; + $this->_bottom = 0.75; + $this->_header = 0.3; + $this->_footer = 0.3; + } + + /** + * Get Left + * + * @return double + */ + public function getLeft() { + return $this->_left; + } + + /** + * Set Left + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setLeft($pValue) { + $this->_left = $pValue; + return $this; + } + + /** + * Get Right + * + * @return double + */ + public function getRight() { + return $this->_right; + } + + /** + * Set Right + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setRight($pValue) { + $this->_right = $pValue; + return $this; + } + + /** + * Get Top + * + * @return double + */ + public function getTop() { + return $this->_top; + } + + /** + * Set Top + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setTop($pValue) { + $this->_top = $pValue; + return $this; + } + + /** + * Get Bottom + * + * @return double + */ + public function getBottom() { + return $this->_bottom; + } + + /** + * Set Bottom + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setBottom($pValue) { + $this->_bottom = $pValue; + return $this; + } + + /** + * Get Header + * + * @return double + */ + public function getHeader() { + return $this->_header; + } + + /** + * Set Header + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setHeader($pValue) { + $this->_header = $pValue; + return $this; + } + + /** + * Get Footer + * + * @return double + */ + public function getFooter() { + return $this->_footer; + } + + /** + * Set Footer + * + * @param double $pValue + * @return PHPExcel_Worksheet_PageMargins + */ + public function setFooter($pValue) { + $this->_footer = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/PageSetup.php b/libraries/PHPExcel/PHPExcel/Worksheet/PageSetup.php new file mode 100644 index 000000000..d7584a32e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/PageSetup.php @@ -0,0 +1,590 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Worksheet_PageSetup + * + * <code> + * Paper size taken from Office Open XML Part 4 - Markup Language Reference, page 1988: + * + * 1 = Letter paper (8.5 in. by 11 in.) + * 2 = Letter small paper (8.5 in. by 11 in.) + * 3 = Tabloid paper (11 in. by 17 in.) + * 4 = Ledger paper (17 in. by 11 in.) + * 5 = Legal paper (8.5 in. by 14 in.) + * 6 = Statement paper (5.5 in. by 8.5 in.) + * 7 = Executive paper (7.25 in. by 10.5 in.) + * 8 = A3 paper (297 mm by 420 mm) + * 9 = A4 paper (210 mm by 297 mm) + * 10 = A4 small paper (210 mm by 297 mm) + * 11 = A5 paper (148 mm by 210 mm) + * 12 = B4 paper (250 mm by 353 mm) + * 13 = B5 paper (176 mm by 250 mm) + * 14 = Folio paper (8.5 in. by 13 in.) + * 15 = Quarto paper (215 mm by 275 mm) + * 16 = Standard paper (10 in. by 14 in.) + * 17 = Standard paper (11 in. by 17 in.) + * 18 = Note paper (8.5 in. by 11 in.) + * 19 = #9 envelope (3.875 in. by 8.875 in.) + * 20 = #10 envelope (4.125 in. by 9.5 in.) + * 21 = #11 envelope (4.5 in. by 10.375 in.) + * 22 = #12 envelope (4.75 in. by 11 in.) + * 23 = #14 envelope (5 in. by 11.5 in.) + * 24 = C paper (17 in. by 22 in.) + * 25 = D paper (22 in. by 34 in.) + * 26 = E paper (34 in. by 44 in.) + * 27 = DL envelope (110 mm by 220 mm) + * 28 = C5 envelope (162 mm by 229 mm) + * 29 = C3 envelope (324 mm by 458 mm) + * 30 = C4 envelope (229 mm by 324 mm) + * 31 = C6 envelope (114 mm by 162 mm) + * 32 = C65 envelope (114 mm by 229 mm) + * 33 = B4 envelope (250 mm by 353 mm) + * 34 = B5 envelope (176 mm by 250 mm) + * 35 = B6 envelope (176 mm by 125 mm) + * 36 = Italy envelope (110 mm by 230 mm) + * 37 = Monarch envelope (3.875 in. by 7.5 in.). + * 38 = 6 3/4 envelope (3.625 in. by 6.5 in.) + * 39 = US standard fanfold (14.875 in. by 11 in.) + * 40 = German standard fanfold (8.5 in. by 12 in.) + * 41 = German legal fanfold (8.5 in. by 13 in.) + * 42 = ISO B4 (250 mm by 353 mm) + * 43 = Japanese double postcard (200 mm by 148 mm) + * 44 = Standard paper (9 in. by 11 in.) + * 45 = Standard paper (10 in. by 11 in.) + * 46 = Standard paper (15 in. by 11 in.) + * 47 = Invite envelope (220 mm by 220 mm) + * 50 = Letter extra paper (9.275 in. by 12 in.) + * 51 = Legal extra paper (9.275 in. by 15 in.) + * 52 = Tabloid extra paper (11.69 in. by 18 in.) + * 53 = A4 extra paper (236 mm by 322 mm) + * 54 = Letter transverse paper (8.275 in. by 11 in.) + * 55 = A4 transverse paper (210 mm by 297 mm) + * 56 = Letter extra transverse paper (9.275 in. by 12 in.) + * 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm) + * 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm) + * 59 = Letter plus paper (8.5 in. by 12.69 in.) + * 60 = A4 plus paper (210 mm by 330 mm) + * 61 = A5 transverse paper (148 mm by 210 mm) + * 62 = JIS B5 transverse paper (182 mm by 257 mm) + * 63 = A3 extra paper (322 mm by 445 mm) + * 64 = A5 extra paper (174 mm by 235 mm) + * 65 = ISO B5 extra paper (201 mm by 276 mm) + * 66 = A2 paper (420 mm by 594 mm) + * 67 = A3 transverse paper (297 mm by 420 mm) + * 68 = A3 extra transverse paper (322 mm by 445 mm) + * </code> + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_PageSetup +{ + /* Paper size */ + const PAPERSIZE_LETTER = 1; + const PAPERSIZE_LETTER_SMALL = 2; + const PAPERSIZE_TABLOID = 3; + const PAPERSIZE_LEDGER = 4; + const PAPERSIZE_LEGAL = 5; + const PAPERSIZE_STATEMENT = 6; + const PAPERSIZE_EXECUTIVE = 7; + const PAPERSIZE_A3 = 8; + const PAPERSIZE_A4 = 9; + const PAPERSIZE_A4_SMALL = 10; + const PAPERSIZE_A5 = 11; + const PAPERSIZE_B4 = 12; + const PAPERSIZE_B5 = 13; + const PAPERSIZE_FOLIO = 14; + const PAPERSIZE_QUARTO = 15; + const PAPERSIZE_STANDARD_1 = 16; + const PAPERSIZE_STANDARD_2 = 17; + const PAPERSIZE_NOTE = 18; + const PAPERSIZE_NO9_ENVELOPE = 19; + const PAPERSIZE_NO10_ENVELOPE = 20; + const PAPERSIZE_NO11_ENVELOPE = 21; + const PAPERSIZE_NO12_ENVELOPE = 22; + const PAPERSIZE_NO14_ENVELOPE = 23; + const PAPERSIZE_C = 24; + const PAPERSIZE_D = 25; + const PAPERSIZE_E = 26; + const PAPERSIZE_DL_ENVELOPE = 27; + const PAPERSIZE_C5_ENVELOPE = 28; + const PAPERSIZE_C3_ENVELOPE = 29; + const PAPERSIZE_C4_ENVELOPE = 30; + const PAPERSIZE_C6_ENVELOPE = 31; + const PAPERSIZE_C65_ENVELOPE = 32; + const PAPERSIZE_B4_ENVELOPE = 33; + const PAPERSIZE_B5_ENVELOPE = 34; + const PAPERSIZE_B6_ENVELOPE = 35; + const PAPERSIZE_ITALY_ENVELOPE = 36; + const PAPERSIZE_MONARCH_ENVELOPE = 37; + const PAPERSIZE_6_3_4_ENVELOPE = 38; + const PAPERSIZE_US_STANDARD_FANFOLD = 39; + const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40; + const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41; + const PAPERSIZE_ISO_B4 = 42; + const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43; + const PAPERSIZE_STANDARD_PAPER_1 = 44; + const PAPERSIZE_STANDARD_PAPER_2 = 45; + const PAPERSIZE_STANDARD_PAPER_3 = 46; + const PAPERSIZE_INVITE_ENVELOPE = 47; + const PAPERSIZE_LETTER_EXTRA_PAPER = 48; + const PAPERSIZE_LEGAL_EXTRA_PAPER = 49; + const PAPERSIZE_TABLOID_EXTRA_PAPER = 50; + const PAPERSIZE_A4_EXTRA_PAPER = 51; + const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52; + const PAPERSIZE_A4_TRANSVERSE_PAPER = 53; + const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54; + const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55; + const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56; + const PAPERSIZE_LETTER_PLUS_PAPER = 57; + const PAPERSIZE_A4_PLUS_PAPER = 58; + const PAPERSIZE_A5_TRANSVERSE_PAPER = 59; + const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60; + const PAPERSIZE_A3_EXTRA_PAPER = 61; + const PAPERSIZE_A5_EXTRA_PAPER = 62; + const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63; + const PAPERSIZE_A2_PAPER = 64; + const PAPERSIZE_A3_TRANSVERSE_PAPER = 65; + const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66; + + /* Page orientation */ + const ORIENTATION_DEFAULT = 'default'; + const ORIENTATION_LANDSCAPE = 'landscape'; + const ORIENTATION_PORTRAIT = 'portrait'; + + /** + * Paper size + * + * @var int + */ + private $_paperSize; + + /** + * Orientation + * + * @var string + */ + private $_orientation; + + /** + * Scale (Print Scale) + * + * Print scaling. Valid values range from 10 to 400 + * This setting is overridden when fitToWidth and/or fitToHeight are in use + * + * @var int? + */ + private $_scale; + + /** + * Fit To Height + * Number of vertical pages to fit on + * + * @var int? + */ + private $_fitToHeight; + + /** + * Fit To Width + * Number of horizontal pages to fit on + * + * @var int? + */ + private $_fitToWidth; + + /** + * Columns to repeat at left + * + * @var array Containing start column and end column, empty array if option unset + */ + private $_columnsToRepeatAtLeft = array('', ''); + + /** + * Rows to repeat at top + * + * @var array Containing start row number and end row number, empty array if option unset + */ + private $_rowsToRepeatAtTop = array(0, 0); + + /** + * Center page horizontally + * + * @var boolean + */ + private $_horizontalCentered = false; + + /** + * Center page vertically + * + * @var boolean + */ + private $_verticalCentered = false; + + /** + * Print area + * + * @var string + */ + private $_printArea = null; + + /** + * Create a new PHPExcel_Worksheet_PageSetup + */ + public function __construct() + { + // Initialise values + $this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; + $this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; + $this->_scale = null; + $this->_fitToHeight = null; + $this->_fitToWidth = null; + $this->_columnsToRepeatAtLeft = array('', ''); + $this->_rowsToRepeatAtTop = array(0, 0); + $this->_horizontalCentered = false; + $this->_verticalCentered = false; + $this->_printArea = null; + } + + /** + * Get Paper Size + * + * @return int + */ + public function getPaperSize() { + return $this->_paperSize; + } + + /** + * Set Paper Size + * + * @param int $pValue + * @return PHPExcel_Worksheet_PageSetup + */ + public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) { + $this->_paperSize = $pValue; + return $this; + } + + /** + * Get Orientation + * + * @return string + */ + public function getOrientation() { + return $this->_orientation; + } + + /** + * Set Orientation + * + * @param string $pValue + * @return PHPExcel_Worksheet_PageSetup + */ + public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) { + $this->_orientation = $pValue; + return $this; + } + + /** + * Get Scale + * + * @return int? + */ + public function getScale() { + return $this->_scale; + } + + /** + * Set Scale + * + * Print scaling. Valid values range from 10 to 400 + * This setting is overridden when fitToWidth and/or fitToHeight are in use + * + * @param int? $pValue + * @throws Exception + * @return PHPExcel_Worksheet_PageSetup + */ + public function setScale($pValue = 100) { + // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, + // but it is apparently still able to handle any scale >= 0, where 0 results in 100 + if (($pValue >= 0) || is_null($pValue)) { + $this->_scale = $pValue; + } else { + throw new Exception("Scale must not be negative"); + } + return $this; + } + + /** + * Get Fit To Height + * + * @return int? + */ + public function getFitToHeight() { + return $this->_fitToHeight; + } + + /** + * Set Fit To Height + * + * @param int? $pValue + * @return PHPExcel_Worksheet_PageSetup + */ + public function setFitToHeight($pValue = 1) { + if ($pValue != '') { + $this->_fitToHeight = $pValue; + } + return $this; + } + + /** + * Get Fit To Width + * + * @return int? + */ + public function getFitToWidth() { + return $this->_fitToWidth; + } + + /** + * Set Fit To Width + * + * @param int? $pValue + * @return PHPExcel_Worksheet_PageSetup + */ + public function setFitToWidth($pValue = 1) { + if ($pValue != '') { + $this->_fitToWidth = $pValue; + } + return $this; + } + + /** + * Is Columns to repeat at left set? + * + * @return boolean + */ + public function isColumnsToRepeatAtLeftSet() { + if (is_array($this->_columnsToRepeatAtLeft)) { + if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') { + return true; + } + } + + return false; + } + + /** + * Get Columns to repeat at left + * + * @return array Containing start column and end column, empty array if option unset + */ + public function getColumnsToRepeatAtLeft() { + return $this->_columnsToRepeatAtLeft; + } + + /** + * Set Columns to repeat at left + * + * @param array $pValue Containing start column and end column, empty array if option unset + * @return PHPExcel_Worksheet_PageSetup + */ + public function setColumnsToRepeatAtLeft($pValue = null) { + if (is_array($pValue)) { + $this->_columnsToRepeatAtLeft = $pValue; + } + return $this; + } + + /** + * Set Columns to repeat at left by start and end + * + * @param string $pStart + * @param string $pEnd + * @return PHPExcel_Worksheet_PageSetup + */ + public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') { + $this->_columnsToRepeatAtLeft = array($pStart, $pEnd); + return $this; + } + + /** + * Is Rows to repeat at top set? + * + * @return boolean + */ + public function isRowsToRepeatAtTopSet() { + if (is_array($this->_rowsToRepeatAtTop)) { + if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) { + return true; + } + } + + return false; + } + + /** + * Get Rows to repeat at top + * + * @return array Containing start column and end column, empty array if option unset + */ + public function getRowsToRepeatAtTop() { + return $this->_rowsToRepeatAtTop; + } + + /** + * Set Rows to repeat at top + * + * @param array $pValue Containing start column and end column, empty array if option unset + * @return PHPExcel_Worksheet_PageSetup + */ + public function setRowsToRepeatAtTop($pValue = null) { + if (is_array($pValue)) { + $this->_rowsToRepeatAtTop = $pValue; + } + return $this; + } + + /** + * Set Rows to repeat at top by start and end + * + * @param int $pStart + * @param int $pEnd + * @return PHPExcel_Worksheet_PageSetup + */ + public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) { + $this->_rowsToRepeatAtTop = array($pStart, $pEnd); + return $this; + } + + /** + * Get center page horizontally + * + * @return bool + */ + public function getHorizontalCentered() { + return $this->_horizontalCentered; + } + + /** + * Set center page horizontally + * + * @param bool $value + * @return PHPExcel_Worksheet_PageSetup + */ + public function setHorizontalCentered($value = false) { + $this->_horizontalCentered = $value; + return $this; + } + + /** + * Get center page vertically + * + * @return bool + */ + public function getVerticalCentered() { + return $this->_verticalCentered; + } + + /** + * Set center page vertically + * + * @param bool $value + * @return PHPExcel_Worksheet_PageSetup + */ + public function setVerticalCentered($value = false) { + $this->_verticalCentered = $value; + return $this; + } + + /** + * Get print area + * + * @return string + */ + public function getPrintArea() { + return $this->_printArea; + } + + /** + * Is print area set? + * + * @return boolean + */ + public function isPrintAreaSet() { + return !is_null($this->_printArea); + } + + /** + * Set print area + * + * @param string $value + * @throws Exception + * @return PHPExcel_Worksheet_PageSetup + */ + public function setPrintArea($value) { + if (strpos($value,':') === false) { + throw new Exception('Cell coordinate must be a range of cells.'); + } elseif (strpos($value,'$') !== false) { + throw new Exception('Cell coordinate must not be absolute.'); + } else { + $this->_printArea = strtoupper($value); + } + return $this; + } + + /** + * Set print area + * + * @param int $column1 Column 1 + * @param int $row1 Row 1 + * @param int $column2 Column 2 + * @param int $row2 Row 2 + * @return PHPExcel_Worksheet_PageSetup + */ + public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2) + { + return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/Protection.php b/libraries/PHPExcel/PHPExcel/Worksheet/Protection.php new file mode 100644 index 000000000..1116c56da --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/Protection.php @@ -0,0 +1,575 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_Shared_PasswordHasher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PasswordHasher.php'; + + +/** + * PHPExcel_Worksheet_Protection + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_Protection +{ + /** + * Sheet + * + * @var boolean + */ + private $_sheet; + + /** + * Objects + * + * @var boolean + */ + private $_objects; + + /** + * Scenarios + * + * @var boolean + */ + private $_scenarios; + + /** + * Format cells + * + * @var boolean + */ + private $_formatCells; + + /** + * Format columns + * + * @var boolean + */ + private $_formatColumns; + + /** + * Format rows + * + * @var boolean + */ + private $_formatRows; + + /** + * Insert columns + * + * @var boolean + */ + private $_insertColumns; + + /** + * Insert rows + * + * @var boolean + */ + private $_insertRows; + + /** + * Insert hyperlinks + * + * @var boolean + */ + private $_insertHyperlinks; + + /** + * Delete columns + * + * @var boolean + */ + private $_deleteColumns; + + /** + * Delete rows + * + * @var boolean + */ + private $_deleteRows; + + /** + * Select locked cells + * + * @var boolean + */ + private $_selectLockedCells; + + /** + * Sort + * + * @var boolean + */ + private $_sort; + + /** + * AutoFilter + * + * @var boolean + */ + private $_autoFilter; + + /** + * Pivot tables + * + * @var boolean + */ + private $_pivotTables; + + /** + * Select unlocked cells + * + * @var boolean + */ + private $_selectUnlockedCells; + + /** + * Password + * + * @var string + */ + private $_password; + + /** + * Create a new PHPExcel_Worksheet_Protection + */ + public function __construct() + { + // Initialise values + $this->_sheet = false; + $this->_objects = false; + $this->_scenarios = false; + $this->_formatCells = false; + $this->_formatColumns = false; + $this->_formatRows = false; + $this->_insertColumns = false; + $this->_insertRows = false; + $this->_insertHyperlinks = false; + $this->_deleteColumns = false; + $this->_deleteRows = false; + $this->_selectLockedCells = false; + $this->_sort = false; + $this->_autoFilter = false; + $this->_pivotTables = false; + $this->_selectUnlockedCells = false; + $this->_password = ''; + } + + /** + * Is some sort of protection enabled? + * + * @return boolean + */ + function isProtectionEnabled() { + return $this->_sheet || + $this->_objects || + $this->_scenarios || + $this->_formatCells || + $this->_formatColumns || + $this->_formatRows || + $this->_insertColumns || + $this->_insertRows || + $this->_insertHyperlinks || + $this->_deleteColumns || + $this->_deleteRows || + $this->_selectLockedCells || + $this->_sort || + $this->_autoFilter || + $this->_pivotTables || + $this->_selectUnlockedCells; + } + + /** + * Get Sheet + * + * @return boolean + */ + function getSheet() { + return $this->_sheet; + } + + /** + * Set Sheet + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setSheet($pValue = false) { + $this->_sheet = $pValue; + return $this; + } + + /** + * Get Objects + * + * @return boolean + */ + function getObjects() { + return $this->_objects; + } + + /** + * Set Objects + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setObjects($pValue = false) { + $this->_objects = $pValue; + return $this; + } + + /** + * Get Scenarios + * + * @return boolean + */ + function getScenarios() { + return $this->_scenarios; + } + + /** + * Set Scenarios + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setScenarios($pValue = false) { + $this->_scenarios = $pValue; + return $this; + } + + /** + * Get FormatCells + * + * @return boolean + */ + function getFormatCells() { + return $this->_formatCells; + } + + /** + * Set FormatCells + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setFormatCells($pValue = false) { + $this->_formatCells = $pValue; + return $this; + } + + /** + * Get FormatColumns + * + * @return boolean + */ + function getFormatColumns() { + return $this->_formatColumns; + } + + /** + * Set FormatColumns + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setFormatColumns($pValue = false) { + $this->_formatColumns = $pValue; + return $this; + } + + /** + * Get FormatRows + * + * @return boolean + */ + function getFormatRows() { + return $this->_formatRows; + } + + /** + * Set FormatRows + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setFormatRows($pValue = false) { + $this->_formatRows = $pValue; + return $this; + } + + /** + * Get InsertColumns + * + * @return boolean + */ + function getInsertColumns() { + return $this->_insertColumns; + } + + /** + * Set InsertColumns + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setInsertColumns($pValue = false) { + $this->_insertColumns = $pValue; + return $this; + } + + /** + * Get InsertRows + * + * @return boolean + */ + function getInsertRows() { + return $this->_insertRows; + } + + /** + * Set InsertRows + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setInsertRows($pValue = false) { + $this->_insertRows = $pValue; + return $this; + } + + /** + * Get InsertHyperlinks + * + * @return boolean + */ + function getInsertHyperlinks() { + return $this->_insertHyperlinks; + } + + /** + * Set InsertHyperlinks + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setInsertHyperlinks($pValue = false) { + $this->_insertHyperlinks = $pValue; + return $this; + } + + /** + * Get DeleteColumns + * + * @return boolean + */ + function getDeleteColumns() { + return $this->_deleteColumns; + } + + /** + * Set DeleteColumns + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setDeleteColumns($pValue = false) { + $this->_deleteColumns = $pValue; + return $this; + } + + /** + * Get DeleteRows + * + * @return boolean + */ + function getDeleteRows() { + return $this->_deleteRows; + } + + /** + * Set DeleteRows + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setDeleteRows($pValue = false) { + $this->_deleteRows = $pValue; + return $this; + } + + /** + * Get SelectLockedCells + * + * @return boolean + */ + function getSelectLockedCells() { + return $this->_selectLockedCells; + } + + /** + * Set SelectLockedCells + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setSelectLockedCells($pValue = false) { + $this->_selectLockedCells = $pValue; + return $this; + } + + /** + * Get Sort + * + * @return boolean + */ + function getSort() { + return $this->_sort; + } + + /** + * Set Sort + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setSort($pValue = false) { + $this->_sort = $pValue; + return $this; + } + + /** + * Get AutoFilter + * + * @return boolean + */ + function getAutoFilter() { + return $this->_autoFilter; + } + + /** + * Set AutoFilter + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setAutoFilter($pValue = false) { + $this->_autoFilter = $pValue; + return $this; + } + + /** + * Get PivotTables + * + * @return boolean + */ + function getPivotTables() { + return $this->_pivotTables; + } + + /** + * Set PivotTables + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setPivotTables($pValue = false) { + $this->_pivotTables = $pValue; + return $this; + } + + /** + * Get SelectUnlockedCells + * + * @return boolean + */ + function getSelectUnlockedCells() { + return $this->_selectUnlockedCells; + } + + /** + * Set SelectUnlockedCells + * + * @param boolean $pValue + * @return PHPExcel_Worksheet_Protection + */ + function setSelectUnlockedCells($pValue = false) { + $this->_selectUnlockedCells = $pValue; + return $this; + } + + /** + * Get Password (hashed) + * + * @return string + */ + function getPassword() { + return $this->_password; + } + + /** + * Set Password + * + * @param string $pValue + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @return PHPExcel_Worksheet_Protection + */ + function setPassword($pValue = '', $pAlreadyHashed = false) { + if (!$pAlreadyHashed) { + $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); + } + $this->_password = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/Row.php b/libraries/PHPExcel/PHPExcel/Worksheet/Row.php new file mode 100644 index 000000000..1aa46cd08 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/Row.php @@ -0,0 +1,108 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_CellIterator */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/CellIterator.php'; + + +/** + * PHPExcel_Worksheet_Row + * + * Represents a row in PHPExcel_Worksheet, used by PHPExcel_Worksheet_RowIterator + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_Row +{ + /** + * PHPExcel_Worksheet + * + * @var PHPExcel_Worksheet + */ + private $_parent; + + /** + * Row index + * + * @var int + */ + private $_rowIndex = 0; + + /** + * Create a new row + * + * @param PHPExcel_Worksheet $parent + * @param int $rowIndex + */ + public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1) { + // Set parent and row index + $this->_parent = $parent; + $this->_rowIndex = $rowIndex; + } + + /** + * Destructor + */ + public function __destruct() { + unset($this->_parent); + } + + /** + * Get row index + * + * @return int + */ + public function getRowIndex() { + return $this->_rowIndex; + } + + /** + * Get cell iterator + * + * @return PHPExcel_Worksheet_CellIterator + */ + public function getCellIterator() { + return new PHPExcel_Worksheet_CellIterator($this->_parent, $this->_rowIndex); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/RowDimension.php b/libraries/PHPExcel/PHPExcel/Worksheet/RowDimension.php new file mode 100644 index 000000000..76cc13249 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/RowDimension.php @@ -0,0 +1,210 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Worksheet_RowDimension + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_RowDimension +{ + /** + * Row index + * + * @var int + */ + private $_rowIndex; + + /** + * Row height (in pt) + * + * When this is set to a negative value, the row height should be ignored by IWriter + * + * @var double + */ + private $_rowHeight; + + /** + * Visible? + * + * @var bool + */ + private $_visible; + + /** + * Outline level + * + * @var int + */ + private $_outlineLevel = 0; + + /** + * Collapsed + * + * @var bool + */ + private $_collapsed; + + /** + * Create a new PHPExcel_Worksheet_RowDimension + * + * @param int $pIndex Numeric row index + */ + public function __construct($pIndex = 0) + { + // Initialise values + $this->_rowIndex = $pIndex; + $this->_rowHeight = -1; + $this->_visible = true; + $this->_outlineLevel = 0; + $this->_collapsed = false; + } + + /** + * Get Row Index + * + * @return int + */ + public function getRowIndex() { + return $this->_rowIndex; + } + + /** + * Set Row Index + * + * @param int $pValue + * @return PHPExcel_Worksheet_RowDimension + */ + public function setRowIndex($pValue) { + $this->_rowIndex = $pValue; + return $this; + } + + /** + * Get Row Height + * + * @return double + */ + public function getRowHeight() { + return $this->_rowHeight; + } + + /** + * Set Row Height + * + * @param double $pValue + * @return PHPExcel_Worksheet_RowDimension + */ + public function setRowHeight($pValue = -1) { + $this->_rowHeight = $pValue; + return $this; + } + + /** + * Get Visible + * + * @return bool + */ + public function getVisible() { + return $this->_visible; + } + + /** + * Set Visible + * + * @param bool $pValue + * @return PHPExcel_Worksheet_RowDimension + */ + public function setVisible($pValue = true) { + $this->_visible = $pValue; + return $this; + } + + /** + * Get Outline Level + * + * @return int + */ + public function getOutlineLevel() { + return $this->_outlineLevel; + } + + /** + * Set Outline Level + * + * Value must be between 0 and 7 + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Worksheet_RowDimension + */ + public function setOutlineLevel($pValue) { + if ($pValue < 0 || $pValue > 7) { + throw new Exception("Outline level must range between 0 and 7."); + } + + $this->_outlineLevel = $pValue; + return $this; + } + + /** + * Get Collapsed + * + * @return bool + */ + public function getCollapsed() { + return $this->_collapsed; + } + + /** + * Set Collapsed + * + * @param bool $pValue + * @return PHPExcel_Worksheet_RowDimension + */ + public function setCollapsed($pValue = true) { + $this->_collapsed = $pValue; + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/RowIterator.php b/libraries/PHPExcel/PHPExcel/Worksheet/RowIterator.php new file mode 100644 index 000000000..459b6d07b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/RowIterator.php @@ -0,0 +1,129 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Worksheet_Row */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Row.php'; + + +/** + * PHPExcel_Worksheet_RowIterator + * + * Used to iterate rows in a PHPExcel_Worksheet + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_RowIterator extends IteratorIterator +{ + /** + * PHPExcel_Worksheet to iterate + * + * @var PHPExcel_Worksheet + */ + private $_subject; + + /** + * Current iterator position + * + * @var int + */ + private $_position = 0; + + /** + * Create a new row iterator + * + * @param PHPExcel_Worksheet $subject + */ + public function __construct(PHPExcel_Worksheet $subject = null) { + // Set subject + $this->_subject = $subject; + } + + /** + * Destructor + */ + public function __destruct() { + unset($this->_subject); + } + + /** + * Rewind iterator + */ + public function rewind() { + $this->_position = 1; + } + + /** + * Current PHPExcel_Worksheet_Row + * + * @return PHPExcel_Worksheet_Row + */ + public function current() { + return new PHPExcel_Worksheet_Row($this->_subject, $this->_position); + } + + /** + * Current key + * + * @return int + */ + public function key() { + return $this->_position; + } + + /** + * Next value + */ + public function next() { + ++$this->_position; + } + + /** + * More PHPExcel_Worksheet_Row instances available? + * + * @return boolean + */ + public function valid() { + return $this->_position <= $this->_subject->getHighestRow(); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Worksheet/SheetView.php b/libraries/PHPExcel/PHPExcel/Worksheet/SheetView.php new file mode 100644 index 000000000..642595f64 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Worksheet/SheetView.php @@ -0,0 +1,133 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Worksheet_SheetView + * + * @category PHPExcel + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Worksheet_SheetView +{ + /** + * ZoomScale + * + * Valid values range from 10 to 400. + * + * @var int + */ + private $_zoomScale; + + /** + * ZoomScaleNormal + * + * Valid values range from 10 to 400. + * + * @var int + */ + private $_zoomScaleNormal; + + /** + * Create a new PHPExcel_Worksheet_SheetView + */ + public function __construct() + { + // Initialise values + $this->_zoomScale = 100; + $this->_zoomScaleNormal = 100; + } + + /** + * Get ZoomScale + * + * @return int + */ + public function getZoomScale() { + return $this->_zoomScale; + } + + /** + * Set ZoomScale + * + * Valid values range from 10 to 400. + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Worksheet_SheetView + */ + public function setZoomScale($pValue = 100) { + if (($pValue >= 10 && $pValue <= 400) || is_null($pValue)) { + $this->_zoomScale = $pValue; + } else { + throw new Exception("Valid scale is between 10 and 400."); + } + return $this; + } + + /** + * Get ZoomScaleNormal + * + * @return int + */ + public function getZoomScaleNormal() { + return $this->_zoomScaleNormal; + } + + /** + * Set ZoomScale + * + * Valid values range from 10 to 400. + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Worksheet_SheetView + */ + public function setZoomScaleNormal($pValue = 100) { + if (($pValue >= 10 && $pValue <= 400) || is_null($pValue)) { + $this->_zoomScaleNormal = $pValue; + } else { + throw new Exception("Valid scale is between 10 and 400."); + } + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/WorksheetIterator.php b/libraries/PHPExcel/PHPExcel/WorksheetIterator.php new file mode 100644 index 000000000..9edcc311f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/WorksheetIterator.php @@ -0,0 +1,126 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + + +/** + * PHPExcel_WorksheetIterator + * + * Used to iterate worksheets in PHPExcel + * + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_WorksheetIterator extends IteratorIterator +{ + /** + * Spreadsheet to iterate + * + * @var PHPExcel + */ + private $_subject; + + /** + * Current iterator position + * + * @var int + */ + private $_position = 0; + + /** + * Create a new worksheet iterator + * + * @param PHPExcel $subject + */ + public function __construct(PHPExcel $subject = null) { + // Set subject + $this->_subject = $subject; + } + + /** + * Destructor + */ + public function __destruct() { + unset($this->_subject); + } + + /** + * Rewind iterator + */ + public function rewind() { + $this->_position = 0; + } + + /** + * Current PHPExcel_Worksheet + * + * @return PHPExcel_Worksheet + */ + public function current() { + return $this->_subject->getSheet($this->_position); + } + + /** + * Current key + * + * @return int + */ + public function key() { + return $this->_position; + } + + /** + * Next value + */ + public function next() { + ++$this->_position; + } + + /** + * More PHPExcel_Worksheet instances available? + * + * @return boolean + */ + public function valid() { + return $this->_position < $this->_subject->getSheetCount(); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/CSV.php b/libraries/PHPExcel/PHPExcel/Writer/CSV.php new file mode 100644 index 000000000..76b64f251 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/CSV.php @@ -0,0 +1,320 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + + +/** + * PHPExcel_Writer_CSV + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { + /** + * PHPExcel object + * + * @var PHPExcel + */ + private $_phpExcel; + + /** + * Delimiter + * + * @var string + */ + private $_delimiter; + + /** + * Enclosure + * + * @var string + */ + private $_enclosure; + + /** + * Line ending + * + * @var string + */ + private $_lineEnding; + + /** + * Sheet index to write + * + * @var int + */ + private $_sheetIndex; + + /** + * Pre-calculate formulas + * + * @var boolean + */ + private $_preCalculateFormulas = true; + + /** + * Whether to write a BOM (for UTF8). + * + * @var boolean + */ + private $_useBOM = false; + + /** + * Create a new PHPExcel_Writer_CSV + * + * @param PHPExcel $phpExcel PHPExcel object + */ + public function __construct(PHPExcel $phpExcel) { + $this->_phpExcel = $phpExcel; + $this->_delimiter = ','; + $this->_enclosure = '"'; + $this->_lineEnding = PHP_EOL; + $this->_sheetIndex = 0; + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) { + // Fetch sheet + $sheet = $this->_phpExcel->getSheet($this->_sheetIndex); + + $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); + PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + + // Open file + $fileHandle = fopen($pFilename, 'w'); + if ($fileHandle === false) { + throw new Exception("Could not open file $pFilename for writing."); + } + + if ($this->_useBOM) { + // Write the UTF-8 BOM code + fwrite($fileHandle, "\xEF\xBB\xBF"); + } + + // Convert sheet to array + $cellsArray = $sheet->toArray('', $this->_preCalculateFormulas); + + // Write rows to file + foreach ($cellsArray as $row) { + $this->_writeLine($fileHandle, $row); + } + + // Close file + fclose($fileHandle); + + PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); + } + + /** + * Get delimiter + * + * @return string + */ + public function getDelimiter() { + return $this->_delimiter; + } + + /** + * Set delimiter + * + * @param string $pValue Delimiter, defaults to , + * @return PHPExcel_Writer_CSV + */ + public function setDelimiter($pValue = ',') { + $this->_delimiter = $pValue; + return $this; + } + + /** + * Get enclosure + * + * @return string + */ + public function getEnclosure() { + return $this->_enclosure; + } + + /** + * Set enclosure + * + * @param string $pValue Enclosure, defaults to " + * @return PHPExcel_Writer_CSV + */ + public function setEnclosure($pValue = '"') { + if ($pValue == '') { + $pValue = null; + } + $this->_enclosure = $pValue; + return $this; + } + + /** + * Get line ending + * + * @return string + */ + public function getLineEnding() { + return $this->_lineEnding; + } + + /** + * Set line ending + * + * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) + * @return PHPExcel_Writer_CSV + */ + public function setLineEnding($pValue = PHP_EOL) { + $this->_lineEnding = $pValue; + return $this; + } + + /** + * Get whether BOM should be used + * + * @return boolean + */ + public function getUseBOM() { + return $this->_useBOM; + } + + /** + * Set whether BOM should be used + * + * @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false + * @return PHPExcel_Writer_CSV + */ + public function setUseBOM($pValue = false) { + $this->_useBOM = $pValue; + return $this; + } + + /** + * Get sheet index + * + * @return int + */ + public function getSheetIndex() { + return $this->_sheetIndex; + } + + /** + * Set sheet index + * + * @param int $pValue Sheet index + * @return PHPExcel_Writer_CSV + */ + public function setSheetIndex($pValue = 0) { + $this->_sheetIndex = $pValue; + return $this; + } + + /** + * Write line to CSV file + * + * @param mixed $pFileHandle PHP filehandle + * @param array $pValues Array containing values in a row + * @throws Exception + */ + private function _writeLine($pFileHandle = null, $pValues = null) { + if (!is_null($pFileHandle) && is_array($pValues)) { + // No leading delimiter + $writeDelimiter = false; + + // Build the line + $line = ''; + + foreach ($pValues as $element) { + // Escape enclosures + $element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); + + // Add delimiter + if ($writeDelimiter) { + $line .= $this->_delimiter; + } else { + $writeDelimiter = true; + } + + // Add enclosed string + $line .= $this->_enclosure . $element . $this->_enclosure; + } + + // Add line ending + $line .= $this->_lineEnding; + + // Write to file + fwrite($pFileHandle, $line); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Get Pre-Calculate Formulas + * + * @return boolean + */ + public function getPreCalculateFormulas() { + return $this->_preCalculateFormulas; + } + + /** + * Set Pre-Calculate Formulas + * + * @param boolean $pValue Pre-Calculate Formulas? + * @return PHPExcel_Writer_CSV + */ + public function setPreCalculateFormulas($pValue = true) { + $this->_preCalculateFormulas = $pValue; + return $this; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007.php new file mode 100644 index 000000000..151fc1e47 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007.php @@ -0,0 +1,580 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_HashTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/HashTable.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Writer_Excel2007_StringTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/StringTable.php'; + +/** PHPExcel_Writer_Excel2007_ContentTypes */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/ContentTypes.php'; + +/** PHPExcel_Writer_Excel2007_DocProps */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/DocProps.php'; + +/** PHPExcel_Writer_Excel2007_Rels */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Rels.php'; + +/** PHPExcel_Writer_Excel2007_Theme */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Theme.php'; + +/** PHPExcel_Writer_Excel2007_Style */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Style.php'; + +/** PHPExcel_Writer_Excel2007_Workbook */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Workbook.php'; + +/** PHPExcel_Writer_Excel2007_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Worksheet.php'; + +/** PHPExcel_Writer_Excel2007_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Drawing.php'; + +/** PHPExcel_Writer_Excel2007_Comments */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Comments.php'; + + +/** + * PHPExcel_Writer_Excel2007 + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter +{ + /** + * Pre-calculate formulas + * + * @var boolean + */ + private $_preCalculateFormulas = true; + + /** + * Office2003 compatibility + * + * @var boolean + */ + private $_office2003compatibility = false; + + /** + * Private writer parts + * + * @var PHPExcel_Writer_Excel2007_WriterPart[] + */ + private $_writerParts; + + /** + * Private PHPExcel + * + * @var PHPExcel + */ + private $_spreadSheet; + + /** + * Private string table + * + * @var string[] + */ + private $_stringTable; + + /** + * Private unique PHPExcel_Style_Conditional HashTable + * + * @var PHPExcel_HashTable + */ + private $_stylesConditionalHashTable; + + /** + * Private unique PHPExcel_Style_Fill HashTable + * + * @var PHPExcel_HashTable + */ + private $_fillHashTable; + + /** + * Private unique PHPExcel_Style_Font HashTable + * + * @var PHPExcel_HashTable + */ + private $_fontHashTable; + + /** + * Private unique PHPExcel_Style_Borders HashTable + * + * @var PHPExcel_HashTable + */ + private $_bordersHashTable ; + + /** + * Private unique PHPExcel_Style_NumberFormat HashTable + * + * @var PHPExcel_HashTable + */ + private $_numFmtHashTable; + + /** + * Private unique PHPExcel_Worksheet_BaseDrawing HashTable + * + * @var PHPExcel_HashTable + */ + private $_drawingHashTable; + + /** + * Use disk caching where possible? + * + * @var boolean + */ + private $_useDiskCaching = false; + + /** + * Disk caching directory + * + * @var string + */ + private $_diskCachingDirectory; + + /** + * Create a new PHPExcel_Writer_Excel2007 + * + * @param PHPExcel $pPHPExcel + */ + public function __construct(PHPExcel $pPHPExcel = null) + { + // Assign PHPExcel + $this->setPHPExcel($pPHPExcel); + + // Set up disk caching location + $this->_diskCachingDirectory = './'; + + // Initialise writer parts + $this->_writerParts['stringtable'] = new PHPExcel_Writer_Excel2007_StringTable(); + $this->_writerParts['contenttypes'] = new PHPExcel_Writer_Excel2007_ContentTypes(); + $this->_writerParts['docprops'] = new PHPExcel_Writer_Excel2007_DocProps(); + $this->_writerParts['rels'] = new PHPExcel_Writer_Excel2007_Rels(); + $this->_writerParts['theme'] = new PHPExcel_Writer_Excel2007_Theme(); + $this->_writerParts['style'] = new PHPExcel_Writer_Excel2007_Style(); + $this->_writerParts['workbook'] = new PHPExcel_Writer_Excel2007_Workbook(); + $this->_writerParts['worksheet'] = new PHPExcel_Writer_Excel2007_Worksheet(); + $this->_writerParts['drawing'] = new PHPExcel_Writer_Excel2007_Drawing(); + $this->_writerParts['comments'] = new PHPExcel_Writer_Excel2007_Comments(); + + // Assign parent IWriter + foreach ($this->_writerParts as $writer) { + $writer->setParentWriter($this); + } + + // Set HashTable variables + $this->_stringTable = array(); + $this->_stylesConditionalHashTable = new PHPExcel_HashTable(); + $this->_fillHashTable = new PHPExcel_HashTable(); + $this->_fontHashTable = new PHPExcel_HashTable(); + $this->_bordersHashTable = new PHPExcel_HashTable(); + $this->_numFmtHashTable = new PHPExcel_HashTable(); + $this->_drawingHashTable = new PHPExcel_HashTable(); + } + + /** + * Get writer part + * + * @param string $pPartName Writer part name + * @return PHPExcel_Writer_Excel2007_WriterPart + */ + function getWriterPart($pPartName = '') { + if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) { + return $this->_writerParts[strtolower($pPartName)]; + } else { + return null; + } + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) + { + if (!is_null($this->_spreadSheet)) { + // garbage collect + $this->_spreadSheet->garbageCollect(); + + // If $pFilename is php://output or php://stdout, make it a temporary file... + $originalFilename = $pFilename; + if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') { + $pFilename = @tempnam('./', 'phpxltmp'); + if ($pFilename == '') { + $pFilename = $originalFilename; + } + } + + $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); + PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + + // Create string lookup table + $this->_stringTable = array(); + for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { + $this->_stringTable = $this->getWriterPart('StringTable')->createStringTable($this->_spreadSheet->getSheet($i), $this->_stringTable); + } + + // Create styles dictionaries + $this->_stylesConditionalHashTable->addFromSource( $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet) ); + $this->_fillHashTable->addFromSource( $this->getWriterPart('Style')->allFills($this->_spreadSheet) ); + $this->_fontHashTable->addFromSource( $this->getWriterPart('Style')->allFonts($this->_spreadSheet) ); + $this->_bordersHashTable->addFromSource( $this->getWriterPart('Style')->allBorders($this->_spreadSheet) ); + $this->_numFmtHashTable->addFromSource( $this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet) ); + + // Create drawing dictionary + $this->_drawingHashTable->addFromSource( $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet) ); + + // Create new ZIP file and open it for writing + $objZip = new ZipArchive(); + + // Try opening the ZIP file + if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) { + if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) { + throw new Exception("Could not open " . $pFilename . " for writing."); + } + } + + // Add [Content_Types].xml to ZIP file + $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet)); + + // Add relationships to ZIP file + $objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet)); + $objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet)); + + // Add document properties to ZIP file + $objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet)); + $objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet)); + + // Add theme to ZIP file + $objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet)); + + // Add string table to ZIP file + $objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable)); + + // Add styles to ZIP file + $objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet)); + + // Add workbook to ZIP file + $objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet)); + + // Add worksheets + for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { + $objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i), $this->_stringTable)); + } + + // Add worksheet relationships (drawings, ...) + for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { + + // Add relationships + $objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1))); + + // Add drawing relationship parts + if ($this->_spreadSheet->getSheet($i)->getDrawingCollection()->count() > 0) { + // Drawing relationships + $objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i))); + + // Drawings + $objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i))); + } + + // Add comment relationship parts + if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) { + // VML Comments + $objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i))); + + // Comments + $objZip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->_spreadSheet->getSheet($i))); + } + + // Add header/footer relationship parts + if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) { + // VML Drawings + $objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i))); + + // VML Drawing relationships + $objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->_spreadSheet->getSheet($i))); + + // Media + foreach ($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) { + $objZip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath())); + } + } + } + + // Add media + for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { + if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + $imageContents = null; + $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath(); + + if (strpos($imagePath, 'zip://') !== false) { + $imagePath = substr($imagePath, 6); + $imagePathSplitted = explode('#', $imagePath); + + $imageZip = new ZipArchive(); + $imageZip->open($imagePathSplitted[0]); + $imageContents = $imageZip->getFromName($imagePathSplitted[1]); + $imageZip->close(); + unset($imageZip); + } else { + $imageContents = file_get_contents($imagePath); + } + + $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); + } else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + ob_start(); + call_user_func( + $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), + $this->getDrawingHashTable()->getByIndex($i)->getImageResource() + ); + $imageContents = ob_get_contents(); + ob_end_clean(); + + $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); + } + } + + PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); + + // Close file + if ($objZip->close() === false) { + throw new Exception("Could not close zip file $pFilename."); + } + + // If a temporary file was used, copy it to the correct file stream + if ($originalFilename != $pFilename) { + if (copy($pFilename, $originalFilename) === false) { + throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + } + @unlink($pFilename); + } + } else { + throw new Exception("PHPExcel object unassigned."); + } + } + + /** + * Get PHPExcel object + * + * @return PHPExcel + * @throws Exception + */ + public function getPHPExcel() { + if (!is_null($this->_spreadSheet)) { + return $this->_spreadSheet; + } else { + throw new Exception("No PHPExcel assigned."); + } + } + + /** + * Set PHPExcel object + * + * @param PHPExcel $pPHPExcel PHPExcel object + * @throws Exception + * @return PHPExcel_Writer_Excel2007 + */ + public function setPHPExcel(PHPExcel $pPHPExcel = null) { + $this->_spreadSheet = $pPHPExcel; + return $this; + } + + /** + * Get string table + * + * @return string[] + */ + public function getStringTable() { + return $this->_stringTable; + } + + /** + * Get PHPExcel_Style_Conditional HashTable + * + * @return PHPExcel_HashTable + */ + public function getStylesConditionalHashTable() { + return $this->_stylesConditionalHashTable; + } + + /** + * Get PHPExcel_Style_Fill HashTable + * + * @return PHPExcel_HashTable + */ + public function getFillHashTable() { + return $this->_fillHashTable; + } + + /** + * Get PHPExcel_Style_Font HashTable + * + * @return PHPExcel_HashTable + */ + public function getFontHashTable() { + return $this->_fontHashTable; + } + + /** + * Get PHPExcel_Style_Borders HashTable + * + * @return PHPExcel_HashTable + */ + public function getBordersHashTable() { + return $this->_bordersHashTable; + } + + /** + * Get PHPExcel_Style_NumberFormat HashTable + * + * @return PHPExcel_HashTable + */ + public function getNumFmtHashTable() { + return $this->_numFmtHashTable; + } + + /** + * Get PHPExcel_Worksheet_BaseDrawing HashTable + * + * @return PHPExcel_HashTable + */ + public function getDrawingHashTable() { + return $this->_drawingHashTable; + } + + /** + * Get Pre-Calculate Formulas + * + * @return boolean + */ + public function getPreCalculateFormulas() { + return $this->_preCalculateFormulas; + } + + /** + * Set Pre-Calculate Formulas + * + * @param boolean $pValue Pre-Calculate Formulas? + */ + public function setPreCalculateFormulas($pValue = true) { + $this->_preCalculateFormulas = $pValue; + } + + /** + * Get Office2003 compatibility + * + * @return boolean + */ + public function getOffice2003Compatibility() { + return $this->_office2003compatibility; + } + + /** + * Set Pre-Calculate Formulas + * + * @param boolean $pValue Office2003 compatibility? + * @return PHPExcel_Writer_Excel2007 + */ + public function setOffice2003Compatibility($pValue = false) { + $this->_office2003compatibility = $pValue; + return $this; + } + + /** + * Get use disk caching where possible? + * + * @return boolean + */ + public function getUseDiskCaching() { + return $this->_useDiskCaching; + } + + /** + * Set use disk caching where possible? + * + * @param boolean $pValue + * @param string $pDirectory Disk caching directory + * @throws Exception Exception when directory does not exist + * @return PHPExcel_Writer_Excel2007 + */ + public function setUseDiskCaching($pValue = false, $pDirectory = null) { + $this->_useDiskCaching = $pValue; + + if (!is_null($pDirectory)) { + if (is_dir($pDirectory)) { + $this->_diskCachingDirectory = $pDirectory; + } else { + throw new Exception("Directory does not exist: $pDirectory"); + } + } + return $this; + } + + /** + * Get disk caching directory + * + * @return string + */ + public function getDiskCachingDirectory() { + return $this->_diskCachingDirectory; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Comments.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Comments.php new file mode 100644 index 000000000..e7ef3d667 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Comments.php @@ -0,0 +1,304 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Comment */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Comment.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Comments + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write comments to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeComments(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Comments cache + $comments = $pWorksheet->getComments(); + + // Authors cache + $authors = array(); + $authorId = 0; + foreach ($comments as $comment) { + if (!isset($authors[$comment->getAuthor()])) { + $authors[$comment->getAuthor()] = $authorId++; + } + } + + // comments + $objWriter->startElement('comments'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + + // Loop trough authors + $objWriter->startElement('authors'); + foreach ($authors as $author => $index) { + $objWriter->writeElement('author', $author); + } + $objWriter->endElement(); + + // Loop trough comments + $objWriter->startElement('commentList'); + foreach ($comments as $key => $value) { + $this->_writeComment($objWriter, $key, $value, $authors); + } + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write comment to XML format + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pCellReference Cell reference + * @param PHPExcel_Comment $pComment Comment + * @param array $pAuthors Array of authors + * @throws Exception + */ + public function _writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) + { + // comment + $objWriter->startElement('comment'); + $objWriter->writeAttribute('ref', $pCellReference); + $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]); + + // text + $objWriter->startElement('text'); + $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write VML comments to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Comments cache + $comments = $pWorksheet->getComments(); + + // xml + $objWriter->startElement('xml'); + $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); + + // o:shapelayout + $objWriter->startElement('o:shapelayout'); + $objWriter->writeAttribute('v:ext', 'edit'); + + // o:idmap + $objWriter->startElement('o:idmap'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('data', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:shapetype + $objWriter->startElement('v:shapetype'); + $objWriter->writeAttribute('id', '_x0000_t202'); + $objWriter->writeAttribute('coordsize', '21600,21600'); + $objWriter->writeAttribute('o:spt', '202'); + $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe'); + + // v:stroke + $objWriter->startElement('v:stroke'); + $objWriter->writeAttribute('joinstyle', 'miter'); + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('gradientshapeok', 't'); + $objWriter->writeAttribute('o:connecttype', 'rect'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Loop trough comments + foreach ($comments as $key => $value) { + $this->_writeVMLComment($objWriter, $key, $value); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write VML comment to XML format + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pCellReference Cell reference + * @param PHPExcel_Comment $pComment Comment + * @throws Exception + */ + public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) + { + // Metadata + list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference); + $column = PHPExcel_Cell::columnIndexFromString($column); + $id = 1024 + $column + $row; + $id = substr($id, 0, 4); + + // v:shape + $objWriter->startElement('v:shape'); + $objWriter->writeAttribute('id', '_x0000_s' . $id); + $objWriter->writeAttribute('type', '#_x0000_t202'); + $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden')); + $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB()); + $objWriter->writeAttribute('o:insetmode', 'auto'); + + // v:fill + $objWriter->startElement('v:fill'); + $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB()); + $objWriter->endElement(); + + // v:shadow + $objWriter->startElement('v:shadow'); + $objWriter->writeAttribute('on', 't'); + $objWriter->writeAttribute('color', 'black'); + $objWriter->writeAttribute('obscured', 't'); + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('o:connecttype', 'none'); + $objWriter->endElement(); + + // v:textbox + $objWriter->startElement('v:textbox'); + $objWriter->writeAttribute('style', 'mso-direction-alt:auto'); + + // div + $objWriter->startElement('div'); + $objWriter->writeAttribute('style', 'text-align:left'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // x:ClientData + $objWriter->startElement('x:ClientData'); + $objWriter->writeAttribute('ObjectType', 'Note'); + + // x:MoveWithCells + $objWriter->writeElement('x:MoveWithCells', ''); + + // x:SizeWithCells + $objWriter->writeElement('x:SizeWithCells', ''); + + // x:Anchor + //$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18'); + + // x:AutoFill + $objWriter->writeElement('x:AutoFill', 'False'); + + // x:Row + $objWriter->writeElement('x:Row', ($row - 1)); + + // x:Column + $objWriter->writeElement('x:Column', ($column - 1)); + + $objWriter->endElement(); + + $objWriter->endElement(); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/ContentTypes.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/ContentTypes.php new file mode 100644 index 000000000..ebe7d0f47 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/ContentTypes.php @@ -0,0 +1,262 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Shared_File */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/File.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_ContentTypes + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write content types to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeContentTypes(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Types + $objWriter->startElement('Types'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); + + // Theme + $this->_writeOverrideContentType( + $objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml' + ); + + // Styles + $this->_writeOverrideContentType( + $objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml' + ); + + // Rels + $this->_writeDefaultContentType( + $objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml' + ); + + // XML + $this->_writeDefaultContentType( + $objWriter, 'xml', 'application/xml' + ); + + // VML + $this->_writeDefaultContentType( + $objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing' + ); + + // Workbook + $this->_writeOverrideContentType( + $objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml' + ); + + // DocProps + $this->_writeOverrideContentType( + $objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml' + ); + + $this->_writeOverrideContentType( + $objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml' + ); + + // Worksheets + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $this->_writeOverrideContentType( + $objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml' + ); + } + + // Shared strings + $this->_writeOverrideContentType( + $objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml' + ); + + // Add worksheet relationship content types + for ($i = 0; $i < $sheetCount; ++$i) { + if ($pPHPExcel->getSheet($i)->getDrawingCollection()->count() > 0) { + $this->_writeOverrideContentType( + $objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml' + ); + } + } + + // Comments + for ($i = 0; $i < $sheetCount; ++$i) { + if (count($pPHPExcel->getSheet($i)->getComments()) > 0) { + $this->_writeOverrideContentType( + $objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml' + ); + } + } + + // Add media content-types + $aMediaContentTypes = array(); + $mediaCount = $this->getParentWriter()->getDrawingHashTable()->count(); + for ($i = 0; $i < $mediaCount; ++$i) { + $extension = ''; + $mimeType = ''; + + if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); + $mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() ); + } else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); + $extension = explode('/', $extension); + $extension = $extension[1]; + + $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); + } + + if (!isset( $aMediaContentTypes[$extension]) ) { + $aMediaContentTypes[$extension] = $mimeType; + + $this->_writeDefaultContentType( + $objWriter, $extension, $mimeType + ); + } + } + + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { + foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { + if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) { + $aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() ); + + $this->_writeDefaultContentType( + $objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())] + ); + } + } + } + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Get image mime type + * + * @param string $pFile Filename + * @return string Mime Type + * @throws Exception + */ + private function _getImageMimeType($pFile = '') + { + if (PHPExcel_Shared_File::file_exists($pFile)) { + $image = getimagesize($pFile); + return image_type_to_mime_type($image[2]); + } else { + throw new Exception("File $pFile does not exist"); + } + } + + /** + * Write Default content type + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pPartname Part name + * @param string $pContentType Content type + * @throws Exception + */ + private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + { + if ($pPartname != '' && $pContentType != '') { + // Write content type + $objWriter->startElement('Default'); + $objWriter->writeAttribute('Extension', $pPartname); + $objWriter->writeAttribute('ContentType', $pContentType); + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Write Override content type + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pPartname Part name + * @param string $pContentType Content type + * @throws Exception + */ + private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + { + if ($pPartname != '' && $pContentType != '') { + // Write content type + $objWriter->startElement('Override'); + $objWriter->writeAttribute('PartName', $pPartname); + $objWriter->writeAttribute('ContentType', $pContentType); + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/DocProps.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/DocProps.php new file mode 100644 index 000000000..fcd845906 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/DocProps.php @@ -0,0 +1,220 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_DocProps + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart +{ +/** + * Write docProps/app.xml to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeDocPropsApp(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Properties + $objWriter->startElement('Properties'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'); + $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); + + // Application + $objWriter->writeElement('Application', 'Microsoft Excel'); + + // DocSecurity + $objWriter->writeElement('DocSecurity', '0'); + + // ScaleCrop + $objWriter->writeElement('ScaleCrop', 'false'); + + // HeadingPairs + $objWriter->startElement('HeadingPairs'); + + // Vector + $objWriter->startElement('vt:vector'); + $objWriter->writeAttribute('size', '2'); + $objWriter->writeAttribute('baseType', 'variant'); + + + // Variant + $objWriter->startElement('vt:variant'); + $objWriter->writeElement('vt:lpstr', 'Worksheets'); + $objWriter->endElement(); + + // Variant + $objWriter->startElement('vt:variant'); + $objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // TitlesOfParts + $objWriter->startElement('TitlesOfParts'); + + // Vector + $objWriter->startElement('vt:vector'); + $objWriter->writeAttribute('size', $pPHPExcel->getSheetCount()); + $objWriter->writeAttribute('baseType', 'lpstr'); + + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle()); + } + + $objWriter->endElement(); + + $objWriter->endElement(); + + // Company + $objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany()); + + // LinksUpToDate + $objWriter->writeElement('LinksUpToDate', 'false'); + + // SharedDoc + $objWriter->writeElement('SharedDoc', 'false'); + + // HyperlinksChanged + $objWriter->writeElement('HyperlinksChanged', 'false'); + + // AppVersion + $objWriter->writeElement('AppVersion', '12.0000'); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write docProps/core.xml to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeDocPropsCore(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // cp:coreProperties + $objWriter->startElement('cp:coreProperties'); + $objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties'); + $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); + $objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/'); + $objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/'); + $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + + // dc:creator + $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator()); + + // cp:lastModifiedBy + $objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy()); + + // dcterms:created + $objWriter->startElement('dcterms:created'); + $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); + $objWriter->writeRaw(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated())); + $objWriter->endElement(); + + // dcterms:modified + $objWriter->startElement('dcterms:modified'); + $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); + $objWriter->writeRaw(date(DATE_W3C, $pPHPExcel->getProperties()->getModified())); + $objWriter->endElement(); + + // dc:title + $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle()); + + // dc:description + $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription()); + + // dc:subject + $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject()); + + // cp:keywords + $objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords()); + + // cp:category + $objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory()); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Drawing.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Drawing.php new file mode 100644 index 000000000..f7d9f9895 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Drawing.php @@ -0,0 +1,552 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Worksheet_BaseDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/BaseDrawing.php'; + +/** PHPExcel_Worksheet_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing.php'; + +/** PHPExcel_Worksheet_MemoryDrawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/MemoryDrawing.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Shared_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Drawing + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write drawings to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // xdr:wsDr + $objWriter->startElement('xdr:wsDr'); + $objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + + // Loop trough images and write drawings + $i = 1; + $iterator = $pWorksheet->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + $this->_writeDrawing($objWriter, $iterator->current(), $i); + + $iterator->next(); + ++$i; + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write drawings to XML format + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet_BaseDrawing $pDrawing + * @param int $pRelationId + * @throws Exception + */ + public function _writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1) + { + if ($pRelationId >= 0) { + // xdr:oneCellAnchor + $objWriter->startElement('xdr:oneCellAnchor'); + // Image location + $aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates()); + $aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]); + + // xdr:from + $objWriter->startElement('xdr:from'); + $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1); + $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX())); + $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1); + $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY())); + $objWriter->endElement(); + + // xdr:ext + $objWriter->startElement('xdr:ext'); + $objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth())); + $objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight())); + $objWriter->endElement(); + + // xdr:pic + $objWriter->startElement('xdr:pic'); + + // xdr:nvPicPr + $objWriter->startElement('xdr:nvPicPr'); + + // xdr:cNvPr + $objWriter->startElement('xdr:cNvPr'); + $objWriter->writeAttribute('id', $pRelationId); + $objWriter->writeAttribute('name', $pDrawing->getName()); + $objWriter->writeAttribute('descr', $pDrawing->getDescription()); + $objWriter->endElement(); + + // xdr:cNvPicPr + $objWriter->startElement('xdr:cNvPicPr'); + + // a:picLocks + $objWriter->startElement('a:picLocks'); + $objWriter->writeAttribute('noChangeAspect', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:blipFill + $objWriter->startElement('xdr:blipFill'); + + // a:blip + $objWriter->startElement('a:blip'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $objWriter->writeAttribute('r:embed', 'rId' . $pRelationId); + $objWriter->endElement(); + + // a:stretch + $objWriter->startElement('a:stretch'); + $objWriter->writeElement('a:fillRect', null); + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:spPr + $objWriter->startElement('xdr:spPr'); + + // a:xfrm + $objWriter->startElement('a:xfrm'); + $objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation())); + $objWriter->endElement(); + + // a:prstGeom + $objWriter->startElement('a:prstGeom'); + $objWriter->writeAttribute('prst', 'rect'); + + // a:avLst + $objWriter->writeElement('a:avLst', null); + + $objWriter->endElement(); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'FFFFFF'); + +/* SHADE + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '85000'); + $objWriter->endElement(); +*/ + + $objWriter->endElement(); + + $objWriter->endElement(); +/* + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '88900'); + $objWriter->writeAttribute('cap', 'sq'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'FFFFFF'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:miter + $objWriter->startElement('a:miter'); + $objWriter->writeAttribute('lim', '800000'); + $objWriter->endElement(); + + $objWriter->endElement(); +*/ + + if ($pDrawing->getShadow()->getVisible()) { + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); + $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment()); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB()); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } +/* + + // a:scene3d + $objWriter->startElement('a:scene3d'); + + // a:camera + $objWriter->startElement('a:camera'); + $objWriter->writeAttribute('prst', 'orthographicFront'); + $objWriter->endElement(); + + // a:lightRig + $objWriter->startElement('a:lightRig'); + $objWriter->writeAttribute('rig', 'twoPt'); + $objWriter->writeAttribute('dir', 't'); + + // a:rot + $objWriter->startElement('a:rot'); + $objWriter->writeAttribute('lat', '0'); + $objWriter->writeAttribute('lon', '0'); + $objWriter->writeAttribute('rev', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); +*/ +/* + // a:sp3d + $objWriter->startElement('a:sp3d'); + + // a:bevelT + $objWriter->startElement('a:bevelT'); + $objWriter->writeAttribute('w', '25400'); + $objWriter->writeAttribute('h', '19050'); + $objWriter->endElement(); + + // a:contourClr + $objWriter->startElement('a:contourClr'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'FFFFFF'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); +*/ + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:clientData + $objWriter->writeElement('xdr:clientData', null); + + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Write VML header/footer images to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Header/footer images + $images = $pWorksheet->getHeaderFooter()->getImages(); + + // xml + $objWriter->startElement('xml'); + $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); + + // o:shapelayout + $objWriter->startElement('o:shapelayout'); + $objWriter->writeAttribute('v:ext', 'edit'); + + // o:idmap + $objWriter->startElement('o:idmap'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('data', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:shapetype + $objWriter->startElement('v:shapetype'); + $objWriter->writeAttribute('id', '_x0000_t75'); + $objWriter->writeAttribute('coordsize', '21600,21600'); + $objWriter->writeAttribute('o:spt', '75'); + $objWriter->writeAttribute('o:preferrelative', 't'); + $objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe'); + $objWriter->writeAttribute('filled', 'f'); + $objWriter->writeAttribute('stroked', 'f'); + + // v:stroke + $objWriter->startElement('v:stroke'); + $objWriter->writeAttribute('joinstyle', 'miter'); + $objWriter->endElement(); + + // v:formulas + $objWriter->startElement('v:formulas'); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @0 1 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum 0 0 @1'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @2 1 2'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @0 0 1'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @6 1 2'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @8 21600 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @10 21600 0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('o:extrusionok', 'f'); + $objWriter->writeAttribute('gradientshapeok', 't'); + $objWriter->writeAttribute('o:connecttype', 'rect'); + $objWriter->endElement(); + + // o:lock + $objWriter->startElement('o:lock'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('aspectratio', 't'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Loop trough images + foreach ($images as $key => $value) { + $this->_writeVMLHeaderFooterImage($objWriter, $key, $value); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write VML comment to XML format + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pReference Reference + * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image + * @throws Exception + */ + public function _writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null) + { + // Calculate object id + preg_match('{(\d+)}', md5($pReference), $m); + $id = 1500 + (substr($m[1], 0, 2) * 1); + + // Calculate offset + $width = $pImage->getWidth(); + $height = $pImage->getHeight(); + $marginLeft = $pImage->getOffsetX(); + $marginTop = $pImage->getOffsetY(); + + // v:shape + $objWriter->startElement('v:shape'); + $objWriter->writeAttribute('id', $pReference); + $objWriter->writeAttribute('o:spid', '_x0000_s' . $id); + $objWriter->writeAttribute('type', '#_x0000_t75'); + $objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1"); + + // v:imagedata + $objWriter->startElement('v:imagedata'); + $objWriter->writeAttribute('o:relid', 'rId' . $pReference); + $objWriter->writeAttribute('o:title', $pImage->getName()); + $objWriter->endElement(); + + // o:lock + $objWriter->startElement('o:lock'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('rotation', 't'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + + /** + * Get an array of all drawings + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel + * @throws Exception + */ + public function allDrawings(PHPExcel $pPHPExcel = null) + { + // Get an array of all drawings + $aDrawings = array(); + + // Loop trough PHPExcel + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // Loop trough images and add to array + $iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + $aDrawings[] = $iterator->current(); + + $iterator->next(); + } + } + + return $aDrawings; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Rels.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Rels.php new file mode 100644 index 000000000..fd8ad849e --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Rels.php @@ -0,0 +1,389 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Rels + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write relationships to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeRelationships(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Relationship docProps/app.xml + $this->_writeRelationship( + $objWriter, + 3, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', + 'docProps/app.xml' + ); + + // Relationship docProps/core.xml + $this->_writeRelationship( + $objWriter, + 2, + 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', + 'docProps/core.xml' + ); + + // Relationship xl/workbook.xml + $this->_writeRelationship( + $objWriter, + 1, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', + 'xl/workbook.xml' + ); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write workbook relationships to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Relationship styles.xml + $this->_writeRelationship( + $objWriter, + 1, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', + 'styles.xml' + ); + + // Relationship theme/theme1.xml + $this->_writeRelationship( + $objWriter, + 2, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', + 'theme/theme1.xml' + ); + + // Relationship sharedStrings.xml + $this->_writeRelationship( + $objWriter, + 3, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', + 'sharedStrings.xml' + ); + + // Relationships with sheets + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $this->_writeRelationship( + $objWriter, + ($i + 1 + 3), + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', + 'worksheets/sheet' . ($i + 1) . '.xml' + ); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write worksheet relationships to XML format + * + * Numbering is as follows: + * rId1 - Drawings + * rId_hyperlink_x - Hyperlinks + * + * @param PHPExcel_Worksheet $pWorksheet + * @param int $pWorksheetId + * @return string XML Output + * @throws Exception + */ + public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Write drawing relationships? + if ($pWorksheet->getDrawingCollection()->count() > 0) { + $this->_writeRelationship( + $objWriter, + 1, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', + '../drawings/drawing' . $pWorksheetId . '.xml' + ); + } + + // Write hyperlink relationships? + $i = 1; + foreach ($pWorksheet->getCellCollection() as $cell) { + if ($cell->hasHyperlink() && !$cell->getHyperlink()->isInternal()) { + $this->_writeRelationship( + $objWriter, + '_hyperlink_' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', + $cell->getHyperlink()->getUrl(), + 'External' + ); + + ++$i; + } + } + + // Write comments relationship? + $i = 1; + if (count($pWorksheet->getComments()) > 0) { + $this->_writeRelationship( + $objWriter, + '_comments_vml' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', + '../drawings/vmlDrawing' . $pWorksheetId . '.vml' + ); + + $this->_writeRelationship( + $objWriter, + '_comments' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', + '../comments' . $pWorksheetId . '.xml' + ); + } + + // Write header/footer relationship? + $i = 1; + if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) { + $this->_writeRelationship( + $objWriter, + '_headerfooter_vml' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', + '../drawings/vmlDrawingHF' . $pWorksheetId . '.vml' + ); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write drawing relationships to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Loop trough images and write relationships + $i = 1; + $iterator = $pWorksheet->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing + || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) { + // Write relationship for image drawing + $this->_writeRelationship( + $objWriter, + $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + '../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename()) + ); + } + + $iterator->next(); + ++$i; + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write header/footer drawing relationships to XML format + * + * @param PHPExcel_Worksheet $pWorksheet + * @return string XML Output + * @throws Exception + */ + public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Loop trough images and write relationships + foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) { + // Write relationship for image drawing + $this->_writeRelationship( + $objWriter, + $key, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + '../media/' . $value->getIndexedFilename() + ); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write Override content type + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param int $pId Relationship ID. rId will be prepended! + * @param string $pType Relationship type + * @param string $pTarget Relationship target + * @param string $pTargetMode Relationship target mode + * @throws Exception + */ + private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') + { + if ($pType != '' && $pTarget != '') { + // Write relationship + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', 'rId' . $pId); + $objWriter->writeAttribute('Type', $pType); + $objWriter->writeAttribute('Target', $pTarget); + + if ($pTargetMode != '') { + $objWriter->writeAttribute('TargetMode', $pTargetMode); + } + + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/StringTable.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/StringTable.php new file mode 100644 index 000000000..f1bc7168f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/StringTable.php @@ -0,0 +1,269 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Cell_DataType */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell/DataType.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + + +/** + * PHPExcel_Writer_Excel2007_StringTable + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Create worksheet stringtable + * + * @param PHPExcel_Worksheet $pSheet Worksheet + * @param string[] $pExistingTable Existing table to eventually merge with + * @return string[] String table for worksheet + * @throws Exception + */ + public function createStringTable($pSheet = null, $pExistingTable = null) + { + if (!is_null($pSheet)) { + // Create string lookup table + $aStringTable = array(); + $cellCollection = null; + $aFlippedStringTable = null; // For faster lookup + + // Is an existing table given? + if (!is_null($pExistingTable) && is_array($pExistingTable)) { + $aStringTable = $pExistingTable; + } + + // Fill index array + $aFlippedStringTable = $this->flipStringTable($aStringTable); + + // Loop trough cells + $cellCollection = $pSheet->getCellCollection(); + foreach ($cellCollection as $cell) { + if (!is_object($cell->getValue()) && + !isset($aFlippedStringTable[$cell->getValue()]) && + !is_null($cell->getValue()) && + $cell->getValue() !== '' && + ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL) + ) { + $aStringTable[] = $cell->getValue(); + $aFlippedStringTable[$cell->getValue()] = 1; + + } else if ($cell->getValue() instanceof PHPExcel_RichText && + !isset($aFlippedStringTable[$cell->getValue()->getHashCode()]) && + !is_null($cell->getValue()) + ) { + $aStringTable[] = $cell->getValue(); + $aFlippedStringTable[$cell->getValue()->getHashCode()] = 1; + } + } + + // Return + return $aStringTable; + } else { + throw new Exception("Invalid PHPExcel_Worksheet object passed."); + } + } + + /** + * Write string table to XML format + * + * @param string[] $pStringTable + * @return string XML Output + * @throws Exception + */ + public function writeStringTable($pStringTable = null) + { + if (!is_null($pStringTable)) { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // String table + $objWriter->startElement('sst'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('uniqueCount', count($pStringTable)); + + // Loop trough string table + foreach ($pStringTable as $textElement) { + $objWriter->startElement('si'); + + if (! $textElement instanceof PHPExcel_RichText) { + $textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement ); + $objWriter->startElement('t'); + if ($textToWrite !== trim($textToWrite)) { + $objWriter->writeAttribute('xml:space', 'preserve'); + } + $objWriter->writeRaw($textToWrite); + $objWriter->endElement(); + } else if ($textElement instanceof PHPExcel_RichText) { + $this->writeRichText($objWriter, $textElement); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } else { + throw new Exception("Invalid string table array passed."); + } + } + + /** + * Write Rich Text + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_RichText $pRichText Rich text + * @throws Exception + */ + public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null) + { + // Loop trough rich text elements + $elements = $pRichText->getRichTextElements(); + foreach ($elements as $element) { + // r + $objWriter->startElement('r'); + + // rPr + if ($element instanceof PHPExcel_RichText_Run) { + // rPr + $objWriter->startElement('rPr'); + + // rFont + $objWriter->startElement('rFont'); + $objWriter->writeAttribute('val', $element->getFont()->getName()); + $objWriter->endElement(); + + // Bold + $objWriter->startElement('b'); + $objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false')); + $objWriter->endElement(); + + // Italic + $objWriter->startElement('i'); + $objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false')); + $objWriter->endElement(); + + // Superscript / subscript + if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) { + $objWriter->startElement('vertAlign'); + if ($element->getFont()->getSuperScript()) { + $objWriter->writeAttribute('val', 'superscript'); + } else if ($element->getFont()->getSubScript()) { + $objWriter->writeAttribute('val', 'subscript'); + } + $objWriter->endElement(); + } + + // Strikethrough + $objWriter->startElement('strike'); + $objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false')); + $objWriter->endElement(); + + // Color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB()); + $objWriter->endElement(); + + // Size + $objWriter->startElement('sz'); + $objWriter->writeAttribute('val', $element->getFont()->getSize()); + $objWriter->endElement(); + + // Underline + $objWriter->startElement('u'); + $objWriter->writeAttribute('val', $element->getFont()->getUnderline()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + // t + $objWriter->startElement('t'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeRaw(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($element->getText()) )); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Flip string table (for index searching) + * + * @param array $stringTable Stringtable + * @return array + */ + public function flipStringTable($stringTable = array()) { + // Return value + $returnValue = array(); + + // Loop trough stringtable and add flipped items to $returnValue + foreach ($stringTable as $key => $value) { + if (! $value instanceof PHPExcel_RichText) { + $returnValue[$value] = $key; + } else if ($value instanceof PHPExcel_RichText) { + $returnValue[$value->getHashCode()] = $key; + } + } + + // Return + return $returnValue; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Style.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Style.php new file mode 100644 index 000000000..eca0ac781 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Style.php @@ -0,0 +1,713 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Style */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php'; + +/** PHPExcel_Style_Borders */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Borders.php'; + +/** PHPExcel_Style_Border */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Border.php'; + +/** PHPExcel_Style_Color */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php'; + +/** PHPExcel_Style_Fill */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + +/** PHPExcel_Style_NumberFormat */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php'; + +/** PHPExcel_Style_Conditional */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Conditional.php'; + +/** PHPExcel_Style_Protection */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Protection.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Style + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write styles to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeStyles(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // styleSheet + $objWriter->startElement('styleSheet'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + + // numFmts + $objWriter->startElement('numFmts'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count()); + + // numFmt + for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) { + $this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i); + } + + $objWriter->endElement(); + + // fonts + $objWriter->startElement('fonts'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count()); + + // font + for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) { + $this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // fills + $objWriter->startElement('fills'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count()); + + // fill + for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) { + $this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // borders + $objWriter->startElement('borders'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count()); + + // border + for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) { + $this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // cellStyleXfs + $objWriter->startElement('cellStyleXfs'); + $objWriter->writeAttribute('count', 1); + + // xf + $objWriter->startElement('xf'); + $objWriter->writeAttribute('numFmtId', 0); + $objWriter->writeAttribute('fontId', 0); + $objWriter->writeAttribute('fillId', 0); + $objWriter->writeAttribute('borderId', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + + // cellXfs + $objWriter->startElement('cellXfs'); + $objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection())); + + // xf + foreach ($pPHPExcel->getCellXfCollection() as $cellXf) { + $this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel); + } + + $objWriter->endElement(); + + // cellStyles + $objWriter->startElement('cellStyles'); + $objWriter->writeAttribute('count', 1); + + // cellStyle + $objWriter->startElement('cellStyle'); + $objWriter->writeAttribute('name', 'Normal'); + $objWriter->writeAttribute('xfId', 0); + $objWriter->writeAttribute('builtinId', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + + // dxfs + $objWriter->startElement('dxfs'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count()); + + // dxf + for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) { + $this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle()); + } + + $objWriter->endElement(); + + // tableStyles + $objWriter->startElement('tableStyles'); + $objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9'); + $objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write Fill + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_Fill $pFill Fill style + * @throws Exception + */ + private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + { + // Check if this is a pattern type or gradient type + if ($pFill->getFillType() == PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR + || $pFill->getFillType() == PHPExcel_Style_Fill::FILL_GRADIENT_PATH) { + // Gradient fill + $this->_writeGradientFill($objWriter, $pFill); + } else { + // Pattern fill + $this->_writePatternFill($objWriter, $pFill); + } + } + + /** + * Write Gradient Fill + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_Fill $pFill Fill style + * @throws Exception + */ + private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + { + // fill + $objWriter->startElement('fill'); + + // gradientFill + $objWriter->startElement('gradientFill'); + $objWriter->writeAttribute('type', $pFill->getFillType()); + $objWriter->writeAttribute('degree', $pFill->getRotation()); + + // stop + $objWriter->startElement('stop'); + $objWriter->writeAttribute('position', '0'); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // stop + $objWriter->startElement('stop'); + $objWriter->writeAttribute('position', '1'); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Pattern Fill + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_Fill $pFill Fill style + * @throws Exception + */ + private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + { + // fill + $objWriter->startElement('fill'); + + // patternFill + $objWriter->startElement('patternFill'); + $objWriter->writeAttribute('patternType', $pFill->getFillType()); + + // fgColor + $objWriter->startElement('fgColor'); + $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); + $objWriter->endElement(); + + // bgColor + $objWriter->startElement('bgColor'); + $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Font + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_Font $pFont Font style + * @throws Exception + */ + private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) + { + // font + $objWriter->startElement('font'); + + // Name + $objWriter->startElement('name'); + $objWriter->writeAttribute('val', $pFont->getName()); + $objWriter->endElement(); + + // Size + $objWriter->startElement('sz'); + $objWriter->writeAttribute('val', $pFont->getSize()); + $objWriter->endElement(); + + // Bold + if ($pFont->getBold()) { + $objWriter->startElement('b'); + $objWriter->writeAttribute('val', 'true'); + $objWriter->endElement(); + } + + // Italic + if ($pFont->getItalic()) { + $objWriter->startElement('i'); + $objWriter->writeAttribute('val', 'true'); + $objWriter->endElement(); + } + + // Superscript / subscript + if ($pFont->getSuperScript() || $pFont->getSubScript()) { + $objWriter->startElement('vertAlign'); + if ($pFont->getSuperScript()) { + $objWriter->writeAttribute('val', 'superscript'); + } else if ($pFont->getSubScript()) { + $objWriter->writeAttribute('val', 'subscript'); + } + $objWriter->endElement(); + } + + // Underline + $objWriter->startElement('u'); + $objWriter->writeAttribute('val', $pFont->getUnderline()); + $objWriter->endElement(); + + // Strikethrough + if ($pFont->getStrikethrough()) { + $objWriter->startElement('strike'); + $objWriter->writeAttribute('val', 'true'); + $objWriter->endElement(); + } + + // Foreground color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Border + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_Borders $pBorders Borders style + * @throws Exception + */ + private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) + { + // Write border + $objWriter->startElement('border'); + // Diagonal? + switch ($pBorders->getDiagonalDirection()) { + case PHPExcel_Style_Borders::DIAGONAL_UP: + $objWriter->writeAttribute('diagonalUp', 'true'); + $objWriter->writeAttribute('diagonalDown', 'false'); + break; + case PHPExcel_Style_Borders::DIAGONAL_DOWN: + $objWriter->writeAttribute('diagonalUp', 'false'); + $objWriter->writeAttribute('diagonalDown', 'true'); + break; + } + + // BorderPr + $this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft()); + $this->_writeBorderPr($objWriter, 'right', $pBorders->getRight()); + $this->_writeBorderPr($objWriter, 'top', $pBorders->getTop()); + $this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom()); + $this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal()); + $objWriter->endElement(); + } + + /** + * Write Cell Style Xf + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style $pStyle Style + * @param PHPExcel $pPHPExcel Workbook + * @throws Exception + */ + private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) + { + // xf + $objWriter->startElement('xf'); + $objWriter->writeAttribute('xfId', 0); + $objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode())); + + if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) { + $objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) ); + } else { + $objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode()); + } + + $objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode())); + $objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode())); + + // Apply styles? + $objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0'); + if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('applyProtection', 'true'); + } + + // alignment + $objWriter->startElement('alignment'); + $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); + $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); + + $textRotation = 0; + if ($pStyle->getAlignment()->getTextRotation() >= 0) { + $textRotation = $pStyle->getAlignment()->getTextRotation(); + } else if ($pStyle->getAlignment()->getTextRotation() < 0) { + $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); + } + + $objWriter->writeAttribute('textRotation', $textRotation); + $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false')); + $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false')); + + if ($pStyle->getAlignment()->getIndent() > 0) { + $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent()); + } + $objWriter->endElement(); + + // protection + if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->startElement('protection'); + if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Cell Style Dxf + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style $pStyle Style + * @throws Exception + */ + private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) + { + // dxf + $objWriter->startElement('dxf'); + + // font + $this->_writeFont($objWriter, $pStyle->getFont()); + + // numFmt + $this->_writeNumFmt($objWriter, $pStyle->getNumberFormat()); + + // fill + $this->_writeFill($objWriter, $pStyle->getFill()); + + // alignment + $objWriter->startElement('alignment'); + $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); + $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); + + $textRotation = 0; + if ($pStyle->getAlignment()->getTextRotation() >= 0) { + $textRotation = $pStyle->getAlignment()->getTextRotation(); + } else if ($pStyle->getAlignment()->getTextRotation() < 0) { + $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); + } + + $objWriter->writeAttribute('textRotation', $textRotation); + $objWriter->endElement(); + + // border + $this->_writeBorder($objWriter, $pStyle->getBorders()); + + // protection + if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->startElement('protection'); + if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write BorderPr + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pName Element name + * @param PHPExcel_Style_Border $pBorder Border style + * @throws Exception + */ + private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) + { + // Write BorderPr + if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { + $objWriter->startElement($pName); + $objWriter->writeAttribute('style', $pBorder->getBorderStyle()); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Write NumberFormat + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format + * @param int $pId Number Format identifier + * @throws Exception + */ + private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) + { + // Translate formatcode + $formatCode = $pNumberFormat->getFormatCode(); + + // numFmt + $objWriter->startElement('numFmt'); + $objWriter->writeAttribute('numFmtId', ($pId + 164)); + $objWriter->writeAttribute('formatCode', $formatCode); + $objWriter->endElement(); + } + + /** + * Get an array of all styles + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style[] All styles in PHPExcel + * @throws Exception + */ + public function allStyles(PHPExcel $pPHPExcel = null) + { + $aStyles = $pPHPExcel->getCellXfCollection(); + + return $aStyles; + } + + /** + * Get an array of all conditional styles + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel + * @throws Exception + */ + public function allConditionalStyles(PHPExcel $pPHPExcel = null) + { + // Get an array of all styles + $aStyles = array(); + + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + foreach ($pPHPExcel->getSheet($i)->getConditionalStylesCollection() as $conditionalStyles) { + foreach ($conditionalStyles as $conditionalStyle) { + $aStyles[] = $conditionalStyle; + } + } + } + + return $aStyles; + } + + /** + * Get an array of all fills + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style_Fill[] All fills in PHPExcel + * @throws Exception + */ + public function allFills(PHPExcel $pPHPExcel = null) + { + // Get an array of unique fills + $aFills = array(); + + // Two first fills are predefined + $fill0 = new PHPExcel_Style_Fill(); + $fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE); + $aFills[] = $fill0; + + $fill1 = new PHPExcel_Style_Fill(); + $fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125); + $aFills[] = $fill1; + + // The remaining fills + $aStyles = $this->allStyles($pPHPExcel); + foreach ($aStyles as $style) { + if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) { + $aFills[ $style->getFill()->getHashCode() ] = $style->getFill(); + } + } + + return $aFills; + } + + /** + * Get an array of all fonts + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style_Font[] All fonts in PHPExcel + * @throws Exception + */ + public function allFonts(PHPExcel $pPHPExcel = null) + { + // Get an array of unique fonts + $aFonts = array(); + $aStyles = $this->allStyles($pPHPExcel); + + foreach ($aStyles as $style) { + if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) { + $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont(); + } + } + + return $aFonts; + } + + /** + * Get an array of all borders + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style_Borders[] All borders in PHPExcel + * @throws Exception + */ + public function allBorders(PHPExcel $pPHPExcel = null) + { + // Get an array of unique borders + $aBorders = array(); + $aStyles = $this->allStyles($pPHPExcel); + + foreach ($aStyles as $style) { + if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) { + $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders(); + } + } + + return $aBorders; + } + + /** + * Get an array of all number formats + * + * @param PHPExcel $pPHPExcel + * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel + * @throws Exception + */ + public function allNumberFormats(PHPExcel $pPHPExcel = null) + { + // Get an array of unique number formats + $aNumFmts = array(); + $aStyles = $this->allStyles($pPHPExcel); + + foreach ($aStyles as $style) { + if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) { + $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat(); + } + } + + return $aNumFmts; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Theme.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Theme.php new file mode 100644 index 000000000..cd8c2c932 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Theme.php @@ -0,0 +1,1223 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_DocProps + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write theme to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeTheme(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // a:theme + $objWriter->startElement('a:theme'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $objWriter->writeAttribute('name', 'Office Theme'); + + // a:themeElements + $objWriter->startElement('a:themeElements'); + + { + // a:clrScheme + $objWriter->startElement('a:clrScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:dk1 + $objWriter->startElement('a:dk1'); + + // a:sysClr + $objWriter->startElement('a:sysClr'); + $objWriter->writeAttribute('val', 'windowText'); + $objWriter->writeAttribute('lastClr', '000000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lt1 + $objWriter->startElement('a:lt1'); + + // a:sysClr + $objWriter->startElement('a:sysClr'); + $objWriter->writeAttribute('val', 'window'); + $objWriter->writeAttribute('lastClr', 'FFFFFF'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:dk2 + $objWriter->startElement('a:dk2'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '1F497D'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lt2 + $objWriter->startElement('a:lt2'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'EEECE1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent1 + $objWriter->startElement('a:accent1'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '4F81BD'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent2 + $objWriter->startElement('a:accent2'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'C0504D'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent3 + $objWriter->startElement('a:accent3'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '9BBB59'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent4 + $objWriter->startElement('a:accent4'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '8064A2'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent5 + $objWriter->startElement('a:accent5'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '4BACC6'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:accent6 + $objWriter->startElement('a:accent6'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', 'F79646'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:hlink + $objWriter->startElement('a:hlink'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '0000FF'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:folHlink + $objWriter->startElement('a:folHlink'); + + // a:sysClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '800080'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + { + // a:fontScheme + $objWriter->startElement('a:fontScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:majorFont + $objWriter->startElement('a:majorFont'); + + // a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', 'Cambria'); + $objWriter->endElement(); + + // a:ea + $objWriter->startElement('a:ea'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + // a:cs + $objWriter->startElement('a:cs'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Jpan'); + $objWriter->writeAttribute('typeface', '?? ?????'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hang'); + $objWriter->writeAttribute('typeface', '?? ??'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hans'); + $objWriter->writeAttribute('typeface', '??'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hant'); + $objWriter->writeAttribute('typeface', '????'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Arab'); + $objWriter->writeAttribute('typeface', 'Times New Roman'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hebr'); + $objWriter->writeAttribute('typeface', 'Times New Roman'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Thai'); + $objWriter->writeAttribute('typeface', 'Tahoma'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Ethi'); + $objWriter->writeAttribute('typeface', 'Nyala'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Beng'); + $objWriter->writeAttribute('typeface', 'Vrinda'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Gujr'); + $objWriter->writeAttribute('typeface', 'Shruti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Khmr'); + $objWriter->writeAttribute('typeface', 'MoolBoran'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Knda'); + $objWriter->writeAttribute('typeface', 'Tunga'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Guru'); + $objWriter->writeAttribute('typeface', 'Raavi'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Cans'); + $objWriter->writeAttribute('typeface', 'Euphemia'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Cher'); + $objWriter->writeAttribute('typeface', 'Plantagenet Cherokee'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Yiii'); + $objWriter->writeAttribute('typeface', 'Microsoft Yi Baiti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Tibt'); + $objWriter->writeAttribute('typeface', 'Microsoft Himalaya'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Thaa'); + $objWriter->writeAttribute('typeface', 'MV Boli'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Deva'); + $objWriter->writeAttribute('typeface', 'Mangal'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Telu'); + $objWriter->writeAttribute('typeface', 'Gautami'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Taml'); + $objWriter->writeAttribute('typeface', 'Latha'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Syrc'); + $objWriter->writeAttribute('typeface', 'Estrangelo Edessa'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Orya'); + $objWriter->writeAttribute('typeface', 'Kalinga'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Mlym'); + $objWriter->writeAttribute('typeface', 'Kartika'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Laoo'); + $objWriter->writeAttribute('typeface', 'DokChampa'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Sinh'); + $objWriter->writeAttribute('typeface', 'Iskoola Pota'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Mong'); + $objWriter->writeAttribute('typeface', 'Mongolian Baiti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Viet'); + $objWriter->writeAttribute('typeface', 'Times New Roman'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Uigh'); + $objWriter->writeAttribute('typeface', 'Microsoft Uighur'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:minorFont + $objWriter->startElement('a:minorFont'); + + // a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', 'Calibri'); + $objWriter->endElement(); + + // a:ea + $objWriter->startElement('a:ea'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + // a:cs + $objWriter->startElement('a:cs'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Jpan'); + $objWriter->writeAttribute('typeface', '?? ?????'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hang'); + $objWriter->writeAttribute('typeface', '?? ??'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hans'); + $objWriter->writeAttribute('typeface', '??'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hant'); + $objWriter->writeAttribute('typeface', '????'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Arab'); + $objWriter->writeAttribute('typeface', 'Arial'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Hebr'); + $objWriter->writeAttribute('typeface', 'Arial'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Thai'); + $objWriter->writeAttribute('typeface', 'Tahoma'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Ethi'); + $objWriter->writeAttribute('typeface', 'Nyala'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Beng'); + $objWriter->writeAttribute('typeface', 'Vrinda'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Gujr'); + $objWriter->writeAttribute('typeface', 'Shruti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Khmr'); + $objWriter->writeAttribute('typeface', 'DaunPenh'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Knda'); + $objWriter->writeAttribute('typeface', 'Tunga'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Guru'); + $objWriter->writeAttribute('typeface', 'Raavi'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Cans'); + $objWriter->writeAttribute('typeface', 'Euphemia'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Cher'); + $objWriter->writeAttribute('typeface', 'Plantagenet Cherokee'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Yiii'); + $objWriter->writeAttribute('typeface', 'Microsoft Yi Baiti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Tibt'); + $objWriter->writeAttribute('typeface', 'Microsoft Himalaya'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Thaa'); + $objWriter->writeAttribute('typeface', 'MV Boli'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Deva'); + $objWriter->writeAttribute('typeface', 'Mangal'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Telu'); + $objWriter->writeAttribute('typeface', 'Gautami'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Taml'); + $objWriter->writeAttribute('typeface', 'Latha'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Syrc'); + $objWriter->writeAttribute('typeface', 'Estrangelo Edessa'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Orya'); + $objWriter->writeAttribute('typeface', 'Kalinga'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Mlym'); + $objWriter->writeAttribute('typeface', 'Kartika'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Laoo'); + $objWriter->writeAttribute('typeface', 'DokChampa'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Sinh'); + $objWriter->writeAttribute('typeface', 'Iskoola Pota'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Mong'); + $objWriter->writeAttribute('typeface', 'Mongolian Baiti'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Viet'); + $objWriter->writeAttribute('typeface', 'Arial'); + $objWriter->endElement(); + + // a:font + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', 'Uigh'); + $objWriter->writeAttribute('typeface', 'Microsoft Uighur'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + { + // a:fmtScheme + $objWriter->startElement('a:fmtScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:fillStyleLst + $objWriter->startElement('a:fillStyleLst'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '50000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '35000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '37000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '15000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lin + $objWriter->startElement('a:lin'); + $objWriter->writeAttribute('ang', '16200000'); + $objWriter->writeAttribute('scaled', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '51000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '130000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '80000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '93000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '130000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '94000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '135000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lin + $objWriter->startElement('a:lin'); + $objWriter->writeAttribute('ang', '16200000'); + $objWriter->writeAttribute('scaled', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lnStyleLst + $objWriter->startElement('a:lnStyleLst'); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '9525'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '95000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '105000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '25400'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '38100'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + + + // a:effectStyleLst + $objWriter->startElement('a:effectStyleLst'); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '20000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '38000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '23000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '35000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '23000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '35000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:scene3d + $objWriter->startElement('a:scene3d'); + + // a:camera + $objWriter->startElement('a:camera'); + $objWriter->writeAttribute('prst', 'orthographicFront'); + + // a:rot + $objWriter->startElement('a:rot'); + $objWriter->writeAttribute('lat', '0'); + $objWriter->writeAttribute('lon', '0'); + $objWriter->writeAttribute('rev', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lightRig + $objWriter->startElement('a:lightRig'); + $objWriter->writeAttribute('rig', 'threePt'); + $objWriter->writeAttribute('dir', 't'); + + // a:rot + $objWriter->startElement('a:rot'); + $objWriter->writeAttribute('lat', '0'); + $objWriter->writeAttribute('lon', '0'); + $objWriter->writeAttribute('rev', '1200000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:sp3d + $objWriter->startElement('a:sp3d'); + + // a:bevelT + $objWriter->startElement('a:bevelT'); + $objWriter->writeAttribute('w', '63500'); + $objWriter->writeAttribute('h', '25400'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:bgFillStyleLst + $objWriter->startElement('a:bgFillStyleLst'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '40000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '40000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '45000'); + $objWriter->endElement(); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '99000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '20000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '255000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:path + $objWriter->startElement('a:path'); + $objWriter->writeAttribute('path', 'circle'); + + // a:fillToRect + $objWriter->startElement('a:fillToRect'); + $objWriter->writeAttribute('l', '50000'); + $objWriter->writeAttribute('t', '-80000'); + $objWriter->writeAttribute('r', '50000'); + $objWriter->writeAttribute('b', '180000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '80000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '30000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '200000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:path + $objWriter->startElement('a:path'); + $objWriter->writeAttribute('path', 'circle'); + + // a:fillToRect + $objWriter->startElement('a:fillToRect'); + $objWriter->writeAttribute('l', '50000'); + $objWriter->writeAttribute('t', '50000'); + $objWriter->writeAttribute('r', '50000'); + $objWriter->writeAttribute('b', '50000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + $objWriter->endElement(); + + // a:objectDefaults + $objWriter->writeElement('a:objectDefaults', null); + + // a:extraClrSchemeLst + $objWriter->writeElement('a:extraClrSchemeLst', null); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Workbook.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Workbook.php new file mode 100644 index 000000000..7bf7f2454 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Workbook.php @@ -0,0 +1,461 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Shared_Date */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Date.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Workbook + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write workbook to XML format + * + * @param PHPExcel $pPHPExcel + * @return string XML Output + * @throws Exception + */ + public function writeWorkbook(PHPExcel $pPHPExcel = null) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // workbook + $objWriter->startElement('workbook'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + // fileVersion + $this->_writeFileVersion($objWriter); + + // workbookPr + $this->_writeWorkbookPr($objWriter); + + // workbookProtection + $this->_writeWorkbookProtection($objWriter, $pPHPExcel); + + // bookViews + if ($this->getParentWriter()->getOffice2003Compatibility() === false) { + $this->_writeBookViews($objWriter, $pPHPExcel); + } + + // sheets + $this->_writeSheets($objWriter, $pPHPExcel); + + // definedNames + $this->_writeDefinedNames($objWriter, $pPHPExcel); + + // calcPr + $this->_writeCalcPr($objWriter); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write file version + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @throws Exception + */ + private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null) + { + $objWriter->startElement('fileVersion'); + $objWriter->writeAttribute('appName', 'xl'); + $objWriter->writeAttribute('lastEdited', '4'); + $objWriter->writeAttribute('lowestEdited', '4'); + $objWriter->writeAttribute('rupBuild', '4505'); + $objWriter->endElement(); + } + + /** + * Write WorkbookPr + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @throws Exception + */ + private function _writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null) + { + $objWriter->startElement('workbookPr'); + + if (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) { + $objWriter->writeAttribute('date1904', '1'); + } + + $objWriter->writeAttribute('codeName', 'ThisWorkbook'); + + $objWriter->endElement(); + } + + /** + * Write BookViews + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel $pPHPExcel + * @throws Exception + */ + private function _writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + { + // bookViews + $objWriter->startElement('bookViews'); + + // workbookView + $objWriter->startElement('workbookView'); + + $objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex()); + $objWriter->writeAttribute('autoFilterDateGrouping', '1'); + $objWriter->writeAttribute('firstSheet', '0'); + $objWriter->writeAttribute('minimized', '0'); + $objWriter->writeAttribute('showHorizontalScroll', '1'); + $objWriter->writeAttribute('showSheetTabs', '1'); + $objWriter->writeAttribute('showVerticalScroll', '1'); + $objWriter->writeAttribute('tabRatio', '600'); + $objWriter->writeAttribute('visibility', 'visible'); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write WorkbookProtection + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel $pPHPExcel + * @throws Exception + */ + private function _writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + { + if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { + $objWriter->startElement('workbookProtection'); + $objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false')); + $objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false')); + $objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false')); + + if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') { + $objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword()); + } + + if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') { + $objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword()); + } + + $objWriter->endElement(); + } + } + + /** + * Write calcPr + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @throws Exception + */ + private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null) + { + $objWriter->startElement('calcPr'); + + $objWriter->writeAttribute('calcId', '124519'); + $objWriter->writeAttribute('calcMode', 'auto'); + $objWriter->writeAttribute('fullCalcOnLoad', '1'); + + $objWriter->endElement(); + } + + /** + * Write sheets + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel $pPHPExcel + * @throws Exception + */ + private function _writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + { + // Write sheets + $objWriter->startElement('sheets'); + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // sheet + $this->_writeSheet( + $objWriter, + $pPHPExcel->getSheet($i)->getTitle(), + ($i + 1), + ($i + 1 + 3) + ); + } + + $objWriter->endElement(); + } + + /** + * Write sheet + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param string $pSheetname Sheet name + * @param int $pSheetId Sheet id + * @param int $pRelId Relationship ID + * @throws Exception + */ + private function _writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1) + { + if ($pSheetname != '') { + // Write sheet + $objWriter->startElement('sheet'); + $objWriter->writeAttribute('name', $pSheetname); + $objWriter->writeAttribute('sheetId', $pSheetId); + $objWriter->writeAttribute('r:id', 'rId' . $pRelId); + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Write Defined Names + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel $pPHPExcel + * @throws Exception + */ + private function _writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + { + // Write defined names + $objWriter->startElement('definedNames'); + + // Named ranges + if (count($pPHPExcel->getNamedRanges()) > 0) { + // Named ranges + $this->_writeNamedRanges($objWriter, $pPHPExcel); + } + + // Other defined names + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // definedName for autoFilter + $this->_writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i); + + // definedName for Print_Titles + $this->_writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i); + + // definedName for Print_Area + $this->_writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i); + } + + $objWriter->endElement(); + } + + /** + * Write named ranges + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel $pPHPExcel + * @throws Exception + */ + private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) + { + // Loop named ranges + $namedRanges = $pPHPExcel->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + $this->_writeDefinedNameForNamedRange($objWriter, $namedRange); + } + } + + /** + * Write Defined Name for autoFilter + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_NamedRange $pNamedRange + * @throws Exception + */ + private function _writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) + { + // definedName for named range + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', $pNamedRange->getName()); + if ($pNamedRange->getLocalOnly()) { + $objWriter->writeAttribute('localSheetId', $pNamedRange->getWorksheet()->getParent()->getIndex($pNamedRange->getWorksheet())); + } + + // Create absolute coordinate and write as raw text + $range = PHPExcel_Cell::splitRange($pNamedRange->getRange()); + for ($i = 0; $i < count($range); $i++) { + $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]); + if (isset($range[$i][1])) { + $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]); + } + } + $range = PHPExcel_Cell::buildRange($range); + + $objWriter->writeRaw($range); + + $objWriter->endElement(); + } + + /** + * Write Defined Name for autoFilter + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet + * @param int $pSheetId + * @throws Exception + */ + private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + { + // definedName for autoFilter + if ($pSheet->getAutoFilter() != '') { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm._FilterDatabase'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + $objWriter->writeAttribute('hidden', '1'); + + // Create absolute coordinate and write as raw text + $range = PHPExcel_Cell::splitRange($pSheet->getAutoFilter()); + $range = $range[0]; + $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]); + $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]); + $range = implode(':', $range); + + $objWriter->writeRaw('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range); + + $objWriter->endElement(); + } + } + + /** + * Write Defined Name for PrintTitles + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet + * @param int $pSheetId + * @throws Exception + */ + private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + { + // definedName for PrintTitles + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm.Print_Titles'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + + // Setting string + $settingString = ''; + + // Columns to repeat + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft(); + + $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; + } + + // Rows to repeat + if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $settingString .= ','; + } + + $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop(); + + $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; + } + + $objWriter->writeRaw($settingString); + + $objWriter->endElement(); + } + } + + /** + * Write Defined Name for PrintTitles + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet + * @param int $pSheetId + * @throws Exception + */ + private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) + { + // definedName for PrintArea + if ($pSheet->getPageSetup()->isPrintAreaSet()) { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm.Print_Area'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + + // Setting string + $settingString = ''; + + // Print area + $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); + $printArea = $printArea[0]; + $printArea[0] = PHPExcel_Cell::absoluteCoordinate($printArea[0]); + $printArea[1] = PHPExcel_Cell::absoluteCoordinate($printArea[1]); + + $objWriter->writeRaw('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printArea)); + + $objWriter->endElement(); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Worksheet.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Worksheet.php new file mode 100644 index 000000000..45296cbfc --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/Worksheet.php @@ -0,0 +1,1111 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Writer_Excel2007 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007.php'; + +/** PHPExcel_Writer_Excel2007_WriterPart */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/WriterPart.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Style_Conditional */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Conditional.php'; + +/** PHPExcel_Style_NumberFormat */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php'; + +/** PHPExcel_Shared_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Font.php'; + +/** PHPExcel_Shared_Date */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Date.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Shared_XMLWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_Worksheet + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Write worksheet to XML format + * + * @param PHPExcel_Worksheet $pSheet + * @param string[] $pStringTable + * @return string XML Output + * @throws Exception + */ + public function writeWorksheet($pSheet = null, $pStringTable = null) + { + if (!is_null($pSheet)) { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Worksheet + $objWriter->startElement('worksheet'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + // sheetPr + $this->_writeSheetPr($objWriter, $pSheet); + + // Dimension + $this->_writeDimension($objWriter, $pSheet); + + // sheetViews + $this->_writeSheetViews($objWriter, $pSheet); + + // sheetFormatPr + $this->_writeSheetFormatPr($objWriter, $pSheet); + + // cols + $this->_writeCols($objWriter, $pSheet); + + // sheetData + $this->_writeSheetData($objWriter, $pSheet, $pStringTable); + + // sheetProtection + $this->_writeSheetProtection($objWriter, $pSheet); + + // protectedRanges + $this->_writeProtectedRanges($objWriter, $pSheet); + + // autoFilter + $this->_writeAutoFilter($objWriter, $pSheet); + + // mergeCells + $this->_writeMergeCells($objWriter, $pSheet); + + // conditionalFormatting + $this->_writeConditionalFormatting($objWriter, $pSheet); + + // dataValidations + $this->_writeDataValidations($objWriter, $pSheet); + + // hyperlinks + $this->_writeHyperlinks($objWriter, $pSheet); + + // Print options + $this->_writePrintOptions($objWriter, $pSheet); + + // Page margins + $this->_writePageMargins($objWriter, $pSheet); + + // Page setup + $this->_writePageSetup($objWriter, $pSheet); + + // Header / footer + $this->_writeHeaderFooter($objWriter, $pSheet); + + // Breaks + $this->_writeBreaks($objWriter, $pSheet); + + // Drawings + $this->_writeDrawings($objWriter, $pSheet); + + // LegacyDrawing + $this->_writeLegacyDrawing($objWriter, $pSheet); + + // LegacyDrawingHF + $this->_writeLegacyDrawingHF($objWriter, $pSheet); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } else { + throw new Exception("Invalid PHPExcel_Worksheet object passed."); + } + } + + /** + * Write SheetPr + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // sheetPr + $objWriter->startElement('sheetPr'); + //$objWriter->writeAttribute('codeName', $pSheet->getTitle()); + + // outlinePr + $objWriter->startElement('outlinePr'); + $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0')); + $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0')); + $objWriter->endElement(); + + // pageSetUpPr + if (!is_null($pSheet->getPageSetup()->getFitToHeight()) || !is_null($pSheet->getPageSetup()->getFitToWidth())) { + $objWriter->startElement('pageSetUpPr'); + $objWriter->writeAttribute('fitToPage', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Dimension + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // dimension + $objWriter->startElement('dimension'); + $objWriter->writeAttribute('ref', $pSheet->calculateWorksheetDimension()); + $objWriter->endElement(); + } + + /** + * Write SheetViews + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // sheetViews + $objWriter->startElement('sheetViews'); + + // Sheet selected? + $sheetSelected = false; + if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) + $sheetSelected = true; + + + // sheetView + $objWriter->startElement('sheetView'); + $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0'); + $objWriter->writeAttribute('workbookViewId', '0'); + + // Zoom scales + if ($pSheet->getSheetView()->getZoomScale() != 100) { + $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale()); + } + if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) { + $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); + } + + // Gridlines + if ($pSheet->getShowGridlines()) { + $objWriter->writeAttribute('showGridLines', 'true'); + } else { + $objWriter->writeAttribute('showGridLines', 'false'); + } + + // Right-to-left + if ($pSheet->getRightToLeft()) { + $objWriter->writeAttribute('rightToLeft', 'true'); + } + + // Pane + if ($pSheet->getFreezePane() != '') { + // Calculate freeze coordinates + $xSplit = 0; + $ySplit = 0; + $topLeftCell = $pSheet->getFreezePane(); + + list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($pSheet->getFreezePane()); + $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit); + + // pane + $objWriter->startElement('pane'); + $objWriter->writeAttribute('xSplit', $xSplit - 1); + $objWriter->writeAttribute('ySplit', $ySplit - 1); + $objWriter->writeAttribute('topLeftCell', $topLeftCell); + $objWriter->writeAttribute('activePane', 'bottomRight'); + $objWriter->writeAttribute('state', 'frozen'); + $objWriter->endElement(); + } + + // Selection + $objWriter->startElement('selection'); + $objWriter->writeAttribute('activeCell', $pSheet->getSelectedCell()); + $objWriter->writeAttribute('sqref', $pSheet->getSelectedCell()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write SheetFormatPr + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // sheetFormatPr + $objWriter->startElement('sheetFormatPr'); + + // Default row height + if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { + $objWriter->writeAttribute('customHeight', 'true'); + $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); + } else { + $objWriter->writeAttribute('defaultRowHeight', '12.75'); + } + + // Default column width + if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { + $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); + } + + // Outline level - row + $outlineLevelRow = 0; + foreach ($pSheet->getRowDimensions() as $dimension) { + if ($dimension->getOutlineLevel() > $outlineLevelRow) { + $outlineLevelRow = $dimension->getOutlineLevel(); + } + } + $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow); + + // Outline level - column + $outlineLevelCol = 0; + foreach ($pSheet->getColumnDimensions() as $dimension) { + if ($dimension->getOutlineLevel() > $outlineLevelCol) { + $outlineLevelCol = $dimension->getOutlineLevel(); + } + } + $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol); + + $objWriter->endElement(); + } + + /** + * Write Cols + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // cols + $objWriter->startElement('cols'); + + // Check if there is at least one column dimension specified. If not, create one. + if (count($pSheet->getColumnDimensions()) == 0) { + if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { + $pSheet->getColumnDimension('A')->setWidth($pSheet->getDefaultColumnDimension()->getWidth()); + } else { + $pSheet->getColumnDimension('A')->setWidth(9.10); + } + } + + $pSheet->calculateColumnWidths(); + + // Loop trough column dimensions + foreach ($pSheet->getColumnDimensions() as $colDimension) { + // col + $objWriter->startElement('col'); + $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); + + if ($colDimension->getWidth() < 0) { + // No width set, apply default of 10 + $objWriter->writeAttribute('width', '9.10'); + } else { + // Width set + $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth())); + } + + // Column visibility + if ($colDimension->getVisible() == false) { + $objWriter->writeAttribute('hidden', 'true'); + } + + // Auto size? + if ($colDimension->getAutoSize()) { + $objWriter->writeAttribute('bestFit', 'true'); + } + + // Custom width? + if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) { + $objWriter->writeAttribute('customWidth', 'true'); + } + + // Collapsed + if ($colDimension->getCollapsed() == true) { + $objWriter->writeAttribute('collapsed', 'true'); + } + + // Outline level + if ($colDimension->getOutlineLevel() > 0) { + $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel()); + } + + // Style + $objWriter->writeAttribute('style', 0); + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write SheetProtection + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // sheetProtection + $objWriter->startElement('sheetProtection'); + + if ($pSheet->getProtection()->getPassword() != '') { + $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword()); + } + + $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false')); + $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false')); + $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false')); + $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false')); + $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false')); + $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false')); + $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false')); + $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false')); + $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false')); + $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false')); + $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false')); + $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false')); + $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false')); + $objWriter->endElement(); + } + + /** + * Write ConditionalFormatting + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // Conditional id + $id = 1; + + // Loop trough styles in the current worksheet + foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + // WHY was this again? + // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ) == '') { + // continue; + // } + + if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) { + // conditionalFormatting + $objWriter->startElement('conditionalFormatting'); + $objWriter->writeAttribute('sqref', $cellCoordinate); + + // cfRule + $objWriter->startElement('cfRule'); + $objWriter->writeAttribute('type', $conditional->getConditionType()); + $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() )); + $objWriter->writeAttribute('priority', $id++); + + if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS + || + $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) + && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) { + $objWriter->writeAttribute('operator', $conditional->getOperatorType()); + } + + if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT + && !is_null($conditional->getText())) { + $objWriter->writeAttribute('text', $conditional->getText()); + } + + if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { + foreach ($conditional->getConditions() as $formula) { + // Formula + $objWriter->writeElement('formula', $formula); + } + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + } + } + + /** + * Write DataValidations + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // Build a temporary array of datavalidation objects + $aDataValidations = array(); + foreach ($pSheet->getCellCollection() as $cell) { + if ($cell->hasDataValidation()) { + $aDataValidations[] = $cell->getDataValidation(); + } + } + + // Write data validations? + if (count($aDataValidations) > 0) { + $objWriter->startElement('dataValidations'); + $objWriter->writeAttribute('count', count($aDataValidations)); + + foreach ($aDataValidations as $dv) { + $objWriter->startElement('dataValidation'); + + if ($dv->getType() != '') { + $objWriter->writeAttribute('type', $dv->getType()); + } + + if ($dv->getErrorStyle() != '') { + $objWriter->writeAttribute('errorStyle', $dv->getErrorStyle()); + } + + if ($dv->getOperator() != '') { + $objWriter->writeAttribute('operator', $dv->getOperator()); + } + + $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); + $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0')); + $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); + $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); + + if ($dv->getErrorTitle() !== '') { + $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle()); + } + if ($dv->getError() !== '') { + $objWriter->writeAttribute('error', $dv->getError()); + } + if ($dv->getPromptTitle() !== '') { + $objWriter->writeAttribute('promptTitle', $dv->getPromptTitle()); + } + if ($dv->getPrompt() !== '') { + $objWriter->writeAttribute('prompt', $dv->getPrompt()); + } + + $objWriter->writeAttribute('sqref', $dv->getParent()->getCoordinate()); + + if ($dv->getFormula1() !== '') { + $objWriter->writeElement('formula1', $dv->getFormula1()); + } + if ($dv->getFormula2() !== '') { + $objWriter->writeElement('formula2', $dv->getFormula2()); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write Hyperlinks + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // Build a temporary array of hyperlink objects + $aHyperlinks = array(); + foreach ($pSheet->getCellCollection() as $cell) { + if ($cell->hasHyperlink()) { + $aHyperlinks[] = $cell->getHyperlink(); + } + } + + // Relation ID + $relationId = 1; + + // Write hyperlinks? + if (count($aHyperlinks) > 0) { + $objWriter->startElement('hyperlinks'); + + foreach ($aHyperlinks as $hyperlink) { + $objWriter->startElement('hyperlink'); + + $objWriter->writeAttribute('ref', $hyperlink->getParent()->getCoordinate()); + if (!$hyperlink->isInternal()) { + $objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId); + ++$relationId; + } else { + $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl())); + } + + if ($hyperlink->getTooltip() != '') { + $objWriter->writeAttribute('tooltip', $hyperlink->getTooltip()); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write ProtectedRanges + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + if (count($pSheet->getProtectedCells()) > 0) { + // protectedRanges + $objWriter->startElement('protectedRanges'); + + // Loop protectedRanges + foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) { + // protectedRange + $objWriter->startElement('protectedRange'); + $objWriter->writeAttribute('name', 'p' . md5($protectedCell)); + $objWriter->writeAttribute('sqref', $protectedCell); + $objWriter->writeAttribute('password', $passwordHash); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write MergeCells + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + if (count($pSheet->getMergeCells()) > 0) { + // mergeCells + $objWriter->startElement('mergeCells'); + + // Loop mergeCells + foreach ($pSheet->getMergeCells() as $mergeCell) { + // mergeCell + $objWriter->startElement('mergeCell'); + $objWriter->writeAttribute('ref', $mergeCell); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write PrintOptions + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // printOptions + $objWriter->startElement('printOptions'); + + $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false')); + $objWriter->writeAttribute('gridLinesSet', 'true'); + + if ($pSheet->getPageSetup()->getHorizontalCentered()) { + $objWriter->writeAttribute('horizontalCentered', 'true'); + } + + if ($pSheet->getPageSetup()->getVerticalCentered()) { + $objWriter->writeAttribute('verticalCentered', 'true'); + } + + $objWriter->endElement(); + } + + /** + * Write PageMargins + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // pageMargins + $objWriter->startElement('pageMargins'); + $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); + $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); + $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); + $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); + $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); + $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); + $objWriter->endElement(); + } + + /** + * Write AutoFilter + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + if ($pSheet->getAutoFilter() != '') { + // autoFilter + $objWriter->startElement('autoFilter'); + $objWriter->writeAttribute('ref', $pSheet->getAutoFilter()); + $objWriter->endElement(); + } + } + + /** + * Write PageSetup + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // pageSetup + $objWriter->startElement('pageSetup'); + $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize()); + $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation()); + + if (!is_null($pSheet->getPageSetup()->getScale())) { + $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale()); + } + if (!is_null($pSheet->getPageSetup()->getFitToHeight())) { + $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight()); + } else { + $objWriter->writeAttribute('fitToHeight', '0'); + } + if (!is_null($pSheet->getPageSetup()->getFitToWidth())) { + $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth()); + } else { + $objWriter->writeAttribute('fitToWidth', '0'); + } + + $objWriter->endElement(); + } + + /** + * Write Header / Footer + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // headerFooter + $objWriter->startElement('headerFooter'); + $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false')); + $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false')); + $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false')); + $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false')); + + $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader()); + $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter()); + $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader()); + $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter()); + $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader()); + $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter()); + $objWriter->endElement(); + } + + /** + * Write Breaks + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // Get row and column breaks + $aRowBreaks = array(); + $aColumnBreaks = array(); + foreach ($pSheet->getBreaks() as $cell => $breakType) { + if ($breakType == PHPExcel_Worksheet::BREAK_ROW) { + $aRowBreaks[] = $cell; + } else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { + $aColumnBreaks[] = $cell; + } + } + + // rowBreaks + if (count($aRowBreaks) > 0) { + $objWriter->startElement('rowBreaks'); + $objWriter->writeAttribute('count', count($aRowBreaks)); + $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); + + foreach ($aRowBreaks as $cell) { + $coords = PHPExcel_Cell::coordinateFromString($cell); + + $objWriter->startElement('brk'); + $objWriter->writeAttribute('id', $coords[1]); + $objWriter->writeAttribute('man', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + // Second, write column breaks + if (count($aColumnBreaks) > 0) { + $objWriter->startElement('colBreaks'); + $objWriter->writeAttribute('count', count($aColumnBreaks)); + $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); + + foreach ($aColumnBreaks as $cell) { + $coords = PHPExcel_Cell::coordinateFromString($cell); + + $objWriter->startElement('brk'); + $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1); + $objWriter->writeAttribute('man', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write SheetData + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @param string[] $pStringTable String table + * @throws Exception + */ + private function _writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null) + { + if (is_array($pStringTable)) { + // Flipped stringtable, for faster index searching + $aFlippedStringTable = $this->getParentWriter()->getWriterPart('stringtable')->flipStringTable($pStringTable); + + // sheetData + $objWriter->startElement('sheetData'); + + // Get column count + $colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()); + + // Highest row number + $highestRow = $pSheet->getHighestRow(); + + // Loop trough cells + $cellCollection = $pSheet->getCellCollection(); + + $cellsByRow = array(); + foreach ($cellCollection as $cell) { + $cellsByRow[$cell->getRow()][] = $cell; + } + + for ($currentRow = 1; $currentRow <= $highestRow; ++$currentRow) { + // Get row dimension + $rowDimension = $pSheet->getRowDimension($currentRow); + + // Write current row? + $writeCurrentRow = isset($cellsByRow[$currentRow]) || + $rowDimension->getRowHeight() >= 0 || + $rowDimension->getVisible() == false || + $rowDimension->getCollapsed() == true || + $rowDimension->getOutlineLevel() > 0; + + if ($writeCurrentRow) { + // Start a new row + $objWriter->startElement('row'); + $objWriter->writeAttribute('r', $currentRow); + $objWriter->writeAttribute('spans', '1:' . $colCount); + + // Row dimensions + if ($rowDimension->getRowHeight() >= 0) { + $objWriter->writeAttribute('customHeight', '1'); + $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight())); + } + + // Row visibility + if ($rowDimension->getVisible() == false) { + $objWriter->writeAttribute('hidden', 'true'); + } + + // Collapsed + if ($rowDimension->getCollapsed() == true) { + $objWriter->writeAttribute('collapsed', 'true'); + } + + // Outline level + if ($rowDimension->getOutlineLevel() > 0) { + $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel()); + } + + // Write cells + if (isset($cellsByRow[$currentRow])) { + foreach($cellsByRow[$currentRow] as $cell) { + // Write cell + $this->_writeCell($objWriter, $pSheet, $cell, $pStringTable, $aFlippedStringTable); + } + } + + // End row + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Write Cell + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @param PHPExcel_Cell $pCell Cell + * @param string[] $pStringTable String table + * @param string[] $pFlippedStringTable String table (flipped), for faster index searching + * @throws Exception + */ + private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, PHPExcel_Cell $pCell = null, $pStringTable = null, $pFlippedStringTable = null) + { + if (is_array($pStringTable) && is_array($pFlippedStringTable)) { + // Cell + $objWriter->startElement('c'); + $objWriter->writeAttribute('r', $pCell->getCoordinate()); + + // Sheet styles + if ($pCell->getXfIndex() != '') { + $objWriter->writeAttribute('s', $pCell->getXfIndex()); + } + + // If cell value is supplied, write cell value + if (is_object($pCell->getValue()) || $pCell->getValue() !== '') { + // Map type + $mappedType = $pCell->getDataType(); + + // Write data type depending on its type + switch (strtolower($mappedType)) { + case 'inlinestr': // Inline string + $objWriter->writeAttribute('t', $mappedType); + break; + case 's': // String + $objWriter->writeAttribute('t', $mappedType); + break; + case 'b': // Boolean + $objWriter->writeAttribute('t', $mappedType); + break; + case 'f': // Formula + $calculatedValue = null; + if ($this->getParentWriter()->getPreCalculateFormulas()) { + $calculatedValue = $pCell->getCalculatedValue(); + } else { + $calculatedValue = $pCell->getValue(); + } + if (is_string($calculatedValue)) { + $objWriter->writeAttribute('t', 'str'); + } + break; + case 'e': // Error + $objWriter->writeAttribute('t', $mappedType); + } + + // Write data depending on its type + switch (strtolower($mappedType)) { + case 'inlinestr': // Inline string + if (! $pCell->getValue() instanceof PHPExcel_RichText) { + $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($pCell->getValue()) ) ); + } else if ($pCell->getValue() instanceof PHPExcel_RichText) { + $objWriter->startElement('is'); + $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pCell->getValue()); + $objWriter->endElement(); + } + + break; + case 's': // String + if (! $pCell->getValue() instanceof PHPExcel_RichText) { + if (isset($pFlippedStringTable[$pCell->getValue()])) { + $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()]); + } + } else if ($pCell->getValue() instanceof PHPExcel_RichText) { + $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()->getHashCode()]); + } + + break; + case 'f': // Formula + $objWriter->writeElement('f', substr($pCell->getValue(), 1)); + if ($this->getParentWriter()->getOffice2003Compatibility() === false) { + if ($this->getParentWriter()->getPreCalculateFormulas()) { + $calculatedValue = $pCell->getCalculatedValue(); + if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { + $v = PHPExcel_Shared_String::FormatNumber($calculatedValue); + $objWriter->writeElement('v', $v); + } else { + $objWriter->writeElement('v', '0'); + } + } else { + $objWriter->writeElement('v', '0'); + } + } + break; + case 'n': // Numeric + // force point as decimal separator in case current locale uses comma + $v = str_replace(',', '.', $pCell->getValue()); + $objWriter->writeElement('v', $v); + break; + case 'b': // Boolean + $objWriter->writeElement('v', ($pCell->getValue() ? '1' : '0')); + break; + case 'e': // Error + if (substr($pCell->getValue(), 0, 1) == '=') { + $objWriter->writeElement('f', substr($pCell->getValue(), 1)); + $objWriter->writeElement('v', substr($pCell->getValue(), 1)); + } else { + $objWriter->writeElement('v', $pCell->getValue()); + } + + break; + } + } + + $objWriter->endElement(); + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Write Drawings + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // If sheet contains drawings, add the relationships + if ($pSheet->getDrawingCollection()->count() > 0) { + $objWriter->startElement('drawing'); + $objWriter->writeAttribute('r:id', 'rId1'); + $objWriter->endElement(); + } + } + + /** + * Write LegacyDrawing + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // If sheet contains comments, add the relationships + if (count($pSheet->getComments()) > 0) { + $objWriter->startElement('legacyDrawing'); + $objWriter->writeAttribute('r:id', 'rId_comments_vml1'); + $objWriter->endElement(); + } + } + + /** + * Write LegacyDrawingHF + * + * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param PHPExcel_Worksheet $pSheet Worksheet + * @throws Exception + */ + private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + { + // If sheet contains comments, add the relationships + if (count($pSheet->getHeaderFooter()->getImages()) > 0) { + $objWriter->startElement('legacyDrawingHF'); + $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1'); + $objWriter->endElement(); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel2007/WriterPart.php b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/WriterPart.php new file mode 100644 index 000000000..473a813da --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel2007/WriterPart.php @@ -0,0 +1,80 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + + +/** + * PHPExcel_Writer_Excel2007_WriterPart + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel2007 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +abstract class PHPExcel_Writer_Excel2007_WriterPart +{ + /** + * Parent IWriter object + * + * @var PHPExcel_Writer_IWriter + */ + private $_parentWriter; + + /** + * Set parent IWriter object + * + * @param PHPExcel_Writer_IWriter $pWriter + * @throws Exception + */ + public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) { + $this->_parentWriter = $pWriter; + } + + /** + * Get parent IWriter object + * + * @return PHPExcel_Writer_IWriter + * @throws Exception + */ + public function getParentWriter() { + if (!is_null($this->_parentWriter)) { + return $this->_parentWriter; + } else { + throw new Exception("No parent PHPExcel_Writer_IWriter assigned."); + } + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5.php new file mode 100644 index 000000000..abc9c655b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5.php @@ -0,0 +1,251 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_HashTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/HashTable.php'; + +/** PHPExcel_Shared_OLE_PPS_Root */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_Root.php'; + +/** PHPExcel_Shared_OLE_PPS_File */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_File.php'; + +/** PHPExcel_Writer_Excel5_Parser */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Parser.php'; + +/** PHPExcel_Writer_Excel5_Workbook */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Workbook.php'; + + +/** + * PHPExcel_Writer_Excel5 + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter +{ + /** + * PHPExcel object + * + * @var PHPExcel + */ + private $_phpExcel; + + /** + * The BIFF version of the written Excel file, BIFF5 = 0x0500, BIFF8 = 0x0600 + * + * @var integer + */ + private $_BIFF_version; + + /** + * Temporary storage directory + * + * @var string + */ + private $_tempDir = ''; + + /** + * Total number of shared strings in workbook + * + * @var int + */ + private $_str_total; + + /** + * Number of unique shared strings in workbook + * + * @var int + */ + private $_str_unique; + + /** + * Array of unique shared strings in workbook + * + * @var array + */ + private $_str_table; + + /** + * Formula parser + * + * @var PHPExcel_Writer_Excel5_Parser + */ + private $_parser; + + + /** + * Create a new PHPExcel_Writer_Excel5 + * + * @param PHPExcel $phpExcel PHPExcel object + */ + public function __construct(PHPExcel $phpExcel) { + $this->_phpExcel = $phpExcel; + $this->_BIFF_version = 0x0600; + $this->_tempDir = ''; + + $this->_str_total = 0; + $this->_str_unique = 0; + $this->_str_table = array(); + $this->_parser = new PHPExcel_Writer_Excel5_Parser($this->_BIFF_version); + + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) { + + // check mbstring.func_overload + if (ini_get('mbstring.func_overload') != 0) { + throw new Exception('Multibyte string function overloading in PHP must be disabled.'); + } + + // garbage collect + $this->_phpExcel->garbageCollect(); + + $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); + PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + + // Initialise workbook writer + $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_BIFF_version, + $this->_str_total, $this->_str_unique, $this->_str_table, $this->_parser, $this->_tempDir); + + // Initialise worksheet writers + $countSheets = count($this->_phpExcel->getAllSheets()); + for ($i = 0; $i < $countSheets; ++$i) { + $phpSheet = $this->_phpExcel->getSheet($i); + + $writerWorksheet = new PHPExcel_Writer_Excel5_Worksheet($this->_BIFF_version, + $this->_str_total, $this->_str_unique, + $this->_str_table, + $this->_parser, $this->_tempDir, + $phpSheet); + $this->_writerWorksheets[$i] = $writerWorksheet; + } + + // add 15 identical cell style Xfs + // for now, we use the first cellXf instead of cellStyleXf + $cellXfCollection = $this->_phpExcel->getCellXfCollection(); + for ($i = 0; $i < 15; ++$i) { + $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true); + } + + // add all the cell Xfs + foreach ($this->_phpExcel->getCellXfCollection() as $style) { + $this->_writerWorkbook->addXfWriter($style, false); + } + + // initialize OLE file + $workbookStreamName = ($this->_BIFF_version == 0x0600) ? 'Workbook' : 'Book'; + $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName)); + + if ($this->_tempDir != '') { + $OLE->setTempDir($this->_tempDir); + } + $res = $OLE->init(); + + // Write the worksheet streams before the global workbook stream, + // because the byte sizes of these are needed in the global workbook stream + $worksheetSizes = array(); + for ($i = 0; $i < $countSheets; ++$i) { + $this->_writerWorksheets[$i]->close(); + $worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize; + } + + // add binary data for global workbook stream + $OLE->append( $this->_writerWorkbook->writeWorkbook($worksheetSizes) ); + + // add binary data for sheet streams + for ($i = 0; $i < $countSheets; ++$i) { + while ( ($tmp = $this->_writerWorksheets[$i]->getData()) !== false ) { + $OLE->append($tmp); + } + } + + $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), array($OLE)); + if ($this->_tempDir != '') { + $root->setTempDir($this->_tempDir); + } + + // save the OLE file + $res = $root->save($pFilename); + + PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); + + // clean up + foreach ($this->_writerWorksheets as $sheet) { + $sheet->cleanup(); + } + } + + /** + * Get temporary storage directory + * + * @return string + */ + public function getTempDir() { + return $this->_tempDir; + } + + /** + * Set temporary storage directory + * + * @param string $pValue Temporary storage directory + * @throws Exception Exception when directory does not exist + * @return PHPExcel_Writer_Excel5 + */ + public function setTempDir($pValue = '') { + if (is_dir($pValue)) { + $this->_tempDir = $pValue; + } else { + throw new Exception("Directory does not exist: $pValue"); + } + return $this; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/BIFFwriter.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/BIFFwriter.php new file mode 100644 index 000000000..befcc88f6 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/BIFFwriter.php @@ -0,0 +1,270 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +// Original file header of PEAR::Spreadsheet_Excel_Writer_BIFFwriter (used as the base for this class): +// ----------------------------------------------------------------------------------------- +// * Module written/ported by Xavier Noguer <xnoguer@rezebra.com> +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * <jmcnamara@cpan.org> +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ + + +/** + * PHPExcel_Writer_Excel5_BIFFwriter + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_BIFFwriter +{ + /** + * The BIFF/Excel version (5). + * @var integer + */ + var $_BIFF_version = 0x0500; + + /** + * The byte order of this architecture. 0 => little endian, 1 => big endian + * @var integer + */ + private static $_byte_order; + + /** + * The string containing the data of the BIFF stream + * @var string + */ + var $_data; + + /** + * The size of the data in bytes. Should be the same as strlen($this->_data) + * @var integer + */ + var $_datasize; + + /** + * The maximum length for a BIFF record (excluding record header and length field). See _addContinue() + * @var integer + * @see _addContinue() + */ + var $_limit; + + /** + * Constructor + */ + public function __construct() + { + $this->_data = ''; + $this->_datasize = 0; + $this->_limit = 2080; + } + + /** + * Determine the byte order and store it as class data to avoid + * recalculating it for each call to new(). + * + * @return int + */ + public static function getByteOrder() + { + if (!isset(self::$_byte_order)) { + // Check if "pack" gives the required IEEE 64bit float + $teststr = pack("d", 1.2345); + $number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F); + if ($number == $teststr) { + $byte_order = 0; // Little Endian + } elseif ($number == strrev($teststr)){ + $byte_order = 1; // Big Endian + } else { + // Give up. I'll fix this in a later version. + throw new Exception("Required floating point format ". + "not supported on this platform."); + } + self::$_byte_order = $byte_order; + } + + return self::$_byte_order; + } + + /** + * General storage function + * + * @param string $data binary data to append + * @access private + */ + function _append($data) + { + if (strlen($data) - 4 > $this->_limit) { + $data = $this->_addContinue($data); + } + $this->_data = $this->_data.$data; + $this->_datasize += strlen($data); + } + + /** + * General storage function like _append, but returns string instead of modifying $this->_data + * + * @param string $data binary data to write + * @return string + */ + public function writeData($data) + { + if (strlen($data) - 4 > $this->_limit) { + $data = $this->_addContinue($data); + } + $this->_datasize += strlen($data); + + return $data; + } + + /** + * Writes Excel BOF record to indicate the beginning of a stream or + * sub-stream in the BIFF file. + * + * @param integer $type Type of BIFF file to write: 0x0005 Workbook, + * 0x0010 Worksheet. + * @access private + */ + function _storeBof($type) + { + $record = 0x0809; // Record identifier + + // According to the SDK $build and $year should be set to zero. + // However, this throws a warning in Excel 5. So, use magic numbers. + if ($this->_BIFF_version == 0x0500) { + $length = 0x0008; + $unknown = ''; + $build = 0x096C; + $year = 0x07C9; + } elseif ($this->_BIFF_version == 0x0600) { + $length = 0x0010; + + // by inspection of real files, MS Office Excel 2007 writes the following + $unknown = pack("VV", 0x000100D1, 0x00000406); + + $build = 0x0DBB; + $year = 0x07CC; + } + $version = $this->_BIFF_version; + + $header = pack("vv", $record, $length); + $data = pack("vvvv", $version, $type, $build, $year); + $this->_append($header . $data . $unknown); + } + + /** + * Writes Excel EOF record to indicate the end of a BIFF stream. + * + * @access private + */ + function _storeEof() + { + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow + $header = pack("vv", $record, $length); + $this->_append($header); + } + + /** + * Writes Excel EOF record to indicate the end of a BIFF stream. + * + * @access private + */ + public function writeEof() + { + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow + $header = pack("vv", $record, $length); + return $this->writeData($header); + } + + /** + * Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In + * Excel 97 the limit is 8228 bytes. Records that are longer than these limits + * must be split up into CONTINUE blocks. + * + * This function takes a long BIFF record and inserts CONTINUE records as + * necessary. + * + * @param string $data The original binary data to be written + * @return string A very convenient string of continue blocks + * @access private + */ + function _addContinue($data) + { + $limit = $this->_limit; + $record = 0x003C; // Record identifier + + // The first 2080/8224 bytes remain intact. However, we have to change + // the length field of the record. + $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit); + + $header = pack("vv", $record, $limit); // Headers for continue records + + // Retrieve chunks of 2080/8224 bytes +4 for the header. + $data_length = strlen($data); + for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) { + $tmp .= $header; + $tmp .= substr($data, $i, $limit); + } + + // Retrieve the last chunk of data + $header = pack("vv", $record, strlen($data) - $i); + $tmp .= $header; + $tmp .= substr($data, $i, strlen($data) - $i); + + return $tmp; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Escher.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Escher.php new file mode 100644 index 000000000..b2d8d074b --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Escher.php @@ -0,0 +1,509 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Shared_Escher_DggContainer_BstoreContainer + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Escher +{ + /** + * The object we are writing + */ + private $_object; + + /** + * The written binary data + */ + private $_data; + + /** + * Shape offsets. Positions in binary stream where a new shape record begins + * + * @var array + */ + private $_spOffsets; + + + /** + * Constructor + * + * @param mixed + */ + public function __construct($object) + { + $this->_object = $object; + } + + /** + * Process the object to be written + */ + public function close() + { + // initialize + $this->_data = ''; + + switch (get_class($this->_object)) { + + case 'PHPExcel_Shared_Escher': + if ($dggContainer = $this->_object->getDggContainer()) { + $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer); + $this->_data = $writer->close(); + } else if ($dgContainer = $this->_object->getDgContainer()) { + $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer); + $this->_data = $writer->close(); + $this->_spOffsets = $writer->getSpOffsets(); + } + break; + + case 'PHPExcel_Shared_Escher_DggContainer': + // this is a container record + + // initialize + $innerData = ''; + + // write the dgg + $recVer = 0x0; + $recInstance = 0x0000; + $recType = 0xF006; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + // dgg data + $dggData = + pack('VVVV' + , $this->_object->getSpIdMax() // maximum shape identifier increased by one + , $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one + , $this->_object->getCSpSaved() + , $this->_object->getCDgSaved() // count total number of drawings saved + ); + // add file identifier clusters (one per drawing) + for ($i = 0; $i < $this->_object->getCDgSaved(); ++$i) { + $dggData .= pack('VV', 0, 0); + } + + $header = pack('vvV', $recVerInstance, $recType, strlen($dggData)); + $innerData .= $header . $dggData; + + // write the bstoreContainer + if ($bstoreContainer = $this->_object->getBstoreContainer()) { + $writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer); + $innerData .= $writer->close(); + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF000; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header . $innerData; + break; + + case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer': + // this is a container record + + // initialize + $innerData = ''; + + // treat the inner data + if ($BSECollection = $this->_object->getBSECollection()) { + foreach ($BSECollection as $BSE) { + $writer = new PHPExcel_Writer_Excel5_Escher($BSE); + $innerData .= $writer->close(); + } + } + + // write the record + $recVer = 0xF; + $recInstance = count($this->_object->getBSECollection()); + $recType = 0xF001; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header . $innerData; + break; + + case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE': + // this is a semi-container record + + // initialize + $innerData = ''; + + // here we treat the inner data + if ($blip = $this->_object->getBlip()) { + $writer = new PHPExcel_Writer_Excel5_Escher($blip); + $innerData .= $writer->close(); + } + + // initialize + $data = ''; + + $btWin32 = $this->_object->getBlipType(); + $btMacOS = $this->_object->getBlipType(); + $data .= pack('CC', $btWin32, $btMacOS); + + $rgbUid = pack('VVVV', 0,0,0,0); // todo + $data .= $rgbUid; + + $tag = 0; + $size = strlen($innerData); + $cRef = 1; + $foDelay = 0; //todo + $unused1 = 0x0; + $cbName = 0x0; + $unused2 = 0x0; + $unused3 = 0x0; + $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3); + + $data .= $innerData; + + // write the record + $recVer = 0x2; + $recInstance = $this->_object->getBlipType(); + $recType = 0xF007; + $length = strlen($data); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header; + + $this->_data .= $data; + break; + + case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip': + // this is an atom record + + // write the record + switch ($this->_object->getParent()->getBlipType()) { + + case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: + // initialize + $innerData = ''; + + $rgbUid1 = pack('VVVV', 0,0,0,0); // todo + $innerData .= $rgbUid1; + + $tag = 0xFF; // todo + $innerData .= pack('C', $tag); + + $innerData .= $this->_object->getData(); + + $recVer = 0x0; + $recInstance = 0x46A; + $recType = 0xF01D; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header; + + $this->_data .= $innerData; + break; + + case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG: + // initialize + $innerData = ''; + + $rgbUid1 = pack('VVVV', 0,0,0,0); // todo + $innerData .= $rgbUid1; + + $tag = 0xFF; // todo + $innerData .= pack('C', $tag); + + $innerData .= $this->_object->getData(); + + $recVer = 0x0; + $recInstance = 0x6E0; + $recType = 0xF01E; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header; + + $this->_data .= $innerData; + break; + + } + break; + + case 'PHPExcel_Shared_Escher_DgContainer': + // this is a container record + + // initialize + $innerData = ''; + + // write the dg + $recVer = 0x0; + $recInstance = $this->_object->getDgId(); + $recType = 0xF008; + $length = 8; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + // number of shapes in this drawing (including group shape) + $countShapes = count($this->_object->getSpgrContainer()->getChildren()); + $innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId()); + //$innerData .= $header . pack('VV', 0, 0); + + // write the spgrContainer + if ($spgrContainer = $this->_object->getSpgrContainer()) { + $writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer); + $innerData .= $writer->close(); + + // get the shape offsets relative to the spgrContainer record + $spOffsets = $writer->getSpOffsets(); + + // save the shape offsets relative to dgContainer + foreach ($spOffsets as & $spOffset) { + $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes) + } + + $this->_spOffsets = $spOffsets; + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF002; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header . $innerData; + break; + + case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer': + // this is a container record + + // initialize + $innerData = ''; + + // initialize spape offsets + $totalSize = 8; + $spOffsets = array(); + + // treat the inner data + foreach ($this->_object->getChildren() as $spContainer) { + $writer = new PHPExcel_Writer_Excel5_Escher($spContainer); + $spData = $writer->close(); + $innerData .= $spData; + + // save the shape offsets (where new shape records begin) + $totalSize += strlen($spData); + $spOffsets[] = $totalSize; + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF003; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header . $innerData; + $this->_spOffsets = $spOffsets; + break; + + case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer': + // initialize + $data = ''; + + // build the data + + // write group shape record, if necessary? + if ($this->_object->getSpgr()) { + $recVer = 0x1; + $recInstance = 0x0000; + $recType = 0xF009; + $length = 0x00000010; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $data .= $header . pack('VVVV', 0,0,0,0); + } + + // write the shape record + $recVer = 0x2; + $recInstance = $this->_object->getSpType(); // shape type + $recType = 0xF00A; + $length = 0x00000008; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0xA000); + + + // the options + if ($this->_object->getOPTCollection()) { + $optData = ''; + + $recVer = 0x3; + $recInstance = count($this->_object->getOPTCollection()); + $recType = 0xF00B; + foreach ($this->_object->getOPTCollection() as $property => $value) { + $optData .= pack('vV', $property, $value); + } + $length = strlen($optData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $optData; + } + + // the client anchor + if ($this->_object->getStartCoordinates()) { + $clientAnchorData = ''; + + $recVer = 0x0; + $recInstance = 0x0; + $recType = 0xF010; + + // start coordinates + list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates()); + $c1 = PHPExcel_Cell::columnIndexFromString($column) - 1; + $r1 = $row - 1; + + // start offsetX + $startOffsetX = $this->_object->getStartOffsetX(); + + // start offsetY + $startOffsetY = $this->_object->getStartOffsetY(); + + // end coordinates + list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates()); + $c2 = PHPExcel_Cell::columnIndexFromString($column) - 1; + $r2 = $row - 1; + + // end offsetX + $endOffsetX = $this->_object->getEndOffsetX(); + + // end offsetY + $endOffsetY = $this->_object->getEndOffsetY(); + + $clientAnchorData = pack('vvvvvvvvv', 0x00, + $c1, $startOffsetX, $r1, $startOffsetY, + $c2, $endOffsetX, $r2, $endOffsetY); + + $length = strlen($clientAnchorData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $clientAnchorData; + } + + // the client data, just empty for now + if (!$this->_object->getSpgr()) { + $clientDataData = ''; + + $recVer = 0x0; + $recInstance = 0x0; + $recType = 0xF011; + + $length = strlen($clientDataData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $clientDataData; + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF004; + $length = strlen($data); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->_data = $header . $data; + break; + + } + + return $this->_data; + } + + /** + * Gets the shape offsets + * + * @return array + */ + public function getSpOffsets() + { + return $this->_spOffsets; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Font.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Font.php new file mode 100644 index 000000000..6f5194054 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Font.php @@ -0,0 +1,208 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_Style_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php'; + + +/** + * PHPExcel_Writer_Excel5_Font + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Font +{ + /** + * BIFF version + * + * @var int + */ + private $_BIFFVersion; + + /** + * Color index + * + * @var int + */ + private $_colorIndex; + + /** + * Font + * + * @var PHPExcel_Style_Font + */ + private $_font; + + /** + * Constructor + * + * @param PHPExcel_Style_Font $font + */ + public function __construct(PHPExcel_Style_Font $font = null) + { + $this->_BIFFVersion = 0x0600; + $this->_colorIndex = 0x7FFF; + $this->_font = $font; + } + + /** + * Set the color index + * + * @param int $colorIndex + */ + public function setColorIndex($colorIndex) + { + $this->_colorIndex = $colorIndex; + } + + /** + * Get font record data + * + * @return string + */ + public function writeFont() + { + $font_outline = 0; + $font_shadow = 0; + + $icv = $this->_colorIndex; // Index to color palette + if ($this->_font->getSuperScript()) { + $sss = 1; + } else if ($this->_font->getSubScript()) { + $sss = 2; + } else { + $sss = 0; + } + $bFamily = 0; // Font family + $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set + + $record = 0x31; // Record identifier + $reserved = 0x00; // Reserved + $grbit = 0x00; // Font attributes + if ($this->_font->getItalic()) { + $grbit |= 0x02; + } + if ($this->_font->getStrikethrough()) { + $grbit |= 0x08; + } + if ($font_outline) { + $grbit |= 0x10; + } + if ($font_shadow) { + $grbit |= 0x20; + } + + if ($this->_BIFFVersion == 0x0500) { + $data = pack("vvvvvCCCCC", + $this->_font->getSize() * 20, + $grbit, + $icv, + $this->_mapBold($this->_font->getBold()), + $sss, + $this->_mapUnderline($this->_font->getUnderline()), + $bFamily, + $bCharSet, + $reserved, + strlen($this->_font->getName()) + ); + $data .= $this->_font->getName(); + } elseif ($this->_BIFFVersion == 0x0600) { + $data = pack("vvvvvCCCC", + $this->_font->getSize() * 20, + $grbit, + $icv, + $this->_mapBold($this->_font->getBold()), + $sss, + $this->_mapUnderline($this->_font->getUnderline()), + $bFamily, + $bCharSet, + $reserved + ); + $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName()); + } + + $length = strlen($data); + $header = pack("vv", $record, $length); + + return($header . $data); + } + + /** + * Set BIFF version + * + * @param int $BIFFVersion + */ + public function setBIFFVersion($BIFFVersion) + { + $this->_BIFFVersion = $BIFFVersion; + } + + /** + * Map to BIFF5-BIFF8 codes for bold + * + * @param boolean $bold + * @return int + */ + private function _mapBold($bold) { + if ($bold) { + return 0x2BC; + } + return 0x190; + } + + /** + * Map underline + * + * @param string + * @return int + */ + private function _mapUnderline($underline) { + switch ($underline) { + case PHPExcel_Style_Font::UNDERLINE_NONE: return 0x00; + case PHPExcel_Style_Font::UNDERLINE_SINGLE: return 0x01; + case PHPExcel_Style_Font::UNDERLINE_DOUBLE: return 0x02; + case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING: return 0x21; + case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING: return 0x22; + default: return 0x00; + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Parser.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Parser.php new file mode 100644 index 000000000..b436a4f0f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Parser.php @@ -0,0 +1,1575 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +// Original file header of PEAR::Spreadsheet_Excel_Writer_Parser (used as the base for this class): +// ----------------------------------------------------------------------------------------- +// * Class for parsing Excel formulas +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_Writer_Excel5_BIFFwriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/BIFFwriter.php'; + + +/** + * PHPExcel_Writer_Excel5_Parser + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Parser +{ + /** + * The index of the character we are currently looking at + * @var integer + */ + var $_current_char; + + /** + * The token we are working on. + * @var string + */ + var $_current_token; + + /** + * The formula to parse + * @var string + */ + var $_formula; + + /** + * The character ahead of the current char + * @var string + */ + var $_lookahead; + + /** + * The parse tree to be generated + * @var string + */ + var $_parse_tree; + + /** + * Array of external sheets + * @var array + */ + var $_ext_sheets; + + /** + * Array of sheet references in the form of REF structures + * @var array + */ + var $_references; + + /** + * The BIFF version for the workbook + * @var integer + */ + var $_BIFF_version; + + /** + * The class constructor + * + * @param integer $byte_order The byte order (Little endian or Big endian) of the architecture + * (optional). 1 => big endian, 0 (default) little endian. + */ + public function __construct($biff_version) + { + $this->_current_char = 0; + $this->_BIFF_version = $biff_version; + $this->_current_token = ''; // The token we are working on. + $this->_formula = ''; // The formula to parse. + $this->_lookahead = ''; // The character ahead of the current char. + $this->_parse_tree = ''; // The parse tree to be generated. + $this->_initializeHashes(); // Initialize the hashes: ptg's and function's ptg's + $this->_ext_sheets = array(); + $this->_references = array(); + } + + /** + * Initialize the ptg and function hashes. + * + * @access private + */ + function _initializeHashes() + { + // The Excel ptg indices + $this->ptg = array( + 'ptgExp' => 0x01, + 'ptgTbl' => 0x02, + 'ptgAdd' => 0x03, + 'ptgSub' => 0x04, + 'ptgMul' => 0x05, + 'ptgDiv' => 0x06, + 'ptgPower' => 0x07, + 'ptgConcat' => 0x08, + 'ptgLT' => 0x09, + 'ptgLE' => 0x0A, + 'ptgEQ' => 0x0B, + 'ptgGE' => 0x0C, + 'ptgGT' => 0x0D, + 'ptgNE' => 0x0E, + 'ptgIsect' => 0x0F, + 'ptgUnion' => 0x10, + 'ptgRange' => 0x11, + 'ptgUplus' => 0x12, + 'ptgUminus' => 0x13, + 'ptgPercent' => 0x14, + 'ptgParen' => 0x15, + 'ptgMissArg' => 0x16, + 'ptgStr' => 0x17, + 'ptgAttr' => 0x19, + 'ptgSheet' => 0x1A, + 'ptgEndSheet' => 0x1B, + 'ptgErr' => 0x1C, + 'ptgBool' => 0x1D, + 'ptgInt' => 0x1E, + 'ptgNum' => 0x1F, + 'ptgArray' => 0x20, + 'ptgFunc' => 0x21, + 'ptgFuncVar' => 0x22, + 'ptgName' => 0x23, + 'ptgRef' => 0x24, + 'ptgArea' => 0x25, + 'ptgMemArea' => 0x26, + 'ptgMemErr' => 0x27, + 'ptgMemNoMem' => 0x28, + 'ptgMemFunc' => 0x29, + 'ptgRefErr' => 0x2A, + 'ptgAreaErr' => 0x2B, + 'ptgRefN' => 0x2C, + 'ptgAreaN' => 0x2D, + 'ptgMemAreaN' => 0x2E, + 'ptgMemNoMemN' => 0x2F, + 'ptgNameX' => 0x39, + 'ptgRef3d' => 0x3A, + 'ptgArea3d' => 0x3B, + 'ptgRefErr3d' => 0x3C, + 'ptgAreaErr3d' => 0x3D, + 'ptgArrayV' => 0x40, + 'ptgFuncV' => 0x41, + 'ptgFuncVarV' => 0x42, + 'ptgNameV' => 0x43, + 'ptgRefV' => 0x44, + 'ptgAreaV' => 0x45, + 'ptgMemAreaV' => 0x46, + 'ptgMemErrV' => 0x47, + 'ptgMemNoMemV' => 0x48, + 'ptgMemFuncV' => 0x49, + 'ptgRefErrV' => 0x4A, + 'ptgAreaErrV' => 0x4B, + 'ptgRefNV' => 0x4C, + 'ptgAreaNV' => 0x4D, + 'ptgMemAreaNV' => 0x4E, + 'ptgMemNoMemN' => 0x4F, + 'ptgFuncCEV' => 0x58, + 'ptgNameXV' => 0x59, + 'ptgRef3dV' => 0x5A, + 'ptgArea3dV' => 0x5B, + 'ptgRefErr3dV' => 0x5C, + 'ptgAreaErr3d' => 0x5D, + 'ptgArrayA' => 0x60, + 'ptgFuncA' => 0x61, + 'ptgFuncVarA' => 0x62, + 'ptgNameA' => 0x63, + 'ptgRefA' => 0x64, + 'ptgAreaA' => 0x65, + 'ptgMemAreaA' => 0x66, + 'ptgMemErrA' => 0x67, + 'ptgMemNoMemA' => 0x68, + 'ptgMemFuncA' => 0x69, + 'ptgRefErrA' => 0x6A, + 'ptgAreaErrA' => 0x6B, + 'ptgRefNA' => 0x6C, + 'ptgAreaNA' => 0x6D, + 'ptgMemAreaNA' => 0x6E, + 'ptgMemNoMemN' => 0x6F, + 'ptgFuncCEA' => 0x78, + 'ptgNameXA' => 0x79, + 'ptgRef3dA' => 0x7A, + 'ptgArea3dA' => 0x7B, + 'ptgRefErr3dA' => 0x7C, + 'ptgAreaErr3d' => 0x7D + ); + + // Thanks to Michael Meeks and Gnumeric for the initial arg values. + // + // The following hash was generated by "function_locale.pl" in the distro. + // Refer to function_locale.pl for non-English function names. + // + // The array elements are as follow: + // ptg: The Excel function ptg code. + // args: The number of arguments that the function takes: + // >=0 is a fixed number of arguments. + // -1 is a variable number of arguments. + // class: The reference, value or array class of the function args. + // vol: The function is volatile. + // + $this->_functions = array( + // function ptg args class vol + 'COUNT' => array( 0, -1, 0, 0 ), + 'IF' => array( 1, -1, 1, 0 ), + 'ISNA' => array( 2, 1, 1, 0 ), + 'ISERROR' => array( 3, 1, 1, 0 ), + 'SUM' => array( 4, -1, 0, 0 ), + 'AVERAGE' => array( 5, -1, 0, 0 ), + 'MIN' => array( 6, -1, 0, 0 ), + 'MAX' => array( 7, -1, 0, 0 ), + 'ROW' => array( 8, -1, 0, 0 ), + 'COLUMN' => array( 9, -1, 0, 0 ), + 'NA' => array( 10, 0, 0, 0 ), + 'NPV' => array( 11, -1, 1, 0 ), + 'STDEV' => array( 12, -1, 0, 0 ), + 'DOLLAR' => array( 13, -1, 1, 0 ), + 'FIXED' => array( 14, -1, 1, 0 ), + 'SIN' => array( 15, 1, 1, 0 ), + 'COS' => array( 16, 1, 1, 0 ), + 'TAN' => array( 17, 1, 1, 0 ), + 'ATAN' => array( 18, 1, 1, 0 ), + 'PI' => array( 19, 0, 1, 0 ), + 'SQRT' => array( 20, 1, 1, 0 ), + 'EXP' => array( 21, 1, 1, 0 ), + 'LN' => array( 22, 1, 1, 0 ), + 'LOG10' => array( 23, 1, 1, 0 ), + 'ABS' => array( 24, 1, 1, 0 ), + 'INT' => array( 25, 1, 1, 0 ), + 'SIGN' => array( 26, 1, 1, 0 ), + 'ROUND' => array( 27, 2, 1, 0 ), + 'LOOKUP' => array( 28, -1, 0, 0 ), + 'INDEX' => array( 29, -1, 0, 1 ), + 'REPT' => array( 30, 2, 1, 0 ), + 'MID' => array( 31, 3, 1, 0 ), + 'LEN' => array( 32, 1, 1, 0 ), + 'VALUE' => array( 33, 1, 1, 0 ), + 'TRUE' => array( 34, 0, 1, 0 ), + 'FALSE' => array( 35, 0, 1, 0 ), + 'AND' => array( 36, -1, 0, 0 ), + 'OR' => array( 37, -1, 0, 0 ), + 'NOT' => array( 38, 1, 1, 0 ), + 'MOD' => array( 39, 2, 1, 0 ), + 'DCOUNT' => array( 40, 3, 0, 0 ), + 'DSUM' => array( 41, 3, 0, 0 ), + 'DAVERAGE' => array( 42, 3, 0, 0 ), + 'DMIN' => array( 43, 3, 0, 0 ), + 'DMAX' => array( 44, 3, 0, 0 ), + 'DSTDEV' => array( 45, 3, 0, 0 ), + 'VAR' => array( 46, -1, 0, 0 ), + 'DVAR' => array( 47, 3, 0, 0 ), + 'TEXT' => array( 48, 2, 1, 0 ), + 'LINEST' => array( 49, -1, 0, 0 ), + 'TREND' => array( 50, -1, 0, 0 ), + 'LOGEST' => array( 51, -1, 0, 0 ), + 'GROWTH' => array( 52, -1, 0, 0 ), + 'PV' => array( 56, -1, 1, 0 ), + 'FV' => array( 57, -1, 1, 0 ), + 'NPER' => array( 58, -1, 1, 0 ), + 'PMT' => array( 59, -1, 1, 0 ), + 'RATE' => array( 60, -1, 1, 0 ), + 'MIRR' => array( 61, 3, 0, 0 ), + 'IRR' => array( 62, -1, 0, 0 ), + 'RAND' => array( 63, 0, 1, 1 ), + 'MATCH' => array( 64, -1, 0, 0 ), + 'DATE' => array( 65, 3, 1, 0 ), + 'TIME' => array( 66, 3, 1, 0 ), + 'DAY' => array( 67, 1, 1, 0 ), + 'MONTH' => array( 68, 1, 1, 0 ), + 'YEAR' => array( 69, 1, 1, 0 ), + 'WEEKDAY' => array( 70, -1, 1, 0 ), + 'HOUR' => array( 71, 1, 1, 0 ), + 'MINUTE' => array( 72, 1, 1, 0 ), + 'SECOND' => array( 73, 1, 1, 0 ), + 'NOW' => array( 74, 0, 1, 1 ), + 'AREAS' => array( 75, 1, 0, 1 ), + 'ROWS' => array( 76, 1, 0, 1 ), + 'COLUMNS' => array( 77, 1, 0, 1 ), + 'OFFSET' => array( 78, -1, 0, 1 ), + 'SEARCH' => array( 82, -1, 1, 0 ), + 'TRANSPOSE' => array( 83, 1, 1, 0 ), + 'TYPE' => array( 86, 1, 1, 0 ), + 'ATAN2' => array( 97, 2, 1, 0 ), + 'ASIN' => array( 98, 1, 1, 0 ), + 'ACOS' => array( 99, 1, 1, 0 ), + 'CHOOSE' => array( 100, -1, 1, 0 ), + 'HLOOKUP' => array( 101, -1, 0, 0 ), + 'VLOOKUP' => array( 102, -1, 0, 0 ), + 'ISREF' => array( 105, 1, 0, 0 ), + 'LOG' => array( 109, -1, 1, 0 ), + 'CHAR' => array( 111, 1, 1, 0 ), + 'LOWER' => array( 112, 1, 1, 0 ), + 'UPPER' => array( 113, 1, 1, 0 ), + 'PROPER' => array( 114, 1, 1, 0 ), + 'LEFT' => array( 115, -1, 1, 0 ), + 'RIGHT' => array( 116, -1, 1, 0 ), + 'EXACT' => array( 117, 2, 1, 0 ), + 'TRIM' => array( 118, 1, 1, 0 ), + 'REPLACE' => array( 119, 4, 1, 0 ), + 'SUBSTITUTE' => array( 120, -1, 1, 0 ), + 'CODE' => array( 121, 1, 1, 0 ), + 'FIND' => array( 124, -1, 1, 0 ), + 'CELL' => array( 125, -1, 0, 1 ), + 'ISERR' => array( 126, 1, 1, 0 ), + 'ISTEXT' => array( 127, 1, 1, 0 ), + 'ISNUMBER' => array( 128, 1, 1, 0 ), + 'ISBLANK' => array( 129, 1, 1, 0 ), + 'T' => array( 130, 1, 0, 0 ), + 'N' => array( 131, 1, 0, 0 ), + 'DATEVALUE' => array( 140, 1, 1, 0 ), + 'TIMEVALUE' => array( 141, 1, 1, 0 ), + 'SLN' => array( 142, 3, 1, 0 ), + 'SYD' => array( 143, 4, 1, 0 ), + 'DDB' => array( 144, -1, 1, 0 ), + 'INDIRECT' => array( 148, -1, 1, 1 ), + 'CALL' => array( 150, -1, 1, 0 ), + 'CLEAN' => array( 162, 1, 1, 0 ), + 'MDETERM' => array( 163, 1, 2, 0 ), + 'MINVERSE' => array( 164, 1, 2, 0 ), + 'MMULT' => array( 165, 2, 2, 0 ), + 'IPMT' => array( 167, -1, 1, 0 ), + 'PPMT' => array( 168, -1, 1, 0 ), + 'COUNTA' => array( 169, -1, 0, 0 ), + 'PRODUCT' => array( 183, -1, 0, 0 ), + 'FACT' => array( 184, 1, 1, 0 ), + 'DPRODUCT' => array( 189, 3, 0, 0 ), + 'ISNONTEXT' => array( 190, 1, 1, 0 ), + 'STDEVP' => array( 193, -1, 0, 0 ), + 'VARP' => array( 194, -1, 0, 0 ), + 'DSTDEVP' => array( 195, 3, 0, 0 ), + 'DVARP' => array( 196, 3, 0, 0 ), + 'TRUNC' => array( 197, -1, 1, 0 ), + 'ISLOGICAL' => array( 198, 1, 1, 0 ), + 'DCOUNTA' => array( 199, 3, 0, 0 ), + 'USDOLLAR' => array( 204, -1, 1, 0 ), + 'FINDB' => array( 205, -1, 1, 0 ), + 'SEARCHB' => array( 206, -1, 1, 0 ), + 'REPLACEB' => array( 207, 4, 1, 0 ), + 'LEFTB' => array( 208, -1, 1, 0 ), + 'RIGHTB' => array( 209, -1, 1, 0 ), + 'MIDB' => array( 210, 3, 1, 0 ), + 'LENB' => array( 211, 1, 1, 0 ), + 'ROUNDUP' => array( 212, 2, 1, 0 ), + 'ROUNDDOWN' => array( 213, 2, 1, 0 ), + 'ASC' => array( 214, 1, 1, 0 ), + 'DBCS' => array( 215, 1, 1, 0 ), + 'RANK' => array( 216, -1, 0, 0 ), + 'ADDRESS' => array( 219, -1, 1, 0 ), + 'DAYS360' => array( 220, -1, 1, 0 ), + 'TODAY' => array( 221, 0, 1, 1 ), + 'VDB' => array( 222, -1, 1, 0 ), + 'MEDIAN' => array( 227, -1, 0, 0 ), + 'SUMPRODUCT' => array( 228, -1, 2, 0 ), + 'SINH' => array( 229, 1, 1, 0 ), + 'COSH' => array( 230, 1, 1, 0 ), + 'TANH' => array( 231, 1, 1, 0 ), + 'ASINH' => array( 232, 1, 1, 0 ), + 'ACOSH' => array( 233, 1, 1, 0 ), + 'ATANH' => array( 234, 1, 1, 0 ), + 'DGET' => array( 235, 3, 0, 0 ), + 'INFO' => array( 244, 1, 1, 1 ), + 'DB' => array( 247, -1, 1, 0 ), + 'FREQUENCY' => array( 252, 2, 0, 0 ), + 'ERROR.TYPE' => array( 261, 1, 1, 0 ), + 'REGISTER.ID' => array( 267, -1, 1, 0 ), + 'AVEDEV' => array( 269, -1, 0, 0 ), + 'BETADIST' => array( 270, -1, 1, 0 ), + 'GAMMALN' => array( 271, 1, 1, 0 ), + 'BETAINV' => array( 272, -1, 1, 0 ), + 'BINOMDIST' => array( 273, 4, 1, 0 ), + 'CHIDIST' => array( 274, 2, 1, 0 ), + 'CHIINV' => array( 275, 2, 1, 0 ), + 'COMBIN' => array( 276, 2, 1, 0 ), + 'CONFIDENCE' => array( 277, 3, 1, 0 ), + 'CRITBINOM' => array( 278, 3, 1, 0 ), + 'EVEN' => array( 279, 1, 1, 0 ), + 'EXPONDIST' => array( 280, 3, 1, 0 ), + 'FDIST' => array( 281, 3, 1, 0 ), + 'FINV' => array( 282, 3, 1, 0 ), + 'FISHER' => array( 283, 1, 1, 0 ), + 'FISHERINV' => array( 284, 1, 1, 0 ), + 'FLOOR' => array( 285, 2, 1, 0 ), + 'GAMMADIST' => array( 286, 4, 1, 0 ), + 'GAMMAINV' => array( 287, 3, 1, 0 ), + 'CEILING' => array( 288, 2, 1, 0 ), + 'HYPGEOMDIST' => array( 289, 4, 1, 0 ), + 'LOGNORMDIST' => array( 290, 3, 1, 0 ), + 'LOGINV' => array( 291, 3, 1, 0 ), + 'NEGBINOMDIST' => array( 292, 3, 1, 0 ), + 'NORMDIST' => array( 293, 4, 1, 0 ), + 'NORMSDIST' => array( 294, 1, 1, 0 ), + 'NORMINV' => array( 295, 3, 1, 0 ), + 'NORMSINV' => array( 296, 1, 1, 0 ), + 'STANDARDIZE' => array( 297, 3, 1, 0 ), + 'ODD' => array( 298, 1, 1, 0 ), + 'PERMUT' => array( 299, 2, 1, 0 ), + 'POISSON' => array( 300, 3, 1, 0 ), + 'TDIST' => array( 301, 3, 1, 0 ), + 'WEIBULL' => array( 302, 4, 1, 0 ), + 'SUMXMY2' => array( 303, 2, 2, 0 ), + 'SUMX2MY2' => array( 304, 2, 2, 0 ), + 'SUMX2PY2' => array( 305, 2, 2, 0 ), + 'CHITEST' => array( 306, 2, 2, 0 ), + 'CORREL' => array( 307, 2, 2, 0 ), + 'COVAR' => array( 308, 2, 2, 0 ), + 'FORECAST' => array( 309, 3, 2, 0 ), + 'FTEST' => array( 310, 2, 2, 0 ), + 'INTERCEPT' => array( 311, 2, 2, 0 ), + 'PEARSON' => array( 312, 2, 2, 0 ), + 'RSQ' => array( 313, 2, 2, 0 ), + 'STEYX' => array( 314, 2, 2, 0 ), + 'SLOPE' => array( 315, 2, 2, 0 ), + 'TTEST' => array( 316, 4, 2, 0 ), + 'PROB' => array( 317, -1, 2, 0 ), + 'DEVSQ' => array( 318, -1, 0, 0 ), + 'GEOMEAN' => array( 319, -1, 0, 0 ), + 'HARMEAN' => array( 320, -1, 0, 0 ), + 'SUMSQ' => array( 321, -1, 0, 0 ), + 'KURT' => array( 322, -1, 0, 0 ), + 'SKEW' => array( 323, -1, 0, 0 ), + 'ZTEST' => array( 324, -1, 0, 0 ), + 'LARGE' => array( 325, 2, 0, 0 ), + 'SMALL' => array( 326, 2, 0, 0 ), + 'QUARTILE' => array( 327, 2, 0, 0 ), + 'PERCENTILE' => array( 328, 2, 0, 0 ), + 'PERCENTRANK' => array( 329, -1, 0, 0 ), + 'MODE' => array( 330, -1, 2, 0 ), + 'TRIMMEAN' => array( 331, 2, 0, 0 ), + 'TINV' => array( 332, 2, 1, 0 ), + 'CONCATENATE' => array( 336, -1, 1, 0 ), + 'POWER' => array( 337, 2, 1, 0 ), + 'RADIANS' => array( 342, 1, 1, 0 ), + 'DEGREES' => array( 343, 1, 1, 0 ), + 'SUBTOTAL' => array( 344, -1, 0, 0 ), + 'SUMIF' => array( 345, -1, 0, 0 ), + 'COUNTIF' => array( 346, 2, 0, 0 ), + 'COUNTBLANK' => array( 347, 1, 0, 0 ), + 'ISPMT' => array( 350, 4, 1, 0 ), + 'DATEDIF' => array( 351, 3, 1, 0 ), + 'DATESTRING' => array( 352, 1, 1, 0 ), + 'NUMBERSTRING' => array( 353, 2, 1, 0 ), + 'ROMAN' => array( 354, -1, 1, 0 ), + 'GETPIVOTDATA' => array( 358, -1, 0, 0 ), + 'HYPERLINK' => array( 359, -1, 1, 0 ), + 'PHONETIC' => array( 360, 1, 0, 0 ), + 'AVERAGEA' => array( 361, -1, 0, 0 ), + 'MAXA' => array( 362, -1, 0, 0 ), + 'MINA' => array( 363, -1, 0, 0 ), + 'STDEVPA' => array( 364, -1, 0, 0 ), + 'VARPA' => array( 365, -1, 0, 0 ), + 'STDEVA' => array( 366, -1, 0, 0 ), + 'VARA' => array( 367, -1, 0, 0 ), + ); + } + + /** + * Convert a token to the proper ptg value. + * + * @access private + * @param mixed $token The token to convert. + * @return mixed the converted token on success + */ + function _convert($token) + { + if (preg_match("/^\"[^\"]{0,255}\"$/", $token)) { + return $this->_convertString($token); + + } elseif (is_numeric($token)) { + return $this->_convertNumber($token); + + // match references like A1 or $A$1 + } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) { + return $this->_convertRef2d($token); + + // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 + } elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z](\d+)$/u",$token)) { + return $this->_convertRef3d($token); + + // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 + } elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z](\d+)$/u",$token)) { + return $this->_convertRef3d($token); + + // match ranges like A1:B2 + } elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/",$token)) { + return $this->_convertRange2d($token); + + // match ranges like A1..B2 + } elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/",$token)) { + return $this->_convertRange2d($token); + + // match external ranges like Sheet1!A1 or Sheet1:Sheet2!A1:B2 + } elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?(\d+)\:([A-Ia-i]?[A-Za-z])?(\d+)$/u",$token)) { + return $this->_convertRange3d($token); + + // match external ranges like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1:B2 + } elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?(\d+)\:([A-Ia-i]?[A-Za-z])?(\d+)$/u",$token)) { + return $this->_convertRange3d($token); + + // operators (including parentheses) + } elseif (isset($this->ptg[$token])) { + return pack("C", $this->ptg[$token]); + + // commented so argument number can be processed correctly. See toReversePolish(). + /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token)) + { + return($this->_convertFunction($token,$this->_func_args)); + }*/ + + // if it's an argument, ignore the token (the argument remains) + } elseif ($token == 'arg') { + return ''; + } + // TODO: use real error codes + throw new Exception("Unknown token $token"); + } + + /** + * Convert a number token to ptgInt or ptgNum + * + * @access private + * @param mixed $num an integer or double for conversion to its ptg value + */ + function _convertNumber($num) + { + // Integer in the range 0..2**16-1 + if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { + return pack("Cv", $this->ptg['ptgInt'], $num); + } else { // A float + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $num = strrev($num); + } + return pack("Cd", $this->ptg['ptgNum'], $num); + } + } + + /** + * Convert a string token to ptgStr + * + * @access private + * @param string $string A string for conversion to its ptg value. + * @return mixed the converted token on success + */ + function _convertString($string) + { + // chop away beggining and ending quotes + $string = substr($string, 1, strlen($string) - 2); + if (strlen($string) > 255) { + throw new Exception("String is too long"); + } + + if ($this->_BIFF_version == 0x0500) { + return pack("CC", $this->ptg['ptgStr'], strlen($string)).$string; + } elseif ($this->_BIFF_version == 0x0600) { + return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string); + } + } + + /** + * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of + * args that it takes. + * + * @access private + * @param string $token The name of the function for convertion to ptg value. + * @param integer $num_args The number of arguments the function receives. + * @return string The packed ptg for the function + */ + function _convertFunction($token, $num_args) + { + $args = $this->_functions[$token][1]; + $volatile = $this->_functions[$token][3]; + + // Fixed number of args eg. TIME($i,$j,$k). + if ($args >= 0) { + return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]); + } + // Variable number of args eg. SUM($i,$j,$k, ..). + if ($args == -1) { + return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]); + } + } + + /** + * Convert an Excel range such as A1:D4 to a ptgRefV. + * + * @access private + * @param string $range An Excel range in the A1:A2 or A1..A2 format. + */ + function _convertRange2d($range, $class=0) + { + + // TODO: possible class value 0,1,2 check Formula.pm + // Split the range into 2 cell refs + if (preg_match("/^([A-Ia-i]?[A-Za-z])(\d+)\:([A-Ia-i]?[A-Za-z])(\d+)$/", $range)) { + list($cell1, $cell2) = split(':', $range); + } elseif (preg_match("/^([A-Ia-i]?[A-Za-z])(\d+)\.\.([A-Ia-i]?[A-Za-z])(\d+)$/", $range)) { + list($cell1, $cell2) = split('\.\.', $range); + + } else { + // TODO: use real error codes + throw new Exception("Unknown range separator"); + } + + // Convert the cell references + $cell_array1 = $this->_cellToPackedRowcol($cell1); + list($row1, $col1) = $cell_array1; + $cell_array2 = $this->_cellToPackedRowcol($cell2); + list($row2, $col2) = $cell_array2; + + // The ptg value depends on the class of the ptg. + if ($class == 0) { + $ptgArea = pack("C", $this->ptg['ptgArea']); + } elseif ($class == 1) { + $ptgArea = pack("C", $this->ptg['ptgAreaV']); + } elseif ($class == 2) { + $ptgArea = pack("C", $this->ptg['ptgAreaA']); + } else { + // TODO: use real error codes + throw new Exception("Unknown class $class"); + } + return $ptgArea . $row1 . $row2 . $col1. $col2; + } + + /** + * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to + * a ptgArea3d. + * + * @access private + * @param string $token An Excel range in the Sheet1!A1:A2 format. + * @return mixed The packed ptgArea3d token on success. + */ + function _convertRange3d($token) + { + $class = 2; // as far as I know, this is magick. + + // Split the ref at the ! symbol + list($ext_ref, $range) = split('!', $token); + + // Convert the external reference part (different for BIFF8) + if ($this->_BIFF_version == 0x0500) { + $ext_ref = $this->_packExtRef($ext_ref); + } elseif ($this->_BIFF_version == 0x0600) { + $ext_ref = $this->_getRefIndex($ext_ref); + } + + // Split the range into 2 cell refs + list($cell1, $cell2) = split(':', $range); + + // Convert the cell references + if (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/", $cell1)) { + $cell_array1 = $this->_cellToPackedRowcol($cell1); + list($row1, $col1) = $cell_array1; + $cell_array2 = $this->_cellToPackedRowcol($cell2); + list($row2, $col2) = $cell_array2; + } else { // It's a rows range (like 26:27) + $cells_array = $this->_rangeToPackedRange($cell1.':'.$cell2); + list($row1, $col1, $row2, $col2) = $cells_array; + } + + // The ptg value depends on the class of the ptg. + if ($class == 0) { + $ptgArea = pack("C", $this->ptg['ptgArea3d']); + } elseif ($class == 1) { + $ptgArea = pack("C", $this->ptg['ptgArea3dV']); + } elseif ($class == 2) { + $ptgArea = pack("C", $this->ptg['ptgArea3dA']); + } else { + throw new Exception("Unknown class $class"); + } + + return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2; + } + + /** + * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. + * + * @access private + * @param string $cell An Excel cell reference + * @return string The cell in packed() format with the corresponding ptg + */ + function _convertRef2d($cell) + { + $class = 2; // as far as I know, this is magick. + + // Convert the cell reference + $cell_array = $this->_cellToPackedRowcol($cell); + list($row, $col) = $cell_array; + + // The ptg value depends on the class of the ptg. + if ($class == 0) { + $ptgRef = pack("C", $this->ptg['ptgRef']); + } elseif ($class == 1) { + $ptgRef = pack("C", $this->ptg['ptgRefV']); + } elseif ($class == 2) { + $ptgRef = pack("C", $this->ptg['ptgRefA']); + } else { + // TODO: use real error codes + throw new Exception("Unknown class $class"); + } + return $ptgRef.$row.$col; + } + + /** + * Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a + * ptgRef3d. + * + * @access private + * @param string $cell An Excel cell reference + * @return mixed The packed ptgRef3d token on success. + */ + function _convertRef3d($cell) + { + $class = 2; // as far as I know, this is magick. + + // Split the ref at the ! symbol + list($ext_ref, $cell) = split('!', $cell); + + // Convert the external reference part (different for BIFF8) + if ($this->_BIFF_version == 0x0500) { + $ext_ref = $this->_packExtRef($ext_ref); + } elseif ($this->_BIFF_version == 0x0600) { + $ext_ref = $this->_getRefIndex($ext_ref); + } + + // Convert the cell reference part + list($row, $col) = $this->_cellToPackedRowcol($cell); + + // The ptg value depends on the class of the ptg. + if ($class == 0) { + $ptgRef = pack("C", $this->ptg['ptgRef3d']); + } elseif ($class == 1) { + $ptgRef = pack("C", $this->ptg['ptgRef3dV']); + } elseif ($class == 2) { + $ptgRef = pack("C", $this->ptg['ptgRef3dA']); + } else { + throw new Exception("Unknown class $class"); + } + + return $ptgRef . $ext_ref. $row . $col; + } + + /** + * Convert the sheet name part of an external reference, for example "Sheet1" or + * "Sheet1:Sheet2", to a packed structure. + * + * @access private + * @param string $ext_ref The name of the external reference + * @return string The reference index in packed() format + */ + function _packExtRef($ext_ref) + { + $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any. + $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any. + + // Check if there is a sheet range eg., Sheet1:Sheet2. + if (preg_match("/:/", $ext_ref)) { + list($sheet_name1, $sheet_name2) = split(':', $ext_ref); + + $sheet1 = $this->_getSheetIndex($sheet_name1); + if ($sheet1 == -1) { + throw new Exception("Unknown sheet name $sheet_name1 in formula"); + } + $sheet2 = $this->_getSheetIndex($sheet_name2); + if ($sheet2 == -1) { + throw new Exception("Unknown sheet name $sheet_name2 in formula"); + } + + // Reverse max and min sheet numbers if necessary + if ($sheet1 > $sheet2) { + list($sheet1, $sheet2) = array($sheet2, $sheet1); + } + } else { // Single sheet name only. + $sheet1 = $this->_getSheetIndex($ext_ref); + if ($sheet1 == -1) { + throw new Exception("Unknown sheet name $ext_ref in formula"); + } + $sheet2 = $sheet1; + } + + // References are stored relative to 0xFFFF. + $offset = -1 - $sheet1; + + return pack('vdvv', $offset, 0x00, $sheet1, $sheet2); + } + + /** + * Look up the REF index that corresponds to an external sheet name + * (or range). If it doesn't exist yet add it to the workbook's references + * array. It assumes all sheet names given must exist. + * + * @access private + * @param string $ext_ref The name of the external reference + * @return mixed The reference index in packed() format on success + */ + function _getRefIndex($ext_ref) + { + $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any. + $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any. + + // Check if there is a sheet range eg., Sheet1:Sheet2. + if (preg_match("/:/", $ext_ref)) { + list($sheet_name1, $sheet_name2) = split(':', $ext_ref); + + $sheet1 = $this->_getSheetIndex($sheet_name1); + if ($sheet1 == -1) { + throw new Exception("Unknown sheet name $sheet_name1 in formula"); + } + $sheet2 = $this->_getSheetIndex($sheet_name2); + if ($sheet2 == -1) { + throw new Exception("Unknown sheet name $sheet_name2 in formula"); + } + + // Reverse max and min sheet numbers if necessary + if ($sheet1 > $sheet2) { + list($sheet1, $sheet2) = array($sheet2, $sheet1); + } + } else { // Single sheet name only. + $sheet1 = $this->_getSheetIndex($ext_ref); + if ($sheet1 == -1) { + throw new Exception("Unknown sheet name $ext_ref in formula"); + } + $sheet2 = $sheet1; + } + + // assume all references belong to this document + $supbook_index = 0x00; + $ref = pack('vvv', $supbook_index, $sheet1, $sheet2); + $total_references = count($this->_references); + $index = -1; + for ($i = 0; $i < $total_references; ++$i) { + if ($ref == $this->_references[$i]) { + $index = $i; + break; + } + } + // if REF was not found add it to references array + if ($index == -1) { + $this->_references[$total_references] = $ref; + $index = $total_references; + } + + return pack('v', $index); + } + + /** + * Look up the index that corresponds to an external sheet name. The hash of + * sheet names is updated by the addworksheet() method of the + * PHPExcel_Writer_Excel5_Workbook class. + * + * @access private + * @return integer The sheet index, -1 if the sheet was not found + */ + function _getSheetIndex($sheet_name) + { + if (!isset($this->_ext_sheets[$sheet_name])) { + return -1; + } else { + return $this->_ext_sheets[$sheet_name]; + } + } + + /** + * This method is used to update the array of sheet names. It is + * called by the addWorksheet() method of the + * PHPExcel_Writer_Excel5_Workbook class. + * + * @access public + * @see PHPExcel_Writer_Excel5_Workbook::addWorksheet() + * @param string $name The name of the worksheet being added + * @param integer $index The index of the worksheet being added + */ + function setExtSheet($name, $index) + { + $this->_ext_sheets[$name] = $index; + } + + /** + * pack() row and column into the required 3 or 4 byte format. + * + * @access private + * @param string $cell The Excel cell reference to be packed + * @return array Array containing the row and column in packed() format + */ + function _cellToPackedRowcol($cell) + { + $cell = strtoupper($cell); + list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell); + if ($col >= 256) { + throw new Exception("Column in: $cell greater than 255"); + } + // FIXME: change for BIFF8 + if ($row >= 16384) { + throw new Exception("Row in: $cell greater than 16384 "); + } + + // Set the high bits to indicate if row or col are relative. + if ($this->_BIFF_version == 0x0500) { + $row |= $col_rel << 14; + $row |= $row_rel << 15; + $col = pack('C', $col); + } elseif ($this->_BIFF_version == 0x0600) { + $col |= $col_rel << 14; + $col |= $row_rel << 15; + $col = pack('v', $col); + } + $row = pack('v', $row); + + return array($row, $col); + } + + /** + * pack() row range into the required 3 or 4 byte format. + * Just using maximum col/rows, which is probably not the correct solution + * + * @access private + * @param string $range The Excel range to be packed + * @return array Array containing (row1,col1,row2,col2) in packed() format + */ + function _rangeToPackedRange($range) + { + preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match); + // return absolute rows if there is a $ in the ref + $row1_rel = empty($match[1]) ? 1 : 0; + $row1 = $match[2]; + $row2_rel = empty($match[3]) ? 1 : 0; + $row2 = $match[4]; + // Convert 1-index to zero-index + --$row1; + --$row2; + // Trick poor inocent Excel + $col1 = 0; + $col2 = 16383; // FIXME: maximum possible value for Excel 5 (change this!!!) + + // FIXME: this changes for BIFF8 + if (($row1 >= 16384) or ($row2 >= 16384)) { + throw new Exception("Row in: $range greater than 16384 "); + } + + // Set the high bits to indicate if rows are relative. + if ($this->_BIFF_version == 0x0500) { + $row1 |= $row1_rel << 14; // FIXME: probably a bug + $row2 |= $row2_rel << 15; + $col1 = pack('C', $col1); + $col2 = pack('C', $col2); + } elseif ($this->_BIFF_version == 0x0600) { + $col1 |= $row1_rel << 15; + $col2 |= $row2_rel << 15; + $col1 = pack('v', $col1); + $col2 = pack('v', $col2); + } + $row1 = pack('v', $row1); + $row2 = pack('v', $row2); + + return array($row1, $col1, $row2, $col2); + } + + /** + * Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero + * indexed row and column number. Also returns two (0,1) values to indicate + * whether the row or column are relative references. + * + * @access private + * @param string $cell The Excel cell reference in A1 format. + * @return array + */ + function _cellToRowcol($cell) + { + preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match); + // return absolute column if there is a $ in the ref + $col_rel = empty($match[1]) ? 1 : 0; + $col_ref = $match[2]; + $row_rel = empty($match[3]) ? 1 : 0; + $row = $match[4]; + + // Convert base26 column string to a number. + $expn = strlen($col_ref) - 1; + $col = 0; + $col_ref_length = strlen($col_ref); + for ($i = 0; $i < $col_ref_length; ++$i) { + $col += (ord($col_ref{$i}) - ord('A') + 1) * pow(26, $expn); + --$expn; + } + + // Convert 1-index to zero-index + --$row; + --$col; + + return array($row, $col, $row_rel, $col_rel); + } + + /** + * Advance to the next valid token. + * + * @access private + */ + function _advance() + { + $i = $this->_current_char; + $formula_length = strlen($this->_formula); + // eat up white spaces + if ($i < $formula_length) { + while ($this->_formula{$i} == " ") { + ++$i; + } + + if ($i < ($formula_length - 1)) { + $this->_lookahead = $this->_formula{$i+1}; + } + $token = ''; + } + + while ($i < $formula_length) { + $token .= $this->_formula{$i}; + if ($i < ($formula_length - 1)) { + $this->_lookahead = $this->_formula{$i+1}; + } else { + $this->_lookahead = ''; + } + + if ($this->_match($token) != '') { + //if ($i < strlen($this->_formula) - 1) { + // $this->_lookahead = $this->_formula{$i+1}; + //} + $this->_current_char = $i + 1; + $this->_current_token = $token; + return 1; + } + + if ($i < ($formula_length - 2)) { + $this->_lookahead = $this->_formula{$i+2}; + } else { // if we run out of characters _lookahead becomes empty + $this->_lookahead = ''; + } + ++$i; + } + //die("Lexical error ".$this->_current_char); + } + + /** + * Checks if it's a valid token. + * + * @access private + * @param mixed $token The token to check. + * @return mixed The checked token or false on failure + */ + function _match($token) + { + switch($token) { + case "+": + return $token; + break; + case "-": + return $token; + break; + case "*": + return $token; + break; + case "/": + return $token; + break; + case "(": + return $token; + break; + case ")": + return $token; + break; + case ",": + return $token; + break; + case ";": + return $token; + break; + case ">": + if ($this->_lookahead == '=') { // it's a GE token + break; + } + return $token; + break; + case "<": + // it's a LE or a NE token + if (($this->_lookahead == '=') or ($this->_lookahead == '>')) { + break; + } + return $token; + break; + case ">=": + return $token; + break; + case "<=": + return $token; + break; + case "=": + return $token; + break; + case "<>": + return $token; + break; + default: + // if it's a reference + if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and + !ereg("[0-9]",$this->_lookahead) and + ($this->_lookahead != ':') and ($this->_lookahead != '.') and + ($this->_lookahead != '!')) + { + return $token; + } + // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1) + elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and + !ereg("[0-9]",$this->_lookahead) and + ($this->_lookahead != ':') and ($this->_lookahead != '.')) + { + return $token; + } + // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1) + elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and + !ereg("[0-9]",$this->_lookahead) and + ($this->_lookahead != ':') and ($this->_lookahead != '.')) + { + return $token; + } + // if it's a range (A1:A2) + elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and + !ereg("[0-9]",$this->_lookahead)) + { + return $token; + } + // if it's a range (A1..A2) + elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and + !ereg("[0-9]",$this->_lookahead)) + { + return $token; + } + // If it's an external range like Sheet1!A1 or Sheet1:Sheet2!A1:B2 + elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and + !ereg("[0-9]",$this->_lookahead)) + { + return $token; + } + // If it's an external range like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1:B2 + elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and + !ereg("[0-9]",$this->_lookahead)) + { + return $token; + } + // If it's a number (check that it's not a sheet name or range) + elseif (is_numeric($token) and + (!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and + ($this->_lookahead != '!') and ($this->_lookahead != ':')) + { + return $token; + } + // If it's a string (of maximum 255 characters) + elseif (ereg("^\"[^\"]{0,255}\"$",$token)) + { + return $token; + } + // if it's a function call + elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$token) and ($this->_lookahead == "(")) + { + return $token; + } + return ''; + } + } + + /** + * The parsing method. It parses a formula. + * + * @access public + * @param string $formula The formula to parse, without the initial equal + * sign (=). + * @return mixed true on success + */ + function parse($formula) + { + $this->_current_char = 0; + $this->_formula = $formula; + $this->_lookahead = $formula{1}; + $this->_advance(); + $this->_parse_tree = $this->_condition(); + return true; + } + + /** + * It parses a condition. It assumes the following rule: + * Cond -> Expr [(">" | "<") Expr] + * + * @access private + * @return mixed The parsed ptg'd tree on success + */ + function _condition() + { + $result = $this->_expression(); + if ($this->_current_token == "<") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgLT', $result, $result2); + } elseif ($this->_current_token == ">") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgGT', $result, $result2); + } elseif ($this->_current_token == "<=") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgLE', $result, $result2); + } elseif ($this->_current_token == ">=") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgGE', $result, $result2); + } elseif ($this->_current_token == "=") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgEQ', $result, $result2); + } elseif ($this->_current_token == "<>") { + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgNE', $result, $result2); + } + return $result; + } + + /** + * It parses a expression. It assumes the following rule: + * Expr -> Term [("+" | "-") Term] + * -> "string" + * -> "-" Term + * + * @access private + * @return mixed The parsed ptg'd tree on success + */ + function _expression() + { + // If it's a string return a string node + if (ereg("^\"[^\"]{0,255}\"$", $this->_current_token)) { + $result = $this->_createTree($this->_current_token, '', ''); + $this->_advance(); + return $result; + } elseif ($this->_current_token == "-") { + // catch "-" Term + $this->_advance(); + $result2 = $this->_expression(); + $result = $this->_createTree('ptgUminus', $result2, ''); + return $result; + } + $result = $this->_term(); + while (($this->_current_token == "+") or + ($this->_current_token == "-")) { + /**/ + if ($this->_current_token == "+") { + $this->_advance(); + $result2 = $this->_term(); + $result = $this->_createTree('ptgAdd', $result, $result2); + } else { + $this->_advance(); + $result2 = $this->_term(); + $result = $this->_createTree('ptgSub', $result, $result2); + } + } + return $result; + } + + /** + * This function just introduces a ptgParen element in the tree, so that Excel + * doesn't get confused when working with a parenthesized formula afterwards. + * + * @access private + * @see _fact() + * @return array The parsed ptg'd tree + */ + function _parenthesizedExpression() + { + $result = $this->_createTree('ptgParen', $this->_expression(), ''); + return $result; + } + + /** + * It parses a term. It assumes the following rule: + * Term -> Fact [("*" | "/") Fact] + * + * @access private + * @return mixed The parsed ptg'd tree on success + */ + function _term() + { + $result = $this->_fact(); + while (($this->_current_token == "*") or + ($this->_current_token == "/")) { + /**/ + if ($this->_current_token == "*") { + $this->_advance(); + $result2 = $this->_fact(); + $result = $this->_createTree('ptgMul', $result, $result2); + } else { + $this->_advance(); + $result2 = $this->_fact(); + $result = $this->_createTree('ptgDiv', $result, $result2); + } + } + return $result; + } + + /** + * It parses a factor. It assumes the following rule: + * Fact -> ( Expr ) + * | CellRef + * | CellRange + * | Number + * | Function + * + * @access private + * @return mixed The parsed ptg'd tree on success + */ + function _fact() + { + if ($this->_current_token == "(") { + $this->_advance(); // eat the "(" + $result = $this->_parenthesizedExpression(); + if ($this->_current_token != ")") { + throw new Exception("')' token expected."); + } + $this->_advance(); // eat the ")" + return $result; + } + // if it's a reference + if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token)) + { + $result = $this->_createTree($this->_current_token, '', ''); + $this->_advance(); + return $result; + } + // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1) + elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$this->_current_token)) + { + $result = $this->_createTree($this->_current_token, '', ''); + $this->_advance(); + return $result; + } + // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1) + elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$this->_current_token)) + { + $result = $this->_createTree($this->_current_token, '', ''); + $this->_advance(); + return $result; + } + // if it's a range + elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token) or + preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token)) + { + $result = $this->_current_token; + $this->_advance(); + return $result; + } + // If it's an external range (Sheet1!A1 or Sheet1!A1:B2) + elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$this->_current_token)) + { + $result = $this->_current_token; + $this->_advance(); + return $result; + } + // If it's an external range ('Sheet1'!A1 or 'Sheet1'!A1:B2) + elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$this->_current_token)) + { + $result = $this->_current_token; + $this->_advance(); + return $result; + } + elseif (is_numeric($this->_current_token)) + { + $result = $this->_createTree($this->_current_token, '', ''); + $this->_advance(); + return $result; + } + // if it's a function call + elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token)) + { + $result = $this->_func(); + return $result; + } + throw new Exception("Syntax error: ".$this->_current_token. + ", lookahead: ".$this->_lookahead. + ", current char: ".$this->_current_char); + } + + /** + * It parses a function call. It assumes the following rule: + * Func -> ( Expr [,Expr]* ) + * + * @access private + * @return mixed The parsed ptg'd tree on success + */ + function _func() + { + $num_args = 0; // number of arguments received + $function = strtoupper($this->_current_token); + $result = ''; // initialize result + $this->_advance(); + $this->_advance(); // eat the "(" + while ($this->_current_token != ')') { + /**/ + if ($num_args > 0) { + if ($this->_current_token == "," or + $this->_current_token == ";") + { + $this->_advance(); // eat the "," or ";" + } else { + throw new Exception("Syntax error: comma expected in ". + "function $function, arg #{$num_args}"); + } + $result2 = $this->_condition(); + $result = $this->_createTree('arg', $result, $result2); + } else { // first argument + $result2 = $this->_condition(); + $result = $this->_createTree('arg', '', $result2); + } + ++$num_args; + } + if (!isset($this->_functions[$function])) { + throw new Exception("Function $function() doesn't exist"); + } + $args = $this->_functions[$function][1]; + // If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid. + if (($args >= 0) and ($args != $num_args)) { + throw new Exception("Incorrect number of arguments in function $function() "); + } + + $result = $this->_createTree($function, $result, $num_args); + $this->_advance(); // eat the ")" + return $result; + } + + /** + * Creates a tree. In fact an array which may have one or two arrays (sub-trees) + * as elements. + * + * @access private + * @param mixed $value The value of this node. + * @param mixed $left The left array (sub-tree) or a final node. + * @param mixed $right The right array (sub-tree) or a final node. + * @return array A tree + */ + function _createTree($value, $left, $right) + { + return array('value' => $value, 'left' => $left, 'right' => $right); + } + + /** + * Builds a string containing the tree in reverse polish notation (What you + * would use in a HP calculator stack). + * The following tree: + * + * + + * / \ + * 2 3 + * + * produces: "23+" + * + * The following tree: + * + * + + * / \ + * 3 * + * / \ + * 6 A1 + * + * produces: "36A1*+" + * + * In fact all operands, functions, references, etc... are written as ptg's + * + * @access public + * @param array $tree The optional tree to convert. + * @return string The tree in reverse polish notation + */ + function toReversePolish($tree = array()) + { + $polish = ""; // the string we are going to return + if (empty($tree)) { // If it's the first call use _parse_tree + $tree = $this->_parse_tree; + } + if (is_array($tree['left'])) { + $converted_tree = $this->toReversePolish($tree['left']); + $polish .= $converted_tree; + } elseif ($tree['left'] != '') { // It's a final node + $converted_tree = $this->_convert($tree['left']); + $polish .= $converted_tree; + } + if (is_array($tree['right'])) { + $converted_tree = $this->toReversePolish($tree['right']); + $polish .= $converted_tree; + } elseif ($tree['right'] != '') { // It's a final node + $converted_tree = $this->_convert($tree['right']); + $polish .= $converted_tree; + } + // if it's a function convert it here (so we can set it's arguments) + if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and + !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and + !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and + !is_numeric($tree['value']) and + !isset($this->ptg[$tree['value']])) + { + // left subtree for a function is always an array. + if ($tree['left'] != '') { + $left_tree = $this->toReversePolish($tree['left']); + } else { + $left_tree = ''; + } + // add it's left subtree and return. + return $left_tree.$this->_convertFunction($tree['value'], $tree['right']); + } else { + $converted_tree = $this->_convert($tree['value']); + } + $polish .= $converted_tree; + return $polish; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Workbook.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Workbook.php new file mode 100644 index 000000000..ba359d311 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Workbook.php @@ -0,0 +1,1546 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +// Original file header of PEAR::Spreadsheet_Excel_Writer_Workbook (used as the base for this class): +// ----------------------------------------------------------------------------------------- +// /* +// * Module written/ported by Xavier Noguer <xnoguer@rezebra.com> +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * <jmcnamara@cpan.org> +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Shared_Date */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Date.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_Shared_Escher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher.php'; + +/** PHPExcel_Shared_Escher_DggContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php'; + +/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php'; + +/** PHPExcel_Writer_Excel5_Xf */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Xf.php'; + +/** PHPExcel_Writer_Excel5_BIFFwriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/BIFFwriter.php'; + +/** PHPExcel_Writer_Excel5_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Worksheet.php'; + +/** PHPExcel_Writer_Excel5_Font */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Font.php'; + +/** PHPExcel_Writer_Excel5_Escher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Escher.php'; + + +/** + * PHPExcel_Writer_Excel5_Workbook + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter +{ + /** + * Formula parser + * + * @var PHPExcel_Writer_Excel5_Parser + */ + private $_parser; + + /** + * The BIFF file size for the workbook. + * @var integer + * @see _calcSheetOffsets() + */ + var $_biffsize; + + /** + * XF Writers + * @var PHPExcel_Writer_Excel5_Xf[] + */ + private $_xfWriters = array(); + + /** + * Array containing the colour palette + * @var array + */ + var $_palette; + + /** + * The codepage indicates the text encoding used for strings + * @var integer + */ + var $_codepage; + + /** + * The country code used for localization + * @var integer + */ + var $_country_code; + + /** + * The temporary dir for storing the OLE file + * @var string + */ + var $_tmp_dir; + + /** + * Workbook + * @var PHPExcel + */ + private $_phpExcel; + + /** + * Color cache + */ + private $_colors = array(); + + /** + * Fonts writers + * + * @var PHPExcel_Writer_Excel5_Font[] + */ + private $_fontWriters = array(); + + /** + * Added fonts. Maps from font's hash => index in workbook + * + * @var array + */ + private $_addedFonts = array(); + + /** + * Shared number formats + * + * @var array + */ + private $_numberFormats = array(); + + /** + * Added number formats. Maps from numberFormat's hash => index in workbook + * + * @var array + */ + private $_addedNumberFormats = array(); + + /** + * Sizes of the binary worksheet streams + * + * @var array + */ + private $_worksheetSizes = array(); + + /** + * Offsets of the binary worksheet streams relative to the start of the global workbook stream + * + * @var array + */ + private $_worksheetOffsets = array(); + + /** + * Total number of shared strings in workbook + * + * @var int + */ + private $_str_total; + + /** + * Number of unique shared strings in workbook + * + * @var int + */ + private $_str_unique; + + /** + * Array of unique shared strings in workbook + * + * @var array + */ + private $_str_table; + + + /** + * Class constructor + * + * @param PHPExcel $phpExcel The Workbook + * @param int $BIFF_verions BIFF version + * @param int $str_total Total number of strings + * @param int $str_unique Total number of unique strings + * @param array $str_table + * @param mixed $parser The formula parser created for the Workbook + */ + public function __construct(PHPExcel $phpExcel = null, $BIFF_version = 0x0600, + &$str_total, + &$str_unique, &$str_table, $parser, $tempDir = '' + ) + { + // It needs to call its parent's constructor explicitly + parent::__construct(); + + $this->_parser = $parser; + $this->_biffsize = 0; + $this->_palette = array(); + $this->_codepage = 0x04E4; // FIXME: should change for BIFF8 + $this->_country_code = -1; + + $this->_str_total = &$str_total; + $this->_str_unique = &$str_unique; + $this->_str_table = &$str_table; + $this->_setPaletteXl97(); + $this->_tmp_dir = $tempDir; + + $this->_phpExcel = $phpExcel; + + if ($BIFF_version == 0x0600) { + $this->_BIFF_version = 0x0600; + // change BIFFwriter limit for CONTINUE records + $this->_limit = 8224; + $this->_codepage = 0x04B0; + } + + // Add empty sheets + $countSheets = count($phpExcel->getAllSheets()); + for ($i = 0; $i < $countSheets; ++$i) { + $phpSheet = $phpExcel->getSheet($i); + + $this->_parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser + + // for BIFF8 + if ($this->_BIFF_version == 0x0600) { + $supbook_index = 0x00; + $ref = pack('vvv', $supbook_index, $i, $i); + $this->_parser->_references[] = $ref; // Register reference with parser + } + } + } + + /** + * Add a new XF writer + * + * @param PHPExcel_Style + * @param boolean Is it a style XF? + * @return int Index to XF record + */ + public function addXfWriter($style, $isStyleXf = false) + { + $xfWriter = new PHPExcel_Writer_Excel5_Xf($style); + $xfWriter->setBIFFVersion($this->_BIFF_version); + $xfWriter->setIsStyleXf($isStyleXf); + + $xfWriter->setFgColor($this->_addColor($style->getFill()->getStartColor()->getRGB())); + $xfWriter->setBgColor($this->_addColor($style->getFill()->getEndColor()->getRGB())); + $xfWriter->setBottomColor($this->_addColor($style->getBorders()->getBottom()->getColor()->getRGB())); + $xfWriter->setTopColor($this->_addColor($style->getBorders()->getTop()->getColor()->getRGB())); + $xfWriter->setRightColor($this->_addColor($style->getBorders()->getRight()->getColor()->getRGB())); + $xfWriter->setLeftColor($this->_addColor($style->getBorders()->getLeft()->getColor()->getRGB())); + + // Add the font if not already added + $fontHashCode = $style->getFont()->getHashCode(); + + if (isset($this->_addedFonts[$fontHashCode])) { + $fontIndex = $this->_addedFonts[$fontHashCode]; + } else { + $countFonts = count($this->_fontWriters); + $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1; + + $fontWriter = new PHPExcel_Writer_Excel5_Font($style->getFont()); + $fontWriter->setBIFFVersion($this->_BIFF_version); + $fontWriter->setColorIndex($this->_addColor($style->getFont()->getColor()->getRGB())); + $this->_fontWriters[] = $fontWriter; + + $this->_addedFonts[$fontHashCode] = $fontIndex; + } + + // Assign the font index to the xf record + $xfWriter->setFontIndex($fontIndex); + + // Add the number format if it is not a built-in one and not already added + if ($style->getNumberFormat()->getBuiltInFormatCode() === false) { + $numberFormatHashCode = $style->getNumberFormat()->getHashCode(); + + if (isset($this->_addedNumberFormats[$numberFormatHashCode])) { + $numberFormatIndex = $this->_addedNumberFormats[$numberFormatHashCode]; + } else { + $numberFormatIndex = 164 + count($this->_numberFormats); + $this->_numberFormats[$numberFormatIndex] = $style->getNumberFormat(); + $this->_addedNumberFormats[$numberFormatHashCode] = $numberFormatIndex; + } + } + else { + $numberFormatIndex = (int) $style->getNumberFormat()->getBuiltInFormatCode(); + } + + // Assign the number format index to xf record + $xfWriter->setNumberFormatIndex($numberFormatIndex); + + $this->_xfWriters[] = $xfWriter; + + $xfIndex = count($this->_xfWriters) - 1; + return $xfIndex; + } + + /** + * Alter color palette adding a custom color + * + * @param string $rgb E.g. 'FF00AA' + * @return int Color index + */ + private function _addColor($rgb) { + if (!isset($this->_colors[$rgb])) { + if (count($this->_colors) < 57) { + // then we add a custom color altering the palette + $colorIndex = 8 + count($this->_colors); + $this->_palette[$colorIndex] = + array( + hexdec(substr($rgb, 0, 2)), + hexdec(substr($rgb, 2, 2)), + hexdec(substr($rgb, 4)), + 0 + ); + $this->_colors[$rgb] = $colorIndex; + } else { + // no room for more custom colors, just map to black + $colorIndex = 0; + } + } else { + // fetch already added custom color + $colorIndex = $this->_colors[$rgb]; + } + + return $colorIndex; + } + + /** + * Sets the colour palette to the Excel 97+ default. + * + * @access private + */ + function _setPaletteXl97() + { + $this->_palette = array( + 0x08 => array(0x00, 0x00, 0x00, 0x00), + 0x09 => array(0xff, 0xff, 0xff, 0x00), + 0x0A => array(0xff, 0x00, 0x00, 0x00), + 0x0B => array(0x00, 0xff, 0x00, 0x00), + 0x0C => array(0x00, 0x00, 0xff, 0x00), + 0x0D => array(0xff, 0xff, 0x00, 0x00), + 0x0E => array(0xff, 0x00, 0xff, 0x00), + 0x0F => array(0x00, 0xff, 0xff, 0x00), + 0x10 => array(0x80, 0x00, 0x00, 0x00), + 0x11 => array(0x00, 0x80, 0x00, 0x00), + 0x12 => array(0x00, 0x00, 0x80, 0x00), + 0x13 => array(0x80, 0x80, 0x00, 0x00), + 0x14 => array(0x80, 0x00, 0x80, 0x00), + 0x15 => array(0x00, 0x80, 0x80, 0x00), + 0x16 => array(0xc0, 0xc0, 0xc0, 0x00), + 0x17 => array(0x80, 0x80, 0x80, 0x00), + 0x18 => array(0x99, 0x99, 0xff, 0x00), + 0x19 => array(0x99, 0x33, 0x66, 0x00), + 0x1A => array(0xff, 0xff, 0xcc, 0x00), + 0x1B => array(0xcc, 0xff, 0xff, 0x00), + 0x1C => array(0x66, 0x00, 0x66, 0x00), + 0x1D => array(0xff, 0x80, 0x80, 0x00), + 0x1E => array(0x00, 0x66, 0xcc, 0x00), + 0x1F => array(0xcc, 0xcc, 0xff, 0x00), + 0x20 => array(0x00, 0x00, 0x80, 0x00), + 0x21 => array(0xff, 0x00, 0xff, 0x00), + 0x22 => array(0xff, 0xff, 0x00, 0x00), + 0x23 => array(0x00, 0xff, 0xff, 0x00), + 0x24 => array(0x80, 0x00, 0x80, 0x00), + 0x25 => array(0x80, 0x00, 0x00, 0x00), + 0x26 => array(0x00, 0x80, 0x80, 0x00), + 0x27 => array(0x00, 0x00, 0xff, 0x00), + 0x28 => array(0x00, 0xcc, 0xff, 0x00), + 0x29 => array(0xcc, 0xff, 0xff, 0x00), + 0x2A => array(0xcc, 0xff, 0xcc, 0x00), + 0x2B => array(0xff, 0xff, 0x99, 0x00), + 0x2C => array(0x99, 0xcc, 0xff, 0x00), + 0x2D => array(0xff, 0x99, 0xcc, 0x00), + 0x2E => array(0xcc, 0x99, 0xff, 0x00), + 0x2F => array(0xff, 0xcc, 0x99, 0x00), + 0x30 => array(0x33, 0x66, 0xff, 0x00), + 0x31 => array(0x33, 0xcc, 0xcc, 0x00), + 0x32 => array(0x99, 0xcc, 0x00, 0x00), + 0x33 => array(0xff, 0xcc, 0x00, 0x00), + 0x34 => array(0xff, 0x99, 0x00, 0x00), + 0x35 => array(0xff, 0x66, 0x00, 0x00), + 0x36 => array(0x66, 0x66, 0x99, 0x00), + 0x37 => array(0x96, 0x96, 0x96, 0x00), + 0x38 => array(0x00, 0x33, 0x66, 0x00), + 0x39 => array(0x33, 0x99, 0x66, 0x00), + 0x3A => array(0x00, 0x33, 0x00, 0x00), + 0x3B => array(0x33, 0x33, 0x00, 0x00), + 0x3C => array(0x99, 0x33, 0x00, 0x00), + 0x3D => array(0x99, 0x33, 0x66, 0x00), + 0x3E => array(0x33, 0x33, 0x99, 0x00), + 0x3F => array(0x33, 0x33, 0x33, 0x00), + ); + } + + /** + * Assemble worksheets into a workbook and send the BIFF data to an OLE + * storage. + * + * @param array $worksheetSizes The sizes in bytes of the binary worksheet streams + * @return string Binary data for workbook stream + */ + public function writeWorkbook($pWorksheetSizes = null) + { + $this->_worksheetSizes = $pWorksheetSizes; + + // Calculate the number of selected worksheet tabs and call the finalization + // methods for each worksheet + $total_worksheets = count($this->_phpExcel->getAllSheets()); + + // Add part 1 of the Workbook globals, what goes before the SHEET records + $this->_storeBof(0x0005); + $this->_storeCodepage(); + if ($this->_BIFF_version == 0x0600) { + $this->_storeWindow1(); + } + if ($this->_BIFF_version == 0x0500) { + $this->_storeExterns(); // For print area and repeat rows + $this->_storeNames(); // For print area and repeat rows + } + if ($this->_BIFF_version == 0x0500) { + $this->_storeWindow1(); + } + $this->_storeDatemode(); + $this->_storeAllFonts(); + $this->_storeAllNumFormats(); + $this->_storeAllXfs(); + $this->_storeAllStyles(); + $this->_storePalette(); + + // Prepare part 3 of the workbook global stream, what goes after the SHEET records + $part3 = ''; + if ($this->_country_code != -1) { + $part3 .= $this->_writeCountry(); + } + $part3 .= $this->_writeRecalcId(); + + if ($this->_BIFF_version == 0x0600) { + $part3 .= $this->_writeSupbookInternal(); + /* TODO: store external SUPBOOK records and XCT and CRN records + in case of external references for BIFF8 */ + $part3 .= $this->_writeExternsheetBiff8(); + $part3 .= $this->_writeAllDefinedNamesBiff8(); + $part3 .= $this->_writeMsoDrawingGroup(); + $part3 .= $this->_writeSharedStringsTable(); + } + + $part3 .= $this->writeEof(); + + // Add part 2 of the Workbook globals, the SHEET records + $this->_calcSheetOffsets(); + for ($i = 0; $i < $total_worksheets; ++$i) { + $this->_storeBoundsheet($this->_phpExcel->getSheet($i)->getTitle(), $this->_worksheetOffsets[$i]); + } + + // Add part 3 of the Workbook globals + $this->_data .= $part3; + + return $this->_data; + } + + /** + * Calculate offsets for Worksheet BOF records. + * + * @access private + */ + function _calcSheetOffsets() + { + if ($this->_BIFF_version == 0x0600) { + $boundsheet_length = 10; // fixed length for a BOUNDSHEET record + } else { + $boundsheet_length = 11; + } + + // size of Workbook globals part 1 + 3 + $offset = $this->_datasize; + + // add size of Workbook globals part 2, the length of the SHEET records + $total_worksheets = count($this->_phpExcel->getAllSheets()); + foreach ($this->_phpExcel->getWorksheetIterator() as $sheet) { + if ($this->_BIFF_version == 0x0600) { + $offset += $boundsheet_length + strlen(PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle())); + } else { + $offset += $boundsheet_length + strlen($sheet->getTitle()); + } + } + + // add the sizes of each of the Sheet substreams, respectively + for ($i = 0; $i < $total_worksheets; ++$i) { + $this->_worksheetOffsets[$i] = $offset; + $offset += $this->_worksheetSizes[$i]; + } + $this->_biffsize = $offset; + } + + /** + * Store the Excel FONT records. + * + * @access private + */ + function _storeAllFonts() + { + foreach ($this->_fontWriters as $fontWriter) { + $this->_append($fontWriter->writeFont()); + } + } + + /** + * Store user defined numerical formats i.e. FORMAT records + * + * @access private + */ + function _storeAllNumFormats() + { + foreach ($this->_numberFormats as $numberFormatIndex => $numberFormat) { + $this->_storeNumFormat($numberFormat->getFormatCode(), $numberFormatIndex); + } + } + + /** + * Write all XF records. + * + * @access private + */ + function _storeAllXfs() + { + foreach ($this->_xfWriters as $xfWriter) { + $this->_append($xfWriter->writeXf()); + } + } + + /** + * Write all STYLE records. + * + * @access private + */ + function _storeAllStyles() + { + $this->_storeStyle(); + } + + /** + * Write the EXTERNCOUNT and EXTERNSHEET records. These are used as indexes for + * the NAME records. + * + * @access private + */ + function _storeExterns() + { + // Create EXTERNCOUNT with number of worksheets + $this->_storeExterncount(count($this->_phpExcel->getAllSheets())); + + // Create EXTERNSHEET for each worksheet + foreach ($this->_phpExcel->getWorksheetIterator() as $sheet) { + $this->_storeExternsheet($sheet->getTitle()); + } + } + + /** + * Write the NAME record to define the print area and the repeat rows and cols. + * + * @access private + */ + function _storeNames() + { + // total number of sheets + $total_worksheets = count($this->_phpExcel->getAllSheets()); + + // Create the print area NAME records + for ($i = 0; $i < $total_worksheets; ++$i) { + // Write a Name record if the print area has been defined + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isPrintAreaSet()) { + // Print area + $printArea = PHPExcel_Cell::splitRange($this->_phpExcel->getSheet($i)->getPageSetup()->getPrintArea()); + $printArea = $printArea[0]; + $printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]); + $printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]); + + $print_rowmin = $printArea[0][1] - 1; + $print_rowmax = $printArea[1][1] - 1; + $print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1; + $print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1; + + $this->_storeNameShort( + $i, // sheet index + 0x06, // NAME type + $print_rowmin, + $print_rowmax, + $print_colmin, + $print_colmax + ); + } + } + + // Create the print title NAME records + for ($i = 0; $i < $total_worksheets; ++$i) { + + // simultaneous repeatColumns repeatRows + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet() && $this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getColumnsToRepeatAtLeft(); + $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + + $this->_storeNameLong( + $i, // sheet index + 0x07, // NAME type + $rowmin, + $rowmax, + $colmin, + $colmax + ); + + // (exclusive) either repeatColumns or repeatRows + } else if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet() || $this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + + // Columns to repeat + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getColumnsToRepeatAtLeft(); + $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + } else { + $colmin = 0; + $colmax = 255; + } + + // Rows to repeat + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + } else { + $rowmin = 0; + $rowmax = 16383; + } + + $this->_storeNameShort( + $i, // sheet index + 0x07, // NAME type + $rowmin, + $rowmax, + $colmin, + $colmax + ); + } + } + } + + + /** + * Writes all the DEFINEDNAME records (BIFF8). + * So far this is only used for repeating rows/columns (print titles) and print areas + */ + private function _writeAllDefinedNamesBiff8() + { + $chunk = ''; + + // total number of sheets + $total_worksheets = count($this->_phpExcel->getAllSheets()); + + // write the print titles (repeating rows, columns), if any + for ($i = 0; $i < $total_worksheets; ++$i) { + + // simultaneous repeatColumns repeatRows + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet() && $this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getColumnsToRepeatAtLeft(); + $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + + // construct formula data manually + $formulaData = pack('Cv', 0x29, 0x17); // tMemFunc + $formulaData .= pack('Cvvvvv', 0x3B, $i, 0, 65535, $colmin, $colmax); // tArea3d + $formulaData .= pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, 0, 255); // tArea3d + $formulaData .= pack('C', 0x10); // tList + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); + + // (exclusive) either repeatColumns or repeatRows + } else if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet() || $this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + + // Columns to repeat + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getColumnsToRepeatAtLeft(); + $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1; + $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1; + } else { + $colmin = 0; + $colmax = 255; + } + // Rows to repeat + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isRowsToRepeatAtTopSet()) { + $repeat = $this->_phpExcel->getSheet($i)->getPageSetup()->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + } else { + $rowmin = 0; + $rowmax = 65535; + } + + // construct formula data manually because parser does not recognize absolute 3d cell references + $formulaData = pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, $colmin, $colmax); + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); + } + } + + // write the print areas, if any + for ($i = 0; $i < $total_worksheets; ++$i) { + if ($this->_phpExcel->getSheet($i)->getPageSetup()->isPrintAreaSet()) { + // Print area + $printArea = PHPExcel_Cell::splitRange($this->_phpExcel->getSheet($i)->getPageSetup()->getPrintArea()); + $printArea = $printArea[0]; + $printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]); + $printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]); + + $print_rowmin = $printArea[0][1] - 1; + $print_rowmax = $printArea[1][1] - 1; + $print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1; + $print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1; + + // construct formula data manually because parser does not recognize absolute 3d cell references + $formulaData = pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax); + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x06), $formulaData, $i + 1, true)); + } + } + + return $chunk; + } + + /** + * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data + * + * @param string $name The name in UTF-8 + * @param string $formulaData The binary formula data + * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global + * @param boolean $isBuiltIn Built-in name? + * @return string Complete binary record data + */ + private function _writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false) + { + $record = 0x0018; + + // option flags + $options = $isBuiltIn ? 0x20 : 0x00; + + // length of the name, character count + $nlen = PHPExcel_Shared_String::CountCharacters($name); + + // name with stripped length field + $name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2); + + // size of the formula (in bytes) + $sz = strlen($formulaData); + + // combine the parts + $data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0) + . $name . $formulaData; + $length = strlen($data); + + $header = pack('vv', $record, $length); + + return $header . $data; + } + + /** + * Stores the CODEPAGE biff record. + * + * @access private + */ + function _storeCodepage() + { + $record = 0x0042; // Record identifier + $length = 0x0002; // Number of bytes to follow + $cv = $this->_codepage; // The code page + + $header = pack('vv', $record, $length); + $data = pack('v', $cv); + + $this->_append($header . $data); + } + + /** + * Write Excel BIFF WINDOW1 record. + * + * @access private + */ + function _storeWindow1() + { + $record = 0x003D; // Record identifier + $length = 0x0012; // Number of bytes to follow + + $xWn = 0x0000; // Horizontal position of window + $yWn = 0x0000; // Vertical position of window + $dxWn = 0x25BC; // Width of window + $dyWn = 0x1572; // Height of window + + $grbit = 0x0038; // Option flags + + // not supported by PHPExcel, so there is only one selected sheet, the active + $ctabsel = 1; // Number of workbook tabs selected + + $wTabRatio = 0x0258; // Tab to scrollbar ratio + + // not supported by PHPExcel, set to 0 + $itabFirst = 0; // 1st displayed worksheet + $itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet + + $header = pack("vv", $record, $length); + $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, + $grbit, + $itabCur, $itabFirst, + $ctabsel, $wTabRatio); + $this->_append($header . $data); + } + + /** + * Writes Excel BIFF BOUNDSHEET record. + * + * @param string $sheetname Worksheet name + * @param integer $offset Location of worksheet BOF + * @access private + */ + function _storeBoundsheet($sheetname,$offset) + { + $record = 0x0085; // Record identifier + $grbit = 0x0000; // Visibility and sheet type + + if ($this->_BIFF_version == 0x0600) { + $data = pack("Vv", $offset, $grbit); + $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname); + } else { + $cch = strlen($sheetname); // Length of sheet name + $data = pack("VvC", $offset, $grbit, $cch); + $data .= $sheetname; + } + + $length = strlen($data); + $header = pack("vv", $record, $length); + $this->_append($header . $data); + } + + /** + * Write Internal SUPBOOK record + */ + private function _writeSupbookInternal() + { + $record = 0x01AE; // Record identifier + $length = 0x0004; // Bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("vv", count($this->_phpExcel->getAllSheets()), 0x0401); + return $this->writeData($header . $data); + } + + /** + * Writes the Excel BIFF EXTERNSHEET record. These references are used by + * formulas. + * + */ + private function _writeExternsheetBiff8() + { + $total_references = count($this->_parser->_references); + $record = 0x0017; // Record identifier + $length = 2 + 6 * $total_references; // Number of bytes to follow + + $supbook_index = 0; // FIXME: only using internal SUPBOOK record + $header = pack("vv", $record, $length); + $data = pack('v', $total_references); + for ($i = 0; $i < $total_references; ++$i) { + $data .= $this->_parser->_references[$i]; + } + return $this->writeData($header . $data); + } + + /** + * Write Excel BIFF STYLE records. + * + * @access private + */ + function _storeStyle() + { + $record = 0x0293; // Record identifier + $length = 0x0004; // Bytes to follow + + $ixfe = 0x8000; // Index to cell style XF + $BuiltIn = 0x00; // Built-in style + $iLevel = 0xff; // Outline style level + + $header = pack("vv", $record, $length); + $data = pack("vCC", $ixfe, $BuiltIn, $iLevel); + $this->_append($header . $data); + } + + + /** + * Writes Excel FORMAT record for non "built-in" numerical formats. + * + * @param string $format Custom format string + * @param integer $ifmt Format index code + * @access private + */ + function _storeNumFormat($format, $ifmt) + { + $record = 0x041E; // Record identifier + + if ($this->_BIFF_version == 0x0600) { + $numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format); + $length = 2 + strlen($numberFormatString); // Number of bytes to follow + } elseif ($this->_BIFF_version == 0x0500) { + $length = 3 + strlen($format); // Number of bytes to follow + } + + + $header = pack("vv", $record, $length); + if ($this->_BIFF_version == 0x0600) { + $data = pack("v", $ifmt) . $numberFormatString; + $this->_append($header . $data); + } elseif ($this->_BIFF_version == 0x0500) { + $cch = strlen($format); // Length of format string + $data = pack("vC", $ifmt, $cch); + $this->_append($header . $data . $format); + } + } + + /** + * Write DATEMODE record to indicate the date system in use (1904 or 1900). + * + * @access private + */ + function _storeDatemode() + { + $record = 0x0022; // Record identifier + $length = 0x0002; // Bytes to follow + + $f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) ? + 1 : 0; // Flag for 1904 date system + + $header = pack("vv", $record, $length); + $data = pack("v", $f1904); + $this->_append($header . $data); + } + + + /** + * Write BIFF record EXTERNCOUNT to indicate the number of external sheet + * references in the workbook. + * + * Excel only stores references to external sheets that are used in NAME. + * The workbook NAME record is required to define the print area and the repeat + * rows and columns. + * + * A similar method is used in Worksheet.php for a slightly different purpose. + * + * @param integer $cxals Number of external references + * @access private + */ + function _storeExterncount($cxals) + { + $record = 0x0016; // Record identifier + $length = 0x0002; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("v", $cxals); + $this->_append($header . $data); + } + + + /** + * Writes the Excel BIFF EXTERNSHEET record. These references are used by + * formulas. NAME record is required to define the print area and the repeat + * rows and columns. + * + * A similar method is used in Worksheet.php for a slightly different purpose. + * + * @param string $sheetname Worksheet name + * @access private + */ + function _storeExternsheet($sheetname) + { + $record = 0x0017; // Record identifier + $length = 0x02 + strlen($sheetname); // Number of bytes to follow + + $cch = strlen($sheetname); // Length of sheet name + $rgch = 0x03; // Filename encoding + + $header = pack("vv", $record, $length); + $data = pack("CC", $cch, $rgch); + $this->_append($header . $data . $sheetname); + } + + + /** + * Store the NAME record in the short format that is used for storing the print + * area, repeat rows only and repeat columns only. + * + * @param integer $index Sheet index + * @param integer $type Built-in name type + * @param integer $rowmin Start row + * @param integer $rowmax End row + * @param integer $colmin Start colum + * @param integer $colmax End column + * @access private + */ + function _storeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax) + { + $record = 0x0018; // Record identifier + $length = 0x0024; // Number of bytes to follow + + $grbit = 0x0020; // Option flags + $chKey = 0x00; // Keyboard shortcut + $cch = 0x01; // Length of text name + $cce = 0x0015; // Length of text definition + $ixals = $index + 1; // Sheet index + $itab = $ixals; // Equal to ixals + $cchCustMenu = 0x00; // Length of cust menu text + $cchDescription = 0x00; // Length of description text + $cchHelptopic = 0x00; // Length of help topic text + $cchStatustext = 0x00; // Length of status bar text + $rgch = $type; // Built-in name type + + $unknown03 = 0x3b; + $unknown04 = 0xffff-$index; + $unknown05 = 0x0000; + $unknown06 = 0x0000; + $unknown07 = 0x1087; + $unknown08 = 0x8005; + + $header = pack("vv", $record, $length); + $data = pack("v", $grbit); + $data .= pack("C", $chKey); + $data .= pack("C", $cch); + $data .= pack("v", $cce); + $data .= pack("v", $ixals); + $data .= pack("v", $itab); + $data .= pack("C", $cchCustMenu); + $data .= pack("C", $cchDescription); + $data .= pack("C", $cchHelptopic); + $data .= pack("C", $cchStatustext); + $data .= pack("C", $rgch); + $data .= pack("C", $unknown03); + $data .= pack("v", $unknown04); + $data .= pack("v", $unknown05); + $data .= pack("v", $unknown06); + $data .= pack("v", $unknown07); + $data .= pack("v", $unknown08); + $data .= pack("v", $index); + $data .= pack("v", $index); + $data .= pack("v", $rowmin); + $data .= pack("v", $rowmax); + $data .= pack("C", $colmin); + $data .= pack("C", $colmax); + $this->_append($header . $data); + } + + + /** + * Store the NAME record in the long format that is used for storing the repeat + * rows and columns when both are specified. This shares a lot of code with + * _storeNameShort() but we use a separate method to keep the code clean. + * Code abstraction for reuse can be carried too far, and I should know. ;-) + * + * @param integer $index Sheet index + * @param integer $type Built-in name type + * @param integer $rowmin Start row + * @param integer $rowmax End row + * @param integer $colmin Start colum + * @param integer $colmax End column + * @access private + */ + function _storeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax) + { + $record = 0x0018; // Record identifier + $length = 0x003d; // Number of bytes to follow + $grbit = 0x0020; // Option flags + $chKey = 0x00; // Keyboard shortcut + $cch = 0x01; // Length of text name + $cce = 0x002e; // Length of text definition + $ixals = $index + 1; // Sheet index + $itab = $ixals; // Equal to ixals + $cchCustMenu = 0x00; // Length of cust menu text + $cchDescription = 0x00; // Length of description text + $cchHelptopic = 0x00; // Length of help topic text + $cchStatustext = 0x00; // Length of status bar text + $rgch = $type; // Built-in name type + + $unknown01 = 0x29; + $unknown02 = 0x002b; + $unknown03 = 0x3b; + $unknown04 = 0xffff-$index; + $unknown05 = 0x0000; + $unknown06 = 0x0000; + $unknown07 = 0x1087; + $unknown08 = 0x8008; + + $header = pack("vv", $record, $length); + $data = pack("v", $grbit); + $data .= pack("C", $chKey); + $data .= pack("C", $cch); + $data .= pack("v", $cce); + $data .= pack("v", $ixals); + $data .= pack("v", $itab); + $data .= pack("C", $cchCustMenu); + $data .= pack("C", $cchDescription); + $data .= pack("C", $cchHelptopic); + $data .= pack("C", $cchStatustext); + $data .= pack("C", $rgch); + $data .= pack("C", $unknown01); + $data .= pack("v", $unknown02); + // Column definition + $data .= pack("C", $unknown03); + $data .= pack("v", $unknown04); + $data .= pack("v", $unknown05); + $data .= pack("v", $unknown06); + $data .= pack("v", $unknown07); + $data .= pack("v", $unknown08); + $data .= pack("v", $index); + $data .= pack("v", $index); + $data .= pack("v", 0x0000); + $data .= pack("v", 0x3fff); + $data .= pack("C", $colmin); + $data .= pack("C", $colmax); + // Row definition + $data .= pack("C", $unknown03); + $data .= pack("v", $unknown04); + $data .= pack("v", $unknown05); + $data .= pack("v", $unknown06); + $data .= pack("v", $unknown07); + $data .= pack("v", $unknown08); + $data .= pack("v", $index); + $data .= pack("v", $index); + $data .= pack("v", $rowmin); + $data .= pack("v", $rowmax); + $data .= pack("C", 0x00); + $data .= pack("C", 0xff); + // End of data + $data .= pack("C", 0x10); + $this->_append($header . $data); + } + + /** + * Stores the COUNTRY record for localization + * + * @return string + */ + private function _writeCountry() + { + $record = 0x008C; // Record identifier + $length = 4; // Number of bytes to follow + + $header = pack('vv', $record, $length); + /* using the same country code always for simplicity */ + $data = pack('vv', $this->_country_code, $this->_country_code); + //$this->_append($header . $data); + return $this->writeData($header . $data); + } + + /** + * Write the RECALCID record + * + * @return string + */ + private function _writeRecalcId() + { + $record = 0x01C1; // Record identifier + $length = 8; // Number of bytes to follow + + $header = pack('vv', $record, $length); + + // by inspection of real Excel files, MS Office Excel 2007 writes this + $data = pack('VV', 0x000001C1, 0x00001E667); + + return $this->writeData($header . $data); + } + + /** + * Stores the PALETTE biff record. + * + * @access private + */ + function _storePalette() + { + $aref = $this->_palette; + + $record = 0x0092; // Record identifier + $length = 2 + 4 * count($aref); // Number of bytes to follow + $ccv = count($aref); // Number of RGB values to follow + $data = ''; // The RGB data + + // Pack the RGB data + foreach ($aref as $color) { + foreach ($color as $byte) { + $data .= pack("C",$byte); + } + } + + $header = pack("vvv", $record, $length, $ccv); + $this->_append($header . $data); + } + + /** + * Handling of the SST continue blocks is complicated by the need to include an + * additional continuation byte depending on whether the string is split between + * blocks or whether it starts at the beginning of the block. (There are also + * additional complications that will arise later when/if Rich Strings are + * supported). + * + * The Excel documentation says that the SST record should be followed by an + * EXTSST record. The EXTSST record is a hash table that is used to optimise + * access to SST. However, despite the documentation it doesn't seem to be + * required so we will ignore it. + * + * @return string Binary data + */ + private function _writeSharedStringsTable() + { + // maximum size of record data (excluding record header) + $continue_limit = 8224; + + // initialize array of record data blocks + $recordDatas = array(); + + // start SST record data block with total number of strings, total number of unique strings + $recordData = pack("VV", $this->_str_total, $this->_str_unique); + + // loop through all (unique) strings in shared strings table + foreach (array_keys($this->_str_table) as $string) { + + // here $string is a BIFF8 encoded string + + // length = character count + $headerinfo = unpack("vlength/Cencoding", $string); + + // currently, this is always 1 = uncompressed + $encoding = $headerinfo["encoding"]; + + // initialize finished writing current $string + $finished = false; + + while ($finished === false) { + + // normally, there will be only one cycle, but if string cannot immediately be written as is + // there will be need for more than one cylcle, if string longer than one record data block, there + // may be need for even more cycles + + if (strlen($recordData) + strlen($string) < $continue_limit) { + // then we can write the string (or remainder of string) without any problems + $recordData .= $string; + + // we are finished writing this string + $finished = true; + + } else if (strlen($recordData) + strlen($string) == $continue_limit) { + // then we can also write the string (or remainder of string) + $recordData .= $string; + + // but we close the record data block, and initialize a new one + $recordDatas[] = $recordData; + $recordData = ''; + + // we are finished writing this string + $finished = true; + + } else { + // special treatment writing the string (or remainder of the string) + // If the string is very long it may need to be written in more than one CONTINUE record. + + // check how many bytes more there is room for in the current record + $space_remaining = $continue_limit - strlen($recordData); + + // minimum space needed + // uncompressed: 2 byte string length length field + 1 byte option flags + 2 byte character + // compressed: 2 byte string length length field + 1 byte option flags + 1 byte character + $min_space_needed = ($encoding == 1) ? 5 : 4; + + // We have two cases + // 1. space remaining is less than minimum space needed + // here we must waste the space remaining and move to next record data block + // 2. space remaining is greater than or equal to minimum space needed + // here we write as much as we can in the current block, then move to next record data block + + // 1. space remaining is less than minimum space needed + if ($space_remaining < $min_space_needed) { + // we close the block, store the block data + $recordDatas[] = $recordData; + + // and start new record data block where we start writing the string + $recordData = ''; + + // 2. space remaining is greater than or equal to minimum space needed + } else { + // initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below + $effective_space_remaining = $space_remaining; + + // for uncompressed strings, sometimes effective space remaining is reduced by 1 + if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) { + --$effective_space_remaining; + } + + // one block fininshed, store the block data + $recordData .= substr($string, 0, $effective_space_remaining); + + $string = substr($string, $effective_space_remaining); // for next cycle in while loop + $recordDatas[] = $recordData; + + // start new record data block with the repeated option flags + $recordData = pack('C', $encoding); + } + } + } + } + + // Store the last record data block unless it is empty + // if there was no need for any continue records, this will be the for SST record data block itself + if (strlen($recordData) > 0) { + $recordDatas[] = $recordData; + } + + // combine into one chunk with all the blocks SST, CONTINUE,... + $chunk = ''; + foreach ($recordDatas as $i => $recordData) { + // first block should have the SST record header, remaing should have CONTINUE header + $record = ($i == 0) ? 0x00FC : 0x003C; + + $header = pack("vv", $record, strlen($recordData)); + $data = $header . $recordData; + + $chunk .= $this->writeData($data); + } + + return $chunk; + } + + /** + * Writes the MSODRAWINGGROUP record if needed. Possibly split using CONTINUE records. + */ + private function _writeMsoDrawingGroup() + { + // any drawings in this workbook? + $found = false; + foreach ($this->_phpExcel->getAllSheets() as $sheet) { + if (count($sheet->getDrawingCollection()) > 0) { + $found = true; + } + } + + // if there are drawings, then we need to write MSODRAWINGGROUP record + if ($found) { + + // create intermediate Escher object + $escher = new PHPExcel_Shared_Escher(); + + // dggContainer + $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); + $escher->setDggContainer($dggContainer); + + // this loop is for determining maximum shape identifier of all drawing + $spIdMax = 0; + $totalCountShapes = 0; + $countDrawings = 0; + + foreach ($this->_phpExcel->getAllsheets() as $sheet) { + $sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet + + if (count($sheet->getDrawingCollection()) > 0) { + ++$countDrawings; + + foreach ($sheet->getDrawingCollection() as $drawing) { + ++$sheetCountShapes; + ++$totalCountShapes; + + $spId = $sheetCountShapes + | ($this->_phpExcel->getIndex($sheet) + 1) << 10; + $spIdMax = max($spId, $spIdMax); + } + } + } + + $dggContainer->setSpIdMax($spIdMax + 1); + $dggContainer->setCDgSaved($countDrawings); + $dggContainer->setCSpSaved($totalCountShapes + $countDrawings); // total number of shapes incl. one group shapes per drawing + + // bstoreContainer + $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); + $dggContainer->setBstoreContainer($bstoreContainer); + + // the BSE's (all the images) + foreach ($this->_phpExcel->getAllsheets() as $sheet) { + foreach ($sheet->getDrawingCollection() as $drawing) { + if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + + $filename = $drawing->getPath(); + + list($imagesx, $imagesy, $imageFormat) = getimagesize($filename); + + switch ($imageFormat) { + + case 1: // GIF, not supported by BIFF8, we convert to PNG + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $imageResource = imagecreatefromgif($filename); + ob_start(); + imagepng($imageResource); + $blipData = ob_get_contents(); + ob_end_clean(); + break; + + case 2: // JPEG + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; + $blipData = file_get_contents($filename); + break; + + case 3: // PNG + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $blipData = file_get_contents($filename); + break; + + default: continue 2; + + } + + $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip->setData($blipData); + + $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $BSE->setBlipType($blipType); + $BSE->setBlip($blip); + + $bstoreContainer->addBSE($BSE); + + } else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { + + switch ($drawing->getRenderingFunction()) { + + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; + $renderingFunction = 'imagejpeg'; + break; + + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; + $renderingFunction = 'imagepng'; + break; + + } + + ob_start(); + call_user_func($renderingFunction, $drawing->getImageResource()); + $blipData = ob_get_contents(); + ob_end_clean(); + + $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); + $blip->setData($blipData); + + $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); + $BSE->setBlipType($blipType); + $BSE->setBlip($blip); + + $bstoreContainer->addBSE($BSE); + } + } + } + + // write the Escher stream from the intermediate Escher object + $writer = new PHPExcel_Writer_Excel5_Escher($escher); + $data = $writer->close(); + + $record = 0x00EB; + $length = strlen($data); + $header = pack("vv", $record, $length); + + return $this->writeData($header . $data); + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Worksheet.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Worksheet.php new file mode 100644 index 000000000..079947437 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Worksheet.php @@ -0,0 +1,2862 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +// Original file header of PEAR::Spreadsheet_Excel_Writer_Worksheet (used as the base for this class): +// ----------------------------------------------------------------------------------------- +// /* +// * Module written/ported by Xavier Noguer <xnoguer@rezebra.com> +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * <jmcnamara@cpan.org> +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Writer_Excel5_Parser.php */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Parser.php'; + +/** PHPExcel_Writer_Excel5_BIFFwriter.php */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/BIFFwriter.php'; + +/** PHPExcel_Writer_Excel5_Escher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel5/Escher.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_Shared_Excel5 */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Excel5.php'; + +/** PHPExcel_Shared_Escher */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher.php'; + +/** PHPExcel_Shared_Escher_DgContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer.php'; + +/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php'; + +/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php'; + + +/** + * PHPExcel_Writer_Excel5_Worksheet + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter +{ + /** + * Formula parser + * + * @var PHPExcel_Writer_Excel5_Parser + */ + private $_parser; + + /** + * Filehandle to the temporary file for storing data + * @var resource + */ + var $_filehandle; + + /** + * Boolean indicating if we are using a temporary file for storing data + * @var bool + */ + var $_using_tmpfile; + + /** + * Maximum number of characters for a string (LABEL record in BIFF5) + * @var integer + */ + var $_xls_strmax; + + /** + * Array containing format information for columns + * @var array + */ + var $_colinfo; + + /** + * Array containing the selected area for the worksheet + * @var array + */ + var $_selection; + + /** + * The active pane for the worksheet + * @var integer + */ + var $_active_pane; + + /** + * Whether to use outline. + * @var integer + */ + var $_outline_on; + + /** + * Auto outline styles. + * @var bool + */ + var $_outline_style; + + /** + * Whether to have outline summary below. + * @var bool + */ + var $_outline_below; + + /** + * Whether to have outline summary at the right. + * @var bool + */ + var $_outline_right; + + /** + * Reference to the total number of strings in the workbook + * @var integer + */ + var $_str_total; + + /** + * Reference to the number of unique strings in the workbook + * @var integer + */ + var $_str_unique; + + /** + * Reference to the array containing all the unique strings in the workbook + * @var array + */ + var $_str_table; + + /** + * The temporary dir for storing files + * @var string + */ + var $_tmp_dir; + + /** + * List of temporary files created + * @var array + */ + var $_tempFilesCreated = array(); + + /** + * Index of first used row (at least 0) + * @var int + */ + private $_firstRowIndex; + + /** + * Index of last used row. (no used rows means -1) + * @var int + */ + private $_lastRowIndex; + + /** + * Index of first used column (at least 0) + * @var int + */ + private $_firstColumnIndex; + + /** + * Index of last used column (no used columns means -1) + * @var int + */ + private $_lastColumnIndex; + + /** + * Sheet object + * @var PHPExcel_Worksheet + */ + private $_phpSheet; + + /** + * Count cell style Xfs + * + * @var int + */ + private $_countCellStyleXfs; + + /** + * Constructor + * + * @param int $BIFF_version BIFF version + * @param int $str_total Total number of strings + * @param int $str_unique Total number of unique strings + * @param array $str_table + * @param mixed $parser The formula parser created for the Workbook + * @param string $tempDir The temporary directory to be used + * @param PHPExcel_Worksheet $phpSheet + */ + public function __construct($BIFF_version, + &$str_total, + &$str_unique, &$str_table, + $parser, $tempDir = '', $phpSheet) + { + // It needs to call its parent's constructor explicitly + parent::__construct(); + + $this->_BIFF_version = $BIFF_version; + if ($BIFF_version == 0x0600) { + // change BIFFwriter limit for CONTINUE records + $this->_limit = 8224; + } + + + $this->_str_total = &$str_total; + $this->_str_unique = &$str_unique; + $this->_str_table = &$str_table; + $this->_parser = $parser; + + $this->_phpSheet = $phpSheet; + + //$this->ext_sheets = array(); + $this->_filehandle = ''; + $this->_using_tmpfile = true; + //$this->fileclosed = 0; + //$this->offset = 0; + $this->_xls_strmax = 255; + $this->_colinfo = array(); + $this->_selection = array(0,0,0,0); + $this->_active_pane = 3; + + $this->_print_headers = 0; + + $this->_outline_style = 0; + $this->_outline_below = 1; + $this->_outline_right = 1; + $this->_outline_on = 1; + + $this->_dv = array(); + + $this->_tmp_dir = $tempDir; + + // calculate values for DIMENSIONS record + $this->_firstRowIndex = 0; + $this->_lastRowIndex = -1; + $this->_firstColumnIndex = 0; + $this->_lastColumnIndex = -1; + + foreach ($this->_phpSheet->getCellCollection(false) as $cell) { + $row = $cell->getRow() - 1; + $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1; + + // Don't break Excel! + if ($row + 1 > 65536 or $column + 1 > 256) { + break; + } + + $this->_firstRowIndex = min($this->_firstRowIndex, $row); + $this->_lastRowIndex = max($this->_lastRowIndex, $row); + $this->_firstColumnIndex = min($this->_firstColumnIndex, $column); + $this->_lastColumnIndex = max($this->_lastColumnIndex, $column); + } + + $this->_initialize(); + $this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection()); + } + + /** + * Cleanup + */ + public function cleanup() { + @fclose($this->_filehandle); + + foreach ($this->_tempFilesCreated as $file) { + @unlink($file); + } + } + + /** + * Open a tmp file to store the majority of the Worksheet data. If this fails, + * for example due to write permissions, store the data in memory. This can be + * slow for large files. + * + * @access private + */ + function _initialize() + { + // Open tmp file for storing Worksheet data + $fileName = tempnam($this->_tmp_dir, 'XLSHEET'); + $fh = fopen($fileName, 'w+'); + if ($fh) { + // Store filehandle + $this->_filehandle = $fh; + $this->_tempFilesCreated[] = $fileName; + } else { + // If tmpfile() fails store data in memory + $this->_using_tmpfile = false; + } + } + + /** + * Add data to the beginning of the workbook (note the reverse order) + * and to the end of the workbook. + * + * @access public + * @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook() + */ + function close() + { + $num_sheets = count($this->_phpSheet->getParent()->getAllSheets()); + + // Write BOF record + $this->_storeBof(0x0010); + + // Write DEFCOLWIDTH record + $this->_storeDefcol(); + + // Calculate column widths + $this->_phpSheet->calculateColumnWidths(); + + // Column dimensions + $columnDimensions = $this->_phpSheet->getColumnDimensions(); + for ($i = 0; $i < 256; ++$i) { + $width = 9.140625; // assuming Calibri 11 + $hidden = 0; + $level = 0; + + if ($this->_phpSheet->getDefaultColumnDimension()->getWidth() >= 0) { + $width = $this->_phpSheet->getDefaultColumnDimension()->getWidth(); + } + + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($i); + if (isset($columnDimensions[$columnLetter])) { + $columnDimension = $columnDimensions[$columnLetter]; + if ($columnDimension->getWidth() >= 0) { + $width = $columnDimension->getWidth(); + } + $hidden = $columnDimension->getVisible() ? 0 : 1; + $level = $columnDimension->getOutlineLevel(); + } + + $this->_setColumn( $i, $i, $width, null, $hidden, $level); + } + + // Write the COLINFO records if they exist + if (!empty($this->_colinfo)) { + $colcount = count($this->_colinfo); + for ($i = 0; $i < $colcount; ++$i) { + $this->_storeColinfo($this->_colinfo[$i]); + } + } + + // Write EXTERNCOUNT of external references + if ($this->_BIFF_version == 0x0500) { + $this->_storeExterncount($num_sheets); + } + + // Write EXTERNSHEET references + if ($this->_BIFF_version == 0x0500) { + for ($i = 0; $i < $num_sheets; ++$i) { + $this->_storeExternsheet($this->_phpSheet->getParent()->getSheet($i)->getTitle()); + } + } + + // Write PRINTHEADERS + $this->_storePrintHeaders(); + + // Write PRINTGRIDLINES + $this->_storePrintGridlines(); + + // Write GUTS + $this->_storeGuts(); + + // Write GRIDSET + $this->_storeGridset(); + + // Write DEFAULTROWHEIGHT + if ($this->_BIFF_version == 0x0600) { + $this->_storeDefaultRowHeight(); + } + + // Write WSBOOL + $this->_storeWsbool(); + + // Write horizontal and vertical page breaks + $this->_storeBreaks(); + + // Write page header + $this->_storeHeader(); + + // Write page footer + $this->_storeFooter(); + + // Write page horizontal centering + $this->_storeHcenter(); + + // Write page vertical centering + $this->_storeVcenter(); + + // Write left margin + $this->_storeMarginLeft(); + + // Write right margin + $this->_storeMarginRight(); + + // Write top margin + $this->_storeMarginTop(); + + // Write bottom margin + $this->_storeMarginBottom(); + + // Write page setup + $this->_storeSetup(); + + // Write sheet protection + $this->_storeProtect(); + + // Write sheet password + $this->_storePassword(); + + // Write sheet dimensions + $this->_storeDimensions(); + + // Write Cells + foreach ($this->_phpSheet->getCellCollection() as $cell) { + $row = $cell->getRow() - 1; + $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1; + + // Don't break Excel! + if ($row + 1 > 65536 or $column + 1 > 256) { + break; + } + + // Write cell value + $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs + + if ($cell->getValue() instanceof PHPExcel_RichText) { + $this->_writeString($row, $column, $cell->getValue()->getPlainText(), $xfIndex); + } else { + switch ($cell->getDatatype()) { + + case PHPExcel_Cell_DataType::TYPE_STRING: + if ($cell->getValue() === '' or $cell->getValue() === null) { + $this->_writeBlank($row, $column, $xfIndex); + } else { + $this->_writeString($row, $column, $cell->getValue(), $xfIndex); + } + break; + + case PHPExcel_Cell_DataType::TYPE_FORMULA: + $this->_writeFormula($row, $column, $cell->getValue(), $xfIndex); + break; + + case PHPExcel_Cell_DataType::TYPE_BOOL: + $this->_writeBoolErr($row, $column, $cell->getValue(), 0, $xfIndex); + break; + + case PHPExcel_Cell_DataType::TYPE_ERROR: + $this->_writeBoolErr($row, $column, $this->_mapErrorCode($cell->getValue()), 1, $xfIndex); + break; + + case PHPExcel_Cell_DataType::TYPE_NUMERIC: + $this->_writeNumber($row, $column, $cell->getValue(), $xfIndex); + break; + } + + // Hyperlink? + if ($cell->hasHyperlink()) { + $this->_writeUrl($row, $column, str_replace('sheet://', 'internal:', $cell->getHyperlink()->getUrl())); + } + } + } + + // Row dimensions + foreach ($this->_phpSheet->getRowDimensions() as $rowDimension) { + $this->_setRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), null, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() ); + } + + // Append + if ($this->_BIFF_version == 0x0600) { + $this->_storeMsoDrawing(); + } + $this->_storeWindow2(); + $this->_storeZoom(); + if ($this->_phpSheet->getFreezePane()) { + $this->_storePanes(); + } + $this->_storeSelection($this->_selection); + $this->_storeMergedCells(); + /*if ($this->_BIFF_version == 0x0600) { + $this->_storeDataValidity(); + }*/ + + if ($this->_BIFF_version == 0x0600) { + $this->_storeRangeProtection(); + } + + $this->_storeEof(); + } + + /** + * Write a cell range address in BIFF8 + * always fixed range + * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format + * + * @param string $range E.g. 'A1' or 'A1:B6' + * @return string Binary data + */ + private function _writeBIFF8CellRangeAddressFixed($range = 'A1') + { + $explodes = explode(':', $range); + + // extract first cell, e.g. 'A1' + $firstCell = $explodes[0]; + + // extract last cell, e.g. 'B6' + if (count($explodes) == 1) { + $lastCell = $firstCell; + } else { + $lastCell = $explodes[1]; + } + + $firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1) + $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6) + + $data = pack('vvvv', + $firstCellCoordinates[1] - 1, + $lastCellCoordinates[1] - 1, + PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, + PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1 + ); + + return $data; + } + + /** + * Retrieves data from memory in one chunk, or from disk in $buffer + * sized chunks. + * + * @return string The data + */ + function getData() + { + $buffer = 4096; + + // Return data stored in memory + if (isset($this->_data)) { + $tmp = $this->_data; + unset($this->_data); + $fh = $this->_filehandle; + if ($this->_using_tmpfile) { + fseek($fh, 0); + } + return $tmp; + } + // Return data stored on disk + if ($this->_using_tmpfile) { + if ($tmp = fread($this->_filehandle, $buffer)) { + return $tmp; + } + } + + // No data to return + return false; + } + + /** + * Set the width of a single column or a range of columns. + * + * @param integer $firstcol first column on the range + * @param integer $lastcol last column on the range + * @param integer $width width to set + * @param mixed $format The optional XF format to apply to the columns + * @param integer $hidden The optional hidden atribute + * @param integer $level The optional outline level + */ + private function _setColumn($firstcol, $lastcol, $width, $format = null, $hidden = 0, $level = 0) + { + $this->_colinfo[] = array($firstcol, $lastcol, $width, &$format, $hidden, $level); + + // Set width to zero if column is hidden + $width = ($hidden) ? 0 : $width; + } + + /** + * Set which cell or cells are selected in a worksheet + * + * @access public + * @param integer $first_row first row in the selected quadrant + * @param integer $first_column first column in the selected quadrant + * @param integer $last_row last row in the selected quadrant + * @param integer $last_column last column in the selected quadrant + */ + function setSelection($first_row,$first_column,$last_row,$last_column) + { + $this->_selection = array($first_row,$first_column,$last_row,$last_column); + } + + /** + * Set the option to print the row and column headers on the printed page. + * + * @access public + * @param integer $print Whether to print the headers or not. Defaults to 1 (print). + */ + function printRowColHeaders($print = 1) + { + $this->_print_headers = $print; + } + + /** + * Store Worksheet data in memory using the parent's class append() or to a + * temporary file, the default. + * + * @access private + * @param string $data The binary data to append + */ + function _append($data) + { + if ($this->_using_tmpfile) { + // Add CONTINUE records if necessary + if (strlen($data) - 4 > $this->_limit) { + $data = $this->_addContinue($data); + } + fwrite($this->_filehandle, $data); + $this->_datasize += strlen($data); + } else { + parent::_append($data); + } + } + + /** + * This method sets the properties for outlining and grouping. The defaults + * correspond to Excel's defaults. + * + * @param bool $visible + * @param bool $symbols_below + * @param bool $symbols_right + * @param bool $auto_style + */ + function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) + { + $this->_outline_on = $visible; + $this->_outline_below = $symbols_below; + $this->_outline_right = $symbols_right; + $this->_outline_style = $auto_style; + + // Ensure this is a boolean vale for Window2 + if ($this->_outline_on) { + $this->_outline_on = 1; + } + } + + /** + * Write a double to the specified row and column (zero indexed). + * An integer can be written as a double. Excel will display an + * integer. $format is optional. + * + * Returns 0 : normal termination + * -2 : row or column out of range + * + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param float $num The number to write + * @param mixed $format The optional XF format + * @return integer + */ + private function _writeNumber($row, $col, $num, $xfIndex) + { + $record = 0x0203; // Record identifier + $length = 0x000E; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("vvv", $row, $col, $xfIndex); + $xl_double = pack("d", $num); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $xl_double = strrev($xl_double); + } + + $this->_append($header.$data.$xl_double); + return(0); + } + + /** + * Write a LABELSST record or a LABEL record. Which one depends on BIFF version + * + * @param int $row Row index (0-based) + * @param int $col Column index (0-based) + * @param string $str The string + * @param int $xfIndex Index to XF record + */ + private function _writeString($row, $col, $str, $xfIndex) + { + if ($this->_BIFF_version == 0x0600) { + $this->_writeLabelSst($row, $col, $str, $xfIndex); + } else { + $this->_writeLabel($row, $col, $str, $xfIndex); + } + } + /** + * Write a string to the specified row and column (zero indexed). + * NOTE: there is an Excel 5 defined limit of 255 characters. + * $format is optional. + * Returns 0 : normal termination + * -2 : row or column out of range + * -3 : long string truncated to 255 chars + * + * @access public + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param string $str The string to write + * @param mixed $format The XF format for the cell + * @return integer + */ + private function _writeLabel($row, $col, $str, $xfIndex) + { + $strlen = strlen($str); + $record = 0x0204; // Record identifier + $length = 0x0008 + $strlen; // Bytes to follow + + $str_error = 0; + + if ($strlen > $this->_xls_strmax) { // LABEL must be < 255 chars + $str = substr($str, 0, $this->_xls_strmax); + $length = 0x0008 + $this->_xls_strmax; + $strlen = $this->_xls_strmax; + $str_error = -3; + } + + $header = pack("vv", $record, $length); + $data = pack("vvvv", $row, $col, $xfIndex, $strlen); + $this->_append($header . $data . $str); + return($str_error); + } + + /** + * Write a string to the specified row and column (zero indexed). + * This is the BIFF8 version (no 255 chars limit). + * $format is optional. + * Returns 0 : normal termination + * -2 : row or column out of range + * -3 : long string truncated to 255 chars + * + * @access public + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param string $str The string to write + * @param mixed $format The XF format for the cell + * @return integer + */ + private function _writeLabelSst($row, $col, $str, $xfIndex) + { + $record = 0x00FD; // Record identifier + $length = 0x000A; // Bytes to follow + + $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str); + + /* check if string is already present */ + if (!isset($this->_str_table[$str])) { + $this->_str_table[$str] = $this->_str_unique++; + } + $this->_str_total++; + + $header = pack('vv', $record, $length); + $data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]); + $this->_append($header.$data); + } + + /** + * Writes a note associated with the cell given by the row and column. + * NOTE records don't have a length limit. + * + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param string $note The note to write + */ + private function _writeNote($row, $col, $note) + { + $note_length = strlen($note); + $record = 0x001C; // Record identifier + $max_length = 2048; // Maximun length for a NOTE record + //$length = 0x0006 + $note_length; // Bytes to follow + + // Length for this record is no more than 2048 + 6 + $length = 0x0006 + min($note_length, 2048); + $header = pack("vv", $record, $length); + $data = pack("vvv", $row, $col, $note_length); + $this->_append($header . $data . substr($note, 0, 2048)); + + for ($i = $max_length; $i < $note_length; $i += $max_length) { + $chunk = substr($note, $i, $max_length); + $length = 0x0006 + strlen($chunk); + $header = pack("vv", $record, $length); + $data = pack("vvv", -1, 0, strlen($chunk)); + $this->_append($header.$data.$chunk); + } + return(0); + } + + /** + * Write a blank cell to the specified row and column (zero indexed). + * A blank cell is used to specify formatting without adding a string + * or a number. + * + * A blank cell without a format serves no purpose. Therefore, we don't write + * a BLANK record unless a format is specified. + * + * Returns 0 : normal termination (including no format) + * -1 : insufficient number of arguments + * -2 : row or column out of range + * + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param mixed $format The XF format + */ + function _writeBlank($row, $col, $xfIndex) + { + $record = 0x0201; // Record identifier + $length = 0x0006; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("vvv", $row, $col, $xfIndex); + $this->_append($header . $data); + return 0; + } + + /** + * Write a boolean or an error type to the specified row and column (zero indexed) + * + * @param int $row Row index (0-based) + * @param int $col Column index (0-based) + * @param int $value + * @param boolean $isError Error or Boolean? + * @param int $xfIndex + */ + private function _writeBoolErr($row, $col, $value, $isError, $xfIndex) + { + $record = 0x0205; + $length = 8; + + $header = pack("vv", $record, $length); + $data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError); + $this->_append($header . $data); + return 0; + } + + /** + * Write a formula to the specified row and column (zero indexed). + * The textual representation of the formula is passed to the parser in + * Parser.php which returns a packed binary string. + * + * Returns 0 : normal termination + * -1 : formula errors (bad formula) + * -2 : row or column out of range + * + * @param integer $row Zero indexed row + * @param integer $col Zero indexed column + * @param string $formula The formula text string + * @param mixed $format The optional XF format + * @return integer + */ + private function _writeFormula($row, $col, $formula, $xfIndex) + { + $record = 0x0006; // Record identifier + + // Excel normally stores the last calculated value of the formula in $num. + // Clearly we are not in a position to calculate this a priori. Instead + // we set $num to zero and set the option flags in $grbit to ensure + // automatic calculation of the formula when the file is opened. + // + $num = 0x00; // Current value of formula + $grbit = 0x03; // Option flags + $unknown = 0x0000; // Must be zero + + // Strip the '=' or '@' sign at the beginning of the formula string + if (preg_match("/^=/", $formula)) { + $formula = preg_replace("/(^=)/", "", $formula); + } elseif (preg_match("/^@/", $formula)) { + $formula = preg_replace("/(^@)/", "", $formula); + } else { + // Error handling + $this->_writeString($row, $col, 'Unrecognised character for formula'); + return -1; + } + + // Parse the formula using the parser in Parser.php + try { + $error = $this->_parser->parse($formula); + $formula = $this->_parser->toReversePolish(); + + $formlen = strlen($formula); // Length of the binary string + $length = 0x16 + $formlen; // Length of the record data + + $header = pack("vv", $record, $length); + $data = pack("vvvdvVv", $row, $col, $xfIndex, $num, + $grbit, $unknown, $formlen); + $this->_append($header . $data . $formula); + return 0; + + } catch (Exception $e) { + // do nothing + } + + } + + /** + * Write a hyperlink. + * This is comprised of two elements: the visible label and + * the invisible link. The visible label is the same as the link unless an + * alternative string is specified. The label is written using the + * _writeString() method. Therefore the 255 characters string limit applies. + * $string and $format are optional. + * + * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external + * directory url. + * + * Returns 0 : normal termination + * -2 : row or column out of range + * -3 : long string truncated to 255 chars + * + * @param integer $row Row + * @param integer $col Column + * @param string $url URL string + * @return integer + */ + private function _writeUrl($row, $col, $url) + { + // Add start row and col to arg list + return($this->_writeUrlRange($row, $col, $row, $col, $url)); + } + + /** + * This is the more general form of _writeUrl(). It allows a hyperlink to be + * written to a range of cells. This function also decides the type of hyperlink + * to be written. These are either, Web (http, ftp, mailto), Internal + * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1'). + * + * @access private + * @see _writeUrl() + * @param integer $row1 Start row + * @param integer $col1 Start column + * @param integer $row2 End row + * @param integer $col2 End column + * @param string $url URL string + * @return integer + */ + + function _writeUrlRange($row1, $col1, $row2, $col2, $url) + { + + // Check for internal/external sheet links or default to web link + if (preg_match('[^internal:]', $url)) { + return($this->_writeUrlInternal($row1, $col1, $row2, $col2, $url)); + } + if (preg_match('[^external:]', $url)) { + return($this->_writeUrlExternal($row1, $col1, $row2, $col2, $url)); + } + return($this->_writeUrlWeb($row1, $col1, $row2, $col2, $url)); + } + + + /** + * Used to write http, ftp and mailto hyperlinks. + * The link type ($options) is 0x03 is the same as absolute dir ref without + * sheet. However it is differentiated by the $unknown2 data stream. + * + * @access private + * @see _writeUrl() + * @param integer $row1 Start row + * @param integer $col1 Start column + * @param integer $row2 End row + * @param integer $col2 End column + * @param string $url URL string + * @return integer + */ + function _writeUrlWeb($row1, $col1, $row2, $col2, $url) + { + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000"); + $unknown2 = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B"); + + // Pack the option flags + $options = pack("V", 0x03); + + // Convert URL to a null terminated wchar string + $url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY)); + $url = $url . "\0\0\0"; + + // Pack the length of the URL + $url_len = pack("V", strlen($url)); + + // Calculate the data length + $length = 0x34 + strlen($url); + + // Pack the header data + $header = pack("vv", $record, $length); + $data = pack("vvvv", $row1, $row2, $col1, $col2); + + // Write the packed data + $this->_append($header . $data . + $unknown1 . $options . + $unknown2 . $url_len . $url); + return 0; + } + + /** + * Used to write internal reference hyperlinks such as "Sheet1!A1". + * + * @access private + * @see _writeUrl() + * @param integer $row1 Start row + * @param integer $col1 Start column + * @param integer $row2 End row + * @param integer $col2 End column + * @param string $url URL string + * @return integer + */ + function _writeUrlInternal($row1, $col1, $row2, $col2, $url) + { + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Strip URL type + $url = preg_replace('/^internal:/', '', $url); + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000"); + + // Pack the option flags + $options = pack("V", 0x08); + + // Convert the URL type and to a null terminated wchar string + $url .= "\0"; + + // character count + $url_len = PHPExcel_Shared_String::CountCharacters($url); + $url_len = pack('V', $url_len); + + $url = PHPExcel_Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8'); + + // Calculate the data length + $length = 0x24 + strlen($url); + + // Pack the header data + $header = pack("vv", $record, $length); + $data = pack("vvvv", $row1, $row2, $col1, $col2); + + // Write the packed data + $this->_append($header . $data . + $unknown1 . $options . + $url_len . $url); + return 0; + } + + /** + * Write links to external directory names such as 'c:\foo.xls', + * c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'. + * + * Note: Excel writes some relative links with the $dir_long string. We ignore + * these cases for the sake of simpler code. + * + * @access private + * @see _writeUrl() + * @param integer $row1 Start row + * @param integer $col1 Start column + * @param integer $row2 End row + * @param integer $col2 End column + * @param string $url URL string + * @return integer + */ + function _writeUrlExternal($row1, $col1, $row2, $col2, $url) + { + // Network drives are different. We will handle them separately + // MS/Novell network drives and shares start with \\ + if (preg_match('[^external:\\\\]', $url)) { + return; //($this->_writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); + } + + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Strip URL type and change Unix dir separator to Dos style (if needed) + // + $url = preg_replace('/^external:/', '', $url); + $url = preg_replace('/\//', "\\", $url); + + // Determine if the link is relative or absolute: + // relative if link contains no dir separator, "somefile.xls" + // relative if link starts with up-dir, "..\..\somefile.xls" + // otherwise, absolute + + $absolute = 0x02; // Bit mask + if (!preg_match("/\\\/", $url)) { + $absolute = 0x00; + } + if (preg_match("/^\.\.\\\/", $url)) { + $absolute = 0x00; + } + $link_type = 0x01 | $absolute; + + // Determine if the link contains a sheet reference and change some of the + // parameters accordingly. + // Split the dir name and sheet name (if it exists) + /*if (preg_match("/\#/", $url)) { + list($dir_long, $sheet) = split("\#", $url); + } else { + $dir_long = $url; + } + + if (isset($sheet)) { + $link_type |= 0x08; + $sheet_len = pack("V", strlen($sheet) + 0x01); + $sheet = join("\0", split('', $sheet)); + $sheet .= "\0\0\0"; + } else { + $sheet_len = ''; + $sheet = ''; + }*/ + $dir_long = $url; + if (preg_match("/\#/", $url)) { + $link_type |= 0x08; + } + + + + // Pack the link type + $link_type = pack("V", $link_type); + + // Calculate the up-level dir count e.g.. (..\..\..\ == 3) + $up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless); + $up_count = pack("v", $up_count); + + // Store the short dos dir name (null terminated) + $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0"; + + // Store the long dir name as a wchar string (non-null terminated) + //$dir_long = join("\0", split('', $dir_long)); + $dir_long = $dir_long . "\0"; + + // Pack the lengths of the dir strings + $dir_short_len = pack("V", strlen($dir_short) ); + $dir_long_len = pack("V", strlen($dir_long) ); + $stream_len = pack("V", 0);//strlen($dir_long) + 0x06); + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' ); + $unknown2 = pack("H*",'0303000000000000C000000000000046' ); + $unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000'); + $unknown4 = pack("v", 0x03 ); + + // Pack the main data stream + $data = pack("vvvv", $row1, $row2, $col1, $col2) . + $unknown1 . + $link_type . + $unknown2 . + $up_count . + $dir_short_len. + $dir_short . + $unknown3 . + $stream_len ;/*. + $dir_long_len . + $unknown4 . + $dir_long . + $sheet_len . + $sheet ;*/ + + // Pack the header data + $length = strlen($data); + $header = pack("vv", $record, $length); + + // Write the packed data + $this->_append($header. $data); + return 0; + } + + /** + * This method is used to set the height and format for a row. + * + * @param integer $row The row to set + * @param integer $height Height we are giving to the row. + * Use null to set XF without setting height + * @param mixed $format XF format we are giving to the row + * @param bool $hidden The optional hidden attribute + * @param integer $level The optional outline level for row, in range [0,7] + */ + private function _setRow($row, $height, $format = null, $hidden = false, $level = 0) + { + $record = 0x0208; // Record identifier + $length = 0x0010; // Number of bytes to follow + + $colMic = 0x0000; // First defined column + $colMac = 0x0000; // Last defined column + $irwMac = 0x0000; // Used by Excel to optimise loading + $reserved = 0x0000; // Reserved + $grbit = 0x0000; // Option flags + $ixfe = 0x0F; // hard-coding XF index + + if ( $height < 0 ){ + $height = null; + } + + // Use _setRow($row, null, $XF) to set XF format without setting height + if ($height != null) { + $miyRw = $height * 20; // row height + } else { + $miyRw = 0xff; // default row height is 256 + } + + // Set the options flags. fUnsynced is used to show that the font and row + // heights are not compatible. This is usually the case for WriteExcel. + // The collapsed flag 0x10 doesn't seem to be used to indicate that a row + // is collapsed. Instead it is used to indicate that the previous row is + // collapsed. The zero height flag, 0x20, is used to collapse a row. + + $grbit |= $level; + if ($hidden) { + $grbit |= 0x0020; + } + $grbit |= 0x0040; // fUnsynced + if ($format) { + $grbit |= 0x0080; + } + $grbit |= 0x0100; + + $header = pack("vv", $record, $length); + $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, + $irwMac,$reserved, $grbit, $ixfe); + $this->_append($header.$data); + } + + /** + * Writes Excel DIMENSIONS to define the area in which there is data. + * + * @access private + */ + function _storeDimensions() + { + $record = 0x0200; // Record identifier + + if ($this->_BIFF_version == 0x0500) { + $length = 0x000A; // Number of bytes to follow + $data = pack("vvvvv" + , $this->_firstRowIndex + , $this->_lastRowIndex + 1 + , $this->_firstColumnIndex + , $this->_lastColumnIndex + 1 + , 0x0000 // reserved + ); + + } elseif ($this->_BIFF_version == 0x0600) { + $length = 0x000E; + $data = pack('VVvvv' + , $this->_firstRowIndex + , $this->_lastRowIndex + 1 + , $this->_firstColumnIndex + , $this->_lastColumnIndex + 1 + , 0x0000 // reserved + ); + } + + $header = pack("vv", $record, $length); + $this->_append($header.$data); + } + + /** + * Write BIFF record Window2. + * + * @access private + */ + function _storeWindow2() + { + $record = 0x023E; // Record identifier + if ($this->_BIFF_version == 0x0500) { + $length = 0x000A; // Number of bytes to follow + } elseif ($this->_BIFF_version == 0x0600) { + $length = 0x0012; + } + + $grbit = 0x00B6; // Option flags + $rwTop = 0x0000; // Top row visible in window + $colLeft = 0x0000; // Leftmost column visible in window + + + // The options flags that comprise $grbit + $fDspFmla = 0; // 0 - bit + $fDspGrid = $this->_phpSheet->getShowGridlines() ? 1 : 0; // 1 + $fDspRwCol = 1; // 2 + $fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0; // 3 + $fDspZeros = 1; // 4 + $fDefaultHdr = 1; // 5 + $fArabic = $this->_phpSheet->getRightToLeft() ? 1 : 0; // 6 + $fDspGuts = $this->_outline_on; // 7 + $fFrozenNoSplit = 0; // 0 - bit + // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet + $fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0; + $fPaged = 1; // 2 + + $grbit = $fDspFmla; + $grbit |= $fDspGrid << 1; + $grbit |= $fDspRwCol << 2; + $grbit |= $fFrozen << 3; + $grbit |= $fDspZeros << 4; + $grbit |= $fDefaultHdr << 5; + $grbit |= $fArabic << 6; + $grbit |= $fDspGuts << 7; + $grbit |= $fFrozenNoSplit << 8; + $grbit |= $fSelected << 9; + $grbit |= $fPaged << 10; + + $header = pack("vv", $record, $length); + $data = pack("vvv", $grbit, $rwTop, $colLeft); + // FIXME !!! + if ($this->_BIFF_version == 0x0500) { + $rgbHdr = 0x00000000; // Row/column heading and gridline color + $data .= pack("V", $rgbHdr); + } elseif ($this->_BIFF_version == 0x0600) { + $rgbHdr = 0x0040; // Row/column heading and gridline color index + $zoom_factor_page_break = 0x0000; + $zoom_factor_normal = 0x0000; + $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000); + } + $this->_append($header.$data); + } + + /** + * Write BIFF record DEFAULTROWHEIGHT. + * + * @access private + */ + private function _storeDefaultRowHeight() + { + $defaultRowHeight = $this->_phpSheet->getDefaultRowDimension()->getRowHeight(); + + if ($defaultRowHeight < 0) { + return; + } + + // convert to twips + $defaultRowHeight = (int) 20 * $defaultRowHeight; + + $record = 0x0225; // Record identifier + $length = 0x0004; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("vv", 1, $defaultRowHeight); + $this->_append($header . $data); + } + + /** + * Write BIFF record DEFCOLWIDTH if COLINFO records are in use. + * + * @access private + */ + function _storeDefcol() + { + $defaultColWidth = 8; + + $record = 0x0055; // Record identifier + $length = 0x0002; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("v", $defaultColWidth); + $this->_append($header . $data); + } + + /** + * Write BIFF record COLINFO to define column widths + * + * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C + * length record. + * + * @access private + * @param array $col_array This is the only parameter received and is composed of the following: + * 0 => First formatted column, + * 1 => Last formatted column, + * 2 => Col width (8.43 is Excel default), + * 3 => The optional XF format of the column, + * 4 => Option flags. + * 5 => Optional outline level + */ + function _storeColinfo($col_array) + { + if (isset($col_array[0])) { + $colFirst = $col_array[0]; + } + if (isset($col_array[1])) { + $colLast = $col_array[1]; + } + if (isset($col_array[2])) { + $coldx = $col_array[2]; + } else { + $coldx = 8.43; + } + if (isset($col_array[3])) { + $format = $col_array[3]; + } else { + $format = 0; + } + if (isset($col_array[4])) { + $grbit = $col_array[4]; + } else { + $grbit = 0; + } + if (isset($col_array[5])) { + $level = $col_array[5]; + } else { + $level = 0; + } + $record = 0x007D; // Record identifier + $length = 0x000B; // Number of bytes to follow + + $coldx *= 256; // Convert to units of 1/256 of a char + + $ixfe = 0x0F; // hard-coding XF index + $reserved = 0x00; // Reserved + + $level = max(0, min($level, 7)); + $grbit |= $level << 8; + + $header = pack("vv", $record, $length); + $data = pack("vvvvvC", $colFirst, $colLast, $coldx, + $ixfe, $grbit, $reserved); + $this->_append($header.$data); + } + + /** + * Write BIFF record SELECTION. + * + * @access private + * @param array $array array containing ($rwFirst,$colFirst,$rwLast,$colLast) + * @see setSelection() + */ + function _storeSelection($array) + { + list($rwFirst,$colFirst,$rwLast,$colLast) = $array; + $record = 0x001D; // Record identifier + $length = 0x000F; // Number of bytes to follow + + $pnn = $this->_active_pane; // Pane position + $rwAct = $rwFirst; // Active row + $colAct = $colFirst; // Active column + $irefAct = 0; // Active cell ref + $cref = 1; // Number of refs + + if (!isset($rwLast)) { + $rwLast = $rwFirst; // Last row in reference + } + if (!isset($colLast)) { + $colLast = $colFirst; // Last col in reference + } + + // Swap last row/col for first row/col as necessary + if ($rwFirst > $rwLast) { + list($rwFirst, $rwLast) = array($rwLast, $rwFirst); + } + + if ($colFirst > $colLast) { + list($colFirst, $colLast) = array($colLast, $colFirst); + } + + $header = pack("vv", $record, $length); + $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, + $irefAct, $cref, + $rwFirst, $rwLast, + $colFirst, $colLast); + $this->_append($header . $data); + } + + /** + * Store the MERGEDCELLS records for all ranges of merged cells + * + * @access private + */ + function _storeMergedCells() + { + $mergeCells = $this->_phpSheet->getMergeCells(); + $countMergeCells = count($mergeCells); + + if ($countMergeCells == 0) { + return; + } + + // maximum allowed number of merged cells per record + if ($this->_BIFF_version == 0x0600) { + $maxCountMergeCellsPerRecord = 1027; + } else { + $maxCountMergeCellsPerRecord = 259; + } + + // record identifier + $record = 0x00E5; + + // counter for total number of merged cells treated so far by the writer + $i = 0; + + // counter for number of merged cells written in record currently being written + $j = 0; + + // initialize record data + $recordData = ''; + + // loop through the merged cells + foreach ($mergeCells as $mergeCell) { + ++$i; + ++$j; + + // extract the row and column indexes + $range = PHPExcel_Cell::splitRange($mergeCell); + list($first, $last) = $range[0]; + list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first); + list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last); + + $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1); + + // flush record if we have reached limit for number of merged cells, or reached final merged cell + if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) { + $recordData = pack('v', $j) . $recordData; + $length = strlen($recordData); + $header = pack('vv', $record, $length); + $this->_append($header . $recordData); + + // initialize for next record, if any + $recordData = ''; + $j = 0; + } + } + } + + /** + * Write BIFF record RANGEPROTECTION + * + * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records + * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records + */ + private function _storeRangeProtection() + { + foreach ($this->_phpSheet->getProtectedCells() as $range => $password) { + // number of ranges, e.g. 'A1:B3 C20:D25' + $cellRanges = explode(' ', $range); + $cref = count($cellRanges); + + $recordData = pack( + 'vvVVvCVvVv', + 0x0868, + 0x00, + 0x0000, + 0x0000, + 0x02, + 0x0, + 0x0000, + $cref, + 0x0000, + 0x00 + ); + + foreach ($cellRanges as $cellRange) { + $recordData .= $this->_writeBIFF8CellRangeAddressFixed($cellRange); + } + + // the rgbFeat structure + $recordData .= pack( + 'VV', + 0x0000, + hexdec($password) + ); + + $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); + + $length = strlen($recordData); + + $record = 0x0868; // Record identifier + $header = pack("vv", $record, $length); + $this->_append($header . $recordData); + } + } + + /** + * Write BIFF record EXTERNCOUNT to indicate the number of external sheet + * references in a worksheet. + * + * Excel only stores references to external sheets that are used in formulas. + * For simplicity we store references to all the sheets in the workbook + * regardless of whether they are used or not. This reduces the overall + * complexity and eliminates the need for a two way dialogue between the formula + * parser the worksheet objects. + * + * @access private + * @param integer $count The number of external sheet references in this worksheet + */ + function _storeExterncount($count) + { + $record = 0x0016; // Record identifier + $length = 0x0002; // Number of bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("v", $count); + $this->_append($header . $data); + } + + /** + * Writes the Excel BIFF EXTERNSHEET record. These references are used by + * formulas. A formula references a sheet name via an index. Since we store a + * reference to all of the external worksheets the EXTERNSHEET index is the same + * as the worksheet index. + * + * @access private + * @param string $sheetname The name of a external worksheet + */ + function _storeExternsheet($sheetname) + { + $record = 0x0017; // Record identifier + + // References to the current sheet are encoded differently to references to + // external sheets. + // + if ($this->_phpSheet->getTitle() == $sheetname) { + $sheetname = ''; + $length = 0x02; // The following 2 bytes + $cch = 1; // The following byte + $rgch = 0x02; // Self reference + } else { + $length = 0x02 + strlen($sheetname); + $cch = strlen($sheetname); + $rgch = 0x03; // Reference to a sheet in the current workbook + } + + $header = pack("vv", $record, $length); + $data = pack("CC", $cch, $rgch); + $this->_append($header . $data . $sheetname); + } + + /** + * Writes the Excel BIFF PANE record. + * The panes can either be frozen or thawed (unfrozen). + * Frozen panes are specified in terms of an integer number of rows and columns. + * Thawed panes are specified in terms of Excel's units for rows and columns. + * + * @access private + */ + function _storePanes() + { + $panes = array(); + if ($freezePane = $this->_phpSheet->getFreezePane()) { + list($column, $row) = PHPExcel_Cell::coordinateFromString($freezePane); + $panes[0] = $row - 1; + $panes[1] = PHPExcel_Cell::columnIndexFromString($column) - 1; + } else { + // thaw panes + return; + } + + $y = isset($panes[0]) ? $panes[0] : null; + $x = isset($panes[1]) ? $panes[1] : null; + $rwTop = isset($panes[2]) ? $panes[2] : null; + $colLeft = isset($panes[3]) ? $panes[3] : null; + if (count($panes) > 4) { // if Active pane was received + $pnnAct = $panes[4]; + } else { + $pnnAct = null; + } + $record = 0x0041; // Record identifier + $length = 0x000A; // Number of bytes to follow + + // Code specific to frozen or thawed panes. + if ($this->_phpSheet->getFreezePane()) { + // Set default values for $rwTop and $colLeft + if (!isset($rwTop)) { + $rwTop = $y; + } + if (!isset($colLeft)) { + $colLeft = $x; + } + } else { + // Set default values for $rwTop and $colLeft + if (!isset($rwTop)) { + $rwTop = 0; + } + if (!isset($colLeft)) { + $colLeft = 0; + } + + // Convert Excel's row and column units to the internal units. + // The default row height is 12.75 + // The default column width is 8.43 + // The following slope and intersection values were interpolated. + // + $y = 20*$y + 255; + $x = 113.879*$x + 390; + } + + + // Determine which pane should be active. There is also the undocumented + // option to override this should it be necessary: may be removed later. + // + if (!isset($pnnAct)) { + if ($x != 0 && $y != 0) { + $pnnAct = 0; // Bottom right + } + if ($x != 0 && $y == 0) { + $pnnAct = 1; // Top right + } + if ($x == 0 && $y != 0) { + $pnnAct = 2; // Bottom left + } + if ($x == 0 && $y == 0) { + $pnnAct = 3; // Top left + } + } + + $this->_active_pane = $pnnAct; // Used in _storeSelection + + $header = pack("vv", $record, $length); + $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct); + $this->_append($header . $data); + } + + /** + * Store the page setup SETUP BIFF record. + * + * @access private + */ + function _storeSetup() + { + $record = 0x00A1; // Record identifier + $length = 0x0022; // Number of bytes to follow + + $iPaperSize = $this->_phpSheet->getPageSetup()->getPaperSize(); // Paper size + + $iScale = $this->_phpSheet->getPageSetup()->getScale() ? + $this->_phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor + + $iPageStart = 0x01; // Starting page number + $iFitWidth = (int) $this->_phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide + $iFitHeight = (int) $this->_phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high + $grbit = 0x00; // Option flags + $iRes = 0x0258; // Print resolution + $iVRes = 0x0258; // Vertical print resolution + + $numHdr = $this->_phpSheet->getPageMargins()->getHeader(); // Header Margin + + $numFtr = $this->_phpSheet->getPageMargins()->getFooter(); // Footer Margin + $iCopies = 0x01; // Number of copies + + $fLeftToRight = 0x0; // Print over then down + + // Page orientation + $fLandscape = ($this->_phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? + 0x0 : 0x1; + + $fNoPls = 0x0; // Setup not read from printer + $fNoColor = 0x0; // Print black and white + $fDraft = 0x0; // Print draft quality + $fNotes = 0x0; // Print notes + $fNoOrient = 0x0; // Orientation not set + $fUsePage = 0x0; // Use custom starting page + + $grbit = $fLeftToRight; + $grbit |= $fLandscape << 1; + $grbit |= $fNoPls << 2; + $grbit |= $fNoColor << 3; + $grbit |= $fDraft << 4; + $grbit |= $fNotes << 5; + $grbit |= $fNoOrient << 6; + $grbit |= $fUsePage << 7; + + $numHdr = pack("d", $numHdr); + $numFtr = pack("d", $numFtr); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $numHdr = strrev($numHdr); + $numFtr = strrev($numFtr); + } + + $header = pack("vv", $record, $length); + $data1 = pack("vvvvvvvv", $iPaperSize, + $iScale, + $iPageStart, + $iFitWidth, + $iFitHeight, + $grbit, + $iRes, + $iVRes); + $data2 = $numHdr.$numFtr; + $data3 = pack("v", $iCopies); + $this->_append($header . $data1 . $data2 . $data3); + } + + /** + * Store the header caption BIFF record. + * + * @access private + */ + function _storeHeader() + { + $record = 0x0014; // Record identifier + + /* removing for now + // need to fix character count (multibyte!) + if (strlen($this->_phpSheet->getHeaderFooter()->getOddHeader()) <= 255) { + $str = $this->_phpSheet->getHeaderFooter()->getOddHeader(); // header string + } else { + $str = ''; + } + */ + + if ($this->_BIFF_version == 0x0600) { + $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddHeader()); + $length = strlen($recordData); + } else { + $cch = strlen($this->_phpSheet->getHeaderFooter()->getOddHeader()); // Length of header string + $length = 1 + $cch; // Bytes to follow + $data = pack("C", $cch); + $recordData = $data . $this->_phpSheet->getHeaderFooter()->getOddHeader(); + } + + $header = pack("vv", $record, $length); + + $this->_append($header . $recordData); + } + + /** + * Store the footer caption BIFF record. + * + * @access private + */ + function _storeFooter() + { + $record = 0x0015; // Record identifier + + /* removing for now + // need to fix character count (multibyte!) + if (strlen($this->_phpSheet->getHeaderFooter()->getOddFooter()) <= 255) { + $str = $this->_phpSheet->getHeaderFooter()->getOddFooter(); + } else { + $str = ''; + } + */ + + if ($this->_BIFF_version == 0x0600) { + $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddFooter()); + $length = strlen($recordData); + } else { + $cch = strlen($this->_phpSheet->getHeaderFooter()->getOddFooter()); // Length of footer string + $length = 1 + $cch; + $data = pack("C", $cch); + $recordData = $data . $this->_phpSheet->getHeaderFooter()->getOddFooter(); + } + + $header = pack("vv", $record, $length); + + $this->_append($header . $recordData); + } + + /** + * Store the horizontal centering HCENTER BIFF record. + * + * @access private + */ + function _storeHcenter() + { + $record = 0x0083; // Record identifier + $length = 0x0002; // Bytes to follow + + $fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering + + $header = pack("vv", $record, $length); + $data = pack("v", $fHCenter); + + $this->_append($header.$data); + } + + /** + * Store the vertical centering VCENTER BIFF record. + * + * @access private + */ + function _storeVcenter() + { + $record = 0x0084; // Record identifier + $length = 0x0002; // Bytes to follow + + $fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering + + $header = pack("vv", $record, $length); + $data = pack("v", $fVCenter); + $this->_append($header . $data); + } + + /** + * Store the LEFTMARGIN BIFF record. + * + * @access private + */ + function _storeMarginLeft() + { + $record = 0x0026; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches + + $header = pack("vv", $record, $length); + $data = pack("d", $margin); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->_append($header . $data); + } + + /** + * Store the RIGHTMARGIN BIFF record. + * + * @access private + */ + function _storeMarginRight() + { + $record = 0x0027; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches + + $header = pack("vv", $record, $length); + $data = pack("d", $margin); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->_append($header . $data); + } + + /** + * Store the TOPMARGIN BIFF record. + * + * @access private + */ + function _storeMarginTop() + { + $record = 0x0028; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches + + $header = pack("vv", $record, $length); + $data = pack("d", $margin); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->_append($header . $data); + } + + /** + * Store the BOTTOMMARGIN BIFF record. + * + * @access private + */ + function _storeMarginBottom() + { + $record = 0x0029; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches + + $header = pack("vv", $record, $length); + $data = pack("d", $margin); + if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->_append($header . $data); + } + + /** + * Write the PRINTHEADERS BIFF record. + * + * @access private + */ + function _storePrintHeaders() + { + $record = 0x002a; // Record identifier + $length = 0x0002; // Bytes to follow + + $fPrintRwCol = $this->_print_headers; // Boolean flag + + $header = pack("vv", $record, $length); + $data = pack("v", $fPrintRwCol); + $this->_append($header . $data); + } + + /** + * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the + * GRIDSET record. + * + * @access private + */ + function _storePrintGridlines() + { + $record = 0x002b; // Record identifier + $length = 0x0002; // Bytes to follow + + $fPrintGrid = $this->_phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag + + $header = pack("vv", $record, $length); + $data = pack("v", $fPrintGrid); + $this->_append($header . $data); + } + + /** + * Write the GRIDSET BIFF record. Must be used in conjunction with the + * PRINTGRIDLINES record. + * + * @access private + */ + function _storeGridset() + { + $record = 0x0082; // Record identifier + $length = 0x0002; // Bytes to follow + + $fGridSet = !$this->_phpSheet->getPrintGridlines(); // Boolean flag + + $header = pack("vv", $record, $length); + $data = pack("v", $fGridSet); + $this->_append($header . $data); + } + + /** + * Write the GUTS BIFF record. This is used to configure the gutter margins + * where Excel outline symbols are displayed. The visibility of the gutters is + * controlled by a flag in WSBOOL. + * + * @see _storeWsbool() + * @access private + */ + function _storeGuts() + { + $record = 0x0080; // Record identifier + $length = 0x0008; // Bytes to follow + + $dxRwGut = 0x0000; // Size of row gutter + $dxColGut = 0x0000; // Size of col gutter + + // determine maximum row outline level + $maxRowOutlineLevel = 0; + foreach ($this->_phpSheet->getRowDimensions() as $rowDimension) { + $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel()); + } + + $col_level = 0; + + // Calculate the maximum column outline level. The equivalent calculation + // for the row outline level is carried out in _setRow(). + $colcount = count($this->_colinfo); + for ($i = 0; $i < $colcount; ++$i) { + $col_level = max($this->_colinfo[$i][5], $col_level); + } + + // Set the limits for the outline levels (0 <= x <= 7). + $col_level = max(0, min($col_level, 7)); + + // The displayed level is one greater than the max outline levels + if ($maxRowOutlineLevel) { + ++$maxRowOutlineLevel; + } + if ($col_level) { + ++$col_level; + } + + $header = pack("vv", $record, $length); + $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); + + $this->_append($header.$data); + } + + + /** + * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction + * with the SETUP record. + * + * @access private + */ + function _storeWsbool() + { + $record = 0x0081; // Record identifier + $length = 0x0002; // Bytes to follow + $grbit = 0x0000; + + // The only option that is of interest is the flag for fit to page. So we + // set all the options in one go. + // + // Set the option flags + $grbit |= 0x0001; // Auto page breaks visible + if ($this->_outline_style) { + $grbit |= 0x0020; // Auto outline styles + } + if ($this->_phpSheet->getShowSummaryBelow()) { + $grbit |= 0x0040; // Outline summary below + } + if ($this->_phpSheet->getShowSummaryRight()) { + $grbit |= 0x0080; // Outline summary right + } + if ($this->_phpSheet->getPageSetup()->getFitToWidth() || $this->_phpSheet->getPageSetup()->getFitToHeight()) { + $grbit |= 0x0100; // Page setup fit to page + } + if ($this->_outline_on) { + $grbit |= 0x0400; // Outline symbols displayed + } + + $header = pack("vv", $record, $length); + $data = pack("v", $grbit); + $this->_append($header . $data); + } + + /** + * Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records. + */ + private function _storeBreaks() + { + // initialize + $vbreaks = array(); + $hbreaks = array(); + + foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) { + // Fetch coordinates + $coordinates = PHPExcel_Cell::coordinateFromString($cell); + + // Decide what to do by the type of break + switch ($breakType) { + case PHPExcel_Worksheet::BREAK_COLUMN: + // Add to list of vertical breaks + $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1; + break; + + case PHPExcel_Worksheet::BREAK_ROW: + // Add to list of horizontal breaks + $hbreaks[] = $coordinates[1]; + break; + + case PHPExcel_Worksheet::BREAK_NONE: + default: + // Nothing to do + break; + } + } + + //horizontal page breaks + if (count($hbreaks) > 0) { + + // Sort and filter array of page breaks + sort($hbreaks, SORT_NUMERIC); + if ($hbreaks[0] == 0) { // don't use first break if it's 0 + array_shift($hbreaks); + } + + $record = 0x001b; // Record identifier + $cbrk = count($hbreaks); // Number of page breaks + if ($this->_BIFF_version == 0x0600) { + $length = 2 + 6 * $cbrk; // Bytes to follow + } else { + $length = 2 + 2 * $cbrk; // Bytes to follow + } + + $header = pack("vv", $record, $length); + $data = pack("v", $cbrk); + + // Append each page break + foreach ($hbreaks as $hbreak) { + if ($this->_BIFF_version == 0x0600) { + $data .= pack("vvv", $hbreak, 0x0000, 0x00ff); + } else { + $data .= pack("v", $hbreak); + } + } + + $this->_append($header . $data); + } + + // vertical page breaks + if (count($vbreaks) > 0) { + + // 1000 vertical pagebreaks appears to be an internal Excel 5 limit. + // It is slightly higher in Excel 97/200, approx. 1026 + $vbreaks = array_slice($vbreaks, 0, 1000); + + // Sort and filter array of page breaks + sort($vbreaks, SORT_NUMERIC); + if ($vbreaks[0] == 0) { // don't use first break if it's 0 + array_shift($vbreaks); + } + + $record = 0x001a; // Record identifier + $cbrk = count($vbreaks); // Number of page breaks + if ($this->_BIFF_version == 0x0600) { + $length = 2 + 6 * $cbrk; // Bytes to follow + } else { + $length = 2 + 2 * $cbrk; // Bytes to follow + } + + $header = pack("vv", $record, $length); + $data = pack("v", $cbrk); + + // Append each page break + foreach ($vbreaks as $vbreak) { + if ($this->_BIFF_version == 0x0600) { + $data .= pack("vvv", $vbreak, 0x0000, 0xffff); + } else { + $data .= pack("v", $vbreak); + } + } + + $this->_append($header . $data); + } + } + + /** + * Set the Biff PROTECT record to indicate that the worksheet is protected. + * + * @access private + */ + function _storeProtect() + { + // Exit unless sheet protection has been specified + if (!$this->_phpSheet->getProtection()->getSheet()) { + return; + } + + $record = 0x0012; // Record identifier + $length = 0x0002; // Bytes to follow + + $fLock = 1; // Worksheet is protected + + $header = pack("vv", $record, $length); + $data = pack("v", $fLock); + + $this->_append($header.$data); + } + + /** + * Write the worksheet PASSWORD record. + * + * @access private + */ + function _storePassword() + { + // Exit unless sheet protection and password have been specified + if (!$this->_phpSheet->getProtection()->getSheet() || !$this->_phpSheet->getProtection()->getPassword()) { + return; + } + + $record = 0x0013; // Record identifier + $length = 0x0002; // Bytes to follow + + $wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password + + $header = pack("vv", $record, $length); + $data = pack("v", $wPassword); + + $this->_append($header . $data); + } + + + /** + * Insert a 24bit bitmap image in a worksheet. + * + * @access public + * @param integer $row The row we are going to insert the bitmap into + * @param integer $col The column we are going to insert the bitmap into + * @param mixed $bitmap The bitmap filename or GD-image resource + * @param integer $x The horizontal position (offset) of the image inside the cell. + * @param integer $y The vertical position (offset) of the image inside the cell. + * @param float $scale_x The horizontal scale + * @param float $scale_y The vertical scale + */ + function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) + { + $bitmap_array = (is_resource($bitmap) ? $this->_processBitmapGd($bitmap) : $this->_processBitmap($bitmap)); + list($width, $height, $size, $data) = $bitmap_array; //$this->_processBitmap($bitmap); + + // Scale the frame of the image. + $width *= $scale_x; + $height *= $scale_y; + + // Calculate the vertices of the image and write the OBJ record + $this->_positionImage($col, $row, $x, $y, $width, $height); + + // Write the IMDATA record to store the bitmap data + $record = 0x007f; + $length = 8 + $size; + $cf = 0x09; + $env = 0x01; + $lcb = $size; + + $header = pack("vvvvV", $record, $length, $cf, $env, $lcb); + $this->_append($header.$data); + } + + /** + * Calculate the vertices that define the position of the image as required by + * the OBJ record. + * + * +------------+------------+ + * | A | B | + * +-----+------------+------------+ + * | |(x1,y1) | | + * | 1 |(A1)._______|______ | + * | | | | | + * | | | | | + * +-----+----| BITMAP |-----+ + * | | | | | + * | 2 | |______________. | + * | | | (B2)| + * | | | (x2,y2)| + * +---- +------------+------------+ + * + * Example of a bitmap that covers some of the area from cell A1 to cell B2. + * + * Based on the width and height of the bitmap we need to calculate 8 vars: + * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. + * The width and height of the cells are also variable and have to be taken into + * account. + * The values of $col_start and $row_start are passed in from the calling + * function. The values of $col_end and $row_end are calculated by subtracting + * the width and height of the bitmap from the width and height of the + * underlying cells. + * The vertices are expressed as a percentage of the underlying cell width as + * follows (rhs values are in pixels): + * + * x1 = X / W *1024 + * y1 = Y / H *256 + * x2 = (X-1) / W *1024 + * y2 = (Y-1) / H *256 + * + * Where: X is distance from the left side of the underlying cell + * Y is distance from the top of the underlying cell + * W is the width of the cell + * H is the height of the cell + * The SDK incorrectly states that the height should be expressed as a + * percentage of 1024. + * + * @access private + * @param integer $col_start Col containing upper left corner of object + * @param integer $row_start Row containing top left corner of object + * @param integer $x1 Distance to left side of object + * @param integer $y1 Distance to top of object + * @param integer $width Width of image frame + * @param integer $height Height of image frame + */ + function _positionImage($col_start, $row_start, $x1, $y1, $width, $height) + { + // Initialise end cell to the same as the start cell + $col_end = $col_start; // Col containing lower right corner of object + $row_end = $row_start; // Row containing bottom right corner of object + + // Zero the specified offset if greater than the cell dimensions + if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) { + $x1 = 0; + } + if ($y1 >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1)) { + $y1 = 0; + } + + $width = $width + $x1 -1; + $height = $height + $y1 -1; + + // Subtract the underlying cell widths to find the end cell of the image + while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) { + $width -= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)); + ++$col_end; + } + + // Subtract the underlying cell heights to find the end cell of the image + while ($height >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1)) { + $height -= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1); + ++$row_end; + } + + // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell + // with zero eight or width. + // + if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) { + return; + } + if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) { + return; + } + if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) == 0) { + return; + } + if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) { + return; + } + + // Convert the pixel values to the percentage value expected by Excel + $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024; + $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256; + $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object + + $this->_storeObjPicture($col_start, $x1, + $row_start, $y1, + $col_end, $x2, + $row_end, $y2); + } + + /** + * Store the OBJ record that precedes an IMDATA record. This could be generalise + * to support other Excel objects. + * + * @access private + * @param integer $colL Column containing upper left corner of object + * @param integer $dxL Distance from left side of cell + * @param integer $rwT Row containing top left corner of object + * @param integer $dyT Distance from top of cell + * @param integer $colR Column containing lower right corner of object + * @param integer $dxR Distance from right of cell + * @param integer $rwB Row containing bottom right corner of object + * @param integer $dyB Distance from bottom of cell + */ + function _storeObjPicture($colL,$dxL,$rwT,$dyT,$colR,$dxR,$rwB,$dyB) + { + $record = 0x005d; // Record identifier + $length = 0x003c; // Bytes to follow + + $cObj = 0x0001; // Count of objects in file (set to 1) + $OT = 0x0008; // Object type. 8 = Picture + $id = 0x0001; // Object ID + $grbit = 0x0614; // Option flags + + $cbMacro = 0x0000; // Length of FMLA structure + $Reserved1 = 0x0000; // Reserved + $Reserved2 = 0x0000; // Reserved + + $icvBack = 0x09; // Background colour + $icvFore = 0x09; // Foreground colour + $fls = 0x00; // Fill pattern + $fAuto = 0x00; // Automatic fill + $icv = 0x08; // Line colour + $lns = 0xff; // Line style + $lnw = 0x01; // Line weight + $fAutoB = 0x00; // Automatic border + $frs = 0x0000; // Frame style + $cf = 0x0009; // Image format, 9 = bitmap + $Reserved3 = 0x0000; // Reserved + $cbPictFmla = 0x0000; // Length of FMLA structure + $Reserved4 = 0x0000; // Reserved + $grbit2 = 0x0001; // Option flags + $Reserved5 = 0x0000; // Reserved + + + $header = pack("vv", $record, $length); + $data = pack("V", $cObj); + $data .= pack("v", $OT); + $data .= pack("v", $id); + $data .= pack("v", $grbit); + $data .= pack("v", $colL); + $data .= pack("v", $dxL); + $data .= pack("v", $rwT); + $data .= pack("v", $dyT); + $data .= pack("v", $colR); + $data .= pack("v", $dxR); + $data .= pack("v", $rwB); + $data .= pack("v", $dyB); + $data .= pack("v", $cbMacro); + $data .= pack("V", $Reserved1); + $data .= pack("v", $Reserved2); + $data .= pack("C", $icvBack); + $data .= pack("C", $icvFore); + $data .= pack("C", $fls); + $data .= pack("C", $fAuto); + $data .= pack("C", $icv); + $data .= pack("C", $lns); + $data .= pack("C", $lnw); + $data .= pack("C", $fAutoB); + $data .= pack("v", $frs); + $data .= pack("V", $cf); + $data .= pack("v", $Reserved3); + $data .= pack("v", $cbPictFmla); + $data .= pack("v", $Reserved4); + $data .= pack("v", $grbit2); + $data .= pack("V", $Reserved5); + + $this->_append($header . $data); + } + + /** + * Convert a GD-image into the internal format. + * + * @access private + * @param resource $image The image to process + * @return array Array with data and properties of the bitmap + */ + function _processBitmapGd($image) { + $width = imagesx($image); + $height = imagesy($image); + + $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); + for ($j=$height; $j--; ) { + for ($i=0; $i < $width; ++$i) { + $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); + foreach (array("red", "green", "blue") as $key) { + $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127); + } + $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]); + } + if (3*$width % 4) { + $data .= str_repeat("\x00", 4 - 3*$width % 4); + } + } + + return array($width, $height, strlen($data), $data); + } + + /** + * Convert a 24 bit bitmap into the modified internal format used by Windows. + * This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the + * MSDN library. + * + * @access private + * @param string $bitmap The bitmap to process + * @return array Array with data and properties of the bitmap + */ + function _processBitmap($bitmap) + { + // Open file. + $bmp_fd = @fopen($bitmap,"rb"); + if (!$bmp_fd) { + throw new Exception("Couldn't import $bitmap"); + } + + // Slurp the file into a string. + $data = fread($bmp_fd, filesize($bitmap)); + + // Check that the file is big enough to be a bitmap. + if (strlen($data) <= 0x36) { + throw new Exception("$bitmap doesn't contain enough data.\n"); + } + + // The first 2 bytes are used to identify the bitmap. + $identity = unpack("A2ident", $data); + if ($identity['ident'] != "BM") { + throw new Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); + } + + // Remove bitmap data: ID. + $data = substr($data, 2); + + // Read and remove the bitmap size. This is more reliable than reading + // the data size at offset 0x22. + // + $size_array = unpack("Vsa", substr($data, 0, 4)); + $size = $size_array['sa']; + $data = substr($data, 4); + $size -= 0x36; // Subtract size of bitmap header. + $size += 0x0C; // Add size of BIFF header. + + // Remove bitmap data: reserved, offset, header length. + $data = substr($data, 12); + + // Read and remove the bitmap width and height. Verify the sizes. + $width_and_height = unpack("V2", substr($data, 0, 8)); + $width = $width_and_height[1]; + $height = $width_and_height[2]; + $data = substr($data, 8); + if ($width > 0xFFFF) { + throw new Exception("$bitmap: largest image width supported is 65k.\n"); + } + if ($height > 0xFFFF) { + throw new Exception("$bitmap: largest image height supported is 65k.\n"); + } + + // Read and remove the bitmap planes and bpp data. Verify them. + $planes_and_bitcount = unpack("v2", substr($data, 0, 4)); + $data = substr($data, 4); + if ($planes_and_bitcount[2] != 24) { // Bitcount + throw new Exception("$bitmap isn't a 24bit true color bitmap.\n"); + } + if ($planes_and_bitcount[1] != 1) { + throw new Exception("$bitmap: only 1 plane supported in bitmap image.\n"); + } + + // Read and remove the bitmap compression. Verify compression. + $compression = unpack("Vcomp", substr($data, 0, 4)); + $data = substr($data, 4); + + //$compression = 0; + if ($compression['comp'] != 0) { + throw new Exception("$bitmap: compression not supported in bitmap image.\n"); + } + + // Remove bitmap data: data size, hres, vres, colours, imp. colours. + $data = substr($data, 20); + + // Add the BITMAPCOREHEADER data + $header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); + $data = $header . $data; + + return (array($width, $height, $size, $data)); + } + + /** + * Store the window zoom factor. This should be a reduced fraction but for + * simplicity we will store all fractions with a numerator of 100. + * + * @access private + */ + function _storeZoom() + { + // If scale is 100 we don't need to write a record + if ($this->_phpSheet->getSheetView()->getZoomScale() == 100) { + return; + } + + $record = 0x00A0; // Record identifier + $length = 0x0004; // Bytes to follow + + $header = pack("vv", $record, $length); + $data = pack("vv", $this->_phpSheet->getSheetView()->getZoomScale(), 100); + $this->_append($header . $data); + } + + /** + * Write MSODRAWING record + */ + private function _storeMsoDrawing() + { + // check if there are any shapes for this sheet + if (count($this->_phpSheet->getDrawingCollection()) == 0) { + return; + } + + // create intermediate Escher object + $escher = new PHPExcel_Shared_Escher(); + + // dgContainer + $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); + + // set the drawing index (we use sheet index + 1) + $dgContainer->setDgId($this->_phpSheet->getParent()->getIndex($this->_phpSheet) + 1); + $escher->setDgContainer($dgContainer); + + // spgrContainer + $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); + $dgContainer->setSpgrContainer($spgrContainer); + + // add one shape which is the group shape + $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + $spContainer->setSpgr(true); + $spContainer->setSpType(0); + $spContainer->setSpId(($this->_phpSheet->getParent()->getIndex($this->_phpSheet) + 1) << 10); + $spgrContainer->addChild($spContainer); + + // add the shapes + + // outer loop is for determining BSE index + $blipIndex = 0; // 1-based index to BstoreContainer + + $countShapes = 0; // count number of shapes (minus group shape), in this sheet + + foreach ($this->_phpSheet->getParent()->getAllsheets() as $sheet) { + foreach ($sheet->getDrawingCollection() as $drawing) { + ++$blipIndex; + + if ($sheet === $this->_phpSheet) { + ++$countShapes; + + // add the shape + $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); + + // set the shape type + $spContainer->setSpType(0x004B); + + // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) + $spId = $countShapes + | ($this->_phpSheet->getParent()->getIndex($this->_phpSheet) + 1) << 10; + $spContainer->setSpId($spId); + + // keep track of last spId + $lastSpId = $spId; + + // set the BLIP index + $spContainer->setOPT(0x4104, $blipIndex); + + // set coordinates and offsets, client anchor + $coordinates = $drawing->getCoordinates(); + $offsetX = $drawing->getOffsetX(); + $offsetY = $drawing->getOffsetY(); + $width = $drawing->getWidth(); + $height = $drawing->getHeight(); + + $twoAnchor = PHPExcel_Shared_Excel5::oneAnchor2twoAnchor($this->_phpSheet, $coordinates, $offsetX, $offsetY, $width, $height); + + $spContainer->setStartCoordinates($twoAnchor['startCoordinates']); + $spContainer->setStartOffsetX($twoAnchor['startOffsetX']); + $spContainer->setStartOffsetY($twoAnchor['startOffsetY']); + $spContainer->setEndCoordinates($twoAnchor['endCoordinates']); + $spContainer->setEndOffsetX($twoAnchor['endOffsetX']); + $spContainer->setEndOffsetY($twoAnchor['endOffsetY']); + + $spgrContainer->addChild($spContainer); + } + } + } + + // set last shape index + $dgContainer->setLastSpId($lastSpId); + + // write the Escher stream + $writer = new PHPExcel_Writer_Excel5_Escher($escher); + $data = $writer->close(); + $spOffsets = $writer->getSpOffsets(); + + // write the neccesary MSODRAWING, OBJ records + + // split the Escher stream + $spOffsets[0] = 0; + $nm = count($spOffsets) - 1; // number of shapes excluding first shape + for ($i = 1; $i <= $nm; ++$i) { + // MSODRAWING record + $record = 0x00EC; // Record identifier + + // chunk of Escher stream for one shape + + $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]); + + $length = strlen($dataChunk); + $header = pack("vv", $record, $length); + + $this->_append($header . $dataChunk); + + // OBJ record + $record = 0x005D; // record identifier + $objData = ''; + + // ftCmo + $objData .= + pack('vvvvvVVV' + , 0x0015 // 0x0015 = ftCmo + , 0x0012 // length of ftCmo data + , 0x0008 // object type, 0x0008 = picture + , $i // object id number, Excel seems to use 1-based index, local for the sheet + , 0x6011 // option flags, 0x6011 is what OpenOffice.org uses + , 0 // reserved + , 0 // reserved + , 0 // reserved + ); + // ftEnd + $objData .= + pack('vv' + , 0x0000 // 0x0000 = ftEnd + , 0x0000 // length of ftEnd data + ); + + $length = strlen($objData); + $header = pack('vv', $record, $length); + $this->_append($header . $objData); + } + + } + + /** + * Store the DVAL and DV records. + * + * @access private + */ + function _storeDataValidity() + { + $record = 0x01b2; // Record identifier + $length = 0x0012; // Bytes to follow + + $grbit = 0x0002; // Prompt box at cell, no cached validity data at DV records + $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position + $verPos = 0x00000000; // Vertical position of prompt box, if fixed position + $objId = 0xffffffff; // Object identifier of drop down arrow object, or -1 if not visible + + $header = pack('vv', $record, $length); + $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, + count($this->_dv)); + $this->_append($header.$data); + + $record = 0x01be; // Record identifier + foreach ($this->_dv as $dv) { + $length = strlen($dv); // Bytes to follow + $header = pack("vv", $record, $length); + $this->_append($header . $dv); + } + } + + /** + * Map Error code + */ + private function _mapErrorCode($errorCode) { + switch ($errorCode) { + case '#NULL!': return 0x00; + case '#DIV/0!': return 0x07; + case '#VALUE!': return 0x0F; + case '#REF!': return 0x17; + case '#NAME?': return 0x1D; + case '#NUM!': return 0x24; + case '#N/A': return 0x2A; + } + + return 0; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Excel5/Xf.php b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Xf.php new file mode 100644 index 000000000..717866330 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Excel5/Xf.php @@ -0,0 +1,579 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + +// Original file header of PEAR::Spreadsheet_Excel_Writer_Format (used as the base for this class): +// ----------------------------------------------------------------------------------------- +// /* +// * Module written/ported by Xavier Noguer <xnoguer@rezebra.com> +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * <jmcnamara@cpan.org> +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); +} + +/** PHPExcel_Style_Alignment */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Alignment.php'; + +/** PHPExcel_Style_Border */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Border.php'; + +/** PHPExcel_Style_Fill */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php'; + +/** PHPExcel_Style_Protection */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Protection.php'; + + +/** + * PHPExcel_Writer_Excel5_Xf + * + * @category PHPExcel + * @package PHPExcel_Writer_Excel5 + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Excel5_Xf +{ + /** + * BIFF version + * + * @var int + */ + private $_BIFFVersion; + + /** + * Style XF or a cell XF ? + * + * @var boolean + */ + private $_isStyleXf; + + /** + * Index to the FONT record. Index 4 does not exist + * @var integer + */ + private $_fontIndex; + + /** + * An index (2 bytes) to a FORMAT record (number format). + * @var integer + */ + var $_numberFormatIndex; + + /** + * 1 bit, apparently not used. + * @var integer + */ + var $_text_justlast; + + /** + * The cell's foreground color. + * @var integer + */ + var $_fg_color; + + /** + * The cell's background color. + * @var integer + */ + var $_bg_color; + + /** + * Color of the bottom border of the cell. + * @var integer + */ + var $_bottom_color; + + /** + * Color of the top border of the cell. + * @var integer + */ + var $_top_color; + + /** + * Color of the left border of the cell. + * @var integer + */ + var $_left_color; + + /** + * Color of the right border of the cell. + * @var integer + */ + var $_right_color; + + /** + * Constructor + * + * @access private + * @param integer $index the XF index for the format. + * @param PHPExcel_Style + */ + public function __construct(PHPExcel_Style $style = null) + { + $this->_isStyleXf = false; + $this->_BIFFVersion = 0x0600; + $this->_fontIndex = 0; + + $this->_numberFormatIndex = 0; + + $this->_text_justlast = 0; + + $this->_fg_color = 0x40; + $this->_bg_color = 0x41; + + $this->_diag = 0; + + $this->_bottom_color = 0x40; + $this->_top_color = 0x40; + $this->_left_color = 0x40; + $this->_right_color = 0x40; + $this->_diag_color = 0x40; + $this->_style = $style; + + } + + + /** + * Generate an Excel BIFF XF record (style or cell). + * + * @param string $style The type of the XF record ('style' or 'cell'). + * @return string The XF record + */ + function writeXf() + { + // Set the type of the XF record and some of the attributes. + if ($this->_isStyleXf) { + $style = 0xFFF5; + } else { + $style = $this->_mapLocked($this->_style->getProtection()->getLocked()); + $style |= $this->_mapHidden($this->_style->getProtection()->getHidden()) << 1; + } + + // Flags to indicate if attributes have been set. + $atr_num = ($this->_numberFormatIndex != 0)?1:0; + $atr_fnt = ($this->_fontIndex != 0)?1:0; + $atr_alc = ((int) $this->_style->getAlignment()->getWrapText())?1:0; + $atr_bdr = ($this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || + $this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || + $this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || + $this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; + $atr_pat = (($this->_fg_color != 0x40) || + ($this->_bg_color != 0x41) || + $this->_mapFillType($this->_style->getFill()->getFillType()))?1:0; + $atr_prot = $this->_mapLocked($this->_style->getProtection()->getLocked()) + | $this->_mapHidden($this->_style->getProtection()->getHidden()); + + // Zero the default border colour if the border has not been set. + if ($this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { + $this->_bottom_color = 0; + } + if ($this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { + $this->_top_color = 0; + } + if ($this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { + $this->_right_color = 0; + } + if ($this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) { + $this->_left_color = 0; + } + if ($this->_diag == 0) { + $this->_diag_color = 0; + } + + $record = 0x00E0; // Record identifier + if ($this->_BIFFVersion == 0x0500) { + $length = 0x0010; // Number of bytes to follow + } + if ($this->_BIFFVersion == 0x0600) { + $length = 0x0014; + } + + $ifnt = $this->_fontIndex; // Index to FONT record + $ifmt = $this->_numberFormatIndex; // Index to FORMAT record + if ($this->_BIFFVersion == 0x0500) { + $align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment + $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; + $align |= $this->_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; + $align |= $this->_text_justlast << 7; + $align |= 0 << 8; // rotation + $align |= $atr_num << 10; + $align |= $atr_fnt << 11; + $align |= $atr_alc << 12; + $align |= $atr_bdr << 13; + $align |= $atr_pat << 14; + $align |= $atr_prot << 15; + + $icv = $this->_fg_color; // fg and bg pattern colors + $icv |= $this->_bg_color << 7; + + $fill = $this->_mapFillType($this->_style->getFill()->getFillType()); // Fill and border line style + $fill |= $this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 6; + $fill |= $this->_bottom_color << 9; + + $border1 = $this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()); // Border line style and color + $border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) << 3; + $border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 6; + $border1 |= $this->_top_color << 9; + + $border2 = $this->_left_color; // Border color + $border2 |= $this->_right_color << 7; + + $header = pack("vv", $record, $length); + $data = pack("vvvvvvvv", $ifnt, $ifmt, $style, $align, + $icv, $fill, + $border1, $border2); + } elseif ($this->_BIFFVersion == 0x0600) { + $align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment + $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; + $align |= $this->_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; + $align |= $this->_text_justlast << 7; + + $used_attrib = $atr_num << 2; + $used_attrib |= $atr_fnt << 3; + $used_attrib |= $atr_alc << 4; + $used_attrib |= $atr_bdr << 5; + $used_attrib |= $atr_pat << 6; + $used_attrib |= $atr_prot << 7; + + $icv = $this->_fg_color; // fg and bg pattern colors + $icv |= $this->_bg_color << 7; + + $border1 = $this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color + $border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; + $border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; + $border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; + $border1 |= $this->_left_color << 16; + $border1 |= $this->_right_color << 23; + $diag_tl_to_rb = 0; + $diag_tr_to_lb = 0; + $border1 |= $diag_tl_to_rb << 30; + $border1 |= $diag_tr_to_lb << 31; + + $border2 = $this->_top_color; // Border color + $border2 |= $this->_bottom_color << 7; + $border2 |= $this->_diag_color << 14; + $border2 |= $this->_diag << 21; + $border2 |= $this->_mapFillType($this->_style->getFill()->getFillType()) << 26; + + $header = pack("vv", $record, $length); + + //BIFF8 options: identation, shrinkToFit and text direction + $biff8_options = $this->_style->getAlignment()->getIndent(); + $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; + + $data = pack("vvvC", $ifnt, $ifmt, $style, $align); + $data .= pack("CCC" + , $this->_mapTextRotation($this->_style->getAlignment()->getTextRotation()) + , $biff8_options + , $used_attrib + ); + $data .= pack("VVv", $border1, $border2, $icv); + } + + return($header . $data); + } + + /** + * Set BIFF version + * + * @param int $BIFFVersion + */ + public function setBIFFVersion($BIFFVersion) + { + $this->_BIFFVersion = $BIFFVersion; + } + + /** + * Is this a style XF ? + * + * @param boolean $value + */ + public function setIsStyleXf($value) + { + $this->_isStyleXf = $value; + } + + /** + * Sets the cell's bottom border color + * + * @access public + * @param int $colorIndex Color index + */ + function setBottomColor($colorIndex) + { + $this->_bottom_color = $colorIndex; + } + + /** + * Sets the cell's top border color + * + * @access public + * @param int $colorIndex Color index + */ + function setTopColor($colorIndex) + { + $this->_top_color = $colorIndex; + } + + /** + * Sets the cell's left border color + * + * @access public + * @param int $colorIndex Color index + */ + function setLeftColor($colorIndex) + { + $this->_left_color = $colorIndex; + } + + /** + * Sets the cell's right border color + * + * @access public + * @param int $colorIndex Color index + */ + function setRightColor($colorIndex) + { + $this->_right_color = $colorIndex; + } + + + /** + * Sets the cell's foreground color + * + * @access public + * @param int $colorIndex Color index + */ + function setFgColor($colorIndex) + { + $this->_fg_color = $colorIndex; + } + + /** + * Sets the cell's background color + * + * @access public + * @param int $colorIndex Color index + */ + function setBgColor($colorIndex) + { + $this->_bg_color = $colorIndex; + } + + /** + * Sets the index to the number format record + * It can be date, time, currency, etc... + * + * @access public + * @param integer $numberFormatIndex Index to format record + */ + function setNumberFormatIndex($numberFormatIndex) + { + $this->_numberFormatIndex = $numberFormatIndex; + } + + /** + * Set the font index. + * + * @param int $value Font index, note that value 4 does not exist + */ + public function setFontIndex($value) + { + $this->_fontIndex = $value; + } + + /** + * Map border style + */ + private function _mapBorderStyle($borderStyle) { + switch ($borderStyle) { + case PHPExcel_Style_Border::BORDER_NONE: return 0x00; + case PHPExcel_Style_Border::BORDER_THIN; return 0x01; + case PHPExcel_Style_Border::BORDER_MEDIUM; return 0x02; + case PHPExcel_Style_Border::BORDER_DASHED; return 0x03; + case PHPExcel_Style_Border::BORDER_DOTTED; return 0x04; + case PHPExcel_Style_Border::BORDER_THICK; return 0x05; + case PHPExcel_Style_Border::BORDER_DOUBLE; return 0x06; + case PHPExcel_Style_Border::BORDER_HAIR; return 0x07; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED; return 0x08; + case PHPExcel_Style_Border::BORDER_DASHDOT; return 0x09; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT; return 0x0A; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT; return 0x0B; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; return 0x0C; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT; return 0x0D; + default: return 0x00; + } + } + + /** + * Map fill type + */ + private function _mapFillType($fillType) { + switch ($fillType) { + case PHPExcel_Style_Fill::FILL_NONE: return 0x00; + case PHPExcel_Style_Fill::FILL_SOLID: return 0x01; + case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY: return 0x02; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY: return 0x03; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY: return 0x04; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL: return 0x05; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL: return 0x06; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN: return 0x07; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP: return 0x08; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID: return 0x09; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS: return 0x0A; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL: return 0x0B; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL: return 0x0C; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN: return 0x0D; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP: return 0x0E; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID: return 0x0F; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS: return 0x10; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125: return 0x11; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625: return 0x12; + case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR: // does not exist in BIFF8 + case PHPExcel_Style_Fill::FILL_GRADIENT_PATH: // does not exist in BIFF8 + default: return 0x00; + } + } + + /** + * Map to BIFF2-BIFF8 codes for horizontal alignment + * + * @param string $hAlign + * @return int + */ + private function _mapHAlign($hAlign) + { + switch ($hAlign) { + case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: return 0; + case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: return 1; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: return 2; + case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: return 3; + case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: return 5; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: return 6; + default: return 0; + } + } + + /** + * Map to BIFF2-BIFF8 codes for vertical alignment + * + * @param string $vAlign + * @return int + */ + private function _mapVAlign($vAlign) { + switch ($vAlign) { + case PHPExcel_Style_Alignment::VERTICAL_TOP: return 0; + case PHPExcel_Style_Alignment::VERTICAL_CENTER: return 1; + case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: return 2; + case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: return 3; + default: return 2; + } + } + + /** + * Map to BIFF8 codes for text rotation angle + * + * @param int $textRotation + * @return int + */ + private function _mapTextRotation($textRotation) { + if ($textRotation >= 0) { + return $textRotation; + } + if ($textRotation == -165) { + return 255; + } + if ($textRotation < 0) { + return 90 - $textRotation; + } + } + + /** + * Map locked + * + * @param string + * @return int + */ + private function _mapLocked($locked) { + switch ($locked) { + case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1; + case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; + case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; + default: return 1; + } + } + + /** + * Map hidden + * + * @param string + * @return int + */ + private function _mapHidden($hidden) { + switch ($hidden) { + case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0; + case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; + case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; + default: return 0; + } + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/HTML.php b/libraries/PHPExcel/PHPExcel/Writer/HTML.php new file mode 100644 index 000000000..d1f59a1de --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/HTML.php @@ -0,0 +1,1088 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Shared_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php'; + +/** PHPExcel_Shared_String */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php'; + +/** PHPExcel_HashTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/HashTable.php'; + + +/** + * PHPExcel_Writer_HTML + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { + /** + * PHPExcel object + * + * @var PHPExcel + */ + protected $_phpExcel; + + /** + * Sheet index to write + * + * @var int + */ + private $_sheetIndex; + + /** + * Pre-calculate formulas + * + * @var boolean + */ + private $_preCalculateFormulas = true; + + /** + * Images root + * + * @var string + */ + private $_imagesRoot = '.'; + + /** + * Use inline CSS? + * + * @var boolean + */ + private $_useInlineCss = false; + + /** + * Array of CSS styles + * + * @var array + */ + private $_cssStyles = null; + + /** + * Array of column widths in points + * + * @var array + */ + private $_columnWidths = null; + + /** + * Default font size + * + * @var int + */ + private $_defaultFontSize; + + /** + * Is the current writer creating PDF? + * + * @var boolean + */ + protected $_isPdf = false; + + /** + * Create a new PHPExcel_Writer_HTML + * + * @param PHPExcel $phpExcel PHPExcel object + */ + public function __construct(PHPExcel $phpExcel) { + $this->_phpExcel = $phpExcel; + $this->_defaultFontSize = $this->_phpExcel->getDefaultStyle()->getFont()->getSize(); + $this->_sheetIndex = 0; + $this->_imagesRoot = '.'; + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) { + // garbage collect + $this->_phpExcel->garbageCollect(); + + $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); + PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + + // Build CSS + $this->buildCSS(!$this->_useInlineCss); + + // Open file + $fileHandle = fopen($pFilename, 'w'); + if ($fileHandle === false) { + throw new Exception("Could not open file $pFilename for writing."); + } + + // Write headers + fwrite($fileHandle, $this->generateHTMLHeader(!$this->_useInlineCss)); + + // Write data + fwrite($fileHandle, $this->generateSheetData()); + + // Write footer + fwrite($fileHandle, $this->generateHTMLFooter()); + + // Close file + fclose($fileHandle); + + PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); + } + + /** + * Map VAlign + */ + private function _mapVAlign($vAlign) { + switch ($vAlign) { + case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: return 'bottom'; + case PHPExcel_Style_Alignment::VERTICAL_TOP: return 'top'; + case PHPExcel_Style_Alignment::VERTICAL_CENTER: + case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: return 'middle'; + default: return 'baseline'; + } + } + + /** + * Map HAlign + * + * @return string|false + */ + private function _mapHAlign($hAlign) { + switch ($hAlign) { + case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: return false; + case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: return 'left'; + case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: return 'right'; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: return 'center'; + case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: return 'justify'; + default: return false; + } + } + + /** + * Map border style + */ + private function _mapBorderStyle($borderStyle) { + switch ($borderStyle) { + case PHPExcel_Style_Border::BORDER_NONE: return '0px'; + case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed'; + case PHPExcel_Style_Border::BORDER_DOTTED: return '1px dotted'; + case PHPExcel_Style_Border::BORDER_THICK: return '2px solid'; + default: return '1px solid'; // map others to thin + } + } + + /** + * Get sheet index + * + * @return int + */ + public function getSheetIndex() { + return $this->_sheetIndex; + } + + /** + * Set sheet index + * + * @param int $pValue Sheet index + * @return PHPExcel_Writer_HTML + */ + public function setSheetIndex($pValue = 0) { + $this->_sheetIndex = $pValue; + return $this; + } + + /** + * Write all sheets (resets sheetIndex to NULL) + */ + public function writeAllSheets() { + $this->_sheetIndex = null; + } + + /** + * Generate HTML header + * + * @param boolean $pIncludeStyles Include styles? + * @return string + * @throws Exception + */ + public function generateHTMLHeader($pIncludeStyles = false) { + // PHPExcel object known? + if (is_null($this->_phpExcel)) { + throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + } + + // Construct HTML + $html = ''; + $html .= '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . "\r\n"; + $html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . "\r\n"; + $html .= '<html>' . "\r\n"; + $html .= ' <head>' . "\r\n"; + $html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\r\n"; + $html .= ' <title>' . htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) . '</title>' . "\r\n"; + if ($pIncludeStyles) { + $html .= $this->generateStyles(true); + } + $html .= ' </head>' . "\r\n"; + $html .= '' . "\r\n"; + $html .= ' <body>' . "\r\n"; + + // Return + return $html; + } + + /** + * Generate sheet data + * + * @return string + * @throws Exception + */ + public function generateSheetData() { + // PHPExcel object known? + if (is_null($this->_phpExcel)) { + throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + } + + // Fetch sheets + $sheets = array(); + if (is_null($this->_sheetIndex)) { + $sheets = $this->_phpExcel->getAllSheets(); + } else { + $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex); + } + + // Construct HTML + $html = ''; + + // Loop all sheets + $sheetId = 0; + foreach ($sheets as $sheet) { + // Get cell collection + $cellCollection = $sheet->getCellCollection(); + + // Write table header + $html .= $this->_generateTableHeader($sheet); + + // Get worksheet dimension + $dimension = explode(':', $sheet->calculateWorksheetDimension()); + $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]); + $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1; + $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]); + $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1; + + // Loop trough cells + $rowData = null; + for ($row = $dimension[0][1]; $row <= $dimension[1][1]; ++$row) { + // Start a new row + $rowData = array(); + + // Loop trough columns + for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) { + // Cell exists? + if ($sheet->cellExistsByColumnAndRow($column, $row)) { + $rowData[$column] = $sheet->getCellByColumnAndRow($column, $row); + } else { + $rowData[$column] = ''; + } + } + + // Write row + $html .= $this->_generateRow($sheet, $rowData, $row - 1); + } + + // Write table footer + $html .= $this->_generateTableFooter(); + + // Writing PDF? + if ($this->_isPdf) + { + if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) { + $html .= '<tcpdf method="AddPage" />'; + } + } + + // Next sheet + ++$sheetId; + } + + // Return + return $html; + } + + /** + * Generate image tag in cell + * + * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param string $coordinates Cell coordinates + * @return string + * @throws Exception + */ + private function _writeImageTagInCell(PHPExcel_Worksheet $pSheet, $coordinates) { + // Construct HTML + $html = ''; + + // Write images + foreach ($pSheet->getDrawingCollection() as $drawing) { + if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing->getCoordinates() == $coordinates) { + $filename = $drawing->getPath(); + + // Strip off eventual '.' + if (substr($filename, 0, 1) == '.') { + $filename = substr($filename, 1); + } + + // Prepend images root + $filename = $this->getImagesRoot() . $filename; + + // Strip off eventual '.' + if (substr($filename, 0, 1) == '.' && substr($filename, 0, 2) != './') { + $filename = substr($filename, 1); + } + + // Convert UTF8 data to PCDATA + $filename = htmlspecialchars($filename); + + $html .= "\r\n"; + $html .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . "\r\n"; + } + } + } + + // Return + return $html; + } + + /** + * Generate CSS styles + * + * @param boolean $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>) + * @return string + * @throws Exception + */ + public function generateStyles($generateSurroundingHTML = true) { + // PHPExcel object known? + if (is_null($this->_phpExcel)) { + throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + } + + // Build CSS + $css = $this->buildCSS($generateSurroundingHTML); + + // Construct HTML + $html = ''; + + // Start styles + if ($generateSurroundingHTML) { + $html .= ' <style type="text/css">' . "\r\n"; + $html .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . "\r\n"; + } + + // Write all other styles + foreach ($css as $styleName => $styleDefinition) { + if ($styleName != 'html') { + $html .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . "\r\n"; + } + } + + // End styles + if ($generateSurroundingHTML) { + $html .= ' </style>' . "\r\n"; + } + + // Return + return $html; + } + + /** + * Build CSS styles + * + * @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { }) + * @return array + * @throws Exception + */ + public function buildCSS($generateSurroundingHTML = true) { + // PHPExcel object known? + if (is_null($this->_phpExcel)) { + throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + } + + // Cached? + if (!is_null($this->_cssStyles)) { + return $this->_cssStyles; + } + + // Construct CSS + $css = array(); + + // Start styles + if ($generateSurroundingHTML) { + // html { } + $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif'; + $css['html']['font-size'] = '11pt'; + $css['html']['background-color'] = 'white'; + } + + + // table { } + $css['table']['border-collapse'] = 'collapse'; + $css['table']['page-break-after'] = 'always'; + + // .gridlines td { } + $css['.gridlines td']['border'] = '1px dotted black'; + + // .b {} + $css['.b']['text-align'] = 'center'; // BOOL + + // .e {} + $css['.e']['text-align'] = 'center'; // ERROR + + // .f {} + $css['.f']['text-align'] = 'right'; // FORMULA + + // .inlineStr {} + $css['.inlineStr']['text-align'] = 'left'; // INLINE + + // .n {} + $css['.n']['text-align'] = 'right'; // NUMERIC + + // .s {} + $css['.s']['text-align'] = 'left'; // STRING + + // Calculate cell style hashes + foreach ($this->_phpExcel->getCellXfCollection() as $index => $style) { + $css['td.style' . $index] = $this->_createCSSStyle( $style ); + } + + // Fetch sheets + $sheets = array(); + if (is_null($this->_sheetIndex)) { + $sheets = $this->_phpExcel->getAllSheets(); + } else { + $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex); + } + + // Build styles per sheet + foreach ($sheets as $sheet) { + // Calculate hash code + $sheetIndex = $sheet->getParent()->getIndex($sheet); + + // Build styles + // Calculate column widths + $sheet->calculateColumnWidths(); + + // col elements, initialize + $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; + for ($column = 0; $column <= $highestColumnIndex; ++$column) { + $this->_columnWidths[$sheetIndex][$column] = 42; // approximation + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt'; + } + + // col elements, loop through columnDimensions and set width + foreach ($sheet->getColumnDimensions() as $columnDimension) { + if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->_defaultFontSize)) >= 0) { + $width = PHPExcel_Shared_Drawing::pixelsToPoints($width); + $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; + $this->_columnWidths[$sheetIndex][$column] = $width; + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; + + if ($columnDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['visibility'] = 'collapse'; + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['*display'] = 'none'; // target IE6+7 + } + } + } + + // Default row height + $rowDimension = $sheet->getDefaultRowDimension(); + + // table.sheetN tr { } + $css['table.sheet' . $sheetIndex . ' tr'] = array(); + + $pt_height = $rowDimension->getRowHeight(); + $css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt'; + if ($rowDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none'; + $css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden'; + } + + // Calculate row heights + foreach ($sheet->getRowDimensions() as $rowDimension) { + $row = $rowDimension->getRowIndex() - 1; + + // table.sheetN tr.rowYYYYYY { } + $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array(); + + $pt_height = $rowDimension->getRowHeight(); + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt'; + if ($rowDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none'; + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden'; + } + } + } + + // Cache + if (is_null($this->_cssStyles)) { + $this->_cssStyles = $css; + } + + // Return + return $css; + } + + /** + * Create CSS style + * + * @param PHPExcel_Style $pStyle PHPExcel_Style + * @return array + */ + private function _createCSSStyle(PHPExcel_Style $pStyle) { + // Construct CSS + $css = ''; + + // Create CSS + $css = array_merge( + $this->_createCSSStyleAlignment($pStyle->getAlignment()) + , $this->_createCSSStyleBorders($pStyle->getBorders()) + , $this->_createCSSStyleFont($pStyle->getFont()) + , $this->_createCSSStyleFill($pStyle->getFill()) + ); + + // Return + return $css; + } + + /** + * Create CSS style (PHPExcel_Style_Alignment) + * + * @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment + * @return array + */ + private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) { + // Construct CSS + $css = array(); + + // Create CSS + $css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical()); + if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) { + $css['text-align'] = $textAlign; + } + + // Return + return $css; + } + + /** + * Create CSS style (PHPExcel_Style_Font) + * + * @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font + * @return array + */ + private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) { + // Construct CSS + $css = array(); + + // Create CSS + if ($pStyle->getBold()) { + $css['font-weight'] = 'bold'; + } + if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { + $css['text-decoration'] = 'underline line-through'; + } else if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) { + $css['text-decoration'] = 'underline'; + } else if ($pStyle->getStrikethrough()) { + $css['text-decoration'] = 'line-through'; + } + if ($pStyle->getItalic()) { + $css['font-style'] = 'italic'; + } + + $css['color'] = '#' . $pStyle->getColor()->getRGB(); + $css['font-family'] = '\'' . $pStyle->getName() . '\''; + $css['font-size'] = $pStyle->getSize() . 'pt'; + + // Return + return $css; + } + + /** + * Create CSS style (PHPExcel_Style_Borders) + * + * @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders + * @return array + */ + private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) { + // Construct CSS + $css = array(); + + // Create CSS + $css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom()); + $css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop()); + $css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft()); + $css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight()); + + // Return + return $css; + } + + /** + * Create CSS style (PHPExcel_Style_Border) + * + * @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border + * @return string + */ + private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) { + // Construct HTML + $css = ''; + + // Create CSS + $css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); + + // Return + return $css; + } + + /** + * Create CSS style (PHPExcel_Style_Fill) + * + * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill + * @return array + */ + private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) { + // Construct HTML + $css = array(); + + // Create CSS + $value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? + 'white' : '#' . $pStyle->getStartColor()->getRGB(); + $css['background-color'] = $value; + + // Return + return $css; + } + + /** + * Generate HTML footer + */ + public function generateHTMLFooter() { + // Construct HTML + $html = ''; + $html .= ' </body>' . "\r\n"; + $html .= '</html>' . "\r\n"; + + // Return + return $html; + } + + /** + * Generate table header + * + * @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing + * @return string + * @throws Exception + */ + private function _generateTableHeader($pSheet) { + $sheetIndex = $pSheet->getParent()->getIndex($pSheet); + + // Construct HTML + $html = ''; + + if (!$this->_useInlineCss) { + $gridlines = $pSheet->getShowGridLines() ? ' gridlines' : ''; + $html .= ' <table border="0" cellpadding="0" cellspacing="0" class="sheet' . $sheetIndex . $gridlines . '">' . "\r\n"; + } else { + $style = isset($this->_cssStyles['table']) ? + $this->_assembleCSS($this->_cssStyles['table']) : ''; + + $html .= ' <table border="0" cellpadding="0" cellspacing="0" style="' . $style . '">' . "\r\n"; + } + + // Write <col> elements + $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; + for ($i = 0; $i <= $highestColumnIndex; ++$i) { + if (!$this->_useInlineCss) { + $html .= ' <col class="col' . $i . '">' . "\r\n"; + } else { + $style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ? + $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : ''; + $html .= ' <col style="' . $style . '">' . "\r\n"; + } + } + + // Return + return $html; + } + + /** + * Generate table footer + * + * @throws Exception + */ + private function _generateTableFooter() { + // Construct HTML + $html = ''; + $html .= ' </table>' . "\r\n"; + + // Return + return $html; + } + + /** + * Generate row + * + * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param array $pValues Array containing cells in a row + * @param int $pRow Row number + * @return string + * @throws Exception + */ + private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0) { + if (is_array($pValues)) { + // Construct HTML + $html = ''; + + // Sheet index + $sheetIndex = $pSheet->getParent()->getIndex($pSheet); + + // Write row start + if (!$this->_useInlineCss) { + $html .= ' <tr class="row' . $pRow . '">' . "\r\n"; + } else { + $style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) + ? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : ''; + + $html .= ' <tr style="' . $style . '">' . "\r\n"; + } + + // Write cells + $colNum = 0; + foreach ($pValues as $cell) { + if (!$this->_useInlineCss) { + $cssClass = ''; + $cssClass = 'column' . $colNum; + } else { + $cssClass = array(); + if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum])) { + $this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum]; + } + } + $colSpan = 1; + $rowSpan = 1; + $writeCell = true; // Write cell + + // initialize + $cellData = ''; + + // PHPExcel_Cell + if ($cell instanceof PHPExcel_Cell) { + + // Value + if ($cell->getValue() instanceof PHPExcel_RichText) { + // Loop trough rich text elements + $elements = $cell->getValue()->getRichTextElements(); + foreach ($elements as $element) { + // Rich text start? + if ($element instanceof PHPExcel_RichText_Run) { + $cellData .= '<span style="' . $this->_assembleCSS($this->_createCSSStyleFont($element->getFont())) . '">'; + + if ($element->getFont()->getSuperScript()) { + $cellData .= '<sup>'; + } else if ($element->getFont()->getSubScript()) { + $cellData .= '<sub>'; + } + } + + // Convert UTF8 data to PCDATA + $cellText = $element->getText(); + $cellData .= htmlspecialchars($cellText); + + if ($element instanceof PHPExcel_RichText_Run) { + if ($element->getFont()->getSuperScript()) { + $cellData .= '</sup>'; + } else if ($element->getFont()->getSubScript()) { + $cellData .= '</sub>'; + } + + $cellData .= '</span>'; + } + } + } else { + if ($this->_preCalculateFormulas) { + $cellData = PHPExcel_Style_NumberFormat::toFormattedString( + $cell->getCalculatedValue(), + $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode() + ); + } else { + $cellData = PHPExcel_Style_NumberFormat::ToFormattedString( + $cell->getValue(), + $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode() + ); + } + + // Convert UTF8 data to PCDATA + $cellData = htmlspecialchars($cellData); + } + + // replace leading spaces on each line with &nbsp; + $cellData = $this->_convertNbsp($cellData); + + // convert newline "\n" to '<br>' + $cellData = str_replace("\n", '<br/>', $cellData); + + // Check value + if ($cellData == '') { + $cellData = '&nbsp;'; + } + + // Extend CSS class? + if (!$this->_useInlineCss) { + $cssClass .= ' style' . $cell->getXfIndex(); + $cssClass .= ' ' . $cell->getDataType(); + } else { + if (isset($this->_cssStyles['td.style' . $cell->getXfIndex()])) { + $cssClass = array_merge($cssClass, $this->_cssStyles['td.style' . $cell->getXfIndex()]); + } + + // General horizontal alignment: Actual horizontal alignment depends on dataType + $sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() ); + if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL + && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) + { + $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align']; + } + } + } else { + $cell = new PHPExcel_Cell( + PHPExcel_Cell::stringFromColumnIndex($colNum), + ($pRow + 1), + '', + PHPExcel_Cell_DataType::TYPE_NULL, + $pSheet + ); + } + + // Hyperlink? + if ($cell->hasHyperlink() && !$cell->getHyperlink()->isInternal()) { + $cellData = '<a href="' . htmlspecialchars($cell->getHyperlink()->getUrl()) . '" title="' . htmlspecialchars($cell->getHyperlink()->getTooltip()) . '">' . $cellData . '</a>'; + } + + // Column/rowspan + foreach ($pSheet->getMergeCells() as $cells) { + if ($cell->isInRange($cells)) { + list($first, ) = PHPExcel_Cell::splitRange($cells); + + if ($first[0] == $cell->getCoordinate()) { + list($colSpan, $rowSpan) = PHPExcel_Cell::rangeDimension($cells); + } else { + $writeCell = false; + } + + break; + } + } + + // Write + if ($writeCell) { + // Column start + $html .= ' <td'; + if (!$this->_useInlineCss) { + $html .= ' class="' . $cssClass . '"'; + } else { + //** Necessary redundant code for the sake of PHPExcel_Writer_PDF ** + // We must explicitly write the width of the <td> element because TCPDF + // does not recognize e.g. <col style="width:42pt"> + $width = 0; + $columnIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1; + for ($i = $columnIndex; $i < $columnIndex + $colSpan; ++$i) { + if (isset($this->_columnWidths[$sheetIndex][$i])) { + $width += $this->_columnWidths[$sheetIndex][$i]; + } + } + $cssClass['width'] = $width . 'pt'; + + // We must also explicitly write the height of the <td> element because TCPDF + // does not recognize e.g. <tr style="height:50pt"> + if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) { + $height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height']; + $cssClass['height'] = $height; + } + //** end of redundant code ** + + $html .= ' style="' . $this->_assembleCSS($cssClass) . '"'; + } + if ($colSpan > 1) { + $html .= ' colspan="' . $colSpan . '"'; + } + if ($rowSpan > 1) { + $html .= ' rowspan="' . $rowSpan . '"'; + } + $html .= '>'; + + // Image? + $html .= $this->_writeImageTagInCell($pSheet, $cell->getCoordinate()); + + // Cell data + $html .= $cellData; + + // Column end + $html .= '</td>' . "\r\n"; + } + + // Next column + ++$colNum; + } + + // Write row end + $html .= ' </tr>' . "\r\n"; + + // Return + return $html; + } else { + throw new Exception("Invalid parameters passed."); + } + } + + /** + * Takes array where of CSS properties / values and converts to CSS string + * + * @param array + * @return string + */ + private function _assembleCSS($pValue = array()) + { + $pairs = array(); + foreach ($pValue as $property => $value) { + $pairs[] = $property . ':' . $value; + } + $string = implode('; ', $pairs); + + return $string; + } + + /** + * Get Pre-Calculate Formulas + * + * @return boolean + */ + public function getPreCalculateFormulas() { + return $this->_preCalculateFormulas; + } + + /** + * Set Pre-Calculate Formulas + * + * @param boolean $pValue Pre-Calculate Formulas? + * @return PHPExcel_Writer_HTML + */ + public function setPreCalculateFormulas($pValue = true) { + $this->_preCalculateFormulas = $pValue; + return $this; + } + + /** + * Get images root + * + * @return string + */ + public function getImagesRoot() { + return $this->_imagesRoot; + } + + /** + * Set images root + * + * @param string $pValue + * @return PHPExcel_Writer_HTML + */ + public function setImagesRoot($pValue = '.') { + $this->_imagesRoot = $pValue; + return $this; + } + + /** + * Get use inline CSS? + * + * @return boolean + */ + public function getUseInlineCss() { + return $this->_useInlineCss; + } + + /** + * Set use inline CSS? + * + * @param boolean $pValue + * @return PHPExcel_Writer_HTML + */ + public function setUseInlineCss($pValue = false) { + $this->_useInlineCss = $pValue; + return $this; + } + + /** + * Converts a string so that spaces occuring at beginning of each new line are replaced by &nbsp; + * Example: " Hello\n to the world" is converted to "&nbsp;&nbsp;Hello\n&nbsp;to the world" + * + * @param string $pValue + * @return string + */ + private function _convertNbsp($pValue = '') + { + $explodes = explode("\n", $pValue); + foreach ($explodes as $explode) { + $matches = array(); + if (preg_match('/^( )+/', $explode, $matches)) { + $explode = str_repeat('&nbsp;', strlen($matches[0])) . substr($explode, strlen($matches[0])); + } + $implodes[] = $explode; + } + + $string = implode("\n", $implodes); + return $string; + } + +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/IWriter.php b/libraries/PHPExcel/PHPExcel/Writer/IWriter.php new file mode 100644 index 000000000..b8f0ba89f --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/IWriter.php @@ -0,0 +1,45 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** + * PHPExcel_Writer_IWriter + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +interface PHPExcel_Writer_IWriter +{ + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null); +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/PDF.php b/libraries/PHPExcel/PHPExcel/Writer/PDF.php new file mode 100644 index 000000000..6712c3929 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/PDF.php @@ -0,0 +1,175 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + +/** PHPExcel_Writer_HTML */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/HTML.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_RichText */ +require_once PHPEXCEL_ROOT . 'PHPExcel/RichText.php'; + +/** PHPExcel_Shared_Drawing */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php'; + +/** PHPExcel_HashTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/HashTable.php'; + +/** PHPExcel_Shared_PDF */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PDF.php'; + + +/** + * PHPExcel_Writer_PDF + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_PDF extends PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { + /** + * Temporary storage directory + * + * @var string + */ + private $_tempDir = ''; + + /** + * Create a new PHPExcel_Writer_PDF + * + * @param PHPExcel $phpExcel PHPExcel object + */ + public function __construct(PHPExcel $phpExcel) { + parent::__construct($phpExcel); + $this->setUseInlineCss(true); + $this->_tempDir = sys_get_temp_dir(); + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) { + // garbage collect + $this->_phpExcel->garbageCollect(); + + $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); + PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + + // Open file + $fileHandle = fopen($pFilename, 'w'); + if ($fileHandle === false) { + throw new Exception("Could not open file $pFilename for writing."); + } + + // Set PDF + $this->_isPdf = true; + + // Build CSS + $this->buildCSS(true); + + // Generate HTML + $html = ''; + //$html .= $this->generateHTMLHeader(false); + $html .= $this->generateSheetData(); + //$html .= $this->generateHTMLFooter(); + + // Default PDF paper size + $paperSize = 'A4'; + $orientation = 'P'; + + // Check for overrides + if (is_null($this->getSheetIndex())) { + $orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P'; + } else { + $orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P'; + } + + // Create PDF + $pdf = new TCPDF($orientation, 'pt', $paperSize); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + $pdf->AddPage(); + $pdf->SetFont('freesans'); + $pdf->writeHTML($html); + + // Document info + $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); + $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); + $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); + $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); + $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); + + // Write to file + fwrite($fileHandle, $pdf->output($pFilename, 'S')); + + // Close file + fclose($fileHandle); + + PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); + } + + /** + * Get temporary storage directory + * + * @return string + */ + public function getTempDir() { + return $this->_tempDir; + } + + /** + * Set temporary storage directory + * + * @param string $pValue Temporary storage directory + * @throws Exception Exception when directory does not exist + * @return PHPExcel_Writer_PDF + */ + public function setTempDir($pValue = '') { + if (is_dir($pValue)) { + $this->_tempDir = $pValue; + } else { + throw new Exception("Directory does not exist: $pValue"); + } + return $this; + } +} diff --git a/libraries/PHPExcel/PHPExcel/Writer/Serialized.php b/libraries/PHPExcel/PHPExcel/Writer/Serialized.php new file mode 100644 index 000000000..940a49969 --- /dev/null +++ b/libraries/PHPExcel/PHPExcel/Writer/Serialized.php @@ -0,0 +1,208 @@ +<?php +/** + * PHPExcel + * + * Copyright (c) 2006 - 2009 PHPExcel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.7.0, 2009-08-10 + */ + + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); +} + +/** PHPExcel */ +require_once PHPEXCEL_ROOT . 'PHPExcel.php'; + +/** PHPExcel_HashTable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/HashTable.php'; + +/** PHPExcel_IComparable */ +require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php'; + +/** PHPExcel_Worksheet */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php'; + +/** PHPExcel_Cell */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php'; + +/** PHPExcel_IWriter */ +require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/IWriter.php'; + + +/** + * PHPExcel_Writer_Serialized + * + * @category PHPExcel + * @package PHPExcel_Writer + * @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel) + */ +class PHPExcel_Writer_Serialized implements PHPExcel_Writer_IWriter +{ + /** + * Private PHPExcel + * + * @var PHPExcel + */ + private $_spreadSheet; + + /** + * Create a new PHPExcel_Writer_Serialized + * + * @param PHPExcel $pPHPExcel + */ + public function __construct(PHPExcel $pPHPExcel = null) + { + // Assign PHPExcel + $this->setPHPExcel($pPHPExcel); + } + + /** + * Save PHPExcel to file + * + * @param string $pFileName + * @throws Exception + */ + public function save($pFilename = null) + { + if (!is_null($this->_spreadSheet)) { + // Garbage collect + $this->_spreadSheet->garbageCollect(); + + // Garbage collect... + foreach ($this->_spreadSheet->getAllSheets() as $sheet) { + $sheet->garbageCollect(); + } + + // Create new ZIP file and open it for writing + $objZip = new ZipArchive(); + + // Try opening the ZIP file + if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) { + if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) { + throw new Exception("Could not open " . $pFilename . " for writing."); + } + } + + // Add media + $sheetCount = $this->_spreadSheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + for ($j = 0; $j < $this->_spreadSheet->getSheet($i)->getDrawingCollection()->count(); ++$j) { + if ($this->_spreadSheet->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcel_Worksheet_BaseDrawing) { + $imgTemp = $this->_spreadSheet->getSheet($i)->getDrawingCollection()->offsetGet($j); + $objZip->addFromString('media/' . $imgTemp->getFilename(), file_get_contents($imgTemp->getPath())); + } + } + } + + // Add phpexcel.xml to the document, which represents a PHP serialized PHPExcel object + $objZip->addFromString('phpexcel.xml', $this->_writeSerialized($this->_spreadSheet, $pFilename)); + + // Close file + if ($objZip->close() === false) { + throw new Exception("Could not close zip file $pFilename."); + } + } else { + throw new Exception("PHPExcel object unassigned."); + } + } + + /** + * Get PHPExcel object + * + * @return PHPExcel + * @throws Exception + */ + public function getPHPExcel() { + if (!is_null($this->_spreadSheet)) { + return $this->_spreadSheet; + } else { + throw new Exception("No PHPExcel assigned."); + } + } + + /** + * Get PHPExcel object + * + * @param PHPExcel $pPHPExcel PHPExcel object + * @throws Exception + * @return PHPExcel_Writer_Serialized + */ + public function setPHPExcel(PHPExcel $pPHPExcel = null) { + $this->_spreadSheet = $pPHPExcel; + return $this; + } + + /** + * Serialize PHPExcel object to XML + * + * @param PHPExcel $pPHPExcel + * @param string $pFilename + * @return string XML Output + * @throws Exception + */ + private function _writeSerialized(PHPExcel $pPHPExcel = null, $pFilename = '') + { + // Clone $pPHPExcel + $pPHPExcel = clone $pPHPExcel; + + // Update media links + $sheetCount = $pPHPExcel->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + for ($j = 0; $j < $pPHPExcel->getSheet($i)->getDrawingCollection()->count(); ++$j) { + if ($pPHPExcel->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcel_Worksheet_BaseDrawing) { + $imgTemp =& $pPHPExcel->getSheet($i)->getDrawingCollection()->offsetGet($j); + $imgTemp->setPath('zip://' . $pFilename . '#media/' . $imgTemp->getFilename(), false); + } + } + } + + // Create XML writer + $objWriter = new xmlWriter(); + $objWriter->openMemory(); + $objWriter->setIndent(true); + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // PHPExcel + $objWriter->startElement('PHPExcel'); + $objWriter->writeAttribute('version', '1.7.0'); + + // Comment + $objWriter->writeComment('This file has been generated using PHPExcel v1.7.0 (http://www.codeplex.com/PHPExcel). It contains a base64 encoded serialized version of the PHPExcel internal object.'); + + // Data + $objWriter->startElement('data'); + $objWriter->writeCData( base64_encode(serialize($pPHPExcel)) ); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->outputMemory(true); + } +} diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php new file mode 100644 index 000000000..35f6bce46 --- /dev/null +++ b/libraries/Tracker.class.php @@ -0,0 +1,903 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * + * @author Alexander Rutkowski + * @version $Id$ + * @package phpMyAdmin + */ + +/** + * Gets relation settings + */ +require_once './libraries/relation.lib.php'; +$cfgRelation = PMA_getRelationsParam(); + +/** + * This class tracks changes on databases, tables and views. + * For more information please see phpMyAdmin/Documentation.html + * + * @author Alexander Rutkowski <alexander.rutkowski@googlemail.com> + * @package phpMyAdmin + * + * @todo use stristr instead of strstr + */ +class PMA_Tracker +{ + /** + * Defines the internal PMA table which contains tracking data. + * + * @access protected + * @var string + */ + static protected $pma_table; + + /** + * Defines the usage of DROP TABLE statment in SQL dumps. + * + * @access protected + * @var boolean + */ + static protected $add_drop_table; + + /** + * Defines the usage of DROP VIEW statment in SQL dumps. + * + * @access protected + * @var boolean + */ + static protected $add_drop_view; + + /** + * Defines the usage of DROP DATABASE statment in SQL dumps. + * + * @access protected + * @var boolean + */ + static protected $add_drop_database; + + /** + * Defines auto-creation of tracking versions. + * + * @var boolean + */ + static protected $version_auto_create; + + /** + * Defines the default set of tracked statements. + * + * @var string + */ + static protected $default_tracking_set; + + /** + * Initializes settings. See phpMyAdmin/Documentation.html. + * + * @static + * + */ + static public function init() + { + self::$pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) .".". + PMA_backquote($GLOBALS['cfg']['Server']['tracking']); + + self::$add_drop_table = $GLOBALS['cfg']['Server']['tracking_add_drop_table']; + + self::$add_drop_view = $GLOBALS['cfg']['Server']['tracking_add_drop_view']; + + self::$add_drop_database = $GLOBALS['cfg']['Server']['tracking_add_drop_database']; + + self::$default_tracking_set = $GLOBALS['cfg']['Server']['tracking_default_statements']; + + self::$version_auto_create = $GLOBALS['cfg']['Server']['tracking_version_auto_create']; + + } + + + /** + * Gets the on/off value of the Tracker module, starts initialization. + * + * @static + * + * @return boolean (true=on|false=off) + */ + static public function isActive() + { + global $cfgRelation; + if (!$cfgRelation['trackingwork']) return false; + + self::init(); + + if(isset(self::$pma_table)) + return true; + else + return false; + } + + /** + * Returns a simple DROP TABLE statement. + * + * @param string $tablename + * @return string + */ + static public function getStatementDropTable($tablename) + { + return 'DROP TABLE IF EXISTS ' . $tablename; + } + + /** + * Returns a simple DROP VIEW statement. + * + * @param string $viewname + * @return string + */ + static public function getStatementDropView($viewname) + { + return 'DROP VIEW IF EXISTS ' . $viewname; + } + + /** + * Returns a simple DROP DATABASE statement. + * + * @param string $dbname + * @return string + */ + static public function getStatementDropDatabase($dbname) + { + return 'DROP DATABASE IF EXISTS ' . $dbname; + } + + /** + * Parses the name of a table from a SQL statement substring. + * + * @static + * + * @param string $string part of SQL statement + * + * @return string the name of table + */ + static protected function getTableName($string) + { + if(strstr($string,'.')) { + $temp = explode('.',$string); + $tablename = $temp[1]; + } + else { + $tablename = $string; + } + + $str = explode("\n", $tablename); + $tablename = $str[0]; + + + $tablename = str_replace(';', '', $tablename); + $tablename = str_replace('`', '', $tablename); + $tablename = trim($tablename); + + return $tablename; + } + + + /** + * Gets the tracking status of a table, is it active or deactive ? + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * + * @return boolean true or false + */ + static public function isTracked($dbname, $tablename) + { + if (!$cfgRelation['trackingwork']) return false; + + $sql_query = + " SELECT tracking_active FROM " . self::$pma_table . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' ". + " ORDER BY version DESC"; + + $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query)); + + if(isset($row['tracking_active']) and $row['tracking_active'] == 1) + return true; + else + return false; + } + + /** + * Returns the comment line for the log. + * + * @return string Comment, contains date and username + */ + static public function getLogComment() + { + $date = date('Y-m-d H:i:s'); + + return "# log " . $date . " " . $GLOBALS['cfg']['Server']['user'] . "\n"; + } + + /** + * Creates tracking version of a table / view + * (in other words: create a job to track future changes on the table). + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * @param string $version version + * @param string $tracking_set set of tracking statements + * @param string $is_view if table is a view + * + * @return int result of version insertion + */ + static public function createVersion($dbname, $tablename, $version, $tracking_set = '', $is_view = false) + { + global $sql_backquotes; + + if($tracking_set == '') + $tracking_set = self::$default_tracking_set; + + require_once './libraries/export/sql.php'; + + $sql_backquotes = true; + + $date = date('Y-m-d H:i:s'); + + // Get data definition snapshot of table + $sql_query = ' + SHOW FULL COLUMNS FROM ' . PMA_backquote($dbname) . '.' . PMA_backquote($tablename); + + $sql_result = PMA_DBI_query($sql_query); + + while($row = PMA_DBI_fetch_array($sql_result)) + $columns[] = $row; + + + $sql_query = ' + SHOW INDEX FROM ' . PMA_backquote($dbname) . '.' . PMA_backquote($tablename); + + $sql_result = PMA_DBI_query($sql_query); + + $indexes = array(); + + while( $row = PMA_DBI_fetch_array($sql_result)) + $indexes[] = $row; + + + $snapshot = array('COLUMNS' => $columns , 'INDEXES' => $indexes); + $snapshot = serialize($snapshot); + + + + // Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements + $sql_backquotes = true; + + $create_sql = ""; + + if(self::$add_drop_table == true and $is_view == false) + { + $create_sql .= self::getLogComment() . + self::getStatementDropTable(PMA_backquote($tablename)) . ";\n"; + + } + + if(self::$add_drop_view == true and $is_view == true) + { + $create_sql .= self::getLogComment() . + self::getStatementDropView(PMA_backquote($tablename)) . ";\n"; + } + + + + $create_sql .= self::getLogComment() . + PMA_getTableDef($dbname, $tablename, "\n", ""); + + // Save version + + $sql_query = + "/*NOTRACK*/\n" . + "INSERT INTO" . self::$pma_table . " (" . + "db_name, ". + "table_name, ". + "version, ". + "date_created, ". + "date_updated, ". + "schema_snapshot, ". + "schema_sql, ". + "data_sql, ". + "tracking ". + ") ". + "values ( + '" . PMA_sqlAddslashes($dbname) . "', + '" . PMA_sqlAddslashes($tablename) . "', + '" . PMA_sqlAddslashes($version) . "', + '" . PMA_sqlAddslashes($date) . "', + '" . PMA_sqlAddslashes($date) . "', + '" . PMA_sqlAddslashes($snapshot) . "', + '" . PMA_sqlAddslashes($create_sql) . "', + '" . PMA_sqlAddslashes("\n") . "', + '" . PMA_sqlAddslashes($tracking_set) . "' )"; + + $result = PMA_query_as_controluser($sql_query); + + if($result) + { + // Deactivate previous version + self::deactivateTracking($dbname, $tablename, ($version - 1)); + } + + return $result; + } + + + /** + * Creates tracking version of a database + * (in other words: create a job to track future changes on the database). + * + * @static + * + * @param string $dbname name of database + * @param string $version version + * @param string $query query + * @param string $tracking_set set of tracking statements + * + * @return int result of version insertion + */ + static public function createDatabaseVersion($dbname, $version, $query, $tracking_set = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE') + { + global $sql_backquotes; + + $date = date('Y-m-d H:i:s'); + + + if($tracking_set == '') + $tracking_set = self::$default_tracking_set; + + require_once './libraries/export/sql.php'; + + $create_sql = ""; + + if(self::$add_drop_database == true) + { + $create_sql .= self::getLogComment() . + self::getStatementDropDatabase(PMA_backquote($dbname)) . ";\n"; + + } + + $create_sql .= self::getLogComment() . $query; + + // Save version + $sql_query = + "/*NOTRACK*/\n" . + "INSERT INTO" . self::$pma_table . " (" . + "db_name, ". + "table_name, ". + "version, ". + "date_created, ". + "date_updated, ". + "schema_snapshot, ". + "schema_sql, ". + "data_sql, ". + "tracking ". + ") ". + "values ( + '" . PMA_sqlAddslashes($dbname) . "', + '" . PMA_sqlAddslashes('') . "', + '" . PMA_sqlAddslashes($version) . "', + '" . PMA_sqlAddslashes($date) . "', + '" . PMA_sqlAddslashes($date) . "', + '" . PMA_sqlAddslashes('') . "', + '" . PMA_sqlAddslashes($create_sql) . "', + '" . PMA_sqlAddslashes("\n") . "', + '" . PMA_sqlAddslashes($tracking_set) . "' )"; + + $result = PMA_query_as_controluser($sql_query); + + return $result; + } + + + + /** + * Activates tracking of a table. + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * @param string $version version + * + * @return int result of SQL query + */ + static public function activateTracking($dbname, $tablename, $version) + { + $sql_query = + " UPDATE " . self::$pma_table . + " SET " . PMA_backquote('tracking_active') ." = '1' " . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' " . + " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' "; + + $result = PMA_query_as_controluser($sql_query); + + return $result; + } + + + /** + * Deativates tracking of a table. + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * @param string $version version + * + * @return int result of SQL query + */ + static public function deactivateTracking($dbname, $tablename, $version) + { + $sql_query = + " UPDATE " . self::$pma_table . + " SET " . PMA_backquote('tracking_active') ." = '0' " . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' " . + " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' "; + + $result = PMA_query_as_controluser($sql_query); + + return $result; + } + + + /** + * Gets the newest version of a tracking job + * (in other words: gets the HEAD version). + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * @param string $statement tracked statement + * + * @return int (-1 if no version exist | > 0 if a version exist) + */ + static public function getVersion($dbname, $tablename, $statement = null) + { + $sql_query = + " SELECT MAX(version) FROM " . self::$pma_table . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' "; + + if($statement != "") + $sql_query .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ; + + $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query)); + if(isset($row[0])) + $version = $row[0]; + + if(!isset($version)) $version = -1; + + return $version; + } + + + /** + * Gets the record of a tracking job. + * + * @static + * + * @param string $dbname name of database + * @param string $tablename name of table + * @param string $version version number + * + * @return mixed record DDM log, DDL log, structure snapshot, tracked statements. + */ + static public function getTrackedData($dbname, $tablename, $version) + { + $sql_query = " SELECT * FROM " . self::$pma_table . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' ". + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) ."' ". + " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) ."' ". + " ORDER BY ". PMA_backquote('version') . " DESC "; + + $mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query)); + + // Parse log + $log_schema_entries = explode('# log ', $mixed['schema_sql']); + $log_data_entries = explode('# log ', $mixed['data_sql']); + + $ddl_date_from = $date = date('Y-m-d H:i:s'); + + $ddlog = array(); + $i = 0; + + // Iterate tracked data definition statements + // For each log entry we want to get date, username and statement + foreach ($log_schema_entries as $log_entry) + { + if(trim($log_entry) != '') + { + $date = substr($log_entry, 0, 19); + $username = substr($log_entry, 20, strpos($log_entry, "\n") - 20); + if($i == 0) $ddl_date_from = $date; + $statement = rtrim(strstr($log_entry, "\n")); + + $ddlog[] = array( 'date' => $date, + 'username'=> $username, + 'statement' => $statement ); + $i++; + } + } + + $date_from = $ddl_date_from; + $date_to = $ddl_date_to = $date; + + $dml_date_from = $date_from; + + $dmlog = array(); + $i = 0; + + // Iterate tracked data manipulation statements + // For each log entry we want to get date, username and statement + foreach ($log_data_entries as $log_entry) + { + if(trim($log_entry) != '') + { + $date = substr($log_entry, 0, 19); + $username = substr($log_entry, 20, strpos($log_entry, "\n") - 20); + if($i == 0) $dml_date_from = $date; + $statement = rtrim(strstr($log_entry, "\n")); + + $dmlog[] = array( 'date' => $date, + 'username' => $username, + 'statement' => $statement ); + $i++; + } + } + + $dml_date_to = $date; + + // Define begin and end of date range for both logs + if(strtotime($ddl_date_from) <= strtotime($dml_date_from)) + $data['date_from'] = $ddl_date_from; + else + $data['date_from'] = $dml_date_from; + + if(strtotime($ddl_date_to) >= strtotime($dml_date_to)) + $data['date_to'] = $ddl_date_to; + else + $data['date_to'] = $dml_date_to; + + $data['ddlog'] = $ddlog; + $data['dmlog'] = $dmlog; + $data['tracking'] = $mixed['tracking']; + $data['schema_snapshot'] = $mixed['schema_snapshot']; + + return $data; + } + + + /** + * Parses a query. Gets + * - statement identifier (UPDATE, ALTER TABLE, ...) + * - type of statement, is it part of DDL or DML ? + * - tablename + * + * @static + * @todo: using PMA SQL Parser when possible + * @todo: support multi-table/view drops + * + * @param string $query + * + * @return mixed Array containing identifier, type and tablename. + * + */ + static public function parseQuery($query) + { + + // Usage of PMA_SQP does not work here + // + // require_once("libraries/sqlparser.lib.php"); + // $parsed_sql = PMA_SQP_parse($query); + // $sql_info = PMA_SQP_analyze($parsed_sql); + + $query = str_replace("\n"," ", $query); + $query = str_replace("\r"," ", $query); + + $query = trim($query); + $query = trim($query, ' -'); + + $tokens = explode(" ", $query); + $tokens = array_map('strtoupper', $tokens); + + // Parse USE statement, need it for SQL dump imports + if(substr($query, 0, 4) == 'USE ') + { + $prefix = explode('USE ', $query); + $GLOBALS['db'] = self::getTableName($prefix[1]); + } + + /* + * DDL statements + */ + + $result['type'] = 'DDL'; + + // Parse CREATE VIEW statement + if(in_array('CREATE', $tokens) == true and + in_array('VIEW', $tokens) == true and + in_array('AS', $tokens) == true) + { + $result['identifier'] = 'CREATE VIEW'; + + $index = array_search('VIEW', $tokens); + + $result['tablename'] = strtolower(self::getTableName($tokens[$index + 1])); + } + + // Parse ALTER VIEW statement + if(in_array('ALTER', $tokens) == true and + in_array('VIEW', $tokens) == true and + in_array('AS', $tokens) == true and + !isset($result['identifier'])) + { + $result['identifier'] = 'ALTER VIEW'; + + $index = array_search('VIEW', $tokens); + + $result['tablename'] = strtolower(self::getTableName($tokens[$index + 1])); + } + + // Parse DROP VIEW statement + if(!isset($result['identifier']) and substr($query, 0, 10) == 'DROP VIEW ') + { + $result['identifier'] = 'DROP VIEW'; + + $prefix = explode('DROP VIEW ', $query); + $str = strstr($prefix[1], 'IF EXISTS'); + + if($str == FALSE ) + $str = $prefix[1]; + + $result['tablename'] = self::getTableName($str); + } + + // Parse CREATE DATABASE statement + if(!isset($result['identifier']) and substr($query, 0, 15) == 'CREATE DATABASE') + { + $result['identifier'] = 'CREATE DATABASE'; + $str = str_replace('CREATE DATABASE', '', $query); + $str = str_replace('IF NOT EXISTS', '', $str); + + $prefix = explode('DEFAULT ', $str); + + $result['tablename'] = ''; + $GLOBALS['db'] = self::getTableName($prefix[0]); + } + + // Parse ALTER DATABASE statement + if(!isset($result['identifier']) and substr($query, 0, 14) == 'ALTER DATABASE') + { + $result['identifier'] = 'ALTER DATABASE'; + $result['tablename'] = ''; + } + + // Parse DROP DATABASE statement + if(!isset($result['identifier']) and substr($query, 0, 13) == 'DROP DATABASE') + { + $result['identifier'] = 'DROP DATABASE'; + $str = str_replace('DROP DATABASE', '', $query); + $str = str_replace('IF EXISTS', '', $str); + $GLOBALS['db'] = self::getTableName($str); + $result['tablename'] = ''; + } + + // Parse CREATE TABLE statement + if(!isset($result['identifier']) and substr($query, 0, 12) == 'CREATE TABLE') + { + $result['identifier'] = 'CREATE TABLE'; + $query = str_replace('IF NOT EXISTS', '', $query); + $prefix = explode('CREATE TABLE ', $query); + $suffix = explode('(', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse ALTER TABLE statement + if(!isset($result['identifier']) and substr($query, 0, 12) == 'ALTER TABLE ') + { + $result['identifier'] = 'ALTER TABLE'; + + $prefix = explode('ALTER TABLE ', $query); + $suffix = explode(' ', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse DROP TABLE statement + if(!isset($result['identifier']) and substr($query, 0, 11) == 'DROP TABLE ') + { + $result['identifier'] = 'DROP TABLE'; + + $prefix = explode('DROP TABLE ', $query); + $str = strstr($prefix[1], 'IF EXISTS'); + + if($str == FALSE ) + $str = $prefix[1]; + + $result['tablename'] = self::getTableName($str); + } + + // Parse CREATE INDEX statement + if(!isset($result['identifier']) and + ( substr($query, 0, 12) == 'CREATE INDEX' or + substr($query, 0, 19) == 'CREATE UNIQUE INDEX' or + substr($query, 0, 20) == 'CREATE SPATIAL INDEX' + ) + ) + { + $result['identifier'] = 'CREATE INDEX'; + $prefix = explode('ON ', $query); + $suffix = explode('(', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse DROP INDEX statement + if(!isset($result['identifier']) and substr($query, 0, 10) == 'DROP INDEX') + { + $result['identifier'] = 'DROP INDEX'; + $prefix = explode('ON ', $query); + $result['tablename'] = self::getTableName($prefix[1]); + } + + // Parse RENAME TABLE statement + if(!isset($result['identifier']) and substr($query, 0, 13) == 'RENAME TABLE ') + { + $result['identifier'] = 'RENAME TABLE'; + $prefix = explode('RENAME TABLE ', $query); + $names = explode(' TO ', $prefix[1]); + $result['tablename'] = self::getTableName($names[0]); + $result["tablename_after_rename"] = self::getTableName($names[1]); + } + + /* + * DML statements + */ + + if(!isset($result['identifier'])) + $result["type"] = 'DML'; + + // Parse UPDATE statement + if(!isset($result['identifier']) and substr($query, 0, 6) == 'UPDATE') + { + $result['identifier'] = 'UPDATE'; + $prefix = explode('UPDATE ', $query); + $suffix = explode(' ', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse INSERT INTO statement + if(!isset($result['identifier']) and substr($query, 0, 11 ) == 'INSERT INTO') + { + $result['identifier'] = 'INSERT'; + $prefix = explode('INSERT INTO', $query); + $suffix = explode('(', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse DELETE statement + if(!isset($result['identifier']) and substr($query, 0, 6 ) == 'DELETE') + { + $result['identifier'] = 'DELETE'; + $prefix = explode('FROM ', $query); + $suffix = explode(' ', $prefix[1]); + $result['tablename'] = self::getTableName($suffix[0]); + } + + // Parse TRUNCATE statement + if(!isset($result['identifier']) and substr($query, 0, 8 ) == 'TRUNCATE') + { + $result['identifier'] = 'TRUNCATE'; + $prefix = explode('TRUNCATE', $query); + $result['tablename'] = self::getTableName($prefix[1]); + } + + return $result; + } + + + /** + * Analyzes a given SQL statement and saves tracking data. + * + * + * @static + * @param string $query a SQL query + */ + static public function handleQuery($query) + { + // If query is marked as untouchable, leave + if(strstr($query, "/*NOTRACK*/")) + return false; + + //$query = trim($query); + //$query = ltrim($query, '-'); + + + if(!(substr($query, -1) == ';')) + $query = $query . ";\n"; + + // Get some information about query + $result = self::parseQuery($query); + + // Get database name + $dbname = trim($GLOBALS['db'], '`'); + + // If we found a valid statement + if(isset($result['identifier'])) + { + $version = self::getVersion($dbname, $result['tablename'], $result['identifier']); + + // If version not exists and auto-creation is enabled + if(self::$version_auto_create == true and + self::isTracked($dbname, $result['tablename']) == false and + $version == -1) + { + // Create the version + + if($result['identifier'] == 'CREATE TABLE') + self::createVersion($dbname, $result['tablename'], '1'); + + if($result['identifier'] == 'CREATE VIEW') + self::createVersion($dbname, $result['tablename'], '1', '', true); + + if($result['identifier'] == 'CREATE DATABASE') + self::createDatabaseVersion($dbname, '1', $query); + } + + // If version exists + if(self::isTracked($dbname, $result['tablename']) and $version != -1) + { + if($result['type'] == 'DDL') + $save_to = 'schema_sql'; + else if($result['type'] == 'DML') + $save_to = 'data_sql'; + else + $save_to = ''; + + $date = date('Y-m-d H:i:s'); + + // Cut off `dbname`. from query + $query = preg_replace('/`'.$dbname.'`\s?\./', '', $query); + + // Add log information + $query = self::getLogComment() . $query ; + + // Mark it as untouchable + $sql_query = + " /*NOTRACK*/\n" . + " UPDATE " . self::$pma_table . + " SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddslashes($query) . "') ," . + " " . PMA_backquote('date_updated') . " = '" . $date . "' "; + + // If table was renamed we have to change the tablename attribute in pma_tracking too + if($result['identifier'] == 'RENAME TABLE') + $sql_query .= ', ' . PMA_backquote('table_name') . ' = \'' . PMA_sqlAddslashes($result['tablename_after_rename']) . '\' '; + + // Save the tracking information only for + // 1. the database + // 2. the table / view + // 3. the statements + // we want to track + $sql_query .= + " WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" . + " AND " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " . + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($result['tablename']) . "' " . + " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' "; + + $result = PMA_query_as_controluser($sql_query); + } + } + } +} +?> diff --git a/libraries/common.inc.php b/libraries/common.inc.php index e2adc6106..2d90e8488 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -101,6 +101,16 @@ require_once './libraries/Theme_Manager.class.php'; */ require_once './libraries/Config.class.php'; +/** + * the relation lib, tracker needs it + */ +require_once './libraries/relation.lib.php'; + +/** + * the PMA_Tracker class + */ +require_once './libraries/Tracker.class.php'; + /** * the PMA_Table class */ @@ -982,4 +992,4 @@ if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) { require $__redirect; exit(); } -?> \ No newline at end of file +?> diff --git a/libraries/common.lib.php b/libraries/common.lib.php index a29e5e4e0..382fd1260 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -24,10 +24,6 @@ function PMA_pow($base, $exp, $use_function = false) { static $pow_function = null; - if ($exp < 0) { - return false; - } - if (null == $pow_function) { if (function_exists('bcpow')) { // BCMath Arbitrary Precision Mathematics Function @@ -45,6 +41,9 @@ function PMA_pow($base, $exp, $use_function = false) $use_function = $pow_function; } + if ($exp < 0 && 'pow' != $use_function) { + return false; + } switch ($use_function) { case 'bcpow' : // bcscale() needed for testing PMA_pow() with base values < 1 @@ -1463,8 +1462,9 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false) } // end for } elseif (!$only_down && (float) $value !== 0.0) { for ($d = -8; $d <= 8; $d++) { - if (isset($units[$d]) && $value <= $li * PMA_pow(1000, $d-1)) { - $value = round($value / (PMA_pow(1000, $d) / $dh)) /$dh; + // force using pow() because of the negative exponent + if (isset($units[$d]) && $value <= $li * PMA_pow(1000, $d-1, 'pow')) { + $value = round($value / (PMA_pow(1000, $d, 'pow') / $dh)) /$dh; $unit = $units[$d]; break 1; } // end if @@ -1912,6 +1912,7 @@ function PMA_checkParameters($params, $die = true, $request = true) * @uses PMA_DBI_field_flags() * @uses PMA_backquote() * @uses PMA_sqlAddslashes() + * @uses PMA_printable_bit_value() * @uses stristr() * @uses bin2hex() * @uses preg_replace() @@ -2003,6 +2004,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force // this blob won't be part of the final condition $condition = ''; } + } elseif ($meta->type == 'bit') { + $condition .= "= b'" . PMA_printable_bit_value($row[$i], $meta->length) . "' AND"; } else { $condition .= '= \'' . PMA_sqlAddslashes($row[$i], false, true) . '\' AND'; @@ -2434,7 +2437,7 @@ window.addEvent('domready', function(){ var anchor<?php echo $id; ?> = new Element('a', { 'id': 'toggle_<?php echo $id; ?>', - 'href': '#', + 'href': 'javascript:void(0)', 'events': { 'click': function(){ mySlide<?php echo $id; ?>.toggle(); @@ -2561,6 +2564,18 @@ function PMA_printable_bit_value($value, $length) { return $printable; } +/** + * Converts a BIT type default value + * for example, b'010' becomes 010 + * + * @uses strtr() + * @param string $bit_default_value + * @return string the converted value + */ +function PMA_convert_bit_default_value($bit_default_value) { + return strtr($bit_default_value, array("b" => "", "'" => "")); +} + /** * Extracts the various parts from a field type spec * diff --git a/libraries/config.default.php b/libraries/config.default.php index 13820fdb8..ddb8b2732 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -331,6 +331,15 @@ $cfg['Servers'][$i]['history'] = ''; */ $cfg['Servers'][$i]['designer_coords'] = ''; +/** + * table to store SQL tracking + * - leave blank for no SQL tracking + * SUGGESTED: 'pma_tracking' + * + * @global string $cfg['Servers'][$i]['tracking'] + */ +$cfg['Servers'][$i]['tracking'] = ''; + /** * set to false if you know that your pma_* tables are up to date. * This prevents compatibility checks and thereby increases performance. @@ -409,6 +418,50 @@ $cfg['Servers'][$i]['ShowDatabasesCommand'] = 'SHOW DATABASES'; */ $cfg['Servers'][$i]['CountTables'] = true; +/** + * Whether the tracking mechanism creates versions for tables and views automatically. + * + * @global bool $cfg['Servers'][$i]['tracking_version_auto_create'] + */ + +$cfg['Servers'][$i]['tracking_version_auto_create'] = true; + +/** + * Defines the list of statements the auto-creation uses for new versions. + * + * @global string $cfg['Servers'][$i]['tracking_default_statements'] + */ + +$cfg['Servers'][$i]['tracking_default_statements'] = 'CREATE TABLE,ALTER TABLE,DROP TABLE,RENAME TABLE,' . + 'CREATE INDEX,DROP INDEX,' . + 'INSERT,UPDATE,DELETE,TRUNCATE,REPLACE,' . + 'CREATE VIEW,ALTER VIEW,DROP VIEW,' . + 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE'; + +/** + * Whether a DROP VIEW IF EXISTS statement will added as first line to the log when creating a view. + * + * @global bool $cfg['Servers'][$i]['tracking_version_drop_view'] + */ + +$cfg['Servers'][$i]['tracking_version_drop_view'] = true; + +/** + * Whether a DROP TABLE IF EXISTS statement will added as first line to the log when creating a table. + * + * @global bool $cfg['Servers'][$i]['tracking_version_drop_table'] + */ + +$cfg['Servers'][$i]['tracking_version_drop_table'] = true; + +/** + * Whether a DROP DATABASE IF EXISTS statement will added as first line to the log when creating a database. + * + * @global bool $cfg['Servers'][$i]['tracking_version_drop_database'] + */ + +$cfg['Servers'][$i]['tracking_version_drop_database'] = true; + /** * Default server (0 = no default server) * @@ -1132,20 +1185,6 @@ $cfg['Export']['odt_mime'] = true; */ $cfg['Export']['odt_null'] = 'NULL'; -/** - * - * - * @global boolean $cfg['Export']['htmlexcel_columns'] - */ -$cfg['Export']['htmlexcel_columns'] = false; - -/** - * - * - * @global string $cfg['Export']['htmlexcel_null'] - */ -$cfg['Export']['htmlexcel_null'] = 'NULL'; - /** * * @@ -1216,6 +1255,20 @@ $cfg['Export']['xls_columns'] = false; */ $cfg['Export']['xls_null'] = 'NULL'; +/** + * + * + * @global boolean $cfg['Export']['xlsx_columns'] + */ +$cfg['Export']['xlsx_columns'] = false; + +/** + * + * + * @global string $cfg['Export']['xlsx_null'] + */ +$cfg['Export']['xlsx_null'] = 'NULL'; + /** * * @@ -1568,6 +1621,55 @@ $cfg['Export']['pdf_data'] = true; */ $cfg['Export']['pdf_report_title'] = ''; +/** + * Export schema for each structure + * + * @global string $cfg['Export']['xml_export_struc'] + */ +$cfg['Export']['xml_export_struc'] = true; + +/** + * Export functions + * + * @global string $cfg['Export']['xml_export_functions'] + */ +$cfg['Export']['xml_export_functions'] = true; + +/** + * Export procedures + * + * @global string $cfg['Export']['xml_export_procedures'] + */ +$cfg['Export']['xml_export_procedures'] = true; + +/** + * Export schema for each table + * + * @global string $cfg['Export']['xml_export_tables'] + */ +$cfg['Export']['xml_export_tables'] = true; + +/** + * Export triggers + * + * @global string $cfg['Export']['xml_export_triggers'] + */ +$cfg['Export']['xml_export_triggers'] = true; + +/** + * Export views + * + * @global string $cfg['Export']['xml_export_views'] + */ +$cfg['Export']['xml_export_views'] = true; + +/** + * Export contents data + * + * @global string $cfg['Export']['xml_export_contents'] + */ +$cfg['Export']['xml_export_contents'] = true; + /******************************************************************************* * Import defaults @@ -1658,6 +1760,13 @@ $cfg['Import']['csv_new_line'] = 'auto'; */ $cfg['Import']['csv_columns'] = ''; +/** + * + * + * @global string $cfg['Import']['csv_col_names'] + */ +$cfg['Import']['csv_col_names'] = false; + /** * * @@ -1707,6 +1816,48 @@ $cfg['Import']['ldi_columns'] = ''; */ $cfg['Import']['ldi_local_option'] = 'auto'; +/** + * + * + * @global string $cfg['Import']['ods_col_names'] + */ +$cfg['Import']['ods_col_names'] = false; + +/** + * + * + * @global string $cfg['Import']['ods_empty_rows'] + */ +$cfg['Import']['ods_empty_rows'] = true; + +/** + * + * + * @global string $cfg['Import']['ods_recognize_percentages'] + */ +$cfg['Import']['ods_recognize_percentages'] = true; + +/** + * + * + * @global string $cfg['Import']['ods_recognize_currency'] + */ +$cfg['Import']['ods_recognize_currency'] = true; + +/** + * + * + * @global string $cfg['Import']['xml_col_names'] + */ +$cfg['Import']['xls_col_names'] = false; + +/** + * + * + * @global string $cfg['Import']['xml_empty_rows'] + */ +$cfg['Import']['xls_empty_rows'] = true; + /** * Link to the official MySQL documentation. * Be sure to include no trailing slash on the path. diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index e5f248d5d..6eea5f57f 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -17,8 +17,8 @@ if (! defined('PHPMYADMIN')) { define('PMA_DBI_QUERY_STORE', 1); // Force STORE_RESULT method, ignored by classic MySQL. define('PMA_DBI_QUERY_UNBUFFERED', 2); // Do not read whole query // PMA_DBI_get_variable() -define('PMA_DBI_GETVAR_SESSION', 1); -define('PMA_DBI_GETVAR_GLOBAL', 2); +define('PMA_DBI_GETVAR_SESSION', 1); +define('PMA_DBI_GETVAR_GLOBAL', 2); /** * Checks one of the mysql extensions @@ -33,7 +33,6 @@ function PMA_DBI_checkMysqlExtension($extension = 'mysql') { return true; } - /** * check for requested extension */ @@ -616,8 +615,13 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, += $row['Max_data_length']; $databases[$database_name]['SCHEMA_INDEX_LENGTH'] += $row['Index_length']; - $databases[$database_name]['SCHEMA_DATA_FREE'] - += $row['Data_free']; + + // for InnoDB, this does not contain the number of + // overhead bytes but the total free space + if ('InnoDB' != $row['Engine']) { + $databases[$database_name]['SCHEMA_DATA_FREE'] + += $row['Data_free']; + } $databases[$database_name]['SCHEMA_LENGTH'] += $row['Data_length'] + $row['Index_length']; } @@ -1330,13 +1334,35 @@ function PMA_DBI_get_triggers($db, $table) $one_result['action_timing'] = $trigger['ACTION_TIMING']; $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION']; - $one_result['full_trigger_name'] = PMA_backquote($trigger['TRIGGER_SCHEMA']) . '.' . PMA_backquote($trigger['TRIGGER_NAME']); + // do not prepend the schema name; this way, importing the + // definition into another schema will work + $one_result['full_trigger_name'] = PMA_backquote($trigger['TRIGGER_NAME']); $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name']; - $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING']. ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_backquote($trigger['EVENT_OBJECT_SCHEMA']) . '.' . PMA_backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n"; + $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING']. ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n"; $result[] = $one_result; } } return($result); } + +/** + * Returns TRUE if $db.$view_name is a view, FALSE if not + * + * @uses PMA_DBI_fetch_result() + * @param string $db database name + * @param string $view_name view/table name + * + * @return bool TRUE if $db.$view_name is a view, FALSE if not + */ +function PMA_isView($db, $view_name) +{ + $result = PMA_DBI_fetch_result("SELECT TABLE_NAME FROM information_schema.VIEWS WHERE TABLE_SCHEMA = '".$db."' and TABLE_NAME = '".$view_name."';"); + + if ($result) { + return TRUE; + } else { + return FALSE; + } +} ?> diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php index 3505dc963..11a049f0a 100644 --- a/libraries/db_links.inc.php +++ b/libraries/db_links.inc.php @@ -76,6 +76,13 @@ $tab_search['text'] = $GLOBALS['strSearch']; $tab_search['icon'] = 'b_search.png'; $tab_search['link'] = 'db_search.php'; +if(PMA_Tracker::isActive()) +{ + $tab_tracking['text'] = "Tracking"; + $tab_tracking['icon'] = 'eye.png'; + $tab_tracking['link'] = 'db_tracking.php'; +} + $tab_qbe['text'] = $GLOBALS['strQBE']; $tab_qbe['icon'] = 's_db.png'; $tab_qbe['link'] = 'db_qbe.php'; @@ -113,6 +120,9 @@ $tabs = array(); $tabs[] =& $tab_structure; $tabs[] =& $tab_sql; $tabs[] =& $tab_search; +if (PMA_Tracker::isActive()) { + $tabs[] =& $tab_tracking; +} $tabs[] =& $tab_qbe; $tabs[] =& $tab_export; if (! $db_is_information_schema) { diff --git a/libraries/db_structure.lib.php b/libraries/db_structure.lib.php index 3542e1aee..0ad779bd8 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -46,7 +46,8 @@ function PMA_TableHeader($db_is_information_schema = false) .' <th colspan="' . $action_colspan . '">' . "\n" .' ' . $GLOBALS['strAction'] . "\n" .' </th>' - .' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records') + // larger values are more interesting so default sort order is DESC + .' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records', 'DESC') .PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n" .' </th>' . "\n"; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { @@ -56,8 +57,10 @@ function PMA_TableHeader($db_is_information_schema = false) $cnt++; } if ($GLOBALS['is_show_stats']) { - echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size') . '</th>' . "\n" - . ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead') . '</th>' . "\n"; + // larger values are more interesting so default sort order is DESC + echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size', 'DESC') . '</th>' . "\n" + // larger values are more interesting so default sort order is DESC + . ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead', 'DESC') . '</th>' . "\n"; $cnt += 2; } echo '</tr>' . "\n"; @@ -72,14 +75,14 @@ function PMA_TableHeader($db_is_information_schema = false) * * @param string title to use for the link * @param string corresponds to sortable data name mapped in libraries/db_info.inc.php + * @param string initial sort order * @returns string link to be displayed in the table header */ -function PMA_SortableTableHeader($title, $sort) +function PMA_SortableTableHeader($title, $sort, $initial_sort_order = 'ASC') { // Set some defaults $requested_sort = 'table'; - $requested_sort_order = 'ASC'; - $sort_order = 'ASC'; + $requested_sort_order = $future_sort_order = $initial_sort_order; // If the user requested a sort if (isset($_REQUEST['sort'])) { @@ -97,14 +100,21 @@ function PMA_SortableTableHeader($title, $sort) // If this column was requested to be sorted. if ($requested_sort == $sort) { if ($requested_sort_order == 'ASC') { - $sort_order = 'DESC'; - $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />'; - $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }'; - $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }'; - } else { + $future_sort_order = 'DESC'; + // current sort order is ASC $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="sort_arrow" />'; + // but on mouse over, show the reverse order (DESC) $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }'; + // on mouse out, show current sort order (ASC) $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }'; + } else { + $future_sort_order = 'ASC'; + // current sort order is DESC + $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />'; + // but on mouse over, show the reverse order (ASC) + $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }'; + // on mouse out, show current sort order (DESC) + $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }'; } } @@ -114,7 +124,7 @@ function PMA_SortableTableHeader($title, $sort) $url = 'db_structure.php'.PMA_generate_common_url($_url_params); // We set the position back to 0 every time they sort. - $url .= "&amp;pos=0&amp;sort=$sort&amp;sort_order=$sort_order"; + $url .= "&amp;pos=0&amp;sort=$sort&amp;sort_order=$future_sort_order"; return PMA_linkOrButton($url, $title . $order_img, $order_link_params); } // end function PMA_SortableTableHeader() diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index 1539614da..cd3b0bf04 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -174,6 +174,9 @@ function PMA_DBI_try_query($query, $link = null, $options = 0) $_SESSION['debug']['queries'][$hash]['trace'][] = $trace; } + if($r != FALSE and PMA_Tracker::isActive() == TRUE ) + PMA_Tracker::handleQuery($query); + return $r; } diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index a781e6ad6..660b944a7 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -198,6 +198,9 @@ function PMA_DBI_try_query($query, $link = null, $options = 0) $_SESSION['debug']['queries'][$hash]['trace'][] = $trace; } + if($r != FALSE and PMA_Tracker::isActive() == TRUE ) + PMA_Tracker::handleQuery($query); + return $r; // From the PHP manual: diff --git a/libraries/export/htmlexcel.php b/libraries/export/htmlexcel.php deleted file mode 100644 index 506ec0475..000000000 --- a/libraries/export/htmlexcel.php +++ /dev/null @@ -1,196 +0,0 @@ -<?php -/* vim: set expandtab sw=4 ts=4 sts=4: */ -/** - * Set of functions used to build CSV dumps of tables - * - * @package phpMyAdmin-Export-HTMLExcel - * @version $Id$ - */ -if (! defined('PHPMYADMIN')) { - exit; -} - -/** - * - */ -if (isset($plugin_list)) { - $plugin_list['htmlexcel'] = array( - 'text' => 'strHTMLExcel', - 'extension' => 'xls', - 'mime_type' => 'application/vnd.ms-excel', - 'force_file' => true, - 'options' => array( - array('type' => 'text', 'name' => 'null', 'text' => 'strReplaceNULLBy'), - array('type' => 'bool', 'name' => 'columns', 'text' => 'strPutColNames'), - array('type' => 'hidden', 'name' => 'data'), - ), - 'options_text' => 'strOptions', - ); -} else { - -/** - * Outputs comment - * - * @param string Text of comment - * - * @return bool Whether it suceeded - */ -function PMA_exportComment($text) { - return TRUE; -} - -/** - * Outputs export footer - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportFooter() { - if (!PMA_exportOutputHandler(' -</table> -</div> -</body> -</html> -')) { - return FALSE; - } - return TRUE; -} - -/** - * Outputs export header - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportHeader() { - global $charset, $charset_of_file; - if (!PMA_exportOutputHandler(' -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:x="urn:schemas-microsoft-com:office:excel" -xmlns="http://www.w3.org/TR/REC-html40"> - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> -<head> - <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" /> -<style id="Classeur1_16681_Styles"> -</style> - -</head> -<body> - -<div id="Classeur1_16681" align=center x:publishsource="Excel"> - -<table x:str border=0 cellpadding=0 cellspacing=0 width=100% style="border-collapse: collapse"> -')) { - return FALSE; - } - - return TRUE; -} - -/** - * Outputs database header - * - * @param string Database name - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportDBHeader($db) { - return TRUE; -} - -/** - * Outputs database footer - * - * @param string Database name - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportDBFooter($db) { - return TRUE; -} - -/** - * Outputs create database database - * - * @param string Database name - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportDBCreate($db) { - return TRUE; -} - -/** - * Outputs the content of a table in CSV format - * - * @param string the database name - * @param string the table name - * @param string the end of line sequence - * @param string the url to go back in case of error - * @param string SQL query for obtaining data - * - * @return bool Whether it suceeded - * - * @access public - */ -function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { - global $what; - - // Gets the data from the database - $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED); - $fields_cnt = PMA_DBI_num_fields($result); - - // If required, get fields name at the first line - if (isset($GLOBALS[$what . '_columns'])) { - $schema_insert = '<tr>'; - for ($i = 0; $i < $fields_cnt; $i++) { - $schema_insert .= '<td class=xl2216681 nowrap><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>'; - } // end for - $schema_insert .= '</tr>'; - if (!PMA_exportOutputHandler($schema_insert)) { - return FALSE; - } - } // end if - - $fields_meta = PMA_DBI_get_fields_meta($result); - - // Format the data - while ($row = PMA_DBI_fetch_row($result)) { - $schema_insert = '<tr>'; - for ($j = 0; $j < $fields_cnt; $j++) { - if (!isset($row[$j]) || is_null($row[$j])) { - $value = $GLOBALS[$what . '_null']; - } elseif ($row[$j] == '0' || $row[$j] != '') { - $value = $row[$j]; - } else { - $value = ''; - } - $schema_insert .= '<td class=xl2216681 nowrap'; - if ('1' == $fields_meta[$j]->numeric) { - $schema_insert .= ' x:num '; - } - $schema_insert .= '>' . htmlspecialchars($value) . '</td>'; - } // end for - $schema_insert .= '</tr>'; - if (!PMA_exportOutputHandler($schema_insert)) { - return FALSE; - } - } // end while - PMA_DBI_free_result($result); - - return TRUE; -} - -} -?> diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 443030b08..a0bedf75f 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -131,7 +131,7 @@ if (! isset($sql_backquotes)) { } /** - * Outputs comment + * Possibly outputs comment * * @param string Text of comment * @@ -139,7 +139,7 @@ if (! isset($sql_backquotes)) { */ function PMA_exportComment($text = '') { - if ($GLOBALS['sql_include_comments']) { + if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) { // see http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html return '--' . (empty($text) ? '' : ' ') . $text . $GLOBALS['crlf']; } else { @@ -147,6 +147,21 @@ function PMA_exportComment($text = '') } } +/** + * Possibly outputs CRLF + * + * @return string $crlf or nothing + */ +function PMA_possibleCRLF() +{ + + if (isset($GLOBALS['sql_include_comments']) && $GLOBALS['sql_include_comments']) { + return $GLOBALS['crlf']; + } else { + return ''; + } +} + /** * Outputs export footer * @@ -162,11 +177,11 @@ function PMA_exportFooter() $foot = ''; if (isset($GLOBALS['sql_disable_fk'])) { - $foot .= $crlf . 'SET FOREIGN_KEY_CHECKS=1;' . $crlf; + $foot .= 'SET FOREIGN_KEY_CHECKS=1;' . $crlf; } if (isset($GLOBALS['sql_use_transaction'])) { - $foot .= $crlf . 'COMMIT;' . $crlf; + $foot .= 'COMMIT;' . $crlf; } // restore connection settings @@ -211,7 +226,8 @@ function PMA_exportHeader() $head .= PMA_exportComment($GLOBALS['strGenTime'] . ': ' . PMA_localisedDate()) . PMA_exportComment($GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3)) - . PMA_exportComment($GLOBALS['strPHPVersion'] . ': ' . phpversion()); + . PMA_exportComment($GLOBALS['strPHPVersion'] . ': ' . phpversion()) + . PMA_possibleCRLF(); if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) { // '\n' is not a newline (like "\n" would be), it's the characters @@ -225,20 +241,20 @@ function PMA_exportHeader() } if (isset($GLOBALS['sql_disable_fk'])) { - $head .= $crlf . 'SET FOREIGN_KEY_CHECKS=0;' . $crlf; + $head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf; } /* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */ if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') { - $head .= $crlf . 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf; + $head .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf; } if (isset($GLOBALS['sql_use_transaction'])) { - $head .= $crlf .'SET AUTOCOMMIT=0;' . $crlf + $head .= 'SET AUTOCOMMIT=0;' . $crlf . 'START TRANSACTION;' . $crlf; } - $head .= $crlf; + $head .= PMA_possibleCRLF(); if (! empty($GLOBALS['asfile'])) { // we are saving as file, therefore we provide charset information @@ -684,7 +700,7 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mim } if (isset($mime_map) && count($mime_map) > 0) { - $schema_create .= $crlf + $schema_create .= PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment($GLOBALS['strMIMETypesForTable']. ' ' . PMA_backquote($table, $sql_backquotes) . ':'); @reset($mime_map); @@ -696,7 +712,7 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_mim } if ($have_rel) { - $schema_create .= $crlf + $schema_create .= PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment($GLOBALS['strRelationsForTable']. ' ' . PMA_backquote($table, $sql_backquotes) . ':'); foreach ($res_rel AS $rel_field => $rel) { @@ -737,9 +753,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) ? PMA_backquote($table) : '\'' . $table . '\''; - $dump = $crlf + $dump = PMA_possibleCRLF() . PMA_exportComment(str_repeat('-', 56)) - . $crlf + . PMA_possibleCRLF() . PMA_exportComment(); switch($export_mode) { @@ -749,7 +765,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates); $triggers = PMA_DBI_get_triggers($db, $table); if ($triggers) { - $dump .= $crlf + $dump .= PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment($GLOBALS['strTriggers'] . ' ' . $formatted_table_name) . PMA_exportComment(); @@ -822,12 +838,12 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) // Do not export data for a VIEW // (For a VIEW, this is called only when exporting a single VIEW) if (PMA_Table::isView($db, $table)) { - $head = $crlf + $head = PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment('VIEW ' . ' ' . $formatted_table_name) . PMA_exportComment($GLOBALS['strData'] . ': ' . $GLOBALS['strNone']) . PMA_exportComment() - . $crlf; + . PMA_possibleCRLF(); if (! PMA_exportOutputHandler($head)) { return FALSE; @@ -836,11 +852,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } // it's not a VIEW - $head = $crlf + $head = PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment($GLOBALS['strDumpingData'] . ' ' . $formatted_table_name) - . PMA_exportComment() - . $crlf; + . PMA_exportComment(); if (! PMA_exportOutputHandler($head)) { return FALSE; @@ -861,6 +876,13 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } if ($result != FALSE) { + // emit a single CRLF before the first data statement (produces + // an unintended CRLF when there is no data, but I don't see how it + // can be avoided, as we are in UNBUFFERED mode) + if (! PMA_exportOutputHandler($crlf)) { + return FALSE; + } + $fields_cnt = PMA_DBI_num_fields($result); // Get field information diff --git a/libraries/export/xls.php b/libraries/export/xls.php index 07b676c6e..b450d6f2a 100644 --- a/libraries/export/xls.php +++ b/libraries/export/xls.php @@ -1,10 +1,10 @@ <?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** - * Set of functions used to build XLS dumps of tables * - * @version $Id$ + * * @package phpMyAdmin-Export-XLS + * @version $Id$ */ if (! defined('PHPMYADMIN')) { exit; @@ -13,38 +13,26 @@ if (! defined('PHPMYADMIN')) { /** * */ -// Check if we have native MS Excel export using PEAR class Spreadsheet_Excel_Writer -if (!empty($GLOBALS['cfg']['TempDir'])) { - @include_once 'Spreadsheet/Excel/Writer.php'; - if (class_exists('Spreadsheet_Excel_Writer')) { - $xls = TRUE; - } else { - $xls = FALSE; - } +if (isset($plugin_list)) { + $plugin_list['xls'] = array( + 'text' => 'strImportXLS', + 'extension' => 'xls', + 'mime_type' => 'application/vnd.ms-excel', + 'force_file' => true, + 'options' => array( + array('type' => 'text', 'name' => 'null', 'text' => 'strReplaceNULLBy'), + array('type' => 'bool', 'name' => 'columns', 'text' => 'strPutColNames'), + array('type' => 'hidden', 'name' => 'data'), + ), + 'options_text' => 'strOptions', + ); } else { - $xls = FALSE; -} -if ($xls) { +/* Append the PHPExcel directory to the include path variable */ +set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/'); - if (isset($plugin_list)) { - $plugin_list['xls'] = array( - 'text' => 'strStrucNativeExcel', - 'extension' => 'xls', - 'mime_type' => 'application/vnd.ms-excel', - 'force_file' => true, - 'options' => array( - array('type' => 'text', 'name' => 'null', 'text' => 'strReplaceNULLBy'), - array('type' => 'bool', 'name' => 'columns', 'text' => 'strPutColNames'), - array('type' => 'hidden', 'name' => 'data'), - ), - 'options_text' => 'strOptions', - ); - } else { - -/** - * Set of functions used to build MS Excel dumps of tables - */ +require_once './libraries/PHPExcel/PHPExcel.php'; +require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php'; /** * Outputs comment @@ -53,8 +41,7 @@ if ($xls) { * * @return bool Whether it suceeded */ -function PMA_exportComment($text) -{ +function PMA_exportComment($text) { return TRUE; } @@ -65,20 +52,23 @@ function PMA_exportComment($text) * * @access public */ -function PMA_exportFooter() -{ +function PMA_exportFooter() { global $workbook; global $tmp_filename; - - $res = $workbook->close(); - if (PEAR::isError($res)) { - echo $res->getMessage(); - return FALSE; - } + + $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_'); + + $workbookWriter = new PHPExcel_Writer_Excel5($workbook); + $workbookWriter->save($tmp_filename); + if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) { return FALSE; } + unlink($tmp_filename); + + unset($GLOBALS['workbook']); + unset($GLOBALS['sheet_index']); return TRUE; } @@ -90,17 +80,19 @@ function PMA_exportFooter() * * @access public */ -function PMA_exportHeader() -{ +function PMA_exportHeader() { + global $db; + + /* Initialize the workbook */ + $GLOBALS['workbook'] = new PHPExcel(); + $GLOBALS['sheet_index'] = 0; global $workbook; - global $tmp_filename; - - if (empty($GLOBALS['cfg']['TempDir'])) { - return FALSE; - } - $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_'); - $workbook = new Spreadsheet_Excel_Writer($tmp_filename); - + + $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION); + $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION); + $workbook->getProperties()->setTitle($db); + $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLS Dump'); + return TRUE; } @@ -113,8 +105,9 @@ function PMA_exportHeader() * * @access public */ -function PMA_exportDBHeader($db) -{ +function PMA_exportDBHeader($db) { + + return TRUE; } @@ -127,8 +120,7 @@ function PMA_exportDBHeader($db) * * @access public */ -function PMA_exportDBFooter($db) -{ +function PMA_exportDBFooter($db) { return TRUE; } @@ -141,13 +133,12 @@ function PMA_exportDBFooter($db) * * @access public */ -function PMA_exportDBCreate($db) -{ +function PMA_exportDBCreate($db) { return TRUE; } /** - * Outputs the content of a table in CSV format + * Outputs the content of a table in XLS format * * @param string the database name * @param string the table name @@ -159,61 +150,56 @@ function PMA_exportDBCreate($db) * * @access public */ -function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) -{ - global $what; +function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { global $workbook; - - $workbook->setTempDir(realpath($GLOBALS['cfg']['TempDir'])); - - // Gets the data from the database - $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED); - $fields_cnt = PMA_DBI_num_fields($result); - - $row = PMA_DBI_fetch_row($result); - for ($sheetIndex = 0; ; $sheetIndex++) { - // Maximum sheet name length is 31 chars - leave 2 for numeric index - $sheetName = substr($table, 0, 29) . ($sheetIndex > 0 ? $sheetIndex : ''); - $worksheet =& $workbook->addWorksheet($sheetName); - $rowIndex = 0; - - // If required, get fields name at the first line + global $sheet_index; + + /** + * Get the data from the database using the original query + */ + $result = PMA_DBI_fetch_result($sql_query); + $row_cnt = count($result); + + if ($row_cnt > 0) { + $col_names = array_keys($result[0]); + $fields_cnt = count($result[0]); + $row_offset = 1; + + /* Only one sheet is created on workbook initialization */ + if ($sheet_index > 0) { + $workbook->createSheet(); + } + + $workbook->setActiveSheetIndex($sheet_index); + $workbook->getActiveSheet()->setTitle(substr($table, 0, 31)); + if (isset($GLOBALS['xls_columns']) && $GLOBALS['xls_columns']) { - for ($i = 0; $i < $fields_cnt; $i++) { - $worksheet->write(0, $i, stripslashes(PMA_DBI_field_name($result, $i))); - } // end for - $worksheet->repeatRows($rowIndex); - $worksheet->freezePanes(array($rowIndex + 1, 0, $rowIndex + 1, 0)); - $rowIndex++; - } // end if - - // Format the data (max 65536 rows per worksheet) - while ($rowIndex < 65536 && $row) { - set_time_limit(0); - for ($j = 0; $j < $fields_cnt; $j++) { - if (!isset($row[$j]) || is_null($row[$j])) { - $worksheet->write($rowIndex, $j, $GLOBALS['xls_null']); - } elseif ($row[$j] == '0' || $row[$j] != '') { + for ($i = 0; $i < $fields_cnt; ++$i) { + $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]); + } + $row_offset++; + } + + for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) { + for ($c = 0; $c < $fields_cnt; ++$c) { + if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) { + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xls_null']); + } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') { /** * @todo we should somehow handle character set here! */ - $worksheet->write($rowIndex, $j, $row[$j]); + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]); } else { - $worksheet->write($rowIndex, $j, ''); + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), ''); } - } // end for - $rowIndex++; - $row = PMA_DBI_fetch_row($result); - } // end while - if (!$row) { - break; + } } - } // end for - PMA_DBI_free_result($result); - + + $sheet_index++; + } + return TRUE; } - } } ?> diff --git a/libraries/export/xlsx.php b/libraries/export/xlsx.php new file mode 100644 index 000000000..5a8ec703d --- /dev/null +++ b/libraries/export/xlsx.php @@ -0,0 +1,205 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * + * + * @package phpMyAdmin-Export-XLSX + * @version $Id$ + */ +if (! defined('PHPMYADMIN')) { + exit; +} + +/** + * + */ +if (isset($plugin_list)) { + $plugin_list['xlsx'] = array( + 'text' => 'strImportXLSX', + 'extension' => 'xlsx', + 'mime_type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'force_file' => true, + 'options' => array( + array('type' => 'text', 'name' => 'null', 'text' => 'strReplaceNULLBy'), + array('type' => 'bool', 'name' => 'columns', 'text' => 'strPutColNames'), + array('type' => 'hidden', 'name' => 'data'), + ), + 'options_text' => 'strOptions', + ); +} else { + +/* Append the PHPExcel directory to the include path variable */ +set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/'); + +require_once './libraries/PHPExcel/PHPExcel.php'; +require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php'; + +/** + * Outputs comment + * + * @param string Text of comment + * + * @return bool Whether it suceeded + */ +function PMA_exportComment($text) { + return TRUE; +} + +/** + * Outputs export footer + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportFooter() { + global $workbook; + global $tmp_filename; + + $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_'); + + $workbookWriter = new PHPExcel_Writer_Excel2007($workbook); + $workbookWriter->save($tmp_filename); + + if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) { + return FALSE; + } + + unlink($tmp_filename); + + unset($GLOBALS['workbook']); + unset($GLOBALS['sheet_index']); + + return TRUE; +} + +/** + * Outputs export header + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportHeader() { + global $db; + + /* Initialize the workbook */ + $GLOBALS['workbook'] = new PHPExcel(); + $GLOBALS['sheet_index'] = 0; + global $workbook; + + $workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION); + $workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION); + $workbook->getProperties()->setTitle($db); + $workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump'); + + return TRUE; +} + +/** + * Outputs database header + * + * @param string Database name + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportDBHeader($db) { + + + return TRUE; +} + +/** + * Outputs database footer + * + * @param string Database name + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportDBFooter($db) { + return TRUE; +} + +/** + * Outputs create database database + * + * @param string Database name + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportDBCreate($db) { + return TRUE; +} + +/** + * Outputs the content of a table in XLSX format + * + * @param string the database name + * @param string the table name + * @param string the end of line sequence + * @param string the url to go back in case of error + * @param string SQL query for obtaining data + * + * @return bool Whether it suceeded + * + * @access public + */ +function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { + global $workbook; + global $sheet_index; + + /** + * Get the data from the database using the original query + */ + $result = PMA_DBI_fetch_result($sql_query); + $row_cnt = count($result); + + if ($row_cnt > 0) { + $col_names = array_keys($result[0]); + $fields_cnt = count($result[0]); + $row_offset = 1; + + /* Only one sheet is created on workbook initialization */ + if ($sheet_index > 0) { + $workbook->createSheet(); + } + + $workbook->setActiveSheetIndex($sheet_index); + $workbook->getActiveSheet()->setTitle(substr($table, 0, 31)); + + if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) { + for ($i = 0; $i < $fields_cnt; ++$i) { + $workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]); + } + $row_offset++; + } + + for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) { + for ($c = 0; $c < $fields_cnt; ++$c) { + if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) { + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xlsx_null']); + } elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') { + /** + * @todo we should somehow handle character set here! + */ + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]); + } else { + $workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), ''); + } + } + } + + $sheet_index++; + } + + return TRUE; +} + +} +?> diff --git a/libraries/export/xml.php b/libraries/export/xml.php index 77d75ad19..e55c52b1d 100644 --- a/libraries/export/xml.php +++ b/libraries/export/xml.php @@ -3,6 +3,7 @@ /** * Set of functions used to build XML dumps of tables * + * @todo * @version $Id$ * @package phpMyAdmin-Export-XML */ @@ -10,9 +11,6 @@ if (! defined('PHPMYADMIN')) { exit; } -/** - * - */ if (strlen($GLOBALS['db'])) { /* Can't do server export */ if (isset($plugin_list)) { @@ -23,8 +21,28 @@ if (isset($plugin_list)) { 'options' => array( array('type' => 'hidden', 'name' => 'data'), ), - 'options_text' => 'strOptions', + 'options_text' => 'strOptions' ); + + /* Export structure */ + $plugin_list['xml']['options'][] = + array('type' => 'bgroup', 'name' => 'export_struc', 'text' => 'strXMLExportStructs'); + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_functions', 'text' => 'strXMLExportFunctions'); + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_procedures', 'text' => 'strXMLExportProcedures'); + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_tables', 'text' => 'strXMLExportTables'); + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_triggers', 'text' => 'strXMLExportTriggers'); + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_views', 'text' => 'strXMLExportViews'); + $plugin_list['xml']['options'][] = + array('type' => 'egroup'); + + /* Data */ + $plugin_list['xml']['options'][] = + array('type' => 'bool', 'name' => 'export_contents', 'text' => 'strXMLExportContents'); } else { /** @@ -46,7 +64,9 @@ function PMA_exportComment($text) { * @access public */ function PMA_exportFooter() { - return TRUE; + $foot = '</pma_xml_export>'; + + return PMA_exportOutputHandler($foot); } /** @@ -59,6 +79,13 @@ function PMA_exportFooter() { function PMA_exportHeader() { global $crlf; global $cfg; + global $what; + global $db; + global $table; + global $tables; + + $export_struct = $GLOBALS[$what . '_export_struc']; + $export_data = $GLOBALS[$what . '_export_contents']; if ($GLOBALS['output_charset_conversion']) { $charset = $GLOBALS['charset_of_file']; @@ -66,9 +93,8 @@ function PMA_exportHeader() { $charset = $GLOBALS['charset']; } - $head = '<?xml version="1.0" encoding="' . $charset . '" ?>' . $crlf + $head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf . '<!--' . $crlf - . '-' . $crlf . '- phpMyAdmin XML Dump' . $crlf . '- version ' . PMA_VERSION . $crlf . '- http://www.phpmyadmin.net' . $crlf @@ -82,6 +108,132 @@ function PMA_exportHeader() { . '- ' . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf . '- ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf . '-->' . $crlf . $crlf; + + $head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf; + + if ($export_struct) { + $result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.$db.'\' LIMIT 1'); + $db_collation = $result[0]['DEFAULT_COLLATION_NAME']; + $db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME']; + + $head .= ' <!--' . $crlf; + $head .= ' - Structure schemas' . $crlf; + $head .= ' -->' . $crlf; + $head .= ' <pma:structure_schemas>' . $crlf; + $head .= ' <pma:database name="' . $db . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf; + + if (count($tables) == 0) { + $tables[] = $table; + } + + foreach ($tables as $table) { + // Export tables and views + $result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0); + $tbl = $result[$table][1]; + + $is_view = PMA_isView($db, $table); + + if ($is_view) { + $type = 'view'; + } else { + $type = 'table'; + } + + if ($is_view && !$GLOBALS[$what . '_export_views']) { + continue; + } + + if (!$is_view && !$GLOBALS[$what . '_export_tables']) { + continue; + } + + $head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf; + + $tbl = " " . $tbl; + $tbl = str_replace("\n", "\n ", $tbl); + + $head .= $tbl . ';' . $crlf; + $head .= ' </pma:' . $type . '>' . $crlf; + + if ($GLOBALS[$what . '_export_triggers']) { + // Export triggers + $triggers = PMA_DBI_get_triggers($db, $table); + if ($triggers) { + foreach ($triggers as $trigger) { + $code = $trigger['create']; + $head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf; + + // Do some formatting + $code = substr(rtrim($code), 0, -3); + $code = " " . $code; + $code = str_replace("\n", "\n ", $code); + + $head .= $code . $crlf; + $head .= ' </pma:trigger>' . $crlf; + } + + unset($trigger); + unset($triggers); + } + } + } + + if ($GLOBALS[$what . '_export_functions']) { + // Export functions + $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION'); + if ($functions) { + foreach ($functions as $function) { + $head .= ' <pma:function name="' . $function . '">' . $crlf; + + // Do some formatting + $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function); + $sql = rtrim($sql); + $sql = " " . $sql; + $sql = str_replace("\n", "\n ", $sql); + + $head .= $sql . $crlf; + $head .= ' </pma:function>' . $crlf; + } + + unset($create_func); + unset($function); + unset($functions); + } + } + + if ($GLOBALS[$what . '_export_procedures']) { + // Export procedures + $procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE'); + if ($procedures) { + foreach ($procedures as $procedure) { + $head .= ' <pma:procedure name="' . $procedure . '">' . $crlf; + + // Do some formatting + $sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure); + $sql = rtrim($sql); + $sql = " " . $sql; + $sql = str_replace("\n", "\n ", $sql); + + $head .= $sql . $crlf; + $head .= ' </pma:procedure>' . $crlf; + } + + unset($create_proc); + unset($procedure); + unset($procedures); + } + } + + unset($result); + + $head .= ' </pma:database>' . $crlf; + $head .= ' </pma:structure_schemas>' . $crlf; + + if ($export_data) { + $head .= $crlf; + } + } + return PMA_exportOutputHandler($head); } @@ -96,12 +248,21 @@ function PMA_exportHeader() { */ function PMA_exportDBHeader($db) { global $crlf; - $db = str_replace(' ', '_', $db); - $head = '<!--' . $crlf - . '- ' . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf - . '-->' . $crlf - . '<' . $db . '>' . $crlf; - return PMA_exportOutputHandler($head); + global $what; + + if ($GLOBALS[$what . '_export_contents']) + { + $head = ' <!--' . $crlf + . ' - ' . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf + . ' -->' . $crlf + . ' <database name="' . $db . '">' . $crlf; + + return PMA_exportOutputHandler($head); + } + else + { + return TRUE; + } } /** @@ -115,8 +276,16 @@ function PMA_exportDBHeader($db) { */ function PMA_exportDBFooter($db) { global $crlf; - $db = str_replace(' ', '_', $db); - return PMA_exportOutputHandler('</' . $db . '>' . $crlf); + global $what; + + if ($GLOBALS[$what . '_export_contents']) + { + return PMA_exportOutputHandler(' </database>' . $crlf); + } + else + { + return TRUE; + } } /** @@ -147,36 +316,41 @@ function PMA_exportDBCreate($db) { * @access public */ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { - $db = str_replace(' ', '_', $db); - $table = str_replace(' ', '_', $table); - $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED); - - $columns_cnt = PMA_DBI_num_fields($result); - for ($i = 0; $i < $columns_cnt; $i++) { - $columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i))); - } - unset($i); - - $buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf; - if (!PMA_exportOutputHandler($buffer)) { - return FALSE; - } - - while ($record = PMA_DBI_fetch_row($result)) { - $buffer = ' <' . $table . '>' . $crlf; + global $what; + + if ($GLOBALS[$what . '_export_contents']) + { + $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED); + + $columns_cnt = PMA_DBI_num_fields($result); for ($i = 0; $i < $columns_cnt; $i++) { - if (isset($record[$i]) && !is_null($record[$i])) { - $buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars($record[$i]) - . '</' . $columns[$i] . '>' . $crlf; - } + $columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i))); } - $buffer .= ' </' . $table . '>' . $crlf; - + unset($i); + + $buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf; if (!PMA_exportOutputHandler($buffer)) { return FALSE; } + + while ($record = PMA_DBI_fetch_row($result)) { + $buffer = ' <table name="' . htmlspecialchars($table) . '">' . $crlf; + for ($i = 0; $i < $columns_cnt; $i++) { + // If a cell is NULL, still export it to preserve the XML structure + if (!isset($record[$i]) || is_null($record[$i])) { + $record[$i] = 'NULL'; + } + $buffer .= ' <column name="' . $columns[$i] . '">' . htmlspecialchars(utf8_encode((string)$record[$i])) + . '</column>' . $crlf; + } + $buffer .= ' </table>' . $crlf; + + if (!PMA_exportOutputHandler($buffer)) { + return FALSE; + } + } + PMA_DBI_free_result($result); } - PMA_DBI_free_result($result); return TRUE; } // end of the 'PMA_getTableXML()' function diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php index 128193707..5a5d03baa 100644 --- a/libraries/header_scripts.inc.php +++ b/libraries/header_scripts.inc.php @@ -2,7 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * - * @version $Id: header.inc.php 10719 2007-10-04 15:03:44Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin */ if (! defined('PHPMYADMIN')) { diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 478205926..a1445e9a1 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -129,11 +129,11 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) $my_die = array(); } $my_die[] = array('sql' => $import_run_buffer['full'], 'error' => PMA_DBI_getError()); - + if ($cfg['VerboseMultiSubmit']) { $msg .= $GLOBALS['strError']; } - + if (!$cfg['IgnoreMultiSubmitErrors']) { $error = TRUE; return; @@ -152,14 +152,14 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) if (!$sql_query_disabled) { $sql_query .= $msg . "\n"; } - + // If a 'USE <db>' SQL-clause was found and the query succeeded, set our current $db to the new one if ($result != FALSE && preg_match('@^[\s]*USE[[:space:]]*([\S]+)@i', $import_run_buffer['sql'], $match)) { $db = trim($match[1]); $db = trim($db,';'); // for example, USE abc; $reload = TRUE; } - + if ($result != FALSE && preg_match('@^[\s]*(DROP|CREATE)[\s]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $import_run_buffer['sql'])) { $reload = TRUE; } @@ -298,4 +298,840 @@ function PMA_importGetNextChunk($size = 32768) return $result; } } + +/** + * Returns the "Excel" column name (i.e. 1 = "A", 26 = "Z", 27 = "AA", etc.) + * This algorithm only works up to ZZ. it fails on AAA (up to 701 columns) + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses chr() + * @param int $num + * @return string The column's "Excel" name + */ +function PMA_getColumnAlphaName($num) +{ + /* ASCII value for capital "A" */ + $A = 65; + $sCol = ""; + $iRemain = 0; + + /* This algorithm only works up to ZZ. it fails on AAA */ + + if ($num > 701) { + return $num; + } else if ($num <= 26) { + if ($num == 0) { + $sCol = chr(($A + 26) - 1); + } else { + $sCol = chr(($A + $num) - 1); + } + } else { + $iRemain = (($num / 26))-1; + if (($num % 26) == 0) { + $sCol = PMA_getColumnAlphaName($iRemain) . PMA_getColumnAlphaName($num % 26); + } else { + $sCol = chr($A + $iRemain) . PMA_getColumnAlphaName($num % 26); + } + } + + return $sCol; +} + +/** + * Returns the column number based on the Excel name. + * So "A" = 1, "AZ" = 27, etc. + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses strtoupper() + * @uses strlen() + * @uses count() + * @uses ord() + * @param string $name (i.e. "A", or "BC", etc.) + * @return int The column number + */ +function PMA_getColumnNumberFromName($name) { + if (strlen($name) != 0) { + $name = strtoupper($name); + $num_chars = count($name); + $number = 0; + for ($i = 0; $i < $num_chars; ++$i) { + $number += (ord($name[$i]) - 64); + } + return $number; + } else { + return 0; + } +} + +/** + * Constants definitions + */ + +/* MySQL type defs */ +define("NONE", 0); +define("VARCHAR", 1); +define("INT", 2); +define("DECIMAL", 3); + +/* Decimal size defs */ +define("M", 0); +define("D", 1); +define("FULL", 2); + +/* Table array defs */ +define("TBL_NAME", 0); +define("COL_NAMES", 1); +define("ROWS", 2); + +/* Analysis array defs */ +define("TYPES", 0); +define("SIZES", 1); + +/** + * Obtains the precision (total # of digits) from a size of type decimal + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses substr() + * @uses strpos() + * @param string $last_cumulative_size + * @return int Precision of the given decimal size notation + */ +function PMA_getM($last_cumulative_size) { + return (int)substr($last_cumulative_size, 0, strpos($last_cumulative_size, ",")); +} + +/** + * Obtains the scale (# of digits to the right of the decimal point) from a size of type decimal + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses substr() + * @uses strpos() + * @uses strlen() + * @param string $last_cumulative_size + * @return int Scale of the given decimal size notation + */ +function PMA_getD($last_cumulative_size) { + return (int)substr($last_cumulative_size, (strpos($last_cumulative_size, ",") + 1), (strlen($last_cumulative_size) - strpos($last_cumulative_size, ","))); +} + +/** + * Obtains the decimal size of a given cell + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses strlen() + * @uses strpos() + * @param string &$cell + * @return array Contains the precision, scale, and full size representation of the given decimal cell + */ +function PMA_getDecimalSize(&$cell) { + $curr_size = strlen((string)$cell); + $decPos = strpos($cell, "."); + $decPrecision = ($curr_size - 1) - $decPos; + + $m = $curr_size - 1; + $d = $decPrecision; + + return array($m, $d, ($m.",".$d)); +} + +/** + * Obtains the size of the given cell + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @todo Handle the error cases more elegantly + * + * @access public + * + * @uses M + * @uses D + * @uses FULL + * @uses VARCHAR + * @uses DECIMAL + * @uses INT + * @uses NONE + * @uses strcmp() + * @uses strlen() + * @uses PMA_getM() + * @uses PMA_getD() + * @uses PMA_getDecimalSize() + * @param string $last_cumulative_size Last cumulative column size + * @param int $last_cumulative_type Last cumulative column type (NONE or VARCHAR or DECIMAL or INT) + * @param int $curr_type Type of the current cell (NONE or VARCHAR or DECIMAL or INT) + * @param string &$cell The current cell + * @return string Size of the given cell in the type-appropriate format + */ +function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type, &$cell) { + $curr_size = strlen((string)$cell); + + /** + * If the cell is NULL, don't treat it as a varchar + */ + if (!strcmp('NULL', $cell)) { + return $last_cumulative_size; + } + /** + * What to do if the current cell is of type VARCHAR + */ + else if ($curr_type == VARCHAR) { + /** + * The last cumlative type was VARCHAR + */ + if ($last_cumulative_type == VARCHAR) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; + } else { + return $last_cumulative_size; + } + } + /** + * The last cumlative type was DECIMAL + */ + else if ($last_cumulative_type == DECIMAL) { + $oldM = PMA_getM($last_cumulative_size); + + if ($curr_size >= $oldM) { + return $curr_size; + } else { + return $oldM; + } + } + /** + * The last cumlative type was INT + */ + else if ($last_cumulative_type == INT) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; + } else { + return $last_cumulative_size; + } + } + /** + * This is the first row to be analyzed + */ + else if (!isset($last_cumulative_type) || $last_cumulative_type == NONE) { + return $curr_size; + } + /** + * An error has DEFINITELY occurred + */ + else { + /** + * TODO: Handle this MUCH more elegantly + */ + + return -1; + } + } + /** + * What to do if the current cell is of type DECIMAL + */ + else if ($curr_type == DECIMAL) { + /** + * The last cumlative type was VARCHAR + */ + if ($last_cumulative_type == VARCHAR) { + /* Convert $last_cumulative_size from varchar to decimal format */ + $size = PMA_getDecimalSize($cell); + + if ($size[M] >= $last_cumulative_size) { + return $size[M]; + } else { + return $last_cumulative_size; + } + } + /** + * The last cumlative type was DECIMAL + */ + else if ($last_cumulative_type == DECIMAL) { + $size = PMA_getDecimalSize($cell); + + $oldM = PMA_getM($last_cumulative_size); + $oldD = PMA_getD($last_cumulative_size); + + /* New val if M or D is greater than current largest */ + if ($size[M] > $oldM || $size[D] > $oldD) { + /* Take the largest of both types */ + return (string)((($size[M] > $oldM) ? $size[M] : $oldM) . "," . (($size[D] > $oldD) ? $size[D] : $oldD)); + } else { + return $last_cumulative_size; + } + } + /** + * The last cumlative type was INT + */ + else if ($last_cumulative_type == INT) { + /* Convert $last_cumulative_size from int to decimal format */ + $size = PMA_getDecimalSize($cell); + + if ($size[M] >= $last_cumulative_size) { + return $size[FULL]; + } else { + return ($last_cumulative_size.",".$size[D]); + } + } + /** + * This is the first row to be analyzed + */ + else if (!isset($last_cumulative_type) || $last_cumulative_type == NONE) { + /* First row of the column */ + $size = PMA_getDecimalSize($cell); + + return $size[FULL]; + } + /** + * An error has DEFINITELY occurred + */ + else { + /** + * TODO: Handle this MUCH more elegantly + */ + + return -1; + } + } + /** + * What to do if the current cell is of type INT + */ + else if ($curr_type == INT) { + /** + * The last cumlative type was VARCHAR + */ + if ($last_cumulative_type == VARCHAR) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; + } else { + return $last_cumulative_size; + } + } + /** + * The last cumlative type was DECIMAL + */ + else if ($last_cumulative_type == DECIMAL) { + $oldM = PMA_getM($last_cumulative_size); + $oldD = PMA_getD($last_cumulative_size); + $oldInt = $oldM - $oldD; + $newInt = strlen((string)$cell); + + /* See which has the larger integer length */ + if ($oldInt >= $newInt) { + /* Use old decimal size */ + return $last_cumulative_size; + } else { + /* Use $newInt + $oldD as new M */ + return (($newInt + $oldD).",".$oldD); + } + } + /** + * The last cumlative type was INT + */ + else if ($last_cumulative_type == INT) { + if ($curr_size >= $last_cumulative_size) { + return $curr_size; + } else { + return $last_cumulative_size; + } + } + /** + * This is the first row to be analyzed + */ + else if (!isset($last_cumulative_type) || $last_cumulative_type == NONE) { + return $curr_size; + } + /** + * An error has DEFINITELY occurred + */ + else { + /** + * TODO: Handle this MUCH more elegantly + */ + + return -1; + } + } + /** + * An error has DEFINITELY occurred + */ + else { + /** + * TODO: Handle this MUCH more elegantly + */ + + return -1; + } +} + +/** + * Determines what MySQL type a cell is + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @access public + * + * @uses DECIMAL + * @uses INT + * @uses VARCHAR + * @uses NONE + * @uses is_numeric() + * @uses strcmp() + * @uses strpos() + * @uses substr_count() + * @param int $last_cumulative_type Last cumulative column type (VARCHAR or INT or DECIMAL or NONE) + * @param string &$cell String representation of the cell for which a best-fit type is to be determined + * @return int The MySQL type representation (VARCHAR or INT or DECIMAL or NONE) + */ +function PMA_detectType($last_cumulative_type, &$cell) { + /** + * If numeric, determine if decimal or int + * Else, we call it varchar for simplicity + */ + + if (!strcmp('NULL', $cell)) { + if ($last_cumulative_type === NULL || $last_cumulative_type == NONE) { + return NONE; + } else { + return $last_cumulative_type; + } + } else if (is_numeric($cell)) { + if ($cell == (string)(float)$cell && strpos($cell, ".") !== false && substr_count($cell, ".") == 1) { + return DECIMAL; + } else { + return INT; + } + } else { + return VARCHAR; + } +} + +/** + * Determines if the column types are int, decimal, or string + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @link http://wiki.phpmyadmin.net/pma/Devel:Import + * + * @todo Handle the error case more elegantly + * + * @access public + * + * @uses TBL_NAME + * @uses COL_NAMES + * @uses ROWS + * @uses VARCHAR + * @uses DECIMAL + * @uses INT + * @uses NONE + * @uses count() + * @uses is_array() + * @uses PMA_detectType() + * @uses PMA_detectSize() + * @param &$table array(string $table_name, array $col_names, array $rows) + * @return array array(array $types, array $sizes) + */ +function PMA_analyzeTable(&$table) { + /* Get number of rows in table */ + $numRows = count($table[ROWS]); + /* Get number of columns */ + $numCols = count($table[COL_NAMES]); + /* Current type for each column */ + $types = array(); + $sizes = array(); + + /* Initialize $sizes to all 0's */ + for ($i = 0; $i < $numCols; ++$i) { + $sizes[$i] = 0; + } + + /* Initialize $types to NONE */ + for ($i = 0; $i < $numCols; ++$i) { + $types[$i] = NONE; + } + + /* Temp vars */ + $curr_type = NONE; + $curr_size = 0; + + /* If the passed array is not of the correct form, do not process it */ + if (is_array($table) && !is_array($table[TBL_NAME]) && is_array($table[COL_NAMES]) && is_array($table[ROWS])) { + /* Analyze each column */ + for ($i = 0; $i < $numCols; ++$i) { + /* Analyze the column in each row */ + for ($j = 0; $j < $numRows; ++$j) { + /* Determine type of the current cell */ + $curr_type = PMA_detectType($types[$i], $table[ROWS][$j][$i]); + /* Determine size of the current cell */ + $sizes[$i] = PMA_detectSize($sizes[$i], $types[$i], $curr_type, $table[ROWS][$j][$i]); + + /** + * If a type for this column has alreday been delcared, + * only alter it if it was a number and a varchar was found + */ + if ($curr_type != NONE) { + if ($curr_type == VARCHAR) { + $types[$i] = VARCHAR; + } else if ($curr_type == DECIMAL) { + if ($types[$i] != VARCHAR) { + $types[$i] = DECIMAL; + } + } else if ($curr_type == INT) { + if ($types[$i] != VARCHAR && $types[$i] != DECIMAL) { + $types[$i] = INT; + } + } + } + } + } + + /* Check to ensure that all types are valid */ + $len = count($types); + for ($n = 0; $n < $len; ++$n) { + if (!strcmp(NONE, $types[$n])) { + $types[$n] = VARCHAR; + $sizes[$n] = '10'; + } + } + + return array($types, $sizes); + } + else + { + /** + * TODO: Handle this better + */ + + return false; + } +} + +/* Needed to quell the beast that is PMA_Message */ +$import_notice = NULL; + +/** + * Builds and executes SQL statements to create the database and tables + * as necessary, as well as insert all the data. + * + * @author Derek Schaefer (derek.schaefer@gmail.com) + * + * @link http://wiki.phpmyadmin.net/pma/Devel:Import + * + * @access public + * + * @uses TBL_NAME + * @uses COL_NAMES + * @uses ROWS + * @uses TYPES + * @uses SIZES + * @uses strcmp() + * @uses count() + * @uses ereg() + * @uses ereg_replace() + * @uses PMA_isView() + * @uses PMA_backquote() + * @uses PMA_importRunQuery() + * @uses PMA_generate_common_url() + * @uses PMA_Message::notice() + * @param string $db_name Name of the database + * @param array &$tables Array of tables for the specified database + * @param array &$analyses = NULL Analyses of the tables + * @param array &$additional_sql = NULL Additional SQL statements to be executed + * @param array $options = NULL Associative array of options + * @return void + */ +function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql = NULL, $options = NULL) { + /* Take care of the options */ + if (isset($options['db_collation'])) { + $collation = $options['db_collation']; + } else { + $collation = "utf8_general_ci"; + } + + if (isset($options['db_charset'])) { + $charset = $options['db_charset']; + } else { + $charset = "utf8"; + } + + if (isset($options['create_db'])) { + $create_db = $options['create_db']; + } else { + $create_db = true; + } + + /* Create SQL code to handle the database */ + $sql = array(); + + if ($create_db) { + $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_backquote($db_name) . " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation; + } + + /** + * The calling plug-in should include this statement, if necessary, in the $additional_sql parameter + * + * $sql[] = "USE " . PMA_backquote($db_name); + */ + + /* Execute the SQL statements create above */ + $sql_len = count($sql); + for ($i = 0; $i < $sql_len; ++$i) { + PMA_importRunQuery($sql[$i], $sql[$i]); + } + + /* No longer needed */ + unset($sql); + + /* Run the $additional_sql statements supplied by the caller plug-in */ + if ($additional_sql != NULL) { + /* Clean the SQL first */ + $additional_sql_len = count($additional_sql); + + /** + * Only match tables for now, because CREATE IF NOT EXISTS + * syntax is lacking or nonexisting for views, triggers, + * functions, and procedures. + * + * See: http://bugs.mysql.com/bug.php?id=15287 + * + * To the best of my knowledge this is still an issue. + * + * $pattern = 'CREATE (TABLE|VIEW|TRIGGER|FUNCTION|PROCEDURE)'; + */ + $pattern = 'CREATE .*(TABLE)'; + $replacement = 'CREATE \\1 IF NOT EXISTS'; + + /* Change CREATE statements to CREATE IF NOT EXISTS to support inserting into existing structures */ + for ($i = 0; $i < $additional_sql_len; ++$i) { + $additional_sql[$i] = ereg_replace($pattern, $replacement, $additional_sql[$i]); + /* Execute the resulting statements */ + PMA_importRunQuery($additional_sql[$i], $additional_sql[$i]); + } + } + + if ($analyses != NULL) { + $type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal"); + + /* TODO: Do more checking here to make sure they really are matched */ + if (count($tables) != count($analyses)) { + exit(); + } + + /* Create SQL code to create the tables */ + $tempSQLStr = ""; + $num_tables = count($tables); + for ($i = 0; $i < $num_tables; ++$i) { + $num_cols = count($tables[$i][COL_NAMES]); + $tempSQLStr = "CREATE TABLE IF NOT EXISTS " . PMA_backquote($db_name) . '.' . PMA_backquote($tables[$i][TBL_NAME]) . " ("; + for ($j = 0; $j < $num_cols; ++$j) { + $size = $analyses[$i][SIZES][$j]; + if ((int)$size == 0) { + $size = 10; + } + + $tempSQLStr .= PMA_backquote($tables[$i][COL_NAMES][$j]) . " " . $type_array[$analyses[$i][TYPES][$j]] . "(" . $size . ")"; + + if ($j != (count($tables[$i][COL_NAMES]) - 1)) { + $tempSQLStr .= ", "; + } + } + $tempSQLStr .= ") ENGINE=MyISAM;"; + + /** + * Each SQL statement is executed immediately + * after it is formed so that we don't have + * to store them in a (possibly large) buffer + */ + PMA_importRunQuery($tempSQLStr, $tempSQLStr); + } + } + + /** + * Create the SQL statements to insert all the data + * + * Only one insert query is formed for each table + */ + $tempSQLStr = ""; + $col_count = 0; + $num_tables = count($tables); + for ($i = 0; $i < $num_tables; ++$i) { + $num_cols = count($tables[$i][COL_NAMES]); + $num_rows = count($tables[$i][ROWS]); + + $tempSQLStr = "INSERT INTO " . PMA_backquote($db_name) . '.' . PMA_backquote($tables[$i][TBL_NAME]) . " ("; + + for ($m = 0; $m < $num_cols; ++$m) { + $tempSQLStr .= PMA_backquote($tables[$i][COL_NAMES][$m]); + + if ($m != ($num_cols - 1)) { + $tempSQLStr .= ", "; + } + } + + $tempSQLStr .= ") VALUES "; + + for ($j = 0; $j < $num_rows; ++$j) { + $tempSQLStr .= "("; + + for ($k = 0; $k < $num_cols; ++$k) { + if ($analyses != NULL) { + $is_varchar = ($analyses[$i][TYPES][$col_count] === VARCHAR); + } else { + $is_varchar = !is_numeric($tables[$i][ROWS][$j][$k]); + } + + /* Don't put quotes around NULL fields */ + if (!strcmp($tables[$i][ROWS][$j][$k], 'NULL')) { + $is_varchar = false; + } + + $tempSQLStr .= (($is_varchar) ? "'" : ""); + $tempSQLStr .= (str_replace("'", "\'", (string)$tables[$i][ROWS][$j][$k])); + $tempSQLStr .= (($is_varchar) ? "'" : ""); + + if ($k != ($num_cols - 1)) { + $tempSQLStr .= ", "; + } + + if ($col_count == ($num_cols - 1)) { + $col_count = 0; + } else { + $col_count++; + } + + /* Delete the cell after we are done with it */ + unset($tables[$i][ROWS][$j][$k]); + } + + $tempSQLStr .= ")"; + + if ($j != ($num_rows - 1)) { + $tempSQLStr .= ",\n "; + } + + $col_count = 0; + /* Delete the row after we are done with it */ + unset($tables[$i][ROWS][$j]); + } + + $tempSQLStr .= ";"; + + /** + * Each SQL statement is executed immediately + * after it is formed so that we don't have + * to store them in a (possibly large) buffer + */ + PMA_importRunQuery($tempSQLStr, $tempSQLStr); + } + + /* No longer needed */ + unset($tempSQLStr); + + /** + * A work in progress + */ + + /* Add the viewable structures from $additional_sql to $tables so they are also displayed */ + + $view_pattern = 'VIEW `[^`]+`\.`([^`]+)'; + $table_pattern = 'CREATE TABLE IF NOT EXISTS `([^`]+)`'; + /* Check a third pattern to make sure its not a "USE `db_name`;" statement */ + + $regs = array(); + + $inTables = false; + + $additional_sql_len = count($additional_sql); + for ($i = 0; $i < $additional_sql_len; ++$i) { + ereg($view_pattern, $additional_sql[$i], $regs); + + if (count($regs) == 0) { + ereg($table_pattern, $additional_sql[$i], $regs); + } + + if (count($regs)) { + for ($n = 0; $n < $num_tables; ++$n) { + if (!strcmp($regs[1], $tables[$n][TBL_NAME])) { + $inTables = true; + break; + } + } + + if (!$inTables) { + $tables[] = array(TBL_NAME => $regs[1]); + } + } + + /* Reset the array */ + $regs = array(); + $inTables = false; + } + + $params = array('db' => (string)$db_name); + $db_url = 'db_structure.php' . PMA_generate_common_url($params); + $db_ops_url = 'db_operations.php' . PMA_generate_common_url($params); + + $message = '<br /><br />'; + $message .= '<strong>'.$GLOBALS['strImportNoticePt1'].'</strong><br />'; + $message .= '<ul><li>'.$GLOBALS['strImportNoticePt2'].'</li>'; + $message .= '<li>'.$GLOBALS['strImportNoticePt3'].'</li>'; + $message .= '<li>'.$GLOBALS['strImportNoticePt4'].'</li>'; + $message .= sprintf('<br /><li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">'.$GLOBALS['strOptions'].'</a>)</li>', + $db_url, + $GLOBALS['strGoToDatabase'].': '.PMA_backquote($db_name), + $db_name, + $db_ops_url, + $GLOBALS['strEdit'].' '.PMA_backquote($db_name).' '.$GLOBALS['strSettings']); + + $message .= '<ul>'; + + unset($params); + + $num_tables = count($tables); + for ($i = 0; $i < $num_tables; ++$i) + { + $params = array('db' => (string)$db_name, 'table' => (string)$tables[$i][TBL_NAME]); + $tbl_url = 'sql.php' . PMA_generate_common_url($params); + $tbl_struct_url = 'tbl_structure.php' . PMA_generate_common_url($params); + $tbl_ops_url = 'tbl_operations.php' . PMA_generate_common_url($params); + + unset($params); + + if (!PMA_isView($db_name, $tables[$i][TBL_NAME])) { + $message .= sprintf('<li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">'.$GLOBALS['strStructure'].'</a>) (<a href="%s" title="%s">'.$GLOBALS['strOptions'].'</a>)</li>', + $tbl_url, + $GLOBALS['strGoToTable'].': '.PMA_backquote($tables[$i][TBL_NAME]), + $tables[$i][TBL_NAME], + $tbl_struct_url, + PMA_backquote($tables[$i][TBL_NAME]).' '.$GLOBALS['strStructureLC'], + $tbl_ops_url, + $GLOBALS['strEdit'].' '.PMA_backquote($tables[$i][TBL_NAME]).' '.$GLOBALS['strSettings']); + } else { + $message .= sprintf('<li><a href="%s" title="%s">%s</a></li>', + $tbl_url, + $GLOBALS['strGoToView'].': '.PMA_backquote($tables[$i][TBL_NAME]), + $tables[$i][TBL_NAME]); + } + } + + $message .= '</ul></ul>'; + + global $import_notice; + $import_notice = $message; + + unset($tables); +} + ?> diff --git a/libraries/import/csv.php b/libraries/import/csv.php index 79b337a7d..f7ab3ed9a 100644 --- a/libraries/import/csv.php +++ b/libraries/import/csv.php @@ -11,11 +11,10 @@ if (! defined('PHPMYADMIN')) { exit; } -/** - * - */ +$analyze = false; + if ($plugin_param !== 'table') { - return; + $analyze = true; } if (isset($plugin_list)) { @@ -29,10 +28,18 @@ if (isset($plugin_list)) { array('type' => 'text', 'name' => 'enclosed', 'text' => 'strFieldsEnclosedBy', 'size' => 2, 'len' => 2), array('type' => 'text', 'name' => 'escaped', 'text' => 'strFieldsEscapedBy', 'size' => 2, 'len' => 2), array('type' => 'text', 'name' => 'new_line', 'text' => 'strLinesTerminatedBy', 'size' => 2), - array('type' => 'text', 'name' => 'columns', 'text' => 'strColumnNames'), ), 'options_text' => 'strOptions', ); + + if ($plugin_param !== 'table') { + $plugin_list['csv']['options'][] = + array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames'); + } else { + $plugin_list['csv']['options'][] = + array('type' => 'text', 'name' => 'columns', 'text' => 'strColumnNames'); + } + /* We do not define function when plugin is just queried for information above */ return; } @@ -74,53 +81,57 @@ if (strlen($csv_terminated) != 1) { } $buffer = ''; -if (isset($csv_replace)) { - $sql_template = 'REPLACE'; -} else { - $sql_template = 'INSERT'; - if (isset($csv_ignore)) { - $sql_template .= ' IGNORE'; - } -} -$sql_template .= ' INTO ' . PMA_backquote($table); +$required_fields = 0; -$tmp_fields = PMA_DBI_get_fields($db, $table); - -if (empty($csv_columns)) { - $fields = $tmp_fields; -} else { - $sql_template .= ' ('; - $fields = array(); - $tmp = split(',( ?)', $csv_columns); - foreach ($tmp as $key => $val) { - if (count($fields) > 0) { - $sql_template .= ', '; +if (!$analyze) { + if (isset($csv_replace)) { + $sql_template = 'REPLACE'; + } else { + $sql_template = 'INSERT'; + if (isset($csv_ignore)) { + $sql_template .= ' IGNORE'; } - /* Trim also `, if user already included backquoted fields */ - $val = trim($val, " \t\r\n\0\x0B`"); - $found = FALSE; - foreach ($tmp_fields as $id => $field) { - if ($field['Field'] == $val) { - $found = TRUE; + } + $sql_template .= ' INTO ' . PMA_backquote($table); + + $tmp_fields = PMA_DBI_get_fields($db, $table); + + if (empty($csv_columns)) { + $fields = $tmp_fields; + } else { + $sql_template .= ' ('; + $fields = array(); + $tmp = split(',( ?)', $csv_columns); + foreach ($tmp as $key => $val) { + if (count($fields) > 0) { + $sql_template .= ', '; + } + /* Trim also `, if user already included backquoted fields */ + $val = trim($val, " \t\r\n\0\x0B`"); + $found = FALSE; + foreach ($tmp_fields as $id => $field) { + if ($field['Field'] == $val) { + $found = TRUE; + break; + } + } + if (!$found) { + $message = PMA_Message::error('strInvalidColumn'); + $message->addParam($val); + $error = TRUE; break; } + $fields[] = $field; + $sql_template .= PMA_backquote($val); } - if (!$found) { - $message = PMA_Message::error('strInvalidColumn'); - $message->addParam($val); - $error = TRUE; - break; - } - $fields[] = $field; - $sql_template .= PMA_backquote($val); + $sql_template .= ') '; } - $sql_template .= ') '; + + $required_fields = count($fields); + + $sql_template .= ' VALUES ('; } -$required_fields = count($fields); - -$sql_template .= ' VALUES ('; - // Defaults for parser $i = 0; $len = 0; @@ -129,6 +140,14 @@ $lasti = -1; $values = array(); $csv_finish = FALSE; +$tempRow = array(); +$rows = array(); +$col_names = array(); +$tables = array(); + +$col_count = 0; +$max_cols = 0; + while (!($finished && $i >= $len) && !$error && !$timeout_passed) { $data = PMA_importGetNextChunk(); if ($data === FALSE) { @@ -268,40 +287,57 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { if (!$csv_finish) { $values[] = ''; } - // Do we have correct count of values? - if (count($values) != $required_fields) { - - // Hack for excel - if ($values[count($values) - 1] == ';') { - unset($values[count($values) - 1]); - } else { - $message = PMA_Message::error('strInvalidCSVFieldCount'); - $message->addParam($line); - $error = TRUE; - break; + + if ($analyze) { + foreach ($values as $ley => $val) { + $tempRow[] = $val; + ++$col_count; } + + if ($col_count > $max_cols) { + $max_cols = $col_count; + } + $col_count = 0; + + $rows[] = $tempRow; + $tempRow = array(); + } else { + // Do we have correct count of values? + if (count($values) != $required_fields) { + + // Hack for excel + if ($values[count($values) - 1] == ';') { + unset($values[count($values) - 1]); + } else { + $message = PMA_Message::error('strInvalidCSVFieldCount'); + $message->addParam($line); + $error = TRUE; + break; + } + } + + $first = TRUE; + $sql = $sql_template; + foreach ($values as $key => $val) { + if (!$first) { + $sql .= ', '; + } + if ($val === null) { + $sql .= 'NULL'; + } else { + $sql .= '\'' . addslashes($val) . '\''; + } + + $first = FALSE; + } + $sql .= ')'; + + /** + * @todo maybe we could add original line to verbose SQL in comment + */ + PMA_importRunQuery($sql, $sql); } - - $first = TRUE; - $sql = $sql_template; - foreach ($values as $key => $val) { - if (!$first) { - $sql .= ', '; - } - if ($val === null) { - $sql .= 'NULL'; - } else { - $sql .= '\'' . addslashes($val) . '\''; - } - - $first = FALSE; - } - $sql .= ')'; - - /** - * @todo maybe we could add original line to verbose SQL in comment - */ - PMA_importRunQuery($sql, $sql); + $line++; $csv_finish = FALSE; $values = array(); @@ -314,6 +350,73 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { } // End of parser loop } // End of import loop +if ($analyze) { + /* Fill out all rows */ + $num_rows = count($rows); + for ($i = 0; $i < $num_rows; ++$i) { + for ($j = count($rows[$i]); $j < $max_cols; ++$j) { + $rows[$i][] = 'NULL'; + } + } + + if ($_REQUEST['csv_col_names']) { + $col_names = array_splice($rows, 0, 1); + $col_names = $col_names[0]; + } + + if ((isset($col_names) && count($col_names) != $max_cols) || !isset($col_names)) { + // Fill out column names + for ($i = 0; $i < $max_cols; ++$i) { + $col_names[] = 'COL '.($i+1); + } + } + + if (strlen($db)) { + $result = PMA_DBI_fetch_result('SHOW TABLES'); + $tbl_name = 'TABLE '.(count($result) + 1); + } else { + $tbl_name = 'TBL_NAME'; + } + + $tables[] = array($tbl_name, $col_names, $rows); + + /* Obtain the best-fit MySQL types for each column */ + $analyses = array(); + $analyses[] = PMA_analyzeTable($tables[0]); + + /** + * string $db_name (no backquotes) + * + * array $table = array(table_name, array() column_names, array()() rows) + * array $tables = array of "$table"s + * + * array $analysis = array(array() column_types, array() column_sizes) + * array $analyses = array of "$analysis"s + * + * array $create = array of SQL strings + * + * array $options = an associative array of options + */ + + /* Set database name to the currently selected one, if applicable */ + if (strlen($db)) { + $db_name = $db; + $options = array('create_db' => false); + } else { + $db_name = 'CSV_DB'; + $options = NULL; + } + + /* Non-applicable parameters */ + $create = NULL; + + /* Created and execute necessary SQL statements from data */ + PMA_buildSQL($db_name, $tables, $analyses, $create, $options); + + unset($tables); + unset($analyses); +} + // Commit any possible data in buffers PMA_importRunQuery(); diff --git a/libraries/import/ods.php b/libraries/import/ods.php new file mode 100644 index 000000000..6711c1fe0 --- /dev/null +++ b/libraries/import/ods.php @@ -0,0 +1,281 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * OpenDocument Spreadsheet import plugin for phpMyAdmin + * + * @todo Pretty much everything + * @version 0.5-beta + * @package phpMyAdmin-Import + */ + +if (!defined('PHPMYADMIN')) { + exit; +} + +/** + * The possible scopes for $plugin_param are: 'table', 'database', and 'server' + */ + +if (isset($plugin_list)) { + $plugin_list['ods'] = array( + 'text' => 'strImportODS', + 'extension' => 'ods', + 'options' => array( + array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames'), + array('type' => 'bool', 'name' => 'empty_rows', 'text' => 'strImportEmptyRows'), + array('type' => 'bool', 'name' => 'recognize_percentages', 'text' => 'strImportODSPercents'), + array('type' => 'bool', 'name' => 'recognize_currency', 'text' => 'strImportODSCurrency'), + ), + 'options_text' => 'strOptions', + ); + /* We do not define function when plugin is just queried for information above */ + return; +} + +ini_set('memory_limit', '128M'); +set_time_limit(120); + +$i = 0; +$len = 0; +$buffer = ""; + +/** + * Read in the file via PMA_importGetNextChunk so that + * it can process compressed files + */ +while (!($finished && $i >= $len) && !$error && !$timeout_passed) { + $data = PMA_importGetNextChunk(); + if ($data === FALSE) { + /* subtract data we didn't handle yet and stop processing */ + $offset -= strlen($buffer); + break; + } else if ($data === TRUE) { + /* Handle rest of buffer */ + } else { + /* Append new data to buffer */ + $buffer .= $data; + unset($data); + } +} + +unset($data); + +/** + * Load the XML string + * + * The option LIBXML_COMPACT is specified because it can + * result in increased performance without the need to + * alter the code in any way. It's basically a freebee. + */ +$xml = simplexml_load_string(utf8_encode($buffer), "SimpleXMLElement", LIBXML_COMPACT); + +unset($buffer); + +$sheets = $xml->children('office', true)->{'body'}->{'spreadsheet'}->children('table', true); + +$tables = array(); + +$max_cols = 0; + +$row_count = 0; +$col_count = 0; +$col_names = array(); + +$tempRow = array(); +$tempRows = array(); +$rows = array(); + +/* Iterate over tables */ +foreach ($sheets as $sheet) { + $col_names_in_first_row = $_REQUEST['ods_col_names']; + + /* Iterate over rows */ + foreach ($sheet as $row) { + $type = $row->getName(); + if (!strcmp('table-row', $type)) { + /* Iterate over columns */ + foreach ($row as $cell) { + $text = $cell->children('text', true); + $cell_attrs = $cell->attributes('office', true); + + if (count($text) != 0) { + if (!$col_names_in_first_row) { + if ($_REQUEST['ods_recognize_percentages'] && !strcmp('percentage', $cell_attrs['value-type'])) { + $tempRow[] = (double)$cell_attrs['value']; + } else if ($_REQUEST['ods_recognize_currency'] && !strcmp('currency', $cell_attrs['value-type'])) { + $tempRow[] = (double)$cell_attrs['value']; + } else { + $tempRow[] = (string)$text; + } + } else { + if ($_REQUEST['ods_recognize_percentages'] && !strcmp('percentage', $cell_attrs['value-type'])) { + $col_names[] = (double)$cell_attrs['value']; + } else if ($_REQUEST['ods_recognize_currency'] && !strcmp('currency', $cell_attrs['value-type'])) { + $col_names[] = (double)$cell_attrs['value']; + } else { + $col_names[] = (string)$text; + } + } + + ++$col_count; + } else { + /* Number of blank columns repeated */ + if ($col_count < count($row->children('table', true)) - 1) { + $attr = $cell->attributes('table', true); + $num_null = (int)$attr['number-columns-repeated']; + + if ($num_null) { + if (!$col_names_in_first_row) { + for ($i = 0; $i < $num_null; ++$i) { + $tempRow[] = 'NULL'; + ++$col_count; + } + } else { + for ($i = 0; $i < $num_null; ++$i) { + $col_names[] = PMA_getColumnAlphaName($col_count + 1); + ++$col_count; + } + } + } else { + if (!$col_names_in_first_row) { + $tempRow[] = 'NULL'; + } else { + $col_names[] = PMA_getColumnAlphaName($col_count + 1); + } + + ++$col_count; + } + } + } + } + + /* Find the widest row */ + if ($col_count > $max_cols) { + $max_cols = $col_count; + } + + /* Don't include a row that is full of NULL values */ + if (!$col_names_in_first_row) { + if ($_REQUEST['ods_empty_rows']) { + foreach ($tempRow as $cell) { + if (strcmp('NULL', $cell)) { + $tempRows[] = $tempRow; + break; + } + } + } else { + $tempRows[] = $tempRow; + } + } + + $col_count = 0; + $col_names_in_first_row = false; + $tempRow = array(); + } + } + + /* Skip over empty sheets */ + if (count($tempRows) == 0 || count($tempRows[0]) == 0) { + $col_names = array(); + $tempRow = array(); + $tempRows = array(); + continue; + } + + /** + * Fill out each row as necessary to make + * every one exactly as wide as the widest + * row. This included column names. + */ + + /* Fill out column names */ + for ($i = count($col_names); $i < $max_cols; ++$i) { + $col_names[] = PMA_getColumnAlphaName($i + 1); + } + + /* Fill out all rows */ + $num_rows = count($tempRows); + for ($i = 0; $i < $num_rows; ++$i) { + for ($j = count($tempRows[$i]); $j < $max_cols; ++$j) { + $tempRows[$i][] = 'NULL'; + } + } + + /* Store the table name so we know where to place the row set */ + $tbl_attr = $sheet->attributes('table', true); + $tables[] = array((string)$tbl_attr['name']); + + /* Store the current sheet in the accumulator */ + $rows[] = array((string)$tbl_attr['name'], $col_names, $tempRows); + $tempRows = array(); + $col_names = array(); + $max_cols = 0; +} + +unset($tempRow); +unset($tempRows); +unset($col_names); +unset($sheets); +unset($xml); + +/** + * Bring accumulated rows into the corresponding table + */ +$num_tbls = count($tables); +for ($i = 0; $i < $num_tbls; ++$i) { + for ($j = 0; $j < count($rows); ++$j) { + if (!strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) { + if (!isset($tables[$i][COL_NAMES])) { + $tables[$i][] = $rows[$j][COL_NAMES]; + } + + $tables[$i][ROWS] = $rows[$j][ROWS]; + } + } +} + +/* No longer needed */ +unset($rows); + +/* Obtain the best-fit MySQL types for each column */ +$analyses = array(); + +$len = count($tables); +for ($i = 0; $i < $len; ++$i) { + $analyses[] = PMA_analyzeTable($tables[$i]); +} + +/** + * string $db_name (no backquotes) + * + * array $table = array(table_name, array() column_names, array()() rows) + * array $tables = array of "$table"s + * + * array $analysis = array(array() column_types, array() column_sizes) + * array $analyses = array of "$analysis"s + * + * array $create = array of SQL strings + * + * array $options = an associative array of options + */ + +/* Set database name to the currently selected one, if applicable */ +if (strlen($db)) { + $db_name = $db; +} else { + $db_name = 'ODS_DB'; +} + +/* Non-applicable parameters */ +$create = NULL; +$options = NULL; + +/* Created and execute necessary SQL statements from data */ +PMA_buildSQL($db_name, $tables, $analyses, $create, $options); + +unset($tables); +unset($analyses); + +/* Commit any possible data in buffers */ +PMA_importRunQuery(); +?> diff --git a/libraries/import/upload/apc.php b/libraries/import/upload/apc.php index 245be656e..4b6623128 100644 --- a/libraries/import/upload/apc.php +++ b/libraries/import/upload/apc.php @@ -2,7 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * -* @version $Id: $ +* @version $Id$ * @package phpMyAdmin */ diff --git a/libraries/import/upload/noplugin.php b/libraries/import/upload/noplugin.php index 94f8caee0..3215a77c9 100644 --- a/libraries/import/upload/noplugin.php +++ b/libraries/import/upload/noplugin.php @@ -2,7 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * -* @version $Id: $ +* @version $Id$ * @package phpMyAdmin */ diff --git a/libraries/import/upload/uploadprogress.php b/libraries/import/upload/uploadprogress.php index 768513587..a47bba3f3 100644 --- a/libraries/import/upload/uploadprogress.php +++ b/libraries/import/upload/uploadprogress.php @@ -2,7 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * -* @version $Id: $ +* @version $Id$ * @package phpMyAdmin */ if (!defined('PHPMYADMIN')) { diff --git a/libraries/import/xls.php b/libraries/import/xls.php new file mode 100644 index 000000000..5a44f4c68 --- /dev/null +++ b/libraries/import/xls.php @@ -0,0 +1,148 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * Microsoft Office Excel 97-2003 XLS import plugin for phpMyAdmin + * + * @todo Pretty much everything + * @version $Id$ + * @package phpMyAdmin-Import + */ + +if (!defined('PHPMYADMIN')) { + exit; +} + +/** + * The possible scopes for $plugin_param are: 'table', 'database', and 'server' + */ + +if (isset($plugin_list)) { + $plugin_list['xls'] = array( + 'text' => 'strImportXLS', + 'extension' => 'xls', + 'options' => array( + array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames'), + ), + 'options_text' => 'strOptions', + ); + /* We do not define function when plugin is just queried for information above */ + return; +} + +ini_set('memory_limit', '256M'); +set_time_limit(120); + +/* Append the PHPExcel directory to the include path variable */ +set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/'); + +require_once './libraries/PHPExcel/PHPExcel.php'; +require_once './libraries/PHPExcel/PHPExcel/Reader/Excel5.php'; + +$objReader = new PHPExcel_Reader_Excel5(); +$objReader->setReadDataOnly(true); +$objReader->setLoadAllSheets(); +$objPHPExcel = $objReader->load($import_file); + +$sheet_names = $objPHPExcel->getSheetNames(); +$num_sheets = count($sheet_names); + +$tables = array(); +$tempRow = array(); +$rows = array(); +$col_names = array(); + +for ($s = 0; $s < $num_sheets; ++$s) { + $current_sheet = $objPHPExcel->getSheet($s); + + $num_rows = $current_sheet->getHighestRow(); + $num_cols = PMA_getColumnNumberFromName($current_sheet->getHighestColumn()); + + if ($num_rows != 1 && $num_cols != 1) { + for ($r = 1; $r <= $num_rows; ++$r) { + for ($c = 0; $c < $num_cols; ++$c) { + $cell = $current_sheet->getCellByColumnAndRow($c, $r)->getCalculatedValue(); + + if (!strcmp($cell, '')) { + $cell = 'NULL'; + } + + $tempRow[] = $cell; + } + + $rows[] = $tempRow; + $tempRow = array(); + } + + if ($_REQUEST['xls_col_names']) { + $col_names = array_splice($rows, 0, 1); + $col_names = $col_names[0]; + for ($j = 0; $j < $num_cols; ++$j) { + if (!strcmp('NULL', $col_names[$j])) { + $col_names[$j] = PMA_getColumnAlphaName($j + 1); + } + } + } else { + for ($n = 0; $n < $num_cols; ++$n) { + $col_names[] = PMA_getColumnAlphaName($n + 1); + } + } + + $tables[] = array($sheet_names[$s], $col_names, $rows); + + $col_names = array(); + $rows = array(); + } +} + +unset($objPHPExcel); +unset($objReader); +unset($rows); +unset($tempRow); +unset($col_names); + +/* Obtain the best-fit MySQL types for each column */ +$analyses = array(); + +$len = count($tables); +for ($i = 0; $i < $len; ++$i) { + $analyses[] = PMA_analyzeTable($tables[$i]); +} + +/** + * string $db_name (no backquotes) + * + * array $table = array(table_name, array() column_names, array()() rows) + * array $tables = array of "$table"s + * + * array $analysis = array(array() column_types, array() column_sizes) + * array $analyses = array of "$analysis"s + * + * array $create = array of SQL strings + * + * array $options = an associative array of options + */ + +/* Set database name to the currently selected one, if applicable */ +if (strlen($db)) { + $db_name = $db; + $options = array('create_db' => false); +} else { + $db_name = 'XLS_DB'; + $options = NULL; +} + +/* Non-applicable parameters */ +$create = NULL; + +/* Created and execute necessary SQL statements from data */ +PMA_buildSQL($db_name, $tables, $analyses, $create, $options); + +unset($tables); +unset($analyses); + +$finished = true; +$error = false; + +/* Commit any possible data in buffers */ +PMA_importRunQuery(); +?> diff --git a/libraries/import/xlsx.php b/libraries/import/xlsx.php new file mode 100644 index 000000000..54aada02b --- /dev/null +++ b/libraries/import/xlsx.php @@ -0,0 +1,148 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * Microsoft Office Excel 2007 XLSX import plugin for phpMyAdmin + * + * @todo Pretty much everything + * @version $Id$ + * @package phpMyAdmin-Import + */ + +if (!defined('PHPMYADMIN')) { + exit; +} + +/** + * The possible scopes for $plugin_param are: 'table', 'database', and 'server' + */ + +if (isset($plugin_list)) { + $plugin_list['xlsx'] = array( + 'text' => 'strImportXLSX', + 'extension' => 'xlsx', + 'options' => array( + array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames'), + ), + 'options_text' => 'strOptions', + ); + /* We do not define function when plugin is just queried for information above */ + return; +} + +ini_set('memory_limit', '256M'); +set_time_limit(120); + +/* Append the PHPExcel directory to the include path variable */ +set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/'); + +require_once './libraries/PHPExcel/PHPExcel.php'; +require_once './libraries/PHPExcel/PHPExcel/Reader/Excel2007.php'; + +$objReader = new PHPExcel_Reader_Excel2007(); +$objReader->setReadDataOnly(true); +$objReader->setLoadAllSheets(); +$objPHPExcel = $objReader->load($import_file); + +$sheet_names = $objPHPExcel->getSheetNames(); +$num_sheets = count($sheet_names); + +$tables = array(); +$tempRow = array(); +$rows = array(); +$col_names = array(); + +for ($s = 0; $s < $num_sheets; ++$s) { + $current_sheet = $objPHPExcel->getSheet($s); + + $num_rows = $current_sheet->getHighestRow(); + $num_cols = PMA_getColumnNumberFromName($current_sheet->getHighestColumn()); + + if ($num_rows != 1 && $num_cols != 1) { + for ($r = 1; $r <= $num_rows; ++$r) { + for ($c = 0; $c < $num_cols; ++$c) { + $cell = $current_sheet->getCellByColumnAndRow($c, $r)->getCalculatedValue(); + + if (!strcmp($cell, '')) { + $cell = 'NULL'; + } + + $tempRow[] = $cell; + } + + $rows[] = $tempRow; + $tempRow = array(); + } + + if ($_REQUEST['xlsx_col_names']) { + $col_names = array_splice($rows, 0, 1); + $col_names = $col_names[0]; + for ($j = 0; $j < $num_cols; ++$j) { + if (!strcmp('NULL', $col_names[$j])) { + $col_names[$j] = PMA_getColumnAlphaName($j + 1); + } + } + } else { + for ($n = 0; $n < $num_cols; ++$n) { + $col_names[] = PMA_getColumnAlphaName($n + 1); + } + } + + $tables[] = array($sheet_names[$s], $col_names, $rows); + + $col_names = array(); + $rows = array(); + } +} + +unset($objPHPExcel); +unset($objReader); +unset($rows); +unset($tempRow); +unset($col_names); + +/* Obtain the best-fit MySQL types for each column */ +$analyses = array(); + +$len = count($tables); +for ($i = 0; $i < $len; ++$i) { + $analyses[] = PMA_analyzeTable($tables[$i]); +} + +/** + * string $db_name (no backquotes) + * + * array $table = array(table_name, array() column_names, array()() rows) + * array $tables = array of "$table"s + * + * array $analysis = array(array() column_types, array() column_sizes) + * array $analyses = array of "$analysis"s + * + * array $create = array of SQL strings + * + * array $options = an associative array of options + */ + +/* Set database name to the currently selected one, if applicable */ +if (strlen($db)) { + $db_name = $db; + $options = array('create_db' => false); +} else { + $db_name = 'XLSX_DB'; + $options = NULL; +} + +/* Non-applicable parameters */ +$create = NULL; + +/* Created and execute necessary SQL statements from data */ +PMA_buildSQL($db_name, $tables, $analyses, $create, $options); + +unset($tables); +unset($analyses); + +$finished = true; +$error = false; + +/* Commit any possible data in buffers */ +PMA_importRunQuery(); +?> diff --git a/libraries/import/xml.php b/libraries/import/xml.php new file mode 100644 index 000000000..c29ee87d2 --- /dev/null +++ b/libraries/import/xml.php @@ -0,0 +1,296 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * XML import plugin for phpMyAdmin + * + * @todo Improve efficiency + * @version 0.5-beta + * @package phpMyAdmin-Import + */ + +if (!defined('PHPMYADMIN')) { + exit; +} + +/** + * The possible scopes for $plugin_param are: 'table', 'database', and 'server' + */ + +if (isset($plugin_list)) { + $plugin_list['xml'] = array( + 'text' => 'strXML', + 'extension' => 'xml', + 'options' => array( + ), + 'options_text' => 'strOptions', + ); + /* We do not define function when plugin is just queried for information above */ + return; +} + +ini_set('memory_limit', '128M'); +set_time_limit(120); + +$i = 0; +$len = 0; +$buffer = ""; + +/** + * Read in the file via PMA_importGetNextChunk so that + * it can process compressed files + */ +while (!($finished && $i >= $len) && !$error && !$timeout_passed) { + $data = PMA_importGetNextChunk(); + if ($data === FALSE) { + /* subtract data we didn't handle yet and stop processing */ + $offset -= strlen($buffer); + break; + } else if ($data === TRUE) { + /* Handle rest of buffer */ + } else { + /* Append new data to buffer */ + $buffer .= $data; + unset($data); + } +} + +unset($data); + +/** + * Load the XML string + * + * The option LIBXML_COMPACT is specified because it can + * result in increased performance without the need to + * alter the code in any way. It's basically a freebee. + */ +$xml = simplexml_load_string(utf8_encode($buffer), "SimpleXMLElement", LIBXML_COMPACT); + +unset($buffer); + +/** + * The XML was malformed + */ +if ($xml === FALSE) { + PMA_Message::error('strXMLError')->display(); + unset($xml); + $GLOBALS['finished'] = false; + return; +} + +/** + * Table accumulator + */ +$tables = array(); +/** + * Row accumulator + */ +$rows = array(); + +/** + * Temp arrays + */ +$tempRow = array(); +$tempCells = array(); + +/** + * CREATE code included (by default: no) + */ +$struct_present = false; + +/** + * Analyze the data in each table + */ +$namespaces = $xml->getNameSpaces(true); + +/** + * Get the database name, collation and charset + */ +$db_attr = $xml->children($namespaces['pma'])->{'structure_schemas'}->{'database'}; + +if ($db_attr instanceof SimpleXMLElement) { + $db_attr = $db_attr->attributes(); + $db_name = (string)$db_attr['name']; + $collation = (string)$db_attr['collation']; + $charset = (string)$db_attr['charset']; +} else { + /** + * If the structure section is not present + * get the database name from the data section + */ + $db_attr = $xml->children()->attributes(); + $db_name = (string)$db_attr['name']; + $collation = NULL; + $charset = NULL; +} + +/** + * The XML was malformed + */ +if ($db_name === NULL) { + PMA_Message::error('strXMLError')->display(); + unset($xml); + $GLOBALS['finished'] = false; + return; +} + +/** + * Retrieve the structure information + */ +if (isset($namespaces['pma'])) { + /** + * Get structures for all tables + */ + $struct = $xml->children($namespaces['pma']); + + $create = array(); + + foreach ($struct as $tier1=>$val1) { + foreach($val1 as $tier2=>$val2) { + /* Need to select the correct database for the creation of tables, views, triggers, etc. */ + $attrs = $val2->attributes(); + $create[] = "USE " . PMA_backquote($attrs["name"]); + + foreach ($val2 as $val3) { + /** + * Remove the extra cosmetic spacing + */ + $val3 = str_replace(" ", "", (string)$val3); + $create[] = $val3; + } + } + } + + $struct_present = true; +} + +/** + * Move down the XML tree to the actual data + */ +$xml = $xml->children()->children(); + +$data_present = false; + +/** + * Only attempt to analyze/collect data if there is data present + */ +if (@count($xml->children())) { + $data_present = true; + + /** + * Process all database content + */ + foreach ($xml as $k1=>$v1) { + $tbl_attr = $v1->attributes(); + + $isInTables = false; + for ($i = 0; $i < count($tables); ++$i) { + if (!strcmp($tables[$i][TBL_NAME], (string)$tbl_attr['name'])) { + $isInTables = true; + break; + } + } + + if ($isInTables == false) { + $tables[] = array((string)$tbl_attr['name']); + } + + foreach ($v1 as $k2=>$v2) { + $row_attr = $v2->attributes(); + if (!array_search((string)$row_attr['name'], $tempRow)) + { + $tempRow[] = (string)$row_attr['name']; + } + $tempCells[] = (string)$v2; + } + + $rows[] = array((string)$tbl_attr['name'], $tempRow, $tempCells); + + $tempRow = array(); + $tempCells = array(); + } + + unset($tempRow); + unset($tempCells); + unset($xml); + + /** + * Bring accumulated rows into the corresponding table + */ + $num_tbls = count($tables); + for ($i = 0; $i < $num_tbls; ++$i) { + for ($j = 0; $j < count($rows); ++$j) { + if (!strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) { + if (!isset($tables[$i][COL_NAMES])) { + $tables[$i][] = $rows[$j][COL_NAMES]; + } + + $tables[$i][ROWS][] = $rows[$j][ROWS]; + } + } + } + + unset($rows); + + if (!$struct_present) { + $analyses = array(); + + $len = count($tables); + for ($i = 0; $i < $len; ++$i) { + $analyses[] = PMA_analyzeTable($tables[$i]); + } + } +} + +unset($xml); +unset($tempRows); +unset($tempCells); +unset($rows); + +/** + * Only build SQL from data if there is data present + */ +if ($data_present) { + /** + * Set values to NULL if they were not present + * to maintain PMA_buildSQL() call integrity + */ + if (!isset($analyses)) { + if ($struct_present) { + $analyses = NULL; + } else { + $analyses = NULL; + $create = NULL; + } + } +} + +/** + * string $db_name (no backquotes) + * + * array $table = array(table_name, array() column_names, array()() rows) + * array $tables = array of "$table"s + * + * array $analysis = array(array() column_types, array() column_sizes) + * array $analyses = array of "$analysis"s + * + * array $create = array of SQL strings + * + * array $options = an associative array of options + */ + +/* Set database collation/charset */ +$options = array( + 'db_collation' => $collation, + 'db_charset' => $charset, +); + +/* Created and execute necessary SQL statements from data */ +PMA_buildSQL($db_name, $tables, $analyses, $create, $options); + +unset($analyses); +unset($tables); +unset($create); + +/* Commit any possible data in buffers */ +PMA_importRunQuery(); +?> diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index fcbde10e0..1544571d1 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -149,6 +149,10 @@ function PMA_printRelationsParamDiagnostic($cfgRelation) PMA_printDiagMessageForFeature('strDesigner', 'designerwork', $messages); + PMA_printDiagMessageForParameter('tracking', isset($cfgRelation['tracking']), $messages, 'tracking'); + + PMA_printDiagMessageForFeature('strTracking', 'trackingwork', $messages); + echo '</table>' . "\n"; } @@ -216,6 +220,7 @@ function PMA__getRelationsParam() $cfgRelation['commwork'] = false; $cfgRelation['mimework'] = false; $cfgRelation['historywork'] = false; + $cfgRelation['trackingwork'] = false; $cfgRelation['designerwork'] = false; $cfgRelation['allworks'] = false; $cfgRelation['user'] = null; @@ -265,6 +270,8 @@ function PMA__getRelationsParam() $cfgRelation['pdf_pages'] = $curr_table[0]; } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['history']) { $cfgRelation['history'] = $curr_table[0]; + } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) { + $cfgRelation['tracking'] = $curr_table[0]; } } // end while PMA_DBI_free_result($tab_rs); @@ -315,6 +322,10 @@ function PMA__getRelationsParam() $cfgRelation['historywork'] = true; } + if (isset($cfgRelation['tracking'])) { + $cfgRelation['trackingwork'] = true; + } + // we do not absolutely need that the internal relations or the PDF // schema feature be activated if (isset($cfgRelation['designer_coords'])) { @@ -328,6 +339,7 @@ function PMA__getRelationsParam() if ($cfgRelation['relwork'] && $cfgRelation['displaywork'] && $cfgRelation['pdfwork'] && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfgRelation['historywork'] + && $cfgRelation['trackingwork'] && $cfgRelation['bookmarkwork'] && $cfgRelation['designerwork']) { $cfgRelation['allworks'] = true; } diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index d82f1aeab..97a15e310 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -8,6 +8,7 @@ * @usedby db_sql.php * @usedby tbl_sql.php * @usedby tbl_structure.php + * @usedby tbl_tracking.php * @usedby querywindow.php * @package phpMyAdmin */ @@ -28,6 +29,7 @@ require_once './libraries/bookmark.lib.php'; // used for file listing * @usedby db_sql.php * @usedby tbl_sql.php * @usedby tbl_structure.php + * @usedby tbl_tracking.php * @usedby querywindow.php * @uses $GLOBALS['table'] * @uses $GLOBALS['db'] diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php index a5b71ad39..8f752c90e 100644 --- a/libraries/tbl_links.inc.php +++ b/libraries/tbl_links.inc.php @@ -63,6 +63,13 @@ $tabs['search']['icon'] = 'b_search.png'; $tabs['search']['text'] = $strSearch; $tabs['search']['link'] = 'tbl_select.php'; +if(PMA_Tracker::isActive()) +{ + $tabs['tracking']['icon'] = 'eye.png'; + $tabs['tracking']['text'] = "Tracking"; + $tabs['tracking']['link'] = 'tbl_tracking.php'; +} + if (! (isset($db_is_information_schema) && $db_is_information_schema)) { $tabs['insert']['icon'] = 'b_insrow.png'; $tabs['insert']['link'] = 'tbl_change.php'; @@ -127,6 +134,12 @@ if ($table_info_num_rows == 0 && !$tbl_is_view) { echo PMA_generate_html_tabs($tabs, $url_params); unset($tabs); +if(PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])) +{ + $msg = PMA_Message::notice('<a href="tbl_tracking.php?'.$url_query.'">'.sprintf($strTrackingActivated, $GLOBALS["db"], $GLOBALS["table"]).'</a>'); + $msg->display(); +} + /** * Displays a message */ diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index d99470ab3..10777a81d 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -241,7 +241,7 @@ for ($i = 0; $i < $num_fields; $i++) { if (isset($row['Type'])) { $extracted_fieldspec = PMA_extractFieldSpec($row['Type']); if ($extracted_fieldspec['type'] == 'bit') { - $row['Default'] = PMA_printable_bit_value($row['Default'], $extracted_fieldspec['spec_in_brackets']); + $row['Default'] = PMA_convert_bit_default_value($row['Default']); } } // Cell index: If certain fields get left out, the counter shouldn't change. @@ -396,6 +396,10 @@ for ($i = 0; $i < $num_fields; $i++) { $row['Default'] = ''; } + if ($type_upper == 'BIT') { + $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']); + } + $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">'; foreach ($default_options as $key => $value) { $content_cells[$i][$ci] .= '<option value="' . $key . '"'; diff --git a/libraries/transformations/text_plain__longToIpv4.inc.php b/libraries/transformations/text_plain__longToIpv4.inc.php index 3c31686bc..7f9d6b887 100644 --- a/libraries/transformations/text_plain__longToIpv4.inc.php +++ b/libraries/transformations/text_plain__longToIpv4.inc.php @@ -2,7 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @package phpMyAdmin-Transformation - * @version $Id: text_plain__dateformat.inc.php 10239 2007-04-01 09:51:41Z cybot_tm $ + * @version $Id$ */ /** diff --git a/libraries/zip_extension.lib.php b/libraries/zip_extension.lib.php index 03b8c8de2..b68285176 100644 --- a/libraries/zip_extension.lib.php +++ b/libraries/zip_extension.lib.php @@ -26,9 +26,42 @@ function PMA_getZipContents($file) if (false === $first_zip_entry) { $error_message = $GLOBALS['strNoFilesFoundInZip']; } else { - zip_entry_open($zip_handle, $first_zip_entry, 'r'); - $file_data = zip_entry_read($first_zip_entry, zip_entry_filesize($first_zip_entry)); - zip_entry_close($first_zip_entry); + /* Is the the zip really an ODS file? */ + $read = zip_entry_read($first_zip_entry); + $ods_mime = 'application/vnd.oasis.opendocument.spreadsheet'; + if (!strcmp($ods_mime, $read)) { + /* Return the correct contents, not just the first entry */ + for ( ; ; ) { + $entry = zip_read($zip_handle); + if (is_resource($entry)) { + if (!strcmp('content.xml', zip_entry_name($entry))) { + zip_entry_open($zip_handle, $entry, 'r'); + $file_data = zip_entry_read($entry, zip_entry_filesize($entry)); + zip_entry_close($entry); + break; + } + } else { + /** + * Either we have reached the end of the zip and still + * haven't found 'content.xml' or there was a parsing + * error that we must display + */ + if ($entry === FALSE) { + $error_message = $GLOBALS['strErrorInZipFile'] . ' Could not find "content.xml"'; + } else { + $error_message = $GLOBALS['strErrorInZipFile'] . ' ' . PMA_getZipError($zip_handle); + } + + break; + } + } + } else { + zip_entry_open($zip_handle, $first_zip_entry, 'r'); + /* File pointer has already been moved, so include what was read above */ + $file_data = $read; + $file_data .= zip_entry_read($first_zip_entry, zip_entry_filesize($first_zip_entry)); + zip_entry_close($first_zip_entry); + } } } else { $error_message = $GLOBALS['strErrorInZipFile'] . ' ' . PMA_getZipError($zip_handle); @@ -37,7 +70,6 @@ function PMA_getZipContents($file) return (array('error' => $error_message, 'data' => $file_data)); } - /** * Gets zip error message * diff --git a/scripts/create-release.sh b/scripts/create-release.sh index d7189eed2..f19cd77d1 100755 --- a/scripts/create-release.sh +++ b/scripts/create-release.sh @@ -155,15 +155,6 @@ echo "------" ls -la *.gz *.zip *.bz2 *.7z -echo -echo "MD5 sums:" -echo "--------" - -md5sum *.{gz,zip,bz2,7z} | sed "s/\([^ ]*\)[ ]*\([^ ]*\)/md5sum['\2'] = '\1'/" - -echo -echo "Add these to website/data/md5sums.py in SVN" - cat <<END @@ -177,10 +168,8 @@ Todo now: 2. upload the files to SF (procedure explained on the sf.net Admin/File Releases page) 3. add files to SF files page (cut and paste changelog since last release) 4. add SF news item to phpMyAdmin project - 5. update web page: - - add MD5s to website/data/md5sums.py in SVN - 6. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/) - 7. send a short mail (with list of major changes) to + 5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/) + 6. send a short mail (with list of major changes) to phpmyadmin-devel@lists.sourceforge.net phpmyadmin-news@lists.sourceforge.net phpmyadmin-users@lists.sourceforge.net @@ -188,7 +177,7 @@ Todo now: Don't forget to update the Description section in the announcement, based on Documentation.html. - 8. increment rc count or version in subversion : + 7. increment rc count or version in subversion : - in libraries/Config.class.php PMA_Config::__constructor() the line " $this->set( 'PMA_VERSION', '2.7.1-dev' ); " - in Documentation.html the 2 lines @@ -196,17 +185,11 @@ Todo now: " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> " - in translators.html - 9. add a group for bug tracking this new version, at + 8. add a group for bug tracking this new version, at https://sourceforge.net/tracker/admin/index.php?group_id=23067&atid=377408&add_group=1 -10. the end :-) + 9. the end :-) END fi - -# Removed due to not needed thanks to clever scripting by Robbat2 -# 9. update the demo subdirectory: -# - in htdocs, cvs update phpMyAdmin -# - and don't forget to give write rights for the updated scripts to the -# whole group diff --git a/scripts/create_tables.sql b/scripts/create_tables.sql index d20b4af73..de225eeee 100644 --- a/scripts/create_tables.sql +++ b/scripts/create_tables.sql @@ -172,3 +172,21 @@ CREATE TABLE IF NOT EXISTS `pma_designer_coords` ( ) ENGINE=MyISAM COMMENT='Table coordinates for Designer' DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; + +-- +-- Table structure for table `pma_tracking` +-- + +CREATE TABLE IF NOT EXISTS `pma_tracking` ( + `db_name` varchar(64) collate utf8_bin NOT NULL, + `table_name` varchar(64) collate utf8_bin NOT NULL, + `version` int(10) unsigned NOT NULL, + `date_created` datetime NOT NULL, + `date_updated` datetime NOT NULL, + `schema_snapshot` text collate utf8_bin NOT NULL, + `schema_sql` text collate utf8_bin, + `data_sql` text collate utf8_bin, + `tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') collate utf8_bin default NULL, + `tracking_active` int(1) unsigned NOT NULL default '1', + PRIMARY KEY (`db_name`,`table_name`,`version`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT; diff --git a/server_status.php b/server_status.php index a0c7d10b8..860f5fd2f 100644 --- a/server_status.php +++ b/server_status.php @@ -806,14 +806,18 @@ if ($server_master_status_run || $server_slave_status_run) </td> <td class="value"> <?php - if (${"{$type}_variables_alerts"}[$variable] == ${"server_{$type}_status"}[0][$variable]) - echo '<span class="attention">'; - if (${"{$type}_variables_oks"}[$variable] == ${"server_{$type}_status"}[0][$variable]) + if (isset(${"{$type}_variables_alerts"}[$variable]) + && ${"{$type}_variables_alerts"}[$variable] == ${"server_{$type}_status"}[0][$variable]) { + echo '<span class="attention">'; + + } elseif (isset(${"{$type}_variables_oks"}[$variable]) + && ${"{$type}_variables_oks"}[$variable] == ${"server_{$type}_status"}[0][$variable]) { echo '<span class="allfine">'; - else + } else { echo '<span>'; - echo ${"server_{$type}_status"}[0][$variable]; - echo '</span>'; + } + echo ${"server_{$type}_status"}[0][$variable]; + echo '</span>'; ?> </td> </tr> diff --git a/tbl_change.php b/tbl_change.php index 3364b19c8..05225bf3a 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -464,7 +464,7 @@ foreach ($rows as $row_id => $vrow) { $data = $field['Default']; } if ($field['True_Type'] == 'bit') { - $special_chars = PMA_printable_bit_value($field['Default'], $extracted_fieldspec['spec_in_brackets']); + $special_chars = PMA_convert_bit_default_value($field['Default']); } else { $special_chars = htmlspecialchars($field['Default']); } @@ -525,8 +525,12 @@ foreach ($rows as $row_id => $vrow) { $default_function = $cfg['DefaultFunctions']['first_timestamp']; } - if ($field['Key'] == 'PRI' - && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)')) { + // For primary keys of type char(36) or varchar(36) UUID if the default function + // Only applies to insert mode, as it would silently trash data on updates. + if ($insert_mode + && $field['Key'] == 'PRI' + && ($field['Type'] == 'char(36)' || $field['Type'] == 'varchar(36)') + ) { $default_function = $cfg['DefaultFunctions']['pk_char36']; } diff --git a/tbl_structure.php b/tbl_structure.php index efc4ab28b..4f8510b43 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -337,7 +337,8 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { <td nowrap="nowrap"><?php if (isset($row['Default'])) { if ($extracted_fieldspec['type'] == 'bit') { - echo PMA_printable_bit_value($row['Default'], $extracted_fieldspec['spec_in_brackets']); + // here, $row['Default'] contains something like b'010' + echo PMA_convert_bit_default_value($row['Default']); } else { echo $row['Default']; } @@ -502,7 +503,21 @@ if (! $tbl_is_view && ! $db_is_information_schema) { echo $strStructPropose; ?></a><?php echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n"; - ?><br /> + + + if(PMA_Tracker::isActive()) + { + echo '<a href="tbl_tracking.php?' . $url_query . '">'; + + if ($cfg['PropertiesIconic']) + { + echo '<img class="icon" src="' . $pmaThemeImage . 'eye.png" width="16" height="16" alt="' . $strTrackingTrackTable . '" /> '; + } + echo $strTrackingTrackTable . '</a>'; + } + ?> + + <br /> <form method="post" action="tbl_addfield.php" onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)"> <?php diff --git a/tbl_tracking.php b/tbl_tracking.php new file mode 100644 index 000000000..7c1f8fe43 --- /dev/null +++ b/tbl_tracking.php @@ -0,0 +1,707 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * + * @author Alexander Rutkowski + * @version $Id$ + * @package phpMyAdmin + */ + +// Run common work +require_once './libraries/common.inc.php'; +require_once './libraries/Table.class.php'; + +require './libraries/tbl_common.php'; +$url_query .= '&amp;goto=tbl_tracking.php&amp;back=tbl_tracking.php'; +$url_params['goto'] = 'tbl_tracking.php';; +$url_params['back'] = 'tbl_tracking.php'; + +// Get relation settings +require_once './libraries/relation.lib.php'; + +// Init vars for tracking report +if(isset($_REQUEST['report']) or isset($_REQUEST['report_export'])) +{ + $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']); + + $selection_schema = ''; + $selection_data = ''; + $selection_both = ''; + + if(!isset($_REQUEST['logtype'])) + $_REQUEST['logtype'] = 'schema_and_data'; + + if($_REQUEST['logtype'] == 'schema') + $selection_schema = 'selected'; + else if($_REQUEST['logtype'] == 'data') + $selection_data = 'selected'; + else + $selection_both = 'selected'; + + if(!isset($_REQUEST['date_from'])) + $_REQUEST['date_from'] = $data['date_from']; + if(!isset($_REQUEST['date_to'])) + $_REQUEST['date_to'] = $data['date_to']; + + if(!isset($_REQUEST['users'])) + $_REQUEST['users'] = '*'; + + $filter_ts_from = strtotime($_REQUEST['date_from']); + $filter_ts_to = strtotime($_REQUEST['date_to']); + $filter_users = array_map('trim', explode(',', $_REQUEST['users'])); +} + +// Prepare export +if(isset($_REQUEST['report_export'])) +{ + // Filtering data definition statements + if($_REQUEST['logtype'] == 'schema' or $_REQUEST['logtype'] == 'schema_and_data') + { + $id = 0; + foreach( $data['ddlog'] as $entry ) + { + $timestamp = strtotime($entry['date']); + + if( $timestamp >= $filter_ts_from and $timestamp <= $filter_ts_to and + ( in_array('*', $filter_users) or in_array($entry['username'], $filter_users) ) ) + $entries[] = array( 'id' => $id, + 'timestamp' => $timestamp, + 'username' => $entry['username'], + 'statement' => $entry['statement'] + ); + + $id++; + } + } + + // Filtering data manipulation statments + if($_REQUEST['logtype'] == 'data' or $_REQUEST['logtype'] == 'schema_and_data') + { + $id = 0; + foreach( $data['dmlog'] as $entry ) + { + $timestamp = strtotime($entry['date']); + + if( $timestamp >= $filter_ts_from and $timestamp <= $filter_ts_to and + ( in_array('*', $filter_users) or in_array($entry['username'], $filter_users) ) ) + $entries[] = array( 'id' => $id, + 'timestamp' => $timestamp, + 'username' => $entry['username'], + 'statement' => $entry['statement'] + ); + + $id++; + } + } + + // Sort it + foreach ($entries as $key => $row) + { + $ids[$key] = $row['id']; + $timestamps[$key] = $row['timestamp']; + $usernames[$key] = $row['username']; + $statements[$key] = $row['statement']; + } + + array_multisort($timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, SORT_ASC, $statements, SORT_ASC, $entries); + + +} + +// Export as file download +if(isset($_REQUEST['report_export']) and $_REQUEST['export_type'] == 'sqldumpfile') +{ + + @ini_set('url_rewriter.tags',''); + + $dump = "# Tracking report for table `" . $_REQUEST['table'] . "`\n" . + "# " . date('Y-m-d H:i:s') . "\n"; + foreach($entries as $entry) + $dump .= $entry['statement']; + + $filename = 'log_' . $_REQUEST['table'] . '.sql'; + header('Content-Type: text/x-sql'); + header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Content-Disposition: attachment; filename="' . $filename . '"'); + if (PMA_USR_BROWSER_AGENT == 'IE') + { + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + } + else + { + header('Pragma: no-cache'); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + } + + echo $dump; + exit(); +} + + +/** + * Gets tables informations + */ + +//require './libraries/tbl_info.inc.php'; + +/** + * Displays top menu links + */ +require_once './libraries/tbl_links.inc.php'; + +?> +<p/> +<?php + +/** + * Actions + */ + +// Create tracking version +if(isset($_REQUEST['submit_create_version'])) +{ + $tracking_set = ''; + + if($_REQUEST['alter_table'] == true) + $tracking_set .= 'ALTER TABLE,'; + if($_REQUEST['rename_table'] == true) + $tracking_set .= 'RENAME TABLE,'; + if($_REQUEST['create_table'] == true) + $tracking_set .= 'CREATE TABLE,'; + if($_REQUEST['drop_table'] == true) + $tracking_set .= 'DROP TABLE,'; + if($_REQUEST['create_index'] == true) + $tracking_set .= 'CREATE INDEX,'; + if($_REQUEST['drop_index'] == true) + $tracking_set .= 'DROP INDEX,'; + if($_REQUEST['insert'] == true) + $tracking_set .= 'INSERT,'; + if($_REQUEST['update'] == true) + $tracking_set .= 'UPDATE,'; + if($_REQUEST['delete'] == true) + $tracking_set .= 'DELETE,'; + if($_REQUEST['truncate'] == true) + $tracking_set .= 'TRUNCATE,'; + + $tracking_set = rtrim($tracking_set, ','); + + if(PMA_Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set )) + { + $msg = PMA_Message::success(sprintf($strTrackingVersionCreated, $_REQUEST['version'], $GLOBALS['db'], $GLOBALS['table'])); + $msg->display(); + } +} + +// Deactivate tracking +if(isset($_REQUEST['submit_deactivate_now'])) +{ + if(PMA_Tracker::deactivateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) + { + $msg = PMA_Message::success(sprintf($strTrackingVersionDeactivated, $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])); + $msg->display(); + } +} + +// Activate tracking +if(isset($_REQUEST['submit_activate_now'])) +{ + if(PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) + { + $msg = PMA_Message::success(sprintf($strTrackingVersionActivated, $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])); + $msg->display(); + } +} + +// Export as SQL execution +if(isset($_REQUEST['report_export']) and $_REQUEST['export_type'] == 'execution') +{ + foreach($entries as $entry) + $sql_result = PMA_DBI_query( "/*NOTRACK*/\n" . $entry['statement'] ); + + $msg = PMA_Message::success($strTrackingSQLExecuted); + $msg->display(); +} + +// Export as SQL dump +if(isset($_REQUEST['report_export']) and $_REQUEST['export_type'] == 'sqldump') +{ + $new_query = "# You can execute the dump by creating and using a temporary table. Please ensure that you have the privileges to do that. \n" . + "# Comment out or remove these two lines if you don't need them. \n" . + "\n" . + "CREATE database IF NOT EXISTS pma_temp_db; \n" . + "USE pma_temp_db; \n" . + "\n" . + "/* BEGIN OF SQL DUMP */ \n"; + + foreach($entries as $entry) + $new_query .= $entry['statement']; + + $msg = PMA_Message::success($strTrackingSQLExported); + $msg->display(); + + $db_temp = $db; + $table_temp = $table; + + $db = $table = ''; + $GLOBALS['js_include'][] = 'functions.js'; + require_once './libraries/sql_query_form.lib.php'; + + PMA_sqlQueryForm($new_query, 'sql'); + + $db = $db_temp; + $table = $table_temp; +} + + + +/* + * Schema snapshot + */ +if(isset($_REQUEST['snapshot'])) +{ +?> + <h3><?php echo $strTrackingStructureSnapshot;?> [<a href="tbl_tracking.php?<?php echo $url_query;?>"><?php echo $strTrackingReportClose;?></a>]</h3> +<?php + + $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']); + + // Get first DROP TABLE and CREATE TABLE statements + $drop_create_statements = $data['ddlog'][0]['statement']; + + if(strstr($data['ddlog'][0]['statement'], 'DROP TABLE')) + $drop_create_statements .= $data['ddlog'][1]['statement']; + + // Print SQL code + PMA_showMessage(sprintf($strTrackingVersionSnapshotSQL, $_REQUEST['version']), $drop_create_statements); + + // Unserialize snapshot + $temp = unserialize($data['schema_snapshot']); + $columns = $temp['COLUMNS']; + $indexes = $temp['INDEXES']; +?> + <h3><?php echo $strStructure;?></h3> + <table id="tablestructure" class="data"> + <thead> + <tr> + <th><?php echo $strField; ?></th> + <th><?php echo $strType; ?></th> + <th><?php echo $strCollation; ?></th> + <th><?php echo $strNull; ?></th> + <th><?php echo $strDefault; ?></th> + <th><?php echo $strExtra; ?></th> + <th><?php echo $strComment; ?></th> + </tr> + </thead> + <tbody> +<?php + + $style = 'odd'; + foreach($columns as $field_index => $field) + { +?> + <tr class="<?php echo $style; ?>"> + <?php + if($field['Key'] == 'PRI') + echo '<td><b><u>' . $field['Field'] . '</u></b></td>'."\n"; + else + echo '<td><b>' . $field['Field'] . '</b></td>'."\n"; + ?> + <td><?php echo $field['Type'];?></td> + <td><?php echo $field['Collation'];?></td> + <td><?php echo $field['Null'];?></td> + <td><?php echo $field['Default'];?></td> + <td><?php echo $field['Extra'];?></td> + <td><?php echo $field['Comment'];?></td> + </tr> +<?php + if($style == 'even') $style = 'odd'; else $style = 'even'; + } +?> + </tbody> + </table> + +<?php + if(count($indexes) > 0) + { +?> + <h3><?php echo $strIndexes;?></h3> + <table id="tablestructure_indexes" class="data"> + <thead> + <tr> + <th><?php echo $strKeyname;?></th> + <th><?php echo $strType;?></th> + <th><?php echo $strUnique;?></th> + <th><?php echo $strPacked;?></th> + <th><?php echo $strField;?></th> + <th><?php echo $strCardinality;?></th> + <th><?php echo $strCollation;?></th> + <th><?php echo $strNull;?></th> + <th><?php echo $strComment;?></th> + </tr> + <tbody> +<?php + $style = 'odd'; + foreach($indexes as $indexes_index => $index) + { + if($index['Non_unique'] == 0) + $str_unique = $strYes; + else + $str_unique = $strNo; + + if($index['Packed'] != '') + $str_packed = $strYes; + else + $str_packed = $strNo; +?> + <tr class="<?php echo $style; ?>"> + <td><b><?php echo $index['Key_name'];?></b></td> + <td><?php echo $index['Index_type'];?></td> + <td><?php echo $str_unique;?></td> + <td><?php echo $str_packed;?></td> + <td><?php echo $index['Column_name'];?></td> + <td><?php echo $index['Cardinality'];?></td> + <td><?php echo $index['Collation'];?></td> + <td><?php echo $index['Null'];?></td> + <td><?php echo $index['Comment'];?></td> + </tr> +<?php + if($style == 'even') $style = 'odd'; else $style = 'even'; + } +?> + </tbody> + </table> +<?php + } // endif +?> + <br/><hr/><br/> +<?php +} +// end of snapshot report + +/* + * Tracking report + */ +if(isset($_REQUEST['report']) or isset($_REQUEST['report_export'])) +{ + ?> + <h3><?php echo $strTrackingReport;?> [<a href="tbl_tracking.php?<?php echo $url_query;?>"><?php echo $strTrackingReportClose;?></a>]</h3> + + <small><?php echo $strTrackingStatements . ' ' . $data['tracking']; ?></small><br/> + <br/> + + <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>&report=true&version=<?php echo $_REQUEST['version'];?>"> + <?php + + $str1 = '<select name="logtype">' . + '<option value="schema"' . $selection_schema . '>' . $strTrackingSelectStructureOnly . '</option>' . + '<option value="data"' . $selection_data . '>' . $strTrackingSelectDataOnly . '</option>' . + '<option value="schema_and_data"' . $selection_both . '>' . $strTrackingSelectStructureAndData . '</option>' . + '</select>'; + $str2 = '<input type="text" name="date_from" value="' . $_REQUEST['date_from'] . '" size="19">'; + $str3 = '<input type="text" name="date_to" value="' . $_REQUEST['date_to'] . '" size="19">'; + $str4 = '<input type="text" name="users" value="' . $_REQUEST['users'] . '">'; + $str5 = '<input type="submit" name="list_report" value="' . $strTrackingDoIt . '">'; + + printf($strTrackingShowLogDateUsers, $str1, $str2, $str3, $str4, $str5); + + + /* + * First, list tracked data defintion statements + */ + $i = 1; + if($selection_schema == 'selected' or $selection_both == 'selected') + { + ?> + <table id="versions" class="data" width="100%"> + <thead> + <tr> + <th width="18">#</th> + <th width="100"><?php echo $strTrackingDate;?></th> + <th width="60"><?php echo $strTrackingUsername;?></th> + <th><?php echo $strTrackingDataDefinitionStatement;?></th> + </tr> + </thead> + <tbody> + <?php + $style = 'odd'; + foreach ($data['ddlog'] as $entry) + { + $parsed_sql = PMA_SQP_parse($entry['statement']); + $statement = PMA_formatSql($parsed_sql); + $timestamp = strtotime($entry['date']); + + if( $timestamp >= $filter_ts_from and $timestamp <= $filter_ts_to and + ( in_array('*', $filter_users) or in_array($entry['username'], $filter_users) ) ) + { + ?> + <tr class="<?php echo $style; ?>"> + <td><small><?php echo $i;?></small></td> + <td><small><?php echo $entry['date'];?></small></td> + <td><small><?php echo $entry['username']; ?></small></td> + <td><?php echo $statement; ?></td> + </tr> + <?php + if($style == 'even') $style = 'odd'; else $style = 'even'; + $i++; + } + } + ?> + </tbody> + </table> + <?php + + } //endif + + /* + * Secondly, list tracked data manipulation statements + */ + + if(($selection_data == 'selected' or $selection_both == 'selected') and count($data['dmlog']) > 0) + { + ?> + <table id="versions" class="data" width="100%"> + <thead> + <tr> + <th width="18">#</th> + <th width="100"><?php echo $strTrackingDate;?></th> + <th width="60"><?php echo $strTrackingUsername;?></th> + <th><?php echo $strTrackingDataManipulationStatement;?></th> + </tr> + </thead> + <tbody> + <?php + $style = 'odd'; + foreach ($data['dmlog'] as $entry) + { + $parsed_sql = PMA_SQP_parse($entry['statement']); + $statement = PMA_formatSql($parsed_sql); + $timestamp = strtotime($entry['date']); + + if( $timestamp >= $filter_ts_from and $timestamp <= $filter_ts_to and + ( in_array('*', $filter_users) or in_array($entry['username'], $filter_users) ) ) + { + ?> + <tr class="<?php echo $style; ?>"> + <td><small><?php echo $i; ?></small></td> + <td><small><?php echo $entry['date']; ?></small></td> + <td><small><?php echo $entry['username']; ?></small></td> + <td><?php echo $statement; ?></td> + </tr> + <?php + if($style == 'even') $style = 'odd'; else $style = 'even'; + $i++; + } + } + ?> + </tbody> + </table> + <?php + } + ?> + </form> + <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>&report=true&version=<?php echo $_REQUEST['version'];?>"> + <?php + + + printf($strTrackingShowLogDateUsers, $str1, $str2, $str3, $str4, $str5); + + $str_export1 = '<select name="export_type">' . + '<option value="sqldumpfile">' . $strTrackingSQLDumpFile . '</option>' . + '<option value="sqldump">' . $strTrackingSQLDump . '</option>' . + '<option value="execution" onclick="alert(\''.$strTrackingSQLExecutionAlert .'\')">' . $strTrackingSQLExecution . '</option>' . + '</select>'; + + $str_export2 = '<input type="submit" name="report_export" value="'. $strTrackingDoIt .'">'; + ?> + </form> + <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>&report=true&version=<?php echo $_REQUEST['version'];?>"> + <input type="hidden" name="logtype" value="<?php echo $_REQUEST['logtype'];?>"> + <input type="hidden" name="date_from" value="<?php echo $_REQUEST['date_from'];?>"> + <input type="hidden" name="date_to" value="<?php echo $_REQUEST['date_to'];?>"> + <input type="hidden" name="users" value="<?php echo $_REQUEST['users'];?>"> + <?php + echo "<br/>" . sprintf($strTrackingExportAs, $str_export1) . $str_export2 . "<br/>"; + ?> + </form> + <?php + echo "<br/><br/><hr/><br/>\n"; +} // end of report + + +/* + * List selectable tables + */ + +$sql_query = " SELECT DISTINCT db_name, table_name FROM " . + PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . + PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($GLOBALS['db']) . "' " . + " ORDER BY ". PMA_backquote('db_name') . ", " . PMA_backquote('table_name'); + +$sql_result = PMA_query_as_controluser($sql_query); + +if(PMA_DBI_num_rows($sql_result) > 0) +{ +?> + <form method="post" action="tbl_tracking.php?<?php echo $url_query;?>"> + <select name="table"> + <?php + while($entries = PMA_DBI_fetch_array($sql_result)) + { + if(PMA_Tracker::isTracked($entries['db_name'], $entries['table_name'])) + $status = ' (ON)'; + else + $status = ' (OFF)'; + + if($entries['table_name'] == $_REQUEST['table']) + $s = ' selected'; + else + $s = ''; + + echo '<option value="'.$entries['table_name'].'"'.$s.'>'.$entries['db_name'].' . '.$entries['table_name'] .$status.'</option>'."\n"; + } + ?> + </select> + <input type="submit" name="show_versions_submit" value="<?php echo $strTrackingShowVersions;?>"> + </form> +<?php +} +?> +<p/> +<?php + +/* + * List versions of current table + */ + +$sql_query = " SELECT * FROM " . + PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . + PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . + " WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($_REQUEST['db']) . "' ". + " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($_REQUEST['table']) ."' ". + " ORDER BY ". PMA_backquote('version') . " DESC "; + +$sql_result = PMA_query_as_controluser($sql_query); + +$last_version = 0; +$maxversion = PMA_DBI_fetch_array($sql_result); +$last_version = $maxversion['version']; + +if($last_version > 0) +{ +?> + + <table id="versions" class="data"> + <thead> + <tr> + <th><?php echo $strTrackingThDatabase;?></th> + <th><?php echo $strTrackingThTable;?></th> + <th><?php echo $strTrackingThVersion;?></th> + <th><?php echo $strTrackingThCreated;?></th> + <th><?php echo $strTrackingThUpdated;?></th> + <th><?php echo $strTrackingThStatus;?></th> + <th><?php echo $strTrackingThShow;?></th> + </tr> + </thead> + <tbody> + <?php + $style = 'odd'; + PMA_DBI_data_seek($sql_result, 0); + while($version = PMA_DBI_fetch_array($sql_result)) + { + + if($version['tracking_active'] == 1) + $version_status = $strTrackingStatusActive; + else + $version_status = $strTrackingStatusDeactive; + + if(($version['version'] == $last_version) and ($version_status == $strTrackingStatusDeactive)) + $tracking_active = false; + if(($version['version'] == $last_version) and ($version_status == $strTrackingStatusActive)) + $tracking_active = true; + ?> + <tr class="<?php echo $style;?>"> + <td><?php echo $version['db_name'];?></td> + <td><?php echo $version['table_name'];?></td> + <td><?php echo $version['version'];?></td> + <td><?php echo $version['date_created'];?></td> + <td><?php echo $version['date_updated'];?></td> + <td><?php echo $version_status;?></td> + <td> <a href="tbl_tracking.php?<?php echo $url_query;?>&report=true&version=<?php echo $version['version'];?>"><?php echo $strTrackingReport;?></a> | <a href="tbl_tracking.php?<?php echo $url_query;?>&snapshot=true&version=<?php echo $version['version'];?>"><?php echo $strTrackingStructureSnapshot;?></a></td> + </tr> + <?php + if($style == 'even') $style = 'odd'; else $style = 'even'; + } + ?> + </tbody> + </table> + <?php if($tracking_active == true) {?> + <div id="div_deactivate_tracking"> + <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>"> + <fieldset> + <legend><?php printf($strTrackingDeactivateTrackingFor, $GLOBALS['db'], $GLOBALS['table']); ?></legend> + <input type="hidden" name="version" value="<?php echo $last_version; ?>"> + <input type="submit" name="submit_deactivate_now" value="<?php echo $strTrackingDeactivateNow; ?>" /> + </fieldset> + </form> + </div> + <?php + } + ?> + <?php if($tracking_active == false) {?> + <div id="div_activate_tracking"> + <form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>"> + <fieldset> + <legend><?php printf($strTrackingActivateTrackingFor, $GLOBALS['db'], $GLOBALS['table']); ?></legend> + <input type="hidden" name="version" value="<?php echo $last_version; ?>"> + <input type="submit" name="submit_activate_now" value="<?php echo $strTrackingActivateNow; ?>" /> + </fieldset> + </form> + </div> + <?php + } + ?> + +<?php +} +?> + +<div id="div_create_version"> +<form method="post" action="tbl_tracking.php?<?php echo $url_query; ?>"> +<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?> +<fieldset> + <legend><?php printf($strTrackingCreateVersionOf, ($last_version + 1), $GLOBALS['db'], $GLOBALS['table']); ?></legend> + + <input type="hidden" name="version" value="<?php echo ($last_version + 1); ?>"> + + <p><?php echo $strTrackingTrackDDStatements;?></p> + <input type="checkbox" name="alter_table" value="true" checked/> ALTER TABLE<br/> + <input type="checkbox" name="rename_table" value="true" checked/> RENAME TABLE<br/> + <input type="checkbox" name="create_table" value="true" checked/> CREATE TABLE<br/> + <input type="checkbox" name="drop_table" value="true" checked/> DROP TABLE<br/> + <br/> + <input type="checkbox" name="create_index" value="true" checked/> CREATE INDEX<br/> + <input type="checkbox" name="drop_index" value="true" checked/> DROP INDEX<br/> + <p><?php echo $strTrackingTrackDMStatements;?></p> + <input type="checkbox" name="insert" value="true" checked/> INSERT<br/> + <input type="checkbox" name="update" value="true" checked/> UPDATE<br/> + <input type="checkbox" name="delete" value="true" checked/> DELETE<br/> + <input type="checkbox" name="truncate" value="true" checked/> TRUNCATE<br/> + +</fieldset> +<fieldset class="tblFooters"> + <legend></legend> + <input type="submit" name="submit_create_version" value="<?php echo $strTrackingCreateVersion; ?>" /> +</fieldset> +</form> +</div> + +<br class="clearfloat"/> + +<?php +/** + * Displays the footer + */ +require_once './libraries/footer.inc.php'; +?> diff --git a/test/wui.php b/test/wui.php index 6d2e37ca8..77898bc11 100644 --- a/test/wui.php +++ b/test/wui.php @@ -3,7 +3,7 @@ /** * runs all defined tests * - * @version $Id: AllTests.php 12036 2008-11-30 11:49:44Z lem9 $ + * @version $Id$ * @package phpMyAdmin-test */ diff --git a/themes/darkblue_orange/img/eye.png b/themes/darkblue_orange/img/eye.png new file mode 100644 index 0000000000000000000000000000000000000000..564a1a9714ff37aee1c8758109113e434eff7862 GIT binary patch literal 750 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7SkfJR9T^zbpD<_bdda}R zAX(xXQ4*Y=R#Ki=l*-_klAn~S;F+74o*I;zm{M7IGS!BGfvLgM#WBR<^wD5%f8jup zfA31HYJC)SMRlGobSOw}3=wxr4l&d5G1+kWhjNU>qJNxbQf7H2Z`~d<_iFbtNx2BQ zEcukTu%R~a*2_CPjlWk#Gb<LJJT$qcdvf(Y{rfwg%P6%R2y{9q=xjS@&HDB6B_B`K z2A%wR*r=xEc7yUkS%F83E*uWFxlyMt)mwMx`Gmh>K`XBaho?SobJ{#>*@}c|olbWA zw>Lc~Wb7@ql5tBcKAF+EKj&3fti8a5C)?K@y41kdcIBDcq?a;2LJXf>4#+T_es<w) zuFJ;Gh-itfk|T@vZhkmVd+)1Tw{CT$<?v+eX}WntYm4yo#2051E?K5BEn`WQv7RQ9 zd3D0wYSz75nhu<D@$agTpM2%f8?lq>eeb&zc0HbMV3xZe;e%A=k1+X`2NH6B)mkm~ z<TdSf<~?zyp6$O~o6pH@q0^%CKDqw7aPdaa?{2M&3;0%)C|IoLl$dr#bNb(ZvQZm; z>zw*mwLyIGs#kekg}MSomVL~wfdcE8Cq=R^+fwuUpm=~cSJ<0b&6nTS6=+7S&dqRL zVXP(+ct>N?BeR^_Y{@)t6ImI17v~sEQQeqhG)1M4mE)26)hOSs)0RzNAYwM-Q0>Fz zNw3-0JmJYOY~JwhLCo}~U_r*vfE|g7_uLBJ_Nd*SBCILyC~nudx4vb|)4x&D$w_HN zcjnKvejm)~vO<}E@5L6mO$(}i{5ur#`pA1x{rGt~+a?u97%*olf8G2vVd65oJ=J-+ zs_WcNtdsgs&FF8t<97e6;!@?eL2@_Zj$|!U`PMWy_{;Sptp_JwH?yqqdAzvXX6M~Y z3QJ2oX1%=5!K7y~>HUYUOh0cM<vIO#Yks8tn;-fw|N0O1+_gC?5>jV5GB7YOc)I$z JtaD0e0sxjCSAzfm literal 0 HcmV?d00001 diff --git a/themes/original/img/eye.png b/themes/original/img/eye.png new file mode 100644 index 0000000000000000000000000000000000000000..564a1a9714ff37aee1c8758109113e434eff7862 GIT binary patch literal 750 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7SkfJR9T^zbpD<_bdda}R zAX(xXQ4*Y=R#Ki=l*-_klAn~S;F+74o*I;zm{M7IGS!BGfvLgM#WBR<^wD5%f8jup zfA31HYJC)SMRlGobSOw}3=wxr4l&d5G1+kWhjNU>qJNxbQf7H2Z`~d<_iFbtNx2BQ zEcukTu%R~a*2_CPjlWk#Gb<LJJT$qcdvf(Y{rfwg%P6%R2y{9q=xjS@&HDB6B_B`K z2A%wR*r=xEc7yUkS%F83E*uWFxlyMt)mwMx`Gmh>K`XBaho?SobJ{#>*@}c|olbWA zw>Lc~Wb7@ql5tBcKAF+EKj&3fti8a5C)?K@y41kdcIBDcq?a;2LJXf>4#+T_es<w) zuFJ;Gh-itfk|T@vZhkmVd+)1Tw{CT$<?v+eX}WntYm4yo#2051E?K5BEn`WQv7RQ9 zd3D0wYSz75nhu<D@$agTpM2%f8?lq>eeb&zc0HbMV3xZe;e%A=k1+X`2NH6B)mkm~ z<TdSf<~?zyp6$O~o6pH@q0^%CKDqw7aPdaa?{2M&3;0%)C|IoLl$dr#bNb(ZvQZm; z>zw*mwLyIGs#kekg}MSomVL~wfdcE8Cq=R^+fwuUpm=~cSJ<0b&6nTS6=+7S&dqRL zVXP(+ct>N?BeR^_Y{@)t6ImI17v~sEQQeqhG)1M4mE)26)hOSs)0RzNAYwM-Q0>Fz zNw3-0JmJYOY~JwhLCo}~U_r*vfE|g7_uLBJ_Nd*SBCILyC~nudx4vb|)4x&D$w_HN zcjnKvejm)~vO<}E@5L6mO$(}i{5ur#`pA1x{rGt~+a?u97%*olf8G2vVd65oJ=J-+ zs_WcNtdsgs&FF8t<97e6;!@?eL2@_Zj$|!U`PMWy_{;Sptp_JwH?yqqdAzvXX6M~Y z3QJ2oX1%=5!K7y~>HUYUOh0cM<vIO#Yks8tn;-fw|N0O1+_gC?5>jV5GB7YOc)I$z JtaD0e0sxjCSAzfm literal 0 HcmV?d00001 diff --git a/themes/original/img/eye_grey.png b/themes/original/img/eye_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..a29cfdaad5752c5f4252f9cdd18dd8829c572769 GIT binary patch literal 550 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4kiW$h6xih%orFL*h@TpUD<E4%P{cDwl6yP zgn@y9v%n*=n1O*?2!t6g-L3n>z`($g?&#~tz_78O`%fY(0|NtFNswPKg98W}2v6={ zU|?MA>Eaktack=&>n<io5!dCnzOC2z!Oc?tK+ES&gLZ}sPi*_n2W%{b@=Y@r&TP}N z`td*e^_H^pGv7(JbMii8J-T|;?|Zf1!#Zp1{(tlG&|k>;bEfHR-`MN<+i(A^yMESy z$C=|{(at}0`xj}{OGK@mwk&his-}e9_upTC{q<o%LbcUgwaK1~FK(E?#JiyXxN`aX zw1TYdx8?iWU0vsSEluEVKRngTm8bpi>#wJdCKz-ae>|b#@|hn7$`d^bn2x<HIhJJD z>DQn)-Fsnx!uEorNgHGI7Pr@!NIfmGJaz7Q@%rnN%Xi0`NVWEPIxr_~6^Uk5iCKC% zbNlVPdE1``Xgv8^^-|YUC{Jg)x5L(`UZZ0Q{%Vu2Fmtdleee)icw?5eP^W>$<CXS~ z-9BoEMH#9d&fsBUXJl=5oPU1$*|c0U>EdLmXB%8Kw(q$9{`<mTo3_TScW$cvk{l4{ zHEqAV2;=RyWma>~Juj9^H=E7*T0eC4)vH-g3oLBp__bBqB){CtG3!3s<o5XEj>|7Q zo<G-~>SfVpykdESaLXcT)sV8?ckfUCcmMt`&cYTKfd$zGpa^B~boFyt=akR{0P&ja AhyVZp literal 0 HcmV?d00001