1<?php 2 3namespace Mpdf\Tag; 4 5class Br extends Tag 6{ 7 8 public function open($attr, &$ahtml, &$ihtml) 9 { 10 // Added mPDF 3.0 Float DIV - CLEAR 11 if (isset($attr['STYLE'])) { 12 $properties = $this->cssManager->readInlineCSS($attr['STYLE']); 13 if (isset($properties['CLEAR'])) { 14 $this->mpdf->ClearFloats(strtoupper($properties['CLEAR']), $this->mpdf->blklvl); 15 } // *CSS-FLOAT* 16 } 17 18 // mPDF 6 bidi 19 // Inline 20 // If unicode-bidi set, any embedding levels, isolates, or overrides started by 21 // the inline box are closed at the br and reopened on the other side 22 $blockpre = ''; 23 $blockpost = ''; 24 if (isset($this->mpdf->blk[$this->mpdf->blklvl]['bidicode'])) { 25 $blockpre = $this->mpdf->_setBidiCodes('end', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']); 26 $blockpost = $this->mpdf->_setBidiCodes('start', $this->mpdf->blk[$this->mpdf->blklvl]['bidicode']); 27 } 28 29 // Inline 30 // If unicode-bidi set, any embedding levels, isolates, or overrides started by 31 // the inline box are closed at the br and reopened on the other side 32 $inlinepre = ''; 33 $inlinepost = ''; 34 $iBDF = []; 35 if (count($this->mpdf->InlineBDF)) { 36 foreach ($this->mpdf->InlineBDF as $k => $ib) { 37 foreach ($ib as $ib2) { 38 $iBDF[$ib2[1]] = $ib2[0]; 39 } 40 } 41 if (count($iBDF)) { 42 ksort($iBDF); 43 for ($i = count($iBDF) - 1; $i >= 0; $i--) { 44 $inlinepre .= $this->mpdf->_setBidiCodes('end', $iBDF[$i]); 45 } 46 for ($i = 0; $i < count($iBDF); $i++) { 47 $inlinepost .= $this->mpdf->_setBidiCodes('start', $iBDF[$i]); 48 } 49 } 50 } 51 52 /* -- TABLES -- */ 53 if ($this->mpdf->tableLevel) { 54 if ($this->mpdf->blockjustfinished) { 55 $this->mpdf->_saveCellTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost); 56 } 57 58 $this->mpdf->_saveCellTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost); 59 if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) { 60 $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']; 61 } elseif ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] < $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']) { 62 $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'] = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s']; 63 } 64 $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] = 0; // reset 65 } else { 66 /* -- END TABLES -- */ 67 if (count($this->mpdf->textbuffer)) { 68 $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0] = preg_replace( 69 '/ $/', 70 '', 71 $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0] 72 ); 73 if (!empty($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][18])) { 74 $this->otl->trimOTLdata($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][18], false); 75 } // *OTL* 76 } 77 $this->mpdf->_saveTextBuffer($blockpre . $inlinepre . "\n" . $inlinepost . $blockpost); 78 } // *TABLES* 79 $this->mpdf->ignorefollowingspaces = true; 80 $this->mpdf->blockjustfinished = false; 81 82 $this->mpdf->linebreakjustfinished = true; 83 } 84 85 public function close(&$ahtml, &$ihtml) 86 { 87 } 88} 89