Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bootstrap4/css/bootstrap.min.css

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions bootstrap4/helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/**
* @package Joomla.Site
* @subpackage Templates.bootstrap4
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$this->language = $doc->language;
$this->direction = $doc->direction;

// Getting params from template
$params = $app->getTemplate(true)->params;

// Detecting Active Variables
$option = $app->input->getCmd('option', '');
$view = $app->input->getCmd('view', '');
$layout = $app->input->getCmd('layout', '');
$task = $app->input->getCmd('task', '');
$itemid = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');

if ($task == "edit" || $layout == "form") {
$fullWidth = 1;
} else {
$fullWidth = 0;
}

// Adjusting content width
if ($this->countModules('sidebar-left') && $this->countModules('sidebar-right')) {
$span = "col-md-6";
} elseif ($this->countModules('sidebar-left') && !$this->countModules('sidebar-right')) {
$span = "col-md-9";
} elseif (!$this->countModules('sidebar-left') && $this->countModules('sidebar-right')) {
$span = "col-md-9";
} else {
$span = "col-md-12";
}

// Local files or CDN assets loading
if ($this->params->get('local_files') == 1) {
// Add Stylesheets
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/bootstrap.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/font-awesome.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// Add scripts
JHtml::_('jquery.framework');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/popper.min.js');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/bootstrap.min.js');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/template.js');
}

// Remove Bootstrap JS
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);
//if ($this->params->get('jbootstrap') == 1) {unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);}

// Remove J! JQuery if CDN assets are enabled
if ($this->params->get('local_files') == 0) {
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']);
}

// Remove Other Scripts
if ($this->params->get('jall') == 1) {$this->_script = $this->_scripts = array();}
if ($this->params->get('jcaption') == 1) {unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);}
if ($this->params->get('jjquery') == 1) {unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']);}
if ($this->params->get('jjquery_migrate') == 1) {unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-migrate.min.js']);}
if ($this->params->get('jjquery_noconflict') == 1) {unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-noconflict.js']);}

// Remove Joomla Generator Tag
if ($this->params->get('jmetagenerator') == 0) {
$doc->setGenerator('');
}

// Check for a custom CSS file
JHtml::_('stylesheet', 'custom.css', array('version' => 'auto', 'relative' => true));

// Check for a custom js file
JHtml::_('script', 'custom.js', array('version' => 'auto', 'relative' => true));
81 changes: 25 additions & 56 deletions bootstrap4/index.php
Original file line number Diff line number Diff line change
@@ -1,63 +1,32 @@
<?php
/**
* @package Joomla.Site
* @subpackage Templates.protostar
* @subpackage Templates.bootstrap4
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$this->language = $doc->language;
$this->direction = $doc->direction;
include_once (JPATH_ROOT. '/templates/' . $this->template . '/helper.php');

// Getting params from template
$params = $app->getTemplate(true)->params;

// Detecting Active Variables
$option = $app->input->getCmd('option', '');
$view = $app->input->getCmd('view', '');
$layout = $app->input->getCmd('layout', '');
$task = $app->input->getCmd('task', '');
$itemid = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');

if ($task == "edit" || $layout == "form") {
$fullWidth = 1;
} else {
$fullWidth = 0;
}

// Add Stylesheets
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/bootstrap.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/font-awesome.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// Add scripts
JHtml::_('jquery.framework');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/popper.min.js');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/bootstrap.min.js');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/template.js');

// Adjusting content width
if ($this->countModules('sidebar-left') && $this->countModules('sidebar-right')) {
$span = "col-md-6";
} elseif ($this->countModules('sidebar-left') && !$this->countModules('sidebar-right')) {
$span = "col-md-9";
} elseif (!$this->countModules('sidebar-left') && $this->countModules('sidebar-right')) {
$span = "col-md-9";
} else {
$span = "col-md-12";
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<jdoc:include type="head" />
<?php if ($this->params->get('local_files') == 0) { ?>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="templates/bootstrap4/css/template.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js" integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=" crossorigin="anonymous"></script>
<script defer src="templates/bootstrap4/js/template.js"></script>

<?php } ?>
<jdoc:include type="head" />
<?php if($this->params->get('favicon')) { ?>
<link rel="shortcut icon" href="<?php echo JUri::root(true) . htmlspecialchars($this->params->get('favicon'), ENT_COMPAT, 'UTF-8'); ?>" />
<?php } ?>
Expand All @@ -71,12 +40,12 @@
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="<?php echo JURI::base(); ?>"><?php echo $app->get('sitename'); ?></a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<nav class="collapse navbar-collapse" id="navbarSupportedContent">
<jdoc:include type="modules" name="navbar-1" style="none" />
<jdoc:include type="modules" name="navbar-2" style="none" />
</div>
</nav>
</header>
<div class="body">
<main class="body">
<div class="content">
<div class="jumbotron jumbotron-fluid bg-primary text-white">
<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
Expand All @@ -88,7 +57,7 @@
</p>
<?php }?>
<?php } else {?>
<h1><?php echo $this->getTitle();; ?>
<h1><?php echo $this->getTitle();; ?></h1>
<?php } ?>
</div>
</div>
Expand All @@ -103,27 +72,27 @@
<?php endif; ?>
<div class="row">
<?php if ($this->countModules('sidebar-left')) : ?>
<div id="sidebar" class="col-md-3">
<aside id="sidebar" class="col-md-3">
<div class="sidebar-nav">
<jdoc:include type="modules" name="sidebar-left" style="xhtml" />
</div>
</div>
</aside>
<?php endif; ?>
<main id="content" role="main" class="<?php echo $span; ?>">
<article id="content" role="main" class="<?php echo $span; ?>">
<jdoc:include type="modules" name="position-3" style="xhtml" />
<jdoc:include type="message" />
<jdoc:include type="component" />
<jdoc:include type="modules" name="position-2" style="none" />
</main>
</article>
<?php if ($this->countModules('sidebar-right')) : ?>
<div id="aside" class="col-md-3">
<aside id="aside" class="col-md-3">
<jdoc:include type="modules" name="sidebar-right" style="xhtml" />
</div>
</aside>
<?php endif; ?>
</div>
</div>
</div>
</div>
</main>
<footer class="footer bg-faded text-muted" role="contentinfo">
<hr />
<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
Expand Down
5 changes: 2 additions & 3 deletions bootstrap4/js/bootstrap.min.js

Large diffs are not rendered by default.

Loading