2013-12-21 01:32:39 -08:00
|
|
|
<?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
|
|
|
|
{
|
2016-05-01 09:30:33 -07:00
|
|
|
// public $override = true;
|
2016-04-30 12:02:02 -07:00
|
|
|
|
2019-08-30 15:19:53 -07:00
|
|
|
|
2015-03-29 20:25:33 -07:00
|
|
|
|
2019-08-25 22:15:51 +02:00
|
|
|
/**
|
|
|
|
* Special Header Shortcode for dynamic menuarea templates.
|
|
|
|
* @shortcode {---HEADER---}
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function sc_header()
|
|
|
|
{
|
|
|
|
return "<!-- Dynamic Header template -->\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Special Footer Shortcode for dynamic menuarea templates.
|
|
|
|
* @shortcode {---FOOTER---}
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function sc_footer()
|
|
|
|
{
|
|
|
|
return "<!-- Dynamic Footer template -->\n";
|
|
|
|
/*
|
|
|
|
return '
|
|
|
|
<footer class="footer py-4 bg-dark text-white">
|
|
|
|
<div class="container">
|
|
|
|
<div class="content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-3"> <h4>Navigation</h4>{NAVIGATION: type=main&layout=alt}
|
|
|
|
{MENUAREA=14}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3"> <h4>Follow Us</h4>{XURL_ICONS: template=footer}
|
|
|
|
{MENUAREA=15}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
|
|
{MENUAREA=16}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
|
|
{MENUAREA=17}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<div class="container"> {NAVIGATION: type=main&layout=footer} </div>
|
|
|
|
<div class="container">
|
|
|
|
<p class="m-0 text-center text-white">{SITEDISCLAIMER}</p>
|
|
|
|
</div>
|
|
|
|
<!-- /.container -->
|
|
|
|
</div>
|
|
|
|
</footer>';*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-01 09:30:33 -07:00
|
|
|
/*
|
2016-04-30 12:02:02 -07:00
|
|
|
function sc_news_summary()
|
|
|
|
{
|
|
|
|
$sc = e107::getScBatch('news');
|
|
|
|
$data = $sc->getScVar('news_item');
|
|
|
|
|
|
|
|
return "<span class='label label-danger'>".e107::getParser()->toHTML($data['news_summary'],'BODY')."</span>";
|
2016-05-01 09:30:33 -07:00
|
|
|
}*/
|
2016-04-30 12:02:02 -07:00
|
|
|
|
|
|
|
|
2015-03-29 20:25:33 -07:00
|
|
|
function sc_bootstrap_branding()
|
2013-12-21 01:32:39 -08:00
|
|
|
{
|
2015-11-05 12:25:16 -08:00
|
|
|
$pref = e107::pref('theme', 'branding');
|
2015-03-29 20:25:33 -07:00
|
|
|
|
|
|
|
switch($pref)
|
|
|
|
{
|
|
|
|
case 'logo':
|
|
|
|
|
|
|
|
return e107::getParser()->parseTemplate('{SITELOGO: h=30}',true);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'sitenamelogo':
|
|
|
|
|
|
|
|
return "<span class='pull-left'>".e107::getParser()->parseTemplate('{SITELOGO: h=30}',true)."</span>".SITENAME;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'sitename':
|
|
|
|
default:
|
|
|
|
|
|
|
|
return SITENAME;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sc_bootstrap_nav_align()
|
|
|
|
{
|
|
|
|
$pref = e107::pref('theme', 'nav_alignment');
|
|
|
|
|
|
|
|
if($pref == 'right')
|
|
|
|
{
|
|
|
|
return "navbar-right";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-20 14:53:43 -07:00
|
|
|
function sc_bootstrap_usernav($parm=null)
|
2015-03-29 20:25:33 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
$placement = e107::pref('theme', 'usernav_placement', 'top');
|
|
|
|
|
|
|
|
if($parm['placement'] != $placement)
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2017-01-23 09:41:23 -08:00
|
|
|
e107::includeLan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
|
2013-12-21 01:32:39 -08:00
|
|
|
|
|
|
|
$tp = e107::getParser();
|
2015-04-08 14:47:15 -07:00
|
|
|
require(e_PLUGIN."login_menu/login_menu_shortcodes.php"); // don't use 'require_once'.
|
2015-03-29 20:25:33 -07:00
|
|
|
|
|
|
|
$direction = vartrue($parm['dir']) == 'up' ? ' dropup' : '';
|
2015-02-05 16:24:54 -08:00
|
|
|
|
|
|
|
$userReg = defset('USER_REGISTRATION');
|
2013-12-21 06:23:22 -08:00
|
|
|
|
2013-12-21 01:32:39 -08:00
|
|
|
if(!USERID) // Logged Out.
|
|
|
|
{
|
|
|
|
$text = '
|
2015-04-09 01:39:37 -07:00
|
|
|
<ul class="nav navbar-nav navbar-right'.$direction.'">';
|
2016-03-30 19:10:00 -07:00
|
|
|
|
2015-02-05 16:24:54 -08:00
|
|
|
if($userReg==1)
|
2013-12-21 01:32:39 -08:00
|
|
|
{
|
|
|
|
$text .= '
|
2015-06-11 09:40:56 -07:00
|
|
|
<li><a href="'.e_SIGNUP.'">'.LAN_LOGINMENU_3.'</a></li>
|
2015-01-26 09:57:14 -08:00
|
|
|
'; // Signup
|
2013-12-21 01:32:39 -08:00
|
|
|
}
|
2015-03-30 17:13:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
$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">
|
2015-02-05 16:24:54 -08:00
|
|
|
|
2015-06-11 09:40:56 -07:00
|
|
|
<a class="dropdown-toggle" href="#" data-toggle="dropdown">'.LAN_LOGINMENU_51.' <strong class="caret"></strong></a>
|
2014-01-03 02:43:16 -08:00
|
|
|
<div class="dropdown-menu col-sm-12" style="min-width:250px; padding: 15px; padding-bottom: 0px;">
|
2015-02-05 16:24:54 -08:00
|
|
|
|
2016-03-13 17:57:51 -07:00
|
|
|
{SOCIAL_LOGIN: size=2x&label=1}
|
2015-04-21 11:46:43 +02:00
|
|
|
'; // Sign In
|
2015-03-30 17:13:41 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
2015-02-05 16:24:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
if(!empty($userReg)) // value of 1 or 2 = login okay.
|
|
|
|
{
|
2015-04-10 12:36:35 -07:00
|
|
|
|
2015-04-24 15:03:42 -07:00
|
|
|
// global $sc_style; // never use global - will impact signup/usersettings pages.
|
|
|
|
// $sc_style = array(); // remove any wrappers.
|
2015-04-10 12:36:35 -07:00
|
|
|
|
2015-02-05 16:24:54 -08:00
|
|
|
$text .='
|
|
|
|
|
2013-12-21 01:32:39 -08:00
|
|
|
<form method="post" onsubmit="hashLoginPassword(this);return true" action="'.e_REQUEST_HTTP.'" accept-charset="UTF-8">
|
2017-06-16 15:15:55 +04:00
|
|
|
<p>{LM_USERNAME_INPUT: idprefix=bs3-}</p>
|
|
|
|
<p>{LM_PASSWORD_INPUT: idprefix=bs3-}</p>
|
2015-04-10 12:36:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"></div>
|
2013-12-21 06:23:22 -08:00
|
|
|
{LM_IMAGECODE_NUMBER}
|
|
|
|
{LM_IMAGECODE_BOX}
|
|
|
|
|
2013-12-21 01:32:39 -08:00
|
|
|
<div class="checkbox">
|
2015-01-26 09:57:14 -08:00
|
|
|
|
2017-06-16 15:15:55 +04:00
|
|
|
<label class="string optional" for="bs3-autologin"><input style="margin-right: 10px;" type="checkbox" name="autologin" id="bs3-autologin" value="1">
|
2015-06-11 09:40:56 -07:00
|
|
|
'.LAN_LOGINMENU_6.'</label>
|
2013-12-21 01:32:39 -08:00
|
|
|
</div>
|
2017-06-16 15:15:55 +04:00
|
|
|
<input class="btn btn-primary btn-block" type="submit" name="userlogin" id="bs3-userlogin" value="'.LAN_LOGINMENU_51.'">
|
2015-02-05 16:24:54 -08:00
|
|
|
';
|
|
|
|
|
|
|
|
$text .= '
|
|
|
|
|
2018-01-10 15:06:40 -08:00
|
|
|
<a href="{LM_FPW_LINK=href}" class="btn btn-default btn-secondary btn-sm btn-block">'.LAN_LOGINMENU_4.'</a>
|
|
|
|
<a href="{LM_RESEND_LINK=href}" class="btn btn-default btn-secondary btn-sm btn-block">'.LAN_LOGINMENU_40.'</a>
|
2015-02-05 16:24:54 -08:00
|
|
|
';
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
$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>
|
|
|
|
";
|
2013-12-21 01:32:39 -08:00
|
|
|
|
2015-02-05 16:24:54 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "
|
2013-12-21 01:32:39 -08:00
|
|
|
|
|
|
|
|
|
|
|
</ul>";
|
|
|
|
|
|
|
|
|
2013-12-24 03:49:21 -08:00
|
|
|
|
2015-02-05 16:24:54 -08:00
|
|
|
return $tp->parseTemplate($text, true, $login_menu_shortcodes);
|
2013-12-21 01:32:39 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Logged in.
|
2013-12-21 06:23:22 -08:00
|
|
|
//TODO Generic LANS. (not theme LANs)
|
2016-12-08 12:04:16 -08:00
|
|
|
|
|
|
|
$userNameLabel = !empty($parm['username']) ? USERNAME : '';
|
|
|
|
|
2013-12-21 01:32:39 -08:00
|
|
|
$text = '
|
|
|
|
|
2017-05-23 14:25:15 +04:00
|
|
|
<ul class="nav navbar-nav navbar-right'.$direction.'">';
|
|
|
|
|
|
|
|
if( e107::isInstalled('pm') )
|
|
|
|
{
|
|
|
|
$text .= '<li class="dropdown">{PM_NAV}</li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$text .= '
|
2019-05-16 10:55:47 -07:00
|
|
|
<li class="dropdown dropdown-avatar"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{USER_AVATAR: w=30&h=30&crop=1&shape=circle} '. $userNameLabel.' <b class="caret"></b></a>
|
2013-12-21 01:32:39 -08:00
|
|
|
<ul class="dropdown-menu">
|
2013-12-24 03:49:21 -08:00
|
|
|
<li>
|
2015-06-16 20:33:20 +02:00
|
|
|
<a href="{LM_USERSETTINGS_HREF}"><span class="glyphicon glyphicon-cog"></span> '.LAN_SETTINGS.'</a>
|
2013-12-24 03:49:21 -08:00
|
|
|
</li>
|
|
|
|
<li>
|
2015-06-16 20:33:20 +02:00
|
|
|
<a class="dropdown-toggle no-block" role="button" href="{LM_PROFILE_HREF}"><span class="glyphicon glyphicon-user"></span> '.LAN_LOGINMENU_13.'</a>
|
2013-12-24 03:49:21 -08:00
|
|
|
</li>
|
2013-12-21 01:32:39 -08:00
|
|
|
<li class="divider"></li>';
|
|
|
|
|
|
|
|
if(ADMIN)
|
|
|
|
{
|
2015-06-16 20:33:20 +02:00
|
|
|
$text .= '<li><a href="'.e_ADMIN_ABS.'"><span class="fa fa-cogs"></span> '.LAN_LOGINMENU_11.'</a></li>';
|
2013-12-21 01:32:39 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
$text .= '
|
2015-06-16 20:33:20 +02:00
|
|
|
<li><a href="'.e_HTTP.'index.php?logout"><span class="glyphicon glyphicon-off"></span> '.LAN_LOGOUT.'</a></li>
|
2013-12-21 01:32:39 -08:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
';
|
|
|
|
|
2015-04-10 12:36:35 -07:00
|
|
|
|
2013-12-24 03:49:21 -08:00
|
|
|
return $tp->parseTemplate($text,true,$login_menu_shortcodes);
|
2013-12-21 01:32:39 -08:00
|
|
|
}
|
|
|
|
|
2017-02-04 13:45:11 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @example shortcode to render news.
|
|
|
|
*/
|
|
|
|
function sc_bootstrap_news_example($parm=null)
|
|
|
|
{
|
|
|
|
$news = e107::getObject('e_news_tree'); // get news class.
|
|
|
|
$sc = e107::getScBatch('news'); // get news shortcodes.
|
|
|
|
$tp = e107::getParser(); // get parser.
|
|
|
|
|
|
|
|
$newsCategory = 1; // null, number or array(1,3,4);
|
|
|
|
|
|
|
|
$opts = array(
|
|
|
|
'db_order' =>'n.news_sticky DESC, n.news_datestamp DESC', //default is n.news_datestamp DESC
|
|
|
|
'db_where' => "FIND_IN_SET(0, n.news_render_type)", // optional
|
|
|
|
'db_limit' => '6', // default is 10
|
|
|
|
);
|
|
|
|
|
|
|
|
// load active news items. ie. the correct userclass, start/end time etc.
|
|
|
|
$data = $news->loadJoinActive($newsCategory, false, $opts)->toArray(); // false to utilize the built-in cache.
|
|
|
|
$TEMPLATE = "{NEWS_TITLE} : {NEWS_CATEGORY_NAME}<br />";
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-31 14:26:26 -07:00
|
|
|
/**
|
|
|
|
* Mega-Menu Shortcode Example.
|
|
|
|
* @usage Select "bootstrap_megamenu_example" in Admin > Sitelinks > Create/Edit > Function
|
|
|
|
* @notes Changing the method name will require changing .theme-sc-bootstrap-megamenu-example in style.css
|
|
|
|
* @param null $data Link data.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function sc_bootstrap_megamenu_example($data)
|
|
|
|
{
|
|
|
|
// include a plugin, custom code, whatever you wish.
|
|
|
|
|
|
|
|
// return print_a($data,true);
|
|
|
|
|
|
|
|
$parm= array();
|
|
|
|
$parm['caption'] = '';
|
|
|
|
$parm['titleLimit'] = 25; // number of chars fo news title
|
|
|
|
$parm['summaryLimit'] = 50; // number of chars for new summary
|
|
|
|
$parm['source'] = 'latest'; // latest (latest news items) | sticky (news items) | template (assigned to news-grid layout)
|
|
|
|
$parm['order'] = 'DESC'; // n.news_datestamp DESC
|
|
|
|
$parm['limit'] = '6'; // 10
|
|
|
|
$parm['layout'] = 'media-list'; // default | or any key as defined in news_grid_template.php
|
|
|
|
$parm['featured'] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return "<div class='container'>". e107::getObject('news')->render_newsgrid($parm) ."</div>";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2019-08-25 22:15:51 +02:00
|
|
|
|
2013-12-21 01:32:39 -08:00
|
|
|
}
|
2019-08-25 22:15:51 +02:00
|
|
|
|
2015-04-21 11:46:43 +02:00
|
|
|
?>
|