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


PHP TCPDF_STATIC::_escape方法代码示例

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


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

示例1: _prepareValue

 /**
  * Writes a PDF value to the resulting document.
  *
  * Prepares the value for encryption of imported data by FPDI
  *
  * @param array $value
  */
 protected function _prepareValue(&$value)
 {
     switch ($value[0]) {
         case pdf_parser::TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case pdf_parser::TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_currentObjId, $value[2][1]);
                 $value[1][1]['/Length'] = array(pdf_parser::TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case pdf_parser::TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
 }
开发者ID:shark0der,项目名称:FPDI-TCPDF,代码行数:33,代码来源:fpdi_bridge.php

示例2: pdf_write_value

 /**
  * Encryption of imported data by FPDI
  *
  * @param array $value
  */
 function pdf_write_value(&$value)
 {
     switch ($value[0]) {
         case PDF_TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case PDF_TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
                 $value[1][1]['/Length'] = array(PDF_TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case PDF_TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
 }
开发者ID:surfingtime,项目名称:PDFMerger,代码行数:31,代码来源:fpdi2tcpdf_bridge.php

示例3: _putencryption

 /**
  * Put encryption on PDF document.
  * @protected
  * @author Nicola Asuni
  * @since 2.0.000 (2008-01-02)
  */
 protected function _putencryption()
 {
     if (!$this->encrypted) {
         return;
     }
     $this->encryptdata['objid'] = $this->_newobj();
     $out = '<<';
     if (!isset($this->encryptdata['Filter']) or empty($this->encryptdata['Filter'])) {
         $this->encryptdata['Filter'] = 'Standard';
     }
     $out .= ' /Filter /' . $this->encryptdata['Filter'];
     if (isset($this->encryptdata['SubFilter']) and !empty($this->encryptdata['SubFilter'])) {
         $out .= ' /SubFilter /' . $this->encryptdata['SubFilter'];
     }
     if (!isset($this->encryptdata['V']) or empty($this->encryptdata['V'])) {
         $this->encryptdata['V'] = 1;
     }
     // V is a code specifying the algorithm to be used in encrypting and decrypting the document
     $out .= ' /V ' . $this->encryptdata['V'];
     if (isset($this->encryptdata['Length']) and !empty($this->encryptdata['Length'])) {
         // The length of the encryption key, in bits. The value shall be a multiple of 8, in the range 40 to 256
         $out .= ' /Length ' . $this->encryptdata['Length'];
     } else {
         $out .= ' /Length 40';
     }
     if ($this->encryptdata['V'] >= 4) {
         if (!isset($this->encryptdata['StmF']) or empty($this->encryptdata['StmF'])) {
             $this->encryptdata['StmF'] = 'Identity';
         }
         if (!isset($this->encryptdata['StrF']) or empty($this->encryptdata['StrF'])) {
             // The name of the crypt filter that shall be used when decrypting all strings in the document.
             $this->encryptdata['StrF'] = 'Identity';
         }
         // A dictionary whose keys shall be crypt filter names and whose values shall be the corresponding crypt filter dictionaries.
         if (isset($this->encryptdata['CF']) and !empty($this->encryptdata['CF'])) {
             $out .= ' /CF <<';
             $out .= ' /' . $this->encryptdata['StmF'] . ' <<';
             $out .= ' /Type /CryptFilter';
             if (isset($this->encryptdata['CF']['CFM']) and !empty($this->encryptdata['CF']['CFM'])) {
                 // The method used
                 $out .= ' /CFM /' . $this->encryptdata['CF']['CFM'];
                 if ($this->encryptdata['pubkey']) {
                     $out .= ' /Recipients [';
                     foreach ($this->encryptdata['Recipients'] as $rec) {
                         $out .= ' <' . $rec . '>';
                     }
                     $out .= ' ]';
                     if (isset($this->encryptdata['CF']['EncryptMetadata']) and !$this->encryptdata['CF']['EncryptMetadata']) {
                         $out .= ' /EncryptMetadata false';
                     } else {
                         $out .= ' /EncryptMetadata true';
                     }
                 }
             } else {
                 $out .= ' /CFM /None';
             }
             if (isset($this->encryptdata['CF']['AuthEvent']) and !empty($this->encryptdata['CF']['AuthEvent'])) {
                 // The event to be used to trigger the authorization that is required to access encryption keys used by this filter.
                 $out .= ' /AuthEvent /' . $this->encryptdata['CF']['AuthEvent'];
             } else {
                 $out .= ' /AuthEvent /DocOpen';
             }
             if (isset($this->encryptdata['CF']['Length']) and !empty($this->encryptdata['CF']['Length'])) {
                 // The bit length of the encryption key.
                 $out .= ' /Length ' . $this->encryptdata['CF']['Length'];
             }
             $out .= ' >> >>';
         }
         // The name of the crypt filter that shall be used by default when decrypting streams.
         $out .= ' /StmF /' . $this->encryptdata['StmF'];
         // The name of the crypt filter that shall be used when decrypting all strings in the document.
         $out .= ' /StrF /' . $this->encryptdata['StrF'];
         if (isset($this->encryptdata['EFF']) and !empty($this->encryptdata['EFF'])) {
             // The name of the crypt filter that shall be used when encrypting embedded file streams that do not have their own crypt filter specifier.
             $out .= ' /EFF /' . $this->encryptdata[''];
         }
     }
     // Additional encryption dictionary entries for the standard security handler
     if ($this->encryptdata['pubkey']) {
         if ($this->encryptdata['V'] < 4 and isset($this->encryptdata['Recipients']) and !empty($this->encryptdata['Recipients'])) {
             $out .= ' /Recipients [';
             foreach ($this->encryptdata['Recipients'] as $rec) {
                 $out .= ' <' . $rec . '>';
             }
             $out .= ' ]';
         }
     } else {
         $out .= ' /R';
         if ($this->encryptdata['V'] == 5) {
             // AES-256
             $out .= ' 5';
             $out .= ' /OE (' . TCPDF_STATIC::_escape($this->encryptdata['OE']) . ')';
             $out .= ' /UE (' . TCPDF_STATIC::_escape($this->encryptdata['UE']) . ')';
             $out .= ' /Perms (' . TCPDF_STATIC::_escape($this->encryptdata['perms']) . ')';
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php

示例4: getCellCode


//.........这里部分代码省略.........
     if (TCPDF_STATIC::empty_string($w) or $w <= 0) {
         if ($this->rtl) {
             $w = $x - $this->lMargin;
         } else {
             $w = $this->w - $this->rMargin - $x;
         }
     }
     $s = '';
     // fill and borders
     if (is_string($border) and strlen($border) == 4) {
         // full border
         $border = 1;
     }
     if ($fill or $border == 1) {
         if ($fill) {
             $op = $border == 1 ? 'B' : 'f';
         } else {
             $op = 'S';
         }
         if ($this->rtl) {
             $xk = ($x - $w) * $k;
         } else {
             $xk = $x * $k;
         }
         $s .= sprintf('%F %F %F %F re %s ', $xk, ($this->h - $y) * $k, $w * $k, -$h * $k, $op);
     }
     // draw borders
     $s .= $this->getCellBorder($x, $y, $w, $h, $border);
     if ($txt != '') {
         $txt2 = $txt;
         if ($this->isunicode) {
             $txt2 = $this->UTF8ToLatin2($txt2, $this->isunicode);
         }
         $txt2 = TCPDF_STATIC::_escape($txt2);
         // get current text width (considering general font stretching and spacing)
         $txwidth = $this->GetStringWidth($txt);
         $width = $txwidth;
         // check for stretch mode
         if ($stretch > 0) {
             // calculate ratio between cell width and text width
             if ($width <= 0) {
                 $ratio = 1;
             } else {
                 $ratio = ($w - $this->cell_padding['L'] - $this->cell_padding['R']) / $width;
             }
             // check if stretching is required
             if ($ratio < 1 or $ratio > 1 and $stretch % 2 == 0) {
                 // the text will be stretched to fit cell width
                 if ($stretch > 2) {
                     // set new character spacing
                     $this->font_spacing += ($w - $this->cell_padding['L'] - $this->cell_padding['R'] - $width) / (max($this->GetNumChars($txt) - 1, 1) * ($this->font_stretching / 100));
                 } else {
                     // set new horizontal stretching
                     $this->font_stretching *= $ratio;
                 }
                 // recalculate text width (the text fills the entire cell)
                 $width = $w - $this->cell_padding['L'] - $this->cell_padding['R'];
                 // reset alignment
                 $align = '';
             }
         }
         if ($this->font_stretching != 100) {
             // apply font stretching
             $rs .= sprintf('BT %F Tz ET ', $this->font_stretching);
         }
         if ($this->font_spacing != 0) {
开发者ID:bochniak,项目名称:lms-1,代码行数:67,代码来源:tcpdf.php

示例5: pdf_write_value

 /**
  * Writes a value
  * Needed to rebuild the source document
  *
  * @param mixed $value A PDF-Value. Structure of values see cases in this method
  */
 function pdf_write_value(&$value)
 {
     switch ($value[0]) {
         case PDF_TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case PDF_TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
                 $value[1][1]['/Length'] = array(PDF_TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case PDF_TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
     switch ($value[0]) {
         case PDF_TYPE_TOKEN:
             $this->_straightOut('/' . $value[1] . ' ');
             break;
         case PDF_TYPE_NUMERIC:
         case PDF_TYPE_REAL:
             if (is_float($value[1]) && $value[1] != 0) {
                 $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' ');
             } else {
                 $this->_straightOut($value[1] . ' ');
             }
             break;
         case PDF_TYPE_ARRAY:
             // An array. Output the proper
             // structure and move on.
             $this->_straightOut('[');
             for ($i = 0; $i < count($value[1]); $i++) {
                 $this->pdf_write_value($value[1][$i]);
             }
             $this->_out(']');
             break;
         case PDF_TYPE_DICTIONARY:
             // A dictionary.
             $this->_straightOut('<<');
             reset($value[1]);
             while (list($k, $v) = each($value[1])) {
                 $this->_straightOut($k . ' ');
                 $this->pdf_write_value($v);
             }
             $this->_straightOut('>>');
             break;
         case PDF_TYPE_OBJREF:
             // An indirect object reference
             // Fill the object stack if needed
             $cpfn =& $this->current_parser->uniqueid;
             if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
                 $this->_newobj(false, true);
                 $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
                 $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
                 // Value is maybee obsolete!!!
             }
             $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
             $this->_out($objid . ' 0 R');
             break;
         case PDF_TYPE_STRING:
             // A string.
             $this->_straightOut('(' . $value[1] . ')');
             break;
         case PDF_TYPE_STREAM:
             // A stream. First, output the
             // stream dictionary, then the
             // stream data itself.
             $this->pdf_write_value($value[1]);
             $this->_out('stream');
             $this->_out($value[2][1]);
             $this->_out('endstream');
             break;
         case PDF_TYPE_HEX:
             $this->_straightOut('<' . $value[1] . '>');
             break;
         case PDF_TYPE_BOOLEAN:
             $this->_straightOut($value[1] ? 'true ' : 'false ');
             break;
         case PDF_TYPE_NULL:
             // The null object.
             $this->_straightOut('null ');
             break;
     }
 }
开发者ID:LynX39,项目名称:lara-pdf-merger,代码行数:100,代码来源:tcpdi.php


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