[Bps-public-commit] r17509 - in Prophet/trunk/lib/Prophet: Web

jesse at bestpractical.com jesse at bestpractical.com
Thu Jan 1 21:13:27 EST 2009


Author: jesse
Date: Thu Jan  1 21:13:26 2009
New Revision: 17509

Modified:
   Prophet/trunk/lib/Prophet/Util.pm
   Prophet/trunk/lib/Prophet/Web/Menu.pm

Log:
* move utf8 escaper to lib/Prophet/Util

Modified: Prophet/trunk/lib/Prophet/Util.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Util.pm	(original)
+++ Prophet/trunk/lib/Prophet/Util.pm	Thu Jan  1 21:13:26 2009
@@ -34,4 +34,16 @@
     return $object;
 }
 
+sub escape_utf8 {
+    my $ref = shift;
+    no warnings 'uninitialized';
+    $$ref =~ s/&/&/g;
+    $$ref =~ s/</</g;
+    $$ref =~ s/>/>/g;
+    $$ref =~ s/\(/(/g;
+    $$ref =~ s/\)/)/g;
+    $$ref =~ s/"/"/g;
+    $$ref =~ s/'/'/g;
+}
+
 1;

Modified: Prophet/trunk/lib/Prophet/Web/Menu.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Web/Menu.pm	(original)
+++ Prophet/trunk/lib/Prophet/Web/Menu.pm	Thu Jan  1 21:13:26 2009
@@ -277,7 +277,7 @@
 
     if ( $self->url ) {
         my $label = $self->label;
-         _escape_utf8(\$label) if ($self->escape_label);
+        Prophet::Util::escape_utf8(\$label) if ($self->escape_label);
         return
               qq{<a href="@{[$self->url]}"}
             . ( $self->target ? qq{ target="@{[$self->target]}" } : '' )
@@ -291,16 +291,4 @@
         return $self->label;
     }
 }
-sub _escape_utf8 {
-    my $ref = shift;
-    no warnings 'uninitialized';
-    $$ref =~ s/&/&/g;
-    $$ref =~ s/</</g;
-    $$ref =~ s/>/>/g;
-    $$ref =~ s/\(/(/g;
-    $$ref =~ s/\)/)/g;
-    $$ref =~ s/"/"/g;
-    $$ref =~ s/'/'/g;
-}
-
 1;



More information about the Bps-public-commit mailing list