-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme_shortcodes.php
191 lines (131 loc) · 5.09 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?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 '';
}
e107::includeLan(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.
{
$text = '
<ul class="usernav nav navbar-nav navbar-right'.$direction.'">';
$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="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-user-plus"></i></a>
<div class="usernav-menu dropdown-menu col-sm-12">
{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="login-button" type="submit" name="userlogin" id="userlogin" value="'.LAN_LOGINMENU_51.'">
';
$text .= '
<a href="{LM_FPW_LINK=href}" class="forget-login">'.LAN_LOGINMENU_4.'</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 class='dividing-line'>
<span><i class='material-icons'>import_export</i></span>
</div>
<a class='signin-button' href='".e_SIGNUP."'>".LAN_LOGINMENU_3."</a>
</div>
</li>
";
}
$text .= "
</ul>";
return $tp->parseTemplate($text, true, $login_menu_shortcodes);
}
// Logged in.
//TODO Generic LANS. (not theme LANs)
$userNameLabel = !empty($parm['username']) ? USERNAME : '';
if( e107::isInstalled('pm') )
{
$text .= '<li class="pm dropdown">{PM_NAV}</li>';
}
$text = '
<li class="dropdown dropdown-avatar"><a href="#" class="dropdown-toggle" data-toggle="dropdown">'.USERNAME.' <b class="caret"></b></a>
<ul class="usernav-box 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>
<li class="divider"></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);
}
/*-----------------------------
NEWS CATEGORIES ON TOP
-----------------------------*/
function sc_bootstrap_news_categories(){
$news = e107::getObject('e_news_category_tree'); // get news class.
$sc = e107::getScBatch('news'); // get news shortcodes.
$tp = e107::getParser(); // get parser.
// load active news categories. ie. the correct userclass etc.
$data = $news->loadActive(false)->toArray(); // false to utilize the built-in cache.
$TEMPLATE = "<button class='button' data-filter='.news-category-{NEWS_CATEGORY_ID}'>{NEWS_CATEGORY_NAME}</button>";
$text = '';
foreach($data as $row){
$sc->setScVar('news_item', $row); // send $row values to shortcodes.
$text .= $tp->parseTemplate($TEMPLATE, true, $sc); // parse news shortcodes.
}
return $text;
}
}
?>