ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
TCPDF_STATIC Class Reference

Static methods used by the TCPDF class. More...

+ Collaboration diagram for TCPDF_STATIC:

Static Public Member Functions

static getTCPDFVersion ()
 Return the current TCPDF version. More...
 
static getTCPDFProducer ()
 Return the current TCPDF producer. More...
 
static set_mqr ($mqr)
 Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtime function exist) More...
 
static get_mqr ()
 Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtime function exist) More...
 
static isValidURL ($url)
 Check if the URL exist. More...
 
static removeSHY ($txt='', $unicode=true)
 Removes SHY characters from text. More...
 
static getBorderMode ($brd, $position='start', $opencell=true)
 Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages) More...
 
static empty_string ($str)
 Determine whether a string is empty. More...
 
static getObjFilename ($type='tmp', $file_id='')
 Returns a temporary filename for caching object on filesystem. More...
 
static _escape ($s)
 Add "\" before "\", "(" and ")". More...
 
static _escapeXML ($str)
 Escape some special characters (< > &) for XML output. More...
 
static objclone ($object)
 Creates a copy of a class object. More...
 
static sendOutputData ($data, $length)
 Output input data and compress it if possible. More...
 
static replacePageNumAliases ($page, $replace, $diff=0)
 Replace page number aliases with number. More...
 
static getTimestamp ($date)
 Returns timestamp in seconds from formatted date-time. More...
 
static getFormattedDate ($time)
 Returns a formatted date-time. More...
 
static getRandomSeed ($seed='')
 Returns a string containing random data to be used as a seed for encryption methods. More...
 
static _md5_16 ($str)
 Encrypts a string using MD5 and returns it's value as a binary string. More...
 
static _AES ($key, $text)
 Returns the input text exrypted using AES algorithm and the specified key. More...
 
static _AESnopad ($key, $text)
 Returns the input text exrypted using AES algorithm and the specified key. More...
 
static _RC4 ($key, $text, &$last_enc_key, &$last_enc_key_c)
 Returns the input text encrypted using RC4 algorithm and the specified key. More...
 
static getUserPermissionCode ($permissions, $mode=0)
 Return the permission code used on encryption (P value). More...
 
static convertHexStringToString ($bs)
 Convert hexadecimal string to string. More...
 
static convertStringToHexString ($s)
 Convert string to hexadecimal string (byte string) More...
 
static getEncPermissionsString ($protection)
 Convert encryption P value to a string of bytes, low-order byte first. More...
 
static encodeNameObject ($name)
 Encode a name object. More...
 
static getAnnotOptFromJSProp ($prop, &$spot_colors, $rtl=false)
 Convert JavaScript form fields properties array to Annotation Properties array. More...
 
static formatPageNumber ($num)
 Format the page numbers. More...
 
static formatTOCPageNumber ($num)
 Format the page numbers on the Table Of Content. More...
 
static extractCSSproperties ($cssdata)
 Extracts the CSS properties from a CSS string. More...
 
static fixHTMLCode ($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces)
 Cleanup HTML code (requires HTML Tidy library). More...
 
static isValidCSSSelectorForTag ($dom, $key, $selector)
 Returns true if the CSS selector is valid for the selected HTML tag. More...
 
static getCSSdataArray ($dom, $key, $css)
 Returns the styles array that apply for the selected HTML tag. More...
 
static getTagStyleFromCSSarray ($css)
 Compact CSS data array into single string. More...
 
static intToRoman ($number)
 Returns the Roman representation of an integer number. More...
 
static revstrpos ($haystack, $needle, $offset=0)
 Find position of last occurrence of a substring in a string. More...
 
static getHyphenPatternsFromTEX ($file)
 Returns an array of hyphenation patterns. More...
 
static getPathPaintOperator ($style, $default='S')
 Get the Path-Painting Operators. More...
 
static getTransformationMatrixProduct ($ta, $tb)
 Get the product of two SVG tranformation matrices. More...
 
static getSVGTransformMatrix ($attribute)
 Get the tranformation matrix from SVG transform attribute. More...
 
static getVectorsAngle ($x1, $y1, $x2, $y2)
 Returns the angle in radiants between two vectors. More...
 
static pregSplit ($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL)
 Split string by a regular expression. More...
 
static fopenLocal ($filename, $mode)
 Wrapper to use fopen only with local files. More...
 
static fileGetContents ($file)
 Reads entire file into a string. More...
 
static _getULONG ($str, $offset)
 Get ULONG from string (Big Endian 32-bit unsigned integer). More...
 
static _getUSHORT ($str, $offset)
 Get USHORT from string (Big Endian 16-bit unsigned integer). More...
 
static _getSHORT ($str, $offset)
 Get SHORT from string (Big Endian 16-bit signed integer). More...
 
static _getFWORD ($str, $offset)
 Get FWORD from string (Big Endian 16-bit signed integer). More...
 
static _getUFWORD ($str, $offset)
 Get UFWORD from string (Big Endian 16-bit unsigned integer). More...
 
static _getFIXED ($str, $offset)
 Get FIXED from string (32-bit signed fixed-point number (16.16). More...
 
static _getBYTE ($str, $offset)
 Get BYTE from string (8-bit unsigned integer). More...
 
static rfread ($handle, $length)
 Binary-safe and URL-safe file read. More...
 
static _freadint ($f)
 Read a 4-byte (32 bit) integer from file. More...
 
static getPageSizeFromFormat ($format)
 Get page dimensions from format name. More...
 
static setPageBoxes ($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array())
 Set page boundaries. More...
 
static swapPageBoxCoordinates ($page, $pagedim)
 Swap X and Y coordinates of page boxes (change page boxes orientation). More...
 
static getPageLayoutMode ($layout='SinglePage')
 Get the canonical page layout mode. More...
 
static getPageMode ($mode='UseNone')
 Get the canonical page layout mode. More...
 

Static Public Attributes

static $alias_tot_pages = '{:ptp:}'
 String alias for total number of pages. More...
 
static $alias_num_page = '{:pnp:}'
 String alias for page number. More...
 
static $alias_group_tot_pages = '{:ptg:}'
 String alias for total number of pages in a single group. More...
 
static $alias_group_num_page = '{:png:}'
 String alias for group page number. More...
 
static $alias_right_shift = '{rsc:'
 String alias for right shift compensation used to correctly align page numbers on the right. More...
 
static $enc_padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A"
 Encryption padding string. More...
 
static $byterange_string = '/ByteRange[0 ********** ********** **********]'
 ByteRange placemark used during digital signature process. More...
 
static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox')
 Array page boxes names static. More...
 
static $page_formats
 Array of page formats measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4) static. More...
 

Static Private Attributes

static $tcpdf_version = '6.2.12'
 Current TCPDF version. More...
 

Detailed Description

Static methods used by the TCPDF class.

Definition at line 52 of file tcpdf_static.php.

Member Function Documentation

◆ _AES()

static TCPDF_STATIC::_AES (   $key,
  $text 
)
static

Returns the input text exrypted using AES algorithm and the specified key.

This method requires openssl or mcrypt. Text is padded to 16bytes blocks

Parameters
$key(string) encryption key
$text(String) input text to be encrypted
Returns
String encrypted text
Author
Nicola Asuni
Since
5.0.005 (2010-05-11) static

Definition at line 444 of file tcpdf_static.php.

References $text.

Referenced by TCPDF\_encrypt_data().

444  {
445  // padding (RFC 2898, PKCS #5: Password-Based Cryptography Specification Version 2.0)
446  $padding = 16 - (strlen($text) % 16);
447  $text .= str_repeat(chr($padding), $padding);
448  if (extension_loaded('openssl')) {
449  $iv = openssl_random_pseudo_bytes (openssl_cipher_iv_length('aes-256-cbc'));
450  $text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
451  return $iv.substr($text, 0, -16);
452  }
453  $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND);
454  $text = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_CBC, $iv);
455  $text = $iv.$text;
456  return $text;
457  }
$text
+ Here is the caller graph for this function:

◆ _AESnopad()

static TCPDF_STATIC::_AESnopad (   $key,
  $text 
)
static

Returns the input text exrypted using AES algorithm and the specified key.

This method requires openssl or mcrypt. Text is not padded

Parameters
$key(string) encryption key
$text(String) input text to be encrypted
Returns
String encrypted text
Author
Nicola Asuni
Since
TODO static

Definition at line 469 of file tcpdf_static.php.

References $text.

Referenced by TCPDF\_generateencryptionkey(), TCPDF\_OEvalue(), and TCPDF\_UEvalue().

469  {
470  if (extension_loaded('openssl')) {
471  $iv = str_repeat("\x00", openssl_cipher_iv_length('aes-256-cbc'));
472  $text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
473  return substr($text, 0, -16);
474  }
475  $iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
476  $text = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_CBC, $iv);
477  return $text;
478  }
$text
+ Here is the caller graph for this function:

◆ _escape()

static TCPDF_STATIC::_escape (   $s)
static

Add "\" before "\", "(" and ")".

Parameters
$s(string) string to escape.
Returns
string escaped string. static

Definition at line 305 of file tcpdf_static.php.

References array.

Referenced by TCPDF\_datastring(), TCPDF\getCellCode(), and TCPDF\getInternalPageNumberAliases().

