*** QRcode.pl 2004-08-16 03:15:15.000000000 +0900 --- QRcodeContainer.pl 2006-06-17 00:07:59.000000000 +0900 *************** *** 7,14 **** # QRcode is trademark of Denso-Wave, see http://www.denso-wave.com/qrcode/ . use strict; ! my $PLUGIN_NAME = 'QRcode'; my $VERSION = 'v0.05'; my $cfg = { --- 7,15 ---- # QRcode is trademark of Denso-Wave, see http://www.denso-wave.com/qrcode/ . use strict; + use Jcode; ! my $PLUGIN_NAME = 'QRcode(with container patch)'; my $VERSION = 'v0.05'; my $cfg = { *************** *** 22,28 **** use MT::Template::Context; ! MT::Template::Context->add_tag(QRcode => \&generate_qrcode); sub generate_qrcode { my $ctx = shift; --- 23,29 ---- use MT::Template::Context; ! MT::Template::Context->add_container_tag(QRcode => \&generate_qrcode); sub generate_qrcode { my $ctx = shift; *************** *** 30,35 **** --- 31,38 ---- my $blog = $ctx->stash('blog'); my $entry = $ctx->stash('entry'); + my $builder = $ctx->stash('builder'); + my $tokens = $ctx->stash('tokens'); require File::Spec; my ($url, $site_path, $title, $imagedir, $filename, $format, $size); *************** *** 37,42 **** --- 40,46 ---- $url = $blog->site_url; $site_path = $blog->site_path; $title = $blog->name; + $filename = $cfg->{QRcode_filename_base}; } else { return $ctx->error(MT->translate('Cannot access stash of blog')); } *************** *** 44,56 **** if ($entry) { $url = $entry->permalink; $title = $entry->title || ''; } ! $url = $arg->{url} || $url; $title = $arg->{title} || $title; $imagedir = $arg->{dir} || $cfg->{QRcode_path}; $format = $arg->{format} || $cfg->{QRcode_format}; ! $filename = $arg->{filename} . $entry ? '-' . $entry->id : '' || $cfg->{QRcode_filename_base}; $filename .= '.' . lc $format; $size = $arg->{size} || $cfg->{QRcode_size}; my $imagefile = File::Spec->catfile($site_path, $imagedir, $filename); --- 48,62 ---- if ($entry) { $url = $entry->permalink; $title = $entry->title || ''; + $filename = '-' . $entry->id; } ! $url = $builder->build($ctx,$tokens,$cond) || $url; ! $url = jcode($url)->sjis; $title = $arg->{title} || $title; $imagedir = $arg->{dir} || $cfg->{QRcode_path}; $format = $arg->{format} || $cfg->{QRcode_format}; ! $filename = $arg->{filename} || $filename; $filename .= '.' . lc $format; $size = $arg->{size} || $cfg->{QRcode_size}; my $imagefile = File::Spec->catfile($site_path, $imagedir, $filename); *************** *** 90,96 **** require MT::Plugin; my $plugin = new MT::Plugin( { name => $PLUGIN_NAME . ' ' . $VERSION, ! description => 'QRcode generator <$MTQRcode$>.', dir_name => 'QRcode', doc_link => 'http://uva.jp/dh/mt/qrcode.html', } ); --- 96,102 ---- require MT::Plugin; my $plugin = new MT::Plugin( { name => $PLUGIN_NAME . ' ' . $VERSION, ! description => 'QRcode generator <MTQRcode>url</MTQRcode>.', dir_name => 'QRcode', doc_link => 'http://uva.jp/dh/mt/qrcode.html', } );