diff options
| author | Greg Roach <fisharebest@gmail.com> | 2014-04-27 19:06:50 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2014-04-27 19:06:50 +0100 |
| commit | 42e86566122212a06c912a854764d1179fdfa9bd (patch) | |
| tree | 6ba49efe238a1771da3fa3c3023b9cc3e0b8b09b /library/tecnick.com/tcpdf/include | |
| parent | 949f080c5ac17eae6c3f02de9f635538649d7745 (diff) | |
| download | webtrees-42e86566122212a06c912a854764d1179fdfa9bd.tar.gz webtrees-42e86566122212a06c912a854764d1179fdfa9bd.tar.bz2 webtrees-42e86566122212a06c912a854764d1179fdfa9bd.zip | |
Update TCPDF library from 6.0.062 => 6.0.071
Diffstat (limited to 'library/tecnick.com/tcpdf/include')
6 files changed, 73 insertions, 48 deletions
diff --git a/library/tecnick.com/tcpdf/include/barcodes/datamatrix.php b/library/tecnick.com/tcpdf/include/barcodes/datamatrix.php index 95e4cbb937..e39b6f3af0 100644 --- a/library/tecnick.com/tcpdf/include/barcodes/datamatrix.php +++ b/library/tecnick.com/tcpdf/include/barcodes/datamatrix.php @@ -1,13 +1,13 @@ <?php //============================================================+ // File name : datamatrix.php -// Version : 1.0.004 +// Version : 1.0.006 // Begin : 2010-06-07 -// Last Update : 2013-12-12 +// Last Update : 2014-04-24 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2010-2012 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2010-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -40,7 +40,7 @@ * * @package com.tecnick.tcpdf * @author Nicola Asuni -* @version 1.0.004 +* @version 1.0.006 */ // custom definitions @@ -256,14 +256,16 @@ class Datamatrix { return false; } elseif ($params[11] > $nd) { // add padding - if ($this->last_enc == ENC_EDF) { - // switch to ASCII encoding - $cw[] = 124; - ++$nd; - } elseif (($this->last_enc != ENC_ASCII) AND ($this->last_enc != ENC_BASE256)) { - // switch to ASCII encoding - $cw[] = 254; - ++$nd; + if ((($params[11] - $nd) > 1) AND ($cw[($nd - 1)] != 254)) { + if ($this->last_enc == ENC_EDF) { + // switch to ASCII encoding + $cw[] = 124; + ++$nd; + } elseif (($this->last_enc != ENC_ASCII) AND ($this->last_enc != ENC_BASE256)) { + // switch to ASCII encoding + $cw[] = 254; + ++$nd; + } } if ($params[11] > $nd) { // add first pad @@ -652,6 +654,9 @@ class Datamatrix { switch ($mode) { case ENC_ASCII: { // ASCII character 0 to 127 $cw = 254; + if ($this->last_enc == ENC_EDF) { + $cw = 124; + } break; } case ENC_C40: { // Upper-case alphanumeric @@ -707,6 +712,8 @@ class Datamatrix { $cw_num = 0; // number of data codewords $data_lenght = strlen($data); // number of chars while ($pos < $data_lenght) { + // 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))) { @@ -799,7 +806,13 @@ class Datamatrix { // 1. If the C40 encoding is at the point of starting a new double symbol character and if the look-ahead test (starting at step J) indicates another mode, switch to that mode. $newenc = $this->lookAheadTest($data, $pos, $enc); if ($newenc != $enc) { + // switch to new encoding $enc = $newenc; + if ($enc != ENC_ASCII) { + // set unlatch character + $cw[] = $this->getSwitchEncodingCodeword(ENC_ASCII); + ++$cw_num; + } $cw[] = $this->getSwitchEncodingCodeword($enc); ++$cw_num; $pos -= $p; @@ -811,20 +824,22 @@ class Datamatrix { // process last data (if any) if ($p > 0) { // get remaining number of data symbols - $cwr = ($this->getMaxDataCodewords($cw_num + 2) - $cw_num); + $cwr = ($this->getMaxDataCodewords($cw_num) - $cw_num); if (($cwr == 1) AND ($p == 1)) { // d. If one symbol character remains and one C40 value (data character) remains to be encoded $c1 = array_shift($temp_cw); --$p; - $cw[] = ($c1 + 1); + $cw[] = ($chr + 1); ++$cw_num; + $pos = $epos; } elseif (($cwr == 2) AND ($p == 1)) { // c. If two symbol characters remain and only one C40 value (data character) remains to be encoded $c1 = array_shift($temp_cw); --$p; $cw[] = 254; - $cw[] = ($c1 + 1); + $cw[] = ($chr + 1); $cw_num += 2; + $pos = $epos; } elseif (($cwr == 2) AND ($p == 2)) { // b. If two symbol characters remain and two C40 values remain to be encoded $c1 = array_shift($temp_cw); @@ -834,12 +849,14 @@ class Datamatrix { $cw[] = ($tmp >> 8); $cw[] = ($tmp % 256); $cw_num += 2; + $pos = $epos; } else { // switch to ASCII encoding if ($enc != ENC_ASCII) { $enc = ENC_ASCII; $cw[] = $this->getSwitchEncodingCodeword($enc); ++$cw_num; + $pos = ($epos - $p); } } } @@ -862,6 +879,8 @@ class Datamatrix { if (($field_lenght == 4) OR ($epos == $data_lenght) OR !$this->isCharMode($chr, ENC_EDF)) { if (($epos == $data_lenght) AND ($field_lenght < 3)) { $enc = ENC_ASCII; + $cw[] = $this->getSwitchEncodingCodeword($enc); + ++$cw_num; break; } if ($field_lenght < 4) { @@ -873,6 +892,7 @@ class Datamatrix { $temp_cw[] = 0; } $enc = ENC_ASCII; + $this->last_enc = $enc; } // encodes four data characters in three codewords $tcw = (($temp_cw[0] & 0x3F) << 2) + (($temp_cw[1] & 0x30) >> 4); @@ -922,25 +942,23 @@ class Datamatrix { } // set field lenght if ($field_lenght <= 249) { - $cw[] = $field_lenght; + $cw[] = $this->get255StateCodeword($field_lenght, ($cw_num + 1)); ++$cw_num; } else { - $cw[] = (floor($field_lenght / 250) + 249); - $cw[] = ($field_lenght % 250); + $cw[] = $this->get255StateCodeword((floor($field_lenght / 250) + 249), ($cw_num + 1)); + $cw[] = $this->get255StateCodeword(($field_lenght % 250), ($cw_num + 2)); $cw_num += 2; } if (!empty($temp_cw)) { // add B256 field foreach ($temp_cw as $p => $cht) { - $cw[] = $this->get255StateCodeword($chr, ($cw_num + $p)); + $cw[] = $this->get255StateCodeword($cht, ($cw_num + $p + 1)); } } break; } } // end of switch enc } // end of while - // set last used encoding - $this->last_enc = $enc; return $cw; } diff --git a/library/tecnick.com/tcpdf/include/barcodes/pdf417.php b/library/tecnick.com/tcpdf/include/barcodes/pdf417.php index 4265299074..f68c207444 100644 --- a/library/tecnick.com/tcpdf/include/barcodes/pdf417.php +++ b/library/tecnick.com/tcpdf/include/barcodes/pdf417.php @@ -3,7 +3,7 @@ // File name : pdf417.php // Version : 1.0.005 // Begin : 2010-06-03 -// Last Update : 2013-09-17 +// Last Update : 2014-04-25 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -934,7 +934,7 @@ class PDF417 { $sublen = strlen($code); } if ($sublen == 6) { - $t = bcmul(''.ord($code{0}), '1099511627776'); + $t = bcmul(''.ord($code[0]), '1099511627776'); $t = bcadd($t, bcmul(''.ord($code{1}), '4294967296')); $t = bcadd($t, bcmul(''.ord($code{2}), '16777216')); $t = bcadd($t, bcmul(''.ord($code{3}), '65536')); diff --git a/library/tecnick.com/tcpdf/include/tcpdf_colors.php b/library/tecnick.com/tcpdf/include/tcpdf_colors.php index a88fbb5a6d..77f1c4cc84 100644 --- a/library/tecnick.com/tcpdf/include/tcpdf_colors.php +++ b/library/tecnick.com/tcpdf/include/tcpdf_colors.php @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : tcpdf_colors.php -// Version : 1.0.003 +// Version : 1.0.004 // Begin : 2002-04-09 -// Last Update : 2013-10-25 +// Last Update : 2014-04-25 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -42,7 +42,7 @@ * @class TCPDF_COLORS * PHP color class for TCPDF * @package com.tecnick.tcpdf - * @version 1.0.003 + * @version 1.0.004 * @author Nicola Asuni - info@tecnick.com */ class TCPDF_COLORS { @@ -306,7 +306,7 @@ class TCPDF_COLORS { } return $returncolor; } - } elseif ((substr($color, 0, 4) != 'cmyk') AND ($dotpos = strpos($color, '.')) !== false) { + } elseif ((substr($color, 0, 4) != 'cmyk') AND (substr($color, 0, 3) != 'rgb') AND (($dotpos = strpos($color, '.')) !== false)) { // remove class parent (i.e.: color.red) $color = substr($color, ($dotpos + 1)); if ($color == 'transparent') { @@ -351,7 +351,7 @@ class TCPDF_COLORS { } return $returncolor; } - if ($color{0} != '#') { + if ($color[0] != '#') { // COLOR NAME if (isset(self::$webcolor[$color])) { // web color diff --git a/library/tecnick.com/tcpdf/include/tcpdf_filters.php b/library/tecnick.com/tcpdf/include/tcpdf_filters.php index 28556e4ce3..96584db542 100644 --- a/library/tecnick.com/tcpdf/include/tcpdf_filters.php +++ b/library/tecnick.com/tcpdf/include/tcpdf_filters.php @@ -3,7 +3,7 @@ // File name : tcpdf_filters.php // Version : 1.0.001 // Begin : 2011-05-23 -// Last Update : 2013-09-15 +// Last Update : 2014-04-25 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -320,12 +320,12 @@ class TCPDF_FILTERS { if ($index < $dix) { // index exist on dictionary $decoded .= $dictionary[$index]; - $dic_val = $dictionary[$prev_index].$dictionary[$index]{0}; + $dic_val = $dictionary[$prev_index].$dictionary[$index][0]; // store current index $prev_index = $index; } else { // index do not exist on dictionary - $dic_val = $dictionary[$prev_index].$dictionary[$prev_index]{0}; + $dic_val = $dictionary[$prev_index].$dictionary[$prev_index][0]; $decoded .= $dic_val; } // update dictionary diff --git a/library/tecnick.com/tcpdf/include/tcpdf_images.php b/library/tecnick.com/tcpdf/include/tcpdf_images.php index c1e31416bd..4e0aba9a0f 100644 --- a/library/tecnick.com/tcpdf/include/tcpdf_images.php +++ b/library/tecnick.com/tcpdf/include/tcpdf_images.php @@ -1,13 +1,13 @@ <?php //============================================================+ // File name : tcpdf_images.php -// Version : 1.0.002 +// Version : 1.0.003 // Begin : 2002-08-03 -// Last Update : 2013-11-24 +// Last Update : 2014-04-03 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2002-2013 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -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.002 + * @version 1.0.003 */ /** @@ -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.002 + * @version 1.0.003 * @author Nicola Asuni - info@tecnick.com */ class TCPDF_IMAGES { @@ -299,14 +299,16 @@ class TCPDF_IMAGES { } elseif ($type == 'tRNS') { // read transparency info $t = TCPDF_STATIC::rfread($f, $n); - if ($ct == 0) { + if ($ct == 0) { // DeviceGray $trns = array(ord($t{1})); - } elseif ($ct == 2) { + } elseif ($ct == 2) { // DeviceRGB $trns = array(ord($t{1}), ord($t{3}), ord($t{5})); - } else { - $pos = strpos($t, chr(0)); - if ($pos !== false) { - $trns = array($pos); + } else { // Indexed + if ($n > 0) { + $trns = array(); + for ($i = 0; $i < $n; ++ $i) { + $trns[] = ord($t{$i}); + } } } fread($f, 4); diff --git a/library/tecnick.com/tcpdf/include/tcpdf_static.php b/library/tecnick.com/tcpdf/include/tcpdf_static.php index faafdba2ef..d0e62532a0 100644 --- a/library/tecnick.com/tcpdf/include/tcpdf_static.php +++ b/library/tecnick.com/tcpdf/include/tcpdf_static.php @@ -3,7 +3,7 @@ // File name : tcpdf_static.php // Version : 1.0.002 // Begin : 2002-08-03 -// Last Update : 2013-09-14 +// Last Update : 2014-04-25 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.062'; + private static $tcpdf_version = '6.0.071'; /** * String alias for total number of pages. @@ -137,7 +137,7 @@ class TCPDF_STATIC { public static function set_mqr($mqr) { if (!defined('PHP_VERSION_ID')) { $version = PHP_VERSION; - define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4})); + define('PHP_VERSION_ID', (($version[0] * 10000) + ($version{2} * 100) + $version{4})); } if (PHP_VERSION_ID < 50300) { @set_magic_quotes_runtime($mqr); @@ -153,7 +153,7 @@ class TCPDF_STATIC { public static function get_mqr() { if (!defined('PHP_VERSION_ID')) { $version = PHP_VERSION; - define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4})); + define('PHP_VERSION_ID', (($version[0] * 10000) + ($version{2} * 100) + $version{4})); } if (PHP_VERSION_ID < 50300) { return @get_magic_quotes_runtime(); @@ -2165,7 +2165,7 @@ class TCPDF_STATIC { $attrib = strtolower(trim($attrib[0])); if (!empty($attrib)) { // check if matches class, id, attribute, pseudo-class or pseudo-element - switch ($attrib{0}) { + switch ($attrib[0]) { case '.': { // class if (in_array(substr($attrib, 1), $class)) { $valid = true; @@ -2764,6 +2764,7 @@ class TCPDF_STATIC { * @public static */ public static function fileGetContents($file) { + //$file = html_entity_decode($file); // array of possible alternative paths/URLs $alt = array($file); // replace URL relative path with full real server path @@ -2800,6 +2801,10 @@ class TCPDF_STATIC { $alt[] = $tmp; } } + if (isset($_SERVER['SCRIPT_URI'])) { + $urldata = @parse_url($_SERVER['SCRIPT_URI']); + $alt[] = $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file; + } foreach ($alt as $f) { $ret = @file_get_contents($f); if (($ret === FALSE) @@ -2808,7 +2813,7 @@ class TCPDF_STATIC { AND preg_match('%^(https?|ftp)://%', $f)) { // try to get remote file data using cURL $cs = curl_init(); // curl session - curl_setopt($cs, CURLOPT_URL, $file); + curl_setopt($cs, CURLOPT_URL, $f); curl_setopt($cs, CURLOPT_BINARYTRANSFER, true); curl_setopt($cs, CURLOPT_FAILONERROR, true); curl_setopt($cs, CURLOPT_RETURNTRANSFER, true); |