305  {
306  // the chr(13) substitution fixes the Bugs item #1421290.
307  return strtr($s, array(')' => '\\)', '(' => '\\(', '\\' => '\\\\', chr(13) => '\r'));
308  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _escapeXML()

static TCPDF_STATIC::_escapeXML (   $str)
static

Escape some special characters (< > &) for XML output.

Parameters
$str(string) Input string to convert.
Returns
converted string
Since
5.9.121 (2011-09-28) static

Definition at line 317 of file tcpdf_static.php.

References array.

Referenced by TCPDF\_putXMP().

317  {
318  $replaceTable = array("\0" => '', '&' => '&amp;', '<' => '&lt;', '>' => '&gt;');
319  $str = strtr($str, $replaceTable);
320  return $str;
321  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _freadint()

static TCPDF_STATIC::_freadint (   $f)
static

Read a 4-byte (32 bit) integer from file.

Parameters
$f(string) file name.
Returns
4-byte integer static

Definition at line 2086 of file tcpdf_static.php.

Referenced by TCPDF_IMAGES\_parsepng().

2086  {
2087  $a = unpack('Ni', fread($f, 4));
2088  return $a['i'];
2089  }
+ Here is the caller graph for this function:

◆ _getBYTE()

static TCPDF_STATIC::_getBYTE (   $str,
  $offset 
)
static

Get BYTE from string (8-bit unsigned integer).

Parameters
$str(string) String from where to extract value.
$offset(int) Point from where to read the data.
Returns
int 8 bit value
Author
Nicola Asuni
Since
5.2.000 (2010-06-02) static

Definition at line 2054 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\_getTrueTypeFontSubset(), and TCPDF_FONTS\addTTFfont().

2054  {
2055  $v = unpack('Ci', substr($str, $offset, 1));
2056  return $v['i'];
2057  }
+ Here is the caller graph for this function:

◆ _getFIXED()

static TCPDF_STATIC::_getFIXED (   $str,
  $offset 
)
static

Get FIXED from string (32-bit signed fixed-point number (16.16).

Parameters
$str(string) string from where to extract value
$offset(int) point from where to read the data
Returns
int 16 bit value
Author
Nicola Asuni
Since
5.9.123 (2011-09-30) static

Definition at line 2036 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\addTTFfont().

2036  {
2037  // mantissa
2038  $m = self::_getFWORD($str, $offset);
2039  // fraction
2040  $f = self::_getUSHORT($str, ($offset + 2));
2041  $v = floatval(''.$m.'.'.$f.'');
2042  return $v;
2043  }
+ Here is the caller graph for this function:

◆ _getFWORD()

static TCPDF_STATIC::_getFWORD (   $str,
  $offset 
)
static

Get FWORD from string (Big Endian 16-bit signed integer).

Parameters
$str(string) String from where to extract value.
$offset(int) Point from where to read the data.
Returns
int 16 bit value
Author
Nicola Asuni
Since
5.9.123 (2011-09-30) static

Definition at line 2005 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\addTTFfont().

2005  {
2006  $v = self::_getUSHORT($str, $offset);
2007  if ($v > 0x7fff) {
2008  $v -= 0x10000;
2009  }
2010  return $v;
2011  }
+ Here is the caller graph for this function:

◆ _getSHORT()

static TCPDF_STATIC::_getSHORT (   $str,
  $offset 
)
static

Get SHORT from string (Big Endian 16-bit signed integer).

Parameters
$str(string) String from where to extract value.
$offset(int) Point from where to read the data.
Returns
int 16 bit value
Author
Nicola Asuni
Since
5.2.000 (2010-06-02) static

Definition at line 1991 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\_getTrueTypeFontSubset(), and TCPDF_FONTS\addTTFfont().

1991  {
1992  $v = unpack('si', substr($str, $offset, 2));
1993  return $v['i'];
1994  }
+ Here is the caller graph for this function:

◆ _getUFWORD()

static TCPDF_STATIC::_getUFWORD (   $str,
  $offset 
)
static

Get UFWORD from string (Big Endian 16-bit unsigned integer).

Parameters
$str(string) string from where to extract value
$offset(int) point from where to read the data
Returns
int 16 bit value
Author
Nicola Asuni
Since
5.9.123 (2011-09-30) static

Definition at line 2022 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\addTTFfont().

2022  {
2023  $v = self::_getUSHORT($str, $offset);
2024  return $v;
2025  }
+ Here is the caller graph for this function:

◆ _getULONG()

static TCPDF_STATIC::_getULONG (   $str,
  $offset 
)
static

Get ULONG from string (Big Endian 32-bit unsigned integer).

Parameters
$str(string) string from where to extract value
$offset(int) point from where to read the data
Returns
int 32 bit value
Author
Nicola Asuni
Since
5.2.000 (2010-06-02) static

Definition at line 1963 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\_getTrueTypeFontSubset(), and TCPDF_FONTS\addTTFfont().

1963  {
1964  $v = unpack('Ni', substr($str, $offset, 4));
1965  return $v['i'];
1966  }
+ Here is the caller graph for this function:

◆ _getUSHORT()

static TCPDF_STATIC::_getUSHORT (   $str,
  $offset 
)
static

Get USHORT from string (Big Endian 16-bit unsigned integer).

Parameters
$str(string) string from where to extract value
$offset(int) point from where to read the data
Returns
int 16 bit value
Author
Nicola Asuni
Since
5.2.000 (2010-06-02) static

Definition at line 1977 of file tcpdf_static.php.

Referenced by TCPDF_FONTS\_getTrueTypeFontSubset(), TCPDF_IMAGES\_parsejpeg(), and TCPDF_FONTS\addTTFfont().

1977  {
1978  $v = unpack('ni', substr($str, $offset, 2));
1979  return $v['i'];
1980  }
+ Here is the caller graph for this function:

◆ _md5_16()

static TCPDF_STATIC::_md5_16 (   $str)
static

Encrypts a string using MD5 and returns it's value as a binary string.

Parameters
$str(string) input string
Returns
String MD5 encrypted binary string
Since
2.0.000 (2008-01-02) static

Definition at line 430 of file tcpdf_static.php.

Referenced by TCPDF\_generateencryptionkey(), TCPDF\_objectkey(), TCPDF\_Ovalue(), and TCPDF\_Uvalue().

430  {
431  return pack('H*', md5($str));
432  }
+ Here is the caller graph for this function:

◆ _RC4()

static TCPDF_STATIC::_RC4 (   $key,
  $text,
$last_enc_key,
$last_enc_key_c 
)
static

Returns the input text encrypted using RC4 algorithm and the specified key.

RC4 is the standard encryption algorithm used in PDF format

Parameters
$key(string) Encryption key.
$text(String) Input text to be encrypted.
$last_enc_key(String) Reference to last RC4 key encrypted.
$last_enc_key_c(String) Reference to last RC4 computed key.
Returns
String encrypted text
Since
2.0.000 (2008-01-02)
Author
Klemen Vodopivec, Nicola Asuni static

Definition at line 492 of file tcpdf_static.php.

References $out, $t, $text, and range.

Referenced by TCPDF\_encrypt_data(), TCPDF\_Ovalue(), and TCPDF\_Uvalue().

492  {
493  if (function_exists('mcrypt_encrypt') AND ($out = @mcrypt_encrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, ''))) {
494  // try to use mcrypt function if exist
495  return $out;
496  }
497  if ($last_enc_key != $key) {
498  $k = str_repeat($key, ((256 / strlen($key)) + 1));
499  $rc4 = range(0, 255);
500  $j = 0;
501  for ($i = 0; $i < 256; ++$i) {
502  $t = $rc4[$i];
503  $j = ($j + $t + ord($k[$i])) % 256;
504  $rc4[$i] = $rc4[$j];
505  $rc4[$j] = $t;
506  }
507  $last_enc_key = $key;
508  $last_enc_key_c = $rc4;
509  } else {
510  $rc4 = $last_enc_key_c;
511  }
512  $len = strlen($text);
513  $a = 0;
514  $b = 0;
515  $out = '';
516  for ($i = 0; $i < $len; ++$i) {
517  $a = ($a + 1) % 256;
518  $t = $rc4[$a];
519  $b = ($b + $t) % 256;
520  $rc4[$a] = $rc4[$b];
521  $rc4[$b] = $t;
522  $k = $rc4[($rc4[$a] + $rc4[$b]) % 256];
523  $out .= chr(ord($text[$i]) ^ $k);
524  }
525  return $out;
526  }
Resolve range
$text
+ Here is the caller graph for this function:

◆ convertHexStringToString()

static TCPDF_STATIC::convertHexStringToString (   $bs)
static

Convert hexadecimal string to string.

Parameters
$bs(string) byte-string to convert
Returns
String
Since
5.0.005 (2010-05-12)
Author
Nicola Asuni static

Definition at line 573 of file tcpdf_static.php.

Referenced by TCPDF\SetProtection().

573  {
574  $string = ''; // string to be returned
575  $bslength = strlen($bs);
576  if (($bslength % 2) != 0) {
577  // padding
578  $bs .= '0';
579  ++$bslength;
580  }
581  for ($i = 0; $i < $bslength; $i += 2) {
582  $string .= chr(hexdec($bs[$i].$bs[($i + 1)]));
583  }
584  return $string;
585  }
+ Here is the caller graph for this function:

◆ convertStringToHexString()

static TCPDF_STATIC::convertStringToHexString (   $s)
static

Convert string to hexadecimal string (byte string)

Parameters
$s(string) string to convert
Returns
byte string
Since
5.0.010 (2010-05-17)
Author
Nicola Asuni static

Definition at line 595 of file tcpdf_static.php.

595  {
596  $bs = '';
597  $chars = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY);
598  foreach ($chars as $c) {
599  $bs .= sprintf('%02s', dechex(ord($c)));
600  }
601  return $bs;
602  }

◆ empty_string()

◆ encodeNameObject()

static TCPDF_STATIC::encodeNameObject (   $name)
static

Encode a name object.

Parameters
$name(string) Name object to encode.
Returns
(string) Encoded name object.
Author
Nicola Asuni
Since
5.9.097 (2011-06-23) static

Definition at line 629 of file tcpdf_static.php.

Referenced by TCPDF\setDestination().

629  {
630  $escname = '';
631  $length = strlen($name);
632  for ($i = 0; $i < $length; ++$i) {
633  $chr = $name[$i];
634  if (preg_match('/[0-9a-zA-Z#_=-]/', $chr) == 1) {
635  $escname .= $chr;
636  } else {
637  $escname .= sprintf('#%02X', ord($chr));
638  }
639  }
640  return $escname;
641  }
+ Here is the caller graph for this function:

◆ extractCSSproperties()

static TCPDF_STATIC::extractCSSproperties (   $cssdata)
static

Extracts the CSS properties from a CSS string.

Parameters
$cssdata(string) string containing CSS definitions.
Returns
An array where the keys are the CSS selectors and the values are the CSS properties.
Author
Nicola Asuni
Since
5.1.000 (2010-05-25) static

Definition at line 1043 of file tcpdf_static.php.

References $d, and array.

Referenced by TCPDF\getHtmlDomArray().

1043  {
1044  if (empty($cssdata)) {
1045  return array();
1046  }
1047  // remove comments
1048  $cssdata = preg_replace('/\/\*[^\*]*\*\//', '', $cssdata);
1049  // remove newlines and multiple spaces
1050  $cssdata = preg_replace('/[\s]+/', ' ', $cssdata);
1051  // remove some spaces
1052  $cssdata = preg_replace('/[\s]*([;:\{\}]{1})[\s]*/', '\\1', $cssdata);
1053  // remove empty blocks
1054  $cssdata = preg_replace('/([^\}\{]+)\{\}/', '', $cssdata);
1055  // replace media type parenthesis
1056  $cssdata = preg_replace('/@media[\s]+([^\{]*)\{/i', '@media \\1§', $cssdata);
1057  $cssdata = preg_replace('/\}\}/si', '}§', $cssdata);
1058  // trim string
1059  $cssdata = trim($cssdata);
1060  // find media blocks (all, braille, embossed, handheld, print, projection, screen, speech, tty, tv)
1061  $cssblocks = array();
1062  $matches = array();
1063  if (preg_match_all('/@media[\s]+([^\ foreach ($matches[1] as $key => $type) { $cssblocks[$type] = $matches[2][$key]; } // remove media blocks $cssdata = preg_replace('/@media[\s]+([^\§]*)§([^§]*)§/i', '', $cssdata); } // keep 'all' and 'print' media, other media types are discarded if (isset($cssblocks['all']) AND !empty($cssblocks['all'])) { $cssdata .= $cssblocks['all']; } if (isset($cssblocks['print']) AND !empty($cssblocks['print'])) { $cssdata .= $cssblocks['print']; } // reset css blocks array $cssblocks = array(); $matches = array(); // explode css data string into array if (substr($cssdata, -1) == '}') { // remove last parethesis $cssdata = substr($cssdata, 0, -1); } $matches = explode('}', $cssdata); foreach ($matches as $key => $block) { // index 0 contains the CSS selector, index 1 contains CSS properties $cssblocks[$key] = explode('{', $block); if (!isset($cssblocks[$key][1])) { // remove empty definitions unset($cssblocks[$key]); } } // split groups of selectors (comma-separated list of selectors) foreach ($cssblocks as $key => $block) { if (strpos($block[0], ',') > 0) { $selectors = explode(',', $block[0]); foreach ($selectors as $sel) { $cssblocks[] = array(0 => trim($sel), 1 => $block[1]); } unset($cssblocks[$key]); } } // covert array to selector => properties $cssdata = array(); foreach ($cssblocks as $block) { $selector = $block[0]; // calculate selector's specificity $matches = array(); $a = 0; // the declaration is not from is a 'style' attribute $b = intval(preg_match_all('/[\#]/', $selector, $matches)); // number of ID attributes $c = intval(preg_match_all('/[\[\.]/', $selector, $matches)); // number of other attributes $c += intval(preg_match_all('/[\:]link|visited|hover|active|focus|target|lang|enabled|disabled|checked|indeterminate|root|nth|first|last|only|empty|contains|not/i', $selector, $matches)); // number of pseudo-classes $d = intval(preg_match_all('/[>\+\~\s]{1}[a-zA-Z0-9]+/', ' '.$selector, $matches)); // number of element names $d += intval(preg_match_all('/[\:][\:]/', $selector, $matches)); // number of pseudo-elements $specificity = $a.$b.$c.$d; // add specificity to the beginning of the selector $cssdata[$specificity.' '.$selector] = $block[1]; } // sort selectors alphabetically to account for specificity ksort($cssdata, SORT_STRING); // return array return $cssdata; } §]*)§([^§]*)§/i', $cssdata, $matches) > 0) {
1064  foreach ($matches[1] as $key => $type) {
1065  $cssblocks[$type] = $matches[2][$key];
1066  }
1067  // remove media blocks
1068  $cssdata = preg_replace('/@media[\s]+([^\ } // keep 'all' and 'print' media, other media types are discarded if (isset($cssblocks['all']) AND !empty($cssblocks['all'])) { $cssdata .= $cssblocks['all']; } if (isset($cssblocks['print']) AND !empty($cssblocks['print'])) { $cssdata .= $cssblocks['print']; } // reset css blocks array $cssblocks = array(); $matches = array(); // explode css data string into array if (substr($cssdata, -1) == '}') { // remove last parethesis $cssdata = substr($cssdata, 0, -1); } $matches = explode('}', $cssdata); foreach ($matches as $key => $block) { // index 0 contains the CSS selector, index 1 contains CSS properties $cssblocks[$key] = explode('{', $block); if (!isset($cssblocks[$key][1])) { // remove empty definitions unset($cssblocks[$key]); } } // split groups of selectors (comma-separated list of selectors) foreach ($cssblocks as $key => $block) { if (strpos($block[0], ',') > 0) { $selectors = explode(',', $block[0]); foreach ($selectors as $sel) { $cssblocks[] = array(0 => trim($sel), 1 => $block[1]); } unset($cssblocks[$key]); } } // covert array to selector => properties $cssdata = array(); foreach ($cssblocks as $block) { $selector = $block[0]; // calculate selector's specificity $matches = array(); $a = 0; // the declaration is not from is a 'style' attribute $b = intval(preg_match_all('/[\#]/', $selector, $matches)); // number of ID attributes $c = intval(preg_match_all('/[\[\.]/', $selector, $matches)); // number of other attributes $c += intval(preg_match_all('/[\:]link|visited|hover|active|focus|target|lang|enabled|disabled|checked|indeterminate|root|nth|first|last|only|empty|contains|not/i', $selector, $matches)); // number of pseudo-classes $d = intval(preg_match_all('/[>\+\~\s]{1}[a-zA-Z0-9]+/', ' '.$selector, $matches)); // number of element names $d += intval(preg_match_all('/[\:][\:]/', $selector, $matches)); // number of pseudo-elements $specificity = $a.$b.$c.$d; // add specificity to the beginning of the selector $cssdata[$specificity.' '.$selector] = $block[1]; } // sort selectors alphabetically to account for specificity ksort($cssdata, SORT_STRING); // return array return $cssdata; } §]*)§([^§]*)§/i', '', $cssdata);
1069  }
1070  // keep 'all' and 'print' media, other media types are discarded
1071  if (isset($cssblocks['all']) AND !empty($cssblocks['all'])) {
1072  $cssdata .= $cssblocks['all'];
1073  }
1074  if (isset($cssblocks['print']) AND !empty($cssblocks['print'])) {
1075  $cssdata .= $cssblocks['print'];
1076  }
1077  // reset css blocks array
1078  $cssblocks = array();
1079  $matches = array();
1080  // explode css data string into array
1081  if (substr($cssdata, -1) == '}') {
1082  // remove last parethesis
1083  $cssdata = substr($cssdata, 0, -1);
1084  }
1085  $matches = explode('}', $cssdata);
1086  foreach ($matches as $key => $block) {
1087  // index 0 contains the CSS selector, index 1 contains CSS properties
1088  $cssblocks[$key] = explode('{', $block);
1089  if (!isset($cssblocks[$key][1])) {
1090  // remove empty definitions
1091  unset($cssblocks[$key]);
1092  }
1093  }
1094  // split groups of selectors (comma-separated list of selectors)
1095  foreach ($cssblocks as $key => $block) {
1096  if (strpos($block[0], ',') > 0) {
1097  $selectors = explode(',', $block[0]);
1098  foreach ($selectors as $sel) {
1099  $cssblocks[] = array(0 => trim($sel), 1 => $block[1]);
1100  }
1101  unset($cssblocks[$key]);
1102  }
1103  }
1104  // covert array to selector => properties
1105  $cssdata = array();
1106  foreach ($cssblocks as $block) {
1107  $selector = $block[0];
1108  // calculate selector's specificity
1109  $matches = array();
1110  $a = 0; // the declaration is not from is a 'style' attribute
1111  $b = intval(preg_match_all('/[\#]/', $selector, $matches)); // number of ID attributes
1112  $c = intval(preg_match_all('/[\[\.]/', $selector, $matches)); // number of other attributes
1113  $c += intval(preg_match_all('/[\:]link|visited|hover|active|focus|target|lang|enabled|disabled|checked|indeterminate|root|nth|first|last|only|empty|contains|not/i', $selector, $matches)); // number of pseudo-classes
1114  $d = intval(preg_match_all('/[>\+\~\s]{1}[a-zA-Z0-9]+/', ' '.$selector, $matches)); // number of element names
1115  $d += intval(preg_match_all('/[\:][\:]/', $selector, $matches)); // number of pseudo-elements
1116  $specificity = $a.$b.$c.$d;
1117  // add specificity to the beginning of the selector
1118  $cssdata[$specificity.' '.$selector] = $block[1];
1119  }
1120  // sort selectors alphabetically to account for specificity
1121  ksort($cssdata, SORT_STRING);
1122  // return array
1123  return $cssdata;
1124  }
for($col=0; $col< 50; $col++) $d
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ fileGetContents()

static TCPDF_STATIC::fileGetContents (   $file)
static

Reads entire file into a string.

The file can be also an URL.

Parameters
$file(string) Name of the file or URL to read.
Returns
The function returns the read data or FALSE on failure.
Author
Nicola Asuni
Since
6.0.025 static

Definition at line 1866 of file tcpdf_static.php.

References $_SERVER, $file, $path, $ret, $url, and array.

Referenced by TCPDF\_putEmbeddedFiles(), TCPDF\getHtmlDomArray(), TCPDF\Image(), TCPDF\ImageEps(), and TCPDF\ImageSVG().

1866  {
1867  $alt = array($file);
1868  //
1869  if ((strlen($file) > 1)
1870  && ($file[0] === '/')
1871  && ($file[1] !== '/')
1872  && !empty($_SERVER['DOCUMENT_ROOT'])
1873  && ($_SERVER['DOCUMENT_ROOT'] !== '/')
1874  ) {
1875  $findroot = strpos($file, $_SERVER['DOCUMENT_ROOT']);
1876  if (($findroot === false) || ($findroot > 1)) {
1877  $alt[] = htmlspecialchars_decode(urldecode($_SERVER['DOCUMENT_ROOT'].$file));
1878  }
1879  }
1880  //
1881  $protocol = 'http';
1882  if (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
1883  $protocol .= 's';
1884  }
1885  //
1886  $url = $file;
1887  if (preg_match('%^//%', $url) && !empty($_SERVER['HTTP_HOST'])) {
1888  $url = $protocol.':'.str_replace(' ', '%20', $url);
1889  }
1890  $url = htmlspecialchars_decode($url);
1891  $alt[] = $url;
1892  //
1893  if (preg_match('%^(https?)://%', $url)
1894  && empty($_SERVER['HTTP_HOST'])
1895  && empty($_SERVER['DOCUMENT_ROOT'])
1896  ) {
1897  $urldata = parse_url($url);
1898  if (empty($urldata['query'])) {
1899  $host = $protocol.'://'.$_SERVER['HTTP_HOST'];
1900  if (strpos($url, $host) === 0) {
1901  // convert URL to full server path
1902  $tmp = str_replace($host, $_SERVER['DOCUMENT_ROOT'], $url);
1903  $alt[] = htmlspecialchars_decode(urldecode($tmp));
1904  }
1905  }
1906  }
1907  //
1908  if (isset($_SERVER['SCRIPT_URI'])
1909  && !preg_match('%^(https?|ftp)://%', $file)
1910  && !preg_match('%^//%', $file)
1911  ) {
1912  $urldata = @parse_url($_SERVER['SCRIPT_URI']);
1913  return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
1914  }
1915  //
1916  $alt = array_unique($alt);
1917  //var_dump($alt);exit;//DEBUG
1918  foreach ($alt as $path) {
1919  $ret = @file_get_contents($path);
1920  if ($ret !== false) {
1921  return $ret;
1922  }
1923  // try to use CURL for URLs
1924  if (!ini_get('allow_url_fopen')
1925  && function_exists('curl_init')
1926  && preg_match('%^(https?|ftp)://%', $path)
1927  ) {
1928  // try to get remote file data using cURL
1929  $crs = curl_init();
1930  curl_setopt($crs, CURLOPT_URL, $path);
1931  curl_setopt($crs, CURLOPT_BINARYTRANSFER, true);
1932  curl_setopt($crs, CURLOPT_FAILONERROR, true);
1933  curl_setopt($crs, CURLOPT_RETURNTRANSFER, true);
1934  if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
1935  curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
1936  }
1937  curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5);
1938  curl_setopt($crs, CURLOPT_TIMEOUT, 30);
1939  curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false);
1940  curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false);
1941  curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file');
1942  $ret = curl_exec($crs);
1943  curl_close($crs);
1944  if ($ret !== false) {
1945  return $ret;
1946  }
1947  }
1948  }
1949  return false;
1950  }
$path
Definition: aliased.php:25
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$url
Definition: shib_logout.php:72
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ fixHTMLCode()

