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


PHP T3Path::get方法代码示例

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


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

示例1: renderConditionalCSS

 /**
  * Render conditional css link
  *
  * @param array $cond_css
  *   Conditional css list that each element contain 2 sub-elements:
  *   - URL link
  *   - Attributes of css link, it is associate array with 3 keys
  *     + mine:  link type attribute
  *     + media: link media attibute
  *     + attribs: other attributes
  *
  * @return string
  */
 function renderConditionalCSS($condCss)
 {
     $data = "\n";
     $urlPath = new T3Path();
     foreach ($condCss as $css) {
         // Get url path & link attributes
         $url = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $css['url']);
         $paths = $urlPath->get($url, true);
         if ($paths) {
             $media = $css['media'];
             $cond = $css['condition'];
             $type = $css['type'];
             // Generate links
             $paths = array_reverse($paths);
             foreach ($paths as $path) {
                 $data .= "<!--[if {$cond}]><link href=\"{$path[1]}\" type=\"{$type}\" rel=\"stylesheet\" ";
                 if (!empty($media)) {
                     $data .= "media=\"{$media}\" ";
                 }
                 $data .= "/><![endif]--> \n";
                 // Check and add rtl file
                 $rtl_path = str_replace('.css', '-rtl.css', $path[0]);
                 if (T3Common::isRTL() && is_file($rtl_path)) {
                     $rtl_path = str_replace('.css', '-rtl.css', $path[1]);
                     $data .= "<!--[if {$cond}]><link href=\"{$rtl_path}\" type=\"{$type}\" rel=\"stylesheet\" ";
                     if (!empty($media)) {
                         $data .= "media=\"{$media}\" ";
                     }
                     $data .= "/><![endif]--> \n";
                 }
             }
         }
     }
     return $data;
 }
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:48,代码来源:template.php

