Skip to content

Commit

Permalink
Merge pull request #3418 from WordImpress/issue/3411
Browse files Browse the repository at this point in the history
fix(libraries): resolve tcpdf incompatibility with PHP 7.2 #3411
  • Loading branch information
ravinderk committed Jun 28, 2018
2 parents 5fffaeb + b77b6ad commit 86af3f1
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 66 deletions.
3 changes: 3 additions & 0 deletions includes/libraries/tcpdf/CHANGELOG.TXT
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Unreleased
- fix Undesired mouseover effect on links in PDF on Chrome Pdf Viewer

6.2.13 (2016-06-10)
- IMPORTANT: A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable.

Expand Down
Empty file modified includes/libraries/tcpdf/LICENSE.TXT
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion includes/libraries/tcpdf/README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

* **category** Library
* **author** Nicola Asuni <info@tecnick.com>
* **copyright** 2002-2016 Nicola Asuni - Tecnick.com LTD
* **copyright** 2002-2018 Nicola Asuni - Tecnick.com LTD
* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* **link** http://www.tcpdf.org
* **source** https://github.com/tecnickcom/TCPDF
Expand Down
82 changes: 45 additions & 37 deletions includes/libraries/tcpdf/composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
{
"name": "tecnickcom/tcpdf",
"version": "6.2.13",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": ["PDF","tcpdf","PDFD32000-2008","qrcode","datamatrix","pdf417","barcodes"],
"license": "LGPLv3",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"homepage": "http://nicolaasuni.tecnick.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
"name": "tecnickcom/tcpdf",
"version": "6.2.17",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": [
"PDF",
"tcpdf",
"PDFD32000-2008",
"qrcode",
"datamatrix",
"pdf417",
"barcodes"
],
"license": "LGPL-3.0",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
}
Empty file modified includes/libraries/tcpdf/config/tcpdf_config.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/include/barcodes/datamatrix.php
100644 → 100755
Empty file.
20 changes: 10 additions & 10 deletions includes/libraries/tcpdf/include/barcodes/pdf417.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -740,16 +740,6 @@ public function getBarcodeArray() {
* @protected
*/
protected function getErrorCorrectionLevel($ecl, $numcw) {
// get maximum correction level
$maxecl = 8; // starting error level
$maxerrsize = (928 - $numcw); // available codewords for error
while ($maxecl > 0) {
$errsize = (2 << $ecl);
if ($maxerrsize >= $errsize) {
break;
}
--$maxecl;
}
// check for automatic levels
if (($ecl < 0) OR ($ecl > 8)) {
if ($numcw < 41) {
Expand All @@ -764,6 +754,16 @@ protected function getErrorCorrectionLevel($ecl, $numcw) {
$ecl = $maxecl;
}
}
// get maximum correction level
$maxecl = 8; // starting error level
$maxerrsize = (928 - $numcw); // available codewords for error
while ($maxecl > 0) {
$errsize = (2 << $ecl);
if ($maxerrsize >= $errsize) {
break;
}
--$maxecl;
}
if ($ecl > $maxecl) {
$ecl = $maxecl;
}
Expand Down
Empty file modified includes/libraries/tcpdf/include/barcodes/qrcode.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/include/sRGB.icc
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/include/tcpdf_colors.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/include/tcpdf_filters.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/include/tcpdf_font_data.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion includes/libraries/tcpdf/include/tcpdf_fonts.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $
$glyphIdArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
}
for ($k = 0; $k < $segCount; ++$k) {
for ($k = 0; $k < $segCount - 1; ++$k) {
for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) {
if ($idRangeOffset[$k] == 0) {
$g = ($idDelta[$k] + $c) % 65536;
Expand Down
Empty file modified includes/libraries/tcpdf/include/tcpdf_images.php
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions includes/libraries/tcpdf/include/tcpdf_static.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.2.13';
private static $tcpdf_version = '6.2.17';

/**
* String alias for total number of pages.
Expand Down Expand Up @@ -1910,7 +1910,7 @@ public static function fileGetContents($file) {
&& !preg_match('%^//%', $file)
) {
$urldata = @parse_url($_SERVER['SCRIPT_URI']);
return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
$alt[] = $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
}
//
$alt = array_unique($alt);
Expand Down
30 changes: 16 additions & 14 deletions includes/libraries/tcpdf/tcpdf.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8157,7 +8157,9 @@ protected function _putannotsobjs() {
$annots .= ' /FT /'.$pl['opt']['ft'];
$formfield = true;
}
$annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id);
if ($pl['opt']['subtype'] !== 'Link') {
$annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id);
}
$annots .= ' /P '.$this->page_obj_id[$n].' 0 R';
$annots .= ' /NM '.$this->_datastring(sprintf('%04u-%04u', $n, $key), $annot_obj_id);
$annots .= ' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp);
Expand Down Expand Up @@ -12582,7 +12584,7 @@ protected function _addfield($type, $name, $x, $y, $w, $h, $prop) {
$k = $this->k;
$this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n";
$this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
while (list($key, $val) = each($prop)) {
foreach($prop as $key => $val) {
if (strcmp(substr($key, -5), 'Color') == 0) {
$val = TCPDF_COLORS::_JScolor($val);
} else {
Expand Down Expand Up @@ -15190,7 +15192,7 @@ public function getBarcode() {
* @since 3.1.000 (2008-06-09)
* @public
*/
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') {
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') {
if (TCPDF_STATIC::empty_string(trim($code))) {
return;
}
Expand Down Expand Up @@ -15509,7 +15511,7 @@ public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='
* @since 4.5.037 (2009-04-07)
* @public
*/
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) {
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) {
if (TCPDF_STATIC::empty_string(trim($code))) {
return;
}
Expand Down Expand Up @@ -16545,9 +16547,9 @@ protected function getHtmlDomArray($html) {
// get attributes
preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
$dom[$key]['attribute'] = array(); // reset attribute array
while (list($id, $name) = each($attr_array[1])) {
$dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
}
foreach($attr_array[1] as $id => $name) {
$dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
}
if (!empty($css)) {
// merge CSS style to current style
list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css);
Expand All @@ -16558,10 +16560,10 @@ protected function getHtmlDomArray($html) {
// get style attributes
preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
$dom[$key]['style'] = array(); // reset style attribute array
while (list($id, $name) = each($style_array[1])) {
// in case of duplicate attribute the last replace the previous
$dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
}
foreach($style_array[1] as $id => $name) {
// in case of duplicate attribute the last replace the previous
$dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
}
// --- get some style attributes ---
// text direction
if (isset($dom[$key]['style']['direction'])) {
Expand Down Expand Up @@ -17176,10 +17178,10 @@ public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=fal
if ($cell) {
if ($this->rtl) {
$this->x -= $this->cell_padding['R'];
$this->lMargin += $this->cell_padding['R'];
$this->lMargin += $this->cell_padding['L'];
} else {
$this->x += $this->cell_padding['L'];
$this->rMargin += $this->cell_padding['L'];
$this->rMargin += $this->cell_padding['R'];
}
}
if ($this->customlistindent >= 0) {
Expand Down Expand Up @@ -21511,7 +21513,7 @@ public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $corre
} else {
// placemark to be replaced with the correct number
$pagenum = '{#'.($outline['p']).'}';
if ($templates['F'.$outline['l']]) {
if (isset($templates['F'.$outline['l']]) && $templates['F'.$outline['l']]) {
$pagenum = '{'.$pagenum.'}';
}
$maxpage = max($maxpage, $outline['p']);
Expand Down
Empty file modified includes/libraries/tcpdf/tcpdf_autoconfig.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tcpdf_barcodes_1d.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tcpdf_barcodes_2d.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tcpdf_import.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tcpdf_parser.php
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tools/.htaccess
100644 → 100755
Empty file.
Empty file modified includes/libraries/tcpdf/tools/convert_fonts_examples.txt
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion includes/libraries/tcpdf/tools/tcpdf_addfont.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/php -q
#!/usr/bin/env php
<?php
//============================================================+
// File name : tcpdf_addfont.php
Expand Down

0 comments on commit 86af3f1

Please sign in to comment.