protected function getCombinedDataPart($linkData, $linkPath) { return '// FILE: ' . SpeedOut_Utils::getPathUri($linkPath) . "\n\n{$linkData}\n\n"; }
/** * @expectedException SpeedOut_Exception */ public function testGetPathUriValidatesDocumentRoot() { SpeedOut_Utils::getPathUri(dirname(SpeedOut_Utils::getDocRoot())); }
protected function getLinkData($linkPath) { if (!SpeedOut_Utils::isExternalLink($linkPath) && !is_file($linkPath)) { throw new SpeedOut_DataHandler_Combiner_Exception_PathNotFound($linkPath, '[link "' . SpeedOut_Utils::getPathUri($linkPath) . '" in HTML]'); } $linkData = file_get_contents($linkPath); $this->handleLinkedFileData($linkData, $linkPath); return $linkData; }
public function getUrl($id) { if (is_file($this->getFilePathById($id))) { return SpeedOut_Utils::getPathUrl(SpeedOut_Utils::getDocRoot()) . SpeedOut_Utils::getPathUri($this->getFilePathById($id)); } }
protected function replaceRelationalLinksInLinkData(&$linkedFileData, $linkPath) { $internalLinksReplaces = array(); $linksBaseDir = dirname($linkPath); if (SpeedOut_Utils::safePregMatchAll('~[\'"\\(]\\s*([\\:\\w-_\\./\\\\]+?\\.[\\w]{3,4})\\s*[\'"\\)]~', $linkedFileData, $m)) { foreach ($m[1] as $internalLink) { if (SpeedOut_Utils::isRelativeLink($internalLink)) { $internalLinkPath = SpeedOut_Utils::getLinkPath($internalLink, $linksBaseDir); $internalLinkUri = SpeedOut_Utils::getPathUri($internalLinkPath); if ($this->isValidInternalLink($internalLinkPath, $linkPath)) { $internalLinksReplaces[$internalLink] = $internalLinkUri; } } } } foreach ($this->getInternalLinksPaths($linkedFileData) as $internalLink => $internalLinkPath) { if (SpeedOut_Utils::isRelativeLink($internalLink)) { } } if ($internalLinksReplaces) { $linkedFileData = str_replace(array_keys($internalLinksReplaces), $internalLinksReplaces, $linkedFileData); } }