Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Static methods used by the TCPDF class. More...
Static Public Member Functions | |
static | _AES ($key, $text) |
Returns the input text encrypted using AES algorithm and the specified key. | |
static | _AESnopad ($key, $text) |
Returns the input text encrypted using AES algorithm and the specified key. | |
static | _escape ($s) |
Add "::" before "\", "(" and ")". | |
static | _escapeXML ($str) |
Escape some special characters (< > &) for XML output. | |
static | _freadint ($f) |
Read a 4-byte (32 bit) integer from file. | |
static | _getBYTE ($str, $offset) |
Get BYTE from string (8-bit unsigned integer). | |
static | _getFIXED ($str, $offset) |
Get FIXED from string (32-bit signed fixed-point number (16.16). | |
static | _getFWORD ($str, $offset) |
Get FWORD from string (Big Endian 16-bit signed integer). | |
static | _getSHORT ($str, $offset) |
Get SHORT from string (Big Endian 16-bit signed integer). | |
static | _getUFWORD ($str, $offset) |
Get UFWORD from string (Big Endian 16-bit unsigned integer). | |
static | _getULONG ($str, $offset) |
Get ULONG from string (Big Endian 32-bit unsigned integer). | |
static | _getUSHORT ($str, $offset) |
Get USHORT from string (Big Endian 16-bit unsigned integer). | |
static | _md5_16 ($str) |
Encrypts a string using MD5 and returns it's value as a binary string. | |
static | _RC4 ($key, $text, &$last_enc_key, &$last_enc_key_c) |
Returns the input text encrypted using RC4 algorithm and the specified key. | |
static | convertHexStringToString ($bs) |
Convert hexadecimal string to string. | |
static | convertStringToHexString ($s) |
Convert string to hexadecimal string (byte string) | |
static | empty_string ($str) |
Determine whether a string is empty. | |
static | encodeNameObject ($name) |
Encode a name object. | |
static | encodeUrlQuery ($url) |
Encode query params in URL. | |
static | extractCSSproperties ($cssdata) |
Extracts the CSS properties from a CSS string. | |
static | file_exists ($filename) |
Wrapper for file_exists. | |
static | fileGetContents ($file) |
Reads entire file into a string. | |
static | fixHTMLCode ($html, $default_css, $tagvs, $tidy_options, &$tagvspaces) |
Cleanup HTML code (requires HTML Tidy library). | |
static | fopenLocal ($filename, $mode) |
Wrapper to use fopen only with local files. | |
static | formatPageNumber ($num) |
Format the page numbers. | |
static | formatTOCPageNumber ($num) |
Format the page numbers on the Table Of Content. | |
static | getAnnotOptFromJSProp ($prop, &$spot_colors, $rtl=false) |
Convert JavaScript form fields properties array to Annotation Properties array. | |
static | getBorderMode ($brd, $position='start', $opencell=true) |
Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages) | |
static | getCSSdataArray ($dom, $key, $css) |
Returns the styles array that apply for the selected HTML tag. | |
static | getEncPermissionsString ($protection) |
Convert encryption P value to a string of bytes, low-order byte first. | |
static | getFormattedDate ($time) |
Returns a formatted date-time. | |
static | getHyphenPatternsFromTEX ($file) |
Returns an array of hyphenation patterns. | |
static | getObjFilename ($type='tmp', $file_id='') |
Returns a temporary filename for caching object on filesystem. | |
static | getPageLayoutMode ($layout='SinglePage') |
Get the canonical page layout mode. | |
static | getPageMode ($mode='UseNone') |
Get the canonical page layout mode. | |
static | getPageSizeFromFormat ($format) |
Get page dimensions from format name. | |
static | getPathPaintOperator ($style, $default='S') |
Get the Path-Painting Operators. | |
static | getRandomSeed ($seed='') |
Returns a string containing random data to be used as a seed for encryption methods. | |
static | getSVGTransformMatrix ($attribute) |
Get the tranformation matrix from SVG transform attribute. | |
static | getTagStyleFromCSSarray ($css) |
Compact CSS data array into single string. | |
static | getTCPDFProducer () |
Return the current TCPDF producer. | |
static | getTCPDFVersion () |
Return the current TCPDF version. | |
static | getTimestamp ($date) |
Returns timestamp in seconds from formatted date-time. | |
static | getTransformationMatrixProduct ($ta, $tb) |
Get the product of two SVG tranformation matrices. | |
static | getUserPermissionCode ($permissions, $mode=0) |
Return the permission code used on encryption (P value). | |
static | getVectorsAngle ($x1, $y1, $x2, $y2) |
Returns the angle in radiants between two vectors. | |
static | intToRoman ($number) |
Returns the Roman representation of an integer number. | |
static | isValidCSSSelectorForTag ($dom, $key, $selector) |
Returns true if the CSS selector is valid for the selected HTML tag. | |
static | isValidURL ($url) |
Check if the URL exist. | |
static | objclone ($object) |
Creates a copy of a class object. | |
static | pregSplit ($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL) |
Split string by a regular expression. | |
static | removeSHY ($txt='', $unicode=true) |
Removes SHY characters from text. | |
static | replacePageNumAliases ($page, $replace, $diff=0) |
Replace page number aliases with number. | |
static | revstrpos ($haystack, $needle, $offset=0) |
Find position of last occurrence of a substring in a string. | |
static | rfread ($handle, $length) |
Binary-safe and URL-safe file read. | |
static | sendOutputData ($data, $length) |
Output input data and compress it if possible. | |
static | setPageBoxes ($page, $type, $llx, $lly, $urx, $ury, $points, $k, $pagedim=array()) |
Set page boundaries. | |
static | swapPageBoxCoordinates ($page, $pagedim) |
Swap X and Y coordinates of page boxes (change page boxes orientation). | |
static | url_exists ($url) |
Check if the URL exist. | |
Static Public Attributes | |
static | $alias_group_num_page = '{:png:}' |
String alias for group page number. | |
static | $alias_group_tot_pages = '{:ptg:}' |
String alias for total number of pages in a single group. | |
static | $alias_num_page = '{:pnp:}' |
String alias for page number. | |
static | $alias_right_shift = '{rsc:' |
String alias for right shift compensation used to correctly align page numbers on the right. | |
static | $alias_tot_pages = '{:ptp:}' |
String alias for total number of pages. | |
static | $byterange_string = '/ByteRange[0 ********** ********** **********]' |
ByteRange placemark used during digital signature process. | |
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. | |
static array< string, float[]> | $page_formats |
Array of page formats measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4) static. | |
static | $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox') |
Array page boxes names static. | |
Static methods used by the TCPDF class.
..
PHP class for generating PDF documents without requiring external extensions.
|
static |
Returns the input text encrypted using AES algorithm and the specified key.
This method requires openssl or mcrypt. Text is padded to 16bytes blocks
string | $key | encryption key |
string | $text | input text to be encrypted |
string | encrypted text |
|
static |
Returns the input text encrypted using AES algorithm and the specified key.
This method requires openssl or mcrypt. Text is not padded
string | $key | encryption key |
string | $text | input text to be encrypted |
string | encrypted text |
|
static |
Add "::" before "\", "(" and ")".
string | $s | string to escape. |
string | escaped string. static |
|
static |
Escape some special characters (< > &) for XML output.
string | $str | Input string to convert. |
string | converted string |
|
static |
Read a 4-byte (32 bit) integer from file.
resource | $f | file resource. |
int | 4-byte integer static |
|
static |
Get BYTE from string (8-bit unsigned integer).
string | $str | String from where to extract value. |
int | $offset | Point from where to read the data. |
int | 8 bit value |
|
static |
Get FIXED from string (32-bit signed fixed-point number (16.16).
string | $str | string from where to extract value |
int | $offset | point from where to read the data |
int | 16 bit value |
|
static |
Get FWORD from string (Big Endian 16-bit signed integer).
string | $str | String from where to extract value. |
int | $offset | Point from where to read the data. |
int | 16 bit value |
|
static |
Get SHORT from string (Big Endian 16-bit signed integer).
string | $str | String from where to extract value. |
int | $offset | Point from where to read the data. |
int | 16 bit value |
|
static |
Get UFWORD from string (Big Endian 16-bit unsigned integer).
string | $str | string from where to extract value |
int | $offset | point from where to read the data |
int | 16 bit value |
|
static |
Get ULONG from string (Big Endian 32-bit unsigned integer).
string | $str | string from where to extract value |
int | $offset | point from where to read the data |
int | 32 bit value |
|
static |
Get USHORT from string (Big Endian 16-bit unsigned integer).
string | $str | string from where to extract value |
int | $offset | point from where to read the data |
int | 16 bit value |
|
static |
Encrypts a string using MD5 and returns it's value as a binary string.
string | $str | input string |
string | MD5 encrypted binary string |
|
static |
Returns the input text encrypted using RC4 algorithm and the specified key.
RC4 is the standard encryption algorithm used in PDF format
string | $key | Encryption key. |
string | $text | Input text to be encrypted. |
string | $last_enc_key | Reference to last RC4 key encrypted. |
string | $last_enc_key_c | Reference to last RC4 computed key. |
string | encrypted text |
|
static |
Convert hexadecimal string to string.
string | $bs | byte-string to convert |
string |
|
static |
Convert string to hexadecimal string (byte string)
string | $s | string to convert |
string | byte string |
|
static |
Determine whether a string is empty.
string | $str | string to be checked |
bool | true if string is empty |
|
static |
Encode a name object.
string | $name | Name object to encode. |
string | Encoded name object. |
|
static |
Encode query params in URL.
string | $url |
string |
|
static |
Extracts the CSS properties from a CSS string.
string | $cssdata | string containing CSS definitions. |
array | An array where the keys are the CSS selectors and the values are the CSS properties. |
|
static |
Wrapper for file_exists.
Checks whether a file or directory exists. Only allows some protocols and local files.
string | $filename | Path to the file or directory. |
bool | Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. static |
|
static |
Reads entire file into a string.
The file can be also an URL.
string | $file | Name of the file or URL to read. |
string|false | The function returns the read data or FALSE on failure. |
|
static |
Cleanup HTML code (requires HTML Tidy library).
string | $html | htmlcode to fix |
string | $default_css | CSS commands to add |
array | null | $tagvs | parameters for setHtmlVSpace method |
array | null | $tidy_options | options for tidy_parse_string function |
array | $tagvspaces | Array of vertical spaces for tags. |
string | XHTML code cleaned up |
|
static |
Wrapper to use fopen only with local files.
string | $filename | Name of the file to open |
string | $mode |
resource|false | Returns a file pointer resource on success, or FALSE on error. static |
|
static |
Format the page numbers.
This method can be overridden for custom formats.
int | $num | page number |
string |
|
static |
Format the page numbers on the Table Of Content.
This method can be overridden for custom formats.
int | $num | page number |
string |
|
static |
Convert JavaScript form fields properties array to Annotation Properties array.
array | $prop | javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
array | $spot_colors | Reference to spot colors array. |
boolean | $rtl | True if in Right-To-Left text direction mode, false otherwise. |
array | of annotation properties |
|
static |
Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages)
string | array | int | $brd | Indicates if borders must be drawn around the cell block. The value can be a number:
|
string | $position | multicell position: 'start', 'middle', 'end' |
boolean | $opencell | True when the cell is left open at the page bottom, false otherwise. |
array | border mode array |
|
static |
Returns the styles array that apply for the selected HTML tag.
array | $dom | array of HTML tags and properties |
int | $key | key of the current HTML tag |
array | $css | array of CSS properties |
array | containing CSS properties |
|
static |
Convert encryption P value to a string of bytes, low-order byte first.
string | $protection | 32bit encryption permission value (P value) |
string |
|
static |
Returns a formatted date-time.
int | $time | Time in seconds. |
string | escaped date string. |
|
static |
Returns an array of hyphenation patterns.
string | $file | TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ |
array | of hyphenation patterns |
|
static |
Returns a temporary filename for caching object on filesystem.
string | $type | Type of file (name of the subdir on the tcpdf cache folder). |
string | $file_id | TCPDF file_id. |
string | filename. |
|
static |
Get the canonical page layout mode.
string | $layout | The page layout. Possible values are:
|
string | Canonical page layout name. static |
|
static |
Get the canonical page layout mode.
string | $mode | A name object specifying how the document should be displayed when opened:
|
string | Canonical page mode name. static |
|
static |
Get page dimensions from format name.
mixed | $format | The format name |
array | containing page width and height in points |
|
static |
Get the Path-Painting Operators.
string | $style | Style of rendering. Possible values are:
|
string | $default | default style |
string |
|
static |
Returns a string containing random data to be used as a seed for encryption methods.
string | $seed | starting seed value |
string | containing random data |
|
static |
Get the tranformation matrix from SVG transform attribute.
string | $attribute | transformation |
array | of transformations |
|
static |
Compact CSS data array into single string.
array | $css | array of CSS properties |
string | containing merged CSS properties |
|
static |
Return the current TCPDF producer.
string | TCPDF producer string |
|
static |
Return the current TCPDF version.
string | TCPDF version string |
|
static |
Returns timestamp in seconds from formatted date-time.
string | $date | Formatted date-time. |
int | seconds. |
|
static |
Get the product of two SVG tranformation matrices.
array | $ta | first SVG tranformation matrix |
array | $tb | second SVG tranformation matrix |
array | transformation array |
|
static |
Return the permission code used on encryption (P value).
array | $permissions | the set of permissions (specify the ones you want to block). |
int | $mode | encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. |
|
static |
Returns the angle in radiants between two vectors.
int | $x1 | X coordinate of first vector point |
int | $y1 | Y coordinate of first vector point |
int | $x2 | X coordinate of second vector point |
int | $y2 | Y coordinate of second vector point |
|
static |
Returns the Roman representation of an integer number.
int | $number | number to convert |
string | roman representation of the specified number |
|
static |
Returns true if the CSS selector is valid for the selected HTML tag.
array | $dom | array of HTML tags and properties |
int | $key | key of the current HTML tag |
string | $selector | CSS selector string |
true | if the selector is valid, false otherwise |
|
static |
Check if the URL exist.
string | $url | URL to check. |
boolean | true if the URl exist, false otherwise. |
|
static |
Creates a copy of a class object.
object | $object | class object to be cloned |
object | cloned object |
|
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
string | $pattern | The regular expression pattern to search for without the modifiers, as a string. |
string | $modifiers | The modifiers part of the pattern, |
string | $subject | The input string. |
int | $limit | 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. |
int | $flags | The flags as specified on the preg_split PHP function. |
array | Returns an array containing substrings of subject split along boundaries matched by pattern.modifier |
|
static |
Removes SHY characters from text.
Unicode Data:
string | $txt | input string |
boolean | $unicode | True if we are in unicode mode, false otherwise. |
string | without SHY characters. |
|
static |
Replace page number aliases with number.
string | $page | Page content. |
array | $replace | Array of replacements (array keys are replacement strings, values are alias arrays). |
int | $diff | If passed, this will be set to the total char number difference between alias and replacements. |
array | replaced page content and updated $diff parameter as array. static |
|
static |
Find position of last occurrence of a substring in a string.
string | $haystack | The string to search in. |
string | $needle | substring to search. |
int | $offset | May be specified to begin searching an arbitrary number of characters into the string. |
int|false | Returns the position where the needle exists. Returns FALSE if the needle was not found. |
|
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.
resource | $handle | |
int | $length |
string|false | Returns the read string or FALSE in case of error. |
|
static |
Output input data and compress it if possible.
string | $data | Data to output. |
int | $length | Data length in bytes. |
|
static |
Set page boundaries.
int | $page | page number |
string | $type | valid values are:
|
float | $llx | lower-left x coordinate in user units. |
float | $lly | lower-left y coordinate in user units. |
float | $urx | upper-right x coordinate in user units. |
float | $ury | upper-right y coordinate in user units. |
boolean | $points | If true uses user units as unit of measure, otherwise uses PDF points. |
float | $k | Scale factor (number of points in user unit). |
array | $pagedim | Array of page dimensions. |
array | pagedim array of page dimensions. |
|
static |
Swap X and Y coordinates of page boxes (change page boxes orientation).
int | $page | page number |
array | $pagedim | Array of page dimensions. |
array | pagedim array of page dimensions. |
|
static |
Check if the URL exist.
string | $url | URL to check. |
bool | Returns TRUE if the URL exists; FALSE otherwise. static |
|
static |
String alias for group page number.
static
|
static |
String alias for total number of pages in a single group.
static
|
static |
String alias for page number.
static
|
static |
String alias for right shift compensation used to correctly align page numbers on the right.
static
|
static |
String alias for total number of pages.
static
|
static |
ByteRange placemark used during digital signature process.
|
static |
Encryption padding string.
static