Changeset 1165 for trunk/examples
- Timestamp:
- 10/02/08 22:14:39 (14 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
- 8 copied
-
. (modified) (1 prop)
-
examples/Example3 (copied) (copied from trunk/examples/Example2)
-
examples/Example3/MANIFEST.SKIP (copied) (copied from trunk/examples/Example2/MANIFEST.SKIP)
-
examples/Example3/Makefile.PL (copied) (copied from trunk/examples/Example2/Makefile.PL)
-
examples/Example3/plugins (copied) (copied from trunk/examples/Example2/plugins)
-
examples/Example3/plugins/Example/config.yaml (modified) (1 diff)
-
examples/Example3/plugins/Example/lib/Example/Plugin.pm (modified) (1 diff)
-
examples/Example4 (copied) (copied from trunk/examples/Example2)
-
examples/Example4/MANIFEST.SKIP (copied) (copied from trunk/examples/Example2/MANIFEST.SKIP)
-
examples/Example4/Makefile.PL (copied) (copied from trunk/examples/Example2/Makefile.PL)
-
examples/Example4/plugins (copied) (copied from trunk/examples/Example2/plugins)
-
examples/Example4/plugins/Example/config.yaml (modified) (1 diff)
-
examples/Example4/plugins/Example/lib/Example/Plugin.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property post-commit-email
-
old new 1 brad@sixapart.com,byrne@sixapart.com 1 brad@sixapart.com,byrne@sixapart.com,mark@sixapart.com
-
- Property post-commit-email
-
trunk/examples/Example3/plugins/Example/config.yaml
r969 r1165 5 5 description: This plugin is an example plugin for Movable Type. 6 6 version: 1.0 7 tags:8 tags:9 modifier: 10 'lolcats': $Example::Example::Plugin::lolcats7 config_settings: 8 MyLogPath: 9 handler: $Example::Example::Plugin::MyLogPath 10 path: 1 11 11 -
trunk/examples/Example3/plugins/Example/lib/Example/Plugin.pm
r969 r1165 8 8 use strict; 9 9 10 ############################################################# 11 =head2 lolcats 12 13 A template tag modifer that appends "LOL - CAN I HAZ" to the 14 contents of the associated tag. 15 16 =cut 17 sub lolcats { 18 my ($str, $val, $ctx) = @_; 19 return "LOL - CAN I HAZ $str"; 10 sub MyLogPath { 11 my $mgr = shift; # A reference to MT::ConfigMgr 12 # if this method is invoked with the intent to set the value, 13 # go ahead and set the value, then return. 14 return $mgr->set_internal( 'MyLogPath', @_ ) if @_; 15 # user is attempting to retrieve the value 16 my $name = $mgr->get_internal('MyLogPath'); 17 # if a value has been explicitly set, return it 18 return $name if defined $name; 19 # Ok, guess what the value should be: 20 if ($ENV{HTTPD_HOME}) { 21 return $ENV{HTTPD_HOME} . '/logs'; 22 } else { 23 return 'logs/'; 24 } 20 25 } 21 26 -
trunk/examples/Example4/plugins/Example/config.yaml
r969 r1165 5 5 description: This plugin is an example plugin for Movable Type. 6 6 version: 1.0 7 tags: 8 tags: 9 modifier: 10 'lolcats': $Example::Example::Plugin::lolcats 7 text_filters: 8 mytransform: 9 label: My Text Transform 10 handler: $Example::Example::Plugin::mytransform 11 condition: $Example::Example::Plugin::mytransform_when 11 12 -
trunk/examples/Example4/plugins/Example/lib/Example/Plugin.pm
r969 r1165 8 8 use strict; 9 9 10 ############################################################# 11 =head2 lolcats 10 sub mytransform { 11 my ($str) = @_; 12 $str =~ s/\bcat\b/dog/mg; 13 return $str; 14 } 12 15 13 A template tag modifer that appends "LOL - CAN I HAZ" to the 14 contents of the associated tag. 15 16 =cut 17 sub lolcats { 18 my ($str, $val, $ctx) = @_; 19 return "LOL - CAN I HAZ $str"; 16 # Will only allow the text filter to be applied to comments 17 sub transform_when { 18 my ($obj_type) = @_; 19 return 1 if $obj_type && ($obj_type eq 'comment'); 20 20 } 21 21
