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


PHP AdjustHTML函数代码示例

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


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

示例1: PDF_html_2_pdf

function PDF_html_2_pdf($data)
{
    global $auth;
    $pdf = new HTML2FPDF();
    $pdf->UseCSS();
    $pdf->UseTableHeader();
    $pdf->AddPage();
    $pdf->WriteHTML(AdjustHTML($data));
    $pdf->Output();
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:10,代码来源:lib_PDF.php

示例2: WriteHTML

 function WriteHTML($html)
 {
     //! @desc HTML parser
     //! @return void
     /* $e == content */
     $this->ReadMetaTags($html);
     $html = AdjustHTML($html, $this->usepre);
     //Try to make HTML look more like XHTML
     if ($this->usecss) {
         $html = $this->ReadCSS($html);
     }
     //Add new supported tags in the DisableTags function
     $html = str_replace('<?php', '< ', $html);
     //Fix '<?XML' bug from HTML code generated by MS Word
     //$html = str_replace ("%2", "/", $html);
     $html = strip_tags($html, $this->enabledtags);
     //remove all unsupported tags, but the ones inside the 'enabledtags' string
     //Explode the string in order to parse the HTML code
     $a = preg_split('/<(.*?)>/ms', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //TEXT
             //Adjust lineheight
             //            $this->lineheight = (5*$this->FontSizePt)/11; //should be inside printbuffer?
             //Adjust text, if needed
             if (strpos($e, "&") !== false) {
                 if (strpos($e, "#") !== false) {
                     $e = value_entity_decode($e);
                 }
                 // Decode value entities
                 //Avoid crashing the script on PHP 4.0
                 $version = phpversion();
                 $version = str_replace('.', '', $version);
                 if ($version >= 430) {
                     $e = html_entity_decode($e, ENT_QUOTES, 'cp1252');
                 } else {
                     $e = lesser_entity_decode($e);
                 }
             }
             $e = str_replace(chr(160), chr(32), $e);
             //unify ascii code of spaces (in order to recognize all of them correctly)
             if (strlen($e) == 0) {
                 continue;
             }
             if ($this->divrevert) {
                 $e = strrev($e);
             }
             if ($this->toupper) {
                 $e = strtoupper($e);
             }
             if ($this->tolower) {
                 $e = strtolower($e);
             }
             //Start of 'if/elseif's
             if ($this->titulo) {
                 $this->SetTitle($e);
             } elseif ($this->specialcontent) {
                 if ($this->specialcontent == "type=select" and $this->selectoption['ACTIVE'] == true) {
                     $stringwidth = $this->GetStringWidth($e);
                     if (!isset($this->selectoption['MAXWIDTH']) or $stringwidth > $this->selectoption['MAXWIDTH']) {
                         $this->selectoption['MAXWIDTH'] = $stringwidth;
                     }
                     if (!isset($this->selectoption['SELECTED']) or $this->selectoption['SELECTED'] == '') {
                         $this->selectoption['SELECTED'] = $e;
                     }
                 } else {
                     $this->textbuffer[] = array("???" . $this->specialcontent . "???" . $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, '', $this->strike, $this->outlineparam, $this->bgcolorarray);
                     $this->cell[$this->row][$this->col]['text'][] = $e;
                     $this->cell[$this->row][$this->col]['s'] += $this->GetStringWidth($e);
                 }
                 //Ignore content between <table>,<tr> and a <td> tag (this content is usually only a bunch of spaces)
             } elseif ($this->pbegin or $this->HREF or $this->divbegin or $this->SUP or $this->SUB or $this->strike or $this->buffer_on) {
                 $this->textbuffer[] = array($e, $this->HREF, $this->currentstyle, $this->colorarray, $this->currentfont, $this->SUP, $this->SUB, '', $this->strike, $this->outlineparam, $this->bgcolorarray);
             } else {
                 if ($this->blockjustfinished) {
                     $e = ltrim($e);
                 }
                 if ($e != '') {
                     $this->Write($this->lineheight, $e);
                     //Write text directly in the PDF
                     if ($this->pjustfinished) {
                         $this->pjustfinished = false;
                     }
                 }
             }
         } else {
             $this->colorarray = array();
             $this->strike = false;
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 $regexp = '|=\'(.*?)\'|s';
                 // eliminate single quotes, if any
                 $e = preg_replace($regexp, "=\"\$1\"", $e);
                 $regexp = '| (\\w+?)=([^\\s>"]+)|si';
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:html2fpdf.php

示例3: stripslashes

<?php

require_once "setPDF.php";
// เพิ่มหน้าใน PDF
$pdf->AddPage();
// กำหนด HTML code หรือรับค่าจากตัวแปรที่ส่งมา
//	กรณีกำหนดโดยตรง
//	ตัวอย่าง กรณีรับจากตัวแปร
// $htmlcontent =$_POST['HTMLcode'];
$htmlcontent = '<p>ทดสอบ</p>';
$htmlcontent = stripslashes($htmlcontent);
$htmlcontent = AdjustHTML($htmlcontent);
// สร้างเนื้อหาจาก  HTML code
$pdf->writeHTML($htmlcontent, true, 0, true, 0);
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->lastPage();
// ปิดและสร้างเอกสาร PDF
$pdf->Output('test.pdf', 'I');
开发者ID:robocon,项目名称:iopr,代码行数:18,代码来源:html2pdf.php

示例4: WriteHTML

 function WriteHTML($html)
 {
     //! @desc HTML parser
     //! @return void
     /* $e == content */
     if (!$this->usetitle) {
         $regexp = '/<title>.*?<\\/title>/si';
         // eliminate <TITLE> content </TITLE>
         $html = preg_replace($regexp, '', $html);
     }
     AdjustHTML($html, $this->usepre);
     $html = $this->CreateInternalLinks($html);
     if ($this->usecss) {
         $html = $this->ReadCSS($html);
     }
     //Add new supported tags in the DisableTags function
     $html = strip_tags($html, $this->enabledtags);
     //remove all unsupported tags, but the ones inside the 'enabledtags' string
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     //explodes the string
     foreach ($a as $i => $e) {
         //echo "i=[" . $i . "]  e[" . $e ."]   pbegin[".$this->pbegin."]<br/>\n";
         if ($i % 2 == 0) {
             //TEXT
             //Prepare text, if needed
             if (strlen($e) == 0) {
                 continue;
             }
             if ($this->divrevert) {
                 $e = strrev($e);
             }
             if ($this->toupper) {
                 $e = strtoupper($e);
             }
             if ($this->tolower) {
                 $e = strtolower($e);
             }
             if ($this->cssbegin and !$this->tablestart) {
                 if ($this->divwidth == 0) {
                     $this->divwidth = $this->GetStringWidth($e);
                 }
                 if ($this->divheight == 0) {
                     $this->divheight = 5;
                 }
                 $bak_x = $this->x;
                 //  			  if (!$this->divbegin) $this->x = $this->oldx + $this->GetStringWidth($e) - $this->cMargin;
                 if (!$this->divbegin and $this->oldx > 0) {
                     $this->x = $this->oldx;
                 }
                 if ($this->divbgcolor) {
                     $this->Cell($this->divwidth, $this->divheight, '', $this->divborder, '', $this->divalign, $this->divbgcolor);
                 }
                 if ($this->dash_on) {
                     $this->Rect($this->x - $this->divwidth, $this->y, $this->divwidth, $this->divheight);
                 }
                 if ($this->dotted_on) {
                     $this->DottedRect($this->x - $this->divwidth, $this->y, $this->divwidth, $this->divheight);
                 }
                 $this->x = $bak_x;
             }
             //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));
//.........这里部分代码省略.........
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:html2fpdf.php


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