当前位置: 首页>>代码示例>>PHP>>正文


PHP T3::import方法代码示例

本文整理汇总了PHP中T3::import方法的典型用法代码示例。如果您正苦于以下问题:PHP T3::import方法的具体用法?PHP T3::import怎么用?PHP T3::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在T3的用法示例。


在下文中一共展示了T3::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * 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);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:21,代码来源:t3bootstrap.php

示例2: display

 public static function display()
 {
     T3::import('menu/megamenu');
     $input = JFactory::getApplication()->input;
     //params
     $tplparams = T3::getTplParams();
     //menu type
     $menutype = $input->get('t3menu', 'mainmenu');
     //accessLevel
     $t3acl = (int) $input->get('t3acl', 1);
     $accessLevel = array(1, $t3acl);
     if (in_array(3, $accessLevel)) {
         $accessLevel[] = 2;
     }
     $accessLevel = array_unique($accessLevel);
     sort($accessLevel);
     //languages
     $languages = array(trim($input->get('t3lang', '*')));
     if ($languages[0] != '*') {
         $languages[] = '*';
     }
     //check config
     $currentconfig = $tplparams instanceof JRegistry ? json_decode($tplparams->get('mm_config', ''), true) : null;
     $mmkey = $menutype . ($t3acl == 1 ? '' : '-' . $t3acl);
     $mmconfig = array();
     if ($currentconfig) {
         for ($i = $t3acl; $i >= 1; $i--) {
             $tmmkey = $menutype . ($i == 1 ? '' : '-' . $i);
             if (isset($currentconfig[$tmmkey])) {
                 $mmconfig = $currentconfig[$tmmkey];
                 break;
             }
         }
     }
     if (!is_array($mmconfig)) {
         $mmconfig = array();
     }
     $mmconfig['editmode'] = true;
     $mmconfig['access'] = $accessLevel;
     $mmconfig['language'] = $languages;
     //build the menu
     $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);
     //output the megamenu key to save
     echo $buffer . '<input id="megamenu-key" type="hidden" name="mmkey" value="' . $mmkey . '"/>';
 }
开发者ID:Tommar,项目名称:remate,代码行数:54,代码来源:megamenu.php

