diff --git a/sites/all/modules/unl_migration/unl_migration.php b/sites/all/modules/unl_migration/unl_migration.php index c6faf81e6b6f1a4a760cfeda1901d4ab0250cef4..8afafc06160abc689074ac9950938cefea99f2c9 100644 --- a/sites/all/modules/unl_migration/unl_migration.php +++ b/sites/all/modules/unl_migration/unl_migration.php @@ -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;