cvs: php4 /pear/HTML Table.php
| From: | Bertrand Mansion | Date: | Sat, 14 Jul 2001 17:06:54 +0000 |
| Subject: | cvs: php4 /pear/HTML Table.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-273@lists.php.net to get a copy of this message | ||
mansion Sat Jul 14 13:06:54 2001 EDT
Modified files:
/php4/pear/HTML Table.php
Log:
Now compatible with error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE). Thanks to Olivier
and a fix on variables existence check.
Index: php4/pear/HTML/Table.php
diff -u php4/pear/HTML/Table.php:1.6 php4/pear/HTML/Table.php:1.7
--- php4/pear/HTML/Table.php:1.6 Fri Mar 30 00:30:58 2001
+++ php4/pear/HTML/Table.php Sat Jul 14 13:06:54 2001
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Table.php,v 1.6 2001/03/30 05:30:58 adaniel Exp $
+// $Id: Table.php,v 1.7 2001/07/14 17:06:54 mansion Exp $
require_once "PEAR.php";
require_once "HTML/Common.php";
@@ -234,7 +234,7 @@
*/
function setCellAttributes($row, $col, $attributes)
{
- if ($this->_structure[$row][$col] == "SPANNED") return;
+ if (isset($this->_structure[$row][$col]) && $this->_structure[$row][$col] ==
"SPANNED") return;
if ($row >= $this->_rows) {
if ($this->_autoGrow) {
$this->_rows = $row+1;
@@ -263,7 +263,7 @@
*/
function updateCellAttributes($row, $col, $attributes)
{
- if ($this->_structure[$row][$col] == "SPANNED") return;
+ if (isset($this->_structure[$row][$col]) && $this->_structure[$row][$col] ==
"SPANNED") return;
$attributes = $this->_parseAttributes($attributes);
$this->_updateAttrArray($this->_structure[$row][$col]["attr"],
$attributes);
$this->_updateSpanGrid($row, $col);
@@ -284,7 +284,7 @@
*/
function setCellContents($row, $col, $contents, $type='TD')
{
- if ($this->_structure[$row][$col] == "SPANNED") return;
+ if(isset($this->_structure[$row][$col]) && $this->_structure[$row][$col] ==
"SPANNED") return;
if ($row >= $this->_rows) {
if ($this->_autoGrow) {
$this->_rows = $row+1;
@@ -312,7 +312,7 @@
*/
function getCellContents($row, $col)
{
- if ($this->_structure[$row][$col] == "SPANNED") return;
+ if (isset($this->_structure[$row][$col]) && $this->_structure[$row][$col] ==
"SPANNED") return;
return $this->_structure[$row][$col]["contents"];
} // end func getCellContents
@@ -456,7 +456,7 @@
}
$strHtml .=
$tabs . "<TABLE" . $this->_getAttrString($this->_attributes) .
">\n";
- if ($this->_structure["caption"]) {
+ if (!empty($this->_structure["caption"])) {
$attr = $this->_structure["caption"]["attr"];
$contents = $this->_structure["caption"]["contents"];
$strHtml .= $tabs . "\t<CAPTION" . $this->_getAttrString($attr) .
">";
@@ -467,13 +467,30 @@
for ($i = 0 ; $i < $this->_rows ; $i++) {
$strHtml .= $tabs ."\t<TR>\n";
for ($j = 0 ; $j < $this->_cols ; $j++) {
- if ($this->_structure[$i][$j] == "SPANNED") {
+ if (isset($this -> _structure[$i][$j]) && $this->_structure[$i][$j]
== "SPANNED") {
$strHtml .= $tabs ."\t\t<!-- span -->\n";
continue;
}
- $type = ($this->_structure[$i][$j]["type"] == "TH" ?
"TH" : "TD");
- $attr = $this->_structure[$i][$j]["attr"];
- $contents = $this->_structure[$i][$j]["contents"];
+ if (isset($this->_structure[$i][$j]["type"])) {
+ $type = ($this->_structure[$i][$j]["type"] == "TH" ?
"TH" : "TD");
+ } else {
+ $type = "TD";
+ }
+ if (isset($this->_structure[$i][$j]["attr"])) {
+ $attr = $this->_structure[$i][$j]["attr"];
+ } else {
+ $attr = "";
+ }
+ if (isset($this->_structure[$i][$j]["attr"])) {
+ $attr = $this->_structure[$i][$j]["attr"];
+ } else {
+ $attr = "";
+ }
+ if (isset($this->_structure[$i][$j]["contents"])) {
+ $contents = $this->_structure[$i][$j]["contents"];
+ } else {
+ $contents = "";
+ }
$strHtml .= $tabs . "\t\t<$type" . $this->_getAttrString($attr) .
">";
if (is_object($contents)) {
if (is_subclass_of($contents, "html_common")) {
@@ -486,8 +503,10 @@
$contents = $contents->toString();
}
}
- if (is_array($contents)) $contents = implode(", ",$contents);
- if (isset($this->_autoFill) && $contents == "") $contents =
$this->_autoFill;
+ if (is_array($contents))
+ $contents = implode(", ",$contents);
+ if (isset($this->_autoFill) && $contents == "")
+ $contents = $this->_autoFill;
$strHtml .= $contents;
$strHtml .= "</$type>\n";
}
@@ -506,19 +525,23 @@
*/
function _updateSpanGrid($row, $col)
{
- $colspan = $this->_structure[$row][$col]["attr"]["colspan"];
- $rowspan = $this->_structure[$row][$col]["attr"]["rowspan"];
- if ($colspan) {
+ if (isset($this->_structure[$row][$col]["attr"]["colspan"])) {
+ $colspan = $this->_structure[$row][$col]["attr"]["colspan"];
+ }
+ if (isset($this->_structure[$row][$col]["attr"]["rowspan"])) {
+ $rowspan = $this->_structure[$row][$col]["attr"]["colspan"];
+ }
+ if (isset($colspan)) {
for ($j = $col+1; (($j < $this->_cols) && ($j <= ($col + $colspan -
1))); $j++) {
$this->_structure[$row][$j] = "SPANNED";
}
}
- if ($rowspan) {
+ if (isset($rowspan)) {
for ($i = $row+1; (($i < $this->_rows) && ($i <= ($row + $rowspan -
1))); $i++) {
$this->_structure[$i][$col] = "SPANNED";
}
}
- if ($colspan && $rowspan) {
+ if (isset($colspan) && isset($rowspan)) {
for ($i = $row+1; (($i < $this->_rows) && ($i <= ($row + $rowspan -
1))); $i++) {
for ($j = $col+1; (($j <= $this->_cols) && ($j <= ($col + $colspan
- 1))); $j++) {
$this->_structure[$i][$j] = "SPANNED";
@@ -528,4 +551,4 @@
} // end func _updateSpanGrid
} // end class HTML_Table
-?>
+?>
\ No newline at end of file