PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.3.1
GiveWP – Donation Plugin and Fundraising Platform v2.3.1
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / includes / libraries / give-pdf.php

give-pdf.php in GiveWP – Donation Plugin and Fundraising Platform 2.3.1, at includes/libraries/give-pdf.php

98 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PDF MultiCell Table Class.
4 *
5 * @package Give PDFs
6 * @subpackage TCPDF
7 * @since 1.8.14
8 */
9
10 // Exit if accessed directly.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * Class Give_PDF
17 */
18 class Give_PDF extends TCPDF {
19
20 /**
21 * Width.
22 *
23 * @var int $widths Width.
24 */
25 var $widths;
26
27 /**
28 * Alignment.
29 *
30 * @var string $aligns Alignment.
31 */
32 var $aligns;
33
34 /**
35 * Set Header.
36 */
37 function Header() {
38 }
39
40 /**
41 * Set Footer.
42 */
43 function Footer() {
44 $this->SetY( - 15 );
45 $this->SetFont( 'Helvetica', 'I', 8 );
46 $this->Cell( 0, 10, 'Page ' . $this->PageNo(), 0, 0, 'C' );
47 }
48
49 /**
50 * Set Width.
51 *
52 * @param array $w Cell Width.
53 */
54 function SetWidths( $w ) {
55 $this->widths = $w;
56 }
57
58 /**
59 * Set Alignment.
60 *
61 * @param string $a Cell Alignment.
62 */
63 function SetAligns( $a ) {
64 $this->aligns = $a;
65 }
66
67 /**
68 * Set Table Row.
69 *
70 * @param array $data Set data in a row.
71 */
72 function Row( $data ) {
73 $nb = 0;
74 $get_height = array();
75 for ( $i = 0; $i < count( $data ); $i ++ ) {
76 $get_height[] = max( $nb, $this->getNumLines( $data[ $i ], $this->widths[ $i ] ) );
77 }
78 // Get max height from the all column.
79 $max_height = max( $get_height );
80
81 for ( $i = 0; $i < count( $data ); $i ++ ) {
82 $h = 7 * $max_height;
83 $this->checkPageBreak( $h, '', true );
84
85 $w = $this->widths[ $i ];
86 $a = isset( $this->aligns[ $i ] ) ? $this->aligns[ $i ] : 'L';
87 $x = $this->GetX();
88 $y = $this->GetY();
89 $this->Rect( $x, $y, $w, $h );
90
91 $this->MultiCell( $w, $h, $data[ $i ], 0, $a, false, 1, '', '', true, 0, false, true, 0, 'M', false );
92 $this->SetXY( $x + $w, $y );
93 }
94
95 $this->Ln( $max_height * 7 );
96 }
97
98 }