root/trunk/mixiComment/plugins/mixiComment/mixiComment.pl @ 1480

Revision 1480, 2.7 kB (checked in by auno, 9 months ago)

Merged changes from internal. #99460

Line 
1package MT::Plugin::mixiComment;
2
3use strict;
4use warnings;
5
6use MT;
7use base qw(MT::Plugin);
8
9my $plugin = MT::Plugin::mixiComment->new({
10    id => 'mixicomment',
11    name => 'mixiComment',
12    author_name => 'Six Apart K.K.',
13    author_url => 'http://www.movabletype.jp/',
14    description => '<MT_TRANS phrase="Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.">',
15    version => '1.1',
16    settings => new MT::PluginSettings([
17        ['mixi_id', { Scope => 'blog' }],
18    ]),
19    l10n_class => 'mixiComment::L10N',
20        blog_config_template => 'config.tmpl',
21});
22MT->add_plugin($plugin);
23
24sub load_config {
25    my $plugin = shift;
26    my ($args, $scope) = @_;
27
28    $plugin->SUPER::load_config(@_);
29
30    if ( $scope =~ /blog:(\d+)/ ) {
31        my $blog_id = $1;
32        $args->{blog_id} = $blog_id;
33    }
34}
35
36sub init_registry {
37    my $plugin = shift;
38    $plugin->registry({
39        applications => {
40            cms => {
41                methods => {
42                    mixicomment_login_blog_owner => '$mixicomment::mixiComment::App::login_blog_owner',
43                    mixicomment_verify_blog_owner => '$mixicomment::mixiComment::App::verify_blog_owner',
44                }
45            }
46        },
47        commenter_authenticators => {
48            'mixicomment' => {
49                label => 'mixi',
50                class => 'mixiComment::Auth::mixi',
51                login_form => <<EOT,
52<__trans_section component="mixicomment">
53<form method="post" action="<mt:var name="script_url">">
54<input type="hidden" name="__mode" value="login_external" />
55<input type="hidden" name="openid_url" value="<mt:var name="url">" />
56<input type="hidden" name="blog_id" value="<mt:var name="blog_id">" />
57<input type="hidden" name="entry_id" value="<mt:var name="entry_id">" />
58<input type="hidden" name="static" value="<mt:var name="static" escape="html">" />
59<input type="hidden" name="key" value="mixicomment" />
60<fieldset>
61<mtapp:setting
62    id="mixiComment_display"
63    hint="<__trans phrase="Sign in using your mixi ID">">
64    <input type="image" src="<mt:var name="static_uri">plugins/mixiComment/images/mixi_button.gif" width="150" height="30" />
65    <p><__trans phrase="Click the button to sign in using your mixi ID"></p>
66</mtapp:setting>
67</fieldset>
68</form>
69</__trans_section>
70EOT
71                condition => '$mixicomment::mixiComment::App::openid_commenter_condition',
72                login_form_params => '$mixicomment::mixiComment::App::commenter_auth_params',
73                logo => 'plugins/mixiComment/images/signin_mixi.png',
74                logo_small => 'plugins/mixiComment/images/signin_mixi_small.gif'
75            },
76        },
77    });
78}
79
80sub instance { $plugin }
81
821;
83__END__
Note: See TracBrowser for help on using the browser.