Tatsuki SUGIURA
sugi****@users*****
2006年 7月 12日 (水) 20:41:54 JST
Index: slashjp/plugins/Relocate/PLUGIN diff -u slashjp/plugins/Relocate/PLUGIN:1.2 slashjp/plugins/Relocate/PLUGIN:1.3 --- slashjp/plugins/Relocate/PLUGIN:1.2 Fri Dec 24 05:13:43 2004 +++ slashjp/plugins/Relocate/PLUGIN Wed Jul 12 20:41:54 2006 @@ -1,4 +1,4 @@ -# $Id: PLUGIN,v 1.2 2004/12/23 20:13:43 oliver Exp $ +# $Id: PLUGIN,v 1.3 2006/07/12 11:41:54 sugi Exp $ name=Relocate description="redirect your href links" mysql_schema=mysql_schema Index: slashjp/plugins/Relocate/Relocate.pm diff -u slashjp/plugins/Relocate/Relocate.pm:1.3 slashjp/plugins/Relocate/Relocate.pm:1.4 --- slashjp/plugins/Relocate/Relocate.pm:1.3 Fri Dec 31 21:37:13 2004 +++ slashjp/plugins/Relocate/Relocate.pm Wed Jul 12 20:41:54 2006 @@ -1,7 +1,7 @@ # This code is a part of Slash, and is released under the GPL. -# Copyright 1997-2004 by Open Source Development Network. See README +# Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: Relocate.pm,v 1.3 2004/12/31 12:37:13 oliver Exp $ +# $Id: Relocate.pm,v 1.4 2006/07/12 11:41:54 sugi Exp $ package Slash::Relocate; @@ -15,7 +15,7 @@ use vars qw($VERSION); use base 'Slash::DB::Utility'; -($VERSION) = ' $Revision: 1.3 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.4 $ ' =~ /\$Revision:\s+([^\s]+)/; sub new { my($class, $user) = @_; @@ -89,19 +89,14 @@ if ($token->[0] eq 'slash') { #Skip non HREF links next unless $token->[1]{href} && $token->[1]{type} eq 'link'; - if (!$token->[1]{id}) { - my $link = $self->create({ stoid => $stoid, url => $token->[1]{href}}); - my $href = strip_attribute($token->[1]{href}); - my $title = strip_attribute($token->[1]{title}); - $text =~ s#\Q$token->[3]\E#<SLASH HREF="$href" ID="$link" TITLE="$title" TYPE="LINK">#is; - } else { + if ($token->[1]{id}) { my $url = $self->get($token->[1]{id}, 'url'); next if $url eq $token->[1]{href}; - my $link = $self->create({ stoid => $stoid, url => $token->[1]{href}}); - my $href = strip_attribute($token->[1]{href}); - my $title = strip_attribute($token->[1]{title}); - $text =~ s#\Q$token->[3]\E#<SLASH HREF="$href" ID="$link" TITLE="$title" TYPE="LINK">#is; } + my $link = $self->create({ stoid => $stoid, url => $token->[1]{href}}); + my $href = strip_attribute($token->[1]{href}); + my $title = strip_attribute($token->[1]{title}); + $text =~ s#\Q$token->[3]\E#<slash href="$href" id="$link" title="$title" type="link">#is; # New links to convert!!!! } else { # We ignore some types of href @@ -110,11 +105,12 @@ next if ($token->[1]{href} =~ /^mailto/i); #This allows you to have a link bypass this system next if ($token->[1]{FORCE} && $user->{is_admin}); + my $link = $self->create({ stoid => $stoid, url => $token->[1]{href}}); - my $data = $tokens->get_text("/a"); + my $data = $tokens->get_text('/a'); my $href = strip_attribute($token->[1]{href}); my $title = strip_attribute($token->[1]{title}); - $text =~ s#\Q$token->[3]$data</a>\E#<SLASH HREF="$href" ID="$link" TITLE="$title" TYPE="LINK">$data</SLASH>#is; + $text =~ s#\Q$token->[3]$data</a>\E#<slash href="$href" id="$link" title="$title" type="link">$data</slash>#is; } } } Index: slashjp/plugins/Relocate/mysql_dump diff -u slashjp/plugins/Relocate/mysql_dump:1.1 slashjp/plugins/Relocate/mysql_dump:1.2 --- slashjp/plugins/Relocate/mysql_dump:1.1 Fri Dec 24 05:13:43 2004 +++ slashjp/plugins/Relocate/mysql_dump Wed Jul 12 20:41:54 2006 @@ -1,5 +1,5 @@ # -# $Id: mysql_dump,v 1.1 2004/12/23 20:13:43 oliver Exp $ +# $Id: mysql_dump,v 1.2 2006/07/12 11:41:54 sugi Exp $ # INSERT INTO vars (name, value, description) VALUES ('relocate_href2slash', 0, 'Automatically convert all A HREF tags to SLASH HREF tags, using relocate.pl.'); Index: slashjp/plugins/Relocate/mysql_schema diff -u slashjp/plugins/Relocate/mysql_schema:1.3 slashjp/plugins/Relocate/mysql_schema:1.4 --- slashjp/plugins/Relocate/mysql_schema:1.3 Fri Dec 31 21:37:13 2004 +++ slashjp/plugins/Relocate/mysql_schema Wed Jul 12 20:41:54 2006 @@ -1,5 +1,5 @@ # -# $Id: mysql_schema,v 1.3 2004/12/31 12:37:13 oliver Exp $ +# $Id: mysql_schema,v 1.4 2006/07/12 11:41:54 sugi Exp $ # # Index: slashjp/plugins/Relocate/relocate.pl diff -u slashjp/plugins/Relocate/relocate.pl:1.3 slashjp/plugins/Relocate/relocate.pl:1.4 --- slashjp/plugins/Relocate/relocate.pl:1.3 Fri Dec 31 21:37:13 2004 +++ slashjp/plugins/Relocate/relocate.pl Wed Jul 12 20:41:54 2006 @@ -1,8 +1,8 @@ #!/usr/bin/perl -w # This code is a part of Slash, and is released under the GPL. -# Copyright 1997-2004 by Open Source Development Network. See README +# Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: relocate.pl,v 1.3 2004/12/31 12:37:13 oliver Exp $ +# $Id: relocate.pl,v 1.4 2006/07/12 11:41:54 sugi Exp $ use strict; use Slash;