当前位置: 首页>>代码示例>>PHP>>正文


PHP txtentities函数代码示例

本文整理汇总了PHP中txtentities函数的典型用法代码示例。如果您正苦于以下问题:PHP txtentities函数的具体用法?PHP txtentities怎么用?PHP txtentities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了txtentities函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WriteHTML

 function WriteHTML($html)
 {
     $html = strip_tags($html, "<b><u><i><a><img><p><br><strong><em><font><tr><blockquote>");
     //remove all unsupported tags
     $html = str_replace("\n", ' ', $html);
     //replace carriage returns by spaces
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //explodes the string
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } else {
                 $this->Write(5, stripslashes(txtentities($e)));
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extract attributes
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:35,代码来源:html2pdf.php

示例2: WriteHTML

 function WriteHTML($indent = 0, $indentY = 0, $html)
 {
     $oldmargin = $this->lMargin;
     $this->SetX($indent);
     $this->SetY($indentY);
     $this->SetLeftMargin($indent);
     $this->SetRightMargin(15);
     $html = str_replace("&rsquo;", "'", str_replace("&lsquo;", "'", str_replace("&rdquo;", "'", str_replace("&ldquo;", "'", str_replace("&ndash;", "-", str_replace("&amp;", "&", str_replace("&lt;", "<", str_replace("&gt;", "<", str_replace("&apos;", "'", str_replace("&quot;", "\"", str_replace("&ndash;", "-", str_replace("&nbsp;", " ", $html))))))))))));
     // HTML parser
     $html = strip_tags($html, "<b><u><i><a><ul><li><img><p><br><h1><h2><h3><h4><h5><h6><h7><strong><em><font><tr><blockquote>");
     // supprime tous les tags sauf ceux reconnus
     $html = str_replace("\n", ' ', $html);
     // remplace retour à la ligne par un espace
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     // éclate la chaîne avec les balises
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             // Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } else {
                 $this->Write(4, stripslashes(txtentities($e)));
             }
         } else {
             // Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 // Extract attributes
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
     $this->SetLeftMargin($oldmargin);
     return $this->GetY() + 8;
 }
开发者ID:prodigyworks,项目名称:FA,代码行数:44,代码来源:pdfreport.php

示例3: WriteHTML

 function WriteHTML($h, $html)
 {
     //HTML parser
     $html = strip_tags($html, "<b><u><i><a><img><p><br><strong><em><font><tr><blockquote>");
     //supprime tous les tags sauf ceux reconnus
     $html = str_replace("\n", ' ', $html);
     //remplace retour àa ligne par un espace
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //éate la chaî avec les balises
     $this->ln_height = $h;
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } else {
                 $this->Write($this->ln_height, stripslashes(txtentities($e)));
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extract attributes
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:NewRoute,项目名称:lglib,代码行数:37,代码来源:PDF_HTML2File.php

示例4: WriteHTML

 function WriteHTML($html, $bi)
 {
     //remove all unsupported tags
     $this->bi = $bi;
     if ($bi) {
         $html = strip_tags($html, "<a><img><p><br><font><tr><blockquote><h1><h2><h3><h4><pre><red><blue><ul><li><hr><b><i><u><strong><em>");
     } else {
         $html = strip_tags($html, "<a><img><p><br><font><tr><blockquote><h1><h2><h3><h4><pre><red><blue><ul><li><hr>");
     }
     $html = str_replace("\n", ' ', $html);
     //replace carriage returns by spaces
     // debug
     if (isset($this->debug) && $this->debug) {
         echo $html;
         exit;
     }
     $html = str_replace('&trade;', '™', $html);
     $html = str_replace('&copy;', '©', $html);
     $html = str_replace('&euro;', '€', $html);
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     $skip = false;
     foreach ($a as $i => $e) {
         if (!$skip) {
             if ($this->HREF) {
                 $e = str_replace("\n", "", str_replace("\r", "", $e));
             }
             if ($i % 2 == 0) {
                 // new line
                 if (isset($this->ALIGN) && $this->ALIGN == 'left') {
                     $this->Cell(100, 4, $e, 0, 1, 'L');
                 }
                 if ($this->PRE) {
                     $e = str_replace("\r", "\n", $e);
                 } else {
                     $e = str_replace("\r", "", $e);
                 }
                 //Text
                 if ($this->HREF) {
                     $this->PutLink($this->HREF, $e);
                     $skip = true;
                 } else {
                     $this->Write(5, stripslashes(txtentities($e)));
                 }
             } else {
                 //Tag
                 if (substr(trim($e), 0, 1) == '/') {
                     $this->CloseTag(strtoupper(substr($e, strpos($e, '/'))));
                 } else {
                     //Extract attributes
                     $a2 = explode(' ', $e);
                     $tag = strtoupper(array_shift($a2));
                     $attr = array();
                     foreach ($a2 as $v) {
                         if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) {
                             $attr[strtoupper($a3[1])] = $a3[2];
                         }
                     }
                     $this->OpenTag($tag, $attr);
                 }
             }
         } else {
             $this->HREF = '';
             $skip = false;
         }
     }
 }
