diff --git a/examples/example_012.php b/examples/example_012.php index 0767d0f..4b17819 100644 --- a/examples/example_012.php +++ b/examples/example_012.php @@ -91,7 +91,7 @@ $pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3)); // Curve $pdf->Text(5, 34, 'Curve examples'); -$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, null, $style6); +$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, '', $style6); $pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6); $pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200)); @@ -99,18 +99,18 @@ $pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 2 $pdf->Text(5, 79, 'Circle and ellipse examples'); $pdf->setLineStyle($style5); $pdf->Circle(25,105,20); -$pdf->Circle(25,105,10, 90, 180, null, $style6); +$pdf->Circle(25,105,10, 90, 180, '', $style6); $pdf->Circle(25,105,10, 270, 360, 'F'); $pdf->Circle(25,105,10, 270, 360, 'C', $style6); $pdf->setLineStyle($style5); $pdf->Ellipse(100,103,40,20); -$pdf->Ellipse(100,105,20,10, 0, 90, 180, null, $style6); +$pdf->Ellipse(100,105,20,10, 0, 90, 180, '', $style6); $pdf->Ellipse(100,105,20,10, 0, 270, 360, 'DF', $style6); $pdf->setLineStyle($style5); $pdf->Ellipse(175,103,30,15,45); -$pdf->Ellipse(175,105,15,7.50, 45, 90, 180, null, $style6); +$pdf->Ellipse(175,105,15,7.50, 45, 90, 180, '', $style6); $pdf->Ellipse(175,105,15,7.50, 45, 270, 360, 'F', $style6, array(220, 200, 200)); // Polygon @@ -130,9 +130,9 @@ $pdf->Text(5, 169, 'Regular polygon examples'); $pdf->setLineStyle($style5); $pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F'); $pdf->RegularPolygon(55, 190, 15, 6); -$pdf->RegularPolygon(55, 190, 10, 6, 45, 0, 'DF', array($style6, 0, $style7, 0, $style7, $style7)); -$pdf->RegularPolygon(90, 190, 15, 3, 0, 1, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200)); -$pdf->RegularPolygon(125, 190, 15, 4, 30, 1, null, array('all' => $style5), null, null, $style6); +$pdf->RegularPolygon(55, 190, 10, 6, 45, false, 'DF', array($style6, 0, $style7, 0, $style7, $style7)); +$pdf->RegularPolygon(90, 190, 15, 3, 0, true, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200)); +$pdf->RegularPolygon(125, 190, 15, 4, 30, true, '', array('all' => $style5), array(), '', $style6); $pdf->RegularPolygon(160, 190, 15, 10); // Star polygon @@ -140,9 +140,9 @@ $pdf->Text(5, 209, 'Star polygon examples'); $pdf->setLineStyle($style5); $pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F'); $pdf->StarPolygon(55, 230, 15, 12, 5); -$pdf->StarPolygon(55, 230, 7, 12, 5, 45, 0, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(90, 230, 15, 20, 6, 0, 1, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(125, 230, 15, 5, 2, 30, 1, null, array('all' => $style5), null, null, $style6); +$pdf->StarPolygon(55, 230, 7, 12, 5, 45, false, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200)); +$pdf->StarPolygon(90, 230, 15, 20, 6, 0, true, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200)); +$pdf->StarPolygon(125, 230, 15, 5, 2, 30, true, '', array('all' => $style5), array(), '', $style6); $pdf->StarPolygon(160, 230, 15, 10, 3); $pdf->StarPolygon(160, 230, 7, 50, 26); @@ -151,7 +151,7 @@ $pdf->Text(5, 249, 'Rounded rectangle examples'); $pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); $pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF'); $pdf->RoundedRect(50, 255, 40, 30, 6.50, '1000'); -$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', null, $style6); +$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', '', $style6); $pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200)); // Arrows diff --git a/examples/example_050.php b/examples/example_050.php index 45f9186..0647be6 100644 --- a/examples/example_050.php +++ b/examples/example_050.php @@ -160,7 +160,7 @@ $pdf->Text(20, 205, 'QRCODE H'); o5 = File Size (numeric); o6 = Checksum (numeric). - Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. + Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff". */ diff --git a/examples/tcpdf_include.php b/examples/tcpdf_include.php index 26e23a8..40d9f75 100644 --- a/examples/tcpdf_include.php +++ b/examples/tcpdf_include.php @@ -28,7 +28,8 @@ require_once('config/tcpdf_config_alt.php'); // Include the main TCPDF library (search the library on the following directories). $tcpdf_include_dirs = array( - realpath('../tcpdf.php'), + realpath(dirname(__FILE__) . '/../tcpdf.php'),// True source file + realpath('../tcpdf.php'),// Relative from $PWD '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index 10e8192..7f41538 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -506,7 +506,7 @@ class TCPDF_STATIC { return $out; } if ($last_enc_key != $key) { - $k = str_repeat($key, ((256 / strlen($key)) + 1)); + $k = str_repeat($key, (int) ((256 / strlen($key)) + 1)); $rc4 = range(0, 255); $j = 0; for ($i = 0; $i < 256; ++$i) { diff --git a/tcpdf.php b/tcpdf.php index fabba04..375f0ca 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -7409,9 +7409,9 @@ class TCPDF { if (!isset($this->gdgammacache['#'.$c])) { $colors = imagecolorsforindex($img, $c); // GD alpha is only 7 bit (0 -> 127) - $this->gdgammacache['#'.$c] = (((127 - $colors['alpha']) / 127) * 255); + $this->gdgammacache['#'.$c] = (int) (((127 - $colors['alpha']) / 127) * 255); // correct gamma - $this->gdgammacache['#'.$c] = (pow(($this->gdgammacache['#'.$c] / 255), 2.2) * 255); + $this->gdgammacache['#'.$c] = (int) (pow(($this->gdgammacache['#'.$c] / 255), 2.2) * 255); // store the latest values on cache to improve performances if (count($this->gdgammacache) > 8) { // remove one element from the cache array @@ -14529,8 +14529,8 @@ class TCPDF { if ($patch_array[$i]['points'][$j] > $bpcd) { $patch_array[$i]['points'][$j] = $bpcd; } - $this->gradients[$n]['stream'] .= chr(floor($patch_array[$i]['points'][$j] / 256)); - $this->gradients[$n]['stream'] .= chr(floor($patch_array[$i]['points'][$j] % 256)); + $this->gradients[$n]['stream'] .= chr((int) floor($patch_array[$i]['points'][$j] / 256)); + $this->gradients[$n]['stream'] .= chr((int) floor(intval($patch_array[$i]['points'][$j]) % 256)); } $count_cols = count($patch_array[$i]['colors']); for ($j=0; $j < $count_cols; ++$j) { @@ -15324,7 +15324,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDFBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if (($arrcode === false) OR empty($arrcode) OR ($arrcode['maxw'] <= 0)) { + if (empty($arrcode) OR ($arrcode['maxw'] <= 0)) { $this->Error('Error in 1D barcode string'); } if ($arrcode['maxh'] <= 0) { @@ -15642,7 +15642,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDF2DBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if (($arrcode === false) OR empty($arrcode) OR !isset($arrcode['num_rows']) OR ($arrcode['num_rows'] == 0) OR !isset($arrcode['num_cols']) OR ($arrcode['num_cols'] == 0)) { + if (empty($arrcode) OR !isset($arrcode['num_rows']) OR ($arrcode['num_rows'] == 0) OR !isset($arrcode['num_cols']) OR ($arrcode['num_cols'] == 0)) { $this->Error('Error in 2D barcode string'); } // set default values diff --git a/tcpdf_barcodes_1d.php b/tcpdf_barcodes_1d.php index 7fc9648..10a79a7 100644 --- a/tcpdf_barcodes_1d.php +++ b/tcpdf_barcodes_1d.php @@ -53,7 +53,7 @@ class TCPDFBarcode { * Array representation of barcode. * @protected */ - protected $barcode_array; + protected $barcode_array = array(); /** * This is the class constructor. @@ -373,7 +373,7 @@ class TCPDFBarcode { break; } default: { - $this->barcode_array = false; + $this->barcode_array = array(); $arrcode = false; break; } diff --git a/tcpdf_barcodes_2d.php b/tcpdf_barcodes_2d.php index 9b35689..730361b 100644 --- a/tcpdf_barcodes_2d.php +++ b/tcpdf_barcodes_2d.php @@ -53,7 +53,7 @@ class TCPDF2DBarcode { * Array representation of barcode. * @protected */ - protected $barcode_array = false; + protected $barcode_array = array(); /** * This is the class constructor. @@ -63,7 +63,7 @@ class TCPDF2DBarcode { *