プラグインのセット

概要

1つのプラグインディレクトリにプラグインファイルを複数配置して、1つのセットとして扱うことが可能

※2つ以上のプラグインを配置することで設定可能


セットプラグインイメージ


ディレクトリ構成

$MT_DIR/
|__ plugins/
|  |__ TestPlugin/
|     |__ functiontest01.pl
|     |__ functiontest02.pl
|     |__ lib/                    
|     |  |__ Common
|     |      |__ L10N
|     |      |   |__ ja.pm
|     |      |   |__ en_us.pm
 

ソース

functiontest01.pl

# モジュール名定義
package MT::Plugin::FunctionTest01;
 
# 制御プラグマ
use strict;
use warnings;
use bytes;
 
# プラグイン情報
require MT;
require MT::Plugin;
 
# 共通定数
use vars qw($VERSION $AUTHOR);
$VERSION = '1.00';
 
# 環境設定
my $plugin = new MT::Plugin({
    # 詳細情報
    name =>  'FunctionTest01',
    version => $VERSION,
    description => '<__trans phrase="_PLUGIN_FUNCTION01_DESCRIPTION_">',
    author_name => '<__trans phrase="_COM_PLUGIN_AUTHOR_NAME_">',
    author_link => 'http://localhost.example.com/',
    plugin_link => 'http://localhost.example.com/',
    doc_link => 'http://localhost.example.com/',
 
    # ローカライズ
    l10n_class => 'Common::L10N',
 
    # 登録情報
    registry => {
        tags => {
            function => {
                'FunctionTest01' => \&hdlr_functiontest01,
            },
        },
    }
});
 
# プラグイン追加
MT->add_plugin($plugin);
 
# サブルーチン
sub hdlr_functiontest01{
    return 'FunctionTest01';
}
 
1;
 
 

functiontest02.pl

# モジュール名定義
package MT::Plugin::FunctionTest02;
 
# 制御プラグマ
use strict;
use warnings;
use bytes;
 
# プラグイン情報
require MT;
require MT::Plugin;
 
# 共通定数
use vars qw($VERSION $AUTHOR);
$VERSION = '1.00';
 
# 環境設定
my $plugin = new MT::Plugin({
    # 詳細情報
    name =>  'FunctionTest02',
    version => $VERSION,
    description => '<__trans phrase="_PLUGIN_FUNCTION02_DESCRIPTION_">',
    author_name => '<__trans phrase="_COM_PLUGIN_AUTHOR_NAME_">',
    author_link => 'http://localhost.example.com/',
    plugin_link => 'http://localhost.example.com/',
    doc_link => 'http://localhost.example.com/',
 
    # ローカライズ
    l10n_class => 'Common::L10N',
 
    # 登録情報
    registry => {
        tags => {
            function => {
                'FunctionTest02' => \&hdlr_functiontest02,
            },
        },
    }
});
 
# プラグイン追加
MT->add_plugin($plugin);
 
# サブルーチン
sub hdlr_functiontest02{
    return 'FunctionTest02';
}
 
1;
 
 



最終更新:2012年03月11日 10:28