Skip to content

Commit

Permalink
v 0.5.4 r3
Browse files Browse the repository at this point in the history
fix template bug
  • Loading branch information
Prev committed Nov 16, 2013
1 parent d983e2b commit e7b09ef
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions lib/classes/TemplateHandler.class.php
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ private function _compileTemplate($html, $module=NULL, $relativePath='/') {
// insert module realitve url in relative src (./.*), href and action
$html = preg_replace_callback('`((?:src|href|action)=(?:\"|\'))(.*?)((?:\"|\'))`i', array($this, 'parseUrl'), $html);
$html = preg_replace_callback('/(<style[\s\S]*?url\((?:\'|\")?)(.*?)((?:\'|\")\))/i', array($this, 'parseUrl'), $html);
$html = preg_replace_callback('/(style=(?:"|\').*?url\()(.*)?(\))/i', array($this, 'parseUrl'), $html);
$html = preg_replace_callback('/(style=(?:"|\').*?url\((?:"|\'))(.*)?(\))/i', array($this, 'parseUrl'), $html);

// targetie condition
$html = preg_replace('`<condition\s+targetie\s*=\s*"([^"]+)"\s*>([\s\S]*?)</condition>`i', '<!--[if $1]>$2<![endif]-->', $html);
@@ -307,10 +307,6 @@ private function parseSwitches($matches) {


private function deleteWhiteSpace($content) {
if (strpos($content, '> ') !== false) {
$content = str_replace('> ', '>', $content);
return $this->deleteWhiteSpace($content);
}
if (strpos($content, ">\t") !== false) {
$content = str_replace(">\t", '>', $content);
return $this->deleteWhiteSpace($content);
@@ -323,12 +319,7 @@ private function deleteWhiteSpace($content) {
$content = str_replace(">\n", '>', $content);
return $this->deleteWhiteSpace($content);
}


if (strpos($content, '< ') !== false) {
$content = str_replace('< ', '<', $content);
return $this->deleteWhiteSpace($content);
}

if (strpos($content, "<\t") !== false) {
$content = str_replace("<\t", '<', $content);
return $this->deleteWhiteSpace($content);
@@ -341,12 +332,7 @@ private function deleteWhiteSpace($content) {
$content = str_replace("<\n", '<', $content);
return $this->deleteWhiteSpace($content);
}


if (strpos($content, ' <?php') !== false) {
$content = str_replace(' <?php', '<?php', $content);
return $this->deleteWhiteSpace($content);
}

if (strpos($content, "\t<?php") !== false) {
$content = str_replace("\t<?php", '<?php', $content);
return $this->deleteWhiteSpace($content);
@@ -359,12 +345,7 @@ private function deleteWhiteSpace($content) {
$content = str_replace("\n<?php", '<?php', $content);
return $this->deleteWhiteSpace($content);
}


if (strpos($content, '?> ') !== false) {
$content = str_replace('?> ', '?>', $content);
return $this->deleteWhiteSpace($content);
}

if (strpos($content, "?>\t") !== false) {
$content = str_replace("?>\t", '?>', $content);
return $this->deleteWhiteSpace($content);

0 comments on commit e7b09ef

Please sign in to comment.