public function prepareData() { $d = new T1(); $d->t1_id = 1; $d->t2_id = 1; $d->save(); $d = new T2(); $d->t2_id = 1; $d->hello_id = 10; $d->save(); for ($i = 0; $i < 10; $i++) { $t3 = new T3(); $t3->hello_id = 10; $t3->save(); } }
public function onT3LoadLayout(&$path, $layout) { if (JRequest::getVar('option') == 'com_mijoshop' && JRequest::getVar('route') == 'product/product') { T3::getApp()->addBodyClass('view-detail'); } //T3::getApp()->addBodyClass('loadlayout'); }
/** * Render megamenu block * * @param string $position The position of the modules to render * @param array $params Associative array of values * @param string $content Module content * * @return string The output of the script * * @since 11.1 */ public function render($info = null, $params = array(), $content = null) { T3::import('menu/t3bootstrap'); // import the renderer $t3app = T3::getApp(); $menutype = empty($params['menutype']) ? $t3app->getParam('mm_type', 'mainmenu') : $params['menutype']; JDispatcher::getInstance()->trigger('onT3BSMenu', array(&$menutype)); $menu = new T3Bootstrap($menutype); return $menu->render(true); }
public static function display() { //load language for template JFactory::getLanguage()->load('tpl_' . T3_TEMPLATE, JPATH_SITE); $japp = JFactory::getApplication(); if (!$japp->isAdmin()) { $tpl = $japp->getTemplate(true); } else { $tplid = JFactory::getApplication()->input->getCmd('view') == 'style' ? JFactory::getApplication()->input->getCmd('id', 0) : false; if (!$tplid) { die(json_encode(array('error' => JText::_('T3_MSG_UNKNOW_ACTION')))); } $cache = JFactory::getCache('com_templates', ''); if (!($templates = $cache->get('t3tpl'))) { // Load styles $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id, home, template, s.params'); $query->from('#__template_styles as s'); $query->where('s.client_id = 0'); $query->where('e.enabled = 1'); $query->leftJoin('#__extensions as e ON e.element=s.template AND e.type=' . $db->quote('template') . ' AND e.client_id=s.client_id'); $db->setQuery($query); $templates = $db->loadObjectList('id'); foreach ($templates as &$template) { $registry = new JRegistry(); $registry->loadString($template->params); $template->params = $registry; } $cache->store($templates, 't3tpl'); } if (isset($templates[$tplid])) { $tpl = $templates[$tplid]; } else { $tpl = $templates[0]; } } ob_clean(); $t3app = T3::getSite($tpl); $layout = $t3app->getLayout(); $t3app->loadLayout($layout); $lbuffer = ob_get_clean(); die($lbuffer); }
public static function display() { T3::import('menu/megamenu'); $input = JFactory::getApplication()->input; $menutype = $input->get('t3menu', 'mainmenu'); $tplparams = $input->get('tplparams', '', 'raw'); $currentconfig = $tplparams instanceof JRegistry ? json_decode($tplparams->get('mm_config', ''), true) : null; $mmconfig = $currentconfig && isset($currentconfig[$menutype]) ? $currentconfig[$menutype] : array(); $mmconfig['editmode'] = true; $menu = new T3MenuMegamenu($menutype, $mmconfig); $buffer = $menu->render(true); // replace image path $base = JURI::base(true) . '/'; $protocols = '[a-zA-Z0-9]+:'; //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by : $regex = '#(src)="(?!/|' . $protocols . '|\\#|\')([^"]*)"#m'; $buffer = preg_replace($regex, "\$1=\"{$base}\$2\"", $buffer); //remove invisibile content $buffer = preg_replace(array('@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu'), array('', ''), $buffer); echo $buffer; }
function buildCss($path) { $app = JFactory::getApplication(); // get vars last-modified $vars_lm = $app->getUserState('vars_last_modified', 0); $theme = $app->getUserState('vars_theme', ''); // less file last-modified $filepath = JPATH_ROOT . '/' . $path; $less_lm = filemtime($filepath); // get css cached file $cssfile = T3_DEV_FOLDER . '/' . ($theme ? $theme . '/' : '') . str_replace('/', '.', $path) . '.css'; $cssurl = JURI::base(true) . '/' . $cssfile; $csspath = JPATH_ROOT . '/' . $cssfile; if (is_file($csspath) && filemtime($csspath) > $less_lm && filemtime($csspath) > $vars_lm) { return $cssurl; } // not cached, build & store it if (!$this->compileCss($path, $cssfile)) { T3::error(JText::sprintf('T3_MSG_DEVFOLDER_NOT_WRITABLE', T3_DEV_FOLDER)); } return $cssurl; }
/** * Render body class of current page * * @param string $position The position of the modules to render * @param array $params Associative array of values * @param string $content Module content * * @return string The output of the script * * @since 11.1 */ public function render($info, $params = array(), $content = null) { $input = JFactory::getApplication()->input; $t3tpl = T3::getApp(); $pageclass = array(); if ($input->getCmd('option', '')) { $pageclass[] = $input->getCmd('option', ''); } if ($input->getCmd('view', '')) { $pageclass[] = 'view-' . $input->getCmd('view', ''); } if ($input->getCmd('layout', '')) { $pageclass[] = 'layout-' . $input->getCmd('layout', ''); } if ($input->getCmd('task', '')) { $pageclass[] = 'task-' . $input->getCmd('task', ''); } if ($input->getCmd('Itemid', '')) { $pageclass[] = 'itemid-' . $input->getCmd('Itemid', ''); } $menu = JFactory::getApplication()->getMenu(); if ($menu) { $active = $menu->getActive(); $default = $menu->getDefault(); if ($active) { if ($default && $active->id == $default->id) { $pageclass[] = 'home'; } if ($active->params && $active->params->get('pageclass_sfx')) { $pageclass[] = $active->params->get('pageclass_sfx'); } } } $pageclass[] = 'j' . str_replace('.', '', number_format((double) JVERSION, 1, '.', '')); $pageclass = array_unique(array_merge($pageclass, $t3tpl->getPageclass())); JDispatcher::getInstance()->trigger('onT3BodyClass', array(&$pageclass)); return implode(' ', $pageclass); }
<?php /** * ------------------------------------------------------------------------ * JA Platon Template * ------------------------------------------------------------------------ * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - Copyrighted Commercial Software * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ // no direct access defined('_JEXEC') or die('Restricted access'); include dirname(__FILE__) . '/index.php'; T3::getApp()->addCss('windows');
<?php /** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ T3::import('admin/layout'); ?> <!-- LAYOUT CONFIGURATION PANEL --> <div id="t3-admin-layout" class="t3-admin-layout hide"> <div class="t3-admin-inline-nav clearfix"> <div class="t3-admin-layout-row-mode clearfix"> <ul class="t3-admin-layout-modes nav nav-tabs"> <li class="t3-admin-layout-mode-structure active"><a href="" title="<?php echo JText::_('T3_LAYOUT_MODE_STRUCTURE'); ?> "><?php echo JText::_('T3_LAYOUT_MODE_STRUCTURE'); ?> </a></li> <li class="t3-admin-layout-mode-layout"><a href="" title="<?php echo JText::_('T3_LAYOUT_MODE_LAYOUT');
* @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ // No direct access defined('_JEXEC') or die(); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); T3::import('minify/csscompressor'); T3::import('core/path'); /** * T3Template class provides extended template tools used for T3 framework * * @package T3 */ class T3Minify { /** * * Known Valid CSS Extension Types * @var array */ protected static $cssexts = array(".css", ".css1", ".css2", ".css3");
/** * Method to get the field input markup. * * @return string The field input markup. */ function getInput() { $this->loadAsset(); T3::import('admin/layout'); return $this->getPositions(); }
function replaceToolbar($body) { $t3toolbar = T3_ADMIN_PATH . '/admin/tpls/toolbar.php'; $input = JFactory::getApplication()->input; if (file_exists($t3toolbar) && class_exists('JToolBar')) { //get the existing toolbar html jimport('joomla.language.help'); $params = T3::getTplParams(); $toolbar = JToolBar::getInstance('toolbar')->render('toolbar'); $helpurl = JHelp::createURL($input->getCmd('view') == 'template' ? 'JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES_EDIT' : 'JHELP_EXTENSIONS_TEMPLATE_MANAGER_STYLES_EDIT'); $helpurl = htmlspecialchars($helpurl, ENT_QUOTES); //render our toolbar ob_start(); include $t3toolbar; $t3toolbar = ob_get_clean(); //replace it $body = str_replace($toolbar, $t3toolbar, $body); } return $body; }
/** * Update head - detect if devmode or themermode is enabled and less file existed, use less file instead of css * We also detect and update jQuery, Bootstrap to use T3 assets * * @return null */ function updateHead() { //state parameters $devmode = $this->getParam('devmode', 0); $themermode = $this->getParam('themermode', 1) && defined('T3_THEMER'); $theme = $this->getParam('theme', ''); $minify = $this->getParam('minify', 0); $minifyjs = $this->getParam('minify_js', 0); // detect RTL $doc = JFactory::getDocument(); $dir = $doc->direction; $is_rtl = $dir == 'rtl'; // As Joomla 3.0 bootstrap is buggy, we will not use it // We also prevent both Joomla bootstrap and T3 bootsrap are loaded // And upgrade jquery as our Framework require jquery 1.7+ if we are loading jquery from google $scripts = array(); if (version_compare(JVERSION, '3.0', 'ge')) { $t3bootstrap = false; $jabootstrap = false; foreach ($doc->_scripts as $url => $script) { if (strpos($url, T3_URL . '/bootstrap/js/bootstrap.js') !== false) { $t3bootstrap = true; if ($jabootstrap) { //we already have the Joomla bootstrap and we also replace to T3 bootstrap continue; } } if (preg_match('@media/jui/js/bootstrap(.min)?.js@', $url)) { if ($t3bootstrap) { //we have T3 bootstrap, no need to add Joomla bootstrap continue; } else { $scripts[T3_URL . '/bootstrap/js/bootstrap.js'] = $script; } $jabootstrap = true; } else { $scripts[$url] = $script; } } $doc->_scripts = $scripts; $scripts = array(); } // VIRTUE MART / JSHOPPING compatible foreach ($doc->_scripts as $url => $script) { $replace = false; if (strpos($url, '//ajax.googleapis.com/ajax/libs/jquery/') !== false && preg_match_all('@/jquery/(\\d+(\\.\\d+)*)?/@msU', $url, $jqver) || preg_match_all('@(^|\\/)jquery([-_]*(\\d+(\\.\\d+)+))?(\\.min)?\\.js@i', $url, $jqver)) { $idx = strpos($url, '//ajax.googleapis.com/ajax/libs/jquery/') !== false ? 1 : 3; if (is_array($jqver) && isset($jqver[$idx]) && isset($jqver[$idx][0])) { $jqver = explode('.', $jqver[$idx][0]); if (isset($jqver[0]) && (int) $jqver[0] <= 1 && isset($jqver[1]) && (int) $jqver[1] < 7) { $scripts[T3_URL . '/js/jquery-1.11.2' . ($devmode ? '' : '.min') . '.js'] = $script; $replace = true; } } } if (!$replace) { $scripts[$url] = $script; } } $doc->_scripts = $scripts; // end update javascript //Update css/less based on devmode and themermode $root = JURI::root(true); $current = JURI::current(); // $regex = '@' . preg_quote(T3_TEMPLATE_REL) . '/css/(rtl/)?(.*)\.css((\?|\#).*)?$@i'; $regex = '@' . preg_quote(T3_TEMPLATE_REL) . '/(.*)\\.css((\\?|\\#).*)?$@i'; $stylesheets = array(); foreach ($doc->_styleSheets as $url => $css) { // detect if this css in template css if (preg_match($regex, $url, $match)) { $fname = $match[1]; // remove rtl $fname = preg_replace('@(^|/)rtl/@mi', '\\1', $fname); // remove local $fname = preg_replace('@^local/@mi', '', $fname); // if (($devmode || $themermode) && is_file(T3_TEMPLATE_PATH . '/less/' . $fname . '.less')) { if ($devmode || $themermode) { // less file $lfname = preg_replace('@(^|/)css/@mi', '\\1less/', $fname); if (is_file(T3_TEMPLATE_PATH . '/' . $lfname . '.less')) { if ($themermode) { $newurl = T3_TEMPLATE_URL . '/' . $lfname . '.less'; $css['mime'] = 'text/less'; } else { T3::import('core/less'); $newurl = T3Less::buildCss(T3Path::cleanPath(T3_TEMPLATE_REL . '/' . $lfname . '.less'), true); } $stylesheets[$newurl] = $css; continue; } } $uri = null; // detect css available base on direction & theme if ($is_rtl && $theme) { // rtl css file $altfname = preg_replace('@(^|/)css/@mi', '\\1css/rtl/' . $theme . '/', $fname); $uri = T3Path::getUrl($altfname . '.css'); } if (!$uri && $is_rtl) { $altfname = preg_replace('@(^|/)css/@mi', '\\1css/rtl/', $fname); $uri = T3Path::getUrl($altfname . '.css'); } if (!$uri && $theme) { $altfname = preg_replace('@(^|/)css/@mi', '\\1css/themes/' . $theme . '/', $fname); $uri = T3Path::getUrl($altfname . '.css'); } if (!$uri) { $uri = T3Path::getUrl($fname . '.css'); } if ($uri) { $stylesheets[$uri] = $css; } continue; } $stylesheets[$url] = $css; } // update back $doc->_styleSheets = $stylesheets; //only check for minify if devmode is disabled if (!$devmode && ($minify || $minifyjs)) { T3::import('core/minify'); if ($minify) { T3Minify::optimizecss($this); } if ($minifyjs) { T3Minify::optimizejs($this); } } }
/** * * Show thememagic form */ public static function megamenu() { $tplparams = T3::getTplParams(); $url = JFactory::getURI(); $url->delVar('t3action'); $url->delVar('t3task'); $referer = $url->toString(); $template = T3_TEMPLATE; $styleid = JFactory::getApplication()->input->getCmd('id'); $mm_type = $tplparams && $tplparams instanceof JRegistry ? $tplparams->get('mm_type', '') : null; //Keepalive $config = JFactory::getConfig(); $lifetime = $config->get('lifetime') * 60000; $refreshTime = $lifetime <= 60000 ? 30000 : $lifetime - 60000; // Refresh time is 1 minute less than the liftime assined in the configuration.php file. // The longest refresh period is one hour to prevent integer overflow. if ($refreshTime > 3600000 || $refreshTime <= 0) { $refreshTime = 3600000; } //check config $currentconfig = $tplparams && $tplparams instanceof JRegistry ? $tplparams->get('mm_config', '') : null; if (!$currentconfig) { $currentconfig = '"{}"'; } include T3_ADMIN_PATH . '/admin/megamenu/megamenu.tpl.php'; exit; }
<?php /** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ // No direct access defined('_JEXEC') or die; jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); T3::import('core/path'); T3::import('lessphp/' . T3_BASE_LESS_COMPILER);
/** * set caching template and its parameters * @param string $name * @param string $params */ public static function setTemplate($name = '', $params = '') { if (!self::$tmpl) { self::$tmpl = new stdClass(); } if ($name && $params) { self::$tmpl->template = $name; self::$tmpl->params = $params; } }
/** * Compile LESS to CSS for a specific theme or all themes * @param string $theme the specific theme */ public static function compileAll($theme = null) { $params = T3::getTplParams(); JFactory::getApplication()->setUserState('current_template_params', $params); // get files need to compile $files = array(); $toPath = T3Path::getLocalPath('', true); // t3 core plugin files $t3files = array('less/frontend-edit.less', 'less/legacy-grid.less', 'less/legacy-navigation.less', 'less/megamenu.less', 'less/off-canvas.less'); // all less file in the template folder $lessFiles = JFolder::files(T3_TEMPLATE_PATH, '.less', true, true, array('rtl', 'themes', '.svn', 'CVS', '.DS_Store', '__MACOSX')); $relLessFiles = array(); $importedFiles = array(); foreach ($lessFiles as $file) { $file = str_replace('\\', '/', $file); $lessContent = file_get_contents($file); $rel = ltrim(str_replace(T3_TEMPLATE_PATH, '', $file), '/'); $reldir = dirname($rel); $ignore = true; if (preg_match_all('#^\\s*@import\\s+"([^"]*)"#im', $lessContent, $matches)) { foreach ($matches[1] as $if) { $if = T3Path::cleanPath($reldir . '/' . $if); if (!in_array($if, $importedFiles)) { $importedFiles[] = $if; } // check if this file import anything in main less folder. if yes, put it in the compile list if (preg_match('@^less/@', $if)) { $ignore = false; } } } if (!$ignore) { $relLessFiles[] = $rel; } } $lessFiles = $relLessFiles; // ignore files which are imported in other file foreach ($lessFiles as $f) { if (!in_array($f, $importedFiles) && !preg_match('@^less/(themes|rtl)/@i', $f)) { $files[] = $f; } } //build t3files foreach ($t3files as $key => $file) { if (in_array($file, $files)) { unset($t3files[$key]); } } // build default if (!$theme || $theme == 'default') { self::buildVars('', 'ltr'); // compile all less files in template "less" folder foreach ($files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath); self::compileCss(T3_TEMPLATE_REL . '/' . $lessPath, $toPath . $cssPath); } // if the template not overwrite the t3 core, we will compile those missing files if (!empty($t3files)) { foreach ($t3files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath); self::compileCss(T3_REL . '/' . $lessPath, $toPath . $cssPath); } } } // build themes if (!$theme) { // get themes $themes = JFolder::folders(T3_TEMPLATE_PATH . '/less/themes'); } else { $themes = $theme != 'default' ? (array) $theme : array(); } if (is_array($themes)) { foreach ($themes as $t) { self::buildVars($t, 'ltr'); // compile foreach ($files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, $t); self::compileCss(T3_TEMPLATE_REL . '/' . $lessPath, $toPath . $cssPath); } if (!empty($t3files)) { foreach ($t3files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, $t); self::compileCss(T3_REL . '/' . $lessPath, $toPath . $cssPath); } } } } // compile rtl css if ($params && $params->get('build_rtl', 0)) { // compile default if (!$theme || $theme == 'default') { self::buildVars('', 'rtl'); // compile foreach ($files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, '', true); self::compileCss(T3_TEMPLATE_REL . '/' . $lessPath, $toPath . $cssPath); } if (!empty($t3files)) { foreach ($t3files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, '', true); self::compileCss(T3_REL . '/' . $lessPath, $toPath . $cssPath); } } } if (is_array($themes)) { // rtl for themes foreach ($themes as $t) { self::buildVars($t, 'rtl'); // compile foreach ($files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, $t, true); self::compileCss(T3_TEMPLATE_REL . '/' . $lessPath, $toPath . $cssPath); } if (!empty($t3files)) { foreach ($t3files as $lessPath) { $cssPath = self::getOutputCssPath($lessPath, $t, true); self::compileCss(T3_REL . '/' . $lessPath, $toPath . $cssPath); } } } } } }
public static function megamenu() { self::cloneParam('t3menu'); JFactory::getLanguage()->load('tpl_' . T3_TEMPLATE, JPATH_SITE); if (!defined('T3')) { die(json_encode(array('error' => JText::_('T3_MSG_PLUGIN_NOT_READY')))); } $action = JFactory::getApplication()->input->get('t3task', ''); if (empty($action)) { die(json_encode(array('error' => JText::_('T3_MSG_UNKNOW_ACTION')))); } if ($action != 'display') { $user = JFactory::getUser(); if (!$user->authorise('core.manage', 'com_templates')) { die(json_encode(array('error' => JText::_('T3_MSG_NO_PERMISSION')))); } } T3::import('admin/megamenu'); if (method_exists('T3AdminMegamenu', $action)) { T3AdminMegamenu::$action(); exit; } else { die(json_encode(array('error' => JText::_('T3_MSG_UNKNOW_ACTION')))); } }
/** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ // No direct access defined('_JEXEC') or die; T3::import('lessphp/lessc.inc'); /** * T3LessCompiler class compile less * * @package T3 */ class T3LessCompiler { public static function compile($source, $path, $todir, $importdirs) { // call Less to compile $parser = new lessc(); $parser->setImportDir(array_keys($importdirs)); $parser->setPreserveComments(true); $output = $parser->compile($source); // update url
public static function addAssets() { $japp = JFactory::getApplication(); $user = JFactory::getUser(); //do nothing when site is offline and user has not login (the offline page is only show login form) if ($japp->getCfg('offline') && !$user->authorise('core.login.offline')) { return; } $jdoc = JFactory::getDocument(); $params = $japp->getTemplate(true)->params; if (defined('T3_THEMER') && $params->get('themermode', 1)) { $jdoc->addStyleSheet(T3_URL . '/css/thememagic.css'); $jdoc->addScript(T3_URL . '/js/thememagic.js'); $theme = $params->get('theme'); $params = new JRegistry(); $themeinfo = new stdClass(); if ($theme) { $themepath = T3_TEMPLATE_PATH . '/less/themes/' . $theme; if (file_exists($themepath . '/variables-custom.less')) { if (!class_exists('JRegistryFormatLESS')) { include_once T3_ADMIN_PATH . '/includes/format/less.php'; } //default variables $varfile = T3_TEMPLATE_PATH . '/less/variables.less'; if (file_exists($varfile)) { $params->loadString(JFile::read($varfile), 'LESS'); //get all less files in "theme" folder $others = JFolder::files($themepath, '.less'); foreach ($others as $other) { //get those developer custom values if ($other == 'variables.less') { $devparams = new JRegistry(); $devparams->loadString(JFile::read($themepath . '/variables.less'), 'LESS'); //overwrite the default variables foreach ($devparams->toArray() as $key => $value) { $params->set($key, $value); } } //ok, we will import it later if ($other != 'variables-custom.less' && $other != 'variables.less') { $themeinfo->{$other} = true; } } //load custom variables $cparams = new JRegistry(); $cparams->loadString(JFile::read($themepath . '/variables-custom.less'), 'LESS'); //and overwrite those defaults variables foreach ($cparams->toArray() as $key => $value) { $params->set($key, $value); } } } } $cache = array(); // a little security if ($user->authorise('core.manage', 'com_templates') || isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], JUri::base() . 'administrator') !== false) { T3::import('core/path'); $baseurl = JUri::base(); //should we provide a list of less path foreach (array(T3_TEMPLATE_PATH . '/less', T3_PATH . '/bootstrap/less', T3_PATH . '/less') as $lesspath) { if (is_dir($lesspath)) { $lessfiles = JFolder::files($lesspath, '.less', true, true); if (is_array($lessfiles)) { foreach ($lessfiles as $less) { $path = ltrim(str_replace(array(JPATH_ROOT, '\\'), array('', '/'), $less), '/'); $path = T3Path::cleanPath($path); $fullurl = $baseurl . preg_replace('@(\\+)|(/+)@', '/', $path); $cache[$fullurl] = JFile::read($less); } } } } } $jdoc->addScriptDeclaration(' var T3Theme = window.T3Theme || {}; T3Theme.vars = ' . json_encode($params->toArray()) . '; T3Theme.others = ' . json_encode($themeinfo) . '; T3Theme.theme = \'' . $theme . '\'; T3Theme.template = \'' . T3_TEMPLATE . '\'; T3Theme.base = \'' . JURI::base() . '\'; T3Theme.cache = ' . json_encode($cache) . '; if(typeof less != \'undefined\'){ //we need to build one - cause the js will have unexpected behavior try{ if(window.parent != window && window.parent.T3Theme && window.parent.T3Theme.applyLess){ window.parent.T3Theme.applyLess(true); } else { less.refresh(); } } catch(e){ } }'); } }
/** * Implement event onGetLayoutPath to return the layout which override by T3 & T3 templates * This event is fired by overriding ModuleHelper class * Return path to layout if found, false if not * * @param string $module The name of the module * @param string $layout The name of the module layout. If alternative * layout, in the form template:filename. * * @return null */ function onGetLayoutPath($module, $layout) { // Detect layout path in T3 themes if (defined('T3_PLUGIN') && T3::detect()) { T3::import('core/path'); $tPath = T3Path::getPath('html/' . $module . '/' . $layout . '.php'); if ($tPath) { return $tPath; } } return false; }
<?php /** * ------------------------------------------------------------------------ * JA Events II template * ------------------------------------------------------------------------ * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - Copyrighted Commercial Software * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ // no direct access defined('_JEXEC') or die; //check if t3 plugin is existed if (!defined('T3')) { if (JError::$legacy) { JError::setErrorHandling(E_ERROR, 'die'); JError::raiseError(500, JText::_('T3_MISSING_T3_PLUGIN')); exit; } else { throw new Exception(JText::_('T3_MISSING_T3_PLUGIN'), 500); } } $t3app = T3::getApp($this); // get configured layout $layout = $t3app->getLayout(); $t3app->loadLayout($layout);
<?php /** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ if (!class_exists('T3MenuMegamenuTpl', false)) { T3::import('menu/megamenu.tpl'); } if (is_file(T3_TEMPLATE_PATH . '/html/megamenu.php')) { require_once T3_TEMPLATE_PATH . '/html/megamenu.php'; } class T3MenuMegamenu { /** * Internal variables */ protected $_items = array(); protected $children = array(); protected $settings = null; protected $params = null; protected $menu = ''; protected $active_id = 0;
<?php /** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ if (!class_exists('T3BootstrapTpl', false)) { T3::import('menu/t3bootstrap.tpl'); } class T3Bootstrap { /** * Internal variables */ protected $menutype; protected $menu; /** * @param string $menutype */ function __construct($menutype = 'mainmenu') { $this->menutype = $menutype; $this->menu = '';
<?php /** * @package Joomla.Platform * @subpackage Document * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * JDocument Megamenu renderer - this is a placeholder for menumenurender */ T3::import('renderer/megamenurender'); class JDocumentRendererMegamenu extends JDocumentRendererMegamenuRender { /** * Render megamenu block * * @param string $position The position of the modules to render * @param array $params Associative array of values * @param string $content Module content * * @return string The output of the script * * @since 11.1 */ public function render($info = null, $params = array(), $content = null) { $params['return_result'] = true; return parent::render($info, $params, $content);
/** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ // No direct access defined('_JEXEC') or die; T3::import('core/template'); jimport('joomla.utilities.utility'); /** * T3Template class provides extended template tools used for T3 framework * * @package T3 */ class T3TemplateLayout extends T3Template { protected $_block = null; /** * Class constructor * @param object $template Current template instance */ public function __construct($template = null) {
/** * Update head - detect if devmode or themermode is enabled and less file existed, use less file instead of css */ function updateHead() { // As Joomla 3.0 bootstrap is buggy, we will not use it // We also prevent both Joomla bootstrap and T3 bootsrap are loaded $t3bootstrap = false; $jabootstrap = false; if (version_compare(JVERSION, '3.0', 'ge')) { $doc = JFactory::getDocument(); $scripts = array(); foreach ($doc->_scripts as $url => $script) { if (strpos($url, T3_URL . '/bootstrap/js/bootstrap.js') !== false) { $t3bootstrap = true; if ($jabootstrap) { //we already have the Joomla bootstrap and we also replace to T3 bootstrap continue; } } if (preg_match('@media/jui/js/bootstrap(.min)?.js@', $url)) { if ($t3bootstrap) { //we have T3 bootstrap, no need to add Joomla bootstrap continue; } else { $scripts[T3_URL . '/bootstrap/js/bootstrap.js'] = $script; } $jabootstrap = true; } else { $scripts[$url] = $script; } } $doc->_scripts = $scripts; } // end update javascript $devmode = $this->getParam('devmode', 0); $themermode = $this->getParam('themermode', 1) && defined('T3_THEMER'); $theme = $this->getParam('theme', ''); $minify = $this->getParam('minify', 0); // not in devmode and in default theme, do nothing if (!$devmode && !$themermode && !$theme && !$minify) { return; } $doc = JFactory::getDocument(); $root = JURI::root(true); $regex = '#' . T3_TEMPLATE_URL . '/css/([^/]*)\\.css((\\?|\\#).*)?$#i'; $stylesheets = array(); foreach ($doc->_styleSheets as $url => $css) { // detect if this css in template css if (preg_match($regex, $url, $match)) { $fname = $match[1]; if ($devmode || $themermode) { if (is_file(T3_TEMPLATE_PATH . '/less/' . $fname . '.less')) { if ($themermode) { $newurl = T3_TEMPLATE_URL . '/less/' . $fname . '.less'; $css['mime'] = 'text/less'; } else { $newurl = JURI::current() . '?t3action=lessc&s=templates/' . T3_TEMPLATE . '/less/' . $fname . '.less'; } $stylesheets[$newurl] = $css; continue; } } else { if ($theme) { if (is_file(T3_TEMPLATE_PATH . '/css/themes/' . $theme . '/' . $fname . '.css')) { $newurl = T3_TEMPLATE_URL . '/css/themes/' . $theme . '/' . $fname . '.css'; $stylesheets[$newurl] = $css; continue; } } } } $stylesheets[$url] = $css; } // update back $doc->_styleSheets = $stylesheets; //only check for minify if devmode is disabled if (!$devmode && $minify) { T3::import('core/minify'); T3Minify::optimizecss($this); } }
/** * ------------------------------------------------------------------------ * Uber Template * ------------------------------------------------------------------------ * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - Copyrighted Commercial Software * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ defined('_JEXEC') or die; // parse jdoc after render $params->set('parse-jdoc', 1); // use with T3 $t3doc = T3::getApp(); $doc = JFactory::getDocument(); // get params $tplparams = JFactory::getApplication()->getTemplate(true)->params; $sitename = $tplparams->get('sitename'); $slogan = $tplparams->get('slogan', ''); $logotype = $tplparams->get('logotype', 'text'); $logoimage = $logotype == 'image' ? $tplparams->get('logoimage', T3Path::getUrl('images/logo.png', '', true)) : ''; $logoimgsm = $logotype == 'image' && $tplparams->get('enable_logoimage_sm', 0) ? $tplparams->get('logoimage_sm', T3Path::getUrl('images/logo-sm.png', '', true)) : false; $logolink = $tplparams->get('logolink'); if (!$sitename) { $sitename = JFactory::getConfig()->get('sitename'); } $headright = $doc->countModules('head-search or languageswitcherload or right-menu') || $tplparams->get('addon_offcanvas_enable'); // get logo url $logourl = JURI::base(true);
public static function getSite($tpl) { //when on site, the JDocumentHTML parameter must be pass if (empty($tpl)) { return false; } $type = 'Template' . JFactory::getApplication()->input->getCmd('t3tp', ''); T3::import('core/' . $type); // create global t3 template object $class = 'T3' . $type; return new $class($tpl); }
?> "> <jdoc:include type="modules" name="<?php $this->_p('footer'); ?> " /> </div> <?php if ($this->getParam('t3-rmvlogo', 1)) { ?> <div class="poweredby"> <a class="t3-logo t3-logo-light" href="http://t3-framework.org" title="<?php echo JText::_('T3_POWER_BY_TEXT'); ?> " target="_blank" <?php echo method_exists('T3', 'isHome') && T3::isHome() ? '' : 'rel="nofollow"'; ?> ><?php echo JText::_('T3_POWER_BY_HTML'); ?> </a> </div> <?php } ?> </section> <div class="clr"></div> <div class="t3-footer-bottom"> <jdoc:include type="modules" name="<?php $this->_p('footer-bottom'); ?>