@@ -138,8 +138,8 @@ |
||
| 138 | 138 | protected static function registerView() |
| 139 | 139 | { |
| 140 | 140 | if (self::$_view === null) { |
| 141 | - Yii::$app->view->on(View::EVENT_BEGIN_BODY, function ($event) { |
|
| 142 | - echo '<script type="application/ld+json">' . Json::encode($event->sender->params) . '</script>'; |
|
| 141 | + Yii::$app->view->on(View::EVENT_BEGIN_BODY, function($event) { |
|
| 142 | + echo '<script type="application/ld+json">'.Json::encode($event->sender->params).'</script>'; |
|
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | 145 | self::$_view = true; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function actionConfigInfo() |
| 31 | 31 | { |
| 32 | - $this->outputInfo("dev config file: " . Yii::getAlias($this->configFile)); |
|
| 32 | + $this->outputInfo("dev config file: ".Yii::getAlias($this->configFile)); |
|
| 33 | 33 | |
| 34 | 34 | $config = $this->readConfig(); |
| 35 | 35 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $save = FileHelper::writeFile($this->configFile, Json::encode($content)); |
| 92 | 92 | |
| 93 | 93 | if (!$save) { |
| 94 | - return $this->outputError("Unable to find config file " . $this->configFile. ". Please create and provide Permissions."); |
|
| 94 | + return $this->outputError("Unable to find config file ".$this->configFile.". Please create and provide Permissions."); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $value; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | } catch (InvalidParamException $e) { |
| 231 | 231 | try { |
| 232 | - $staticPath = static::staticBasePath() . DIRECTORY_SEPARATOR . 'controllers'; |
|
| 232 | + $staticPath = static::staticBasePath().DIRECTORY_SEPARATOR.'controllers'; |
|
| 233 | 233 | foreach (FileHelper::findFiles($staticPath) as $file) { |
| 234 | 234 | $files[$this->fileToName($staticPath, $file)] = $file; |
| 235 | 235 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function getControllerPath() |
| 259 | 259 | { |
| 260 | - return Yii::getAlias('@' . str_replace('\\', '/', $this->controllerNamespace), false); |
|
| 260 | + return Yii::getAlias('@'.str_replace('\\', '/', $this->controllerNamespace), false); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // STATIC METHODS |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | protected function timeToIso8601Duration($time) |
| 45 | 45 | { |
| 46 | 46 | $units = array( |
| 47 | - "Y" => 365*24*3600, |
|
| 48 | - "D" => 24*3600, |
|
| 47 | + "Y" => 365 * 24 * 3600, |
|
| 48 | + "D" => 24 * 3600, |
|
| 49 | 49 | "H" => 3600, |
| 50 | 50 | "M" => 60, |
| 51 | 51 | "S" => 1, |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $str .= "T"; |
| 64 | 64 | $istime = true; |
| 65 | 65 | } |
| 66 | - $str .= strval($unit) . $unitName; |
|
| 66 | + $str .= strval($unit).$unitName; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ($throwException) { |
| 43 | - throw new Exception("The given variable must be an instance of: " . implode(",", $instances)); |
|
| 43 | + throw new Exception("The given variable must be an instance of: ".implode(",", $instances)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return false; |
@@ -114,24 +114,24 @@ discard block |
||
| 114 | 114 | public function writeToFile($filename) |
| 115 | 115 | { |
| 116 | 116 | foreach ($this->sheets as $sheet_name => $sheet) { |
| 117 | - self::finalizeSheet($sheet_name);//making sure all footers have been written |
|
| 117 | + self::finalizeSheet($sheet_name); //making sure all footers have been written |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if (file_exists($filename)) { |
| 121 | 121 | if (is_writable($filename)) { |
| 122 | 122 | @unlink($filename); //if the zip already exists, remove it |
| 123 | 123 | } else { |
| 124 | - self::log("Error in " . __CLASS__ . "::" . __FUNCTION__ . ", file is not writeable."); |
|
| 124 | + self::log("Error in ".__CLASS__."::".__FUNCTION__.", file is not writeable."); |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | $zip = new ZipArchive(); |
| 129 | 129 | if (empty($this->sheets)) { |
| 130 | - self::log("Error in " . __CLASS__ . "::" . __FUNCTION__ . ", no worksheets defined."); |
|
| 130 | + self::log("Error in ".__CLASS__."::".__FUNCTION__.", no worksheets defined."); |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | if (!$zip->open($filename, ZipArchive::CREATE)) { |
| 134 | - self::log("Error in " . __CLASS__ . "::" . __FUNCTION__ . ", unable to create zip."); |
|
| 134 | + self::log("Error in ".__CLASS__."::".__FUNCTION__.", unable to create zip."); |
|
| 135 | 135 | return; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $zip->addEmptyDir("xl/worksheets/"); |
| 146 | 146 | foreach ($this->sheets as $sheet) { |
| 147 | - $zip->addFile($sheet->filename, "xl/worksheets/" . $sheet->xmlname); |
|
| 147 | + $zip->addFile($sheet->filename, "xl/worksheets/".$sheet->xmlname); |
|
| 148 | 148 | } |
| 149 | 149 | $zip->addFromString("xl/workbook.xml", self::buildWorkbookXML()); |
| 150 | 150 | $zip->addFile( |
| 151 | 151 | $this->writeStylesXML(), |
| 152 | 152 | "xl/styles.xml" |
| 153 | - ); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); |
|
| 153 | + ); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); |
|
| 154 | 154 | $zip->addFromString("[Content_Types].xml", self::buildContentTypesXML()); |
| 155 | 155 | |
| 156 | 156 | $zip->addEmptyDir("xl/_rels/"); |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $sheet_filename = $this->tempFilename(); |
| 174 | - $sheet_xmlname = 'sheet' . (count($this->sheets) + 1) . ".xml"; |
|
| 175 | - $this->sheets[$sheet_name] = (object)array( |
|
| 174 | + $sheet_xmlname = 'sheet'.(count($this->sheets) + 1).".xml"; |
|
| 175 | + $this->sheets[$sheet_name] = (object) array( |
|
| 176 | 176 | 'filename' => $sheet_filename, |
| 177 | 177 | 'sheetname' => $sheet_name, |
| 178 | 178 | 'xmlname' => $sheet_xmlname, |
@@ -188,65 +188,65 @@ discard block |
||
| 188 | 188 | 'finalized' => false, |
| 189 | 189 | ); |
| 190 | 190 | $sheet = &$this->sheets[$sheet_name]; |
| 191 | - $tabselected = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected |
|
| 192 | - $max_cell = XLSXWriter::xlsCell(self::EXCEL_2007_MAX_ROW, self::EXCEL_2007_MAX_COL);//XFE1048577 |
|
| 193 | - $sheet->file_writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); |
|
| 191 | + $tabselected = count($this->sheets) == 1 ? 'true' : 'false'; //only first sheet is selected |
|
| 192 | + $max_cell = XLSXWriter::xlsCell(self::EXCEL_2007_MAX_ROW, self::EXCEL_2007_MAX_COL); //XFE1048577 |
|
| 193 | + $sheet->file_writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
|
| 194 | 194 | $sheet->file_writer->write('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'); |
| 195 | 195 | $sheet->file_writer->write('<sheetPr filterMode="false">'); |
| 196 | 196 | $sheet->file_writer->write('<pageSetUpPr fitToPage="false"/>'); |
| 197 | 197 | $sheet->file_writer->write('</sheetPr>'); |
| 198 | 198 | $sheet->max_cell_tag_start = $sheet->file_writer->ftell(); |
| 199 | - $sheet->file_writer->write('<dimension ref="A1:' . $max_cell . '"/>'); |
|
| 199 | + $sheet->file_writer->write('<dimension ref="A1:'.$max_cell.'"/>'); |
|
| 200 | 200 | $sheet->max_cell_tag_end = $sheet->file_writer->ftell(); |
| 201 | 201 | $sheet->file_writer->write('<sheetViews>'); |
| 202 | - $sheet->file_writer->write('<sheetView colorId="64" defaultGridColor="true" rightToLeft="false" showFormulas="false" showGridLines="true" showOutlineSymbols="true" showRowColHeaders="true" showZeros="true" tabSelected="' . $tabselected . '" topLeftCell="A1" view="normal" windowProtection="false" workbookViewId="0" zoomScale="100" zoomScaleNormal="100" zoomScalePageLayoutView="100">'); |
|
| 202 | + $sheet->file_writer->write('<sheetView colorId="64" defaultGridColor="true" rightToLeft="false" showFormulas="false" showGridLines="true" showOutlineSymbols="true" showRowColHeaders="true" showZeros="true" tabSelected="'.$tabselected.'" topLeftCell="A1" view="normal" windowProtection="false" workbookViewId="0" zoomScale="100" zoomScaleNormal="100" zoomScalePageLayoutView="100">'); |
|
| 203 | 203 | if ($sheet->freeze_rows && $sheet->freeze_columns) { |
| 204 | - $sheet->file_writer->write('<pane ySplit="' . $sheet->freeze_rows . '" xSplit="' . $sheet->freeze_columns . '" topLeftCell="' . self::xlsCell( |
|
| 204 | + $sheet->file_writer->write('<pane ySplit="'.$sheet->freeze_rows.'" xSplit="'.$sheet->freeze_columns.'" topLeftCell="'.self::xlsCell( |
|
| 205 | 205 | $sheet->freeze_rows, |
| 206 | 206 | $sheet->freeze_columns |
| 207 | - ) . '" activePane="bottomRight" state="frozen"/>'); |
|
| 208 | - $sheet->file_writer->write('<selection activeCell="' . self::xlsCell( |
|
| 207 | + ).'" activePane="bottomRight" state="frozen"/>'); |
|
| 208 | + $sheet->file_writer->write('<selection activeCell="'.self::xlsCell( |
|
| 209 | 209 | $sheet->freeze_rows, |
| 210 | 210 | 0 |
| 211 | - ) . '" activeCellId="0" pane="topRight" sqref="' . self::xlsCell($sheet->freeze_rows, 0) . '"/>'); |
|
| 212 | - $sheet->file_writer->write('<selection activeCell="' . self::xlsCell( |
|
| 211 | + ).'" activeCellId="0" pane="topRight" sqref="'.self::xlsCell($sheet->freeze_rows, 0).'"/>'); |
|
| 212 | + $sheet->file_writer->write('<selection activeCell="'.self::xlsCell( |
|
| 213 | 213 | 0, |
| 214 | 214 | $sheet->freeze_columns |
| 215 | - ) . '" activeCellId="0" pane="bottomLeft" sqref="' . self::xlsCell( |
|
| 215 | + ).'" activeCellId="0" pane="bottomLeft" sqref="'.self::xlsCell( |
|
| 216 | 216 | 0, |
| 217 | 217 | $sheet->freeze_columns |
| 218 | - ) . '"/>'); |
|
| 219 | - $sheet->file_writer->write('<selection activeCell="' . self::xlsCell( |
|
| 218 | + ).'"/>'); |
|
| 219 | + $sheet->file_writer->write('<selection activeCell="'.self::xlsCell( |
|
| 220 | 220 | $sheet->freeze_rows, |
| 221 | 221 | $sheet->freeze_columns |
| 222 | - ) . '" activeCellId="0" pane="bottomRight" sqref="' . self::xlsCell( |
|
| 222 | + ).'" activeCellId="0" pane="bottomRight" sqref="'.self::xlsCell( |
|
| 223 | 223 | $sheet->freeze_rows, |
| 224 | 224 | $sheet->freeze_columns |
| 225 | - ) . '"/>'); |
|
| 225 | + ).'"/>'); |
|
| 226 | 226 | } elseif ($sheet->freeze_rows) { |
| 227 | - $sheet->file_writer->write('<pane ySplit="' . $sheet->freeze_rows . '" topLeftCell="' . self::xlsCell( |
|
| 227 | + $sheet->file_writer->write('<pane ySplit="'.$sheet->freeze_rows.'" topLeftCell="'.self::xlsCell( |
|
| 228 | 228 | $sheet->freeze_rows, |
| 229 | 229 | 0 |
| 230 | - ) . '" activePane="bottomLeft" state="frozen"/>'); |
|
| 231 | - $sheet->file_writer->write('<selection activeCell="' . self::xlsCell( |
|
| 230 | + ).'" activePane="bottomLeft" state="frozen"/>'); |
|
| 231 | + $sheet->file_writer->write('<selection activeCell="'.self::xlsCell( |
|
| 232 | 232 | $sheet->freeze_rows, |
| 233 | 233 | 0 |
| 234 | - ) . '" activeCellId="0" pane="bottomLeft" sqref="' . self::xlsCell( |
|
| 234 | + ).'" activeCellId="0" pane="bottomLeft" sqref="'.self::xlsCell( |
|
| 235 | 235 | $sheet->freeze_rows, |
| 236 | 236 | 0 |
| 237 | - ) . '"/>'); |
|
| 237 | + ).'"/>'); |
|
| 238 | 238 | } elseif ($sheet->freeze_columns) { |
| 239 | - $sheet->file_writer->write('<pane xSplit="' . $sheet->freeze_columns . '" topLeftCell="' . self::xlsCell( |
|
| 239 | + $sheet->file_writer->write('<pane xSplit="'.$sheet->freeze_columns.'" topLeftCell="'.self::xlsCell( |
|
| 240 | 240 | 0, |
| 241 | 241 | $sheet->freeze_columns |
| 242 | - ) . '" activePane="topRight" state="frozen"/>'); |
|
| 243 | - $sheet->file_writer->write('<selection activeCell="' . self::xlsCell( |
|
| 242 | + ).'" activePane="topRight" state="frozen"/>'); |
|
| 243 | + $sheet->file_writer->write('<selection activeCell="'.self::xlsCell( |
|
| 244 | 244 | 0, |
| 245 | 245 | $sheet->freeze_columns |
| 246 | - ) . '" activeCellId="0" pane="topRight" sqref="' . self::xlsCell( |
|
| 246 | + ).'" activeCellId="0" pane="topRight" sqref="'.self::xlsCell( |
|
| 247 | 247 | 0, |
| 248 | 248 | $sheet->freeze_columns |
| 249 | - ) . '"/>'); |
|
| 249 | + ).'"/>'); |
|
| 250 | 250 | } else { // not frozen |
| 251 | 251 | $sheet->file_writer->write('<selection activeCell="A1" activeCellId="0" pane="topLeft" sqref="A1"/>'); |
| 252 | 252 | } |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | $i = 0; |
| 257 | 257 | if (!empty($col_widths)) { |
| 258 | 258 | foreach ($col_widths as $column_width) { |
| 259 | - $sheet->file_writer->write('<col collapsed="false" hidden="false" max="' . ($i + 1) . '" min="' . ($i + 1) . '" style="0" customWidth="true" width="' . floatval($column_width) . '"/>'); |
|
| 259 | + $sheet->file_writer->write('<col collapsed="false" hidden="false" max="'.($i + 1).'" min="'.($i + 1).'" style="0" customWidth="true" width="'.floatval($column_width).'"/>'); |
|
| 260 | 260 | $i++; |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | - $sheet->file_writer->write('<col collapsed="false" hidden="false" max="1024" min="' . ($i + 1) . '" style="0" customWidth="false" width="11.5"/>'); |
|
| 263 | + $sheet->file_writer->write('<col collapsed="false" hidden="false" max="1024" min="'.($i + 1).'" style="0" customWidth="false" width="11.5"/>'); |
|
| 264 | 264 | $sheet->file_writer->write('</cols>'); |
| 265 | 265 | $sheet->file_writer->write('<sheetData>'); |
| 266 | 266 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | private function addCellStyle($number_format, $cell_style_string) |
| 269 | 269 | { |
| 270 | 270 | $number_format_idx = self::add_to_list_get_index($this->number_formats, $number_format); |
| 271 | - $lookup_string = $number_format_idx . ";" . $cell_style_string; |
|
| 271 | + $lookup_string = $number_format_idx.";".$cell_style_string; |
|
| 272 | 272 | $cell_style_idx = self::add_to_list_get_index($this->cell_styles, $lookup_string); |
| 273 | 273 | return $cell_style_idx; |
| 274 | 274 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $number_format_type = self::determineNumberFormatType($number_format); |
| 282 | 282 | $cell_style_idx = $this->addCellStyle($number_format, $style_string = null); |
| 283 | 283 | $column_types[] = array( |
| 284 | - 'number_format' => $number_format,//contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 284 | + 'number_format' => $number_format, //contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 285 | 285 | 'number_format_type' => $number_format_type, //contains friendly format like 'datetime' |
| 286 | 286 | 'default_cell_style' => $cell_style_idx, |
| 287 | 287 | ); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | $style = &$col_options; |
| 304 | 304 | |
| 305 | - $col_widths = isset($col_options['widths']) ? (array)$col_options['widths'] : array(); |
|
| 305 | + $col_widths = isset($col_options['widths']) ? (array) $col_options['widths'] : array(); |
|
| 306 | 306 | $auto_filter = isset($col_options['auto_filter']) ? intval($col_options['auto_filter']) : false; |
| 307 | 307 | $freeze_rows = isset($col_options['freeze_rows']) ? intval($col_options['freeze_rows']) : false; |
| 308 | 308 | $freeze_columns = isset($col_options['freeze_columns']) ? intval($col_options['freeze_columns']) : false; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | if (!$suppress_row) { |
| 313 | 313 | $header_row = array_keys($header_types); |
| 314 | 314 | |
| 315 | - $sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="' . (1) . '">'); |
|
| 315 | + $sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="'.(1).'">'); |
|
| 316 | 316 | foreach ($header_row as $c => $v) { |
| 317 | 317 | $cell_style_idx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle( |
| 318 | 318 | 'GENERAL', |
@@ -339,18 +339,18 @@ discard block |
||
| 339 | 339 | $from = 0, |
| 340 | 340 | $until = count($row), |
| 341 | 341 | 'GENERAL' |
| 342 | - ));//will map to n_auto |
|
| 343 | - $sheet->columns = array_merge((array)$sheet->columns, $default_column_types); |
|
| 342 | + )); //will map to n_auto |
|
| 343 | + $sheet->columns = array_merge((array) $sheet->columns, $default_column_types); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | if (!empty($row_options)) { |
| 347 | 347 | $ht = isset($row_options['height']) ? floatval($row_options['height']) : 12.1; |
| 348 | 348 | $customHt = isset($row_options['height']) ? true : false; |
| 349 | - $hidden = isset($row_options['hidden']) ? (bool)($row_options['hidden']) : false; |
|
| 350 | - $collapsed = isset($row_options['collapsed']) ? (bool)($row_options['collapsed']) : false; |
|
| 351 | - $sheet->file_writer->write('<row collapsed="' . ($collapsed) . '" customFormat="false" customHeight="' . ($customHt) . '" hidden="' . ($hidden) . '" ht="' . ($ht) . '" outlineLevel="0" r="' . ($sheet->row_count + 1) . '">'); |
|
| 349 | + $hidden = isset($row_options['hidden']) ? (bool) ($row_options['hidden']) : false; |
|
| 350 | + $collapsed = isset($row_options['collapsed']) ? (bool) ($row_options['collapsed']) : false; |
|
| 351 | + $sheet->file_writer->write('<row collapsed="'.($collapsed).'" customFormat="false" customHeight="'.($customHt).'" hidden="'.($hidden).'" ht="'.($ht).'" outlineLevel="0" r="'.($sheet->row_count + 1).'">'); |
|
| 352 | 352 | } else { |
| 353 | - $sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="' . ($sheet->row_count + 1) . '">'); |
|
| 353 | + $sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="'.($sheet->row_count + 1).'">'); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $style = &$row_options; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if (!empty($sheet->merge_cells)) { |
| 390 | 390 | $sheet->file_writer->write('<mergeCells>'); |
| 391 | 391 | foreach ($sheet->merge_cells as $range) { |
| 392 | - $sheet->file_writer->write('<mergeCell ref="' . $range . '"/>'); |
|
| 392 | + $sheet->file_writer->write('<mergeCell ref="'.$range.'"/>'); |
|
| 393 | 393 | } |
| 394 | 394 | $sheet->file_writer->write('</mergeCells>'); |
| 395 | 395 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $max_cell = self::xlsCell($sheet->row_count - 1, count($sheet->columns) - 1); |
| 398 | 398 | |
| 399 | 399 | if ($sheet->auto_filter) { |
| 400 | - $sheet->file_writer->write('<autoFilter ref="A1:' . $max_cell . '"/>'); |
|
| 400 | + $sheet->file_writer->write('<autoFilter ref="A1:'.$max_cell.'"/>'); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | $sheet->file_writer->write('<printOptions headings="false" gridLines="false" gridLinesSet="true" horizontalCentered="false" verticalCentered="false"/>'); |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | $sheet->file_writer->write('</headerFooter>'); |
| 410 | 410 | $sheet->file_writer->write('</worksheet>'); |
| 411 | 411 | |
| 412 | - $max_cell_tag = '<dimension ref="A1:' . $max_cell . '"/>'; |
|
| 412 | + $max_cell_tag = '<dimension ref="A1:'.$max_cell.'"/>'; |
|
| 413 | 413 | $padding_length = $sheet->max_cell_tag_end - $sheet->max_cell_tag_start - strlen($max_cell_tag); |
| 414 | 414 | $sheet->file_writer->fseek($sheet->max_cell_tag_start); |
| 415 | - $sheet->file_writer->write($max_cell_tag . str_repeat(" ", $padding_length)); |
|
| 415 | + $sheet->file_writer->write($max_cell_tag.str_repeat(" ", $padding_length)); |
|
| 416 | 416 | $sheet->file_writer->close(); |
| 417 | 417 | $sheet->finalized = true; |
| 418 | 418 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | $startCell = self::xlsCell($start_cell_row, $start_cell_column); |
| 430 | 430 | $endCell = self::xlsCell($end_cell_row, $end_cell_column); |
| 431 | - $sheet->merge_cells[] = $startCell . ":" . $endCell; |
|
| 431 | + $sheet->merge_cells[] = $startCell.":".$endCell; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | public function writeSheet(array $data, $sheet_name = '', array $header_types = array()) |
@@ -455,26 +455,26 @@ discard block |
||
| 455 | 455 | $cell_name = self::xlsCell($row_number, $column_number); |
| 456 | 456 | |
| 457 | 457 | if (!is_scalar($value) || $value === '') { //objects, array, empty |
| 458 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '"/>'); |
|
| 458 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'"/>'); |
|
| 459 | 459 | } elseif (is_string($value) && $value{0} == '=') { |
| 460 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="s"><f>' . self::xmlspecialchars($value) . '</f></c>'); |
|
| 460 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="s"><f>'.self::xmlspecialchars($value).'</f></c>'); |
|
| 461 | 461 | } elseif ($num_format_type == 'n_date') { |
| 462 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="n"><v>' . intval(self::convert_date_time($value)) . '</v></c>'); |
|
| 462 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="n"><v>'.intval(self::convert_date_time($value)).'</v></c>'); |
|
| 463 | 463 | } elseif ($num_format_type == 'n_datetime') { |
| 464 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="n"><v>' . self::convert_date_time($value) . '</v></c>'); |
|
| 464 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="n"><v>'.self::convert_date_time($value).'</v></c>'); |
|
| 465 | 465 | } elseif ($num_format_type == 'n_numeric') { |
| 466 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="n"><v>' . self::xmlspecialchars($value) . '</v></c>');//int,float,currency |
|
| 466 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="n"><v>'.self::xmlspecialchars($value).'</v></c>'); //int,float,currency |
|
| 467 | 467 | } elseif ($num_format_type == 'n_string') { |
| 468 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="inlineStr"><is><t>' . self::xmlspecialchars($value) . '</t></is></c>'); |
|
| 468 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="inlineStr"><is><t>'.self::xmlspecialchars($value).'</t></is></c>'); |
|
| 469 | 469 | } elseif ($num_format_type == 'n_auto' || 1) { //auto-detect unknown column types |
| 470 | 470 | if (!is_string($value) || $value == '0' || ($value[0] != '0' && ctype_digit($value)) || preg_match( |
| 471 | 471 | "/^\-?(0|[1-9][0-9]*)(\.[0-9]+)?$/", |
| 472 | 472 | $value |
| 473 | 473 | ) |
| 474 | 474 | ) { |
| 475 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="n"><v>' . self::xmlspecialchars($value) . '</v></c>');//int,float,currency |
|
| 475 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="n"><v>'.self::xmlspecialchars($value).'</v></c>'); //int,float,currency |
|
| 476 | 476 | } else { //implied: ($cell_format=='string') |
| 477 | - $file->write('<c r="' . $cell_name . '" s="' . $cell_style_idx . '" t="inlineStr"><is><t>' . self::xmlspecialchars($value) . '</t></is></c>'); |
|
| 477 | + $file->write('<c r="'.$cell_name.'" s="'.$cell_style_idx.'" t="inlineStr"><is><t>'.self::xmlspecialchars($value).'</t></is></c>'); |
|
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -500,9 +500,9 @@ discard block |
||
| 500 | 500 | static $horizontal_allowed = array('general', 'left', 'right', 'justify', 'center'); |
| 501 | 501 | static $vertical_allowed = array('bottom', 'center', 'distributed', 'top'); |
| 502 | 502 | $default_font = array('size' => '10', 'name' => 'Arial', 'family' => '2'); |
| 503 | - $fills = array('', '');//2 placeholders for static xml later |
|
| 504 | - $fonts = array('', '', '', '');//4 placeholders for static xml later |
|
| 505 | - $borders = array('');//1 placeholder for static xml later |
|
| 503 | + $fills = array('', ''); //2 placeholders for static xml later |
|
| 504 | + $fonts = array('', '', '', ''); //4 placeholders for static xml later |
|
| 505 | + $borders = array(''); //1 placeholder for static xml later |
|
| 506 | 506 | $style_indexes = array(); |
| 507 | 507 | foreach ($this->cell_styles as $i => $cell_style_string) { |
| 508 | 508 | $semi_colon_pos = strpos($cell_style_string, ";"); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $style_json_string = substr($cell_style_string, $semi_colon_pos + 1); |
| 511 | 511 | $style = @json_decode($style_json_string, $as_assoc = true); |
| 512 | 512 | |
| 513 | - $style_indexes[$i] = array('num_fmt_idx' => $number_format_idx);//initialize entry |
|
| 513 | + $style_indexes[$i] = array('num_fmt_idx' => $number_format_idx); //initialize entry |
|
| 514 | 514 | if (isset($style['border']) && is_string($style['border'])) {//border is a comma delimited str |
| 515 | 515 | $border_value['side'] = array_intersect(explode(",", $style['border']), $border_allowed); |
| 516 | 516 | if (isset($style['border-style']) && in_array($style['border-style'], $border_style_allowed)) { |
@@ -518,15 +518,15 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | if (isset($style['border-color']) && is_string($style['border-color']) && $style['border-color'][0] == '#') { |
| 520 | 520 | $v = substr($style['border-color'], 1, 6); |
| 521 | - $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00 |
|
| 522 | - $border_value['color'] = "FF" . strtoupper($v); |
|
| 521 | + $v = strlen($v) == 3 ? $v[0].$v[0].$v[1].$v[1].$v[2].$v[2] : $v; // expand cf0 => ccff00 |
|
| 522 | + $border_value['color'] = "FF".strtoupper($v); |
|
| 523 | 523 | } |
| 524 | 524 | $style_indexes[$i]['border_idx'] = self::add_to_list_get_index($borders, json_encode($border_value)); |
| 525 | 525 | } |
| 526 | 526 | if (isset($style['fill']) && is_string($style['fill']) && $style['fill'][0] == '#') { |
| 527 | 527 | $v = substr($style['fill'], 1, 6); |
| 528 | - $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00 |
|
| 529 | - $style_indexes[$i]['fill_idx'] = self::add_to_list_get_index($fills, "FF" . strtoupper($v)); |
|
| 528 | + $v = strlen($v) == 3 ? $v[0].$v[0].$v[1].$v[1].$v[2].$v[2] : $v; // expand cf0 => ccff00 |
|
| 529 | + $style_indexes[$i]['fill_idx'] = self::add_to_list_get_index($fills, "FF".strtoupper($v)); |
|
| 530 | 530 | } |
| 531 | 531 | if (isset($style['halign']) && in_array($style['halign'], $horizontal_allowed)) { |
| 532 | 532 | $style_indexes[$i]['alignment'] = true; |
@@ -538,12 +538,12 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | if (isset($style['wrap_text'])) { |
| 540 | 540 | $style_indexes[$i]['alignment'] = true; |
| 541 | - $style_indexes[$i]['wrap_text'] = (bool)$style['wrap_text']; |
|
| 541 | + $style_indexes[$i]['wrap_text'] = (bool) $style['wrap_text']; |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | $font = $default_font; |
| 545 | 545 | if (isset($style['font-size'])) { |
| 546 | - $font['size'] = floatval($style['font-size']);//floatval to allow "10.5" etc |
|
| 546 | + $font['size'] = floatval($style['font-size']); //floatval to allow "10.5" etc |
|
| 547 | 547 | } |
| 548 | 548 | if (isset($style['font']) && is_string($style['font'])) { |
| 549 | 549 | if ($style['font'] == 'Comic Sans MS') { |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | if (isset($style['color']) && is_string($style['color']) && $style['color'][0] == '#') { |
| 575 | 575 | $v = substr($style['color'], 1, 6); |
| 576 | - $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00 |
|
| 577 | - $font['color'] = "FF" . strtoupper($v); |
|
| 576 | + $v = strlen($v) == 3 ? $v[0].$v[0].$v[1].$v[1].$v[2].$v[2] : $v; // expand cf0 => ccff00 |
|
| 577 | + $font['color'] = "FF".strtoupper($v); |
|
| 578 | 578 | } |
| 579 | 579 | if ($font != $default_font) { |
| 580 | 580 | $style_indexes[$i]['font_idx'] = self::add_to_list_get_index($fonts, json_encode($font)); |
@@ -593,11 +593,11 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | $temporary_filename = $this->tempFilename(); |
| 595 | 595 | $file = new XLSXWriter_BuffererWriter($temporary_filename); |
| 596 | - $file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); |
|
| 596 | + $file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
|
| 597 | 597 | $file->write('<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'); |
| 598 | - $file->write('<numFmts count="' . count($this->number_formats) . '">'); |
|
| 598 | + $file->write('<numFmts count="'.count($this->number_formats).'">'); |
|
| 599 | 599 | foreach ($this->number_formats as $i => $v) { |
| 600 | - $file->write('<numFmt numFmtId="' . (164 + $i) . '" formatCode="' . self::xmlspecialchars($v) . '" />'); |
|
| 600 | + $file->write('<numFmt numFmtId="'.(164 + $i).'" formatCode="'.self::xmlspecialchars($v).'" />'); |
|
| 601 | 601 | } |
| 602 | 602 | //$file->write( '<numFmt formatCode="GENERAL" numFmtId="164"/>'); |
| 603 | 603 | //$file->write( '<numFmt formatCode="[$$-1009]#,##0.00;[RED]\-[$$-1009]#,##0.00" numFmtId="165"/>'); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | //$file->write( '<numFmt formatCode="YYYY-MM-DD" numFmtId="167"/>'); |
| 606 | 606 | $file->write('</numFmts>'); |
| 607 | 607 | |
| 608 | - $file->write('<fonts count="' . (count($fonts)) . '">'); |
|
| 608 | + $file->write('<fonts count="'.(count($fonts)).'">'); |
|
| 609 | 609 | $file->write('<font><name val="Arial"/><charset val="1"/><family val="2"/><sz val="10"/></font>'); |
| 610 | 610 | $file->write('<font><name val="Arial"/><family val="0"/><sz val="10"/></font>'); |
| 611 | 611 | $file->write('<font><name val="Arial"/><family val="0"/><sz val="10"/></font>'); |
@@ -615,10 +615,10 @@ discard block |
||
| 615 | 615 | if (!empty($font)) { //fonts have 4 empty placeholders in array to offset the 4 static xml entries above |
| 616 | 616 | $f = json_decode($font, true); |
| 617 | 617 | $file->write('<font>'); |
| 618 | - $file->write('<name val="' . htmlspecialchars($f['name']) . '"/><charset val="1"/><family val="' . intval($f['family']) . '"/>'); |
|
| 619 | - $file->write('<sz val="' . intval($f['size']) . '"/>'); |
|
| 618 | + $file->write('<name val="'.htmlspecialchars($f['name']).'"/><charset val="1"/><family val="'.intval($f['family']).'"/>'); |
|
| 619 | + $file->write('<sz val="'.intval($f['size']).'"/>'); |
|
| 620 | 620 | if (!empty($f['color'])) { |
| 621 | - $file->write('<color rgb="' . strval($f['color']) . '"/>'); |
|
| 621 | + $file->write('<color rgb="'.strval($f['color']).'"/>'); |
|
| 622 | 622 | } |
| 623 | 623 | if (!empty($f['bold'])) { |
| 624 | 624 | $file->write('<b val="true"/>'); |
@@ -637,23 +637,23 @@ discard block |
||
| 637 | 637 | } |
| 638 | 638 | $file->write('</fonts>'); |
| 639 | 639 | |
| 640 | - $file->write('<fills count="' . (count($fills)) . '">'); |
|
| 640 | + $file->write('<fills count="'.(count($fills)).'">'); |
|
| 641 | 641 | $file->write('<fill><patternFill patternType="none"/></fill>'); |
| 642 | 642 | $file->write('<fill><patternFill patternType="gray125"/></fill>'); |
| 643 | 643 | foreach ($fills as $fill) { |
| 644 | 644 | if (!empty($fill)) { //fills have 2 empty placeholders in array to offset the 2 static xml entries above |
| 645 | - $file->write('<fill><patternFill patternType="solid"><fgColor rgb="' . strval($fill) . '"/><bgColor indexed="64"/></patternFill></fill>'); |
|
| 645 | + $file->write('<fill><patternFill patternType="solid"><fgColor rgb="'.strval($fill).'"/><bgColor indexed="64"/></patternFill></fill>'); |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | $file->write('</fills>'); |
| 649 | 649 | |
| 650 | - $file->write('<borders count="' . (count($borders)) . '">'); |
|
| 650 | + $file->write('<borders count="'.(count($borders)).'">'); |
|
| 651 | 651 | $file->write('<border diagonalDown="false" diagonalUp="false"><left/><right/><top/><bottom/><diagonal/></border>'); |
| 652 | 652 | foreach ($borders as $border) { |
| 653 | 653 | if (!empty($border)) { //fonts have an empty placeholder in the array to offset the static xml entry above |
| 654 | 654 | $pieces = json_decode($border, true); |
| 655 | 655 | $border_style = !empty($pieces['style']) ? $pieces['style'] : 'hair'; |
| 656 | - $border_color = !empty($pieces['color']) ? '<color rgb="' . strval($pieces['color']) . '"/>' : ''; |
|
| 656 | + $border_color = !empty($pieces['color']) ? '<color rgb="'.strval($pieces['color']).'"/>' : ''; |
|
| 657 | 657 | $file->write('<border diagonalDown="false" diagonalUp="false">'); |
| 658 | 658 | foreach (array('left', 'right', 'top', 'bottom') as $side) { |
| 659 | 659 | $show_side = in_array($side, $pieces['side']) ? true : false; |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $file->write('<xf applyAlignment="false" applyBorder="false" applyFont="true" applyProtection="false" borderId="0" fillId="0" fontId="1" numFmtId="9"/>'); |
| 692 | 692 | $file->write('</cellStyleXfs>'); |
| 693 | 693 | |
| 694 | - $file->write('<cellXfs count="' . (count($style_indexes)) . '">'); |
|
| 694 | + $file->write('<cellXfs count="'.(count($style_indexes)).'">'); |
|
| 695 | 695 | //$file->write( '<xf applyAlignment="false" applyBorder="false" applyFont="false" applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="164" xfId="0"/>'); |
| 696 | 696 | //$file->write( '<xf applyAlignment="false" applyBorder="false" applyFont="false" applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="165" xfId="0"/>'); |
| 697 | 697 | //$file->write( '<xf applyAlignment="false" applyBorder="false" applyFont="false" applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="166" xfId="0"/>'); |
@@ -707,8 +707,8 @@ discard block |
||
| 707 | 707 | $fillIdx = isset($v['fill_idx']) ? intval($v['fill_idx']) : 0; |
| 708 | 708 | $fontIdx = isset($v['font_idx']) ? intval($v['font_idx']) : 0; |
| 709 | 709 | //$file->write('<xf applyAlignment="'.$applyAlignment.'" applyBorder="'.$applyBorder.'" applyFont="'.$applyFont.'" applyProtection="false" borderId="'.($borderIdx).'" fillId="'.($fillIdx).'" fontId="'.($fontIdx).'" numFmtId="'.(164+$v['num_fmt_idx']).'" xfId="0"/>'); |
| 710 | - $file->write('<xf applyAlignment="' . $applyAlignment . '" applyBorder="' . $applyBorder . '" applyFont="' . $applyFont . '" applyProtection="false" borderId="' . ($borderIdx) . '" fillId="' . ($fillIdx) . '" fontId="' . ($fontIdx) . '" numFmtId="' . (164 + $v['num_fmt_idx']) . '" xfId="0">'); |
|
| 711 | - $file->write(' <alignment horizontal="' . $horizAlignment . '" vertical="' . $vertAlignment . '" textRotation="0" wrapText="' . $wrapText . '" indent="0" shrinkToFit="false"/>'); |
|
| 710 | + $file->write('<xf applyAlignment="'.$applyAlignment.'" applyBorder="'.$applyBorder.'" applyFont="'.$applyFont.'" applyProtection="false" borderId="'.($borderIdx).'" fillId="'.($fillIdx).'" fontId="'.($fontIdx).'" numFmtId="'.(164 + $v['num_fmt_idx']).'" xfId="0">'); |
|
| 711 | + $file->write(' <alignment horizontal="'.$horizAlignment.'" vertical="'.$vertAlignment.'" textRotation="0" wrapText="'.$wrapText.'" indent="0" shrinkToFit="false"/>'); |
|
| 712 | 712 | $file->write(' <protection locked="true" hidden="false"/>'); |
| 713 | 713 | $file->write('</xf>'); |
| 714 | 714 | } |
@@ -729,10 +729,10 @@ discard block |
||
| 729 | 729 | protected function buildAppXML() |
| 730 | 730 | { |
| 731 | 731 | $app_xml = ""; |
| 732 | - $app_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"; |
|
| 732 | + $app_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"; |
|
| 733 | 733 | $app_xml .= '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">'; |
| 734 | 734 | $app_xml .= '<TotalTime>0</TotalTime>'; |
| 735 | - $app_xml .= '<Company>' . self::xmlspecialchars($this->company) . '</Company>'; |
|
| 735 | + $app_xml .= '<Company>'.self::xmlspecialchars($this->company).'</Company>'; |
|
| 736 | 736 | $app_xml .= '</Properties>'; |
| 737 | 737 | return $app_xml; |
| 738 | 738 | } |
@@ -740,19 +740,19 @@ discard block |
||
| 740 | 740 | protected function buildCoreXML() |
| 741 | 741 | { |
| 742 | 742 | $core_xml = ""; |
| 743 | - $core_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"; |
|
| 743 | + $core_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"; |
|
| 744 | 744 | $core_xml .= '<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; |
| 745 | - $core_xml .= '<dcterms:created xsi:type="dcterms:W3CDTF">' . date("Y-m-d\TH:i:s.00\Z") . '</dcterms:created>';//$date_time = '2014-10-25T15:54:37.00Z'; |
|
| 746 | - $core_xml .= '<dc:title>' . self::xmlspecialchars($this->title) . '</dc:title>'; |
|
| 747 | - $core_xml .= '<dc:subject>' . self::xmlspecialchars($this->subject) . '</dc:subject>'; |
|
| 748 | - $core_xml .= '<dc:creator>' . self::xmlspecialchars($this->author) . '</dc:creator>'; |
|
| 745 | + $core_xml .= '<dcterms:created xsi:type="dcterms:W3CDTF">'.date("Y-m-d\TH:i:s.00\Z").'</dcterms:created>'; //$date_time = '2014-10-25T15:54:37.00Z'; |
|
| 746 | + $core_xml .= '<dc:title>'.self::xmlspecialchars($this->title).'</dc:title>'; |
|
| 747 | + $core_xml .= '<dc:subject>'.self::xmlspecialchars($this->subject).'</dc:subject>'; |
|
| 748 | + $core_xml .= '<dc:creator>'.self::xmlspecialchars($this->author).'</dc:creator>'; |
|
| 749 | 749 | if (!empty($this->keywords)) { |
| 750 | - $core_xml .= '<cp:keywords>' . self::xmlspecialchars(implode( |
|
| 750 | + $core_xml .= '<cp:keywords>'.self::xmlspecialchars(implode( |
|
| 751 | 751 | ", ", |
| 752 | - (array)$this->keywords |
|
| 753 | - )) . '</cp:keywords>'; |
|
| 752 | + (array) $this->keywords |
|
| 753 | + )).'</cp:keywords>'; |
|
| 754 | 754 | } |
| 755 | - $core_xml .= '<dc:description>' . self::xmlspecialchars($this->description) . '</dc:description>'; |
|
| 755 | + $core_xml .= '<dc:description>'.self::xmlspecialchars($this->description).'</dc:description>'; |
|
| 756 | 756 | $core_xml .= '<cp:revision>0</cp:revision>'; |
| 757 | 757 | $core_xml .= '</cp:coreProperties>'; |
| 758 | 758 | return $core_xml; |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | protected function buildRelationshipsXML() |
| 762 | 762 | { |
| 763 | 763 | $rels_xml = ""; |
| 764 | - $rels_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; |
|
| 764 | + $rels_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n"; |
|
| 765 | 765 | $rels_xml .= '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'; |
| 766 | 766 | $rels_xml .= '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>'; |
| 767 | 767 | $rels_xml .= '<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>'; |
@@ -775,14 +775,14 @@ discard block |
||
| 775 | 775 | { |
| 776 | 776 | $i = 0; |
| 777 | 777 | $workbook_xml = ""; |
| 778 | - $workbook_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"; |
|
| 778 | + $workbook_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"; |
|
| 779 | 779 | $workbook_xml .= '<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'; |
| 780 | 780 | $workbook_xml .= '<fileVersion appName="Calc"/><workbookPr backupFile="false" showObjects="all" date1904="false"/><workbookProtection/>'; |
| 781 | 781 | $workbook_xml .= '<bookViews><workbookView activeTab="0" firstSheet="0" showHorizontalScroll="true" showSheetTabs="true" showVerticalScroll="true" tabRatio="212" windowHeight="8192" windowWidth="16384" xWindow="0" yWindow="0"/></bookViews>'; |
| 782 | 782 | $workbook_xml .= '<sheets>'; |
| 783 | 783 | foreach ($this->sheets as $sheet_name => $sheet) { |
| 784 | 784 | $sheetname = self::sanitize_sheetname($sheet->sheetname); |
| 785 | - $workbook_xml .= '<sheet name="' . self::xmlspecialchars($sheetname) . '" sheetId="' . ($i + 1) . '" state="visible" r:id="rId' . ($i + 2) . '"/>'; |
|
| 785 | + $workbook_xml .= '<sheet name="'.self::xmlspecialchars($sheetname).'" sheetId="'.($i + 1).'" state="visible" r:id="rId'.($i + 2).'"/>'; |
|
| 786 | 786 | $i++; |
| 787 | 787 | } |
| 788 | 788 | $workbook_xml .= '</sheets>'; |
@@ -790,11 +790,11 @@ discard block |
||
| 790 | 790 | foreach ($this->sheets as $sheet_name => $sheet) { |
| 791 | 791 | if ($sheet->auto_filter) { |
| 792 | 792 | $sheetname = self::sanitize_sheetname($sheet->sheetname); |
| 793 | - $workbook_xml .= '<definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">\'' . self::xmlspecialchars($sheetname) . '\'!$A$1:' . self::xlsCell( |
|
| 793 | + $workbook_xml .= '<definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">\''.self::xmlspecialchars($sheetname).'\'!$A$1:'.self::xlsCell( |
|
| 794 | 794 | $sheet->row_count - 1, |
| 795 | 795 | count($sheet->columns) - 1, |
| 796 | 796 | true |
| 797 | - ) . '</definedName>'; |
|
| 797 | + ).'</definedName>'; |
|
| 798 | 798 | $i++; |
| 799 | 799 | } |
| 800 | 800 | } |
@@ -807,11 +807,11 @@ discard block |
||
| 807 | 807 | { |
| 808 | 808 | $i = 0; |
| 809 | 809 | $wkbkrels_xml = ""; |
| 810 | - $wkbkrels_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; |
|
| 810 | + $wkbkrels_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n"; |
|
| 811 | 811 | $wkbkrels_xml .= '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'; |
| 812 | 812 | $wkbkrels_xml .= '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>'; |
| 813 | 813 | foreach ($this->sheets as $sheet_name => $sheet) { |
| 814 | - $wkbkrels_xml .= '<Relationship Id="rId' . ($i + 2) . '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/' . ($sheet->xmlname) . '"/>'; |
|
| 814 | + $wkbkrels_xml .= '<Relationship Id="rId'.($i + 2).'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/'.($sheet->xmlname).'"/>'; |
|
| 815 | 815 | $i++; |
| 816 | 816 | } |
| 817 | 817 | $wkbkrels_xml .= "\n"; |
@@ -822,12 +822,12 @@ discard block |
||
| 822 | 822 | protected function buildContentTypesXML() |
| 823 | 823 | { |
| 824 | 824 | $content_types_xml = ""; |
| 825 | - $content_types_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; |
|
| 825 | + $content_types_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n"; |
|
| 826 | 826 | $content_types_xml .= '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">'; |
| 827 | 827 | $content_types_xml .= '<Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'; |
| 828 | 828 | $content_types_xml .= '<Override PartName="/xl/_rels/workbook.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'; |
| 829 | 829 | foreach ($this->sheets as $sheet_name => $sheet) { |
| 830 | - $content_types_xml .= '<Override PartName="/xl/worksheets/' . ($sheet->xmlname) . '" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'; |
|
| 830 | + $content_types_xml .= '<Override PartName="/xl/worksheets/'.($sheet->xmlname).'" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'; |
|
| 831 | 831 | } |
| 832 | 832 | $content_types_xml .= '<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>'; |
| 833 | 833 | $content_types_xml .= '<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>'; |
@@ -849,12 +849,12 @@ discard block |
||
| 849 | 849 | { |
| 850 | 850 | $n = $column_number; |
| 851 | 851 | for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { |
| 852 | - $r = chr($n % 26 + 0x41) . $r; |
|
| 852 | + $r = chr($n % 26 + 0x41).$r; |
|
| 853 | 853 | } |
| 854 | 854 | if ($absolute) { |
| 855 | - return '$' . $r . '$' . ($row_number + 1); |
|
| 855 | + return '$'.$r.'$'.($row_number + 1); |
|
| 856 | 856 | } |
| 857 | - return $r . ($row_number + 1); |
|
| 857 | + return $r.($row_number + 1); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | //------------------------------------------------------------------ |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | { |
| 863 | 863 | file_put_contents( |
| 864 | 864 | "php://stderr", |
| 865 | - date("Y-m-d H:i:s:") . rtrim(is_array($string) ? json_encode($string) : $string) . "\n" |
|
| 865 | + date("Y-m-d H:i:s:").rtrim(is_array($string) ? json_encode($string) : $string)."\n" |
|
| 866 | 866 | ); |
| 867 | 867 | } |
| 868 | 868 | |
@@ -884,8 +884,8 @@ discard block |
||
| 884 | 884 | static $goodchars = ' '; |
| 885 | 885 | $sheetname = strtr($sheetname, $badchars, $goodchars); |
| 886 | 886 | $sheetname = substr($sheetname, 0, 31); |
| 887 | - $sheetname = trim(trim(trim($sheetname), "'"));//trim before and after trimming single quotes |
|
| 888 | - return !empty($sheetname) ? $sheetname : 'Sheet' . ((rand() % 900) + 100); |
|
| 887 | + $sheetname = trim(trim(trim($sheetname), "'")); //trim before and after trimming single quotes |
|
| 888 | + return !empty($sheetname) ? $sheetname : 'Sheet'.((rand() % 900) + 100); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | //------------------------------------------------------------------ |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | htmlspecialchars($val, ENT_QUOTES | ENT_XML1), |
| 899 | 899 | $badchars, |
| 900 | 900 | $goodchars |
| 901 | - );//strtr appears to be faster than str_replace |
|
| 901 | + ); //strtr appears to be faster than str_replace |
|
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | //------------------------------------------------------------------ |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | if ($ignore_until == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $num_format[$i - 1] != '_')) { |
| 1005 | - $escaped .= "\\" . $c; |
|
| 1005 | + $escaped .= "\\".$c; |
|
| 1006 | 1006 | } else { |
| 1007 | 1007 | $escaped .= $c; |
| 1008 | 1008 | } |
@@ -1024,8 +1024,8 @@ discard block |
||
| 1024 | 1024 | //------------------------------------------------------------------ |
| 1025 | 1025 | public static function convert_date_time($date_input) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl) |
| 1026 | 1026 | { |
| 1027 | - $days = 0; # Number of days since epoch |
|
| 1028 | - $seconds = 0; # Time expressed as fraction of 24h hours in seconds |
|
| 1027 | + $days = 0; # Number of days since epoch |
|
| 1028 | + $seconds = 0; # Time expressed as fraction of 24h hours in seconds |
|
| 1029 | 1029 | $year = $month = $day = 0; |
| 1030 | 1030 | $hour = $min = $sec = 0; |
| 1031 | 1031 | |
@@ -1076,13 +1076,13 @@ discard block |
||
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | # Accumulate the number of days since the epoch. |
| 1079 | - $days = $day; # Add days for current month |
|
| 1080 | - $days += array_sum(array_slice($mdays, 0, $month - 1)); # Add days for past months |
|
| 1081 | - $days += $range * 365; # Add days for past years |
|
| 1082 | - $days += intval(($range) / 4); # Add leapdays |
|
| 1079 | + $days = $day; # Add days for current month |
|
| 1080 | + $days += array_sum(array_slice($mdays, 0, $month - 1)); # Add days for past months |
|
| 1081 | + $days += $range * 365; # Add days for past years |
|
| 1082 | + $days += intval(($range) / 4); # Add leapdays |
|
| 1083 | 1083 | $days -= intval(($range + $offset) / 100); # Subtract 100 year leapdays |
| 1084 | - $days += intval(($range + $offset + $norm) / 400); # Add 400 year leapdays |
|
| 1085 | - $days -= $leap; # Already counted above |
|
| 1084 | + $days += intval(($range + $offset + $norm) / 400); # Add 400 year leapdays |
|
| 1085 | + $days -= $leap; # Already counted above |
|
| 1086 | 1086 | |
| 1087 | 1087 | # Adjust for Excel erroneously treating 1900 as a leap year. |
| 1088 | 1088 | if ($days > 59) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | return [ |
| 226 | 226 | 'module' => $this->module->id, |
| 227 | - 'route' => $this->module->id . '/' . $request['route'], |
|
| 227 | + 'route' => $this->module->id.'/'.$request['route'], |
|
| 228 | 228 | 'params' => $request['args'], |
| 229 | 229 | ]; |
| 230 | 230 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | throw new NotFoundHttpException(sprintf("Unable to create controller '%s' for module '%s'.", $requestRoute['route'], $this->module->id)); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - Yii::info('LUYA module run module "'.$this->module->id.'" route ' . $requestRoute['route'], __METHOD__); |
|
| 248 | + Yii::info('LUYA module run module "'.$this->module->id.'" route '.$requestRoute['route'], __METHOD__); |
|
| 249 | 249 | |
| 250 | 250 | $this->controller = $controller[0]; |
| 251 | 251 | $originalController = Yii::$app->controller; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @see https://github.com/luyadev/luya/issues/1730 |
| 258 | 258 | */ |
| 259 | - $this->controller->on(Controller::EVENT_BEFORE_ACTION, function ($event) { |
|
| 259 | + $this->controller->on(Controller::EVENT_BEFORE_ACTION, function($event) { |
|
| 260 | 260 | Yii::$app->controller = $this->controller; |
| 261 | 261 | }); |
| 262 | 262 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * |
| 265 | 265 | * @see https://github.com/luyadev/luya/issues/1768 |
| 266 | 266 | */ |
| 267 | - $this->controller->on(Controller::EVENT_AFTER_ACTION, function ($event) use ($originalController) { |
|
| 267 | + $this->controller->on(Controller::EVENT_AFTER_ACTION, function($event) use ($originalController) { |
|
| 268 | 268 | Yii::$app->controller = $originalController; |
| 269 | 269 | }); |
| 270 | 270 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function trailing($url, $slash = '/') |
| 36 | 36 | { |
| 37 | - return rtrim($url, $slash) . $slash; |
|
| 37 | + return rtrim($url, $slash).$slash; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public static function ensureHttp($url, $https = false) |
| 88 | 88 | { |
| 89 | 89 | if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { |
| 90 | - $url = ($https ? "https://" : "http://") . $url; |
|
| 90 | + $url = ($https ? "https://" : "http://").$url; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $url; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // generate summary overview |
| 101 | 101 | foreach ($this->repos as $repo) { |
| 102 | 102 | $newRepoHome = $this->getFilesystemRepoPath($repo); |
| 103 | - if (file_exists($newRepoHome . DIRECTORY_SEPARATOR . '.git')) { |
|
| 103 | + if (file_exists($newRepoHome.DIRECTORY_SEPARATOR.'.git')) { |
|
| 104 | 104 | $summary[] = $this->summaryItem($repo, false, true); |
| 105 | 105 | } elseif ($this->forkExists($username, $repo)) { |
| 106 | 106 | $summary[] = $this->summaryItem($repo, true, false); |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $this->saveConfig(self::CONFIG_VAR_CUSTOMCLONES, $clones); |
| 198 | 198 | |
| 199 | - $composerReader = new ComposerReader($repoFileSystemPath . DIRECTORY_SEPARATOR . 'composer.json'); |
|
| 199 | + $composerReader = new ComposerReader($repoFileSystemPath.DIRECTORY_SEPARATOR.'composer.json'); |
|
| 200 | 200 | |
| 201 | 201 | if ($composerReader->canRead()) { |
| 202 | 202 | $section = new AutoloadSection($composerReader); |
| 203 | 203 | $autoloaders = []; |
| 204 | 204 | foreach ($section as $autoload) { |
| 205 | - $newSrc = $repoFileSystemPath . DIRECTORY_SEPARATOR . $autoload->source; |
|
| 205 | + $newSrc = $repoFileSystemPath.DIRECTORY_SEPARATOR.$autoload->source; |
|
| 206 | 206 | $autoloaders[] = ['autoload' => $autoload, 'src' => $newSrc]; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | protected function getProjectComposerReader() |
| 250 | 250 | { |
| 251 | - return new ComposerReader(getcwd() . DIRECTORY_SEPARATOR . 'composer.json'); |
|
| 251 | + return new ComposerReader(getcwd().DIRECTORY_SEPARATOR.'composer.json'); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | private $_gitWrapper; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | private function getFilesystemRepoPath($repo) |
| 287 | 287 | { |
| 288 | - return 'repos' . DIRECTORY_SEPARATOR . $repo; |
|
| 288 | + return 'repos'.DIRECTORY_SEPARATOR.$repo; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | $wrapper->git('pull', $repoFileSystemPath); |
| 351 | 351 | $this->outputInfo("{$repo}: pull ✔"); |
| 352 | 352 | } catch (\Exception $err) { |
| 353 | - $this->outputError("{$repo}: error while updating ({$repoFileSystemPath}) with message: " . $err->getMessage()); |
|
| 353 | + $this->outputError("{$repo}: error while updating ({$repoFileSystemPath}) with message: ".$err->getMessage()); |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |