diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 15e7b9c..e345c2b 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,8 @@ +6.0.056 (2014-01-25) + - The automatic chache folder selection now works also with some restricted hosting environments. + - CSS text-transform property is now supported (requires the multibyte string library for php) - see examle n. 061 (Thanks to Walter Ferraz). + - Bug #884 "Parsing error prev tag looking for" was fixed. + 6.0.055 (2014-01-15) - Bug #880 "Error detecting hX tags (h1,h2..)" was fixed - Bug #879 "Thead on the second page inherits style of previous tr" was fixed diff --git a/README.TXT b/README.TXT index bf19f80..c370024 100644 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.055 -Release date: 2014-01-15 +Version: 6.0.056 +Release date: 2014-01-25 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index 35ca2b7..a4a2b70 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.055", + "version": "6.0.056", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/config/tcpdf_config.php b/config/tcpdf_config.php index e6c1bf0..b0931e5 100644 --- a/config/tcpdf_config.php +++ b/config/tcpdf_config.php @@ -2,13 +2,13 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2013-05-16 +// Last Update : 2014-01-25 // // Description : Configuration file for TCPDF. // 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) 2004-2013 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2004-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -36,7 +36,10 @@ * @since 2004-10-27 */ -// If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored. +// IMPORTANT: +// If you define the constant K_TCPDF_EXTERNAL_CONFIG, all the following settings will be ignored. +// If you use the tcpdf_autoconfig.php, then you can overwrite some values here. + /** * Installation path (/var/www/tcpdf/). @@ -76,7 +79,7 @@ /** * Cache directory for temporary files (full path). */ -define ('K_PATH_CACHE', sys_get_temp_dir().'/'); +//define ('K_PATH_CACHE', '/tmp/'); /** * Generic name for a blank image. @@ -210,7 +213,7 @@ define('K_THAI_TOPCHARS', true); define('K_TCPDF_CALLS_IN_HTML', true); /** - * If true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. + * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. */ define('K_TCPDF_THROW_EXCEPTION_ERROR', false); diff --git a/examples/example_061.php b/examples/example_061.php index 11e7e28..13e18c2 100644 --- a/examples/example_061.php +++ b/examples/example_061.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_061.php // Begin : 2010-05-24 -// Last Update : 2013-05-14 +// Last Update : 2014-01-25 // // Description : Example 061 for TCPDF class // XHTML + CSS @@ -138,6 +138,15 @@ $html = <<

Example of XHTML + CSS

@@ -146,7 +155,12 @@ $html = <<Example of paragraph with ID selector. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

-
example of DIV with border and fill.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus.
+
example of DIV with border and fill. +
Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
text-transform LOWERCASE Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
text-transform uppercase Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
text-transform cAPITALIZE Lorem ipsum dolor sit amet, consectetur adipiscing elit. +

diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index 1f5a3ef..d5a0050 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.055'; + private static $tcpdf_version = '6.0.056'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index a6b3d50..6cd47c6 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,7 +1,7 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.055 + * @version 6.0.056 */ // TCPDF configuration @@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.0.055 + * @version 6.0.056 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -3638,7 +3638,7 @@ class TCPDF { $gvars = $this->getGraphicVars(); if (!empty($this->theadMargins['gvars'])) { // set the correct graphic style - $this->setGraphicVars($this->theadMargins['gvars']); // DEBUG + $this->setGraphicVars($this->theadMargins['gvars']); $this->rMargin = $gvars['rMargin']; $this->lMargin = $gvars['lMargin']; } @@ -7738,7 +7738,7 @@ class TCPDF { // remove buffer file from cache unlink($this->buffer); } - if ($destroyall AND isset($this->cached_files) AND !empty($this->cached_files)) { + if ($destroyall AND !empty($this->cached_files)) { // remove cached files foreach ($this->cached_files as $cachefile) { if (is_file($cachefile)) { @@ -16369,6 +16369,7 @@ class TCPDF { $dom[$key]['align'] = ''; $dom[$key]['listtype'] = ''; $dom[$key]['text-indent'] = 0; + $dom[$key]['text-transform'] = ''; $dom[$key]['border'] = array(); $dom[$key]['dir'] = $this->rtl?'rtl':'ltr'; $thead = false; // true when we are inside the THEAD tag @@ -16421,6 +16422,7 @@ class TCPDF { $dom[$key]['fgcolor'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['fgcolor']; $dom[$key]['strokecolor'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['strokecolor']; $dom[$key]['align'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['align']; + $dom[$key]['text-transform'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['text-transform']; $dom[$key]['dir'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['dir']; if (isset($dom[($dom[($dom[$key]['parent'])]['parent'])]['listtype'])) { $dom[$key]['listtype'] = $dom[($dom[($dom[$key]['parent'])]['parent'])]['listtype']; @@ -16492,6 +16494,7 @@ class TCPDF { $dom[$key]['align'] = $dom[$parentkey]['align']; $dom[$key]['listtype'] = $dom[$parentkey]['listtype']; $dom[$key]['text-indent'] = $dom[$parentkey]['text-indent']; + $dom[$key]['text-transform'] = $dom[$parentkey]['text-transform']; $dom[$key]['border'] = array(); $dom[$key]['dir'] = $dom[$parentkey]['dir']; } @@ -16542,6 +16545,10 @@ class TCPDF { $dom[$key]['text-indent'] = $dom[$parentkey]['text-indent']; } } + // text-transform + if (isset($dom[$key]['style']['text-transform'])) { + $dom[$key]['text-transform'] = $dom[$key]['style']['text-transform']; + } // font size if (isset($dom[$key]['style']['font-size'])) { $fsize = trim($dom[$key]['style']['font-size']); @@ -16934,10 +16941,33 @@ class TCPDF { // text $dom[$key]['tag'] = false; $dom[$key]['block'] = false; - //$element = str_replace(' ', TCPDF_FONTS::unichr(160, $this->isunicode), $element); - $dom[$key]['value'] = stripslashes($this->unhtmlentities($element)); $dom[$key]['parent'] = end($level); $dom[$key]['dir'] = $dom[$dom[$key]['parent']]['dir']; + if (!empty($dom[$dom[$key]['parent']]['text-transform'])) { + // text-transform for unicode requires mb_convert_case (Multibyte String Functions) + if (function_exists('mb_convert_case')) { + $ttm = array('capitalize' => MB_CASE_TITLE, 'uppercase' => MB_CASE_UPPER, 'lowercase' => MB_CASE_LOWER); + if (isset($ttm[$dom[$dom[$key]['parent']]['text-transform']])) { + $element = mb_convert_case($element, $ttm[$dom[$dom[$key]['parent']]['text-transform']], $this->encoding); + } + } elseif (!$this->isunicode) { + switch ($dom[$dom[$key]['parent']]['text-transform']) { + case 'capitalize': { + $element = ucwords(strtolower($element)); + break; + } + case 'uppercase': { + $element = strtoupper($element); + break; + } + case 'lowercase': { + $element = strtolower($element); + break; + } + } + } + } + $dom[$key]['value'] = stripslashes($this->unhtmlentities($element)); } ++$elkey; ++$key; diff --git a/tcpdf_autoconfig.php b/tcpdf_autoconfig.php index 2fc1da6..b2f013e 100644 --- a/tcpdf_autoconfig.php +++ b/tcpdf_autoconfig.php @@ -3,11 +3,11 @@ // File name : tcpdf_autoconfig.php // Version : 1.0.000 // Begin : 2013-05-16 -// Last Update : 2013-05-16 +// Last Update : 2014-01-25 // Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -117,7 +117,11 @@ if (!defined('PDF_HEADER_LOGO_WIDTH')) { } if (!defined('K_PATH_CACHE')) { - define ('K_PATH_CACHE', sys_get_temp_dir().'/'); + $K_PATH_CACHE = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(); + if (substr($K_PATH_CACHE, -1) != '/') { + $K_PATH_CACHE .= '/'; + } + define ('K_PATH_CACHE', $K_PATH_CACHE); } if (!defined('K_BLANK_IMAGE')) { diff --git a/tcpdf_parser.php b/tcpdf_parser.php index 3b3d10e..c1fa0d5 100644 --- a/tcpdf_parser.php +++ b/tcpdf_parser.php @@ -1,13 +1,13 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.012 + * @version 1.0.013 */ // include class for decoding filters @@ -234,7 +234,7 @@ class TCPDF_PARSER { } } // get trailer data - if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { + if (preg_match('/trailer[\s]*<<(.*)>>/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { $trailer_data = $matches[1][0]; if (!isset($xref['trailer']) OR empty($xref['trailer'])) { // get only the last updated version