mirror of
https://github.com/typecho/typecho.git
synced 2025-03-20 01:49:40 +01:00
Merge branch 'master' of https://github.com/typecho/typecho
This commit is contained in:
commit
c21474545c
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user