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


PHP T3Path::getLocalPath方法代码示例

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


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

示例1: compileAll

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:grlf,项目名称:eyedock,代码行数:101,代码来源:less.php

示例2: compileAll

 /**
  * 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();
     $lesspath = T3_TEMPLATE_REL . '/less/';
     $csspath = T3Path::getLocalPath('css/', true);
     $fullpath = JPath::clean(JPATH_ROOT . '/' . $lesspath);
     // t3 core plugin files
     $t3files = array('frontend-edit', 'legacy-grid', 'legacy-navigation', 'megamenu', 'off-canvas');
     // all less file in less folders
     $lessFiles = JFolder::files($fullpath, '.less', true, true, array('rtl', 'themes', '.svn', 'CVS', '.DS_Store', '__MACOSX'));
     $lessContent = '';
     $relLessFiles = array();
     foreach ($lessFiles as $file) {
         $lessContent .= JFile::read($file) . "\n";
         $relLessFiles[] = ltrim(str_replace($fullpath, '', $file), '/\\');
     }
     $lessFiles = $relLessFiles;
     // get files imported in this list
     if (preg_match_all('#^\\s*@import\\s+"([^"]*)"#im', $lessContent, $matches)) {
         foreach ($lessFiles as $f) {
             if (!in_array($f, $matches[1])) {
                 $files[] = substr($f, 0, -5);
             }
         }
         //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 $file) {
             self::compileCss($lesspath . $file . '.less', $csspath . $file . '.css');
         }
         // if the template not overwrite the t3 core, we will compile those missing files
         if (!empty($t3files)) {
             foreach ($t3files as $file) {
                 self::compileCss(T3_REL . '/less/' . $file . '.less', $csspath . $file . '.css');
             }
         }
     }
     // build themes
     if (!$theme) {
         // get themes
         $themes = JFolder::folders(JPATH_ROOT . '/' . $lesspath . '/themes');
     } else {
         $themes = $theme != 'default' ? (array) $theme : array();
     }
     if (is_array($themes)) {
         foreach ($themes as $t) {
             self::buildVars($t, 'ltr');
             // compile
             foreach ($files as $file) {
                 self::compileCss($lesspath . $file . '.less', $csspath . 'themes/' . $t . '/' . $file . '.css');
             }
             if (!empty($t3files)) {
                 foreach ($t3files as $file) {
                     self::compileCss(T3_REL . '/less/' . $file . '.less', $csspath . 'themes/' . $t . '/' . $file . '.css');
                 }
             }
         }
     }
     // compile rtl css
     if ($params && $params->get('build_rtl', 0)) {
         // compile default
         if (!$theme || $theme == 'default') {
             self::buildVars('', 'rtl');
             // compile
             foreach ($files as $file) {
                 self::compileCss($lesspath . $file . '.less', $csspath . 'rtl/' . $file . '.css');
             }
             if (!empty($t3files)) {
                 foreach ($t3files as $file) {
                     self::compileCss(T3_REL . '/less/' . $file . '.less', $csspath . 'rtl/' . $file . '.css');
                 }
             }
         }
         if (is_array($themes)) {
             // rtl for themes
             foreach ($themes as $t) {
                 self::buildVars($t, 'rtl');
                 // compile
                 foreach ($files as $file) {
                     self::compileCss($lesspath . $file . '.less', $csspath . 'rtl/' . $t . '/' . $file . '.css');
                 }
                 if (!empty($t3files)) {
                     foreach ($t3files as $file) {
                         self::compileCss(T3_REL . '/less/' . $file . '.less', $csspath . 'rtl/' . $t . '/' . $file . '.css');
                     }
//.........这里部分代码省略.........
开发者ID:pryspry,项目名称:t3,代码行数:101,代码来源:less.php

示例3: purge

 public static function purge()
 {
     // Initialize some variables
     $input = JFactory::getApplication()->input;
     $layout = $input->getCmd('layout');
     $template = $input->getCmd('template');
     if (!$layout) {
         return self::error(JText::_('T3_LAYOUT_UNKNOW_ACTION'));
     }
     // delete custom layout
     $layoutfile = T3Path::getLocalPath('tpls/' . $layout . '.php');
     $initfile = T3Path::getLocalPath('etc/layout/' . $layout . '.ini');
     // delete default layout
     $defaultlayoutfile = T3_TEMPLATE_PATH . '/tpls/' . $layout . '.php';
     $defaultinitfile = T3_TEMPLATE_PATH . '/etc/layout/' . $layout . '.ini';
     if (!@JFile::delete($layoutfile) || !@JFile::delete($defaultlayoutfile) || !@JFile::delete($initfile) || !@JFile::delete($defaultinitfile)) {
         return self::error(JText::_('T3_LAYOUT_DELETE_FAIL'));
     } else {
         return self::response(array('successful' => JText::_('T3_LAYOUT_DELETE_SUCCESSFULLY'), 'layout' => $layout, 'type' => 'delete'));
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:21,代码来源:layout.php

示例4: duplicate

 /**
  *
  * Clone Profile
  */
 public static function duplicate($path)
 {
     $theme = JFactory::getApplication()->input->getCmd('theme');
     $from = JFactory::getApplication()->input->getCmd('from');
     $result = array();
     if (empty($theme) || empty($from)) {
         return self::error(JText::_('T3_TM_INVALID_DATA_TO_SAVE'));
     }
     $source = $path . '/less/themes/' . $from;
     if (!JFolder::exists($source)) {
         // try to find the source in local
         $source = T3Path::getPath('less/themes/' . $from);
         if (!$source) {
             return self::error(JText::sprintf('T3_TM_NOT_FOUND', $from));
         }
     }
     // $dest = $path . '/less/themes/' . $theme;
     // clone to local
     $dest = T3Path::getLocalPath('less/themes/' . $theme);
     if (JFolder::exists($dest)) {
         return self::error(JText::sprintf('T3_TM_EXISTED', $theme));
     }
     // copy $from to $theme
     $status = @JFolder::copy($source, $dest);
     $rtlsource = $path . '/less/rtl/' . $from;
     if (!JFolder::exists($rtlsource)) {
         // try to find the source in local
         $rtlsource = T3Path::getPath('less/rtl/' . $from);
     }
     if ($rtlsource) {
         $rtldest = T3Path::getLocalPath('less/rtl/' . $theme);
         // copy $from to $theme
         @JFolder::copy($rtlsource, $rtldest);
     }
     $result = array();
     if ($status) {
         $result['success'] = JText::_('T3_TM_CLONE_SUCCESSFULLY');
         $result['theme'] = $theme;
         $result['reset'] = true;
         $result['type'] = 'duplicate';
     } else {
         return self::error(JText::_('T3_TM_OPERATION_FAILED'));
     }
     //LessHelper::compileForTemplate(T3_TEMPLATE_PATH , $theme);
     T3::import('core/less');
     T3Less::compileAll($theme);
     return self::response($result);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:52,代码来源:theme.php


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