From 5d90e1dfe2b2fbca330c204c6f43bc8a926d9b4d Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 21 May 2009 03:30:27 -0400
Subject: [PATCH] - moved some code from init() to start()

---
 program/include/html.php |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/program/include/html.php b/program/include/html.php
index 9268aca..350b894 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -5,7 +5,7 @@
  | program/include/html.php                                              |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005-2008, RoundCube Dev, - Switzerland                 |
+ | Copyright (C) 2005-2009, RoundCube Dev, - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -33,7 +33,7 @@
     protected $content;
 
     public static $common_attrib = array('id','class','style','title','align');
-    public static $containers = array('iframe','div','span','p','h1','h2','h3','form','textarea','table','tr','th','td','style');
+    public static $containers = array('iframe','div','span','p','h1','h2','h3','form','textarea','table','tr','th','td','style','script');
     public static $lc_tags = true;
 
     /**
@@ -457,7 +457,7 @@
             unset($this->attrib['value']);
         }
 
-        if (!empty($value) && !ereg('mce_editor', $this->attrib['class'])) {
+        if (!empty($value) && !preg_match('/mce_editor/', $this->attrib['class'])) {
             $value = Q($value, 'strict', false);
         }
 
@@ -599,6 +599,34 @@
         $this->header[] = $cell;
     }
 
+     /**
+     * Remove a column from a table
+     * Useful for plugins making alterations
+     * 
+     * @param string $class 
+     */
+    public function remove_column($class)
+    {
+        // Remove the header
+        foreach($this->header as $index=>$header){
+            if($header->attrib['class'] == $class){
+                unset($this->header[$index]);
+                break;
+            }
+        }
+
+        // Remove cells from rows
+        foreach($this->rows as $i=>$row){
+            foreach($row->cells as $j=>$cell){
+                if($cell->attrib['class'] == $class){
+                    unset($this->rows[$i]->cells[$j]);
+                    break;
+                }
+            }
+        }
+    }
+
+
     /**
      * Jump to next row
      *
@@ -669,6 +697,16 @@
         unset($this->attrib['cols'], $this->attrib['rowsonly']);
         return parent::show();
     }
+    
+    /**
+     * Count number of rows
+     *
+     * @return The number of rows
+     */
+    public function size()
+    {
+      return count($this->rows);
+    }
 }
 
 ?>

--
Gitblit v1.9.1