Changeset 83 for all-keywords/trunk/all-keywords.pl
- Timestamp:
- 06/14/05 16:02:21 (4 years ago)
- Files:
-
- 1 modified
-
all-keywords/trunk/all-keywords.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
all-keywords/trunk/all-keywords.pl
r47 r83 1 1 # A plugin for adding keywords-handling tags 2 2 # 3 # Release 0.1 2 (Mar 23, 2005)3 # Release 0.13 (Jun 11, 2005) 4 4 # 5 5 # This software is provided as-is. You may use it for commercial or … … 12 12 use MT::Template::Context; 13 13 14 eval("use Storable;");15 if (!$@ && MT->can('add_plugin')){14 my $plugin; 15 eval { 16 16 require MT::Plugin; 17 my$plugin = new MT::Plugin();18 $plugin->name("AllKeywords Plugin 0.12");19 $plugin->description(" Add MTAllKeywords tags for listing blog-wide keywords and entry keywords");17 $plugin = new MT::Plugin(); 18 $plugin->name("AllKeywords Plugin"); 19 $plugin->description("MTAllKeywords tags for listing and handling blog-wide tags and entry tags. Version 0.13"); 20 20 $plugin->doc_link("http://as-is.net/hacks/2005/03/allkeywords_plugin.html"); 21 21 MT->add_plugin($plugin); 22 } 22 }; 23 23 24 24 MT::Template::Context->add_container_tag('AllKeywords' => \&all_keywords); … … 46 46 my ($ctx, $args, $cond) = @_; 47 47 48 # sort_by option (keyword/ count, default = keyword)48 # sort_by option (keyword/keyword-case/count, default = keyword) 49 49 my $sort_by = $args->{sort_by} || 'keyword'; 50 50 # sort_order option (ascend/descend, default = ascend) … … 55 55 my $delimiter = $args->{delimiter} || ''; 56 56 # case_sensitive option (0/1, default = 1) 57 my $case_sensitive = $args->{case_sensitive} || 1; 57 my $case_sensitive = defined $args->{case_sensitive} ? 58 $args->{case_sensitive} : 1; 58 59 59 60 my $blog_id = $ctx->stash('blog_id'); … … 77 78 if ($sort_by eq 'keyword') { 78 79 @list = $sort_order eq 'ascend' ? 79 sort { $a cmp $b } keys %all_keywords : 80 sort { $b cmp $a } keys %all_keywords; 80 sort { lc $a cmp lc $b } keys %all_keywords : 81 sort { lc $b cmp lc $a } keys %all_keywords; 82 } elsif ($sort_by eq 'keyword-case') { 83 @list = $sort_order eq 'ascend' ? 84 sort keys %all_keywords : 85 sort reverse keys %all_keywords; 81 86 } else { 82 87 @list = $sort_order eq 'ascend' ? … … 119 124 my $delimiter = $args->{delimiter} || ''; 120 125 # case_sensitive option (0/1, default = 1) 121 my $case_sensitive = $args->{case_sensitive} || 1; 126 my $case_sensitive = defined $args->{case_sensitive} ? 127 $args->{case_sensitive} : 1; 122 128 123 129 my @keywords = split_keywords($e->keywords, $delimiter, $case_sensitive);
![(please configure the [header_logo] section in trac.ini)](/public/chrome/common/trac_banner.png)