[Slashdotjp-dev 643] CVS update: slashjp/Slash/Display

Back to archive index

Tatsuki SUGIURA sugi****@users*****
2006年 11月 8日 (水) 12:05:41 JST


Index: slashjp/Slash/Display/Display.pm
diff -u slashjp/Slash/Display/Display.pm:1.8 slashjp/Slash/Display/Display.pm:1.9
--- slashjp/Slash/Display/Display.pm:1.8	Tue Oct 24 20:20:34 2006
+++ slashjp/Slash/Display/Display.pm	Wed Nov  8 12:05:41 2006
@@ -1,7 +1,7 @@
 # This code is a part of Slash, and is released under the GPL.
 # Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: Display.pm,v 1.8 2006/10/24 11:20:34 sugi Exp $
+# $Id: Display.pm,v 1.9 2006/11/08 03:05:41 sugi Exp $
 
 package Slash::Display;
 
@@ -50,7 +50,7 @@
 use base 'Exporter';
 use vars qw($VERSION @EXPORT @EXPORT_OK $CONTEXT %FILTERS $TEMPNAME);
 
-($VERSION) = ' $Revision: 1.8 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.9 $ ' =~ /\$Revision:\s+([^\s]+)/;
 @EXPORT	   = qw(slashDisplay slashDisplayName);
 @EXPORT_OK = qw(get_template);
 my(%objects);
@@ -358,6 +358,7 @@
 	strip_plaintext		=> \&strip_plaintext,
 	strip_mode		=> [ $strip_mode, 1 ],
 	chopEntity		=> [ \&chopEntityFactory, 1],
+	encode_uri_safe		=> \&encode_uri_safe,
 	%FILTERS
 );
 
@@ -587,6 +588,15 @@
 	};
 }
 
+sub encode_uri_safe {
+	# Do conservative escape.
+	# This will escape '?', '#', and many non-special chars,
+	# so mengle like query strings and fragments. Use carefully!
+	my $s = shift;
+	$s =~ s|([^0-9a-zA-Z/.,!=~_-]+)|join("%", '', (unpack("H*", $1) =~ m/../g))|eg;
+	$s;
+}
+
 1;
 
 __END__


Slashdotjp-dev メーリングリストの案内
Back to archive index