Fatal error. Sorry, I badly read the documentation of the str_replace function :(
Could you try this?
Replace:
$form = $this->using_permalinks ?
str_replace(trailingslashit($this->home), $this->get_home_url($this->curlang, true), $form) :
str_replace('</form>', '<input type="hidden" name="lang" value="'.esc_attr($this->curlang->slug).'" /></form>', $form);
by:
if ($this->using_permalinks) {
preg_match('#<form.+>#', $form, $matches);
$old = reset($matches);
$new = str_replace(trailingslashit($this->home), $this->get_home_url($this->curlang, true), $old);
$form = str_replace($old, $new, $form);
}
else
$form = str_replace('</form>', '<input type="hidden" name="lang" value="'.esc_attr($this->curlang->slug).'" /></form>', $form);