Answer the question
In order to leave comments, you need to log in
Why does Lebedev's typographer return an error?
I use Lebedev's typographer
on my test project , it has a limited size of accepted text.
I want to try breaking up the HTML into parts.
I wrote a recursive function, however, sometimes it gives this error. As I understand it, these are two broken lines. sometimes - everything is fine, often this happens if you make some changes, for example, delete one word.
Function code:
public function get_typograph_content( $content ) {
$remoteTypograf = new RemoteTypograf();
$remoteTypograf->br (false);
$remoteTypograf->p (false);
$remoteTypograf->nobr (3);
$remoteTypograf->quotA ('laquo raquo');
$remoteTypograf->quotB ('bdquo ldquo');
$contentSize = strlen($content);
if ( $contentSize < 32000 ) {
$content = $remoteTypograf->processText( $content );
return $content;
} else {
$firstPart = substr($content, 0, $contentSize/2);
$lastPart = substr($content, $contentSize/2);
$content = $this->get_typograph_content( $firstPart );
$content .= $this->get_typograph_content( $lastPart );
//var_dump($content);
return $content;
}
}
Answer the question
In order to leave comments, you need to log in
Check the text encoding, if multibyte strings, then use mb_* analogues of functions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question