示例3: onBeforeRender

 function onBeforeRender()
 {
     if (T3::detect()) {
         $japp = JFactory::getApplication();
         if ($japp->isAdmin()) {
             $t3app = T3::getApp();
             $t3app->addAssets();
         } else {
             $params = $japp->getTemplate(true)->params;
             if (defined('T3_THEMER') && $params->get('themermode', 1)) {
                 T3::import('admin/theme');
                 T3AdminTheme::addAssets();
             }
             //check for ajax action and render t3ajax type to before head type
             if (class_exists('T3Ajax')) {
                 T3Ajax::render();
             }
         }
     }
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:20,代码来源:t3.php

示例4: display

 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;
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:21,代码来源:megamenu.php

示例5: array

<?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;
开发者ID:Tommar,项目名称:remate,代码行数:31,代码来源:megamenu.php

示例6: minifyJs

 /**
  * @param $js
  * @return string
  */
 public static function minifyJs($js)
 {
     T3::import('minify/' . self::$jstool);
     return call_user_func_array(array(self::$jstools[self::$jstool], 'minify'), array($js));
 }
开发者ID:Tommar,项目名称:vino2,代码行数:9,代码来源:minify.php

示例7: onGetLayoutPath

 /**
  * 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;
 }
开发者ID:lazarch,项目名称:t3,代码行数:23,代码来源:t3.php

示例8: thememagic

 /**
  *
  * Show thememagic form
  */
 public static function thememagic($path)
 {
     $app = JFactory::getApplication();
     $isadmin = $app->isAdmin();
     $url = $isadmin ? JUri::root(true) . '/index.php' : JUri::current();
     $url .= (preg_match('/\\?/', $url) ? '&' : '?') . 'themer=1';
     // show thememagic form
     //todo: Need to optimize here
     $tplparams = JFactory::getApplication('site')->getTemplate(true)->params;
     $assetspath = T3_TEMPLATE_PATH;
     $themepath = $assetspath . '/less/themes';
     if (!class_exists('JRegistryFormatLESS')) {
         include_once T3_ADMIN_PATH . '/includes/format/less.php';
     }
     $themes = array();
     $jsondata = array();
     //push a default theme
     $tobj = new stdClass();
     $tobj->id = 'base';
     $tobj->title = JText::_('JDEFAULT');
     $themes['base'] = $tobj;
     $varfile = $assetspath . '/less/variables.less';
     if (file_exists($varfile)) {
         $params = new JRegistry();
         $params->loadString(JFile::read($varfile), 'LESS');
         $jsondata['base'] = $params->toArray();
     }
     if (JFolder::exists($themepath)) {
         $listthemes = JFolder::folders($themepath);
         if (count($listthemes)) {
             foreach ($listthemes as $theme) {
                 $varsfile = $themepath . '/' . $theme . '/variables-custom.less';
                 if (file_exists($varsfile)) {
                     $tobj = new stdClass();
                     $tobj->id = $theme;
                     $tobj->title = $theme;
                     //check for all less file in theme folder
                     $params = false;
                     $others = JFolder::files($themepath . '/' . $theme, '.less');
                     foreach ($others as $other) {
                         //get those developer custom values
                         if ($other == 'variables.less') {
                             $params = new JRegistry();
                             $params->loadString(JFile::read($themepath . '/' . $theme . '/variables.less'), 'LESS');
                         }
                         if ($other != 'variables-custom.less') {
                             $tobj->{$other} = true;
                             //JFile::read($themepath . '/' . $theme . '/' . $other);
                         }
                     }
                     $cparams = new JRegistry();
                     $cparams->loadString(JFile::read($varsfile), 'LESS');
                     if ($params) {
                         foreach ($cparams->toArray() as $key => $value) {
                             $params->set($key, $value);
                         }
                     } else {
                         $params = $cparams;
                     }
                     $themes[$theme] = $tobj;
                     $jsondata[$theme] = $params->toArray();
                 }
             }
         }
     }
     $langs = array('addTheme' => JText::_('T3_TM_ASK_ADD_THEME'), 'delTheme' => JText::_('T3_TM_ASK_DEL_THEME'), 'overwriteTheme' => JText::_('T3_TM_ASK_OVERWRITE_THEME'), 'correctName' => JText::_('T3_TM_ASK_CORRECT_NAME'), 'themeExist' => JText::_('T3_TM_EXISTED'), 'saveChange' => JText::_('T3_TM_ASK_SAVE_CHANGED'), 'previewError' => JText::_('T3_TM_PREVIEW_ERROR'), 'unknownError' => JText::_('T3_MSG_UNKNOWN_ERROR'), 'lblCancel' => JText::_('JCANCEL'), 'lblOk' => JText::_('T3_TM_LABEL_OK'), 'lblNo' => JText::_('JNO'), 'lblYes' => JText::_('JYES'), 'lblDefault' => JText::_('JDEFAULT'));
     //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;
     }
     $backurl = JFactory::getURI();
     $backurl->delVar('t3action');
     $backurl->delVar('t3task');
     if (!$isadmin) {
         $backurl->delVar('tm');
         $backurl->delVar('themer');
     }
     T3::import('depend/t3form');
     $form = new T3Form('thememagic.themer', array('control' => 't3form'));
     $form->load(JFile::read(JFile::exists(T3_TEMPLATE_PATH . '/thememagic.xml') ? T3_TEMPLATE_PATH . '/thememagic.xml' : T3_PATH . '/params/thememagic.xml'));
     $form->loadFile(T3_TEMPLATE_PATH . '/templateDetails.xml', true, '//config');
     $tplform = new T3Form('thememagic.overwrite', array('control' => 't3form'));
     $tplform->loadFile(T3_TEMPLATE_PATH . '/templateDetails.xml', true, '//config');
     $fieldSets = $form->getFieldsets('thememagic');
     $tplFieldSets = $tplform->getFieldsets('thememagic');
     $disabledFieldSets = array();
     foreach ($tplFieldSets as $name => $fieldSet) {
         if (isset($fieldSet->disabled)) {
             $disabledFieldSets[] = $name;
         }
     }
//.........这里部分代码省略.........
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:101,代码来源:theme.php

示例9: defined

<?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);
开发者ID:Tommar,项目名称:vino2,代码行数:20,代码来源:less.php

