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


PHP T3Path::getAllPath方法代码示例

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


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

示例1: getOptions

 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $table = JTable::getInstance('Style', 'TemplatesTable', array());
     $table->load((int) JFactory::getApplication()->input->getInt('id'));
     // update path to this template
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         // process path in template
         $options = array();
         $vals = array();
         // get all path in template
         $paths = T3Path::getAllPath($path);
         foreach ($paths as $path) {
             $this->directory = $this->element['directory'] = $path;
             $tmps = parent::getOptions();
             foreach ($tmps as $tmp) {
                 if (in_array($tmp->value, $vals)) {
                     continue;
                 }
                 $vals[] = $tmp->value;
                 $options[] = $tmp;
             }
         }
         return $options;
     }
     return parent::getOptions();
 }
开发者ID:ForAEdesWeb,项目名称:AEW9,代码行数:37,代码来源:t3folderlist.php

示例2: addExtraAssets

 /**
  * Add some other condition assets (css, javascript). Use to parse /etc/assets.xml
  *
  * @return  null
  */
 function addExtraAssets()
 {
     $base = JURI::base(true);
     $regurl = '#(http|https)://([a-zA-Z0-9.]|%[0-9A-Za-z]|/|:[0-9]?)*#iu';
     $afiles = T3Path::getAllPath('etc/assets.xml');
     foreach ($afiles as $afile) {
         if (is_file($afile)) {
             //load xml
             $axml = JFactory::getXML($afile);
             //process if exist
             if ($axml) {
                 foreach ($axml as $node => $nodevalue) {
                     //ignore others node
                     if ($node == 'stylesheets' || $node == 'scripts') {
                         foreach ($nodevalue->file as $file) {
                             $compatible = (string) $file['compatible'];
                             if ($compatible) {
                                 $parts = explode(' ', $compatible);
                                 $operator = '=';
                                 //exact equal to
                                 $operand = $parts[0];
                                 if (count($parts) == 2) {
                                     $operator = $parts[0];
                                     $operand = $parts[1];
                                 }
                                 //compare with Joomla version
                                 if (!version_compare(JVERSION, $operand, $operator)) {
                                     continue;
                                 }
                             }
                             $url = (string) $file;
                             if (substr($url, 0, 2) == '//') {
                                 //external link
                             } else {
                                 if ($url[0] == '/') {
                                     //absolute link from based folder
                                     $url = is_file(JPATH_ROOT . $url) ? $base . $url : false;
                                 } else {
                                     if (!preg_match($regurl, $url)) {
                                         //not match a full url -> sure internal link
                                         $url = T3Path::getUrl($url);
                                         // so get it
                                     }
                                 }
                             }
                             if ($url) {
                                 if ($node == 'stylesheets') {
                                     $type = $file['type'] ? (string) $file['type'] : 'text/css';
                                     $media = $file['media'] ? (string) $file['media'] : null;
                                     $this->addStylesheet($url, $type, $media);
                                 } else {
                                     $type = $file['type'] ? (string) $file['type'] : 'text/javascript';
                                     $defer = $file['defer'] ? (bool) $file['defer'] : false;
                                     $async = $file['async'] ? (bool) $file['async'] : false;
                                     $this->addScript($url, $type, $defer, $async);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // template extended styles
     $aparams = $this->_tpl->params->toArray();
     $extras = array();
     $itemid = JFactory::getApplication()->input->get('Itemid');
     foreach ($aparams as $name => $value) {
         if (preg_match('/^theme_extras_(.+)$/', $name, $m)) {
             $extras[$m[1]] = $value;
         }
     }
     if (count($extras)) {
         foreach ($extras as $extra => $pages) {
             if (!is_array($pages) || !count($pages) || in_array(0, $pages)) {
                 continue;
                 // disabled
             }
             if (in_array(-1, $pages) || in_array($itemid, $pages)) {
                 // load this style
                 $this->addCss('extras/' . $extra);
             }
         }
     }
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:90,代码来源:template.php

示例3: parse

 /**
  * Parse a less file to get all its overrides before compile
  * @param  string  $path the less file
  */
 public static function parse($path)
 {
     $rtpl_check = '@' . preg_quote(T3_TEMPLATE_REL, '@') . '/@i';
     $rtpl_less_check = '@' . preg_quote(T3_TEMPLATE_REL, '@') . '/less/@i';
     $app = JFactory::getApplication();
     $theme = $app->getUserState('current_theme');
     $dir = $app->getUserState('current_direction');
     $is_rtl = $dir == 'rtl';
     $rel_path = preg_replace($rtpl_check, '', $path);
     $rel_dir = dirname($rel_path);
     // check path
     $realpath = realpath(JPATH_ROOT . '/' . $path);
     if (!is_file($realpath)) {
         return false;
     }
     // get file content
     $content = file_get_contents($realpath);
     //remove vars.less
     $content = preg_replace(self::$rimportvars, '', $content);
     // split into array, separated by the import
     $arr = preg_split(self::$rimport, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     $arr[] = basename($rel_path);
     $arr[] = '';
     $list = array();
     $rtl_list = array();
     $list[$path] = '';
     $import = false;
     foreach ($arr as $chunk) {
         if ($import) {
             $import = false;
             $import_url = T3Path::cleanPath(T3_TEMPLATE_REL . '/' . $rel_dir . '/' . $chunk);
             // if $url in less folder, get all its overrides
             if (preg_match($rtpl_less_check, $import_url)) {
                 $less_rel_url = preg_replace($rtpl_less_check, '', $import_url);
                 $array = T3Path::getAllPath('less/' . $less_rel_url, true);
                 if ($theme) {
                     $array = array_merge($array, T3Path::getAllPath('less/themes/' . $theme . '/' . $less_rel_url, true));
                 }
                 foreach ($array as $f) {
                     // add file in template only
                     if (preg_match($rtpl_check, $f)) {
                         $list[$f] = T3Path::relativePath(dirname($path), $f);
                     }
                 }
                 // rtl overrides
                 if ($is_rtl) {
                     $array = T3Path::getAllPath('less/rtl/' . $less_rel_url, true);
                     if ($theme) {
                         $array = array_merge($array, T3Path::getAllPath('less/rtl/themes/' . $theme . '/' . $less_rel_url, true));
                     }
                     foreach ($array as $f) {
                         // add file in template only
                         if (preg_match($rtpl_check, $f)) {
                             $rtl_list[$f] = T3Path::relativePath(dirname($path), $f);
                         }
                     }
                 }
             } else {
                 $list[$import_url] = T3Path::cleanPath($chunk);
                 // rtl override
                 if ($is_rtl) {
                     $rtl_url = preg_replace('/\\/less\\//', '/less/rtl/', $import_url);
                     if (is_file(JPATH_ROOT . '/' . $rtl_url)) {
                         $rtl_list[$rtl_url] = T3Path::relativePath(dirname($path), $rtl_url);
                     }
                 }
             }
         } else {
             $import = true;
             $list[$chunk] = false;
         }
     }
     // remove itself
     unset($list[$path]);
     // join rtl
     if ($is_rtl) {
         $list["\n\n#" . self::$krtlsep . "{content: \"separator\";}\n\n"] = false;
         $list = array_merge($list, $rtl_list);
     }
     return $list;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:85,代码来源:less.php

示例4: 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;
        $devmode = $params->get('devmode', 0);
        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) {
                foreach (T3Path::getAllPath('less/themes/' . $theme) as $themepath) {
                    //$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
                            if (file_exists($themepath . '/variables-custom.less')) {
                                $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);
                            }
                        }
                    }
                }
            }
            //workaround for bootstrap icon path
            $sparams = new JRegistry();
            if (defined('T3_BASE_RSP_IN_CLASS') && T3_BASE_RSP_IN_CLASS) {
                $sparams->set('icon-font-path', '"' . JUri::base() . 'plugins/system/t3/base-bs3/bootstrap/fonts/"');
            }
            // enable development mode for less.js
            if ($devmode) {
                $jdoc->addScriptDeclaration('
					var less = window.less || {};
					less.env = \'development\';
				');
            }
            $jdoc->addScriptDeclaration('
				var T3Theme = window.T3Theme || {};
				T3Theme.vars = ' . json_encode($params->toArray()) . ';
				T3Theme.svars = ' . json_encode($sparams->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\'){
//.........这里部分代码省略.........
开发者ID:grlf,项目名称:eyedock,代码行数:101,代码来源:theme.php


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