示例2: proccess

 /**
  * Execute css/js optimizing base on joomla document object
  *
  * @return void
  */
 public static function proccess()
 {
     $document = JFactory::getDocument();
     $urlPath = new T3Path();
     //proccess stylesheets
     $themes = T3Common::get_active_themes();
     //$themes[] = array('core', 'default'); //default now move to template root folder
     //$themes[] = array('engine', 'default');
     $themes = array_reverse($themes);
     $scripts = array();
     $css_urls = array();
     $css_urls['site'] = array();
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1]] = array();
     }
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1] . '-browser'] = array();
     }
     if (T3Common::isRTL()) {
         foreach ($themes as $theme) {
             $css_urls[$theme[0] . '.' . $theme[1] . '-rtl'] = array();
         }
     }
     //$bname = T3Common::getBrowserSortName();
     //$bver = T3Common::getBrowserMajorVersion();
     $optimize_css = T3Parameter::_getParam('optimize_css', 2);
     $optimize_js = T3Parameter::_getParam('optimize_js', 2);
     foreach ($document->_styleSheets as $strSrc => $strAttr) {
         $path = T3Head::cleanUrl($strSrc);
         if (!$path || !preg_match('#\\.css$#', $path)) {
             //External url
             $css_urls['site'][] = array('', $strSrc);
             continue;
         }
         $intemplate = false;
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $path)) {
             $path = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $path);
             $intemplate = true;
         }
         $paths = array();
         //$paths[] = array ('', $path, $strSrc); //The third element is the original url
         $paths[] = array('', $path);
         // Fix when source code in subfolder
         //if ($intemplate) {
         //only load other css files if in T3v2 template
         $ext = '';
         if (preg_match('#\\.[^.]+$#', $path, $matches)) {
             $ext = $matches[0];
         }
         //if ($ext) {
         //$paths[] = array('-browser', str_replace($ext, "-$bname$ext", $path));
         //$paths[] = array('-browser', str_replace($ext, "-$bname$bver$ext", $path));
         //if (T3Common::isRTL()) {
         //$paths[] = array('-rtl', str_replace($ext, "-rtl$ext", $path));
         //$paths[] = array('-rtl', str_replace($ext, "-$bname-rtl$ext", $path));
         //$paths[] = array('-rtl', str_replace($ext, "-$bname$bver-rtl$ext", $path));
         //}
         //}
         if ($ext && T3Common::isRTL()) {
             $paths[] = array('-rtl', str_replace($ext, "-rtl{$ext}", $path));
         }
         //}
         foreach ($paths as $path) {
             //
             if ($intemplate) {
                 $urls = $urlPath->get($path[1], true);
                 if ($urls) {
                     foreach ($urls as $theme => $url) {
                         $url[] = $strAttr;
                         $css_urls[$theme . $path[0]][$url[0]] = $url;
                     }
                 }
             } else {
                 if (is_file(T3Path::path($path[1]))) {
                     $css_urls['site'][T3Path::path($path[1])] = array(T3Path::path($path[1]), count($path) > 2 ? $path[2] : T3Path::url($path[1]), $strAttr);
                     //use original url ($path[2]) if exists
                 }
             }
         }
     }
     // Remove current stylesheets
     $document->_styleSheets = array();
     foreach ($document->_scripts as $strSrc => $strType) {
         $srcurl = T3Head::cleanUrl($strSrc);
         if (!$srcurl || !preg_match('#\\.js$#', $srcurl)) {
             $scrips[] = array('', $strSrc);
             continue;
         }
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $srcurl)) {
             //in template
             $srcurl = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $srcurl);
             $path = str_replace('/', DS, $srcurl);
             $url = $urlPath->get($path);
             if ($url) {
                 $scrips[] = $url;
//.........这里部分代码省略.........
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:101,代码来源:head.php

示例3: proccess

 function proccess()
 {
     $document =& JFactory::getDocument();
     //proccess stylesheets
     $themes = T3Common::get_active_themes();
     //$themes[] = array('core', 'default'); //default now move to template root folder
     //$themes[] = array('engine', 'default');
     $themes = array_reverse($themes);
     $scripts = array();
     $css_urls = array();
     $css_urls['site'] = array();
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1]] = array();
     }
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1] . '-browser'] = array();
     }
     if (T3Common::isRTL()) {
         foreach ($themes as $theme) {
             $css_urls[$theme[0] . '.' . $theme[1] . '-rtl'] = array();
         }
     }
     $bname = T3Common::getBrowserSortName();
     $bver = T3Common::getBrowserMajorVersion();
     $optimize_css = T3Parameter::get('optimize_css', 2);
     $optimize_js = T3Parameter::get('optimize_js', 2);
     foreach ($document->_styleSheets as $strSrc => $strAttr) {
         $path = T3Head::cleanUrl($strSrc);
         if (!$path) {
             //External url
             $css_urls['site'][] = array('', $strSrc);
             continue;
         }
         $intemplate = false;
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $path)) {
             $path = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $path);
             $intemplate = true;
         }
         /*
         if (!$intemplate && $optimize_css < 2) // don't read file content => keep original link
         {
         	$css_urls['site'][] = array ('', $strSrc);
         	continue;
         }
         */
         $paths = array();
         $paths[] = array('', $path, $strSrc);
         //The third element is the original url
         //if ($intemplate) {
         //only load other css files if in T3v2 template
         $ext = '';
         if (preg_match('#\\.[^.]+$#', $path, $matches)) {
             $ext = $matches[0];
         }
         //$file_info = pathinfo($path);
         //$ext = $file_info['extension'];
         if ($ext) {
             $paths[] = array('-browser', str_replace($ext, "-{$bname}{$ext}", $path));
             $paths[] = array('-browser', str_replace($ext, "-{$bname}{$bver}{$ext}", $path));
             if (T3Common::isRTL()) {
                 $paths[] = array('-rtl', str_replace($ext, "-rtl{$ext}", $path));
                 $paths[] = array('-rtl', str_replace($ext, "-{$bname}-rtl{$ext}", $path));
                 $paths[] = array('-rtl', str_replace($ext, "-{$bname}{$bver}-rtl{$ext}", $path));
             }
         }
         //}
         foreach ($paths as $path) {
             //
             if ($intemplate) {
                 if ($urls = T3Path::get($path[1], true)) {
                     foreach ($urls as $theme => $url) {
                         $css_urls[$theme . $path[0]][$url[0]] = $url;
                     }
                 }
             } else {
                 if (is_file(T3Path::path($path[1]))) {
                     $css_urls['site'][T3Path::path($path[1])] = array(T3Path::path($path[1]), count($path) > 2 ? $path[2] : T3Path::url($path[1]));
                 }
                 //use original url ($path[2]) if exists
             }
         }
     }
     //remove current stylesheets
     $document->_styleSheets = array();
     foreach ($document->_scripts as $strSrc => $strType) {
         $srcurl = T3Head::cleanUrl($strSrc);
         if (!$srcurl) {
             $scrips[] = array('', $strSrc);
             continue;
         }
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $srcurl)) {
             //in template
             $srcurl = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $srcurl);
             $path = str_replace('/', DS, $srcurl);
             if ($url = T3Path::get($path)) {
                 $scrips[] = $url;
             }
         } else {
             if ($optimize_js < 1) {
                 $scrips[] = array('', $strSrc);
//.........这里部分代码省略.........
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:head.php


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