-
Notifications
You must be signed in to change notification settings - Fork 1
/
theme_shortcodes.php
132 lines (106 loc) · 4.11 KB
/
theme_shortcodes.php
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* e107 Bootstrap Theme Shortcodes.
*
*/
class theme_shortcodes extends e_shortcode {
function __construct(){
}
/*-----------------------------
LOGIN SHORTCODE
-----------------------------*/
function sc_bootstrap_usernav($parm='')
{
$placement = e107::pref('theme', 'usernav_placement', 'top');
if($parm['placement'] != $placement){
return '';
}
include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
$tp = e107::getParser();
require(e_PLUGIN."login_menu/login_menu_shortcodes.php"); // don't use 'require_once'.
$direction = vartrue($parm['dir']) == 'up' ? ' dropup' : '';
$userReg = defset('USER_REGISTRATION');
if(!USERID){ // Logged Out.
if($userReg==1){
$text .= '
<li class="navbar-registration"><a href="'.e_SIGNUP.'"><i class="fa fa-user-plus"></i></a></li>
'; // Signup
}
$socialActive = e107::pref('core', 'social_login_active');
if(!empty($userReg) || !empty($socialActive)){ // e107 or social login is active.
$text .= '
<li class="divider-vertical"></li>
<li class="navbar-login dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-sign-in"></i> <b class="caret"></b></a>
<div class="dropdown-menu col-sm-12" style="min-width:250px;">
{SOCIAL_LOGIN: size=2x&label=1}
'; // Sign In
}else{
return '';
}
if(!empty($userReg)){ // value of 1 or 2 = login okay.
// global $sc_style; // never use global - will impact signup/usersettings pages.
// $sc_style = array(); // remove any wrappers.
$text .='
<form method="post" onsubmit="hashLoginPassword(this);return true" action="'.e_REQUEST_HTTP.'" accept-charset="UTF-8">
<p>{LM_USERNAME_INPUT}</p>
<p>{LM_PASSWORD_INPUT}</p>
<div class="form-group"></div>
{LM_IMAGECODE_NUMBER}
{LM_IMAGECODE_BOX}
<div class="checkbox">
<label class="string optional" for="autologin"><input style="margin-right: 10px;" type="checkbox" name="autologin" id="autologin" value="1">'.LAN_LOGINMENU_6.'</label>
</div>
<input class="btn btn-primary btn-block" type="submit" name="userlogin" id="userlogin" value="'.LAN_LOGINMENU_51.'">
';
$text .= '
<a href="{LM_FPW_LINK=href}" class="btn btn-default btn-sm btn-block">'.LAN_LOGINMENU_4.'</a>
<a href="{LM_RESEND_LINK=href}" class="btn btn-default btn-sm btn-block">'.LAN_LOGINMENU_40.'</a>
';
/*
$text .= '
<label style="text-align:center;margin-top:5px">or</label>
<input class="btn btn-primary btn-block" type="button" id="sign-in-google" value="Sign In with Google">
<input class="btn btn-primary btn-block" type="button" id="sign-in-twitter" value="Sign In with Twitter">
';
*/
$text .= "<p></p>
</form>
</div>
</li>
";
}
return $tp->parseTemplate($text, true, $login_menu_shortcodes);
}
// Logged in.
//TODO Generic LANS. (not theme LANs)
$text = '
<li class="dropdown">{PM_NAV}</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{SETIMAGE: w=20} {USER_AVATAR: shape=circle} '. USERNAME.' <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="{LM_USERSETTINGS_HREF}"><span class="glyphicon glyphicon-cog"></span> '.LAN_SETTINGS.'</a>
</li>
<li>
<a class="dropdown-toggle no-block" role="button" href="{LM_PROFILE_HREF}"><span class="glyphicon glyphicon-user"></span> '.LAN_LOGINMENU_13.'</a>
</li>
';
if(ADMIN) {
$text .= '
<li><a href="'.e_ADMIN_ABS.'"><span class="fa fa-cogs"></span> '.LAN_LOGINMENU_11.'</a></li>';
}
$text .= '
<li><a href="'.e_HTTP.'index.php?logout"><span class="glyphicon glyphicon-off"></span> '.LAN_LOGOUT.'</a></li>
</ul>
</li>
';
return $tp->parseTemplate($text,true,$login_menu_shortcodes);
}
}
?>