static TCPDF_STATIC::fixHTMLCode (   $html,
  $default_css = '',
  $tagvs = '',
  $tidy_options = '',
$tagvspaces 
)
static

Cleanup HTML code (requires HTML Tidy library).

Parameters
$html(string) htmlcode to fix
$default_css(string) CSS commands to add
$tagvs(array) parameters for setHtmlVSpace method
$tidy_options(array) options for tidy_parse_string function
$tagvspaces(array) Array of vertical spaces for tags.
Returns
string XHTML code cleaned up
Author
Nicola Asuni
Since
5.9.017 (2010-11-16)
See also
setHtmlVSpace() static

Definition at line 1139 of file tcpdf_static.php.

References $html, and array.

Referenced by TCPDF\fixHTMLCode().

1139  {
1140  // configure parameters for HTML Tidy
1141  if ($tidy_options === '') {
1142  $tidy_options = array (
1143  'clean' => 1,
1144  'drop-empty-paras' => 0,
1145  'drop-proprietary-attributes' => 1,
1146  'fix-backslash' => 1,
1147  'hide-comments' => 1,
1148  'join-styles' => 1,
1149  'lower-literals' => 1,
1150  'merge-divs' => 1,
1151  'merge-spans' => 1,
1152  'output-xhtml' => 1,
1153  'word-2000' => 1,
1154  'wrap' => 0,
1155  'output-bom' => 0,
1156  //'char-encoding' => 'utf8',
1157  //'input-encoding' => 'utf8',
1158  //'output-encoding' => 'utf8'
1159  );
1160  }
1161  // clean up the HTML code
1162  $tidy = tidy_parse_string($html, $tidy_options);
1163  // fix the HTML
1164  $tidy->cleanRepair();
1165  // get the CSS part
1166  $tidy_head = tidy_get_head($tidy);
1167  $css = $tidy_head->value;
1168  $css = preg_replace('/<style([^>]+)>/ims', '<style>', $css);
1169  $css = preg_replace('/<\/style>(.*)<style>/ims', "\n", $css);
1170  $css = str_replace('/*<![CDATA[*/', '', $css);
1171  $css = str_replace('/*]]>*/', '', $css);
1172  preg_match('/<style>(.*)<\/style>/ims', $css, $matches);
1173  if (isset($matches[1])) {
1174  $css = strtolower($matches[1]);
1175  } else {
1176  $css = '';
1177  }
1178  // include default css
1179  $css = '<style>'.$default_css.$css.'</style>';
1180  // get the body part
1181  $tidy_body = tidy_get_body($tidy);
1182  $html = $tidy_body->value;
1183  // fix some self-closing tags
1184  $html = str_replace('<br>', '<br />', $html);
1185  // remove some empty tag blocks
1186  $html = preg_replace('/<div([^>]*)><\/div>/', '', $html);
1187  $html = preg_replace('/<p([^>]*)><\/p>/', '', $html);
1188  if ($tagvs !== '') {
1189  // set vertical space for some XHTML tags
1190  $tagvspaces = $tagvs;
1191  }
1192  // return the cleaned XHTML code + CSS
1193  return $css.$html;
1194  }
Create styles array
The data for the language used.
$html
Definition: example_001.php:87
+ Here is the caller graph for this function:

◆ fopenLocal()

static TCPDF_STATIC::fopenLocal (   $filename,
  $mode 
)
static

Wrapper to use fopen only with local files.

Parameters
filename(string) Name of the file to open
$mode(string)
Returns
Returns a file pointer resource on success, or FALSE on error. static

Definition at line 1848 of file tcpdf_static.php.

References $filename.

Referenced by TCPDF\_generateencryptionkey(), TCPDF_FONTS\addTTFfont(), TCPDF\Image(), and TCPDF\Output().

1848  {
1849  if (strpos($filename, '://') === false) {
1850  $filename = 'file://'.$filename;
1851  } elseif (stream_is_local($filename) !== true) {
1852  return false;
1853  }
1854  return fopen($filename, $mode);
1855  }
+ Here is the caller graph for this function:

◆ formatPageNumber()

static TCPDF_STATIC::formatPageNumber (   $num)
static

Format the page numbers.

This method can be overriden for custom formats.

Parameters
$num(int) page number
Since
4.2.005 (2008-11-06) static

Definition at line 1019 of file tcpdf_static.php.

Referenced by TCPDF\_putpages(), TCPDF\getGroupPageNoFormatted(), and TCPDF\PageNoFormatted().

1019  {
1020  return number_format((float)$num, 0, '', '.');
1021  }
+ Here is the caller graph for this function:

◆ formatTOCPageNumber()

static TCPDF_STATIC::formatTOCPageNumber (   $num)
static

Format the page numbers on the Table Of Content.

This method can be overriden for custom formats.

Parameters
$num(int) page number
Since
4.5.001 (2009-01-04)
See also
addTOC(), addHTMLTOC() static

Definition at line 1031 of file tcpdf_static.php.

Referenced by TCPDF\addHTMLTOC(), and TCPDF\addTOC().

1031  {
1032  return number_format((float)$num, 0, '', '.');
1033  }
+ Here is the caller graph for this function:

◆ get_mqr()

static TCPDF_STATIC::get_mqr ( )
static

Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtime function exist)

Returns
Returns 0 if magic quotes runtime is off or get_magic_quotes_runtime doesn't exist, 1 otherwise.
Since
4.6.025 (2009-08-17) static

Definition at line 153 of file tcpdf_static.php.

