Esempio n. 1
0
File: Text.php Progetto: kix/mdash
 /**
  * Расстановка защищенных тегов параграфа (<p>...</p>) и переноса строки
  *
  * @return void
  */
 protected function build_paragraphs()
 {
     $r = mb_strpos($this->_text, '<' . self::BASE64_PARAGRAPH_TAG . '>');
     $p = Util::rstrpos($this->_text, '</' . self::BASE64_PARAGRAPH_TAG . '>');
     if ($r !== false && $p !== false) {
         $beg = mb_substr($this->_text, 0, $r);
         $end = mb_substr($this->_text, $p + mb_strlen('</' . self::BASE64_PARAGRAPH_TAG . '>'));
         $this->_text = (trim($beg) ? $this->do_paragraphs($beg) . "\n" : "") . '<' . self::BASE64_PARAGRAPH_TAG . '>' . mb_substr($this->_text, $r + mb_strlen('<' . self::BASE64_PARAGRAPH_TAG . '>'), $p - ($r + mb_strlen('<' . self::BASE64_PARAGRAPH_TAG . '>'))) . '</' . self::BASE64_PARAGRAPH_TAG . '>' . (trim($end) ? "\n" . $this->do_paragraphs($end) : "");
     } else {
         $this->_text = $this->do_paragraphs($this->_text);
     }
 }