Fix for accepting non-English charsets by removing unnecessary UTF encodings

This commit is contained in:
Gautham Warrier 2014-08-11 23:33:30 +05:30
parent 0296104118
commit 2d622e40c0
2 changed files with 8 additions and 7 deletions

View File

@ -11,22 +11,23 @@
private function build_navigation($tree, $path, $current_url, $base_page, $mode) { private function build_navigation($tree, $path, $current_url, $base_page, $mode) {
$nav = ''; $nav = '';
foreach ($tree->value as $url => $node) { foreach ($tree->value as $node) {
$url = $node->uri;
if ($node->type === \TodayMade\Daux\Directory_Entry::FILE_TYPE) { if ($node->type === \TodayMade\Daux\Directory_Entry::FILE_TYPE) {
if ($node->value === 'index') continue; if ($node->value === 'index') continue;
$nav .= '<li'; $nav .= '<li';
$link = ($path === '') ? $url : $path . '/' . $url; $link = ($path === '') ? $url : $path . '/' . $url;
if ($current_url === $link) $nav .= ' class="active"'; if ($current_url === $link) $nav .= ' class="active"';
$nav .= '><a href="' . utf8_encode($base_page . $link) . '">' . utf8_encode($node->title) . '</a></li>'; $nav .= '><a href="' . $base_page . $link . '">' . $node->title . '</a></li>';
} else { } else {
$nav .= '<li'; $nav .= '<li';
$link = ($path === '') ? $url : $path . '/' . $url; $link = ($path === '') ? $url : $path . '/' . $url;
if (strpos($current_url, $link) === 0) $nav .= ' class="open"'; if (strpos($current_url, $link) === 0) $nav .= ' class="open"';
$nav .= ">"; $nav .= ">";
if ($mode === \TodayMade\Daux\Daux::STATIC_MODE) $link .= "/index.html"; if ($mode === \TodayMade\Daux\Daux::STATIC_MODE) $link .= "/index.html";
if ($node->index_page) $nav .= '<a href="' . utf8_encode($base_page . $link) . '" class="folder">' . if ($node->index_page) $nav .= '<a href="' . $base_page . $link . '" class="folder">' .
utf8_encode($node->title) . '</a>'; $node->title . '</a>';
else $nav .= '<a href="#" class="aj-nav folder">' . utf8_encode($node->title) . '</a>'; else $nav .= '<a href="#" class="aj-nav folder">' . $node->title . '</a>';
$nav .= '<ul class="nav nav-list">'; $nav .= '<ul class="nav nav-list">';
$new_path = ($path === '') ? $url : $path . '/' . $url; $new_path = ($path === '') ? $url : $path . '/' . $url;
$nav .= $this->build_navigation($node, $new_path, $current_url, $base_page, $mode); $nav .= $this->build_navigation($node, $new_path, $current_url, $base_page, $mode);
@ -46,7 +47,7 @@
if ($page['filename'] === 'index' || $page['filename'] === '_index') { if ($page['filename'] === 'index' || $page['filename'] === '_index') {
if ($page['title'] != '') $title = substr($title, 0, -1 * strlen($separator)); if ($page['title'] != '') $title = substr($title, 0, -1 * strlen($separator));
} else $title .= '<a href="' . $base_page . $page['request'] . '">' . $page['title'] . '</a>'; } else $title .= '<a href="' . $base_page . $page['request'] . '">' . $page['title'] . '</a>';
return utf8_encode($title); return $title;
} }
private function get_separator($separator) { private function get_separator($separator) {