Commit a3d99441 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Merge pull request #545 from tsteiner2/liferay-migration

Closes #543. Closes #544.
parents 33fdff2b 46e7c552
......@@ -318,7 +318,7 @@ class Unl_Migration_Tool
if (($fragmentStart = strrpos($path, '#')) !== FALSE) {
$path = substr($path, 0, $fragmentStart);
}
$path = trim($path, '/');
$path = trim($path, '/ ');
if (array_search(strtolower($path), array_map('strtolower', $this->_siteMap)) !== FALSE) {
return;
}
......@@ -560,6 +560,15 @@ class Unl_Migration_Tool
$this->_blocks['optional_footer'] = $this->_get_instance_editable_content($html, 'optionalfooter');
$this->_blocks['footer_content'] = $this->_get_instance_editable_content($html, 'footercontent');
foreach ($this->_blocks as $blockName => $block) {
$dom = new DOMDocument();
@$dom->loadHTML($block);
$linkNodes = $dom->getElementsByTagName('a');
foreach ($linkNodes as $linkNode) {
$this->_processLinks($linkNode->getAttribute('href'), '', '', '<' . $blockName . '>');
}
}
// Filter out the existing headers.
$this->_blocks['related_links'] = preg_replace('/\s*<h3>\s*Related Links\s*<\/h3>\s*/', '', $this->_blocks['related_links']);
$this->_blocks['contact_info'] = preg_replace('/\s*<h3>\sContacting Us*\s*<\/h3>\s*/', '', $this->_blocks['contact_info']);
......@@ -567,6 +576,16 @@ class Unl_Migration_Tool
}
private function _create_blocks() {
foreach ($this->_blocks as $blockName => $block) {
if (!isset($this->_hrefTransform['<' . $blockName . '>'])) {
continue;
}
foreach ($this->_hrefTransform['<' . $blockName . '>'] as $hrefTransformFrom => $hrefTransformTo) {
$this->_blocks[$blockName] = str_replace(htmlspecialchars($hrefTransformFrom), htmlspecialchars($hrefTransformTo), $block);
}
}
db_update('block_custom')
->fields(array(
'body' => $this->_blocks['contact_info'],
......@@ -838,6 +857,9 @@ class Unl_Migration_Tool
if (substr($originalHref, 0, 1) == '#') {
return;
}
// Tidy will remove any spaces later, so we need to remove them here too.
$originalHref = trim($originalHref);
if (!$page_base) {
$page_base = $path;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment