$menu_items = array();
foreach ($menu as $item) {
    // 0 = name, 1 = capability, 2 = file
    $is_current = strcmp($self, $item[2]) == 0 && empty($parent_file) || $parent_file && $item[2] == $parent_file;
    if (!empty($submenu[$item[2]])) {
        $submenu[$item[2]] = array_values($submenu[$item[2]]);
        // Re-index.
        $m = array('link' => $submenu[$item[2]][0][2], 'desc' => $item[0]);
    } else {
        if (current_user_can($item[1])) {
            $m = array('link' => $item[2], 'desc' => $item[0]);
        }
    }
    if ($is_current) {
        $menu_items[] = $m['desc'];
    } else {
        $menu_items[] = '<a href="' . esc_attr($m['link']) . '">' . $m['desc'] . '</a>';
    }
}
echo implode(' | ', $menu_items);
printf(' [<a href="%s">' . __('Log out') . '</a>]', ks_get_logout_url());
echo '<br />';
if ($Ktai_Style->get('cookie_available')) {
    ks_ordered_link(0, 0, ks_blogurl(KTAI_NOT_ECHO), __('Visit Site with logged in', 'ktai_style'));
} else {
    ?>
<img localsrc="1" alt="!" /><font color="red"><?php 
    _e('DO NOT bookmark this page. DO NOT tell others the URL of this page.', 'ktai_style');
    ?>
</font><br /><?php 
}
			<?php 
            echo implode("<br />", array_map('esc_html', explode("\n", $ks_commentdata['message'])));
            ?>
			</font></p> 
		<?php 
        }
        ks_require_term_id_form(ks_plugin_url(KTAI_NOT_ECHO) . 'comments-post.php');
        ks_fix_encoding_form();
        if (is_user_logged_in()) {
            ks_session_id_form();
            ?>
			<p><?php 
            printf(__('Logged in as %s.', 'ktai_style'), esc_html($user_identity));
            ?>
 [<a href="<?php 
            echo esc_url(ks_get_logout_url(KTAI_NOT_ECHO, ks_comments_post_url()));
            ?>
"><?php 
            _e('Log out');
            ?>
</a>]<br /><?php 
            if (!ks_cookie_available()) {
                ?>
<small><?php 
                _e('Note: Ater posting a comment, you are automatically logged out.', 'ktai_style');
                ?>
</small><br /><?php 
            }
        } else {
            if ($login_url) {
                ?>
function ks_login_link()
{
    $defaults = array('before' => '', 'after' => '', 'echo' => true, 'accesskey' => '', 'anchor' => __('Log in'), 'anchor_logout' => __('Log out'), 'before_logout' => NULL, 'after_logout' => NULL);
    $r = _ks_parse_arg(func_get_args(), $defaults);
    global $Ktai_Style;
    $output = '';
    if (isset($Ktai_Style->admin)) {
        if (is_user_logged_in()) {
            $url = ks_get_logout_url();
            if (isset($r['label_logout'])) {
                // backward compati
                $r['anchor_logout'] = $r['label_logout'];
            }
            $anchor = $r['anchor_logout'];
            $before = isset($r['before_logout']) ? $r['before_logout'] : $r['before'];
            $after = isset($r['after_logout']) ? $r['after_logout'] : $r['after'];
        } else {
            $url = ks_get_login_url();
            if (isset($r['label'])) {
                // backward compati
                $r['anchor'] = $r['label'];
            }
            $anchor = $r['anchor'];
            $before = $r['before'];
            $after = $r['after'];
        }
        $output = $before . sprintf('<a href="%s"%s>%s</a>', $url, ks_accesskey_html($r['accesskey']), $anchor) . $after;
        if ($r['echo']) {
            echo $output;
        }
    }
    return $output;
}