Merge branch 'wip-MDL-49522-master' of git://github.com/abgreeve/moodle

This commit is contained in:
Dan Poltawski
2015-03-30 12:18:41 +01:00
16 changed files with 888 additions and 1177 deletions
+72 -10
View File
@@ -1,6 +1,68 @@
6.2.6 (2015-01-28)
- Bug #1008 "UTC offset sing breaks PDF/A-1b compliance" was fixed.
6.2.5 (2015-01-24)
- Bug #1019 "$this in static context" was fixed.
- Bug #1015 "Infinite loop in getIndirectObject method of parser" was fixed.
6.2.4 (2015-01-08)
- fix warning related to empty K_PATH_URL.
- fix error when a $table_colwidths key is not set.
6.2.3 (2014-12-18)
- New comment.
- Moved the K_PATH_IMAGES definition in tcpdf_autoconfig.
6.2.2 (2014-12-18)
- Fixed mispelled words.
- Fixed version number.
6.2.1 (2014-12-18)
- The constant K_TCPDF_THROW_EXCEPTION_ERROR is now set to false in the default configuration file.
- An issue with the _destroy() method was fixed.
6.2.0 (2014-12-10)
- Bug #1005 "Security Report, LFI posting internal files externally abusing default parameter" was fixed.
- Static methods serializeTCPDFtagParameters() and unserializeTCPDFtagParameters() were moved as non static to the main TCPDF class (see changes in example n. 49).
- Deprecated methods were removed, please use the equivalents defined in other classes (i.e. TCPDF_STATIC and TCPDF_FONTS).
- The constant K_TCPDF_CALLS_IN_HTML is now set by default to FALSE.
- DLE, DLX and DLP page format was added.
- Page format are now defined as a public property in TCPDF_STATIC.
6.1.1 (2014-12-09)
- Fixed bug with the register_shutdown_function().
6.1.0 (2014-12-07)
- The method TCPDF_STATIC::getRandomSeed() was improved.
- The disk caching feature was removed.
- Bug #1003 "Backslashes become duplicated in table, using WriteHTML" was fixed.
- Bug #1002 "SVG radialGradient within non-square Rect" was fixed.
6.0.099 (2014-11-15)
- Added basic support for nested SVG images (adapted PR from SamMousa).
- A bug related to setGDImageTransparency() was fixed (thanks to Maarten Boerema).
6.0.098 (2014-11-08)
- Bug item #996 "getCharBBox($char) returns incorrect results for TTF glyphs without outlines" was fixed.
- Bug item #991 "Text problem with SVG" was fixed (only the font style part).
6.0.097 (2014-10-20)
- Bug item #988 "hyphenateText - charmin parameter not work" was fixed.
- New 1D barcode method to print pre-formatted IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200.
6.0.096 (2014-10-06)
- Bug item #982 "Display style is not inherited in SVG" was fixed.
- Bug item #984 "Double quote url in CSS" was fixed.
6.0.095 (2014-10-02)
- Bug item #979 "New Timezone option overwriting current timezone" was fixed.
6.0.094 (2014-09-30)
- Bug item #978 "Variable Undefined: $cborder" was fixed.
6.0.093 (2014-09-02)
- Security fix: some serialize/unserialize methods were replaced with json_encode/json_decode to avoid a potential object injection with user supplied content. Thanks to ownCloud Inc. for reporting this issue.
- K_TIMEZONE constant was added to the default configuration to supress date-time warnings.
- K_TIMEZONE constant was added to the default configuration to suppress date-time warnings.
6.0.092 (2014-09-01)
- Bug item #956 "Monospaced fonts are not alignd at the baseline" was fixed.
@@ -355,7 +417,7 @@
- Image method was improved.
5.9.208 (2013-03-15)
- objclone fuction was patched to support old imagick extensions.
- objclone function was patched to support old imagick extensions.
- tcpdf_parser was improved to support Cross-Reference Streams and large streams.
5.9.207 (2013-03-04)
@@ -432,7 +494,7 @@
- barcodes.php file was resynced.
- Methods SetAbsX, SetAbsY, SetAbsXY where added to set the absolute pointer coordinates.
- Method getCharBBox were added to get single character bounding box.
- Signature of addTTFfont method was changed ($addcbbox paramter was added).
- Signature of addTTFfont method was changed ($addcbbox parameter was added).
5.9.185 (2012-09-12)
- Method _putfontwidths() was fixed.
@@ -834,7 +896,7 @@
5.9.080 (2011-05-17)
- A problem related to file path calculation for images was fixed.
- A problem related to unsupressed getimagesize() error was fixed.
- A problem related to unsuppressed getimagesize() error was fixed.
5.9.079 (2011-05-16)
- Footer() method was changed to use C128 barcode as default (instead of the previous C128B).
@@ -1188,7 +1250,7 @@
- Alignment problem on write2DBarcode was fixed.
5.8.015 (2010-08-24)
- A problem arised with the latest bugfix was fixed.
- A problem arose with the latest bugfix was fixed.
5.8.014 (2010-08-23)
- Method _getxobjectdict() was added for better compatibility with external extensions.
@@ -1650,7 +1712,7 @@
- Bug item #2938412 "Table related problems - thead, nobr, table width" was fixed.
4.8.026 (2010-01-19)
- The misspelled word "lenght" was replaced with "length" in some variables and comments.
- The misspelled word "length" was replaced with "length" in some variables and comments.
4.8.025 (2010-01-18)
- addExtGState() method was improved to reuse existing ExtGState objects.
@@ -1732,7 +1794,7 @@
4.8.006 (2009-09-23)
- Bug item #2864522 "No images if DOCUMENT_ROOT=='/'" was fixed.
- Support for text-indent CSS attribute was added.
- Method rollbackTransaction() was changed to support self-reassigment of previous object (check source code documentation).
- Method rollbackTransaction() was changed to support self-reassignment of previous object (check source code documentation).
- Support for the HTML "nobr" attribute was added to avoid splitting a table or a table row on two pages (i.e.: <tr nobr="true">...</tr>).
4.8.005 (2009-09-17)
@@ -1903,7 +1965,7 @@
- WARNING: THIS VERSION CHANGES THE BEHAVIOUR OF $x and $y parameters for several TCPDF methods:
zero coordinates for $x and $y are now valid coordinates;
set $x and $y as empty strings to get the current value.
- Some error caused by 'empty' funtion were fixed.
- Some error caused by 'empty' function were fixed.
- Default color for convertHTMLColorToDec() method was changed to white and the return value for invalid color is false.
- HTML on footer bug was fixed.
- The following examples were fixed: 5,7,10,17,19,20,21,33,42,43.
@@ -1922,8 +1984,8 @@
C128A : CODE 128 A
C128B : CODE 128 B
C128C : CODE 128 C
EAN2 : 2-Digits UPC-Based Extention
EAN5 : 5-Digits UPC-Based Extention
EAN2 : 2-Digits UPC-Based Extension
EAN5 : 5-Digits UPC-Based Extension
EAN8 : EAN 8
EAN13 : EAN 13
UPCA : UPC-A
+4 -4
View File
@@ -8,11 +8,11 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.093
Release date: 2014-09-02
Version: 6.2.6
Release date: 2015-01-28
Author: Nicola Asuni
Copyright (c) 2002-2014:
Copyright (c) 2002-2015:
Nicola Asuni
Tecnick.com LTD
www.tecnick.com
@@ -35,7 +35,7 @@ Main Features:
* methods to publish some XHTML + CSS code, Javascript and Forms;
* images, graphic (geometric figures) and transformation methods;
* supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http: www.imagemagick.org/www/formats.html)
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417;
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417;
* JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies;
* automatic page header and footer management;
* document encryption up to 256 bit and digital signature certifications;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.0.093",
"version": "6.2.6",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+2 -2
View File
@@ -2,7 +2,7 @@
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2014-09-02
// Last Update : 2014-12-11
//
// Description : Configuration file for TCPDF.
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
@@ -210,7 +210,7 @@ define('K_THAI_TOPCHARS', true);
* If true allows to call TCPDF methods using HTML syntax
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
*/
define('K_TCPDF_CALLS_IN_HTML', true);
define('K_TCPDF_CALLS_IN_HTML', false);
/**
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
+23 -23
View File
@@ -710,13 +710,13 @@ class Datamatrix {
$pos = 0; // current position
$cw = array(); // array of codewords to be returned
$cw_num = 0; // number of data codewords
$data_lenght = strlen($data); // number of chars
while ($pos < $data_lenght) {
$data_length = strlen($data); // number of chars
while ($pos < $data_length) {
// set last used encoding
$this->last_enc = $enc;
switch ($enc) {
case ENC_ASCII: { // STEP B. While in ASCII encodation
if (($data_lenght > 1) AND ($pos < ($data_lenght - 1)) AND ($this->isCharMode(ord($data[$pos]), ENC_ASCII_NUM) AND $this->isCharMode(ord($data[$pos + 1]), ENC_ASCII_NUM))) {
if (($data_length > 1) AND ($pos < ($data_length - 1)) AND ($this->isCharMode(ord($data[$pos]), ENC_ASCII_NUM) AND $this->isCharMode(ord($data[$pos + 1]), ENC_ASCII_NUM))) {
// 1. If the next data sequence is at least 2 consecutive digits, encode the next two digits as a double digit in ASCII mode.
$cw[] = (intval(substr($data, $pos, 2)) + 130);
++$cw_num;
@@ -820,7 +820,7 @@ class Datamatrix {
break;
}
}
} while (($p > 0) AND ($epos < $data_lenght));
} while (($p > 0) AND ($epos < $data_length));
// process last data (if any)
if ($p > 0) {
// get remaining number of data symbols
@@ -870,10 +870,10 @@ class Datamatrix {
break;
}
case ENC_EDF: { // F. While in EDIFACT (EDF) encodation
// initialize temporary array with 0 lenght
// initialize temporary array with 0 length
$temp_cw = array();
$epos = $pos;
$field_lenght = 0;
$field_length = 0;
$newenc = $enc;
do {
// 2. process the next character in EDIFACT encodation.
@@ -881,21 +881,21 @@ class Datamatrix {
if ($this->isCharMode($chr, ENC_EDF)) {
++$epos;
$temp_cw[] = $chr;
++$field_lenght;
++$field_length;
}
if (($field_lenght == 4) OR ($epos == $data_lenght) OR !$this->isCharMode($chr, ENC_EDF)) {
if (($epos == $data_lenght) AND ($field_lenght < 3)) {
if (($field_length == 4) OR ($epos == $data_length) OR !$this->isCharMode($chr, ENC_EDF)) {
if (($epos == $data_length) AND ($field_length < 3)) {
$enc = ENC_ASCII;
$cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num;
break;
}
if ($field_lenght < 4) {
if ($field_length < 4) {
// set unlatch character
$temp_cw[] = 0x1f;
++$field_lenght;
++$field_length;
// fill empty characters
for ($i = $field_lenght; $i < 4; ++$i) {
for ($i = $field_length; $i < 4; ++$i) {
$temp_cw[] = 0;
}
$enc = ENC_ASCII;
@@ -919,19 +919,19 @@ class Datamatrix {
}
$temp_cw = array();
$pos = $epos;
$field_lenght = 0;
$field_length = 0;
if ($enc == ENC_ASCII) {
break; // exit from EDIFACT mode
}
}
} while ($epos < $data_lenght);
} while ($epos < $data_length);
break;
}
case ENC_BASE256: { // G. While in Base 256 (B256) encodation
// initialize temporary array with 0 lenght
// initialize temporary array with 0 length
$temp_cw = array();
$field_lenght = 0;
while (($pos < $data_lenght) AND ($field_lenght <= 1555)) {
$field_length = 0;
while (($pos < $data_length) AND ($field_length <= 1555)) {
$newenc = $this->lookAheadTest($data, $pos, $enc);
if ($newenc != $enc) {
// 1. If the look-ahead test (starting at step J) indicates another mode, switch to that mode.
@@ -942,16 +942,16 @@ class Datamatrix {
$chr = ord($data[$pos]);
++$pos;
$temp_cw[] = $chr;
++$field_lenght;
++$field_length;
}
}
// set field lenght
if ($field_lenght <= 249) {
$cw[] = $this->get255StateCodeword($field_lenght, ($cw_num + 1));
// set field length
if ($field_length <= 249) {
$cw[] = $this->get255StateCodeword($field_length, ($cw_num + 1));
++$cw_num;
} else {
$cw[] = $this->get255StateCodeword((floor($field_lenght / 250) + 249), ($cw_num + 1));
$cw[] = $this->get255StateCodeword(($field_lenght % 250), ($cw_num + 2));
$cw[] = $this->get255StateCodeword((floor($field_length / 250) + 249), ($cw_num + 1));
$cw[] = $this->get255StateCodeword(($field_length % 250), ($cw_num + 2));
$cw_num += 2;
}
if (!empty($temp_cw)) {
+2 -2
View File
@@ -636,7 +636,7 @@ class PDF417 {
// add macro section
$codewords = array_merge($codewords, $macrocw);
}
// Symbol Lenght Descriptor (number of data codewords including Symbol Lenght Descriptor and pad codewords)
// Symbol Length Descriptor (number of data codewords including Symbol Length Descriptor and pad codewords)
$sld = $size - $errsize;
// add symbol length description
array_unshift($codewords, $sld);
@@ -772,7 +772,7 @@ class PDF417 {
/**
* Returns the error correction codewords
* @param $cw (array) array of codewords including Symbol Lenght Descriptor and pad
* @param $cw (array) array of codewords including Symbol Length Descriptor and pad
* @param $ecl (int) error correction level 0-8
* @return array of error correction codewords
* @protected
+5 -5
View File
@@ -148,7 +148,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterASCIIHexDecode($data) {
// intialize string to return
// initialize string to return
$decoded = '';
// all white-space characters shall be ignored
$data = preg_replace('/[\s]/', '', $data);
@@ -188,7 +188,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterASCII85Decode($data) {
// intialize string to return
// initialize string to return
$decoded = '';
// all white-space characters shall be ignored
$data = preg_replace('/[\s]/', '', $data);
@@ -272,7 +272,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterLZWDecode($data) {
// intialize string to return
// initialize string to return
$decoded = '';
// data length
$data_length = strlen($data);
@@ -353,7 +353,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterFlateDecode($data) {
// intialize string to return
// initialize string to return
$decoded = @gzuncompress($data);
if ($decoded === false) {
self::Error('decodeFilterFlateDecode: invalid code');
@@ -369,7 +369,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterRunLengthDecode($data) {
// intialize string to return
// initialize string to return
$decoded = '';
// data length
$data_length = strlen($data);
+20 -12
View File
@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_fonts.php
// Version : 1.0.013
// Version : 1.1.0
// Begin : 2008-01-01
// Last Update : 2014-05-23
// Last Update : 2014-12-10
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -42,7 +42,7 @@
* @class TCPDF_FONTS
* Font methods for TCPDF library.
* @package com.tecnick.tcpdf
* @version 1.0.013
* @version 1.1.0
* @author Nicola Asuni - [email protected]
*/
class TCPDF_FONTS {
@@ -186,7 +186,7 @@ class TCPDF_FONTS {
$data .= $encrypted;
// store compressed font
$fmetric['file'] .= '.z';
$fp = fopen($outpath.$fmetric['file'], 'wb');
$fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb');
fwrite($fp, gzcompress($data));
fclose($fp);
// get font info
@@ -354,6 +354,11 @@ class TCPDF_FONTS {
$fmetric['AvgWidth'] = round($fmetric['AvgWidth'] / count($cwidths));
} else {
// ---------- TRUE TYPE ----------
$offset = 0; // offset position of the font data
if (TCPDF_STATIC::_getULONG($font, $offset) != 0x10000) {
// sfnt version must be 0x00010000 for TrueType version 1.0.
return false;
}
if ($fmetric['type'] != 'cidfont0') {
if ($link) {
// creates a symbolic link to the existing font
@@ -361,16 +366,11 @@ class TCPDF_FONTS {
} else {
// store compressed font
$fmetric['file'] .= '.z';
$fp = fopen($outpath.$fmetric['file'], 'wb');
$fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb');
fwrite($fp, gzcompress($font));
fclose($fp);
}
}
$offset = 0; // offset position of the font data
if (TCPDF_STATIC::_getULONG($font, $offset) != 0x10000) {
// sfnt version must be 0x00010000 for TrueType version 1.0.
return false;
}
$offset += 4;
// get number of tables
$numTables = TCPDF_STATIC::_getUSHORT($font, $offset);
@@ -435,6 +435,10 @@ class TCPDF_FONTS {
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getUSHORT($font, $offset) * 2;
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
// the last glyph didn't have an outline
unset($indexToLoc[($i - 1)]);
}
$offset += 2;
}
} else {
@@ -442,6 +446,10 @@ class TCPDF_FONTS {
$tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getULONG($font, $offset);
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
// the last glyph didn't have an outline
unset($indexToLoc[($i - 1)]);
}
$offset += 4;
}
}
@@ -877,7 +885,7 @@ class TCPDF_FONTS {
$cidtogidmap = self::updateCIDtoGIDmap($cidtogidmap, $cid, $ctg[$cid]);
}
// store compressed CIDToGIDMap
$fp = fopen($outpath.$fmetric['ctg'], 'wb');
$fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['ctg'], 'wb');
fwrite($fp, gzcompress($cidtogidmap));
fclose($fp);
}
@@ -903,7 +911,7 @@ class TCPDF_FONTS {
$pfile .= '$cw=array('.substr($fmetric['cw'], 1).');'."\n";
$pfile .= '// --- EOF ---'."\n";
// store file
$fp = fopen($outpath.$font_name.'.php', 'w');
$fp = TCPDF_STATIC::fopenLocal($outpath.$font_name.'.php', 'w');
fwrite($fp, $pfile);
fclose($fp);
// return TCPDF font name
+19 -19
View File
@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_images.php
// Version : 1.0.003
// Version : 1.0.005
// Begin : 2002-08-03
// Last Update : 2014-04-03
// Last Update : 2014-11-15
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -38,7 +38,7 @@
* This is a PHP class that contains static image methods for the TCPDF class.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.003
* @version 1.0.005
*/
/**
@@ -46,7 +46,7 @@
* Static image methods used by the TCPDF class.
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 1.0.003
* @version 1.0.005
* @author Nicola Asuni - [email protected]
*/
class TCPDF_IMAGES {
@@ -56,7 +56,7 @@ class TCPDF_IMAGES {
* @since 5.0.000 (2010-05-02)
* @public static
*/
public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode');
public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -97,11 +97,12 @@ class TCPDF_IMAGES {
* @public static
*/
public static function setGDImageTransparency($new_image, $image) {
// default transparency color (white)
$tcol = array('red' => 255, 'green' => 255, 'blue' => 255);
// transparency index
$tid = imagecolortransparent($image);
// default transparency color
$tcol = array('red' => 255, 'green' => 255, 'blue' => 255);
if ($tid >= 0) {
$palletsize = imagecolorstotal($image);
if (($tid >= 0) AND ($tid < $palletsize)) {
// get the colors for the transparency index
$tcol = imagecolorsforindex($image, $tid);
}
@@ -115,23 +116,22 @@ class TCPDF_IMAGES {
* Convert the loaded image to a PNG and then return a structure for the PDF creator.
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param $image (image) Image object.
* @param $tempfile (string) Temporary file name.
* return image PNG image object.
* @since 4.9.016 (2010-04-20)
* @public static
*/
public static function _toPNG($image) {
// set temporary image file name
$tempname = TCPDF_STATIC::getObjFilename('img');
public static function _toPNG($image, $tempfile) {
// turn off interlaced mode
imageinterlace($image, 0);
// create temporary PNG image
imagepng($image, $tempname);
imagepng($image, $tempfile);
// remove image from memory
imagedestroy($image);
// get PNG image data
$retvars = self::_parsepng($tempname);
$retvars = self::_parsepng($tempfile);
// tidy up by removing temporary image
unlink($tempname);
unlink($tempfile);
return $retvars;
}
@@ -140,16 +140,16 @@ class TCPDF_IMAGES {
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param $image (image) Image object.
* @param $quality (int) JPEG quality.
* @param $tempfile (string) Temporary file name.
* return image JPEG image object.
* @public static
*/
public static function _toJPEG($image, $quality) {
$tempname = TCPDF_STATIC::getObjFilename('img');
imagejpeg($image, $tempname, $quality);
public static function _toJPEG($image, $quality, $tempfile) {
imagejpeg($image, $tempfile, $quality);
imagedestroy($image);
$retvars = self::_parsejpeg($tempname);
$retvars = self::_parsejpeg($tempfile);
// tidy up by removing temporary image
unlink($tempname);
unlink($tempfile);
return $retvars;
}
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -1,10 +1,15 @@
Description of TCPDF library import 6.0.093
Description of TCPDF library import 6.2.6
===========================================
* delete examples/, tools/ and tcpdf_import.php
* remove tcpdf_import.php from composer.json
* remove all fonts that were not already present
* visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf
2015/03/23
----------
Upgrade to tcpdf_php5 TCPDF 6.2.6 (MDL-49522)
by Adrian Greeve <[email protected]>
2011/10/29
----------
Upgrade to tcpdf_php5 TCPDF 5.9.133 (MDL-29283)
+255 -350
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_autoconfig.php
// Version : 1.0.000
// Version : 1.1.1
// Begin : 2013-05-16
// Last Update : 2014-09-02
// Last Update : 2014-12-18
// Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -37,7 +37,7 @@
* @file
* Try to automatically configure some TCPDF constants if not defined.
* @package com.tecnick.tcpdf
* @version 1.0.000
* @version 1.1.1
*/
// DOCUMENT_ROOT fix for IIS Webserver
@@ -94,10 +94,10 @@ if (!defined('K_PATH_IMAGES')) {
$tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', K_PATH_MAIN.'images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN);
foreach ($tcpdf_images_dirs as $tcpdf_images_path) {
if (@file_exists($tcpdf_images_path)) {
define ('K_PATH_IMAGES', $tcpdf_images_path);
break;
}
}
define ('K_PATH_IMAGES', $tcpdf_images_path);
}
if (!defined('PDF_HEADER_LOGO')) {
@@ -225,7 +225,7 @@ if (!defined('K_THAI_TOPCHARS')) {
}
if (!defined('K_TCPDF_CALLS_IN_HTML')) {
define('K_TCPDF_CALLS_IN_HTML', true);
define('K_TCPDF_CALLS_IN_HTML', false);
}
if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) {
@@ -235,7 +235,6 @@ if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) {
if (!defined('K_TIMEZONE')) {
define('K_TIMEZONE', @date_default_timezone_get());
}
date_default_timezone_set(K_TIMEZONE);
//============================================================+
// END OF FILE
+66 -12
View File
@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_barcodes_1d.php
// Version : 1.0.026
// Version : 1.0.027
// Begin : 2008-06-09
// Last Update : 2014-05-20
// Last Update : 2014-10-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -37,14 +37,14 @@
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.026
* @version 1.0.027
*/
/**
* @class TCPDFBarcode
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
* @package com.tecnick.tcpdf
* @version 1.0.026
* @version 1.0.027
* @author Nicola Asuni
*/
class TCPDFBarcode {
@@ -67,7 +67,7 @@ class TCPDFBarcode {
* <li>$arrcode['bcode'][$k]['h'] bar height in units.</li>
* <li>$arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)</li></ul>
* @param $code (string) code to print
* @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
* @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
* @public
*/
public function __construct($code, $type) {
@@ -242,7 +242,7 @@ class TCPDFBarcode {
/**
* Set the barcode.
* @param $code (string) code to print
* @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extention</li><li>EAN5 : 5-Digits UPC-Based Extention</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
* @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
* @return array barcode array
* @public
*/
@@ -300,11 +300,11 @@ class TCPDFBarcode {
$arrcode = $this->barcode_c128($code, 'C');
break;
}
case 'EAN2': { // 2-Digits UPC-Based Extention
case 'EAN2': { // 2-Digits UPC-Based Extension
$arrcode = $this->barcode_eanext($code, 2);
break;
}
case 'EAN5': { // 5-Digits UPC-Based Extention
case 'EAN5': { // 5-Digits UPC-Based Extension
$arrcode = $this->barcode_eanext($code, 5);
break;
}
@@ -352,6 +352,10 @@ class TCPDFBarcode {
$arrcode = $this->barcode_imb($code);
break;
}
case 'IMBPRE': { // IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200- pre-processed
$arrcode = $this->barcode_imb_pre($code);
break;
}
case 'CODABAR': { // CODABAR
$arrcode = $this->barcode_codabar($code);
break;
@@ -1075,7 +1079,7 @@ class TCPDFBarcode {
$fnc_b = array(241 => 102, 242 => 97, 243 => 96, 244 => 100);
// array of symbols
$code_data = array();
// lenght of the code
// length of the code
$len = strlen($code);
switch(strtoupper($type)) {
case 'A': { // MODE A
@@ -1505,7 +1509,7 @@ class TCPDFBarcode {
}
/**
* UPC-Based Extentions
* UPC-Based Extensions
* 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers
* 5-Digit Ext.: Used to mark suggested retail price of books
* @param $code (string) code to represent.
@@ -1589,7 +1593,7 @@ class TCPDFBarcode {
* @protected
*/
protected function barcode_postnet($code, $planet=false) {
// bar lenght
// bar length
if ($planet) {
$barlen = Array(
0 => Array(1,1,2,2,2),
@@ -2038,7 +2042,6 @@ class TCPDFBarcode {
return $bararray;
}
/**
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
* (requires PHP bcmath extension)
@@ -2166,6 +2169,57 @@ class TCPDFBarcode {
return $bararray;
}
/**
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
*
* @param $code (string) pre-formatted IMB barcode (65 chars "FADT")
* @return array barcode representation.
* @protected
*/
protected function barcode_imb_pre($code) {
if (!preg_match('/^[fadtFADT]{65}$/', $code) == 1) {
return false;
}
$characters = str_split(strtolower($code), 1);
// build bars
$k = 0;
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 3, 'bcode' => array());
for ($i = 0; $i < 65; ++$i) {
switch($characters[$i]) {
case 'f': {
// full bar
$p = 0;
$h = 3;
break;
}
case 'a': {
// ascender
$p = 0;
$h = 2;
break;
}
case 'd': {
// descender
$p = 1;
$h = 2;
break;
}
case 't': {
// tracker (short)
$p = 1;
$h = 1;
break;
}
}
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
$bararray['bcode'][$k++] = array('t' => 0, 'w' => 1, 'h' => 2, 'p' => 0);
$bararray['maxw'] += 2;
}
unset($bararray['bcode'][($k - 1)]);
--$bararray['maxw'];
return $bararray;
}
/**
* Convert large integer number to hexadecimal representation.
* (requires PHP bcmath extension)
+12 -11
View File
@@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf_parser.php
// Version : 1.0.014
// Version : 1.0.15
// Begin : 2011-05-23
// Last Update : 2014-02-18
// Last Update : 2015-01-24
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// -------------------------------------------------------------------
// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2011-2015 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
@@ -37,7 +37,7 @@
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.014
* @version 1.0.15
*/
// include class for decoding filters
@@ -48,7 +48,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @brief This is a PHP class for parsing PDF documents..
* @version 1.0.010
* @version 1.0.15
* @author Nicola Asuni - [email protected]
*/
class TCPDF_PARSER {
@@ -209,7 +209,7 @@ class TCPDF_PARSER {
* @since 1.0.000 (2011-06-20)
*/
protected function decodeXref($startxref, $xref=array()) {
$startxref += 4; // 4 is the lenght of the word 'xref'
$startxref += 4; // 4 is the length of the word 'xref'
// skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
$offset = $startxref + strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $startxref);
// initialize object number
@@ -394,7 +394,7 @@ class TCPDF_PARSER {
$pb = abs($p - $row_up);
$pc = abs($p - $row_upleft);
$pmin = min($pa, $pb, $pc);
// return minumum distance
// return minimum distance
switch ($pmin) {
case $pa: {
$ddata[$k][$j] = (($row[$i] + $row_left) & 0xff);
@@ -690,7 +690,8 @@ class TCPDF_PARSER {
$objdata = array();
$i = 0; // object main index
do {
// get element
$oldoffset = $offset;
// get element
$element = $this->getRawObject($offset);
$offset = $element[2];
// decode stream using stream's dictionary information
@@ -699,7 +700,7 @@ class TCPDF_PARSER {
}
$objdata[$i] = $element;
++$i;
} while ($element[0] != 'endobj');
} while (($element[0] != 'endobj') AND ($offset != $oldoffset));
// remove closing delimiter
array_pop($objdata);
// return raw object content
@@ -737,7 +738,7 @@ class TCPDF_PARSER {
* @since 1.0.000 (2011-06-22)
*/
protected function decodeStream($sdic, $stream) {
// get stream lenght and filters
// get stream length and filters
$slength = strlen($stream);
if ($slength <= 0) {
return array('', array());
@@ -746,7 +747,7 @@ class TCPDF_PARSER {
foreach ($sdic as $k => $v) {
if ($v[0] == '/') {
if (($v[1] == 'Length') AND (isset($sdic[($k + 1)])) AND ($sdic[($k + 1)][0] == 'numeric')) {
// get declared stream lenght
// get declared stream length
$declength = intval($sdic[($k + 1)][1]);
if ($declength < $slength) {
$stream = substr($stream, 0, $declength);
+1 -1
View File
@@ -158,7 +158,7 @@
<location>tcpdf</location>
<name>TCPDF</name>
<license>LGPL</license>
<version>6.0.093</version>
<version>6.2.6</version>
<licenseversion>3</licenseversion>
</library>
<library>