Code:
<?php
/**
* Kunena Component
*
* @package Kunena.Template.Blue_Eagle
*
* @copyright (C) 2008 - 2015 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
**/
defined('_JEXEC') or die();
// Compile CSS from LESS files.
$this->compileLess('style.less', 'kunena.css');
$this->addStyleSheet('kunena.css');
/**
* Class KunenaTemplateDev_Mafuba
*/
class KunenaTemplateDev_Mafuba extends KunenaTemplate
{
// Try to find missing files from the following parent templates:
protected $default = array('dev_mafuba');
protected $css_compile = false;
protected $userClasses = array('kwho-',
'admin' => 'kwho-admin',
'globalmod' => 'kwho-globalmoderator',
'moderator' => 'kwho-moderator',
'user' => 'kwho-user',
'guest' => 'kwho-guest',
'banned' => 'kwho-banned',
'blocked' => 'kwho-blocked');
public $categoryIcons = array('kreadforum', 'kunreadforum');
/**
* Icon Classes mapped
*
* @var array
*/
static protected $fileIcons = array('image' => array('png', 'jpg', 'gif', 'jpeg'),
'archive' => array('tar', 'zip', 'gz', 'tgz', 'bz2', 'rar', '7z'),
'txt' => array('txt', 'doc'),
'pdf' => array('pdf'),);
public function initialize()
{
KunenaFactory::loadLanguage('com_kunena.tpl_blue_eagle');
// Enable legacy mode
KunenaTemplateLegacy::load();
require_once JPATH_SITE . '/' . $this->getFile('initialize.php');
// $this->addStyleSheet ( 'css/kunena.20.css' );
// Dev-Mafubas compiled less file
// $this->addStyleSheet('css/style.css');
// Toggler language strings
JFactory::getDocument()->addScriptDeclaration('// <![CDATA[
var kunena_toggler_close = "' . JText::_('COM_KUNENA_TOGGLER_COLLAPSE', true) . '";
var kunena_toggler_open = "' . JText::_('COM_KUNENA_TOGGLER_EXPAND', true) . '";
// ]]>');
}
public function getButton($link, $name, $scope, $type, $id = null)
{
$types = array('communication' => 'comm', 'user' => 'user', 'moderation' => 'mod', 'permanent' => 'mod');
$names = array('unsubscribe' => 'subscribe',
'unfavorite' => 'favorite',
'unsticky' => 'sticky',
'unlock' => 'lock',
'create' => 'newtopic',
'quickreply' => 'reply',
'quote' => 'quote',
'edit' => 'edit',
'permdelete' => 'delete',
'flat' => 'layout-flat',
'threaded' => 'layout-threaded',
'indented' => 'layout-indented',
'list' => 'reply');
$text = JText::_("COM_KUNENA_BUTTON_{$scope}_{$name}");
$title = JText::_("COM_KUNENA_BUTTON_{$scope}_{$name}_LONG");
if($title == "COM_KUNENA_BUTTON_{$scope}_{$name}_LONG"){
$title = '';
}
if($id){
$id = 'id="' . $id . '"';
}
if(isset($types[$type])){
$type = $types[$type];
}
if($name == 'quickreply'){
$type .= ' kqreply';
}
if(isset($names[$name])){
$name = $names[$name];
}
return <<<HTML
<a $id class="kicon-button kbutton{$type} btn-left" href="{$link}" rel="nofollow" title="{$title}">
<span class="{$name}"><span>{$text}</span></span>
</a>
HTML;
}
public function getIcon($name, $title = '')
{
return '<span class="kicon ' . $name . '" title="' . $title . '"></span>';
}
public function getImage($image, $alt = '')
{
return '<img src="' . $this->getImagePath($image) . '" alt="' . $alt . '" />';
}
/**
* Extract the Link Uri (href)
*
* @param string $html
*
* @return bool
*/
static public function getOriginalUri($html = '')
{
$matches = array();
$pattern = '/href="(.*?)"/';
preg_match($pattern, $html, $matches);
if(isset($matches[1])){
return $matches[1];
}
return false;
}
/**
* Helper to get an css Class for mapped file icons in template
*
* @param null $file
*
* @return string
*/
static public function getFileIconClass($file = null)
{
/**
* Use in Css the following css Classes
*
* class="fileIcon-images"
* class="fileIcon-archive"
* class="fileIcon-txt"
* class="fileIcon-pdf"
*
* if filetype not detected
* class="fileIcon-default"
*
*/
$prefix = 'fileicon-';
if($file){
$ext = pathinfo($file, PATHINFO_EXTENSION);
foreach(self::$fileIcons as $type => $matchingExtensions){
if(in_array($ext, $matchingExtensions)){
return $prefix . '' . $type;
}
}
}
return $prefix . 'default';
}
/**
* Getting the Svg immage resource dir to include
*
* @param $file
*
* @return string
*/
static public function getFileIconSvg($file = null)
{
$icon = self::getFileIconClass($file);
$ficonFile = dirname(__FILE__) . '/images/svg/' . $icon . '.svg';
if(file_exists($ficonFile)){
return $ficonFile;
}
$ficonFile = dirname(__FILE__) . '/images/svg/fileicon-default.svg';
if(file_exists($ficonFile)){
return $ficonFile;
}
return false;
//throw new RuntimeException('missing default fileicon');
}
}
Code:
<?php defined( '_JEXEC' ) or die;
include_once JPATH_THEMES.'/'.$this->template.'/logic.php';
// LESS
require_once(__DIR__ . '/less/lessc.inc.php');
$inputFile = __DIR__ . "/less/style.less";
$outputFile = __DIR__ . "/css/style.css";
$cacheFile = $inputFile . ".cache";
if (file_exists($cacheFile)) {
$cache = unserialize(file_get_contents($cacheFile));
} else {
$cache = $inputFile;
}
$less = new lessc;
$newCache = $less->cachedCompile($cache);
if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {
file_put_contents($cacheFile, serialize($newCache));
file_put_contents($outputFile, $newCache['compiled']);
}
?><!doctype html>
<html lang="<?php echo $this->language; ?>">
<head>
<jdoc:include type="head" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="apple-touch-icon-precomposed" href="<?php echo $tpath; ?>/images/apple-touch-icon-57x57-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $tpath; ?>/images/apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $tpath; ?>/images/apple-touch-icon-114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo $tpath; ?>/images/apple-touch-icon-144x144-precomposed.png">
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,900' rel='stylesheet' type='text/css'>
<!-- JavaScript -->
<script type="text/javascript" src="<?php echo $tpath; ?>/js/menu.js"></script>
<script type="text/javascript" src="https://getdpd.com/js/cart.js"></script>
</head>
<body class="<?php echo (($menu->getActive() == $menu->getDefault()) ? ('front') : ('site')).' '.$active->alias.' '.$pageclass; ?>">
<!-- Temlpate Divs -->
<jdoc:include type="modules" name="debug" />
</body>
</html>