/** * Template initialization. * * @return void */ public function initialize() { // Template requires Bootstrap javascript // Template also requires jQuery framework. // Load JavaScript. // Compile CSS from LESS files. if (jimport('jproofless.jproofless')) { $jproofLess = JProofLess::getInstance(); $cssFile = KPATH_MEDIA . "/cache/{$this->name}/css/" . $this->name . '.css'; $lessFile = KPATH_COMPONENT_RELATIVE . "/template/{$this->name}/less/{$this->name}.less"; $extraStyle = JPATH_SITE . '/components/com_kunena/template/crypsis/css/custom.css'; $jproofLess->setCssFile($cssFile)->setLessFile($lessFile)->setVariables($this->style_variables)->useStrategy('missingcss')->setExtraContent($extraStyle); $class = $this; $jproofLess->getLess()->registerFunction('url', function ($arg) use($class) { list($type, $q, $values) = $arg; $value = reset($values); return "url({$q}{$class->getFile($value, true, 'media', 'media/kunena')}{$q})"; }); // Load template colors settings $this->ktemplate = KunenaFactory::getTemplate(); $styles = <<<EOF \t\t/* Kunena Custom CSS */ EOF; $iconcolor = $this->ktemplate->params->get('IconColor'); if ($iconcolor) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] i, \t\t.layout#kunena #kwho i.icon-users, \t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; } EOF; } $iconcolornew = $this->ktemplate->params->get('IconColorNew'); if ($iconcolornew) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important; } EOF; } $jproofLess->setExtraContent($styles); $jproofLess->autoCompile(); } else { // adding an Log message if it is an good choice to install the JProofLess JLog::add('JProofLess is missing: ' . __FILE__ . ' @see <a target="_blank" href="http://wiki.jproof.de/projects/joomla-library-jproof-less/wiki"><b>Wiki</b></a>', JLog::NOTICE); // Adding each time the regular already rendered css into the template if the LessCompiler not found //JFactory::getDocument()->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css'); } parent::initialize(); }
<?php /** * PHP version 5.4 * * @package JProofLess Template Pattern * @author JProof(Romacron) <*****@*****.**> http://www.jproof.de * @copyright 2005 - 2015 jproof * @license WTFPL (../LICENSE) * @link * @see http://wiki.jproof.de/projects/joomla-library-jproof-less * @since **/ defined('_JEXEC') or die('Restricted access'); /* * * templates/YOUR-template/index.php * */ if (JLoader::import('jproofless.jproofless')) { $joomlaLess = JProofLess::getInstance(); $joomlaLess->setLessFile(JPATH_THEMES . '/' . $this->template . '/less/template.less'); $joomlaLess->setCssFile(JPATH_THEMES . '/' . $this->template . '/css/template.css'); $joomlaLess->autoCompile(); } // Start your standard HTML ?> <head> <!-- Less rendered Template css already inside --> <jdoc:include type="head" /> </head>