fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-15 04:06 am

[dw-free] http://bugs.dwscoalition.org/show_bug.cgi?id=3438

[commit: http://hg.dwscoalition.org/dw-free/rev/9135a526692e]

http://bugs.dwscoalition.org/show_bug.cgi?id=3438

Refactor to be more readable.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/CleanHTML.pm
--------------------------------------------------------------------------------
diff -r d37e371fa48c -r 9135a526692e cgi-bin/LJ/CleanHTML.pm
--- a/cgi-bin/LJ/CleanHTML.pm	Fri Feb 11 22:14:43 2011 +0000
+++ b/cgi-bin/LJ/CleanHTML.pm	Mon Feb 07 16:47:39 2011 +0800
@@ -764,9 +764,16 @@ sub clean
                     }
 
                     # remove specific attributes
-                    if (($remove_colors && ($attr eq "color" || $attr eq "bgcolor" || $attr eq "fgcolor" || $attr eq "text")) ||
-                        ($remove_sizes && $attr eq "size") ||
-                        ($remove_fonts && $attr eq "face")) {
+                    my %remove_attrs =
+                        ( color   => $remove_colors,
+                          bgcolor => $remove_colors,
+                          fgcolor => $remove_colors,
+                          text    => $remove_colors,
+                          size    => $remove_sizes,
+                          face    => $remove_fonts,
+                        );
+
+                    if ( $remove_attrs{$attr} ) {
                         delete $hash->{$attr};
                         next ATTR;
                     }
--------------------------------------------------------------------------------