diff --git a/library/HTMLPurifier/HTMLDefinition.php b/library/HTMLPurifier/HTMLDefinition.php
index 0aea5209..97a1d5c4 100644
--- a/library/HTMLPurifier/HTMLDefinition.php
+++ b/library/HTMLPurifier/HTMLDefinition.php
@@ -18,6 +18,9 @@ require_once 'HTMLPurifier/AttrTransform/ImgRequired.php';
// temporary: tag transformations
require_once 'HTMLPurifier/TagTransform.php';
+require_once 'HTMLPurifier/TagTransform/Simple.php';
+require_once 'HTMLPurifier/TagTransform/Center.php';
+require_once 'HTMLPurifier/TagTransform/Font.php';
// default modules
require_once 'HTMLPurifier/HTMLModule.php';
diff --git a/library/HTMLPurifier/TagTransform.php b/library/HTMLPurifier/TagTransform.php
index be0555a0..f5dc5c97 100644
--- a/library/HTMLPurifier/TagTransform.php
+++ b/library/HTMLPurifier/TagTransform.php
@@ -1,6 +1,6 @@
transform_to = $transform_to;
- }
-
- function transform($tag, $config, &$context) {
- $new_tag = $tag->copy();
- $new_tag->name = $this->transform_to;
- return $new_tag;
- }
-
-}
-
-/**
- * Transforms CENTER tags into proper version (DIV with text-align CSS)
- *
- * Takes a CENTER tag, parses the align attribute, and then if it's valid
- * assigns it to the CSS property text-align.
- */
-class HTMLPurifier_TagTransform_Center extends HTMLPurifier_TagTransform
-{
- var $transform_to = 'div';
-
- function transform($tag, $config, &$context) {
- if ($tag->type == 'end') {
- $new_tag = new HTMLPurifier_Token_End($this->transform_to);
- return $new_tag;
- }
- $attr = $tag->attr;
- $prepend_css = 'text-align:center;';
- if (isset($attr['style'])) {
- $attr['style'] = $prepend_css . $attr['style'];
- } else {
- $attr['style'] = $prepend_css;
- }
- $new_tag = $tag->copy();
- $new_tag->name = $this->transform_to;
- $new_tag->attr = $attr;
- return $new_tag;
- }
-}
-
-/**
- * Transforms FONT tags to the proper form (SPAN with CSS styling)
- *
- * This transformation takes the three proprietary attributes of FONT and
- * transforms them into their corresponding CSS attributes. These are color,
- * face, and size.
- *
- * @note Size is an interesting case because it doesn't map cleanly to CSS.
- * Thanks to
- * http://style.cleverchimp.com/font_size_intervals/altintervals.html
- * for reasonable mappings.
- */
-class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
-{
-
- var $transform_to = 'span';
-
- var $_size_lookup = array(
- '1' => 'xx-small',
- '2' => 'small',
- '3' => 'medium',
- '4' => 'large',
- '5' => 'x-large',
- '6' => 'xx-large',
- '7' => '300%',
- '-1' => 'smaller',
- '+1' => 'larger',
- '-2' => '60%',
- '+2' => '150%',
- '+4' => '300%'
- );
-
- function transform($tag, $config, &$context) {
-
- if ($tag->type == 'end') {
- $new_tag = new HTMLPurifier_Token_End($this->transform_to);
- return $new_tag;
- }
-
- $attr = $tag->attr;
- $prepend_style = '';
-
- // handle color transform
- if (isset($attr['color'])) {
- $prepend_style .= 'color:' . $attr['color'] . ';';
- unset($attr['color']);
- }
-
- // handle face transform
- if (isset($attr['face'])) {
- $prepend_style .= 'font-family:' . $attr['face'] . ';';
- unset($attr['face']);
- }
-
- // handle size transform
- if (isset($attr['size'])) {
- if (isset($this->_size_lookup[$attr['size']])) {
- $prepend_style .= 'font-size:' .
- $this->_size_lookup[$attr['size']] . ';';
- }
- unset($attr['size']);
- }
-
- if ($prepend_style) {
- $attr['style'] = isset($attr['style']) ?
- $prepend_style . $attr['style'] :
- $prepend_style;
- }
-
- $new_tag = $tag->copy();
- $new_tag->name = $this->transform_to;
- $new_tag->attr = $attr;
-
- return $new_tag;
-
- }
-}
-
?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/TagTransform/Center.php b/library/HTMLPurifier/TagTransform/Center.php
new file mode 100644
index 00000000..571bb9df
--- /dev/null
+++ b/library/HTMLPurifier/TagTransform/Center.php
@@ -0,0 +1,34 @@
+type == 'end') {
+ $new_tag = new HTMLPurifier_Token_End($this->transform_to);
+ return $new_tag;
+ }
+ $attr = $tag->attr;
+ $prepend_css = 'text-align:center;';
+ if (isset($attr['style'])) {
+ $attr['style'] = $prepend_css . $attr['style'];
+ } else {
+ $attr['style'] = $prepend_css;
+ }
+ $new_tag = $tag->copy();
+ $new_tag->name = $this->transform_to;
+ $new_tag->attr = $attr;
+ return $new_tag;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/TagTransform/Font.php b/library/HTMLPurifier/TagTransform/Font.php
new file mode 100644
index 00000000..ae6d7838
--- /dev/null
+++ b/library/HTMLPurifier/TagTransform/Font.php
@@ -0,0 +1,83 @@
+ 'xx-small',
+ '2' => 'small',
+ '3' => 'medium',
+ '4' => 'large',
+ '5' => 'x-large',
+ '6' => 'xx-large',
+ '7' => '300%',
+ '-1' => 'smaller',
+ '+1' => 'larger',
+ '-2' => '60%',
+ '+2' => '150%',
+ '+4' => '300%'
+ );
+
+ function transform($tag, $config, &$context) {
+
+ if ($tag->type == 'end') {
+ $new_tag = new HTMLPurifier_Token_End($this->transform_to);
+ return $new_tag;
+ }
+
+ $attr = $tag->attr;
+ $prepend_style = '';
+
+ // handle color transform
+ if (isset($attr['color'])) {
+ $prepend_style .= 'color:' . $attr['color'] . ';';
+ unset($attr['color']);
+ }
+
+ // handle face transform
+ if (isset($attr['face'])) {
+ $prepend_style .= 'font-family:' . $attr['face'] . ';';
+ unset($attr['face']);
+ }
+
+ // handle size transform
+ if (isset($attr['size'])) {
+ if (isset($this->_size_lookup[$attr['size']])) {
+ $prepend_style .= 'font-size:' .
+ $this->_size_lookup[$attr['size']] . ';';
+ }
+ unset($attr['size']);
+ }
+
+ if ($prepend_style) {
+ $attr['style'] = isset($attr['style']) ?
+ $prepend_style . $attr['style'] :
+ $prepend_style;
+ }
+
+ $new_tag = $tag->copy();
+ $new_tag->name = $this->transform_to;
+ $new_tag->attr = $attr;
+
+ return $new_tag;
+
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/TagTransform/Simple.php b/library/HTMLPurifier/TagTransform/Simple.php
new file mode 100644
index 00000000..6ffd0eab
--- /dev/null
+++ b/library/HTMLPurifier/TagTransform/Simple.php
@@ -0,0 +1,26 @@
+transform_to = $transform_to;
+ }
+
+ function transform($tag, $config, &$context) {
+ $new_tag = $tag->copy();
+ $new_tag->name = $this->transform_to;
+ return $new_tag;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/tests/HTMLPurifier/TagTransformTest.php b/tests/HTMLPurifier/TagTransformTest.php
index f2cd18a3..760d85af 100644
--- a/tests/HTMLPurifier/TagTransformTest.php
+++ b/tests/HTMLPurifier/TagTransformTest.php
@@ -2,6 +2,11 @@
require_once 'HTMLPurifier/TagTransform.php';
+// needs to be seperated into files
+require_once 'HTMLPurifier/TagTransform/Center.php';
+require_once 'HTMLPurifier/TagTransform/Font.php';
+require_once 'HTMLPurifier/TagTransform/Simple.php';
+
class HTMLPurifier_TagTransformTest extends UnitTestCase
{