本文整理匯總了PHP中zibo\core\Zibo::getRelativeFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zibo::getRelativeFile方法的具體用法?PHP Zibo::getRelativeFile怎麽用?PHP Zibo::getRelativeFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zibo\core\Zibo
的用法示例。
在下文中一共展示了Zibo::getRelativeFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFilesFromStyle
/**
* Gets all the files needed for the provided CSS file. This will extract the imports from the CSS.
* @param zibo\core\Zibo $zibo Instance of Zibo
* @param zibo\library\filesystem\File $file CSS source file
* @return array Array with the path of the file as key and the File object as value
*/
private function getFilesFromStyle(Zibo $zibo, File $file)
{
$source = $file->read();
$source = preg_replace(CSSMin::REGEX_COMMENT, '', $source);
$files = array();
$parent = $file->getParent();
$lines = explode("\n", $source);
foreach ($lines as $line) {
$line = trim($line);
if (empty($line)) {
continue;
}
if (!preg_match(CSSMin::REGEX_IMPORT, $line)) {
break;
}
$importFileName = $this->getFileNameFromImportLine($line);
$importFile = $zibo->getRelativeFile(new File($parent, $importFileName));
$importFile = $zibo->getFile($importFile);
if (!$importFile) {
continue;
}
$styleFiles = $this->getFilesFromStyle($zibo, $importFile);
$files = Structure::merge($files, $styleFiles);
}
$files[$file->getPath()] = $file;
return $files;
}