xlanguage plugin works fine again

[lang_zh]xlanguage 插件重新启用,之前总是Loop redirect。

经查,确定是以下代码出了问题[/lang_zh][lang_en]xlanguage plugin has been re-activated. Previously it makes my blog dead with an error “loop redirect”.

And per investigation, the problem was:[/lang_en]


    function permalink_url($url, $lang) {
        if ($this->options['permalink_mode'] == xLanguagePermalinkPrefix) {
            $pre = get_option('siteurl'); // Should be get_option('home')
            if (strpos($url, $pre) === 0) {
                return untrailingslashit(substr($url, 0, strlen($pre)) . '/' . xLanguageTagPermalink . '/' . $lang . substr($url, strlen($pre)));
            } else return $url;
        } 
        ...
       }