Example #1
0
             $data_body[$p] .= strlen($total['rtp_audio_in_mos']) > 0 ? $fields['rtp_audio_in_mos'] : null;
         }
         $data_body[$p] .= '</td>';
         $data_body[$p] .= '<td width="2%"></td>';
         $data_body[$p] .= '<td width="15%">' . ucwords(strtolower(str_replace("_", " ", $fields['hangup_cause']))) . '</td>';
         $data_body[$p] .= '</tr>';
         $z++;
         $p++;
         if ($p == 60) {
             //output data
             $data_body_chunk = $data_start . $data_head;
             foreach ($data_body as $data_body_row) {
                 $data_body_chunk .= $data_body_row;
             }
             $data_body_chunk .= $data_end;
             $pdf->writeHTML($data_body_chunk, true, false, false, false, '');
             unset($data_body_chunk);
             unset($data_body);
             $p = 0;
             //add new page
             $pdf->AddPage('L', array($page_width, $page_height));
         }
     }
 }
 //write divider
 $data_footer = '<tr><td colspan="12"></td></tr>';
 //write totals
 $data_footer .= '<tr>';
 $data_footer .= '<td><b>' . $text['label-total'] . '</b></td>';
 $data_footer .= '<td>' . $z . '</td>';
 $data_footer .= '<td colspan="3"></td>';
 public function WriteHTML($html)
 {
     if (trim($html) == "") {
         return;
     }
     if ($this instanceof TCPDF) {
         return parent::writeHTML($html);
     }
     $this->sizeStack[] = $this->getFontSize();
     $html = str_replace("\n", "", $html);
     $html = preg_replace('/<!--\\[if[^\\]]*]>.*?<!\\[endif\\]-->/i', '', $html);
     $bad = array("&gt;", "&lt;", "&amp;");
     $good = array("::gt::", "::lt::", "::amp::");
     libxml_use_internal_errors(true);
     try {
         $xml = new SimpleXMLElement(str_replace($good, $bad, "<phynx>" . html_entity_decode(str_replace($bad, $good, $html), ENT_NOQUOTES, "UTF-8") . "</phynx>"));
     } catch (Exception $e) {
         try {
             $tidy = new tidy();
             $tidy->parseString($html, array("show-body-only" => true, "output-xhtml" => true, "wrap" => 0), 'utf8');
             $tidy->cleanRepair();
             $xml = new SimpleXMLElement(str_replace($good, $bad, "<phynx>" . html_entity_decode(str_replace($bad, $good, $tidy), ENT_NOQUOTES, "UTF-8") . "</phynx>"));
         } catch (Exception $e) {
             $errors = "";
             foreach (libxml_get_errors() as $error) {
                 #echo "\t", $error->message;
                 $errors .= htmlentities(trim($error->message)) . "<br />";
             }
             $xml = new SimpleXMLElement("<phynx><p style=\"color:#dd0000;\">Der Textbaustein konnte nicht geladen werden:<br />{$errors}</p></phynx>");
         }
     }
     $this->translateXML($xml);
 }