Changeset 1165 for trunk/examples

Show
Ignore:
Timestamp:
10/02/08 22:14:39 (14 months ago)
Author:
breese
Message:

adding mark to distro list for commit emails

Location:
trunk
Files:
5 modified
8 copied

Legend:

Unmodified
Added
Removed
  • trunk

    • Property post-commit-email
      •  

        old new  
        1 brad@sixapart.com,byrne@sixapart.com 
         1brad@sixapart.com,byrne@sixapart.com,mark@sixapart.com 
  • trunk/examples/Example3/plugins/Example/config.yaml

    r969 r1165  
    55description: This plugin is an example plugin for Movable Type. 
    66version: 1.0 
    7 tags: 
    8     tags: 
    9         modifier: 
    10             'lolcats': $Example::Example::Plugin::lolcats 
     7config_settings: 
     8        MyLogPath: 
     9                handler: $Example::Example::Plugin::MyLogPath 
     10                path: 1 
    1111 
  • trunk/examples/Example3/plugins/Example/lib/Example/Plugin.pm

    r969 r1165  
    88use strict; 
    99 
    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"; 
     10sub 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    } 
    2025} 
    2126 
  • trunk/examples/Example4/plugins/Example/config.yaml

    r969 r1165  
    55description: This plugin is an example plugin for Movable Type. 
    66version: 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 
    1112 
  • trunk/examples/Example4/plugins/Example/lib/Example/Plugin.pm

    r969 r1165  
    88use strict; 
    99 
    10 ############################################################# 
    11 =head2 lolcats 
     10sub mytransform { 
     11    my ($str) = @_; 
     12    $str =~ s/\bcat\b/dog/mg; 
     13    return $str; 
     14} 
    1215 
    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 
     17sub transform_when { 
     18    my ($obj_type) = @_; 
     19    return 1 if $obj_type && ($obj_type eq 'comment'); 
    2020} 
    2121