?>
			</dl>
		<?php 
        } else {
            // If there are no comments yet
            ?>
			<p><?php 
            echo $type != 'pings' ? __('No comments yet.') : __('No pings yet.', 'ktai_style');
            ?>
</p>
		<?php 
        }
    }
    ks_comments_post_link(NULL, '<div>', '</div>');
} elseif (ks_is_comment_post()) {
    $login_url = ks_get_login_url(KTAI_NOT_ECHO, ks_comments_post_url());
    if (!comments_open()) {
        ?>
		<p><?php 
        _e('Sorry, the comment form is closed at this time.');
        ?>
</p>
	<?php 
    } elseif (get_option('comment_registration') && !is_user_logged_in()) {
        if ($login_url) {
            ?>
			<p><?php 
            printf(__('You must be <a href="%s">logged in</a> to post a comment.'), esc_url($login_url));
            ?>
</p>
		<?php 
 public function bypass_admin_404()
 {
     global $Ktai_Style;
     // redirect to dashboard or login screen if accessed to non-existing URLs
     if (isset($Ktai_Style->admin)) {
         if (preg_match('!^' . ks_plugin_url(KTAI_NOT_ECHO) . KtaiStyle::ADMIN_DIR . '/!', $_SERVER['REQUEST_URI'])) {
             $sid = $Ktai_Style->admin->get_sid();
             if ($sid) {
                 $url = add_query_arg(KtaiStyle_Admin::SESSION_NAME, $sid, ks_admin_url(KTAI_NOT_ECHO));
             } else {
                 $url = ks_get_login_url();
             }
             wp_redirect($url);
             exit;
         }
     } elseif (preg_match('!wp-admin/!', $_SERVER['REQUEST_URI'])) {
         // cannot use is_admin()
         exit;
         // shut out access to non-existing admin screen
     }
 }
 public function fix_comment_reply_link($link, $args, $comment, $post)
 {
     $reply_url = add_query_arg('replytocom', $comment->comment_ID, ks_comments_post_url($post->ID));
     if (strpos($link, 'wp-login.php?redirect_to=')) {
         $url = ks_get_login_url(KTAI_NOT_ECHO, $reply_url);
         if ($url) {
             $link = $args['before'] . '<a href="' . esc_url($url) . '">' . $args['login_text'] . '</a>' . $args['after'];
         } else {
             $link = '';
         }
     } elseif ($post->post_password && !ks_post_password_required($post)) {
         if (preg_match('!<img localsrc="\\w+"[^>]*?>!s', $args['reply_text'], $icon)) {
             // <?php /* syntax hilighting fix */
             $icon = $icon[0];
             $reply_text = strip_tags($args['reply_text']);
         } else {
             $icon = '';
             $reply_text = strip_tags($args['reply_text']);
         }
         $link = _ks_internal_link($reply_url, '', $reply_text, $post->post_password, $args['before'] . $icon, $args['after']);
     } else {
         $link = $args['before'] . '<a href="' . esc_url($reply_url) . '">' . $args['reply_text'] . '</a>' . $args['after'];
     }
     return $link;
 }
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;
}