- Timestamp:
- 04/24/05 19:16:22 (4 years ago)
- Files:
-
- 1 modified
-
mt-i18n/trunk/mt-i18n.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mt-i18n/trunk/mt-i18n.pl
r50 r54 1 # MT-I18N plugin by Hirotaka Ogawa (http://as-is.net/blog/)1 # MT-I18N plugin for MT::I18N container tags and global filters 2 2 # 3 # Release 0.0 1 (Aug 15, 2004)3 # Release 0.02 (Apr 24, 2005) 4 4 # 5 5 # This software is provided as-is. You may use it for commercial or … … 8 8 # Copyright (c) 2004 Hirotaka Ogawa 9 9 10 package MT::Plugin::I18N; 10 11 use strict; 11 12 use MT::Template::Context; 12 13 use MT::I18N; 13 14 14 if (MT->can('add_plugin')) { 15 eval("use Storable;"); 16 if (!$@ && MT->can('add_plugin')) { 15 17 require MT::Plugin; 16 18 my $plugin = new MT::Plugin(); 17 $plugin->name("MT-I18N Plugin , v.0.01");19 $plugin->name("MT-I18N Plugin 0.02"); 18 20 $plugin->description("Add MT::I18N container tags and global filters."); 19 21 $plugin->doc_link("http://as-is.net/blog/archives/000900.html"); … … 78 80 defined(my $text = $builder->build($ctx, $tokens)) 79 81 or return $ctx->error($builder->errstr); 80 my $length = $args->{'length'}; 81 return MT::I18N::first_n_text($text, $length || 20); 82 my $length = $args->{'length'} || 20; 83 return (MT::I18N::length_text($text) > $length) ? 84 MT::I18N::first_n_text($text, $length) . '...' : $text; 82 85 }); 83 86 … … 85 88 my ($text, $length, $ctx) = @_; 86 89 $length ||= 20; 87 if (MT::I18N::length_text($text) > $length) { 88 return MT::I18N::first_n_text($text, $length) . '...'; 89 } else { 90 return $text; 91 } 90 return (MT::I18N::length_text($text) > $length) ? 91 MT::I18N::first_n_text($text, $length) . '...' : $text; 92 92 });
![(please configure the [header_logo] section in trac.ini)](/public/chrome/common/trac_banner.png)