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


PHP TCPDF_STATIC::isValidURL方法代码示例

本文整理汇总了PHP中TCPDF_STATIC::isValidURL方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_STATIC::isValidURL方法的具体用法?PHP TCPDF_STATIC::isValidURL怎么用?PHP TCPDF_STATIC::isValidURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF_STATIC的用法示例。


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

示例1: Annotation

 /**
  * Puts a markup annotation on a rectangular area of the page.
  * !!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!
  * @param $x (float) Abscissa of the upper-left corner of the rectangle
  * @param $y (float) Ordinate of the upper-left corner of the rectangle
  * @param $w (float) Width of the rectangle
  * @param $h (float) Height of the rectangle
  * @param $text (string) annotation text or alternate content
  * @param $opt (array) array of options (see section 8.4 of PDF reference 1.7).
  * @param $spaces (int) number of spaces on the text to link
  * @public
  * @since 4.0.018 (2008-08-06)
  */
 public function Annotation($x, $y, $w, $h, $text, $opt = array('Subtype' => 'Text'), $spaces = 0)
 {
     if ($this->inxobj) {
         // store parameters for later use on template
         $this->xobjects[$this->xobjid]['annotations'][] = array('x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'text' => $text, 'opt' => $opt, 'spaces' => $spaces);
         return;
     }
     if ($x === '') {
         $x = $this->x;
     }
     if ($y === '') {
         $y = $this->y;
     }
     // check page for no-write regions and adapt page margins if necessary
     list($x, $y) = $this->checkPageRegions($h, $x, $y);
     // recalculate coordinates to account for graphic transformations
     if (isset($this->transfmatrix) and !empty($this->transfmatrix)) {
         for ($i = $this->transfmatrix_key; $i > 0; --$i) {
             $maxid = count($this->transfmatrix[$i]) - 1;
             for ($j = $maxid; $j >= 0; --$j) {
                 $ctm = $this->transfmatrix[$i][$j];
                 if (isset($ctm['a'])) {
                     $x = $x * $this->k;
                     $y = ($this->h - $y) * $this->k;
                     $w = $w * $this->k;
                     $h = $h * $this->k;
                     // top left
                     $xt = $x;
                     $yt = $y;
                     $x1 = $ctm['a'] * $xt + $ctm['c'] * $yt + $ctm['e'];
                     $y1 = $ctm['b'] * $xt + $ctm['d'] * $yt + $ctm['f'];
                     // top right
                     $xt = $x + $w;
                     $yt = $y;
                     $x2 = $ctm['a'] * $xt + $ctm['c'] * $yt + $ctm['e'];
                     $y2 = $ctm['b'] * $xt + $ctm['d'] * $yt + $ctm['f'];
                     // bottom left
                     $xt = $x;
                     $yt = $y - $h;
                     $x3 = $ctm['a'] * $xt + $ctm['c'] * $yt + $ctm['e'];
                     $y3 = $ctm['b'] * $xt + $ctm['d'] * $yt + $ctm['f'];
                     // bottom right
                     $xt = $x + $w;
                     $yt = $y - $h;
                     $x4 = $ctm['a'] * $xt + $ctm['c'] * $yt + $ctm['e'];
                     $y4 = $ctm['b'] * $xt + $ctm['d'] * $yt + $ctm['f'];
                     // new coordinates (rectangle area)
                     $x = min($x1, $x2, $x3, $x4);
                     $y = max($y1, $y2, $y3, $y4);
                     $w = (max($x1, $x2, $x3, $x4) - $x) / $this->k;
                     $h = ($y - min($y1, $y2, $y3, $y4)) / $this->k;
                     $x = $x / $this->k;
                     $y = $this->h - $y / $this->k;
                 }
             }
         }
     }
     if ($this->page <= 0) {
         $page = 1;
     } else {
         $page = $this->page;
     }
     if (!isset($this->PageAnnots[$page])) {
         $this->PageAnnots[$page] = array();
     }
     $this->PageAnnots[$page][] = array('n' => ++$this->n, 'x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'txt' => $text, 'opt' => $opt, 'numspaces' => $spaces);
     if (!$this->pdfa_mode) {
         if (($opt['Subtype'] == 'FileAttachment' or $opt['Subtype'] == 'Sound') and !TCPDF_STATIC::empty_string($opt['FS']) and (@file_exists($opt['FS']) or TCPDF_STATIC::isValidURL($opt['FS'])) and !isset($this->embeddedfiles[basename($opt['FS'])])) {
             $this->embeddedfiles[basename($opt['FS'])] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $opt['FS']);
         }
     }
     // Add widgets annotation's icons
     if (isset($opt['mk']['i']) and @file_exists($opt['mk']['i'])) {
         $this->Image($opt['mk']['i'], '', '', 10, 10, '', '', '', false, 300, '', false, false, 0, false, true);
     }
     if (isset($opt['mk']['ri']) and @file_exists($opt['mk']['ri'])) {
         $this->Image($opt['mk']['ri'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true);
     }
     if (isset($opt['mk']['ix']) and @file_exists($opt['mk']['ix'])) {
         $this->Image($opt['mk']['ix'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true);
     }
 }
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:95,代码来源:tcpdf.php


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