开发者ID:JozefAB,项目名称:neoacu,代码行数:66,代码来源:fpdf.php

示例5: WriteHTML

 function WriteHTML($html)
 {
     //die("****$html");
     //HTML parser
     $html = strip_tags($html, "<b><u><i><a><img><p><br><strong><em><font><tr><blockquote><hr><td><tr><table><sup>");
     //remove all unsupported tags
     $html = str_replace("\n", '', $html);
     //replace carriage returns by spaces
     $html = str_replace("\t", '', $html);
     //replace carriage returns by spaces
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //explodes the string
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } elseif ($this->tdbegin) {
                 if (trim($e) != '' and $e != "&nbsp;") {
                     $this->Cell($this->tdwidth, $this->tdheight, $e, $this->tableborder, '', $this->tdalign, $this->tdbgcolor);
                 } elseif ($e == "&nbsp;") {
                     $this->Cell($this->tdwidth, $this->tdheight, '', $this->tableborder, '', $this->tdalign, $this->tdbgcolor);
                 }
             } else {
                 $this->Write(5, stripslashes(txtentities($e)));
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extract attributes
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:rbkpro,项目名称:Cumuls,代码行数:45,代码来源:invoice.php

示例6: WriteHTML


//.........这里部分代码省略.........
             //Start of 'if/elseif's
             if ($this->titulo) {
                 $this->titulo = $e;
                 $this->Header();
             } elseif ($this->issetlist) {
                 if ($this->li) {
                     if ($this->orderedlist) {
                         $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
                         if ($this->oldx < 0) {
                             $this->oldx = $this->x + $this->GetStringWidth($this->orderedlist . '. ') + 3;
                         }
                         $this->oldx += $this->GetStringWidth($e);
                     } else {
                         $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
                         if ($this->oldx < 0) {
                             $this->oldx = $this->x + $this->GetStringWidth(chr(149)) + 3;
                         }
                         $this->oldx += $this->GetStringWidth($e);
                     }
                 }
             } elseif ($this->tablestart) {
                 if ($this->tdbegin) {
                     $this->cell[$this->row][$this->col]['textbuffer'][] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
                     $this->cell[$this->row][$this->col]['text'][] = $e;
                     if ($this->cell[$this->row][$this->col]['s'] < $this->GetStringWidth($e) + 3) {
                         $this->cell[$this->row][$this->col]['s'] = $this->GetStringWidth($e) + 3;
                     }
                 }
             } elseif ($this->divbegin) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
             } elseif ($this->pbegin) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
                 if ($this->oldx < 0) {
                     $this->oldx = $this->x + $this->GetStringWidth(' ');
                 }
                 $this->oldx += $this->GetStringWidth($e);
                 if ($this->oldx < $this->pgwidth + $this->lMargin) {
                     $this->oldy = $this->y;
                 } else {
                     $this->oldy = $this->y + 5 * (int) ($this->oldx / ($this->pgwidth + $this->lMargin));
                 }
             } elseif ($this->SUP) {
                 $this->textbuffer[] = array($e);
             } elseif ($this->SUB) {
                 $this->textbuffer[] = array($e);
             } elseif ($this->strike) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
             } elseif ($this->centertag) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
             } elseif ($this->addresstag) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', 0, $this->strike);
             } elseif ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } elseif ($this->frm_textarea) {
                 $this->textbuffer[] = array($e);
             } elseif ($this->frm_select) {
                 $this->textbuffer[] = array($e);
             } else {
                 $lineheight = 5;
                 //para compensar os H1 H2 H3 H4 usados...
                 if ($this->FontSizePt == 20) {
                     $lineheight = 7;
                 }
                 if ($this->FontSizePt == 16) {
                     $lineheight = 6;
                 }
                 if ($this->FontSizePt == 11) {
                     $lineheight = 5;
                 }
                 if ($this->FontSizePt == 8) {
                     $lineheight = 4;
                 }
                 $this->Write($lineheight, stripslashes(txtentities($e)));
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 $regexp = '/ (\\w+?)=([^\\s>"]+)/si';
                 // change algo=algo to algo="algo" (only do this when this happens inside tags)
                 $e = preg_replace($regexp, " \$1=\"\$2\"", $e);
                 //Extract attributes
                 $contents = array();
                 preg_match_all('/\\S*=["\'][^"\']*["\']/', $e, $contents);
                 preg_match('/\\S+/', $e, $a2);
                 $tag = strtoupper($a2[0]);
                 $attr = array();
                 if (!empty($contents)) {
                     foreach ($contents[0] as $v) {
                         if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                             $attr[strtoupper($a3[1])] = $a3[2];
                         }
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:html2fpdf.php

示例7: WriteHTML

 function WriteHTML($html)
 {
     $this->B = 0;
     $this->I = 0;
     $this->U = 0;
     $this->HREF = '';
     $this->tableborder = 0;
     $this->tdbegin = false;
     $this->tdwidth = 0;
     $this->tdheight = 0;
     $this->tdalign = "L";
     $this->tdbgcolor = false;
     $this->oldx = 0;
     $this->oldy = 0;
     $this->fontlist = array("arial", "times", "courier", "helvetica", "symbol");
     $this->issetfont = false;
     $this->issetcolor = false;
     $html = strip_tags($html, "<b><u><i><a><img><p><br><strong><em><font><tr><blockquote><hr><td><tr><table><sup>");
     //remove all unsupported tags
     $html = str_replace("\n", '', $html);
     //replace carriage returns by spaces
     $html = str_replace("\t", '', $html);
     //replace carriage returns by spaces
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //explodes the string
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } elseif ($this->tdbegin) {
                 if (trim($e) != '' && $e != "&nbsp;") {
                     $this->Cell($this->tdwidth, $this->tdheight, $e, $this->tableborder, '', $this->tdalign, $this->tdbgcolor);
                 } elseif ($e == "&nbsp;") {
                     $this->Cell($this->tdwidth, $this->tdheight, '', $this->tableborder, '', $this->tdalign, $this->tdbgcolor);
                 }
             } else {
                 $this->Write(5, stripslashes(txtentities($e)));
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extract attributes
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:akivaron,项目名称:toko,代码行数:58,代码来源:PDF_Quotation.php

示例8: WriteHTML

 function WriteHTML($html, $bi)
 {
     //remove all unsupported tags
     $this->bi = $bi;
     if ($bi) {
         $html = strip_tags($html, "<a><img><p><br><font><tr><blockquote><h1><h2><h3><h4><pre><red><blue><ul><li><hr><b><i><u><strong><em>");
     } else {
         $html = strip_tags($html, "<a><img><p><br><font><tr><blockquote><h1><h2><h3><h4><pre><red><blue><ul><li><hr>");
     }
     $html = str_replace("\n", ' ', $html);
     //replace carriage returns by spaces
     $str = array('<br />' => '<br>', '<hr />' => '<hr>', '[r]' => '<red>', '[/r]' => '</red>', '[l]' => '<blue>', '[/l]' => '</blue>', '&#8220;' => '"', '&#8221;' => '"', '&#8222;' => '"', '&#8230;' => '...', '&#8217;' => '\'', '&rsquo;' => '\'', '^' => 'ˆ');
     foreach ($str as $_from => $_to) {
         $html = str_replace($_from, $_to, $html);
     }
     // debug
     if ($this->debug) {
         echo $html;
         exit;
     }
     $html = str_replace('&trade;', '™', $html);
     $html = str_replace('&copy;', '©', $html);
     $html = str_replace('&euro;', 'ˆ', $html);
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     $skip = false;
     foreach ($a as $i => $e) {
         if (!$skip) {
             if ($this->HREF) {
                 $e = str_replace("\n", "", str_replace("\r", "", $e));
             }
             if ($i % 2 == 0) {
                 // new line
                 if ($this->PRE) {
                     $e = str_replace("\r", "\n", $e);
                 } else {
                     $e = str_replace("\r", "", $e);
                 }
                 //Text
                 if ($this->HREF) {
                     $this->PutLink($this->HREF, $e);
                     $skip = true;
                 } else {
                     $this->Write(5, stripslashes(txtentities($e)));
                 }
             } else {
                 //Tag
                 if (substr(trim($e), 0, 1) == '/') {
                     $this->CloseTag(strtoupper(substr($e, strpos($e, '/'))));
                 } else {
                     //Extract attributes
                     $a2 = explode(' ', $e);
                     $tag = strtoupper(array_shift($a2));
                     $attr = array();
                     foreach ($a2 as $v) {
                         if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                             $attr[strtoupper($a3[1])] = $a3[2];
                         }
                     }
                     $this->OpenTag($tag, $attr);
                 }
             }
         } else {
             $this->HREF = '';
             $skip = false;
         }
     }
 }
开发者ID:gimoz71,项目名称:Agenzia-Radar,代码行数:67,代码来源:html2pdf.php

示例9: WriteHTMLHeader

 /**
  * WriteHeader()
  * Gibt den formatieten Header fest aus.
  * @param string $html
  */
 function WriteHTMLHeader($html)
 {
     $a = $this->splitTag($html);
     $iz = 0;
     // Standard Zähler
     $txtZ = 0;
     // Textzähler
     $vtxZ = 0;
     // Textzähler nur wenn Text vorhanden
     $tagZ = 0;
     // Tagzähler (wird hier nur gemehrt, wenn ein IMG Tag vorhanden ist)
     $width = 197;
     // PAgeWidth in mm
     foreach ($a as $i => $e) {
         $iz++;
         /**
          * Jede zweite Zeile ist Text oder leer
          */
         // TEXT
         if ($i % 2 == 0) {
             $txtZ++;
             if (trim($e) != '' && $e != "&nbsp;") {
                 $vtxZ++;
                 switch ($vtxZ) {
                     case 1:
                         $this->SetY(10);
                         $this->SetFontSize(15);
                         break;
                     case 2:
                         $this->ln(4);
                         $this->SetFontSize(9);
                         break;
                     case 3:
                         $this->ln(7);
                         $this->SetFontSize(8);
                         break;
                     case 4:
                         $this->ln(7);
                         $this->SetFontSize(10);
                         break;
                     case 5:
                         $this->ln(3);
                         $this->SetFontSize(8);
                         break;
                     case 6:
                         $this->ln(3);
                         $this->SetFontSize(8);
                         break;
                 }
                 $this->SetX($width - $this->GetStringWidth($e));
                 $this->Write(5, stripslashes(txtentities($e)));
                 $this->SetFontSize(7);
             }
         } else {
             $aTag = $this->extractTag($e);
             $tag = $aTag['tag'];
             $attr = $aTag['attr'];
             if ($tag == "IMG") {
                 $tagZ++;
                 switch ($tagZ) {
                     case 1:
                         if (!strstr($attr['SRC'], "blank.gif")) {
                             $this->Image($attr['SRC'], 10, 25, px2mm(300), px2mm(65));
                         }
                         break;
                     case 2:
                         $this->Image($attr['SRC'], $width - px2mm(70), $vtxZ * 7, px2mm(70), px2mm(70));
                         break;
                 }
             }
         }
     }
 }
开发者ID:angstmann82,项目名称:flybook,代码行数:78,代码来源:html_table_parser.php

示例10: WriteHTML

 function WriteHTML($html)
 {
     //Parseur HTML
     $html = str_replace("\n", ' ', $html);
     //remplace retour à la ligne par un espace
     $html = strip_tags($html, '<h1><h2><h3><h4><h5><h6><b><u><i><a><img><p><br><strong><em><font><tr><blockquote>');
     //supprime tous les tags sauf ceux reconnus
     //$html=strip_tags($html,'<a><img><p><br><strong><em><font><tr><blockquote>'); //supprime tous les tags sauf ceux reconnus
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //éclate la chaîne avec les balises
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Texte
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } else {
                 $this->Write(5, stripslashes(txtentities($e)));
             }
         } else {
             //Balise
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extraction des attributs
                 $a2 = explode(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $attr = array();
                 foreach ($a2 as $v) {
                     if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                         $attr[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $attr);
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:wikiplug,代码行数:37,代码来源:pdf.php


注:本文中的txtentities函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。