References $version, and defined.

Referenced by TCPDF\_putfonts(), and TCPDF\Image().

153  {
154  if (!defined('PHP_VERSION_ID')) {
155  $version = PHP_VERSION;
156  define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
157  }
158  if (PHP_VERSION_ID < 50300) {
159  return @get_magic_quotes_runtime();
160  }
161  return 0;
162  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the caller graph for this function:

◆ getAnnotOptFromJSProp()

static TCPDF_STATIC::getAnnotOptFromJSProp (   $prop,
$spot_colors,
  $rtl = false 
)
static

Convert JavaScript form fields properties array to Annotation Properties array.

Parameters
$prop(array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
$spot_colors(array) Reference to spot colors array.
$rtl(boolean) True if in Right-To-Left text direction mode, false otherwise.
Returns
array of annotation properties
Author
Nicola Asuni
Since
4.8.000 (2009-09-06) static

Definition at line 653 of file tcpdf_static.php.

References array, and TCPDF_COLORS\convertHTMLColorToDec().

Referenced by TCPDF\Button(), TCPDF\RadioButton(), and TCPDF\TextField().

653  {
654  if (isset($prop['aopt']) AND is_array($prop['aopt'])) {
655  // the annotation options area lready defined
656  return $prop['aopt'];
657  }
658  $opt = array(); // value to be returned
659  // alignment: Controls how the text is laid out within the text field.
660  if (isset($prop['alignment'])) {
661  switch ($prop['alignment']) {
662  case 'left': {
663  $opt['q'] = 0;
664  break;
665  }
666  case 'center': {
667  $opt['q'] = 1;
668  break;
669  }
670  case 'right': {
671  $opt['q'] = 2;
672  break;
673  }
674  default: {
675  $opt['q'] = ($rtl)?2:0;
676  break;
677  }
678  }
679  }
680  // lineWidth: Specifies the thickness of the border when stroking the perimeter of a field's rectangle.
681  if (isset($prop['lineWidth'])) {
682  $linewidth = intval($prop['lineWidth']);
683  } else {
684  $linewidth = 1;
685  }
686  // borderStyle: The border style for a field.
687  if (isset($prop['borderStyle'])) {
688  switch ($prop['borderStyle']) {
689  case 'border.d':
690  case 'dashed': {
691  $opt['border'] = array(0, 0, $linewidth, array(3, 2));
692  $opt['bs'] = array('w'=>$linewidth, 's'=>'D', 'd'=>array(3, 2));
693  break;
694  }
695  case 'border.b':
696  case 'beveled': {
697  $opt['border'] = array(0, 0, $linewidth);
698  $opt['bs'] = array('w'=>$linewidth, 's'=>'B');
699  break;
700  }
701  case 'border.i':
702  case 'inset': {
703  $opt['border'] = array(0, 0, $linewidth);
704  $opt['bs'] = array('w'=>$linewidth, 's'=>'I');
705  break;
706  }
707  case 'border.u':
708  case 'underline': {
709  $opt['border'] = array(0, 0, $linewidth);
710  $opt['bs'] = array('w'=>$linewidth, 's'=>'U');
711  break;
712  }
713  case 'border.s':
714  case 'solid': {
715  $opt['border'] = array(0, 0, $linewidth);
716  $opt['bs'] = array('w'=>$linewidth, 's'=>'S');
717  break;
718  }
719  default: {
720  break;
721  }
722  }
723  }
724  if (isset($prop['border']) AND is_array($prop['border'])) {
725  $opt['border'] = $prop['border'];
726  }
727  if (!isset($opt['mk'])) {
728  $opt['mk'] = array();
729  }
730  if (!isset($opt['mk']['if'])) {
731  $opt['mk']['if'] = array();
732  }
733  $opt['mk']['if']['a'] = array(0.5, 0.5);
734  // buttonAlignX: Controls how space is distributed from the left of the button face with respect to the icon.
735  if (isset($prop['buttonAlignX'])) {
736  $opt['mk']['if']['a'][0] = $prop['buttonAlignX'];
737  }
738  // buttonAlignY: Controls how unused space is distributed from the bottom of the button face with respect to the icon.
739  if (isset($prop['buttonAlignY'])) {
740  $opt['mk']['if']['a'][1] = $prop['buttonAlignY'];
741  }
742  // buttonFitBounds: If true, the extent to which the icon may be scaled is set to the bounds of the button field.
743  if (isset($prop['buttonFitBounds']) AND ($prop['buttonFitBounds'] == 'true')) {
744  $opt['mk']['if']['fb'] = true;
745  }
746  // buttonScaleHow: Controls how the icon is scaled (if necessary) to fit inside the button face.
747  if (isset($prop['buttonScaleHow'])) {
748  switch ($prop['buttonScaleHow']) {
749  case 'scaleHow.proportional': {
750  $opt['mk']['if']['s'] = 'P';
751  break;
752  }
753  case 'scaleHow.anamorphic': {
754  $opt['mk']['if']['s'] = 'A';
755  break;
756  }
757  }
758  }
759  // buttonScaleWhen: Controls when an icon is scaled to fit inside the button face.
760  if (isset($prop['buttonScaleWhen'])) {
761  switch ($prop['buttonScaleWhen']) {
762  case 'scaleWhen.always': {
763  $opt['mk']['if']['sw'] = 'A';
764  break;
765  }
766  case 'scaleWhen.never': {
767  $opt['mk']['if']['sw'] = 'N';
768  break;
769  }
770  case 'scaleWhen.tooBig': {
771  $opt['mk']['if']['sw'] = 'B';
772  break;
773  }
774  case 'scaleWhen.tooSmall': {
775  $opt['mk']['if']['sw'] = 'S';
776  break;
777  }
778  }
779  }
780  // buttonPosition: Controls how the text and the icon of the button are positioned with respect to each other within the button face.
781  if (isset($prop['buttonPosition'])) {
782  switch ($prop['buttonPosition']) {
783  case 0:
784  case 'position.textOnly': {
785  $opt['mk']['tp'] = 0;
786  break;
787  }
788  case 1:
789  case 'position.iconOnly': {
790  $opt['mk']['tp'] = 1;
791  break;
792  }
793  case 2:
794  case 'position.iconTextV': {
795  $opt['mk']['tp'] = 2;
796  break;
797  }
798  case 3:
799  case 'position.textIconV': {
800  $opt['mk']['tp'] = 3;
801  break;
802  }
803  case 4:
804  case 'position.iconTextH': {
805  $opt['mk']['tp'] = 4;
806  break;
807  }
808  case 5:
809  case 'position.textIconH': {
810  $opt['mk']['tp'] = 5;
811  break;
812  }
813  case 6:
814  case 'position.overlay': {
815  $opt['mk']['tp'] = 6;
816  break;
817  }
818  }
819  }
820  // fillColor: Specifies the background color for a field.
821  if (isset($prop['fillColor'])) {
822  if (is_array($prop['fillColor'])) {
823  $opt['mk']['bg'] = $prop['fillColor'];
824  } else {
825  $opt['mk']['bg'] = TCPDF_COLORS::convertHTMLColorToDec($prop['fillColor'], $spot_colors);
826  }
827  }
828  // strokeColor: Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width.
829  if (isset($prop['strokeColor'])) {
830  if (is_array($prop['strokeColor'])) {
831  $opt['mk']['bc'] = $prop['strokeColor'];
832  } else {
833  $opt['mk']['bc'] = TCPDF_COLORS::convertHTMLColorToDec($prop['strokeColor'], $spot_colors);
834  }
835  }
836  // rotation: The rotation of a widget in counterclockwise increments.
837  if (isset($prop['rotation'])) {
838  $opt['mk']['r'] = $prop['rotation'];
839  }
840  // charLimit: Limits the number of characters that a user can type into a text field.
841  if (isset($prop['charLimit'])) {
842  $opt['maxlen'] = intval($prop['charLimit']);
843  }
844  if (!isset($ff)) {
845  $ff = 0; // default value
846  }
847  // readonly: The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it.
848  if (isset($prop['readonly']) AND ($prop['readonly'] == 'true')) {
849  $ff += 1 << 0;
850  }
851  // required: Specifies whether a field requires a value.
852  if (isset($prop['required']) AND ($prop['required'] == 'true')) {
853  $ff += 1 << 1;
854  }
855  // multiline: Controls how text is wrapped within the field.
856  if (isset($prop['multiline']) AND ($prop['multiline'] == 'true')) {
857  $ff += 1 << 12;
858  }
859  // password: Specifies whether the field should display asterisks when data is entered in the field.
860  if (isset($prop['password']) AND ($prop['password'] == 'true')) {
861  $ff += 1 << 13;
862  }
863  // NoToggleToOff: If set, exactly one radio button shall be selected at all times; selecting the currently selected button has no effect.
864  if (isset($prop['NoToggleToOff']) AND ($prop['NoToggleToOff'] == 'true')) {
865  $ff += 1 << 14;
866  }
867  // Radio: If set, the field is a set of radio buttons.
868  if (isset($prop['Radio']) AND ($prop['Radio'] == 'true')) {
869  $ff += 1 << 15;
870  }
871  // Pushbutton: If set, the field is a pushbutton that does not retain a permanent value.
872  if (isset($prop['Pushbutton']) AND ($prop['Pushbutton'] == 'true')) {
873  $ff += 1 << 16;
874  }
875  // Combo: If set, the field is a combo box; if clear, the field is a list box.
876  if (isset($prop['Combo']) AND ($prop['Combo'] == 'true')) {
877  $ff += 1 << 17;
878  }
879  // editable: Controls whether a combo box is editable.
880  if (isset($prop['editable']) AND ($prop['editable'] == 'true')) {
881  $ff += 1 << 18;
882  }
883  // Sort: If set, the field's option items shall be sorted alphabetically.
884  if (isset($prop['Sort']) AND ($prop['Sort'] == 'true')) {
885  $ff += 1 << 19;
886  }
887  // fileSelect: If true, sets the file-select flag in the Options tab of the text field (Field is Used for File Selection).
888  if (isset($prop['fileSelect']) AND ($prop['fileSelect'] == 'true')) {
889  $ff += 1 << 20;
890  }
891  // multipleSelection: If true, indicates that a list box allows a multiple selection of items.
892  if (isset($prop['multipleSelection']) AND ($prop['multipleSelection'] == 'true')) {
893  $ff += 1 << 21;
894  }
895  // doNotSpellCheck: If true, spell checking is not performed on this editable text field.
896  if (isset($prop['doNotSpellCheck']) AND ($prop['doNotSpellCheck'] == 'true')) {
897  $ff += 1 << 22;
898  }
899  // doNotScroll: If true, the text field does not scroll and the user, therefore, is limited by the rectangular region designed for the field.
900  if (isset($prop['doNotScroll']) AND ($prop['doNotScroll'] == 'true')) {
901  $ff += 1 << 23;
902  }
903  // comb: If set to true, the field background is drawn as series of boxes (one for each character in the value of the field) and each character of the content is drawn within those boxes. The number of boxes drawn is determined from the charLimit property. It applies only to text fields. The setter will also raise if any of the following field properties are also set multiline, password, and fileSelect. A side-effect of setting this property is that the doNotScroll property is also set.
904  if (isset($prop['comb']) AND ($prop['comb'] == 'true')) {
905  $ff += 1 << 24;
906  }
907  // radiosInUnison: If false, even if a group of radio buttons have the same name and export value, they behave in a mutually exclusive fashion, like HTML radio buttons.
908  if (isset($prop['radiosInUnison']) AND ($prop['radiosInUnison'] == 'true')) {
909  $ff += 1 << 25;
910  }
911  // richText: If true, the field allows rich text formatting.
912  if (isset($prop['richText']) AND ($prop['richText'] == 'true')) {
913  $ff += 1 << 25;
914  }
915  // commitOnSelChange: Controls whether a field value is committed after a selection change.
916  if (isset($prop['commitOnSelChange']) AND ($prop['commitOnSelChange'] == 'true')) {
917  $ff += 1 << 26;
918  }
919  $opt['ff'] = $ff;
920  // defaultValue: The default value of a field - that is, the value that the field is set to when the form is reset.
921  if (isset($prop['defaultValue'])) {
922  $opt['dv'] = $prop['defaultValue'];
923  }
924  $f = 4; // default value for annotation flags
925  // readonly: The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it.
926  if (isset($prop['readonly']) AND ($prop['readonly'] == 'true')) {
927  $f += 1 << 6;
928  }
929  // display: Controls whether the field is hidden or visible on screen and in print.
930  if (isset($prop['display'])) {
931  if ($prop['display'] == 'display.visible') {
932  //
933  } elseif ($prop['display'] == 'display.hidden') {
934  $f += 1 << 1;
935  } elseif ($prop['display'] == 'display.noPrint') {
936  $f -= 1 << 2;
937  } elseif ($prop['display'] == 'display.noView') {
938  $f += 1 << 5;
939  }
940  }
941  $opt['f'] = $f;
942  // currentValueIndices: Reads and writes single or multiple values of a list box or combo box.
943  if (isset($prop['currentValueIndices']) AND is_array($prop['currentValueIndices'])) {
944  $opt['i'] = $prop['currentValueIndices'];
945  }
946  // value: The value of the field data that the user has entered.
947  if (isset($prop['value'])) {
948  if (is_array($prop['value'])) {
949  $opt['opt'] = array();
950  foreach ($prop['value'] AS $key => $optval) {
951  // exportValues: An array of strings representing the export values for the field.
952  if (isset($prop['exportValues'][$key])) {
953  $opt['opt'][$key] = array($prop['exportValues'][$key], $prop['value'][$key]);
954  } else {
955  $opt['opt'][$key] = $prop['value'][$key];
956  }
957  }
958  } else {
959  $opt['v'] = $prop['value'];
960  }
961  }
962  // richValue: This property specifies the text contents and formatting of a rich text field.
963  if (isset($prop['richValue'])) {
964  $opt['rv'] = $prop['richValue'];
965  }
966  // submitName: If nonempty, used during form submission instead of name. Only applicable if submitting in HTML format (that is, URL-encoded).
967  if (isset($prop['submitName'])) {
968  $opt['tm'] = $prop['submitName'];
969  }
970  // name: Fully qualified field name.
971  if (isset($prop['name'])) {
972  $opt['t'] = $prop['name'];
973  }
974  // userName: The user name (short description string) of the field.
975  if (isset($prop['userName'])) {
976  $opt['tu'] = $prop['userName'];
977  }
978  // highlight: Defines how a button reacts when a user clicks it.
979  if (isset($prop['highlight'])) {
980  switch ($prop['highlight']) {
981  case 'none':
982  case 'highlight.n': {
983  $opt['h'] = 'N';
984  break;
985  }
986  case 'invert':
987  case 'highlight.i': {
988  $opt['h'] = 'i';
989  break;
990  }
991  case 'push':
992  case 'highlight.p': {
993  $opt['h'] = 'P';
994  break;
995  }
996  case 'outline':
997  case 'highlight.o': {
998  $opt['h'] = 'O';
999  break;
1000  }
1001  }
1002  }
1003  // Unsupported options:
1004  // - calcOrderIndex: Changes the calculation order of fields in the document.
1005  // - delay: Delays the redrawing of a field's appearance.
1006  // - defaultStyle: This property defines the default style attributes for the form field.
1007  // - style: Allows the user to set the glyph style of a check box or radio button.
1008  // - textColor, textFont, textSize
1009  return $opt;
1010  }
static convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'=>128, 'G'=>128, 'B'=>128))
Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBorderMode()

static TCPDF_STATIC::getBorderMode (   $brd,
  $position = 'start',
  $opencell = true 
)
static

Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages)

Parameters
$brd(mixed) Indicates if borders must be drawn around the cell block. The value can be a number:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$position(string) multicell position: 'start', 'middle', 'end'
$opencell(boolean) True when the cell is left open at the page bottom, false otherwise.
Returns
border mode array
Since
4.4.002 (2008-12-09) static

Definition at line 211 of file tcpdf_static.php.

References $border, $style, and array.

Referenced by TCPDF\drawHTMLTagBorder(), and TCPDF\MultiCell().

211  {
212  if ((!$opencell) OR empty($brd)) {
213  return $brd;
214  }
215  if ($brd == 1) {
216  $brd = 'LTRB';
217  }
218  if (is_string($brd)) {
219  // convert string to array
220  $slen = strlen($brd);
221  $newbrd = array();
222  for ($i = 0; $i < $slen; ++$i) {
223  $newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter');
224  }
225  $brd = $newbrd;
226  }
227  foreach ($brd as $border => $style) {
228  switch ($position) {
229  case 'start': {
230  if (strpos($border, 'B') !== false) {
231  // remove bottom line
232  $newkey = str_replace('B', '', $border);
233  if (strlen($newkey) > 0) {
234  $brd[$newkey] = $style;
235  }
236  unset($brd[$border]);
237  }
238  break;
239  }
240  case 'middle': {
241  if (strpos($border, 'B') !== false) {
242  // remove bottom line
243  $newkey = str_replace('B', '', $border);
244  if (strlen($newkey) > 0) {
245  $brd[$newkey] = $style;
246  }
247  unset($brd[$border]);
248  $border = $newkey;
249  }
250  if (strpos($border, 'T') !== false) {
251  // remove bottom line
252  $newkey = str_replace('T', '', $border);
253  if (strlen($newkey) > 0) {
254  $brd[$newkey] = $style;
255  }
256  unset($brd[$border]);
257  }
258  break;
259  }
260  case 'end': {
261  if (strpos($border, 'T') !== false) {
262  // remove bottom line
263  $newkey = str_replace('T', '', $border);
264  if (strlen($newkey) > 0) {
265  $brd[$newkey] = $style;
266  }
267  unset($brd[$border]);
268  }
269  break;
270  }
271  }
272  }
273  return $brd;
274  }
$style
Definition: example_012.php:70
$border
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getCSSdataArray()

static TCPDF_STATIC::getCSSdataArray (   $dom,
  $key,
  $css 
)
static

Returns the styles array that apply for the selected HTML tag.

Parameters
$dom(array) array of HTML tags and properties
$key(int) key of the current HTML tag
$css(array) array of CSS properties
Returns
array containing CSS properties
Since
5.1.000 (2010-05-25) static

Definition at line 1365 of file tcpdf_static.php.

References $style, and array.

Referenced by TCPDF\getHtmlDomArray().

1365  {
1366  $cssarray = array(); // style to be returned
1367  // get parent CSS selectors
1368  $selectors = array();
1369  if (isset($dom[($dom[$key]['parent'])]['csssel'])) {
1370  $selectors = $dom[($dom[$key]['parent'])]['csssel'];
1371  }
1372  // get all styles that apply
1373  foreach($css as $selector => $style) {
1374  $pos = strpos($selector, ' ');
1375  // get specificity
1376  $specificity = substr($selector, 0, $pos);
1377  // remove specificity
1378  $selector = substr($selector, $pos);
1379  // check if this selector apply to current tag
1380  if (self::isValidCSSSelectorForTag($dom, $key, $selector)) {
1381  if (!in_array($selector, $selectors)) {
1382  // add style if not already added on parent selector
1383  $cssarray[] = array('k' => $selector, 's' => $specificity, 'c' => $style);
1384  $selectors[] = $selector;
1385  }
1386  }
1387  }
1388  if (isset($dom[$key]['attribute']['style'])) {
1389  // attach inline style (latest properties have high priority)
1390  $cssarray[] = array('k' => '', 's' => '1000', 'c' => $dom[$key]['attribute']['style']);
1391  }
1392  // order the css array to account for specificity
1393  $cssordered = array();
1394  foreach ($cssarray as $key => $val) {
1395  $skey = sprintf('%04d', $key);
1396  $cssordered[$val['s'].'_'.$skey] = $val;
1397  }
1398  // sort selectors alphabetically to account for specificity
1399  ksort($cssordered, SORT_STRING);
1400  return array($selectors, $cssordered);
1401  }
$style
Definition: example_012.php:70
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getEncPermissionsString()

static TCPDF_STATIC::getEncPermissionsString (   $protection)
static

Convert encryption P value to a string of bytes, low-order byte first.

Parameters
$protection(string) 32bit encryption permission value (P value)
Returns
String
Since
5.0.005 (2010-05-12)
Author
Nicola Asuni static

Definition at line 612 of file tcpdf_static.php.

Referenced by TCPDF\_generateencryptionkey().

612  {
613  $binprot = sprintf('%032b', $protection);
614  $str = chr(bindec(substr($binprot, 24, 8)));
615  $str .= chr(bindec(substr($binprot, 16, 8)));
616  $str .= chr(bindec(substr($binprot, 8, 8)));
617  $str .= chr(bindec(substr($binprot, 0, 8)));
618  return $str;
619  }
+ Here is the caller graph for this function:

◆ getFormattedDate()

static TCPDF_STATIC::getFormattedDate (   $time)
static

Returns a formatted date-time.

Parameters
$time(int) Time in seconds.
Returns
string escaped date string.
Since
5.9.152 (2012-03-23) static

Definition at line 395 of file tcpdf_static.php.

References date.

Referenced by TCPDF\_datestring(), and TCPDF\_putXMP().

395  {
396  return substr_replace(date('YmdHisO', intval($time)), '\'', (0 - 2), 0).'\'';
397  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
+ Here is the caller graph for this function:

◆ getHyphenPatternsFromTEX()

static TCPDF_STATIC::getHyphenPatternsFromTEX (   $file)
static

Returns an array of hyphenation patterns.

Parameters
$file(string) TEX file containing hypenation patterns. TEX pattrns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
Returns
array of hyphenation patterns
Author
Nicola Asuni
Since
4.9.012 (2010-04-12) static

Definition at line 1522 of file tcpdf_static.php.

References $data, $file, array, and empty_string().

Referenced by TCPDF\hyphenateText().

1522  {
1523  // TEX patterns are available at:
1524  // http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
1525  $data = file_get_contents($file);
1526  $patterns = array();
1527  // remove comments
1528  $data = preg_replace('/\%[^\n]*/', '', $data);
1529  // extract the patterns part
1530  preg_match('/\\\\patterns\{([^\}]*)\}/i', $data, $matches);
1531  $data = trim(substr($matches[0], 10, -1));
1532  // extract each pattern
1533  $patterns_array = preg_split('/[\s]+/', $data);
1534  // create new language array of patterns
1535  $patterns = array();
1536  foreach($patterns_array as $val) {
1537  if (!TCPDF_STATIC::empty_string($val)) {
1538  $val = trim($val);
1539  $val = str_replace('\'', '\\\'', $val);
1540  $key = preg_replace('/[0-9]+/', '', $val);
1541  $patterns[$key] = $val;
1542  }
1543  }
1544  return $patterns;
1545  }
static empty_string($str)
Determine whether a string is empty.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjFilename()

static TCPDF_STATIC::getObjFilename (   $type = 'tmp',
  $file_id = '' 
)
static

Returns a temporary filename for caching object on filesystem.

Parameters
$type(string) Type of file (name of the subdir on the tcpdf cache folder).
$file_id(string) TCPDF file_id.
Returns
string filename.
Since
4.5.000 (2008-12-31) static

Definition at line 295 of file tcpdf_static.php.

References getRandomSeed(), and K_PATH_CACHE.

Referenced by TCPDF\_generateencryptionkey(), TCPDF\Image(), and TCPDF\Output().

295  {
296  return tempnam(K_PATH_CACHE, '__tcpdf_'.$file_id.'_'.$type.'_'.md5(TCPDF_STATIC::getRandomSeed()).'_');
297  }
static getRandomSeed($seed='')
Returns a string containing random data to be used as a seed for encryption methods.
const K_PATH_CACHE
Cache directory for temporary files (full path).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageLayoutMode()

static TCPDF_STATIC::getPageLayoutMode (   $layout = 'SinglePage')
static

Get the canonical page layout mode.

Parameters
$layout(string) The page layout. Possible values are:
  • SinglePage Display one page at a time
  • OneColumn Display the pages in one column
  • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
  • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
  • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
  • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
Returns
(string) Canonical page layout name. static

Definition at line 2525 of file tcpdf_static.php.

References $layout.

Referenced by TCPDF\SetDisplayMode().

2525  {
2526  switch ($layout) {
2527  case 'default':
2528  case 'single':
2529  case 'SinglePage': {
2530  $layout_mode = 'SinglePage';
2531  break;
2532  }
2533  case 'continuous':
2534  case 'OneColumn': {
2535  $layout_mode = 'OneColumn';
2536  break;
2537  }
2538  case 'two':
2539  case 'TwoColumnLeft': {
2540  $layout_mode = 'TwoColumnLeft';
2541  break;
2542  }
2543  case 'TwoColumnRight': {
2544  $layout_mode = 'TwoColumnRight';
2545  break;
2546  }
2547  case 'TwoPageLeft': {
2548  $layout_mode = 'TwoPageLeft';
2549  break;
2550  }
2551  case 'TwoPageRight': {
2552  $layout_mode = 'TwoPageRight';
2553  break;
2554  }
2555  default: {
2556  $layout_mode = 'SinglePage';
2557  }
2558  }
2559  return $layout_mode;
2560  }
+ Here is the caller graph for this function:

◆ getPageMode()

static TCPDF_STATIC::getPageMode (   $mode = 'UseNone')
static

Get the canonical page layout mode.

Parameters
$mode(string) A name object specifying how the document should be displayed when opened:
  • UseNone Neither document outline nor thumbnail images visible
  • UseOutlines Document outline visible
  • UseThumbs Thumbnail images visible
  • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
  • UseOC (PDF 1.5) Optional content group panel visible
  • UseAttachments (PDF 1.6) Attachments panel visible
Returns
(string) Canonical page mode name. static

Definition at line 2568 of file tcpdf_static.php.

Referenced by TCPDF\SetDisplayMode().

2568  {
2569  switch ($mode) {
2570  case 'UseNone': {
2571  $page_mode = 'UseNone';
2572  break;
2573  }
2574  case 'UseOutlines': {
2575  $page_mode = 'UseOutlines';
2576  break;
2577  }
2578  case 'UseThumbs': {
2579  $page_mode = 'UseThumbs';
2580  break;
2581  }
2582  case 'FullScreen': {
2583  $page_mode = 'FullScreen';
2584  break;
2585  }
2586  case 'UseOC': {
2587  $page_mode = 'UseOC';
2588  break;
2589  }
2590  case '': {
2591  $page_mode = 'UseAttachments';
2592  break;
2593  }
2594  default: {
2595  $page_mode = 'UseNone';
2596  }
2597  }
2598  return $page_mode;
2599  }
+ Here is the caller graph for this function:

◆ getPageSizeFromFormat()

static TCPDF_STATIC::getPageSizeFromFormat (   $format)
static

Get page dimensions from format name.

Parameters
$format(mixed) The format name
See also
self::$page_format<ul>
Returns
array containing page width and height in points
Since
5.0.010 (2010-05-17) static

Definition at line 2456 of file tcpdf_static.php.

Referenced by TCPDF\setPageFormat().

2456  {
2457  if (isset(self::$page_formats[$format])) {
2458  return self::$page_formats[$format];
2459  }
2460  return self::$page_formats['A4'];
2461  }
+ Here is the caller graph for this function:

◆ getPathPaintOperator()

static TCPDF_STATIC::getPathPaintOperator (   $style,
  $default = 'S' 
)
static

Get the Path-Painting Operators.

Parameters
$style(string) Style of rendering. Possible values are:
  • S or D: Stroke the path.
  • s or d: Close and stroke the path.
  • f or F: Fill the path, using the nonzero winding number rule to determine the region to fill.
  • f* or F*: Fill the path, using the even-odd rule to determine the region to fill.
  • B or FD or DF: Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill.
  • B* or F*D or DF*: Fill and then stroke the path, using the even-odd rule to determine the region to fill.
  • b or fd or df: Close, fill, and then stroke the path, using the nonzero winding number rule to determine the region to fill.
  • b or f*d or df*: Close, fill, and then stroke the path, using the even-odd rule to determine the region to fill.
  • CNZ: Clipping mode using the even-odd rule to determine which regions lie inside the clipping path.
  • CEO: Clipping mode using the nonzero winding number rule to determine which regions lie inside the clipping path
  • n: End the path object without filling or stroking it.
$default(string) default style
Author
Nicola Asuni
Since
5.0.000 (2010-04-30) static

Definition at line 1568 of file tcpdf_static.php.

References $style.

Referenced by TCPDF\Curve(), TCPDF\Ellipse(), TCPDF\PieSectorXY(), TCPDF\Polycurve(), TCPDF\Polygon(), TCPDF\Rect(), TCPDF\RoundedRectXY(), and TCPDF\SVGPath().

1568  {
1569  $op = '';
1570  switch($style) {
1571  case 'S':
1572  case 'D': {
1573  $op = 'S';
1574  break;
1575  }
1576  case 's':
1577  case 'd': {
1578  $op = 's';
1579  break;
1580  }
1581  case 'f':
1582  case 'F': {
1583  $op = 'f';
1584  break;
1585  }
1586  case 'f*':
1587  case 'F*': {
1588  $op = 'f*';
1589  break;
1590  }
1591  case 'B':
1592  case 'FD':
1593  case 'DF': {
1594  $op = 'B';
1595  break;
1596  }
1597  case 'B*':
1598  case 'F*D':
1599  case 'DF*': {
1600  $op = 'B*';
1601  break;
1602  }
1603  case 'b':
1604  case 'fd':
1605  case 'df': {
1606  $op = 'b';
1607  break;
1608  }
1609  case 'b*':
1610  case 'f*d':
1611  case 'df*': {
1612  $op = 'b*';
1613  break;
1614  }
1615  case 'CNZ': {
1616  $op = 'W n';
1617  break;
1618  }
1619  case 'CEO': {
1620  $op = 'W* n';
1621  break;
1622  }
1623  case 'n': {
1624  $op = 'n';
1625  break;
1626  }
1627  default: {
1628  if (!empty($default)) {
1629  $op = self::getPathPaintOperator($default, '');
1630  } else {
1631  $op = '';
1632  }
1633  }
1634  }
1635  return $op;
1636  }
$style
Definition: example_012.php:70
+ Here is the caller graph for this function:

◆ getRandomSeed()

static TCPDF_STATIC::getRandomSeed (   $seed = '')
static

Returns a string containing random data to be used as a seed for encryption methods.

Parameters
$seed(string) starting seed value
Returns
string containing random data
Author
Nicola Asuni
Since
5.9.006 (2010-10-19) static

Definition at line 407 of file tcpdf_static.php.

References $_SERVER.

Referenced by TCPDF\__construct(), TCPDF\_generateencryptionkey(), TCPDF\_Ovalue(), TCPDF\_Uvalue(), getObjFilename(), and TCPDF\SetProtection().

407  {
408  $rnd = uniqid(rand().microtime(true), true);
409  if (function_exists('posix_getpid')) {
410  $rnd .= posix_getpid();
411  }
412  if (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
413  // this is not used on windows systems because it is very slow for a know bug
414  $rnd .= openssl_random_pseudo_bytes(512);
415  } else {
416  for ($i = 0; $i < 23; ++$i) {
417  $rnd .= uniqid('', true);
418  }
419  }
420  return $rnd.$seed.__FILE__.serialize($_SERVER).microtime(true);
421  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
+ Here is the caller graph for this function:

◆ getSVGTransformMatrix()

static TCPDF_STATIC::getSVGTransformMatrix (   $attribute)
static

Get the tranformation matrix from SVG transform attribute.

Parameters
$attribute(string) transformation
Returns
array of transformations
Author
Nicola Asuni
Since
5.0.000 (2010-05-02) static

Definition at line 1666 of file tcpdf_static.php.

References $d, $data, $x, $y, and array.

Referenced by TCPDF\startSVGElementHandler().

1666  {
1667  // identity matrix
1668  $tm = array(1, 0, 0, 1, 0, 0);
1669  $transform = array();
1670  if (preg_match_all('/(matrix|translate|scale|rotate|skewX|skewY)[\s]*\(([^\)]+)\)/si', $attribute, $transform, PREG_SET_ORDER) > 0) {
1671  foreach ($transform as $key => $data) {
1672  if (!empty($data[2])) {
1673  $a = 1;
1674  $b = 0;
1675  $c = 0;
1676  $d = 1;
1677  $e = 0;
1678  $f = 0;
1679  $regs = array();
1680  switch ($data[1]) {
1681  case 'matrix': {
1682  if (preg_match('/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1683  $a = $regs[1];
1684  $b = $regs[2];
1685  $c = $regs[3];
1686  $d = $regs[4];
1687  $e = $regs[5];
1688  $f = $regs[6];
1689  }
1690  break;
1691  }
1692  case 'translate': {
1693  if (preg_match('/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1694  $e = $regs[1];
1695  $f = $regs[2];
1696  } elseif (preg_match('/([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1697  $e = $regs[1];
1698  }
1699  break;
1700  }
1701  case 'scale': {
1702  if (preg_match('/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1703  $a = $regs[1];
1704  $d = $regs[2];
1705  } elseif (preg_match('/([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1706  $a = $regs[1];
1707  $d = $a;
1708  }
1709  break;
1710  }
1711  case 'rotate': {
1712  if (preg_match('/([0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', $data[2], $regs)) {
1713  $ang = deg2rad($regs[1]);
1714  $x = $regs[2];
1715  $y = $regs[3];
1716  $a = cos($ang);
1717  $b = sin($ang);
1718  $c = -$b;
1719  $d = $a;
1720  $e = ($x * (1 - $a)) - ($y * $c);
1721  $f = ($y * (1 - $d)) - ($x * $b);
1722  } elseif (preg_match('/([0-9\-\.]+)/si', $data[2], $regs)) {
1723  $ang = deg2rad($regs[1]);
1724  $a = cos($ang);
1725  $b = sin($ang);
1726  $c = -$b;
1727  $d = $a;
1728  $e = 0;
1729  $f = 0;
1730  }
1731  break;
1732  }
1733  case 'skewX': {
1734  if (preg_match('/([0-9\-\.]+)/si', $data[2], $regs)) {
1735  $c = tan(deg2rad($regs[1]));
1736  }
1737  break;
1738  }
1739  case 'skewY': {
1740  if (preg_match('/([0-9\-\.]+)/si', $data[2], $regs)) {
1741  $b = tan(deg2rad($regs[1]));
1742  }
1743  break;
1744  }
1745  }
1746  $tm = self::getTransformationMatrixProduct($tm, array($a, $b, $c, $d, $e, $f));
1747  }
1748  }
1749  }
1750  return $tm;
1751  }
$x
Definition: example_009.php:98
for($col=0; $col< 50; $col++) $d
$y
Definition: example_007.php:83
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getTagStyleFromCSSarray()

static TCPDF_STATIC::getTagStyleFromCSSarray (   $css)
static

Compact CSS data array into single string.

Parameters
$css(array) array of CSS properties
Returns
string containing merged CSS properties
Since
5.9.070 (2011-04-19) static

Definition at line 1410 of file tcpdf_static.php.

References $cmd, and $style.

Referenced by TCPDF\getHtmlDomArray().

1410  {
1411  $tagstyle = ''; // value to be returned
1412  foreach ($css as $style) {
1413  // split single css commands
1414  $csscmds = explode(';', $style['c']);
1415  foreach ($csscmds as $cmd) {
1416  if (!empty($cmd)) {
1417  $pos = strpos($cmd, ':');
1418  if ($pos !== false) {
1419  $cmd = substr($cmd, 0, ($pos + 1));
1420  if (strpos($tagstyle, $cmd) !== false) {
1421  // remove duplicate commands (last commands have high priority)
1422  $tagstyle = preg_replace('/'.$cmd.'[^;]+/i', '', $tagstyle);
1423  }
1424  }
1425  }
1426  }
1427  $tagstyle .= ';'.$style['c'];
1428  }
1429  // remove multiple semicolons
1430  $tagstyle = preg_replace('/[;]+/', ';', $tagstyle);
1431  return $tagstyle;
1432  }
$style
Definition: example_012.php:70
$cmd
Definition: sahs_server.php:35
+ Here is the caller graph for this function:

◆ getTCPDFProducer()

static TCPDF_STATIC::getTCPDFProducer ( )
static

Return the current TCPDF producer.

Returns
TCPDF producer string
Since
6.0.000 (2013-03-16) static

Definition at line 127 of file tcpdf_static.php.

Referenced by TCPDF\_putinfo(), and TCPDF\_putXMP().

127  {
128  return "\x54\x43\x50\x44\x46\x20".self::getTCPDFVersion()."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
129  }
+ Here is the caller graph for this function:

◆ getTCPDFVersion()

static TCPDF_STATIC::getTCPDFVersion ( )
static

Return the current TCPDF version.

Returns
TCPDF version string
Since
5.9.012 (2010-11-10) static

Definition at line 117 of file tcpdf_static.php.

117  {
118  return self::$tcpdf_version;
119  }

◆ getTimestamp()

static TCPDF_STATIC::getTimestamp (   $date)
static

Returns timestamp in seconds from formatted date-time.

Parameters
$date(string) Formatted date-time.
Returns
int seconds.
Since
5.9.152 (2012-03-23) static

Definition at line 380 of file tcpdf_static.php.

Referenced by TCPDF\setDocCreationTimestamp(), and TCPDF\setDocModificationTimestamp().

380  {
381  if (($date[0] == 'D') AND ($date[1] == ':')) {
382  // remove date prefix if present
383  $date = substr($date, 2);
384  }
385  return strtotime($date);
386  }
+ Here is the caller graph for this function:

◆ getTransformationMatrixProduct()

static TCPDF_STATIC::getTransformationMatrixProduct (   $ta,
  $tb 
)
static

Get the product of two SVG tranformation matrices.

Parameters
$ta(array) first SVG tranformation matrix
$tb(array) second SVG tranformation matrix
Returns
transformation array
Author
Nicola Asuni
Since
5.0.000 (2010-05-02) static

Definition at line 1647 of file tcpdf_static.php.

References array.

Referenced by TCPDF\printTemplate(), and TCPDF\startSVGElementHandler().

1647  {
1648  $tm = array();
1649  $tm[0] = ($ta[0] * $tb[0]) + ($ta[2] * $tb[1]);
1650  $tm[1] = ($ta[1] * $tb[0]) + ($ta[3] * $tb[1]);
1651  $tm[2] = ($ta[0] * $tb[2]) + ($ta[2] * $tb[3]);
1652  $tm[3] = ($ta[1] * $tb[2]) + ($ta[3] * $tb[3]);
1653  $tm[4] = ($ta[0] * $tb[4]) + ($ta[2] * $tb[5]) + $ta[4];
1654  $tm[5] = ($ta[1] * $tb[4]) + ($ta[3] * $tb[5]) + $ta[5];
1655  return $tm;
1656  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getUserPermissionCode()

static TCPDF_STATIC::getUserPermissionCode (   $permissions,
  $mode = 0 
)
static

Return the permission code used on encryption (P value).

Parameters
$permissions(Array) the set of permissions (specify the ones you want to block).
$mode(int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.
Since
5.0.005 (2010-05-12)
Author
Nicola Asuni static

Definition at line 536 of file tcpdf_static.php.

References $options, and array.

Referenced by TCPDF\_generateencryptionkey(), and TCPDF\SetProtection().

536  {
537  $options = array(
538  'owner' => 2, // bit 2 -- inverted logic: cleared by default
539  'print' => 4, // bit 3
540  'modify' => 8, // bit 4
541  'copy' => 16, // bit 5
542  'annot-forms' => 32, // bit 6
543  'fill-forms' => 256, // bit 9
544  'extract' => 512, // bit 10
545  'assemble' => 1024,// bit 11
546  'print-high' => 2048 // bit 12
547  );
548  $protection = 2147422012; // 32 bit: (01111111 11111111 00001111 00111100)
549  foreach ($permissions as $permission) {
550  if (isset($options[$permission])) {
551  if (($mode > 0) OR ($options[$permission] <= 32)) {
552  // set only valid permissions
553  if ($options[$permission] == 2) {
554  // the logic for bit 2 is inverted (cleared by default)
555  $protection += $options[$permission];
556  } else {
557  $protection -= $options[$permission];
558  }
559  }
560  }
561  }
562  return $protection;
563  }
if(!is_array($argv)) $options
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getVectorsAngle()

static TCPDF_STATIC::getVectorsAngle (   $x1,
  $y1,
  $x2,
  $y2 
)
static

Returns the angle in radiants between two vectors.

Parameters
$x1(int) X coordinate of first vector point
$y1(int) Y coordinate of first vector point
$x2(int) X coordinate of second vector point
$y2(int) Y coordinate of second vector point
Author
Nicola Asuni
Since
5.0.000 (2010-05-04) static

Definition at line 1763 of file tcpdf_static.php.

References $angle.

Referenced by TCPDF\SVGPath().

1763  {
1764  $dprod = ($x1 * $x2) + ($y1 * $y2);
1765  $dist1 = sqrt(($x1 * $x1) + ($y1 * $y1));
1766  $dist2 = sqrt(($x2 * $x2) + ($y2 * $y2));
1767  $angle = acos($dprod / ($dist1 * $dist2));
1768  if (is_nan($angle)) {
1769  $angle = M_PI;
1770  }
1771  if ((($x1 * $y2) - ($x2 * $y1)) < 0) {
1772  $angle *= -1;
1773  }
1774  return $angle;
1775  }
$angle
+ Here is the caller graph for this function:

◆ intToRoman()

static TCPDF_STATIC::intToRoman (   $number)
static

Returns the Roman representation of an integer number.

Parameters
$number(int) number to convert
Returns
string roman representation of the specified number
Since
4.4.004 (2008-12-10) static

Definition at line 1441 of file tcpdf_static.php.

Referenced by TCPDF\putHtmlListBullet().

1441  {
1442  $roman = '';
1443  while ($number >= 1000) {
1444  $roman .= 'M';
1445  $number -= 1000;
1446  }
1447  while ($number >= 900) {
1448  $roman .= 'CM';
1449  $number -= 900;
1450  }
1451  while ($number >= 500) {
1452  $roman .= 'D';
1453  $number -= 500;
1454  }
1455  while ($number >= 400) {
1456  $roman .= 'CD';
1457  $number -= 400;
1458  }
1459  while ($number >= 100) {
1460  $roman .= 'C';
1461  $number -= 100;
1462  }
1463  while ($number >= 90) {
1464  $roman .= 'XC';
1465  $number -= 90;
1466  }
1467  while ($number >= 50) {
1468  $roman .= 'L';
1469  $number -= 50;
1470  }
1471  while ($number >= 40) {
1472  $roman .= 'XL';
1473  $number -= 40;
1474  }
1475  while ($number >= 10) {
1476  $roman .= 'X';
1477  $number -= 10;
1478  }
1479  while ($number >= 9) {
1480  $roman .= 'IX';
1481  $number -= 9;
1482  }
1483  while ($number >= 5) {
1484  $roman .= 'V';
1485  $number -= 5;
1486  }
1487  while ($number >= 4) {
1488  $roman .= 'IV';
1489  $number -= 4;
1490  }
1491  while ($number >= 1) {
1492  $roman .= 'I';
1493  --$number;
1494  }
1495  return $roman;
1496  }
+ Here is the caller graph for this function:

◆ isValidCSSSelectorForTag()

static TCPDF_STATIC::isValidCSSSelectorForTag (   $dom,
  $key,
  $selector 
)
static

Returns true if the CSS selector is valid for the selected HTML tag.

Parameters
$dom(array) array of HTML tags and properties
$key(int) key of the current HTML tag
$selector(string) CSS selector string
Returns
true if the selector is valid, false otherwise
Since
5.1.000 (2010-05-25) static

Definition at line 1205 of file tcpdf_static.php.

References $attrib, $valid, and array.

1205  {
1206  $valid = false; // value to be returned
1207  $tag = $dom[$key]['value'];
1208  $class = array();
1209  if (isset($dom[$key]['attribute']['class']) AND !empty($dom[$key]['attribute']['class'])) {
1210  $class = explode(' ', strtolower($dom[$key]['attribute']['class']));
1211  }
1212  $id = '';
1213  if (isset($dom[$key]['attribute']['id']) AND !empty($dom[$key]['attribute']['id'])) {
1214  $id = strtolower($dom[$key]['attribute']['id']);
1215  }
1216  $selector = preg_replace('/([>\+\~\s]{1})([\.]{1})([^>\+\~\s]*)/si', '\\1*.\\3', $selector);
1217  $matches = array();
1218  if (preg_match_all('/([>\+\~\s]{1})([a-zA-Z0-9\*]+)([^>\+\~\s]*)/si', $selector, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) > 0) {
1219  $parentop = array_pop($matches[1]);
1220  $operator = $parentop[0];
1221  $offset = $parentop[1];
1222  $lasttag = array_pop($matches[2]);
1223  $lasttag = strtolower(trim($lasttag[0]));
1224  if (($lasttag == '*') OR ($lasttag == $tag)) {
1225  // the last element on selector is our tag or 'any tag'
1226  $attrib = array_pop($matches[3]);
1227  $attrib = strtolower(trim($attrib[0]));
1228  if (!empty($attrib)) {
1229  // check if matches class, id, attribute, pseudo-class or pseudo-element
1230  switch ($attrib[0]) {
1231  case '.': { // class
1232  if (in_array(substr($attrib, 1), $class)) {
1233  $valid = true;
1234  }
1235  break;
1236  }
1237  case '#': { // ID
1238  if (substr($attrib, 1) == $id) {
1239  $valid = true;
1240  }
1241  break;
1242  }
1243  case '[': { // attribute
1244  $attrmatch = array();
1245  if (preg_match('/\[([a-zA-Z0-9]*)[\s]*([\~\^\$\*\|\=]*)[\s]*["]?([^"\]]*)["]?\]/i', $attrib, $attrmatch) > 0) {
1246  $att = strtolower($attrmatch[1]);
1247  $val = $attrmatch[3];
1248  if (isset($dom[$key]['attribute'][$att])) {
1249  switch ($attrmatch[2]) {
1250  case '=': {
1251  if ($dom[$key]['attribute'][$att] == $val) {
1252  $valid = true;
1253  }
1254  break;
1255  }
1256  case '~=': {
1257  if (in_array($val, explode(' ', $dom[$key]['attribute'][$att]))) {
1258  $valid = true;
1259  }
1260  break;
1261  }
1262  case '^=': {
1263  if ($val == substr($dom[$key]['attribute'][$att], 0, strlen($val))) {
1264  $valid = true;
1265  }
1266  break;
1267  }
1268  case '$=': {
1269  if ($val == substr($dom[$key]['attribute'][$att], -strlen($val))) {
1270  $valid = true;
1271  }
1272  break;
1273  }
1274  case '*=': {
1275  if (strpos($dom[$key]['attribute'][$att], $val) !== false) {
1276  $valid = true;
1277  }
1278  break;
1279  }
1280  case '|=': {
1281  if ($dom[$key]['attribute'][$att] == $val) {
1282  $valid = true;
1283  } elseif (preg_match('/'.$val.'[\-]{1}/i', $dom[$key]['attribute'][$att]) > 0) {
1284  $valid = true;
1285  }
1286  break;
1287  }
1288  default: {
1289  $valid = true;
1290  }
1291  }
1292  }
1293  }
1294  break;
1295  }
1296  case ':': { // pseudo-class or pseudo-element
1297  if ($attrib[1] == ':') { // pseudo-element
1298  // pseudo-elements are not supported!
1299  // (::first-line, ::first-letter, ::before, ::after)
1300  } else { // pseudo-class
1301  // pseudo-classes are not supported!
1302  // (:root, :nth-child(n), :nth-last-child(n), :nth-of-type(n), :nth-last-of-type(n), :first-child, :last-child, :first-of-type, :last-of-type, :only-child, :only-of-type, :empty, :link, :visited, :active, :hover, :focus, :target, :lang(fr), :enabled, :disabled, :checked)
1303  }
1304  break;
1305  }
1306  } // end of switch
1307  } else {
1308  $valid = true;
1309  }
1310  if ($valid AND ($offset > 0)) {
1311  $valid = false;
1312  // check remaining selector part
1313  $selector = substr($selector, 0, $offset);
1314  switch ($operator) {
1315  case ' ': { // descendant of an element
1316  while ($dom[$key]['parent'] > 0) {
1317  if (self::isValidCSSSelectorForTag($dom, $dom[$key]['parent'], $selector)) {
1318  $valid = true;
1319  break;
1320  } else {
1321  $key = $dom[$key]['parent'];
1322  }
1323  }
1324  break;
1325  }
1326  case '>': { // child of an element
1327  $valid = self::isValidCSSSelectorForTag($dom, $dom[$key]['parent'], $selector);
1328  break;
1329  }
1330  case '+': { // immediately preceded by an element
1331  for ($i = ($key - 1); $i > $dom[$key]['parent']; --$i) {
1332  if ($dom[$i]['tag'] AND $dom[$i]['opening']) {
1333  $valid = self::isValidCSSSelectorForTag($dom, $i, $selector);
1334  break;
1335  }
1336  }
1337  break;
1338  }
1339  case '~': { // preceded by an element
1340  for ($i = ($key - 1); $i > $dom[$key]['parent']; --$i) {
1341  if ($dom[$i]['tag'] AND $dom[$i]['opening']) {
1342  if (self::isValidCSSSelectorForTag($dom, $i, $selector)) {
1343  break;
1344  }
1345  }
1346  }
1347  break;
1348  }
1349  }
1350  }
1351  }
1352  }
1353  return $valid;
1354  }
$attrib
Regular expression to match HTML/XML attribute pairs within a tag.
Definition: Sanitizer.php:41
$valid
Create styles array
The data for the language used.

◆ isValidURL()

static TCPDF_STATIC::isValidURL (   $url)
static

Check if the URL exist.

Parameters
$url(string) URL to check.
Returns
Boolean true if the URl exist, false otherwise.
Since
5.9.204 (2013-01-28) static

Definition at line 171 of file tcpdf_static.php.

References $url.

Referenced by TCPDF\Annotation().

171  {
172  $headers = @get_headers($url);
173  return (strpos($headers[0], '200') !== false);
174  }
$url
Definition: shib_logout.php:72
+ Here is the caller graph for this function:

◆ objclone()

static TCPDF_STATIC::objclone (   $object)
static

Creates a copy of a class object.

Parameters
$object(object) class object to be cloned
Returns
cloned object
Since
4.5.029 (2009-03-19) static

Definition at line 330 of file tcpdf_static.php.

Referenced by TCPDF\ImagePngAlpha(), and TCPDF\startTransaction().

330  {
331  if (($object instanceof Imagick) AND (version_compare(phpversion('imagick'), '3.0.1') !== 1)) {
332  // on the versions after 3.0.1 the clone() method was deprecated in favour of clone keyword
333  return @$object->clone();
334  }
335  return @clone($object);
336  }
+ Here is the caller graph for this function:

◆ pregSplit()

static TCPDF_STATIC::pregSplit (   $pattern,
  $modifiers,
  $subject,
  $limit = NULL,
  $flags = NULL 
)
static

Split string by a regular expression.

This is a wrapper for the preg_split function to avoid the bug: https://bugs.php.net/bug.php?id=45850

Parameters
$pattern(string) The regular expression pattern to search for without the modifiers, as a string.
$modifiers(string) The modifiers part of the pattern,
$subject(string) The input string.
$limit(int) If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1, 0 or NULL means "no limit" and, as is standard across PHP, you can use NULL to skip to the flags parameter.
$flags(int) The flags as specified on the preg_split PHP function.
Returns
Returns an array containing substrings of subject split along boundaries matched by pattern.modifier
Author
Nicola Asuni
Since
6.0.023 static

Definition at line 1823 of file tcpdf_static.php.

References $ret, and array.

Referenced by TCPDF_FONTS\UTF8StringToArray(), TCPDF\Write(), and TCPDF\writeHTML().

1823  {
1824  // the bug only happens on PHP 5.2 when using the u modifier
1825  if ((strpos($modifiers, 'u') === FALSE) OR (count(preg_split('//u', "\n\t", -1, PREG_SPLIT_NO_EMPTY)) == 2)) {
1826  return preg_split($pattern.$modifiers, $subject, $limit, $flags);
1827  }
1828  // preg_split is bugged - try alternative solution
1829  $ret = array();
1830  while (($nl = strpos($subject, "\n")) !== FALSE) {
1831  $ret = array_merge($ret, preg_split($pattern.$modifiers, substr($subject, 0, $nl), $limit, $flags));
1832  $ret[] = "\n";
1833  $subject = substr($subject, ($nl + 1));
1834  }
1835  if (strlen($subject) > 0) {
1836  $ret = array_merge($ret, preg_split($pattern.$modifiers, $subject, $limit, $flags));
1837  }
1838  return $ret;
1839  }
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ removeSHY()

static TCPDF_STATIC::removeSHY (   $txt = '',
  $unicode = true 
)
static

Removes SHY characters from text.

Unicode Data:

  • Name : SOFT HYPHEN, commonly abbreviated as SHY
  • HTML Entity (decimal): "&amp;#173;"
  • HTML Entity (hex): "&amp;#xad;"
  • HTML Entity (named): "&amp;shy;"
  • How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173]
  • UTF-8 (hex): 0xC2 0xAD (c2ad)
  • UTF-8 character: chr(194).chr(173)
Parameters
$txt(string) input string
$unicode(boolean) True if we are in unicode mode, false otherwise.
Returns
string without SHY characters.
Since
(4.5.019) 2009-02-28 static

Definition at line 193 of file tcpdf_static.php.

References $txt.

Referenced by TCPDF\getCellCode().

193  {
194  $txt = preg_replace('/([\\xc2]{1}[\\xad]{1})/', '', $txt);
195  if (!$unicode) {
196  $txt = preg_replace('/([\\xad]{1})/', '', $txt);
197  }
198  return $txt;
199  }
$txt
Definition: error.php:12
+ Here is the caller graph for this function:

◆ replacePageNumAliases()

static TCPDF_STATIC::replacePageNumAliases (   $page,
  $replace,
  $diff = 0 
)
static

Replace page number aliases with number.

Parameters
$page(string) Page content.
$replace(array) Array of replacements (array keys are replacement strings, values are alias arrays).
$diff(int) If passed, this will be set to the total char number difference between alias and replacements.
Returns
replaced page content and updated $diff parameter as array. static

Definition at line 361 of file tcpdf_static.php.

References array.

Referenced by TCPDF\_putpages().

361  {
362  foreach ($replace as $rep) {
363  foreach ($rep[3] as $a) {
364  if (strpos($page, $a) !== false) {
365  $page = str_replace($a, $rep[0], $page);
366  $diff += ($rep[2] - $rep[1]);
367  }
368  }
369  }
370  return array($page, $diff);
371  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ revstrpos()

static TCPDF_STATIC::revstrpos (   $haystack,
  $needle,
  $offset = 0 
)
static

Find position of last occurrence of a substring in a string.

Parameters
$haystack(string) The string to search in.
$needle(string) substring to search.
$offset(int) May be specified to begin searching an arbitrary number of characters into the string.
Returns
Returns the position where the needle exists. Returns FALSE if the needle was not found.
Since
4.8.038 (2010-03-13) static

Definition at line 1507 of file tcpdf_static.php.

Referenced by TCPDF\writeHTML().

1507  {
1508  $length = strlen($haystack);
1509  $offset = ($offset > 0)?($length - $offset):abs($offset);
1510  $pos = strpos(strrev($haystack), strrev($needle), $offset);
1511  return ($pos === false)?false:($length - $pos - strlen($needle));
1512  }
+ Here is the caller graph for this function:

◆ rfread()

static TCPDF_STATIC::rfread (   $handle,
  $length 
)
static

Binary-safe and URL-safe file read.

Reads up to length bytes from the file pointer referenced by handle. Reading stops as soon as one of the following conditions is met: length bytes have been read; EOF (end of file) is reached.

Parameters
$handle(resource)
$length(int)
Returns
Returns the read string or FALSE in case of error.
Author
Nicola Asuni
Since
4.5.027 (2009-03-16) static

Definition at line 2068 of file tcpdf_static.php.

References $data, and $rest.

Referenced by TCPDF_IMAGES\_parsepng().

2068  {
2069  $data = fread($handle, $length);
2070  if ($data === false) {
2071  return false;
2072  }
2073  $rest = ($length - strlen($data));
2074  if (($rest > 0) && !feof($handle)) {
2075  $data .= self::rfread($handle, $rest);
2076  }
2077  return $data;
2078  }
$rest
Definition: goto.php:48
+ Here is the caller graph for this function:

◆ sendOutputData()

static TCPDF_STATIC::sendOutputData (   $data,
  $length 
)
static

Output input data and compress it if possible.

Parameters
$data(string) Data to output.
$length(int) Data length in bytes.
Since
5.9.086 static

Definition at line 345 of file tcpdf_static.php.

References $_SERVER, $data, and header.

Referenced by TCPDF\Output().

345  {
346  if (!isset($_SERVER['HTTP_ACCEPT_ENCODING']) OR empty($_SERVER['HTTP_ACCEPT_ENCODING'])) {
347  // the content length may vary if the server is using compression
348  header('Content-Length: '.$length);
349  }
350  echo $data;
351  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Add a drawing to the header
Definition: 04printing.php:69
+ Here is the caller graph for this function:

◆ set_mqr()

static TCPDF_STATIC::set_mqr (   $mqr)
static

Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtime function exist)

Parameters
$mqr(boolean) FALSE for off, TRUE for on.
Since
4.6.025 (2009-08-17) static

Definition at line 137 of file tcpdf_static.php.

References $version, and defined.

Referenced by TCPDF\_putfonts(), and TCPDF\Image().

137  {
138  if (!defined('PHP_VERSION_ID')) {
139  $version = PHP_VERSION;
140  define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
141  }
142  if (PHP_VERSION_ID < 50300) {
143  @set_magic_quotes_runtime($mqr);
144  }
145  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the caller graph for this function:

◆ setPageBoxes()

static TCPDF_STATIC::setPageBoxes (   $page,
  $type,
  $llx,
  $lly,
  $urx,
  $ury,
  $points = false,
  $k,
  $pagedim = array() 
)
static

Set page boundaries.

Parameters
$page(int) page number
$type(string) valid values are:
  • 'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;
  • 'CropBox' : the visible region of default user space;
  • 'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;
  • 'TrimBox' : the intended dimensions of the finished page after trimming;
  • 'ArtBox' : the page's meaningful content (including potential white space).
$llx(float) lower-left x coordinate in user units.
$lly(float) lower-left y coordinate in user units.
$urx(float) upper-right x coordinate in user units.
$ury(float) upper-right y coordinate in user units.
$points(boolean) If true uses user units as unit of measure, otherwise uses PDF points.
$k(float) Scale factor (number of points in user unit).
$pagedim(array) Array of page dimensions.
Returns
pagedim array of page dimensions.
Since
5.0.010 (2010-05-17) static

Definition at line 2478 of file tcpdf_static.php.

References array.

Referenced by TCPDF\setPageFormat(), and TCPDF\setPageOrientation().

2478  {
2479  if (!isset($pagedim[$page])) {
2480  // initialize array
2481  $pagedim[$page] = array();
2482  }
2483  if (!in_array($type, self::$pageboxes)) {
2484  return;
2485  }
2486  if ($points) {
2487  $k = 1;
2488  }
2489  $pagedim[$page][$type]['llx'] = ($llx * $k);
2490  $pagedim[$page][$type]['lly'] = ($lly * $k);
2491  $pagedim[$page][$type]['urx'] = ($urx * $k);
2492  $pagedim[$page][$type]['ury'] = ($ury * $k);
2493  return $pagedim;
2494  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ swapPageBoxCoordinates()

static TCPDF_STATIC::swapPageBoxCoordinates (   $page,
  $pagedim 
)
static

Swap X and Y coordinates of page boxes (change page boxes orientation).

Parameters
$page(int) page number
$pagedim(array) Array of page dimensions.
Returns
pagedim array of page dimensions.
Since
5.0.010 (2010-05-17) static

Definition at line 2504 of file tcpdf_static.php.

Referenced by TCPDF\setPageOrientation().

2504  {
2505  foreach (self::$pageboxes as $type) {
2506  // swap X and Y coordinates
2507  if (isset($pagedim[$page][$type])) {
2508  $tmp = $pagedim[$page][$type]['llx'];
2509  $pagedim[$page][$type]['llx'] = $pagedim[$page][$type]['lly'];
2510  $pagedim[$page][$type]['lly'] = $tmp;
2511  $tmp = $pagedim[$page][$type]['urx'];
2512  $pagedim[$page][$type]['urx'] = $pagedim[$page][$type]['ury'];
2513  $pagedim[$page][$type]['ury'] = $tmp;
2514  }
2515  }
2516  return $pagedim;
2517  }
+ Here is the caller graph for this function:

Field Documentation

◆ $alias_group_num_page

TCPDF_STATIC::$alias_group_num_page = '{:png:}'
static

String alias for group page number.

static

Definition at line 82 of file tcpdf_static.php.

Referenced by TCPDF\getAllInternalPageNumberAliases(), and TCPDF\getPageNumGroupAlias().

◆ $alias_group_tot_pages

TCPDF_STATIC::$alias_group_tot_pages = '{:ptg:}'
static

String alias for total number of pages in a single group.

static

Definition at line 76 of file tcpdf_static.php.

Referenced by TCPDF\getAllInternalPageNumberAliases(), and TCPDF\getPageGroupAlias().

◆ $alias_num_page

TCPDF_STATIC::$alias_num_page = '{:pnp:}'
static

String alias for page number.

static

Definition at line 70 of file tcpdf_static.php.

Referenced by TCPDF\getAliasNumPage(), TCPDF\getAliasRightShift(), and TCPDF\getAllInternalPageNumberAliases().

◆ $alias_right_shift

TCPDF_STATIC::$alias_right_shift = '{rsc:'
static

String alias for right shift compensation used to correctly align page numbers on the right.

static

Definition at line 88 of file tcpdf_static.php.

Referenced by TCPDF\getAliasRightShift(), and TCPDF\getAllInternalPageNumberAliases().

◆ $alias_tot_pages

TCPDF_STATIC::$alias_tot_pages = '{:ptp:}'
static

String alias for total number of pages.

static

Definition at line 64 of file tcpdf_static.php.

Referenced by TCPDF\getAliasNbPages(), TCPDF\getAliasRightShift(), and TCPDF\getAllInternalPageNumberAliases().

◆ $byterange_string

TCPDF_STATIC::$byterange_string = '/ByteRange[0 ********** ********** **********]'
static

ByteRange placemark used during digital signature process.

Since
4.6.028 (2009-08-25) static

Definition at line 101 of file tcpdf_static.php.

Referenced by TCPDF\Output().

◆ $enc_padding

TCPDF_STATIC::$enc_padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A"
static

Encryption padding string.

static

Definition at line 94 of file tcpdf_static.php.

Referenced by TCPDF\_generateencryptionkey(), and TCPDF\_Uvalue().

◆ $page_formats

TCPDF_STATIC::$page_formats
static

Array of page formats measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4) static.

Definition at line 2097 of file tcpdf_static.php.

◆ $pageboxes

TCPDF_STATIC::$pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox')
static

Array page boxes names static.

Definition at line 107 of file tcpdf_static.php.

Referenced by TCPDF\setPageBoxTypes().

◆ $tcpdf_version

TCPDF_STATIC::$tcpdf_version = '6.2.12'
staticprivate

Current TCPDF version.

static

Definition at line 58 of file tcpdf_static.php.


The documentation for this class was generated from the following file: