From af58c3ec6a464d06bcff3e3b1b73d87fa2e8c1d9 Mon Sep 17 00:00:00 2001
From: till <till@php.net>
Date: Tue, 14 Jul 2009 10:30:28 -0400
Subject: [PATCH] 

---
 program/include/html.php |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/program/include/html.php b/program/include/html.php
index 01ad415..350b894 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -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
      *

--
Gitblit v1.9.1