Removed commented code and relevant method externalReferencesFor

This commit is contained in:
Stig Lindqvist 2013-11-08 14:06:48 +13:00 committed by Daniel Hensby
parent dfbfd7fbbc
commit 9821120d72
2 changed files with 1 additions and 58 deletions

View File

@ -304,32 +304,6 @@ class FilesystemPublisher extends StaticPublisher {
);
}
// Add externals
/*
$externals = $this->externalReferencesFor($content);
if($externals) foreach($externals as $external) {
// Skip absolute URLs
if(preg_match('/^[a-zA-Z]+:\/\//', $external)) continue;
// Drop querystring parameters
$external = strtok($external, '?');
if(file_exists("../" . $external)) {
// Break into folder and filename
if(preg_match('/^(.*\/)([^\/]+)$/', $external, $matches)) {
$files[$external] = array(
"Copy" => "../$external",
"Folder" => $matches[1],
"Filename" => $matches[2],
);
} else {
user_error("Can't parse external: $external", E_USER_WARNING);
}
} else {
$missingFiles[$external] = true;
}
}*/
}
//return config to its previous state

View File

@ -179,39 +179,8 @@ abstract class StaticPublisher extends DataExtension {
}
/**
* Get all external references to CSS, JS,
*/
public function externalReferencesFor($content) {
$CLI_content = escapeshellarg($content);
$tidy = `echo $CLI_content | tidy -numeric -asxhtml`;
$tidy = preg_replace('/xmlns="[^"]+"/','', $tidy);
$xContent = new SimpleXMLElement($tidy);
$xlinks = array(
"//link[@rel='stylesheet']/@href" => false,
"//script/@src" => false,
"//img/@src" => false,
"//a/@href" => true,
);
$urls = array();
foreach($xlinks as $xlink => $assetsOnly) {
$matches = $xContent->xpath($xlink);
if($matches) foreach($matches as $item) {
$url = $item . '';
if($assetsOnly && substr($url,0,7) != ASSETS_DIR . '/') continue;
$urls[] = $url;
}
}
return $urls;
}
/**
*
* @param string $url
*
* @return array
*/
public function getMetadata($url) {