if (self::$_buggy_splittext) { // workaround to solve DOMText::spliText() bug parsing multibyte strings $node = $this->_frame->get_node(); $txt0 = $node->substringData(0, $offset); $txt1 = $node->substringData($offset, mb_strlen($node->textContent) - 1); $node->replaceData(0, mb_strlen($node->textContent), $txt0); $split = $node->parentNode->appendChild(new DOMText($txt1)); } else { $split = $this->_frame->get_node()->splitText($offset); } $deco = $this->copy($split); $p = $this->get_parent(); $p->insert_child_after($deco, $this, false); if ($p instanceof Inline_Frame_Decorator) { $p->split($deco); } return $deco; } //........................................................................ function delete_text($offset, $count) { $this->_frame->get_node()->deleteData($offset, $count); } //........................................................................ function set_text($text) { $this->_frame->get_node()->data = $text; } } Text_Frame_Decorator::$_buggy_splittext = PHP_VERSION_ID < 50207;
if (self::$_buggy_splittext) { // workaround to solve DOMText::spliText() bug parsing multibyte strings $node = $this->_frame->get_node(); $txt0 = $node->substringData(0, $offset); $txt1 = $node->substringData($offset, mb_strlen($node->textContent) - 1); $node->replaceData(0, mb_strlen($node->textContent), $txt0); $split = $node->parentNode->appendChild(new DOMText($txt1)); } else { $split = $this->_frame->get_node()->splitText($offset); } $deco = $this->copy($split); $p = $this->get_parent(); $p->insert_child_after($deco, $this, false); if ($p instanceof Inline_Frame_Decorator) { $p->split($deco); } return $deco; } //........................................................................ function delete_text($offset, $count) { $this->_frame->get_node()->deleteData($offset, $count); } //........................................................................ function set_text($text) { $this->_frame->get_node()->data = $text; } } Text_Frame_Decorator::$_buggy_splittext = version_compare(PHP_VERSION, '5.2.6', '<=');