-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathqa-open-widget.php
More file actions
81 lines (57 loc) · 2.05 KB
/
qa-open-widget.php
File metadata and controls
81 lines (57 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
Question2Answer (c) Gideon Greenspan
Open Login Plugin (c) Alex Lixandru
http://www.question2answer.org/
File: qa-plugin/open-login/qa-open-widget.php
Version: 3.0.0
Description: Widget module class open login plugin
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
class qa_open_logins_widget {
function allow_template($template) {
// not allowed when logged in
$userid = qa_get_logged_in_userid();
if (stristr(qa_request(), 'admin/layoutwidgets') === false && isset($userid)) {
return false;
}
if($template == 'login' || $template == 'register') {
return false;
}
return true;
}
function allow_region($region) {
return ($region == 'side');
}
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) {
$loginmodules=qa_load_modules_with('login', 'login_html');
if(empty($loginmodules)) {
return;
}
$themeobject->output(
'<div class="open-login-sidebar">',
qa_lang_html('plugin_open/login_title'),
'</div>',
'<p class="open-login-sidebar-buttons">'
);
foreach ($loginmodules as $tryname => $module) {
ob_start();
$module->login_html(isset($topath) ? (qa_opt('site_url').$topath) : qa_path($request, $_GET, qa_opt('site_url')), 'sidebar');
$label=ob_get_clean();
if (strlen($label))
$themeobject->output($label);
}
$themeobject->output('</p>');
}
}
/*
Omit PHP closing tag to help avoid accidental output
*/