示例10: divide

 /**
  * Special compilation for template.css file when development mode is on
  * @param $path
  * @return bool
  */
 public static function divide($path)
 {
     //check system
     self::requirement();
     $parser = new Less_Parser();
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $tpl = T3_TEMPLATE;
     $theme = $app->getTemplate(true)->params->get('theme');
     $is_rtl = $doc->direction == 'rtl' && strpos($path, 'rtl/') === false;
     $subdir = ($is_rtl ? 'rtl/' : '') . ($theme ? $theme . '/' : '');
     $topath = T3_DEV_FOLDER . '/' . $subdir;
     $tofile = null;
     $root = JUri::root(true);
     //pattern
     $rimport = '@^\\s*\\@import\\s+"([^"]*)"\\s*;@im';
     $rvarscheck = '@(base|base-bs3|bootstrap|' . preg_quote($tpl) . ')/less/(vars|variables|mixins)\\.less@';
     $rexcludepath = '@(base|base-bs3|bootstrap|' . preg_quote($tpl) . ')/less/@';
     $rimportvars = '@^\\s*\\@import\\s+".*(variables-custom|variables|vars|mixins)\\.less"\\s*;@im';
     $rsplitbegin = '@^\\s*\\#';
     $rsplitend = '[^\\s]*?\\s*{\\s*[\\r\\n]*\\s*content:\\s*"([^"]*)";\\s*[\\r\\n]*\\s*}@im';
     $rswitchrtl = '@/less/(themes/[^/]*/)?@';
     $kfilepath = 'less-file-path';
     $kvarsep = 'less-content-separator';
     $krtlsep = 'rtl-less-content';
     if ($topath) {
         if (!is_dir(JPATH_ROOT . '/' . $topath)) {
             JFolder::create(JPATH_ROOT . '/' . $topath);
         }
     }
     // check path
     $realpath = realpath(JPATH_ROOT . '/' . $path);
     if (!is_file($realpath)) {
         return;
     }
     // get file content
     $content = JFile::read($realpath);
     //remove vars.less
     if (preg_match($rexcludepath, $path)) {
         $content = preg_replace($rimportvars, '', $content);
     }
     // check and add theme less if not is theme less
     if ($theme && strpos($path, 'themes/') === false) {
         $themepath = 'themes/' . $theme . '/' . basename($path);
         if (is_file(T3_TEMPLATE_PATH . '/less/' . $themepath)) {
             $content = $content . "\n@import \"{$themepath}\"; \n\n";
         }
     }
     // split into array, separated by the import
     $split_contents = preg_split($rimport, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     //check if we need to rebuild
     $rebuild = false;
     $vars_lm = $app->getUserState('vars_last_modified', 0);
     $file_lm = @filemtime(JPATH_ROOT . '/' . $path);
     //check for this file and rtl
     $cssfile = $topath . str_replace('/', '.', $path) . '.css';
     $css_lm = is_file(JPATH_ROOT . '/' . $cssfile) ? @filemtime(JPATH_ROOT . '/' . $cssfile) : -1;
     //rebuild?
     if ($css_lm < $vars_lm || $css_lm < $file_lm) {
         $rebuild = true;
     } else {
         $doc->addStylesheet($root . '/' . $cssfile);
     }
     //check for rebuild if this rtl overwrite file has just modified
     if (!$rebuild && $is_rtl) {
         $rtl_url = preg_replace('@/less/(themes/)?@', '/less/rtl/', $path);
         $rtl_lm = is_file(JPATH_ROOT . '/' . $rtl_url) ? @filemtime(JPATH_ROOT . '/' . $rtl_url) : 0;
         $rebuild = $css_lm < $rtl_lm;
     }
     if (!$rebuild) {
         $import = false;
         foreach ($split_contents as $chunk) {
             if ($import) {
                 $import = false;
                 $url = T3Path::cleanPath(dirname($path) . '/' . $chunk);
                 if (is_file(JPATH_ROOT . '/' . $url)) {
                     //$css_lm should be the same as templates.css
                     $file_lm = @filemtime(JPATH_ROOT . '/' . $url);
                     $theme_lm = -1;
                     $rtl_lm = -1;
                     $theme_rtl_lm = -1;
                     if ($theme && strpos($url, 'themes/') === false) {
                         $themepath = 'themes/' . $theme . '/' . basename($path);
                         if (is_file(T3_TEMPLATE_PATH . '/less/' . $themepath)) {
                             $theme_lm = @filemtime(T3_TEMPLATE_PATH . '/less/' . $themepath);
                         }
                         if ($is_rtl) {
                             $rtlthemepath = preg_replace($rswitchrtl, '/less/rtl/' . $theme . '/', $url);
                             if (is_file(JPATH_ROOT . '/' . $rtlthemepath)) {
                                 $theme_rtl_lm = @filemtime(JPATH_ROOT . '/' . $rtlthemepath);
                             }
                         }
                     }
                     if ($is_rtl) {
                         $rtl_url = preg_replace('@/less/(themes/)?@', '/less/rtl/', $url);
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:less.php

示例11: defined

/**
 *------------------------------------------------------------------------------
 * @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)
    {
开发者ID:Tommar,项目名称:remate,代码行数:30,代码来源:templatelayout.php

示例12: updateHead

 /**
  * 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&amp;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);
     }
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:82,代码来源:template.php

示例13: addAssets

    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){

					}
				}');
        }
    }
开发者ID:Tommar,项目名称:vino2,代码行数:99,代码来源:theme.php

示例14: render

 /**
  * Render megamenu block, then push the output into megamenu renderer to display
  *
  * @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/megamenu');
     $t3app = T3::getApp();
     //we will check from params
     $menutype = empty($params['menutype']) ? empty($params['name']) ? $t3app->getParam('mm_type', 'mainmenu') : $params['name'] : $params['menutype'];
     $currentconfig = json_decode($t3app->getParam('mm_config', ''), true);
     //force to array
     if (!is_array($currentconfig)) {
         $currentconfig = (array) $currentconfig;
     }
     //get user access levels
     $viewLevels = JFactory::getUser()->getAuthorisedViewLevels();
     $mmkey = $menutype;
     $mmconfig = array();
     if (!empty($currentconfig)) {
         //find best fit configuration based on view level
         $vlevels = array_merge($viewLevels);
         if (is_array($vlevels) && in_array(3, $vlevels)) {
             //we assume, if a user is special, they should be registered also
             $vlevels[] = 2;
         }
         $vlevels = array_unique($vlevels);
         rsort($vlevels);
         if (!is_array($vlevels)) {
             $vlevels = array();
         }
         $vlevels[] = '';
         // extend a blank, default key
         // check if available configuration for language override
         $langcode = JFactory::getDocument()->language;
         $shortlangcode = substr($langcode, 0, 2);
         $types = array($menutype . '-' . $langcode, $menutype . '-' . $shortlangcode, $menutype);
         foreach ($types as $type) {
             foreach ($vlevels as $vlevel) {
                 $key = $type . ($vlevel !== '' ? '-' . $vlevel : '');
                 if (isset($currentconfig[$key])) {
                     $mmkey = $key;
                     $menutype = $type;
                     break 2;
                 } else {
                     if (isset($currentconfig[$type])) {
                         $mmkey = $menutype = $type;
                         break 2;
                     }
                 }
             }
         }
         if (isset($currentconfig[$mmkey])) {
             $mmconfig = $currentconfig[$mmkey];
             if (!is_array($mmconfig)) {
                 $mmconfig = array();
             }
         }
     }
     JDispatcher::getInstance()->trigger('onT3Megamenu', array(&$menutype, &$mmconfig, &$viewLevels));
     $mmconfig['access'] = $viewLevels;
     $menu = new T3MenuMegamenu($menutype, $mmconfig, $t3app->_tpl->params);
     $t3app->setBuffer($menu->render(true), 'megamenu', empty($params['name']) ? null : $params['name'], null);
     return '';
 }
开发者ID:Tommar,项目名称:remate,代码行数:72,代码来源:megamenurender.php

示例15:

<?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 = '';
开发者ID:lazarch,项目名称:t3,代码行数:31,代码来源:t3bootstrap.php


注:本文中的T3::import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。