Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -560,6 +560,15 @@ class Unl_Migration_Tool ...@@ -560,6 +560,15 @@ class Unl_Migration_Tool
$this->_blocks['optional_footer'] = $this->_get_instance_editable_content($html, 'optionalfooter'); $this->_blocks['optional_footer'] = $this->_get_instance_editable_content($html, 'optionalfooter');
$this->_blocks['footer_content'] = $this->_get_instance_editable_content($html, 'footercontent'); $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. // 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['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']); $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 ...@@ -567,6 +576,16 @@ class Unl_Migration_Tool
} }
private function _create_blocks() { 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') db_update('block_custom')
->fields(array( ->fields(array(
'body' => $this->_blocks['contact_info'], 'body' => $this->_blocks['contact_info'],
...@@ -839,6 +858,9 @@ class Unl_Migration_Tool ...@@ -839,6 +858,9 @@ class Unl_Migration_Tool
return; return;
} }
// Tidy will remove any spaces later, so we need to remove them here too.
$originalHref = trim($originalHref);
if (!$page_base) { if (!$page_base) {
$page_base = $path; $page_base = $path;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment