diff --git a/var/MarkdownExtraExtended.php b/var/MarkdownExtraExtended.php index 7558c6f9..674d089a 100644 --- a/var/MarkdownExtraExtended.php +++ b/var/MarkdownExtraExtended.php @@ -1516,7 +1516,7 @@ class Markdown { foreach ($blocks as $block) { # Calculate amount of space, insert spaces, insert block. $amount = $this->tab_width - - $strlen($line, 'UTF-8') % $this->tab_width; + call_user_func($strlen, $line, 'UTF-8') % $this->tab_width; $line .= str_repeat(" ", $amount) . $block; } return $line; @@ -1529,11 +1529,15 @@ class Markdown { # regular expression. # if (function_exists($this->utf8_strlen)) return; - $this->utf8_strlen = create_function('$text', 'return preg_match_all( - "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", - $text, $m);'); + $this->utf8_strlen = array($this, '_utf8_strlen'); } + protected function _utf8_strlen($text) { + return preg_match_all( + "/[\\x00-\\xBF]|[\\xC0-\\xFF][\\x80-\\xBF]*/", + $text, $m); + } + protected function unhash($text) { # @@ -2174,7 +2178,7 @@ class MarkdownExtra extends Markdown { # Calculate indent before tag. if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) { $strlen = $this->utf8_strlen; - $indent = $strlen($matches[1], 'UTF-8'); + $indent = call_user_func($strlen, $matches[1], 'UTF-8'); } else { $indent = 0; } diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php index f36ea0aa..42552643 100644 --- a/var/Widget/Archive.php +++ b/var/Widget/Archive.php @@ -619,7 +619,10 @@ class Widget_Archive extends Widget_Abstract_Contents $permalink = Typecho_Common::url($path, $this->options->index); $requestUrl = $this->request->getRequestUrl(); - if ($permalink != $requestUrl) { + $src = parse_url($permalink); + $target = parse_url($requestUrl); + + if ($src['host'] != $target['host'] || $src['path'] != $target['path']) { $this->response->redirect($permalink, true); } }