本文整理匯總了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();
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}