More psr-2 changes

This commit is contained in:
MarkBaker 2015-05-17 00:16:41 +01:00
parent 61e81377cb
commit 1663ef141c
2 changed files with 1875 additions and 1526 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,15 @@
<?php <?php
if (!defined('PHPEXCEL_ROOT')) {
/** /**
* PHPExcel * @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_HTML
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -26,21 +34,6 @@
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */ /** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_HTML
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
@ -120,12 +113,12 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
{ {
// Reading 2048 bytes should be enough to validate that the format is HTML // Reading 2048 bytes should be enough to validate that the format is HTML
$data = fread($this->_fileHandle, 2048); $data = fread($this->_fileHandle, 2048);
if ((strpos($data, '<') !== FALSE) && if ((strpos($data, '<') !== false) &&
(strlen($data) !== strlen(strip_tags($data)))) { (strlen($data) !== strlen(strip_tags($data)))) {
return TRUE; return true;
} }
return FALSE; return false;
} }
/** /**
@ -173,8 +166,9 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
protected function _setTableStartColumn($column) protected function _setTableStartColumn($column)
{ {
if ($this->_tableLevel == 0) if ($this->_tableLevel == 0) {
$column = 'A'; $column = 'A';
}
++$this->_tableLevel; ++$this->_tableLevel;
$this->_nestedColumn[$this->_tableLevel] = $column; $this->_nestedColumn[$this->_tableLevel] = $column;
@ -259,11 +253,13 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'strong': case 'strong':
case 'b': case 'b':
// echo 'STYLING, SPAN OR DIV<br />'; // echo 'STYLING, SPAN OR DIV<br />';
if ($cellContent > '') if ($cellContent > '') {
$cellContent .= ' '; $cellContent .= ' ';
}
$this->_processDomElement($child, $sheet, $row, $column, $cellContent); $this->_processDomElement($child, $sheet, $row, $column, $cellContent);
if ($cellContent > '') if ($cellContent > '') {
$cellContent .= ' '; $cellContent .= ' ';
}
// echo 'END OF STYLING, SPAN OR DIV<br />'; // echo 'END OF STYLING, SPAN OR DIV<br />';
break; break;
case 'hr': case 'hr':
@ -360,8 +356,9 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$this->_flushCell($sheet, $column, $row, $cellContent); $this->_flushCell($sheet, $column, $row, $cellContent);
$column = $this->_setTableStartColumn($column); $column = $this->_setTableStartColumn($column);
// echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />'; // echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
if ($this->_tableLevel > 1) if ($this->_tableLevel > 1) {
--$row; --$row;
}
$this->_processDomElement($child, $sheet, $row, $column, $cellContent); $this->_processDomElement($child, $sheet, $row, $column, $cellContent);
// echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />'; // echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
$column = $this->_releaseTableStartColumn(); $column = $this->_releaseTableStartColumn();
@ -476,7 +473,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$dom = new domDocument; $dom = new domDocument;
// Reload the HTML file into the DOM object // Reload the HTML file into the DOM object
$loaded = $dom->loadHTML($this->securityScanFile($pFilename)); $loaded = $dom->loadHTML($this->securityScanFile($pFilename));
if ($loaded === FALSE) { if ($loaded === false) {
throw new PHPExcel_Reader_Exception('Failed to load ', $pFilename, ' as a DOM Document'); throw new PHPExcel_Reader_Exception('Failed to load ', $pFilename, ' as a DOM Document');
} }
@ -529,6 +526,4 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
return $xml; return $xml;
} }
} }