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


PHP Tool::getActualPath方法代码示例

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


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

示例1: handle

 private function handle($matches)
 {
     $path = Tool::getActualPath($matches[1]);
     $processor = new JsPreprocess($this->processor->getMap());
     $processor->setFile(C('SRC.SRC_PATH') . $path);
     $processor->process();
     trigger('js_import', $this->processor, $processor);
     return $processor->getContents();
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:9,代码来源:IframeRefreshPlugin.class.php

示例2: replaceMediaPath

 private function replaceMediaPath($matches)
 {
     $path = $matches[0];
     $aPath = Tool::getActualPath($path);
     if (isset($this->map['media'][$aPath])) {
         trigger('js_replace', $this, $aPath);
         return Tool::addCdn($this->map['media'][$aPath]);
     }
     return $path;
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:10,代码来源:JsPreprocess.class.php

示例3: setConfig

 /**
  * 设置mergeConfig,并检查合法性
  * @param $mergeValue
  * @param $url
  * @param $config
  * @throws MergeConfigException
  */
 private function setConfig($mergeValue, $url, $config)
 {
     $url = Tool::getActualPath($url);
     if (!isset($this->mergeConfig[$mergeValue][$url])) {
         $this->mergeConfig[$mergeValue][$url] = $config;
     } else {
         // 如果这个图片地址,之前处理过
         // 取最大的padding
         $paddings = array('padding-left', 'padding-right', 'padding-top', 'padding-bottom');
         $oldConfig =& $this->mergeConfig[$mergeValue][$url];
         foreach ($paddings as $padding) {
             $oldConfig[$padding] = max($oldConfig[$padding], $config[$padding]);
         }
         // 之前float = none,而现在float != none
         if ($oldConfig['float'] === 'none') {
             if ($config['float'] !== 'none') {
                 $oldConfig['float'] = $config['float'];
             }
         } else {
             if ($config['float'] !== 'none' && $oldConfig['float'] !== $config['float']) {
                 //                    throw new MergeConfigException('图片:'.$url.',被多次引用,但存在冲突,请检查background-position!', self::MERGE_FLOAT_ERROR);
             }
         }
         // 之前 repeat none, 现在 repeat !none
         if ($oldConfig['repeat'] === 'none') {
             if ($config['repeat'] !== 'none') {
                 $oldConfig['repeat'] = $config['repeat'];
             }
         } else {
             if ($config['repeat'] !== 'none' && $oldConfig['repeat'] !== $config['repeat']) {
                 throw new MergeConfigException('图片:' . $url . ',被多次引用,但存在冲突,请检查background-repeat!', self::MERGE_REPEAT_ERROR);
             }
         }
     }
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:42,代码来源:MergeConfigGenerator.class.php

示例4: getBackgroundUrlData

 private function getBackgroundUrlData($url, $merge = null)
 {
     $ret = array('url' => $url, 'config' => null);
     $newUrl = $url;
     if (!$url || strpos($url, 'data:') !== false || strpos($url, 'about:') !== false || strpos($url, '://') !== false) {
         return $ret;
     }
     $url = Tool::getActualPath($url);
     $mask = 0;
     $mask += !is_null($merge);
     $mask += $mask > 0 && isset($this->spriteConfig[$merge]);
     $mask += $mask > 1 && isset($this->spriteConfig[$merge]['config'][$url]);
     $mask <<= 1;
     $mask += isset($this->map['media'][$url]);
     if (($mask & 6) === 6) {
         $sprite = $this->spriteConfig[$merge]['attr']['filename'];
         if (isset($this->map['media'][$sprite])) {
             $newUrl = $this->map['media'][$sprite];
         } else {
             mark('找不到合图文件' . $sprite . '的去向,请确定该合图已编译', 'error');
             return $ret;
         }
         $ret['config'] = $this->spriteConfig[$merge]['config'][$url];
         trigger('css_background_change', $this, $sprite);
     } else {
         if (($mask & 1) === 1) {
             $newUrl = $this->map['media'][$url];
         }
         trigger('css_background_change', $this, $url);
         // 依然将合图加入依赖关系表中,万一某天心血来潮又合图了,依然可以进行增量编译
         if ($mask > 1) {
             trigger('css_background_change', $this, $merge . C('SPRITE_SUFFIX') . '.png');
         }
         // 5中异常情况
         switch ($mask) {
             case 0:
                 mark('文件“' . $this->path . '”中引用了“' . $url . '”,但该图片不存在!', 'warn');
                 return $ret;
             case 1:
                 // 正常情况
                 break;
             case 2:
                 mark('文件“' . $this->path . '”中存在未知合图类型“' . $merge . '”,并且图片“' . $url . '”也不存在', 'warn');
                 return $ret;
             case 3:
                 mark('文件“' . $this->path . '”中存在未知合图类型“' . $merge . '”,将用小图地址代替', 'warn');
                 break;
             case 4:
                 mark('文件“' . $this->path . '”中引用了合图“' . $merge . '”,但该合图类型中不存在“' . $url . '”的配置信息,并且该图片也不存在', 'warn');
                 return $ret;
             case 5:
                 mark('文件“' . $this->path . '”中引用了合图“' . $merge . '”,但该合图类型中不存在“' . $url . '”的配置信息,将用小图地址代替', 'warn');
                 break;
             default:
                 mark('文件“' . $this->path . '”中引用了“' . $url . '”,未知错误码:' . $mask, 'error');
                 return $ret;
         }
     }
     $ret['url'] = Tool::addCdn($newUrl);
     return $ret;
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:61,代码来源:CssPreprocess.class.php

示例5: replacePath

 /**
  * 进行地址替换
  * @param $type
  * @param $key
  * @param $orgValue
  */
 private function replacePath($type, &$key, $prop)
 {
     $value = $key->{$prop};
     // 去掉queryString
     $pos = strpos($value, '?');
     if ($pos !== false) {
         $value = substr($value, 0, $pos);
     }
     $value = Tool::getActualPath($value);
     if (isset($this->map[$type][$value])) {
         $key->{$prop} = Tool::addCdn($this->map[$type][$value]);
         trigger('html_href_change', $this, $value);
     }
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:20,代码来源:HtmlPreprocess.class.php


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