add twitter login macro
This commit is contained in:
parent
54eafd2cd6
commit
a50de4281c
2 changed files with 53 additions and 0 deletions
53
lib/WebGUI/Macro/TwitterLogin.pm
Normal file
53
lib/WebGUI/Macro/TwitterLogin.pm
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
package WebGUI::Macro::TwitterLogin;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use List::MoreUtils qw( any );
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::TwitterLogin
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Display a twitter login button
|
||||
|
||||
=head2 process( $session )
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
A session variable
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
|
||||
return "" unless any { $_ eq 'Twitter' } @{ $session->config->get( 'authMethods' ) };
|
||||
return "" unless $session->user->isVisitor;
|
||||
|
||||
my $loginUrl = $session->url->page('op=auth;authType=Twitter;method=login');
|
||||
my $imgUrl = shift || $session->url->extras( 'twitter_login.png' );
|
||||
|
||||
my $output = sprintf '<a href="%s"><img src="%s" border="0" /></a>', $loginUrl, $imgUrl;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
BIN
www/extras/twitter_login.png
Normal file
BIN
www/extras/twitter_login.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue