Version Description
- Bug - Fixed issue with plugin breaking website's when the Gravity Forms plugin wasn't activated.
- Housekeeping - The plugin now only supports Gravity Forms 1.7 or higher and Wordpress 3.5 or higher.
- Housekeeping - PDF template files can no longer be accessed directly. Instead, add &html=1 to the end of your URL when viewing a PDF.
- Extension - Added additional filters to allow the lead ID and notifications to be overridden.
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 3.1.4 |
Comparing to | |
See all releases |
Code changes from version 3.1.3 to 3.1.4
- README.txt +243 -237
- configuration.php +299 -299
- installation-update-manager.php +667 -667
- pdf-common.php +232 -232
- pdf-configuration-indexer.php +255 -259
- pdf-entry-detail.php +1135 -1170
- pdf-render.php +263 -263
- pdf-settings.php +230 -254
- pdf.php +735 -716
- render_to_pdf.php +70 -70
- templates/default-template-no-style.php +53 -76
- templates/default-template-two-rows.php +54 -78
- templates/default-template.php +51 -74
- templates/example-advanced-headers_07.php +117 -139
- templates/example-backgrounds-and-borders02.php +180 -202
- templates/example-basic-html01.php +180 -202
- templates/example-different-page-size_08.php +71 -93
- templates/example-float-and-positioning05.php +172 -194
- templates/example-header-and-footer_06.php +105 -127
- templates/example-images03.php +247 -269
- templates/example-tables04.php +1174 -1196
- templates/example-template.php +103 -144
README.txt
CHANGED
@@ -1,237 +1,243 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
-
Contributors: blueliquiddesigns
|
3 |
-
Donate link: http://www.gravityformspdfextended.com
|
4 |
-
Tags: gravity, forms, pdf, automation, attachment
|
5 |
-
Requires at least: 3.4
|
6 |
-
Tested up to: 3.5.2
|
7 |
-
Stable tag: 3.1.
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
Gravity Forms PDF Extended allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission.
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
As of Gravity Forms PDF Extended v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
16 |
-
|
17 |
-
**Features**
|
18 |
-
|
19 |
-
* Save PDF File on user submission of a Gravity Form so it can be attached to a notification
|
20 |
-
* Customise the PDF template without affecting the core Gravity Form Plugin
|
21 |
-
* Multiple PDF Templates
|
22 |
-
* Custom PDF Name
|
23 |
-
* Output individual form fields in the template - like MERGETAGS.
|
24 |
-
* View and download a PDF via the administrator interface
|
25 |
-
* Simple function to output PDF via template / plugin
|
26 |
-
* Works with Gravity Forms Signature Add-On
|
27 |
-
|
28 |
-
**PDF Features**
|
29 |
-
|
30 |
-
Along with the above features, the new PDF features include:
|
31 |
-
|
32 |
-
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
33 |
-
* HTML Page Numbering
|
34 |
-
* Odd and even paging with mirrored margins (most commonly used in printing).
|
35 |
-
* Nested Tables
|
36 |
-
* Text-justification and hyphenation
|
37 |
-
* Table of Contents
|
38 |
-
* Index
|
39 |
-
* Bookmarks
|
40 |
-
* Watermarks
|
41 |
-
* Password protection
|
42 |
-
* UTF-8 encoded HTML
|
43 |
-
* Better system resource handling
|
44 |
-
|
45 |
-
**Server Requirements**
|
46 |
-
|
47 |
-
1. PHP 5+
|
48 |
-
2. MB String
|
49 |
-
3. GD Library (optional)
|
50 |
-
4. RAM: Recommended: 128MB. Minimum: 64MB.
|
51 |
-
|
52 |
-
**Software Requirements**
|
53 |
-
|
54 |
-
1. [Purchase and install Gravity Forms](https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154)
|
55 |
-
2. Wordpress 3.4+
|
56 |
-
3. Gravity Forms 1.6.9+
|
57 |
-
|
58 |
-
**Documentation and Support**
|
59 |
-
|
60 |
-
To view the Development Documentation head to [http://www.gravityformspdfextended.com/documentation/](http://www.gravityformspdfextended.com/documentation/). If you need support with the plugin please post a topic in our [support forums](http://gravityformspdfextended.com/support/gravity-forms-pdf-extended/).
|
61 |
-
|
62 |
-
== Installation ==
|
63 |
-
|
64 |
-
1. Upload this plugin to your website and activate it
|
65 |
-
2. Create a form in Gravity Forms and configure notifications
|
66 |
-
3. Get the Form ID and follow the steps below in [the configuration section](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/)
|
67 |
-
4. Modify the PDF template file ([see the advanced templating section in the documentation](http://gravityformspdfextended.com/documentation-v3-x-x/templates/)) inside your active theme's PDF_EXTENDED_TEMPLATES/ folder.
|
68 |
-
|
69 |
-
|
70 |
-
== Frequently Asked Questions ==
|
71 |
-
|
72 |
-
All FAQs can be [viewed on the Gravity Forms PDF Extended website](http://gravityformspdfextended.com/faq/category/developers/).
|
73 |
-
|
74 |
-
== Screenshots ==
|
75 |
-
|
76 |
-
1. View PDF from the Gravity Forms entries list.
|
77 |
-
2. View or download the PDF from a Gravity Forms entry.
|
78 |
-
|
79 |
-
== Changelog ==
|
80 |
-
|
81 |
-
= 3.1.
|
82 |
-
*
|
83 |
-
*
|
84 |
-
*
|
85 |
-
*
|
86 |
-
|
87 |
-
|
88 |
-
*
|
89 |
-
|
90 |
-
|
91 |
-
*
|
92 |
-
* Bug - Fixed
|
93 |
-
* Bug - Fixed
|
94 |
-
* Bug - Fixed
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
* Bug -
|
99 |
-
* Bug -
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
*
|
105 |
-
*
|
106 |
-
|
107 |
-
|
108 |
-
*
|
109 |
-
*
|
110 |
-
*
|
111 |
-
*
|
112 |
-
*
|
113 |
-
*
|
114 |
-
*
|
115 |
-
*
|
116 |
-
|
117 |
-
|
118 |
-
*
|
119 |
-
*
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
*
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
New
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
*
|
138 |
-
*
|
139 |
-
*
|
140 |
-
*
|
141 |
-
*
|
142 |
-
*
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
*
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*
|
166 |
-
|
167 |
-
|
168 |
-
* Bug - Fixed error
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
*
|
173 |
-
*
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
*
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
*
|
184 |
-
*
|
185 |
-
*
|
186 |
-
*
|
187 |
-
*
|
188 |
-
*
|
189 |
-
* Bug -
|
190 |
-
*
|
191 |
-
*
|
192 |
-
*
|
193 |
-
*
|
194 |
-
|
195 |
-
|
196 |
-
*
|
197 |
-
*
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
* Fixed
|
203 |
-
*
|
204 |
-
|
205 |
-
|
206 |
-
*
|
207 |
-
*
|
208 |
-
|
209 |
-
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
*
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
*
|
228 |
-
*
|
229 |
-
* Fixed bug when using
|
230 |
-
|
231 |
-
= 1.
|
232 |
-
*
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: blueliquiddesigns
|
3 |
+
Donate link: http://www.gravityformspdfextended.com
|
4 |
+
Tags: gravity, forms, pdf, automation, attachment
|
5 |
+
Requires at least: 3.4
|
6 |
+
Tested up to: 3.5.2
|
7 |
+
Stable tag: 3.1.4
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Gravity Forms PDF Extended allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
As of Gravity Forms PDF Extended v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
16 |
+
|
17 |
+
**Features**
|
18 |
+
|
19 |
+
* Save PDF File on user submission of a Gravity Form so it can be attached to a notification
|
20 |
+
* Customise the PDF template without affecting the core Gravity Form Plugin
|
21 |
+
* Multiple PDF Templates
|
22 |
+
* Custom PDF Name
|
23 |
+
* Output individual form fields in the template - like MERGETAGS.
|
24 |
+
* View and download a PDF via the administrator interface
|
25 |
+
* Simple function to output PDF via template / plugin
|
26 |
+
* Works with Gravity Forms Signature Add-On
|
27 |
+
|
28 |
+
**PDF Features**
|
29 |
+
|
30 |
+
Along with the above features, the new PDF features include:
|
31 |
+
|
32 |
+
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
33 |
+
* HTML Page Numbering
|
34 |
+
* Odd and even paging with mirrored margins (most commonly used in printing).
|
35 |
+
* Nested Tables
|
36 |
+
* Text-justification and hyphenation
|
37 |
+
* Table of Contents
|
38 |
+
* Index
|
39 |
+
* Bookmarks
|
40 |
+
* Watermarks
|
41 |
+
* Password protection
|
42 |
+
* UTF-8 encoded HTML
|
43 |
+
* Better system resource handling
|
44 |
+
|
45 |
+
**Server Requirements**
|
46 |
+
|
47 |
+
1. PHP 5+
|
48 |
+
2. MB String
|
49 |
+
3. GD Library (optional)
|
50 |
+
4. RAM: Recommended: 128MB. Minimum: 64MB.
|
51 |
+
|
52 |
+
**Software Requirements**
|
53 |
+
|
54 |
+
1. [Purchase and install Gravity Forms](https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154)
|
55 |
+
2. Wordpress 3.4+
|
56 |
+
3. Gravity Forms 1.6.9+
|
57 |
+
|
58 |
+
**Documentation and Support**
|
59 |
+
|
60 |
+
To view the Development Documentation head to [http://www.gravityformspdfextended.com/documentation/](http://www.gravityformspdfextended.com/documentation/). If you need support with the plugin please post a topic in our [support forums](http://gravityformspdfextended.com/support/gravity-forms-pdf-extended/).
|
61 |
+
|
62 |
+
== Installation ==
|
63 |
+
|
64 |
+
1. Upload this plugin to your website and activate it
|
65 |
+
2. Create a form in Gravity Forms and configure notifications
|
66 |
+
3. Get the Form ID and follow the steps below in [the configuration section](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/)
|
67 |
+
4. Modify the PDF template file ([see the advanced templating section in the documentation](http://gravityformspdfextended.com/documentation-v3-x-x/templates/)) inside your active theme's PDF_EXTENDED_TEMPLATES/ folder.
|
68 |
+
|
69 |
+
|
70 |
+
== Frequently Asked Questions ==
|
71 |
+
|
72 |
+
All FAQs can be [viewed on the Gravity Forms PDF Extended website](http://gravityformspdfextended.com/faq/category/developers/).
|
73 |
+
|
74 |
+
== Screenshots ==
|
75 |
+
|
76 |
+
1. View PDF from the Gravity Forms entries list.
|
77 |
+
2. View or download the PDF from a Gravity Forms entry.
|
78 |
+
|
79 |
+
== Changelog ==
|
80 |
+
|
81 |
+
= 3.1.4 =
|
82 |
+
* Bug - Fixed issue with plugin breaking website's when the Gravity Forms plugin wasn't activated.
|
83 |
+
* Housekeeping - The plugin now only supports Gravity Forms 1.7 or higher and Wordpress 3.5 or higher.
|
84 |
+
* Housekeeping - PDF template files can no longer be accessed directly. Instead, add &html=1 to the end of your URL when viewing a PDF.
|
85 |
+
* Extension - Added additional filters to allow the lead ID and notifications to be overridden.
|
86 |
+
|
87 |
+
= 3.1.3 =
|
88 |
+
* Feature - Added signature_details_id to $form_data array which maps a signatures field ID to the array.
|
89 |
+
* Extension - Added pre-PDF generator filter for use with extensions.
|
90 |
+
* Bug - Fixed issue with quotes in entry data breaking custom templates.
|
91 |
+
* Bug - Fixed issue with the plugin not correctly using the new default configuration template, if set.
|
92 |
+
* Bug - Fixed issue with signature not being removed correctly when only testing with file_exists(). Added second is_dir() test.
|
93 |
+
* Bug - Fixed issue with empty signature field not displaying when option 'default-show-empty' is set.
|
94 |
+
* Bug - Fixed initialisation prompt issue when the MPDF package wasn't unpacked.
|
95 |
+
|
96 |
+
= 3.1.2 =
|
97 |
+
* Feature - Added list array, file path, form ID and lead ID to $form_data array in custom templates
|
98 |
+
* Bug - Fixed initialisation prompt issue when updating plugin
|
99 |
+
* Bug - Fixed window.open issue which prevented a new window from opening when viewing a PDF in the admin area
|
100 |
+
* Bug - Fixed issue with product dropdown and radio button data showing the value instead of the name field.
|
101 |
+
* Bug - Fixed incorrect URL pointing to signature in $form_data
|
102 |
+
|
103 |
+
= 3.1.1 =
|
104 |
+
* Bug - Users whose server only supports FTP file manipulation using the WP_Filesystem API moved the files into the wrong directory due to FTP usually being rooted to the Wordpress home directory. To fix this the plugin attempts to determine the FTP directory, otherwise assumes it is the WP base directory.
|
105 |
+
* Bug - Initialisation error message was being called but the success message was also showing.
|
106 |
+
|
107 |
+
= 3.1.0 =
|
108 |
+
* Feature - Added defaults to configuration.php which allows users to define the default PDF settings for all Gravity Forms. See the [installation and configuration documentation](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#default-configuration-options) for more details.
|
109 |
+
* Feature - Added three new configuration options 'default-show-html', 'default-show-empty' and 'default-show-page-names' which allow different display options to the three default templates. See the [installation and configuration documentation](http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#default-template-only) for more details.
|
110 |
+
* Feature - Added filter hooks 'gfpdfe_pdf_name' and 'gfpdfe_template' which allows developers to further modify a PDF name and template file, respectively, outside of the configuration.php. This is useful if you have a special case naming convention based on user input. See [http://gravityformspdfextended.com/filters-and-hooks/](http://gravityformspdfextended.com/filters-and-hooks/) for more details about using these filters.
|
111 |
+
* Feature - Custom font support. Any .ttf font file added to the PDF_EXTENDED_TEMPLATE/fonts/ folder will be automatically installed once the plugin has been initialised. Users also have the option to just initialise the fonts via the settings page. See the [font/language documentation ](http://gravityformspdfextended.com/documentation-v3-x-x/language-support/#installing-fonts) for details.
|
112 |
+
* Compatability - Use Gravity Forms get_upload_root() and get_upload_url_root() instead of hard coding the signature upload directory in pdf-entry-detail.php
|
113 |
+
* Compatability - Changed depreciated functions get_themes() and get_theme() to wp_get_theme() (added in Wordpress v3.4).
|
114 |
+
* Compatability - The plugin now needs to be initialised on fresh installation and upgrade. This allows us to use the WP_Filesystem API for file manipulation.
|
115 |
+
* Compatability - Automatic copying of PDF_EXTENDED_TEMPLATE folder on a theme change was removed in favour of a user prompt. This allows us to take advantage of the WP_Filesystem API.
|
116 |
+
* Compatability - Added Wordpress compatibility checker (minimum now 3.4 or higher).
|
117 |
+
* Bug - Removed ZipArchive in favour of Wordpress's WP_Filesystem API unzip_file() command. Some users reported the plugin would stop their entire website working if this extension wasn't installed.
|
118 |
+
* Bug - Fixed Gravity Forms compatibility checker which wouldn't return the correct response.
|
119 |
+
* Bug - Fixed minor bug in pdf.php when using static call 'self' in add_filter hook. Changed to class name.
|
120 |
+
* Bug - Removed PHP notice about $even variable not being defined in pdf-entry-detail.php
|
121 |
+
* Bug - Prevent code from continuing to excecute after sending header redirect.
|
122 |
+
|
123 |
+
= 3.0.2 =
|
124 |
+
* Backwards Compatibility - While PHP 5.3 has was released a number of years ago it seems a number of hosts do not currently offer this version to their clients. In the interest of backwards compatibility we've re-written the plugin to again work with PHP 5+.
|
125 |
+
* Signature / Image Display Bug - All URLs have been converted to a path so images should now display correctly in PDF.
|
126 |
+
|
127 |
+
= 3.0.1 =
|
128 |
+
* Bug - Fixed issue that caused website to become unresponsive when Gravity Forms was disabled or upgraded
|
129 |
+
* Bug - New HTML fields weren't being displayed in $form_data array
|
130 |
+
* Feature - Options for default templates to disable HTML fields or empty fields (or both)
|
131 |
+
|
132 |
+
= 3.0.0 =
|
133 |
+
As of Gravity Forms PDF Extended v3.0.0 we have removed the DOMPDF package from our plugin and integrated the more advanced mPDF system. Along with a new HTML to PDF generator, we've rewritten the entire plugin's base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding security features is now accessible to users who have little experience with PHP.
|
134 |
+
|
135 |
+
New Features include:
|
136 |
+
|
137 |
+
* Language Support - almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and CJK languages - Chinese, Japanese and Korean.
|
138 |
+
* HTML Page Numbering
|
139 |
+
* Odd and even paging with mirrored margins (most commonly used in printing).
|
140 |
+
* Nested Tables
|
141 |
+
* Text-justification and hyphenation
|
142 |
+
* Table of Contents
|
143 |
+
* Index
|
144 |
+
* Bookmarks
|
145 |
+
* Watermarks
|
146 |
+
* Password protection
|
147 |
+
* UTF-8 encoded HTML
|
148 |
+
* Better system resource handling
|
149 |
+
|
150 |
+
A new HTML to PDF package wasn't the only change to this edition of the software. We have rewritten the entire configuration system and made it super easy to get the software up and running.
|
151 |
+
|
152 |
+
Users will no longer place code in their active theme's functions.php file. Instead, configuration will happen in a new file called configuration.php, inside the PDF_EXTENDED_TEMPLATES folder (in your active theme).
|
153 |
+
|
154 |
+
Other changes include
|
155 |
+
* Improved security - further restrictions were placed on non-administrators viewing template files.
|
156 |
+
* $form_data array tidied up - images won't be wrapped in anchor tags.
|
157 |
+
|
158 |
+
For more details [view the 3.x.x online documentation](http://gravityformspdfextended.com/documentation-v3-x-x/introduction/).
|
159 |
+
|
160 |
+
= 2.2.3 =
|
161 |
+
* Bug - Fixed mb_string error in the updated DOMPDF package.
|
162 |
+
|
163 |
+
= 2.2.2 =
|
164 |
+
* DOMPDF - We updated to the latest version of DOMPDF - DOMPDF 0.6.0 beta 3.
|
165 |
+
* DOMPDF - We've enabled font subsetting by default which should help limit the increased PDF size when using DejaVu Sans (or any other font).
|
166 |
+
|
167 |
+
= 2.2.1 =
|
168 |
+
* Bug - Fixed HTML error which caused list items to distort on PDF
|
169 |
+
|
170 |
+
= 2.2.0 =
|
171 |
+
* Compatibility - Ensure compatibility with Gravity Forms 1.7. We've updated the functions.php code and remove gform_user_notification_attachments and gform_admin_notification_attachments hooks which are now depreciated. Functions gform_pdf_create and gform_add_attachment have been removed and replaced with gfpdfe_create_and_attach_pdf(). See upgrade documentation for details.
|
172 |
+
* Enhancement - Added deployment code switch so the template redeployment feature can be turned on and off. This release doesn't require redeployment.
|
173 |
+
* Enhancement - PDF_Generator() variables were getting long and complex so the third variable is now an array which will pass all the optional arguments. The new 1.7 compatible functions.php code includes this method by default. For backwards compatibility the function will still work with the variable structure prior to 2.2.0.
|
174 |
+
* Bug - Fixed error generated by legacy code in the function PDF_processing() which is located in render_to_pdf.php.
|
175 |
+
* Bug - Images and stylesheets will now try and be accessed with a local path instead of a URL. It fixes problem where some hosts were preventing read access from a URL. No template changes are required.
|
176 |
+
|
177 |
+
= 2.1.1 =
|
178 |
+
* Bug - Signatures stopped displaying after 2.1.0 update. Fixed issue.
|
179 |
+
* Bug - First time install code now won't execute if already have configuration variables in database
|
180 |
+
|
181 |
+
= 2.1.0 =
|
182 |
+
|
183 |
+
* Feature - Product table can now be accessed directly through custom templates by running GFPDFEntryDetail::product_table($form, $lead);. See documentation for more details.
|
184 |
+
* Feature - Update screen will ask you if you want to deploy new template files, instead of overriding your modified versions.
|
185 |
+
* Feature - Product subtotal, shipping and total have been added to $form_data['field'] array to make it easier to work with product details in the custom template.
|
186 |
+
* Feature - Added two new default template files. One displays field and name in two rows (like you see when viewing an entry in the admin area) and the other removes all styling. See documentation on use.
|
187 |
+
* Security - Tightened PDF template security so that custom templates couldn't be automatically generated by just anyone. Now only logged in users with the correct privileges and the user who submitted the form (matched against IP) can auto generate a PDF. See documentation on usage.
|
188 |
+
* Depreciated - Removed form data that was added directly to the $form_data array instead of $form_data['field'] array. Users upgrading will need to update their custom templates if not using field data from the $form_data[�field'] array. If using $form_data['field'] in your custom template this won't affect you.
|
189 |
+
* Bug - Fixed problem with default template not showing and displaying a timeout error. Removed table tags and replaced with divs that are styled appropriately.
|
190 |
+
* Bug - The new plugin theme folder will successfully create when upgrading. You won't have to deactivate and reactivate to get it working.
|
191 |
+
* Bug - some installs had plugins that included the function mb_string which is also included in DOMPDF. DOMPDF will now check if the function exists before creating it.
|
192 |
+
* Bug - Remove empty signature field from the default template.
|
193 |
+
* Bug - fixed problem with redirecting to login screen even when logged in while accessing template file through the browser window directly.
|
194 |
+
* Bug - fixed error where sample template would reimport itself automatically even after deleting it. Will now only reimport if any important changes to template need to be viewed straight after an update.
|
195 |
+
* Bug - Moved render_to_pdf.php constants to pdf.php so we can use the constants in the core files. Was previously generating an error.
|
196 |
+
* Housekeeping - Cleaned up core template files, moved functions into classes and added more in-file documentation.
|
197 |
+
* Housekeeping - moved install/upgrade code from pdf.php to installation-update-manager.php
|
198 |
+
* Housekeeping - changed pdf-entry-detail.php class name from GFEntryDetail to GFPDFEntryDetail to remove compatibility problems with Gravity Forms.
|
199 |
+
* Housekeeping - created pdf-settings.php file to house the settings page code.
|
200 |
+
|
201 |
+
= 2.0.1 =
|
202 |
+
* Fixed Signature bug when checking if image file exists using URL instead of filesystem path
|
203 |
+
* Fixed PHP Constants Notice
|
204 |
+
|
205 |
+
= 2.0.0 =
|
206 |
+
* Moved templates to active theme folder to prevent custom themes being removed on upgrade
|
207 |
+
* Allow PDFs to be saved using a custom name
|
208 |
+
* Fixed WP_Error bug when image/css file cannot be found
|
209 |
+
* Upgraded to latest version of DOMPDF
|
210 |
+
* Removed auto-load form bug which would see multiple instances of the example form loaded
|
211 |
+
* Created a number of constants to allow easier developer modification
|
212 |
+
* Plugin/Support moved to dedicated website.
|
213 |
+
* Pro/Business package offers the ability to write fields on an existing PDF.
|
214 |
+
|
215 |
+
= 1.2.3 =
|
216 |
+
* Fixed $wpdb->prepare error
|
217 |
+
|
218 |
+
= 1.2.2 =
|
219 |
+
* Fixed bug with tempalte shipping method MERGETAGS
|
220 |
+
* Fixed bug where attachment wasn't being sent
|
221 |
+
* Fixed problem when all_url_fopen was turned off on server and failed to retreive remote images. Now uses WP_HTTP class.
|
222 |
+
|
223 |
+
= 1.2.1 =
|
224 |
+
* Fixed path to custom css file included in PDF template
|
225 |
+
|
226 |
+
= 1.2.0 =
|
227 |
+
* Template files moved to the plugin's template folder
|
228 |
+
* Sample Form installed so developers have a working example to modify
|
229 |
+
* Fixed bug when using WordPress in another directory to the site
|
230 |
+
|
231 |
+
= 1.1.0 =
|
232 |
+
* Now compatible with Gravity Forms Signature Add-On
|
233 |
+
* Moved the field data functions out side of the Gravity Forms core so users can freely style their form information (located in pdf-entry-detail.php)
|
234 |
+
* Simplified the field data output
|
235 |
+
* Fixed bug when using product information
|
236 |
+
|
237 |
+
= 1.0.0 =
|
238 |
+
* First release.
|
239 |
+
|
240 |
+
== Upgrade Notice ==
|
241 |
+
|
242 |
+
= 3.1.4 =
|
243 |
+
Gravity Forms PDF Extended now only supports Gravity Forms 1.7.x and Wordpress 3.5+.
|
configuration.php
CHANGED
@@ -1,300 +1,300 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* Gravity Forms PDF Extended Configuration
|
5 |
-
* New from v3.0.0. No longer is theme functions.php code required.
|
6 |
-
* Important documentation on the configuration found at http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/
|
7 |
-
*/
|
8 |
-
|
9 |
-
/*
|
10 |
-
* Added in v3.1.0
|
11 |
-
* Users can now assign defaults to forms that aren't configured below.
|
12 |
-
* Note: this will only work if the configuration option GFPDF_SET_DEFAULT_TEMPLATE is set to true (located at the bottom of this file).
|
13 |
-
*
|
14 |
-
* Users can use any configuration option like you would for a singular form, including:
|
15 |
-
* notifications, template, filename, pdf_size, orientation, security and rtl
|
16 |
-
*/
|
17 |
-
global $gf_pdf_default_configuration;
|
18 |
-
|
19 |
-
$gf_pdf_default_configuration = array(
|
20 |
-
'template' => 'default-template
|
21 |
-
'pdf_size' => 'A4'
|
22 |
-
);
|
23 |
-
|
24 |
-
/*
|
25 |
-
* ------------------------------------------------------------
|
26 |
-
* Bare minimum configuration code
|
27 |
-
* Usage: Will generate PDF and send to all notifications
|
28 |
-
* Remove the comments around the code blocks below to use (/*)
|
29 |
-
* form_id Mixed - Integer or Array. Required. The Gravity Form ID you are assigning the PDF to.
|
30 |
-
* notifications Mixed - String, Boolean or Array.
|
31 |
-
*/
|
32 |
-
/*$gf_pdf_config[] = array(
|
33 |
-
'form_id' =>
|
34 |
-
'notifications' => true
|
35 |
-
);*/
|
36 |
-
|
37 |
-
/*
|
38 |
-
* ------------------------------------------------------------
|
39 |
-
* Default template specific configuration code
|
40 |
-
* As of 3.1.0 uses can now add default-show-html, default-show-empty and default-show-page-names when using any
|
41 |
-
* of the default template files (any template prepended with default-)
|
42 |
-
*
|
43 |
-
* Usage:
|
44 |
-
* 'default-show-html' - This option will display HTMl blocks in your default tempalte.
|
45 |
-
* 'default-show-empty' - All form fields will be displayed in the PDF, regardless of what the user input is.
|
46 |
-
* 'default-show-page-names' - If you are using page breaks you can display the page names in the PDF.
|
47 |
-
*
|
48 |
-
* Remove the comments around the code blocks below to use (/*)
|
49 |
-
*/
|
50 |
-
|
51 |
-
/*$gf_pdf_config[] = array(
|
52 |
-
'form_id' =>
|
53 |
-
'template' => 'default-template.php',
|
54 |
-
'default-show-html' => true
|
55 |
-
);*/
|
56 |
-
|
57 |
-
/*$gf_pdf_config[] = array(
|
58 |
-
'form_id' =>
|
59 |
-
'template' => 'default-template.php',
|
60 |
-
'default-show-empty' => true
|
61 |
-
);*/
|
62 |
-
|
63 |
-
/*$gf_pdf_config[] = array(
|
64 |
-
'form_id' =>
|
65 |
-
'template' => 'default-template.php',
|
66 |
-
'default-show-page-names' => true
|
67 |
-
);*/
|
68 |
-
|
69 |
-
/*$gf_pdf_config[] = array(
|
70 |
-
'form_id' =>
|
71 |
-
'template' => 'default-template.php',
|
72 |
-
'default-show-html' => true,
|
73 |
-
'default-show-empty' => true,
|
74 |
-
'default-show-page-names' => true
|
75 |
-
);*/
|
76 |
-
|
77 |
-
/*
|
78 |
-
* ------------------------------------------------------------
|
79 |
-
* Notification Options
|
80 |
-
* notifications Mixed - String, Boolean or Array.
|
81 |
-
* Notifications can be a string like 'Admin Notifications', an array with multiple notification names or true to send to all.
|
82 |
-
*/
|
83 |
-
/*$gf_pdf_config[] = array(
|
84 |
-
'form_id' =>
|
85 |
-
'notifications' => 'Admin Notification'
|
86 |
-
);*/
|
87 |
-
|
88 |
-
/*$gf_pdf_config[] = array(
|
89 |
-
'form_id' => '1',
|
90 |
-
'notifications' => array('Admin Notification', 'User Notification')
|
91 |
-
);*/
|
92 |
-
|
93 |
-
/*
|
94 |
-
* ------------------------------------------------------------
|
95 |
-
* Custom Template
|
96 |
-
* Don't want to use a custom template? Just pass the custom template name to the configuration.
|
97 |
-
* template String. Default default-template.php. The name of your custom template that's placed in your active theme's PDF_EXTENDED_TEMPLATES folder.
|
98 |
-
* For more information about creating custom templates please see http://gravityformspdfextended.com/documentation-v3-x-x/templates/
|
99 |
-
*/
|
100 |
-
/*$gf_pdf_config[] = array(
|
101 |
-
'form_id' => 1,
|
102 |
-
'notifications' => 'User Notification',
|
103 |
-
|
104 |
-
'template' => 'example-float-and-positioning05.php'
|
105 |
-
);*/
|
106 |
-
|
107 |
-
/*$gf_pdf_config[] = array(
|
108 |
-
'form_id' => 2,
|
109 |
-
'notifications' => 'User Notification',
|
110 |
-
|
111 |
-
'template' => 'example-basic-html01.php'
|
112 |
-
);*/
|
113 |
-
|
114 |
-
/*
|
115 |
-
* ------------------------------------------------------------
|
116 |
-
* Multiple Forms
|
117 |
-
* If you have multiple forms that use the same PDF template then you can pass the form_id through as an array.
|
118 |
-
* WARNING: If using a custom template with this option your secondary forms should be a duplicate of the original and you shouldn't delete the fields
|
119 |
-
* otherwise the custom template won't show correctly.
|
120 |
-
* WARNING: The previous warning also applies to custom PDF names with MERGETAGS
|
121 |
-
*/
|
122 |
-
/*$gf_pdf_config[] = array(
|
123 |
-
'form_id' => array(1,5,6),
|
124 |
-
'notifications' => true
|
125 |
-
);*/
|
126 |
-
|
127 |
-
/*
|
128 |
-
* ------------------------------------------------------------
|
129 |
-
* Custom File Name
|
130 |
-
* Will change the filename of the PDF which is attached
|
131 |
-
* As of v3.0.0 merge tags can be used in the file name
|
132 |
-
* filename String. Default form-{form_id}-entry-{entry_id}.pdf
|
133 |
-
*/
|
134 |
-
/*$gf_pdf_config[] = array(
|
135 |
-
'form_id' =>
|
136 |
-
'notifications' => true,
|
137 |
-
'filename' => 'New PDF Name.pdf'
|
138 |
-
);*/
|
139 |
-
|
140 |
-
/*$gf_pdf_config[] = array(
|
141 |
-
'form_id' => '1',
|
142 |
-
'notifications' => true,
|
143 |
-
'filename' => 'User {Name:1}.pdf'
|
144 |
-
);*/
|
145 |
-
|
146 |
-
/*
|
147 |
-
* ------------------------------------------------------------
|
148 |
-
* Custom PDF Size / Orientation
|
149 |
-
* PDF Size can be set to the following:
|
150 |
-
*
|
151 |
-
* A0 - A10, B0 - B10, C0 - C10
|
152 |
-
* 4A0, 2A0, RA0 - RA4, SRA0 - SRA4
|
153 |
-
* Letter, Legal, Executive, Folio
|
154 |
-
* Demy, Royal
|
155 |
-
*
|
156 |
-
* Default: A4
|
157 |
-
* You can also pass the PDF size as an array, represented in millimetres - array(width, height).
|
158 |
-
*
|
159 |
-
* NOTE: By default the orientation is portrait so you only need to add it for landscape PDFs
|
160 |
-
*/
|
161 |
-
|
162 |
-
/* Letter-sized Document */
|
163 |
-
/*$gf_pdf_config[] = array(
|
164 |
-
'form_id' =>
|
165 |
-
'attachments' => true,
|
166 |
-
|
167 |
-
'pdf_size' => 'letter'
|
168 |
-
);*/
|
169 |
-
|
170 |
-
/* Custom PDF Size */
|
171 |
-
/* $gf_pdf_config[] = array(
|
172 |
-
'form_id' =>
|
173 |
-
'attachments' => true,
|
174 |
-
|
175 |
-
'pdf_size' => array(50, 200)
|
176 |
-
);*/
|
177 |
-
|
178 |
-
/* Change orientation */
|
179 |
-
/* $gf_pdf_config[] = array(
|
180 |
-
'form_id' =>
|
181 |
-
'attachments' => true,
|
182 |
-
|
183 |
-
'pdf_size' => 'letter',
|
184 |
-
'orientation' => 'landscape'
|
185 |
-
);*/
|
186 |
-
|
187 |
-
/*
|
188 |
-
* ------------------------------------------------------------
|
189 |
-
* PDF Security
|
190 |
-
* Allows you to password protect your PDF document, place a master password on the document which prevents document tampering and restricts user behaviour.
|
191 |
-
*
|
192 |
-
* security Boolean. Default false. If true the security settings will be applied.
|
193 |
-
* pdf_password String. Default blank.
|
194 |
-
* pdf_privileges Array
|
195 |
-
* Assign user privileges to the document. Valid privileges include: copy, print, modify, annot-forms, fill-forms, extract, assemble, print-highres
|
196 |
-
* pdf_master_password String. Default random generated. Set a master password on the PDF which stops the PDF from being modified.
|
197 |
-
* NOTE: As the document is encrypted in 128-bit print will only allow users to print a low resolution copy.
|
198 |
-
* Use print-highres to print full resolution image.
|
199 |
-
* NOTE: The use of print will only allow low-resolution printing from the document; you must specify print-highres to allow full resolution printing.
|
200 |
-
* NOTE: If pdf_master_password is omitted a random one will be generated
|
201 |
-
* NOTE: Passing a blank array or not passing anything to pdf_privileges will deny all permissions to the user
|
202 |
-
*/
|
203 |
-
|
204 |
-
/*
|
205 |
-
* Setting security settings with all values
|
206 |
-
*/
|
207 |
-
/*$gf_pdf_config[] = array(
|
208 |
-
'form_id' =>
|
209 |
-
'notifications' => true,
|
210 |
-
|
211 |
-
'security' => true,
|
212 |
-
'pdf_password' => 'myPDFpass',
|
213 |
-
'pdf_privileges' => array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres'),
|
214 |
-
'pdf_master_password' => 'admin password'
|
215 |
-
);*/
|
216 |
-
|
217 |
-
/*
|
218 |
-
* Set password to PDF.
|
219 |
-
* Deny all permissions to user
|
220 |
-
* Random master password will be generated
|
221 |
-
*/
|
222 |
-
/*$gf_pdf_config[] = array(
|
223 |
-
'form_id' =>
|
224 |
-
'notifications' => true,
|
225 |
-
|
226 |
-
'security' => true,
|
227 |
-
'pdf_password' => 'myPDFpass'
|
228 |
-
);*/
|
229 |
-
|
230 |
-
/*
|
231 |
-
* No password required to open PDF document.
|
232 |
-
* Deny all permissions to user
|
233 |
-
* Master password set
|
234 |
-
*/
|
235 |
-
/*$gf_pdf_config[] = array(
|
236 |
-
'form_id' =>
|
237 |
-
'notifications' => true,
|
238 |
-
|
239 |
-
'security' => true,
|
240 |
-
'pdf_master_password' => 'admin password'
|
241 |
-
);*/
|
242 |
-
|
243 |
-
/*
|
244 |
-
* No password required to open PDF document.
|
245 |
-
* User can copy, print and modify PDF
|
246 |
-
* Random master password will be generated
|
247 |
-
*
|
248 |
-
*/
|
249 |
-
/*$gf_pdf_config[] = array(
|
250 |
-
'form_id' =>
|
251 |
-
'notifications' => true,
|
252 |
-
|
253 |
-
'security' => true,
|
254 |
-
'pdf_privileges' => array('copy', 'print', 'modify', 'print-highres')
|
255 |
-
);*/
|
256 |
-
|
257 |
-
/*
|
258 |
-
* ------------------------------------------------------------
|
259 |
-
* Right to Left Language Support
|
260 |
-
* We now support RTL languages.
|
261 |
-
* rtl Boolean. Default false.
|
262 |
-
*/
|
263 |
-
/*$gf_pdf_config[] = array(
|
264 |
-
'form_id' =>
|
265 |
-
'notifications' => true,
|
266 |
-
|
267 |
-
'rtl' => true
|
268 |
-
);*/
|
269 |
-
|
270 |
-
/*
|
271 |
-
* ------------------------------------------------------------
|
272 |
-
* Disable Notifications
|
273 |
-
* If you don't need to send notifications and just want a custom PDF generated
|
274 |
-
* via the admin area you can forgo the notifications class
|
275 |
-
*/
|
276 |
-
/*$gf_pdf_config[] = array(
|
277 |
-
'form_id' =>
|
278 |
-
'template' => 'example-template.php'
|
279 |
-
);*/
|
280 |
-
|
281 |
-
/* ---------------------------------------------------------------
|
282 |
-
* CUSTOM PDF SETUP BELOW.
|
283 |
-
* See http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#constants for more details
|
284 |
-
*/
|
285 |
-
|
286 |
-
/*
|
287 |
-
* By default, forms that don't have PDFs assigned through the above configuration
|
288 |
-
* will automatically use the default template in the admin area.
|
289 |
-
* Set to false to disable this feature.
|
290 |
-
*/
|
291 |
-
define('GFPDF_SET_DEFAULT_TEMPLATE', true);
|
292 |
-
|
293 |
-
/*
|
294 |
-
* MEMORY ISSUES?
|
295 |
-
* Try setting the options below to true to help reduce the memory footprint of the package.
|
296 |
-
*/
|
297 |
-
define('PDF_ENABLE_MPDF_LITE', false); /* strip out advanced features like advanced table borders, terms and conditions, columns, index, bookmarks and barcodes. */
|
298 |
-
define('PDF_ENABLE_MPDF_TINY', false); /* if your tried the lite version and are still having trouble the tiny version includes the bare minimum features. There's no positioning, float, watermark or form support */
|
299 |
-
define('PDF_DISABLE_FONT_SUBSTITUTION', false); /* reduced memory by stopping font substitution */
|
300 |
define('PDF_ENABLE_SIMPLE_TABLES', false); /* disable the advanced table feature and forces all cells to have the same border, background etc. */
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Gravity Forms PDF Extended Configuration
|
5 |
+
* New from v3.0.0. No longer is theme functions.php code required.
|
6 |
+
* Important documentation on the configuration found at http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/
|
7 |
+
*/
|
8 |
+
|
9 |
+
/*
|
10 |
+
* Added in v3.1.0
|
11 |
+
* Users can now assign defaults to forms that aren't configured below.
|
12 |
+
* Note: this will only work if the configuration option GFPDF_SET_DEFAULT_TEMPLATE is set to true (located at the bottom of this file).
|
13 |
+
*
|
14 |
+
* Users can use any configuration option like you would for a singular form, including:
|
15 |
+
* notifications, template, filename, pdf_size, orientation, security and rtl
|
16 |
+
*/
|
17 |
+
global $gf_pdf_default_configuration;
|
18 |
+
|
19 |
+
$gf_pdf_default_configuration = array(
|
20 |
+
'template' => 'default-template.php',
|
21 |
+
'pdf_size' => 'A4'
|
22 |
+
);
|
23 |
+
|
24 |
+
/*
|
25 |
+
* ------------------------------------------------------------
|
26 |
+
* Bare minimum configuration code
|
27 |
+
* Usage: Will generate PDF and send to all notifications
|
28 |
+
* Remove the comments around the code blocks below to use (/*)
|
29 |
+
* form_id Mixed - Integer or Array. Required. The Gravity Form ID you are assigning the PDF to.
|
30 |
+
* notifications Mixed - String, Boolean or Array.
|
31 |
+
*/
|
32 |
+
/*$gf_pdf_config[] = array(
|
33 |
+
'form_id' => 1,
|
34 |
+
'notifications' => true
|
35 |
+
);*/
|
36 |
+
|
37 |
+
/*
|
38 |
+
* ------------------------------------------------------------
|
39 |
+
* Default template specific configuration code
|
40 |
+
* As of 3.1.0 uses can now add default-show-html, default-show-empty and default-show-page-names when using any
|
41 |
+
* of the default template files (any template prepended with default-)
|
42 |
+
*
|
43 |
+
* Usage:
|
44 |
+
* 'default-show-html' - This option will display HTMl blocks in your default tempalte.
|
45 |
+
* 'default-show-empty' - All form fields will be displayed in the PDF, regardless of what the user input is.
|
46 |
+
* 'default-show-page-names' - If you are using page breaks you can display the page names in the PDF.
|
47 |
+
*
|
48 |
+
* Remove the comments around the code blocks below to use (/*)
|
49 |
+
*/
|
50 |
+
|
51 |
+
/*$gf_pdf_config[] = array(
|
52 |
+
'form_id' => 1,
|
53 |
+
'template' => 'default-template.php',
|
54 |
+
'default-show-html' => true
|
55 |
+
);*/
|
56 |
+
|
57 |
+
/*$gf_pdf_config[] = array(
|
58 |
+
'form_id' => 1,
|
59 |
+
'template' => 'default-template.php',
|
60 |
+
'default-show-empty' => true
|
61 |
+
);*/
|
62 |
+
|
63 |
+
/*$gf_pdf_config[] = array(
|
64 |
+
'form_id' => 1,
|
65 |
+
'template' => 'default-template.php',
|
66 |
+
'default-show-page-names' => true
|
67 |
+
);*/
|
68 |
+
|
69 |
+
/*$gf_pdf_config[] = array(
|
70 |
+
'form_id' => 1,
|
71 |
+
'template' => 'default-template.php',
|
72 |
+
'default-show-html' => true,
|
73 |
+
'default-show-empty' => true,
|
74 |
+
'default-show-page-names' => true
|
75 |
+
);*/
|
76 |
+
|
77 |
+
/*
|
78 |
+
* ------------------------------------------------------------
|
79 |
+
* Notification Options
|
80 |
+
* notifications Mixed - String, Boolean or Array.
|
81 |
+
* Notifications can be a string like 'Admin Notifications', an array with multiple notification names or true to send to all.
|
82 |
+
*/
|
83 |
+
/*$gf_pdf_config[] = array(
|
84 |
+
'form_id' => 1,
|
85 |
+
'notifications' => 'Admin Notification'
|
86 |
+
);*/
|
87 |
+
|
88 |
+
/*$gf_pdf_config[] = array(
|
89 |
+
'form_id' => '1',
|
90 |
+
'notifications' => array('Admin Notification', 'User Notification')
|
91 |
+
);*/
|
92 |
+
|
93 |
+
/*
|
94 |
+
* ------------------------------------------------------------
|
95 |
+
* Custom Template
|
96 |
+
* Don't want to use a custom template? Just pass the custom template name to the configuration.
|
97 |
+
* template String. Default default-template.php. The name of your custom template that's placed in your active theme's PDF_EXTENDED_TEMPLATES folder.
|
98 |
+
* For more information about creating custom templates please see http://gravityformspdfextended.com/documentation-v3-x-x/templates/
|
99 |
+
*/
|
100 |
+
/*$gf_pdf_config[] = array(
|
101 |
+
'form_id' => 1,
|
102 |
+
'notifications' => 'User Notification',
|
103 |
+
|
104 |
+
'template' => 'example-float-and-positioning05.php'
|
105 |
+
);*/
|
106 |
+
|
107 |
+
/*$gf_pdf_config[] = array(
|
108 |
+
'form_id' => 2,
|
109 |
+
'notifications' => 'User Notification',
|
110 |
+
|
111 |
+
'template' => 'example-basic-html01.php'
|
112 |
+
);*/
|
113 |
+
|
114 |
+
/*
|
115 |
+
* ------------------------------------------------------------
|
116 |
+
* Multiple Forms
|
117 |
+
* If you have multiple forms that use the same PDF template then you can pass the form_id through as an array.
|
118 |
+
* WARNING: If using a custom template with this option your secondary forms should be a duplicate of the original and you shouldn't delete the fields
|
119 |
+
* otherwise the custom template won't show correctly.
|
120 |
+
* WARNING: The previous warning also applies to custom PDF names with MERGETAGS
|
121 |
+
*/
|
122 |
+
/*$gf_pdf_config[] = array(
|
123 |
+
'form_id' => array(1,5,6),
|
124 |
+
'notifications' => true
|
125 |
+
);*/
|
126 |
+
|
127 |
+
/*
|
128 |
+
* ------------------------------------------------------------
|
129 |
+
* Custom File Name
|
130 |
+
* Will change the filename of the PDF which is attached
|
131 |
+
* As of v3.0.0 merge tags can be used in the file name
|
132 |
+
* filename String. Default form-{form_id}-entry-{entry_id}.pdf
|
133 |
+
*/
|
134 |
+
/*$gf_pdf_config[] = array(
|
135 |
+
'form_id' => 1,
|
136 |
+
'notifications' => true,
|
137 |
+
'filename' => 'New PDF Name.pdf'
|
138 |
+
);*/
|
139 |
+
|
140 |
+
/*$gf_pdf_config[] = array(
|
141 |
+
'form_id' => '1',
|
142 |
+
'notifications' => true,
|
143 |
+
'filename' => 'User {Name:1}.pdf'
|
144 |
+
);*/
|
145 |
+
|
146 |
+
/*
|
147 |
+
* ------------------------------------------------------------
|
148 |
+
* Custom PDF Size / Orientation
|
149 |
+
* PDF Size can be set to the following:
|
150 |
+
*
|
151 |
+
* A0 - A10, B0 - B10, C0 - C10
|
152 |
+
* 4A0, 2A0, RA0 - RA4, SRA0 - SRA4
|
153 |
+
* Letter, Legal, Executive, Folio
|
154 |
+
* Demy, Royal
|
155 |
+
*
|
156 |
+
* Default: A4
|
157 |
+
* You can also pass the PDF size as an array, represented in millimetres - array(width, height).
|
158 |
+
*
|
159 |
+
* NOTE: By default the orientation is portrait so you only need to add it for landscape PDFs
|
160 |
+
*/
|
161 |
+
|
162 |
+
/* Letter-sized Document */
|
163 |
+
/*$gf_pdf_config[] = array(
|
164 |
+
'form_id' => 1,
|
165 |
+
'attachments' => true,
|
166 |
+
|
167 |
+
'pdf_size' => 'letter'
|
168 |
+
);*/
|
169 |
+
|
170 |
+
/* Custom PDF Size */
|
171 |
+
/* $gf_pdf_config[] = array(
|
172 |
+
'form_id' => 1,
|
173 |
+
'attachments' => true,
|
174 |
+
|
175 |
+
'pdf_size' => array(50, 200)
|
176 |
+
);*/
|
177 |
+
|
178 |
+
/* Change orientation */
|
179 |
+
/* $gf_pdf_config[] = array(
|
180 |
+
'form_id' => 1,
|
181 |
+
'attachments' => true,
|
182 |
+
|
183 |
+
'pdf_size' => 'letter',
|
184 |
+
'orientation' => 'landscape'
|
185 |
+
);*/
|
186 |
+
|
187 |
+
/*
|
188 |
+
* ------------------------------------------------------------
|
189 |
+
* PDF Security
|
190 |
+
* Allows you to password protect your PDF document, place a master password on the document which prevents document tampering and restricts user behaviour.
|
191 |
+
*
|
192 |
+
* security Boolean. Default false. If true the security settings will be applied.
|
193 |
+
* pdf_password String. Default blank.
|
194 |
+
* pdf_privileges Array
|
195 |
+
* Assign user privileges to the document. Valid privileges include: copy, print, modify, annot-forms, fill-forms, extract, assemble, print-highres
|
196 |
+
* pdf_master_password String. Default random generated. Set a master password on the PDF which stops the PDF from being modified.
|
197 |
+
* NOTE: As the document is encrypted in 128-bit print will only allow users to print a low resolution copy.
|
198 |
+
* Use print-highres to print full resolution image.
|
199 |
+
* NOTE: The use of print will only allow low-resolution printing from the document; you must specify print-highres to allow full resolution printing.
|
200 |
+
* NOTE: If pdf_master_password is omitted a random one will be generated
|
201 |
+
* NOTE: Passing a blank array or not passing anything to pdf_privileges will deny all permissions to the user
|
202 |
+
*/
|
203 |
+
|
204 |
+
/*
|
205 |
+
* Setting security settings with all values
|
206 |
+
*/
|
207 |
+
/*$gf_pdf_config[] = array(
|
208 |
+
'form_id' => 1,
|
209 |
+
'notifications' => true,
|
210 |
+
|
211 |
+
'security' => true,
|
212 |
+
'pdf_password' => 'myPDFpass',
|
213 |
+
'pdf_privileges' => array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres'),
|
214 |
+
'pdf_master_password' => 'admin password'
|
215 |
+
);*/
|
216 |
+
|
217 |
+
/*
|
218 |
+
* Set password to PDF.
|
219 |
+
* Deny all permissions to user
|
220 |
+
* Random master password will be generated
|
221 |
+
*/
|
222 |
+
/*$gf_pdf_config[] = array(
|
223 |
+
'form_id' => 1,
|
224 |
+
'notifications' => true,
|
225 |
+
|
226 |
+
'security' => true,
|
227 |
+
'pdf_password' => 'myPDFpass'
|
228 |
+
);*/
|
229 |
+
|
230 |
+
/*
|
231 |
+
* No password required to open PDF document.
|
232 |
+
* Deny all permissions to user
|
233 |
+
* Master password set
|
234 |
+
*/
|
235 |
+
/*$gf_pdf_config[] = array(
|
236 |
+
'form_id' => 1,
|
237 |
+
'notifications' => true,
|
238 |
+
|
239 |
+
'security' => true,
|
240 |
+
'pdf_master_password' => 'admin password'
|
241 |
+
);*/
|
242 |
+
|
243 |
+
/*
|
244 |
+
* No password required to open PDF document.
|
245 |
+
* User can copy, print and modify PDF
|
246 |
+
* Random master password will be generated
|
247 |
+
*
|
248 |
+
*/
|
249 |
+
/*$gf_pdf_config[] = array(
|
250 |
+
'form_id' => 1,
|
251 |
+
'notifications' => true,
|
252 |
+
|
253 |
+
'security' => true,
|
254 |
+
'pdf_privileges' => array('copy', 'print', 'modify', 'print-highres')
|
255 |
+
);*/
|
256 |
+
|
257 |
+
/*
|
258 |
+
* ------------------------------------------------------------
|
259 |
+
* Right to Left Language Support
|
260 |
+
* We now support RTL languages.
|
261 |
+
* rtl Boolean. Default false.
|
262 |
+
*/
|
263 |
+
/*$gf_pdf_config[] = array(
|
264 |
+
'form_id' => 1,
|
265 |
+
'notifications' => true,
|
266 |
+
|
267 |
+
'rtl' => true
|
268 |
+
);*/
|
269 |
+
|
270 |
+
/*
|
271 |
+
* ------------------------------------------------------------
|
272 |
+
* Disable Notifications
|
273 |
+
* If you don't need to send notifications and just want a custom PDF generated
|
274 |
+
* via the admin area you can forgo the notifications class
|
275 |
+
*/
|
276 |
+
/*$gf_pdf_config[] = array(
|
277 |
+
'form_id' => 1,
|
278 |
+
'template' => 'example-template.php'
|
279 |
+
);*/
|
280 |
+
|
281 |
+
/* ---------------------------------------------------------------
|
282 |
+
* CUSTOM PDF SETUP BELOW.
|
283 |
+
* See http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/#constants for more details
|
284 |
+
*/
|
285 |
+
|
286 |
+
/*
|
287 |
+
* By default, forms that don't have PDFs assigned through the above configuration
|
288 |
+
* will automatically use the default template in the admin area.
|
289 |
+
* Set to false to disable this feature.
|
290 |
+
*/
|
291 |
+
define('GFPDF_SET_DEFAULT_TEMPLATE', true);
|
292 |
+
|
293 |
+
/*
|
294 |
+
* MEMORY ISSUES?
|
295 |
+
* Try setting the options below to true to help reduce the memory footprint of the package.
|
296 |
+
*/
|
297 |
+
define('PDF_ENABLE_MPDF_LITE', false); /* strip out advanced features like advanced table borders, terms and conditions, columns, index, bookmarks and barcodes. */
|
298 |
+
define('PDF_ENABLE_MPDF_TINY', false); /* if your tried the lite version and are still having trouble the tiny version includes the bare minimum features. There's no positioning, float, watermark or form support */
|
299 |
+
define('PDF_DISABLE_FONT_SUBSTITUTION', false); /* reduced memory by stopping font substitution */
|
300 |
define('PDF_ENABLE_SIMPLE_TABLES', false); /* disable the advanced table feature and forces all cells to have the same border, background etc. */
|
installation-update-manager.php
CHANGED
@@ -1,668 +1,668 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity Forms PDF Extended
|
5 |
-
* File: install-update-manager.php
|
6 |
-
*
|
7 |
-
* This file handles the installation and update code that ensures the plugin will be supported.
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Check to see if Gravity Forms version is supported
|
12 |
-
*/
|
13 |
-
|
14 |
-
class GFPDF_InstallUpdater
|
15 |
-
{
|
16 |
-
public function install()
|
17 |
-
{
|
18 |
-
if(strlen(get_option('gf_pdf_extended_installed')) == 0)
|
19 |
-
{
|
20 |
-
update_option('gf_pdf_extended_version', PDF_EXTENDED_VERSION);
|
21 |
-
update_option('gf_pdf_extended_deploy', 'yes');
|
22 |
-
|
23 |
-
self::pdf_extended_activate();
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Install everything required
|
30 |
-
*/
|
31 |
-
public function pdf_extended_activate()
|
32 |
-
{
|
33 |
-
/*
|
34 |
-
* Initialise the Wordpress Filesystem API
|
35 |
-
*/
|
36 |
-
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
37 |
-
{
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
|
41 |
-
/*
|
42 |
-
* If we got here we should have $wp_filesystem available
|
43 |
-
*/
|
44 |
-
global $wp_filesystem;
|
45 |
-
|
46 |
-
/*
|
47 |
-
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
48 |
-
* Most notably is the FTP options, but SSH may be effected too
|
49 |
-
*/
|
50 |
-
$directory = PDF_PLUGIN_DIR;
|
51 |
-
$template_directory = PDF_TEMPLATE_LOCATION;
|
52 |
-
$template_save_directory = PDF_SAVE_LOCATION;
|
53 |
-
$template_font_directory = PDF_FONT_LOCATION;
|
54 |
-
|
55 |
-
|
56 |
-
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
57 |
-
{
|
58 |
-
/*
|
59 |
-
* Assume FTP is rooted to the Wordpress install
|
60 |
-
*/
|
61 |
-
$base_directory = self::get_base_directory();
|
62 |
-
|
63 |
-
$directory = str_replace(ABSPATH, $base_directory, $directory);
|
64 |
-
$template_directory = str_replace(ABSPATH, $base_directory, $template_directory);
|
65 |
-
$template_save_directory = str_replace(ABSPATH, $base_directory, $template_save_directory);
|
66 |
-
$template_font_directory = str_replace(ABSPATH, $base_directory, $template_font_directory);
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* If PDF_TEMPLATE_LOCATION already exists then we will remove the old template files so we can redeploy the new ones
|
72 |
-
*/
|
73 |
-
|
74 |
-
if(PDF_DEPLOY === true && $wp_filesystem->exists($template_directory))
|
75 |
-
{
|
76 |
-
/* read all file names into array and unlink from active theme template folder */
|
77 |
-
foreach(glob($directory.'templates/*.php') as $file) {
|
78 |
-
$path_parts = pathinfo($file);
|
79 |
-
if($wp_filesystem->exists($template_directory.$path_parts['basename']))
|
80 |
-
{
|
81 |
-
$wp_filesystem->delete($template_directory.$path_parts['basename']);
|
82 |
-
}
|
83 |
-
}
|
84 |
-
if($wp_filesystem->exists($template_directory.'template.css')) { $wp_filesystem->delete($template_directory.'template.css'); }
|
85 |
-
}
|
86 |
-
|
87 |
-
|
88 |
-
/* unzip the mPDF file */
|
89 |
-
if($wp_filesystem->exists($directory . 'mPDF.zip'))
|
90 |
-
{
|
91 |
-
/*
|
92 |
-
* The only function that requires the input to be the full path and the export to be the directory used in $wp_filesystem
|
93 |
-
*/
|
94 |
-
$results = unzip_file( PDF_PLUGIN_DIR . 'mPDF.zip', $directory );
|
95 |
-
|
96 |
-
if($results !== true)
|
97 |
-
{
|
98 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_unzip_mpdf_err"));
|
99 |
-
return 'fail';
|
100 |
-
}
|
101 |
-
|
102 |
-
/*
|
103 |
-
* Remove the original archive
|
104 |
-
*/
|
105 |
-
$wp_filesystem->delete($directory . 'mPDF.zip');
|
106 |
-
}
|
107 |
-
|
108 |
-
/* create new directory in active themes folder*/
|
109 |
-
if(!$wp_filesystem->is_dir($template_directory))
|
110 |
-
{
|
111 |
-
if($wp_filesystem->mkdir($template_directory) === false)
|
112 |
-
{
|
113 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
114 |
-
return 'fail';
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
if(!$wp_filesystem->is_dir($template_save_directory))
|
119 |
-
{
|
120 |
-
/* create new directory in active themes folder*/
|
121 |
-
if($wp_filesystem->mkdir($template_save_directory) === false)
|
122 |
-
{
|
123 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
124 |
-
return 'fail';
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
if(!$wp_filesystem->is_dir($template_font_directory))
|
129 |
-
{
|
130 |
-
/* create new directory in active themes folder*/
|
131 |
-
if($wp_filesystem->mkdir($template_font_directory) === false)
|
132 |
-
{
|
133 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
134 |
-
return 'fail';
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
/*
|
139 |
-
* Copy entire template folder over to PDF_TEMPLATE_LOCATION
|
140 |
-
*/
|
141 |
-
self::pdf_extended_copy_directory( $directory . 'templates', $template_directory, false );
|
142 |
-
|
143 |
-
if(!$wp_filesystem->exists($template_directory .'configuration.php'))
|
144 |
-
{
|
145 |
-
/* copy template files to new directory */
|
146 |
-
if(!$wp_filesystem->copy($directory .'configuration.php', $template_directory.'configuration.php'))
|
147 |
-
{
|
148 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
149 |
-
return 'fail';
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
if(!$wp_filesystem->exists($template_directory.'template.css'))
|
154 |
-
{
|
155 |
-
/* copy template files to new directory */
|
156 |
-
if(!$wp_filesystem->copy($directory .'styles/template.css', $template_directory.'template.css'))
|
157 |
-
{
|
158 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
159 |
-
return 'fail';
|
160 |
-
}
|
161 |
-
}
|
162 |
-
|
163 |
-
if(!$wp_filesystem->exists($template_save_directory.'.htaccess'))
|
164 |
-
{
|
165 |
-
if(!$wp_filesystem->put_contents($template_save_directory.'.htaccess', 'deny from all'))
|
166 |
-
{
|
167 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
168 |
-
return 'fail';
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
if(self::install_fonts($directory, $template_directory, $template_font_directory) !== true)
|
173 |
-
{
|
174 |
-
return 'fail';
|
175 |
-
}
|
176 |
-
|
177 |
-
/*
|
178 |
-
* Update system to ensure everything is installed correctly.
|
179 |
-
*/
|
180 |
-
|
181 |
-
update_option('gf_pdf_extended_installed', 'installed');
|
182 |
-
update_option('gf_pdf_extended_deploy', 'yes');
|
183 |
-
delete_option('gfpdfe_switch_theme');
|
184 |
-
|
185 |
-
return true;
|
186 |
-
}
|
187 |
-
|
188 |
-
public static function initialise_fonts()
|
189 |
-
{
|
190 |
-
/*
|
191 |
-
* Initialise the Wordpress Filesystem API
|
192 |
-
*/
|
193 |
-
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
194 |
-
{
|
195 |
-
return false;
|
196 |
-
}
|
197 |
-
|
198 |
-
/*
|
199 |
-
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
200 |
-
* Most notably is the FTP options, but SSH may be effected too
|
201 |
-
*/
|
202 |
-
$directory = PDF_PLUGIN_DIR;
|
203 |
-
$template_directory = PDF_TEMPLATE_LOCATION;
|
204 |
-
$template_font_directory = PDF_FONT_LOCATION;
|
205 |
-
|
206 |
-
|
207 |
-
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
208 |
-
{
|
209 |
-
/*
|
210 |
-
* Assume FTP is rooted to the Wordpress install
|
211 |
-
*/
|
212 |
-
$base_directory = self::get_base_directory();
|
213 |
-
|
214 |
-
$directory = str_replace(ABSPATH, $base_directory, $directory);
|
215 |
-
$template_directory = str_replace(ABSPATH, $base_directory, $template_directory);
|
216 |
-
$template_font_directory = str_replace(ABSPATH, $base_directory, $template_font_directory);
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
if(self::install_fonts($directory, $template_directory, $template_font_directory) === true)
|
221 |
-
{
|
222 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_install_success"));
|
223 |
-
}
|
224 |
-
return true;
|
225 |
-
}
|
226 |
-
|
227 |
-
private static function install_fonts($directory, $template_directory, $fonts_location)
|
228 |
-
{
|
229 |
-
|
230 |
-
global $wp_filesystem;
|
231 |
-
$write_to_file = '<?php
|
232 |
-
|
233 |
-
if(!defined("PDF_EXTENDED_VERSION"))
|
234 |
-
{
|
235 |
-
return;
|
236 |
-
}
|
237 |
-
|
238 |
-
';
|
239 |
-
|
240 |
-
/*
|
241 |
-
* Search the font folder for .ttf files. If found, move them to the mPDF font folder
|
242 |
-
* and write the configuration file
|
243 |
-
*/
|
244 |
-
|
245 |
-
/* read all file names into array and unlink from active theme template folder */
|
246 |
-
foreach(glob($fonts_location.'/*.[tT][tT][fF]') as $file) {
|
247 |
-
|
248 |
-
$path_parts = pathinfo($file);
|
249 |
-
|
250 |
-
/*
|
251 |
-
* Check if the files already exist in the mPDF font folder
|
252 |
-
*/
|
253 |
-
if(!$wp_filesystem->exists($directory . 'mPDF/ttfonts/' . $path_parts['basename']))
|
254 |
-
{
|
255 |
-
/*
|
256 |
-
* copy ttf file to the mPDF font folder
|
257 |
-
*/
|
258 |
-
if($wp_filesystem->copy($file, $directory . 'mPDF/ttfonts/' . $path_parts['basename']) === false)
|
259 |
-
{
|
260 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_err"));
|
261 |
-
return false;
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
/*
|
266 |
-
* Generate configuration information in preparation to write to file
|
267 |
-
*/
|
268 |
-
$write_to_file .= '
|
269 |
-
$this->fontdata[\''.$path_parts['filename'].'\'] = array(
|
270 |
-
\'R\' => \''.$path_parts['basename'].'\'
|
271 |
-
);';
|
272 |
-
|
273 |
-
}
|
274 |
-
|
275 |
-
/*
|
276 |
-
* Remove the old configuration file and put the contents of $write_to_file in a font configuration file
|
277 |
-
*/
|
278 |
-
$wp_filesystem->delete($template_directory.'fonts/config.php');
|
279 |
-
if($wp_filesystem->put_contents($template_directory.'fonts/config.php', $write_to_file) === false)
|
280 |
-
{
|
281 |
-
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_config_err"));
|
282 |
-
return false;
|
283 |
-
}
|
284 |
-
|
285 |
-
return true;
|
286 |
-
}
|
287 |
-
|
288 |
-
public function gf_pdf_font_install_success()
|
289 |
-
{
|
290 |
-
echo '<div id="message" class="updated"><p>';
|
291 |
-
echo 'The font files have been successfully installed. A font can be used by adding it\'s file name (without .ttf) in a CSS font-family declaration.';
|
292 |
-
echo '</p></div>';
|
293 |
-
}
|
294 |
-
|
295 |
-
public function gf_pdf_font_err()
|
296 |
-
{
|
297 |
-
echo '<div id="message" class="error"><p>';
|
298 |
-
echo 'There was a problem installing the font files. Manually copy your fonts to the mPDF/ttfonts/ folder.';
|
299 |
-
echo '</p></div>';
|
300 |
-
}
|
301 |
-
|
302 |
-
public function gf_pdf_font_config_err()
|
303 |
-
{
|
304 |
-
echo '<div id="message" class="error"><p>';
|
305 |
-
echo 'Could not create font configuration file. Try initialise again.';
|
306 |
-
echo '</p></div>';
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Gravity Forms hasn't been installed so throw error.
|
311 |
-
* We make sure the user hasn't already dismissed the error
|
312 |
-
*/
|
313 |
-
public function gf_pdf_not_installed()
|
314 |
-
{
|
315 |
-
echo '<div id="message" class="error"><p>';
|
316 |
-
echo 'You need to install <a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">Gravity Forms</a> to use the Gravity Forms PDF Extended Plugin.';
|
317 |
-
echo '</p></div>';
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* PDF Extended has been updated but the new template files haven't been deployed yet
|
322 |
-
*/
|
323 |
-
public function gf_pdf_not_deployed()
|
324 |
-
{
|
325 |
-
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
326 |
-
{
|
327 |
-
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
328 |
-
{
|
329 |
-
echo '<div id="message" class="error"><p>';
|
330 |
-
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. After initialising, please review the latest updates to ensure your custom templates remain compatible with the latest version.';
|
331 |
-
echo '</p></div>';
|
332 |
-
|
333 |
-
}
|
334 |
-
else
|
335 |
-
{
|
336 |
-
echo '<div id="message" class="error"><p>';
|
337 |
-
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
338 |
-
echo '</p></div>';
|
339 |
-
}
|
340 |
-
}
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* PDF Extended has been freshly installed
|
345 |
-
*/
|
346 |
-
public function gf_pdf_not_deployed_fresh()
|
347 |
-
{
|
348 |
-
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
349 |
-
{
|
350 |
-
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
351 |
-
{
|
352 |
-
echo '<div id="message" class="updated"><p>';
|
353 |
-
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it.';
|
354 |
-
echo '</p></div>';
|
355 |
-
|
356 |
-
}
|
357 |
-
else
|
358 |
-
{
|
359 |
-
echo '<div id="message" class="updated"><p>';
|
360 |
-
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
361 |
-
echo '</p></div>';
|
362 |
-
}
|
363 |
-
}
|
364 |
-
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* The Gravity Forms version isn't compatible. Prompt user to upgrade
|
368 |
-
*/
|
369 |
-
public function gf_pdf_not_supported()
|
370 |
-
{
|
371 |
-
echo '<div id="message" class="error"><p>';
|
372 |
-
echo 'Gravity Forms PDF Extended only works with Gravity Forms version '.GF_PDF_EXTENDED_SUPPORTED_VERSION.' and higher. Please <a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">upgrade your copy of Gravity Forms</a> to use this plugin.';
|
373 |
-
echo '</p></div>';
|
374 |
-
}
|
375 |
-
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Cannot create new template folder in active theme directory
|
379 |
-
*/
|
380 |
-
public function gf_pdf_template_dir_err()
|
381 |
-
{
|
382 |
-
echo '<div id="message" class="error"><p>';
|
383 |
-
echo 'We could not create a template folder in your active theme\'s directory. Please created a folder called <strong>\''. PDF_SAVE_FOLDER .'\'</strong> in '.get_stylesheet_directory().'/. Then copy the contents of '.PDF_PLUGIN_DIR.'templates/ to your newly-created PDF_EXTENDED_TEMPLATES folder, as well as styles/template.css. You should also make this directory writable.';
|
384 |
-
echo '</p></div>';
|
385 |
-
|
386 |
-
}
|
387 |
-
|
388 |
-
public static function gf_pdf_unzip_mpdf_err()
|
389 |
-
{
|
390 |
-
echo '<div id="message" class="error"><p>';
|
391 |
-
echo 'Could not unzip mPDF.zip (located in the plugin folder). Unzip the file manually, place the extracted mPDF folder in the plugin folder and run the initialisation again.';
|
392 |
-
echo '</p></div>';
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Cannot remove old default template files
|
397 |
-
*/
|
398 |
-
public function gf_pdf_deployment_unlink_error()
|
399 |
-
{
|
400 |
-
echo '<div id="message" class="error"><p>';
|
401 |
-
echo 'We could not remove the default template files from the Gravity Forms PDF Extended folder in your active theme\'s directory. Please manually remove all files starting with \'default-\' and the template.css file.';
|
402 |
-
echo '</p></div>';
|
403 |
-
|
404 |
-
}
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Cannot create new template folder in active theme directory
|
408 |
-
*/
|
409 |
-
public function gf_pdf_template_move_err()
|
410 |
-
{
|
411 |
-
echo '<div id="message" class="error"><p>';
|
412 |
-
echo 'We could not copy the contents of '.PDF_PLUGIN_DIR.'templates/ to your newly-created PDF_EXTENDED_TEMPLATES folder. Please manually copy the files to the aforementioned directory..';
|
413 |
-
echo '</p></div>';
|
414 |
-
|
415 |
-
}
|
416 |
-
|
417 |
-
/*
|
418 |
-
* When switching themes copy over current active theme's PDF_EXTENDED_TEMPLATES (if it exists) to new theme folder
|
419 |
-
*/
|
420 |
-
public function gf_pdf_on_switch_theme($old_theme_name, $old_theme_object) {
|
421 |
-
|
422 |
-
/*
|
423 |
-
* We will store the old pdf dir and new pdf directory and prompt the user to copy the PDF_EXTENDED_TEMPLATES folder
|
424 |
-
*/
|
425 |
-
$previous_theme_directory = $old_theme_object->get_stylesheet_directory();
|
426 |
-
|
427 |
-
$current_theme_array = wp_get_theme();
|
428 |
-
$current_theme_directory = $current_theme_array->get_stylesheet_directory();
|
429 |
-
|
430 |
-
/*
|
431 |
-
* Add the save folder name to the end of the paths
|
432 |
-
*/
|
433 |
-
$old_pdf_path = $previous_theme_directory . '/' . PDF_SAVE_FOLDER;
|
434 |
-
$new_pdf_path = $current_theme_directory . '/' . PDF_SAVE_FOLDER;
|
435 |
-
|
436 |
-
update_option('gfpdfe_switch_theme', array('old' => $old_pdf_path, 'new' => $new_pdf_path));
|
437 |
-
}
|
438 |
-
|
439 |
-
/*
|
440 |
-
* Check if a theme switch has been made recently
|
441 |
-
* If it has then prompt the user to move the files
|
442 |
-
*/
|
443 |
-
public static function check_theme_switch()
|
444 |
-
{
|
445 |
-
$theme_switch = get_option('gfpdfe_switch_theme');
|
446 |
-
if(isset($theme_switch['old']) && isset($theme_switch['new']))
|
447 |
-
{
|
448 |
-
/*
|
449 |
-
* Add admin notification hook to move the files
|
450 |
-
*/
|
451 |
-
add_action('admin_notices', array("GFPDF_InstallUpdater", "do_theme_switch_notice"));
|
452 |
-
return true;
|
453 |
-
}
|
454 |
-
return false;
|
455 |
-
}
|
456 |
-
|
457 |
-
/*
|
458 |
-
* Prompt user to keep the plugin working
|
459 |
-
*/
|
460 |
-
public static function do_theme_switch_notice()
|
461 |
-
{
|
462 |
-
/*
|
463 |
-
* Check we aren't in the middle of doing the sync
|
464 |
-
*/
|
465 |
-
if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_sync_now'))
|
466 |
-
{
|
467 |
-
return;
|
468 |
-
}
|
469 |
-
|
470 |
-
echo '<div id="message" class="error"><p>';
|
471 |
-
echo 'Gravity Forms PDF Extended needs to keep the PDF_EXTENDED_TEMPLATE folder in sync with your current active theme. <a href="'. wp_nonce_url(PDF_SETTINGS_URL, 'gfpdfe_sync_now') . '" class="button">Sync Now</a>';
|
472 |
-
echo '</p></div>';
|
473 |
-
|
474 |
-
}
|
475 |
-
|
476 |
-
public static function gf_pdf_theme_sync_success()
|
477 |
-
{
|
478 |
-
echo '<div id="message" class="updated"><p>';
|
479 |
-
echo 'PDF_EXTENDED_TEMPLATE folder successfully synced.';
|
480 |
-
echo '</p></div>';
|
481 |
-
}
|
482 |
-
|
483 |
-
/*
|
484 |
-
* The after_switch_theme hook is too early in the initialisation to use request_filesystem_credentials()
|
485 |
-
* so we have to call this function at a later inteval
|
486 |
-
*/
|
487 |
-
public function do_theme_switch($previous_pdf_path, $current_pdf_path)
|
488 |
-
{
|
489 |
-
/*
|
490 |
-
* Prepare for calling the WP Filesystem
|
491 |
-
* It only allows post data to be added so we have to manually assign them
|
492 |
-
*/
|
493 |
-
$_POST['previous_pdf_path'] = $previous_pdf_path;
|
494 |
-
$_POST['current_pdf_path'] = $current_pdf_path;
|
495 |
-
|
496 |
-
/*
|
497 |
-
* Initialise the Wordpress Filesystem API
|
498 |
-
*/
|
499 |
-
if(PDF_Common::initialise_WP_filesystem_API(array('previous_pdf_path', 'current_pdf_path'), 'gfpdfe_sync_now') === false)
|
500 |
-
{
|
501 |
-
return false;
|
502 |
-
}
|
503 |
-
|
504 |
-
/*
|
505 |
-
* If we got here we should have $wp_filesystem available
|
506 |
-
*/
|
507 |
-
global $wp_filesystem;
|
508 |
-
|
509 |
-
/*
|
510 |
-
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
511 |
-
* Most notably is the FTP options, but SSH may be effected too
|
512 |
-
*/
|
513 |
-
|
514 |
-
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
515 |
-
{
|
516 |
-
/*
|
517 |
-
* Assume FTP is rooted to the Wordpress install
|
518 |
-
*/
|
519 |
-
$base_directory = self::get_base_directory();
|
520 |
|
521 |
-
$
|
522 |
-
$
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
}
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
$
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin: Gravity Forms PDF Extended
|
5 |
+
* File: install-update-manager.php
|
6 |
+
*
|
7 |
+
* This file handles the installation and update code that ensures the plugin will be supported.
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Check to see if Gravity Forms version is supported
|
12 |
+
*/
|
13 |
+
|
14 |
+
class GFPDF_InstallUpdater
|
15 |
+
{
|
16 |
+
public function install()
|
17 |
+
{
|
18 |
+
if(strlen(get_option('gf_pdf_extended_installed')) == 0)
|
19 |
+
{
|
20 |
+
update_option('gf_pdf_extended_version', PDF_EXTENDED_VERSION);
|
21 |
+
update_option('gf_pdf_extended_deploy', 'yes');
|
22 |
+
|
23 |
+
self::pdf_extended_activate();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Install everything required
|
30 |
+
*/
|
31 |
+
public function pdf_extended_activate()
|
32 |
+
{
|
33 |
+
/*
|
34 |
+
* Initialise the Wordpress Filesystem API
|
35 |
+
*/
|
36 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
37 |
+
{
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* If we got here we should have $wp_filesystem available
|
43 |
+
*/
|
44 |
+
global $wp_filesystem;
|
45 |
+
|
46 |
+
/*
|
47 |
+
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
48 |
+
* Most notably is the FTP options, but SSH may be effected too
|
49 |
+
*/
|
50 |
+
$directory = PDF_PLUGIN_DIR;
|
51 |
+
$template_directory = PDF_TEMPLATE_LOCATION;
|
52 |
+
$template_save_directory = PDF_SAVE_LOCATION;
|
53 |
+
$template_font_directory = PDF_FONT_LOCATION;
|
54 |
+
|
55 |
+
|
56 |
+
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
57 |
+
{
|
58 |
+
/*
|
59 |
+
* Assume FTP is rooted to the Wordpress install
|
60 |
+
*/
|
61 |
+
$base_directory = self::get_base_directory();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
$directory = str_replace(ABSPATH, $base_directory, $directory);
|
64 |
+
$template_directory = str_replace(ABSPATH, $base_directory, $template_directory);
|
65 |
+
$template_save_directory = str_replace(ABSPATH, $base_directory, $template_save_directory);
|
66 |
+
$template_font_directory = str_replace(ABSPATH, $base_directory, $template_font_directory);
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* If PDF_TEMPLATE_LOCATION already exists then we will remove the old template files so we can redeploy the new ones
|
72 |
+
*/
|
73 |
+
|
74 |
+
if(PDF_DEPLOY === true && $wp_filesystem->exists($template_directory))
|
75 |
+
{
|
76 |
+
/* read all file names into array and unlink from active theme template folder */
|
77 |
+
foreach(glob($directory.'templates/*.php') as $file) {
|
78 |
+
$path_parts = pathinfo($file);
|
79 |
+
if($wp_filesystem->exists($template_directory.$path_parts['basename']))
|
80 |
+
{
|
81 |
+
$wp_filesystem->delete($template_directory.$path_parts['basename']);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
if($wp_filesystem->exists($template_directory.'template.css')) { $wp_filesystem->delete($template_directory.'template.css'); }
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/* unzip the mPDF file */
|
89 |
+
if($wp_filesystem->exists($directory . 'mPDF.zip'))
|
90 |
+
{
|
91 |
+
/*
|
92 |
+
* The only function that requires the input to be the full path and the export to be the directory used in $wp_filesystem
|
93 |
+
*/
|
94 |
+
$results = unzip_file( PDF_PLUGIN_DIR . 'mPDF.zip', $directory );
|
95 |
+
|
96 |
+
if($results !== true)
|
97 |
+
{
|
98 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_unzip_mpdf_err"));
|
99 |
+
return 'fail';
|
100 |
+
}
|
101 |
+
|
102 |
+
/*
|
103 |
+
* Remove the original archive
|
104 |
+
*/
|
105 |
+
$wp_filesystem->delete($directory . 'mPDF.zip');
|
106 |
+
}
|
107 |
+
|
108 |
+
/* create new directory in active themes folder*/
|
109 |
+
if(!$wp_filesystem->is_dir($template_directory))
|
110 |
+
{
|
111 |
+
if($wp_filesystem->mkdir($template_directory) === false)
|
112 |
+
{
|
113 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
114 |
+
return 'fail';
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
if(!$wp_filesystem->is_dir($template_save_directory))
|
119 |
+
{
|
120 |
+
/* create new directory in active themes folder*/
|
121 |
+
if($wp_filesystem->mkdir($template_save_directory) === false)
|
122 |
+
{
|
123 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
124 |
+
return 'fail';
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
if(!$wp_filesystem->is_dir($template_font_directory))
|
129 |
+
{
|
130 |
+
/* create new directory in active themes folder*/
|
131 |
+
if($wp_filesystem->mkdir($template_font_directory) === false)
|
132 |
+
{
|
133 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
134 |
+
return 'fail';
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
/*
|
139 |
+
* Copy entire template folder over to PDF_TEMPLATE_LOCATION
|
140 |
+
*/
|
141 |
+
self::pdf_extended_copy_directory( $directory . 'templates', $template_directory, false );
|
142 |
+
|
143 |
+
if(!$wp_filesystem->exists($template_directory .'configuration.php'))
|
144 |
+
{
|
145 |
+
/* copy template files to new directory */
|
146 |
+
if(!$wp_filesystem->copy($directory .'configuration.php', $template_directory.'configuration.php'))
|
147 |
+
{
|
148 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
149 |
+
return 'fail';
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
if(!$wp_filesystem->exists($template_directory.'template.css'))
|
154 |
+
{
|
155 |
+
/* copy template files to new directory */
|
156 |
+
if(!$wp_filesystem->copy($directory .'styles/template.css', $template_directory.'template.css'))
|
157 |
+
{
|
158 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
159 |
+
return 'fail';
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
if(!$wp_filesystem->exists($template_save_directory.'.htaccess'))
|
164 |
+
{
|
165 |
+
if(!$wp_filesystem->put_contents($template_save_directory.'.htaccess', 'deny from all'))
|
166 |
+
{
|
167 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_template_dir_err"));
|
168 |
+
return 'fail';
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
if(self::install_fonts($directory, $template_directory, $template_font_directory) !== true)
|
173 |
+
{
|
174 |
+
return 'fail';
|
175 |
+
}
|
176 |
+
|
177 |
+
/*
|
178 |
+
* Update system to ensure everything is installed correctly.
|
179 |
+
*/
|
180 |
+
|
181 |
+
update_option('gf_pdf_extended_installed', 'installed');
|
182 |
+
update_option('gf_pdf_extended_deploy', 'yes');
|
183 |
+
delete_option('gfpdfe_switch_theme');
|
184 |
+
|
185 |
+
return true;
|
186 |
+
}
|
187 |
+
|
188 |
+
public static function initialise_fonts()
|
189 |
+
{
|
190 |
+
/*
|
191 |
+
* Initialise the Wordpress Filesystem API
|
192 |
+
*/
|
193 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('gfpdf_deploy'), 'pdf-extended-filesystem') === false)
|
194 |
+
{
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
|
198 |
+
/*
|
199 |
+
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
200 |
+
* Most notably is the FTP options, but SSH may be effected too
|
201 |
+
*/
|
202 |
+
$directory = PDF_PLUGIN_DIR;
|
203 |
+
$template_directory = PDF_TEMPLATE_LOCATION;
|
204 |
+
$template_font_directory = PDF_FONT_LOCATION;
|
205 |
+
|
206 |
+
|
207 |
+
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
208 |
+
{
|
209 |
+
/*
|
210 |
+
* Assume FTP is rooted to the Wordpress install
|
211 |
+
*/
|
212 |
+
$base_directory = self::get_base_directory();
|
213 |
+
|
214 |
+
$directory = str_replace(ABSPATH, $base_directory, $directory);
|
215 |
+
$template_directory = str_replace(ABSPATH, $base_directory, $template_directory);
|
216 |
+
$template_font_directory = str_replace(ABSPATH, $base_directory, $template_font_directory);
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
if(self::install_fonts($directory, $template_directory, $template_font_directory) === true)
|
221 |
+
{
|
222 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_install_success"));
|
223 |
+
}
|
224 |
+
return true;
|
225 |
+
}
|
226 |
+
|
227 |
+
private static function install_fonts($directory, $template_directory, $fonts_location)
|
228 |
+
{
|
229 |
+
|
230 |
+
global $wp_filesystem;
|
231 |
+
$write_to_file = '<?php
|
232 |
+
|
233 |
+
if(!defined("PDF_EXTENDED_VERSION"))
|
234 |
+
{
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
';
|
239 |
+
|
240 |
+
/*
|
241 |
+
* Search the font folder for .ttf files. If found, move them to the mPDF font folder
|
242 |
+
* and write the configuration file
|
243 |
+
*/
|
244 |
+
|
245 |
+
/* read all file names into array and unlink from active theme template folder */
|
246 |
+
foreach(glob($fonts_location.'/*.[tT][tT][fF]') as $file) {
|
247 |
+
|
248 |
+
$path_parts = pathinfo($file);
|
249 |
+
|
250 |
+
/*
|
251 |
+
* Check if the files already exist in the mPDF font folder
|
252 |
+
*/
|
253 |
+
if(!$wp_filesystem->exists($directory . 'mPDF/ttfonts/' . $path_parts['basename']))
|
254 |
+
{
|
255 |
+
/*
|
256 |
+
* copy ttf file to the mPDF font folder
|
257 |
+
*/
|
258 |
+
if($wp_filesystem->copy($file, $directory . 'mPDF/ttfonts/' . $path_parts['basename']) === false)
|
259 |
+
{
|
260 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_err"));
|
261 |
+
return false;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/*
|
266 |
+
* Generate configuration information in preparation to write to file
|
267 |
+
*/
|
268 |
+
$write_to_file .= '
|
269 |
+
$this->fontdata[\''.$path_parts['filename'].'\'] = array(
|
270 |
+
\'R\' => \''.$path_parts['basename'].'\'
|
271 |
+
);';
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
/*
|
276 |
+
* Remove the old configuration file and put the contents of $write_to_file in a font configuration file
|
277 |
+
*/
|
278 |
+
$wp_filesystem->delete($template_directory.'fonts/config.php');
|
279 |
+
if($wp_filesystem->put_contents($template_directory.'fonts/config.php', $write_to_file) === false)
|
280 |
+
{
|
281 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_font_config_err"));
|
282 |
+
return false;
|
283 |
+
}
|
284 |
+
|
285 |
+
return true;
|
286 |
+
}
|
287 |
+
|
288 |
+
public function gf_pdf_font_install_success()
|
289 |
+
{
|
290 |
+
echo '<div id="message" class="updated"><p>';
|
291 |
+
echo 'The font files have been successfully installed. A font can be used by adding it\'s file name (without .ttf) in a CSS font-family declaration.';
|
292 |
+
echo '</p></div>';
|
293 |
+
}
|
294 |
+
|
295 |
+
public function gf_pdf_font_err()
|
296 |
+
{
|
297 |
+
echo '<div id="message" class="error"><p>';
|
298 |
+
echo 'There was a problem installing the font files. Manually copy your fonts to the mPDF/ttfonts/ folder.';
|
299 |
+
echo '</p></div>';
|
300 |
+
}
|
301 |
+
|
302 |
+
public function gf_pdf_font_config_err()
|
303 |
+
{
|
304 |
+
echo '<div id="message" class="error"><p>';
|
305 |
+
echo 'Could not create font configuration file. Try initialise again.';
|
306 |
+
echo '</p></div>';
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Gravity Forms hasn't been installed so throw error.
|
311 |
+
* We make sure the user hasn't already dismissed the error
|
312 |
+
*/
|
313 |
+
public function gf_pdf_not_installed()
|
314 |
+
{
|
315 |
+
echo '<div id="message" class="error"><p>';
|
316 |
+
echo 'You need to install <a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">Gravity Forms</a> to use the Gravity Forms PDF Extended Plugin.';
|
317 |
+
echo '</p></div>';
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* PDF Extended has been updated but the new template files haven't been deployed yet
|
322 |
+
*/
|
323 |
+
public function gf_pdf_not_deployed()
|
324 |
+
{
|
325 |
+
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
326 |
+
{
|
327 |
+
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
328 |
+
{
|
329 |
+
echo '<div id="message" class="error"><p>';
|
330 |
+
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. After initialising, please review the latest updates to ensure your custom templates remain compatible with the latest version.';
|
331 |
+
echo '</p></div>';
|
332 |
+
|
333 |
+
}
|
334 |
+
else
|
335 |
+
{
|
336 |
+
echo '<div id="message" class="error"><p>';
|
337 |
+
echo 'You\'ve updated Gravity Forms PDF Extended but are yet to re-initialise the plugin. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
338 |
+
echo '</p></div>';
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* PDF Extended has been freshly installed
|
345 |
+
*/
|
346 |
+
public function gf_pdf_not_deployed_fresh()
|
347 |
+
{
|
348 |
+
if( (PDF_DEPLOY === true) && !rgpost('update') )
|
349 |
+
{
|
350 |
+
if(rgget("page") == 'gf_settings' && rgget('addon') == 'PDF')
|
351 |
+
{
|
352 |
+
echo '<div id="message" class="updated"><p>';
|
353 |
+
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it.';
|
354 |
+
echo '</p></div>';
|
355 |
+
|
356 |
+
}
|
357 |
+
else
|
358 |
+
{
|
359 |
+
echo '<div id="message" class="updated"><p>';
|
360 |
+
echo 'Welcome to Gravity Forms PDF Extended. Before you can use the plugin correctly you need to initilise it. Please go to the <a href="'.PDF_SETTINGS_URL.'">plugin\'s settings page</a> to initialise.';
|
361 |
+
echo '</p></div>';
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* The Gravity Forms version isn't compatible. Prompt user to upgrade
|
368 |
+
*/
|
369 |
+
public function gf_pdf_not_supported()
|
370 |
+
{
|
371 |
+
echo '<div id="message" class="error"><p>';
|
372 |
+
echo 'Gravity Forms PDF Extended only works with Gravity Forms version '.GF_PDF_EXTENDED_SUPPORTED_VERSION.' and higher. Please <a href="https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154" target="ejejcsingle">upgrade your copy of Gravity Forms</a> to use this plugin.';
|
373 |
+
echo '</p></div>';
|
374 |
+
}
|
375 |
+
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Cannot create new template folder in active theme directory
|
379 |
+
*/
|
380 |
+
public function gf_pdf_template_dir_err()
|
381 |
+
{
|
382 |
+
echo '<div id="message" class="error"><p>';
|
383 |
+
echo 'We could not create a template folder in your active theme\'s directory. Please created a folder called <strong>\''. PDF_SAVE_FOLDER .'\'</strong> in '.get_stylesheet_directory().'/. Then copy the contents of '.PDF_PLUGIN_DIR.'templates/ to your newly-created PDF_EXTENDED_TEMPLATES folder, as well as styles/template.css. You should also make this directory writable.';
|
384 |
+
echo '</p></div>';
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
public static function gf_pdf_unzip_mpdf_err()
|
389 |
+
{
|
390 |
+
echo '<div id="message" class="error"><p>';
|
391 |
+
echo 'Could not unzip mPDF.zip (located in the plugin folder). Unzip the file manually, place the extracted mPDF folder in the plugin folder and run the initialisation again.';
|
392 |
+
echo '</p></div>';
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Cannot remove old default template files
|
397 |
+
*/
|
398 |
+
public function gf_pdf_deployment_unlink_error()
|
399 |
+
{
|
400 |
+
echo '<div id="message" class="error"><p>';
|
401 |
+
echo 'We could not remove the default template files from the Gravity Forms PDF Extended folder in your active theme\'s directory. Please manually remove all files starting with \'default-\' and the template.css file.';
|
402 |
+
echo '</p></div>';
|
403 |
+
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Cannot create new template folder in active theme directory
|
408 |
+
*/
|
409 |
+
public function gf_pdf_template_move_err()
|
410 |
+
{
|
411 |
+
echo '<div id="message" class="error"><p>';
|
412 |
+
echo 'We could not copy the contents of '.PDF_PLUGIN_DIR.'templates/ to your newly-created PDF_EXTENDED_TEMPLATES folder. Please manually copy the files to the aforementioned directory..';
|
413 |
+
echo '</p></div>';
|
414 |
+
|
415 |
+
}
|
416 |
+
|
417 |
+
/*
|
418 |
+
* When switching themes copy over current active theme's PDF_EXTENDED_TEMPLATES (if it exists) to new theme folder
|
419 |
+
*/
|
420 |
+
public function gf_pdf_on_switch_theme($old_theme_name, $old_theme_object) {
|
421 |
+
|
422 |
+
/*
|
423 |
+
* We will store the old pdf dir and new pdf directory and prompt the user to copy the PDF_EXTENDED_TEMPLATES folder
|
424 |
+
*/
|
425 |
+
$previous_theme_directory = $old_theme_object->get_stylesheet_directory();
|
426 |
+
|
427 |
+
$current_theme_array = wp_get_theme();
|
428 |
+
$current_theme_directory = $current_theme_array->get_stylesheet_directory();
|
429 |
+
|
430 |
+
/*
|
431 |
+
* Add the save folder name to the end of the paths
|
432 |
+
*/
|
433 |
+
$old_pdf_path = $previous_theme_directory . '/' . PDF_SAVE_FOLDER;
|
434 |
+
$new_pdf_path = $current_theme_directory . '/' . PDF_SAVE_FOLDER;
|
435 |
+
|
436 |
+
update_option('gfpdfe_switch_theme', array('old' => $old_pdf_path, 'new' => $new_pdf_path));
|
437 |
+
}
|
438 |
+
|
439 |
+
/*
|
440 |
+
* Check if a theme switch has been made recently
|
441 |
+
* If it has then prompt the user to move the files
|
442 |
+
*/
|
443 |
+
public static function check_theme_switch()
|
444 |
+
{
|
445 |
+
$theme_switch = get_option('gfpdfe_switch_theme');
|
446 |
+
if(isset($theme_switch['old']) && isset($theme_switch['new']))
|
447 |
+
{
|
448 |
+
/*
|
449 |
+
* Add admin notification hook to move the files
|
450 |
+
*/
|
451 |
+
add_action('admin_notices', array("GFPDF_InstallUpdater", "do_theme_switch_notice"));
|
452 |
+
return true;
|
453 |
+
}
|
454 |
+
return false;
|
455 |
+
}
|
456 |
+
|
457 |
+
/*
|
458 |
+
* Prompt user to keep the plugin working
|
459 |
+
*/
|
460 |
+
public static function do_theme_switch_notice()
|
461 |
+
{
|
462 |
+
/*
|
463 |
+
* Check we aren't in the middle of doing the sync
|
464 |
+
*/
|
465 |
+
if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_sync_now'))
|
466 |
+
{
|
467 |
+
return;
|
468 |
+
}
|
469 |
+
|
470 |
+
echo '<div id="message" class="error"><p>';
|
471 |
+
echo 'Gravity Forms PDF Extended needs to keep the PDF_EXTENDED_TEMPLATE folder in sync with your current active theme. <a href="'. wp_nonce_url(PDF_SETTINGS_URL, 'gfpdfe_sync_now') . '" class="button">Sync Now</a>';
|
472 |
+
echo '</p></div>';
|
473 |
+
|
474 |
+
}
|
475 |
+
|
476 |
+
public static function gf_pdf_theme_sync_success()
|
477 |
+
{
|
478 |
+
echo '<div id="message" class="updated"><p>';
|
479 |
+
echo 'PDF_EXTENDED_TEMPLATE folder successfully synced.';
|
480 |
+
echo '</p></div>';
|
481 |
+
}
|
482 |
+
|
483 |
+
/*
|
484 |
+
* The after_switch_theme hook is too early in the initialisation to use request_filesystem_credentials()
|
485 |
+
* so we have to call this function at a later inteval
|
486 |
+
*/
|
487 |
+
public function do_theme_switch($previous_pdf_path, $current_pdf_path)
|
488 |
+
{
|
489 |
+
/*
|
490 |
+
* Prepare for calling the WP Filesystem
|
491 |
+
* It only allows post data to be added so we have to manually assign them
|
492 |
+
*/
|
493 |
+
$_POST['previous_pdf_path'] = $previous_pdf_path;
|
494 |
+
$_POST['current_pdf_path'] = $current_pdf_path;
|
495 |
+
|
496 |
+
/*
|
497 |
+
* Initialise the Wordpress Filesystem API
|
498 |
+
*/
|
499 |
+
if(PDF_Common::initialise_WP_filesystem_API(array('previous_pdf_path', 'current_pdf_path'), 'gfpdfe_sync_now') === false)
|
500 |
+
{
|
501 |
+
return false;
|
502 |
+
}
|
503 |
+
|
504 |
+
/*
|
505 |
+
* If we got here we should have $wp_filesystem available
|
506 |
+
*/
|
507 |
+
global $wp_filesystem;
|
508 |
+
|
509 |
+
/*
|
510 |
+
* We need to set up some filesystem compatibility checkes to work with the different server file management types
|
511 |
+
* Most notably is the FTP options, but SSH may be effected too
|
512 |
+
*/
|
513 |
+
|
514 |
+
if($wp_filesystem->method === 'ftpext' || $wp_filesystem->method === 'ftpsockets')
|
515 |
+
{
|
516 |
+
/*
|
517 |
+
* Assume FTP is rooted to the Wordpress install
|
518 |
+
*/
|
519 |
+
$base_directory = self::get_base_directory();
|
520 |
+
|
521 |
+
$previous_pdf_path = str_replace(ABSPATH, $base_directory, $previous_pdf_path);
|
522 |
+
$current_pdf_path = str_replace(ABSPATH, $base_directory, $current_pdf_path);
|
523 |
+
|
524 |
+
}
|
525 |
+
|
526 |
+
if($wp_filesystem->is_dir($previous_pdf_path))
|
527 |
+
{
|
528 |
+
self::pdf_extended_copy_directory( $previous_pdf_path, $current_pdf_path, true, true );
|
529 |
+
}
|
530 |
+
|
531 |
+
/*
|
532 |
+
* Remove the options key that triggers the switch theme function
|
533 |
+
*/
|
534 |
+
delete_option('gfpdfe_switch_theme');
|
535 |
+
add_action('gfpdfe_notices', array("GFPDF_InstallUpdater", "gf_pdf_theme_sync_success"));
|
536 |
+
|
537 |
+
/*
|
538 |
+
* Show success message to user
|
539 |
+
*/
|
540 |
+
return true;
|
541 |
+
}
|
542 |
+
|
543 |
+
/*
|
544 |
+
* Allows you to copy entire folder structures to new location
|
545 |
+
*/
|
546 |
+
|
547 |
+
public function pdf_extended_copy_directory( $source, $destination, $copy_base = true, $delete_destination = false )
|
548 |
+
{
|
549 |
+
global $wp_filesystem;
|
550 |
+
|
551 |
+
if ( $wp_filesystem->is_dir( $source ) )
|
552 |
+
{
|
553 |
+
if($delete_destination === true)
|
554 |
+
{
|
555 |
+
/*
|
556 |
+
* To ensure everything stays in sync we will remove the destination file structure
|
557 |
+
*/
|
558 |
+
$wp_filesystem->delete($destination, true);
|
559 |
+
}
|
560 |
+
|
561 |
+
if($copy_base === true)
|
562 |
+
{
|
563 |
+
$wp_filesystem->mkdir( $destination );
|
564 |
+
}
|
565 |
+
$directory = $wp_filesystem->dirlist( $source );
|
566 |
+
|
567 |
+
foreach($directory as $name => $data)
|
568 |
+
{
|
569 |
+
|
570 |
+
$PathDir = $source . '/' . $name;
|
571 |
+
|
572 |
+
if ( $wp_filesystem->is_dir( $PathDir ) )
|
573 |
+
{
|
574 |
+
self::pdf_extended_copy_directory( $PathDir, $destination . '/' . $name );
|
575 |
+
continue;
|
576 |
+
}
|
577 |
+
$wp_filesystem->copy( $PathDir, $destination . '/' . $name );
|
578 |
+
}
|
579 |
+
|
580 |
+
}
|
581 |
+
else
|
582 |
+
{
|
583 |
+
$wp_filesystem->copy( $source, $destination );
|
584 |
+
}
|
585 |
+
}
|
586 |
+
|
587 |
+
private static function check_access_path($directory, $file_path, $directory_list)
|
588 |
+
{
|
589 |
+
global $wp_filesystem;
|
590 |
+
|
591 |
+
//$directory = false;
|
592 |
+
foreach($directory_list as $name => $data)
|
593 |
+
{
|
594 |
+
/*
|
595 |
+
* Check if one of the file/folder names matches what is in $file_path, make sure it is a directory and
|
596 |
+
* the name has a value
|
597 |
+
*/
|
598 |
+
$match = array_search($name, $file_path);
|
599 |
+
if((strlen($name) > 0) && ($match !== false) && ((int) $data['isdir'] === 1) )
|
600 |
+
{
|
601 |
+
|
602 |
+
/*
|
603 |
+
* We have a match but it could be fake
|
604 |
+
* Look inside the target folder and see if the next folder in $file_path can be found
|
605 |
+
* If it can we will assume it is the correct path
|
606 |
+
*/
|
607 |
+
if(isset($file_path[$match+1]))
|
608 |
+
{
|
609 |
+
|
610 |
+
$next_match = $file_path[$match+1];
|
611 |
+
$directory_list2 = $wp_filesystem->dirlist('/'.$name.'/');
|
612 |
+
|
613 |
+
if(isset($directory_list2[$next_match]) && (int) $directory_list2[$next_match]['isdir'] === 1)
|
614 |
+
{
|
615 |
+
return self::merge_path($file_path, $match);
|
616 |
+
}
|
617 |
+
|
618 |
+
}
|
619 |
+
else
|
620 |
+
{
|
621 |
+
return self::merge_path($file_path, $match);
|
622 |
+
}
|
623 |
+
}
|
624 |
+
}
|
625 |
+
return $directory;
|
626 |
+
}
|
627 |
+
|
628 |
+
/*
|
629 |
+
* Merge the path array back together from the matched key
|
630 |
+
*/
|
631 |
+
private static function merge_path($file_path, $key)
|
632 |
+
{
|
633 |
+
return '/' . implode('/', array_slice($file_path, $key)) . '/';
|
634 |
+
}
|
635 |
+
|
636 |
+
/*
|
637 |
+
* Get the base directory for the current filemanagement type
|
638 |
+
* In this case it is FTP but may be SSH
|
639 |
+
*/
|
640 |
+
private static function get_base_directory()
|
641 |
+
{
|
642 |
+
global $wp_filesystem;
|
643 |
+
|
644 |
+
/*
|
645 |
+
* Assume FTP is rooted to the Wordpress install
|
646 |
+
*/
|
647 |
+
$directory = '/';
|
648 |
+
|
649 |
+
/*
|
650 |
+
* Test if the FTP is below the Wordpress base by sniffing the base directory
|
651 |
+
*/
|
652 |
+
$directory_list = $wp_filesystem->dirlist('/');
|
653 |
+
|
654 |
+
/*
|
655 |
+
* Use the ABSPATH to compare the directory structure
|
656 |
+
*/
|
657 |
+
$file_path = array_filter(explode('/', ABSPATH ));
|
658 |
+
|
659 |
+
/*
|
660 |
+
* Rekey the array
|
661 |
+
*/
|
662 |
+
$file_path = array_values($file_path);
|
663 |
+
|
664 |
+
return self::check_access_path($directory, $file_path, $directory_list);
|
665 |
+
|
666 |
+
}
|
667 |
+
|
668 |
+
}
|
pdf-common.php
CHANGED
@@ -1,232 +1,232 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class PDF_Common
|
4 |
-
{
|
5 |
-
public static function setup_ids()
|
6 |
-
{
|
7 |
-
global $form_id, $lead_id, $lead_ids;
|
8 |
-
|
9 |
-
if(defined('GF_FORM_ID') && defined('GF_LEAD_ID'))
|
10 |
-
{
|
11 |
-
$form_id = GF_FORM_ID;
|
12 |
-
$lead_ids =
|
13 |
-
}
|
14 |
-
else
|
15 |
-
{
|
16 |
-
$form_id = ($form_id) ? $form_id : absint( rgget("fid") );
|
17 |
-
$lead_ids = ($lead_id) ? array($lead_id) : explode(',', rgget("lid"));
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* If form ID and lead ID hasn't been set stop the PDF from attempting to generate
|
22 |
-
*/
|
23 |
-
if(empty($form_id) || empty($lead_ids))
|
24 |
-
{
|
25 |
-
trigger_error(__("Form Id and Lead Id are required parameters.", "gravityforms"));
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
/*
|
31 |
-
* Check if the system is fully installed and return the correct values
|
32 |
-
*/
|
33 |
-
public static function is_fully_installed()
|
34 |
-
{
|
35 |
-
if( (get_option('gf_pdf_extended_installed') != 'installed') || (!is_dir(PDF_TEMPLATE_LOCATION)) )
|
36 |
-
{
|
37 |
-
return false;
|
38 |
-
}
|
39 |
-
|
40 |
-
if(get_option('gf_pdf_extended_version') != PDF_EXTENDED_VERSION)
|
41 |
-
{
|
42 |
-
return false;
|
43 |
-
}
|
44 |
-
|
45 |
-
if(get_option('gf_pdf_extended_deploy') == 'no' && !rgpost('upgrade') && PDF_DEPLOY === true)
|
46 |
-
{
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
|
50 |
-
if(file_exists(PDF_PLUGIN_DIR .'mPDF.zip'))
|
51 |
-
{
|
52 |
-
return false;
|
53 |
-
}
|
54 |
-
|
55 |
-
return true;
|
56 |
-
}
|
57 |
-
|
58 |
-
public static function getRealIpAddr()
|
59 |
-
{
|
60 |
-
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
|
61 |
-
{
|
62 |
-
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
63 |
-
}
|
64 |
-
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
|
65 |
-
{
|
66 |
-
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
67 |
-
}
|
68 |
-
else
|
69 |
-
{
|
70 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
71 |
-
}
|
72 |
-
return $ip;
|
73 |
-
}
|
74 |
-
|
75 |
-
public static function get_html_template($filename)
|
76 |
-
{
|
77 |
-
global $form_id, $lead_id, $lead_ids;
|
78 |
-
|
79 |
-
ob_start();
|
80 |
-
require($filename);
|
81 |
-
|
82 |
-
$page = ob_get_contents();
|
83 |
-
ob_end_clean();
|
84 |
-
|
85 |
-
return $page;
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Get the name of the PDF based on the Form and the submission
|
90 |
-
*/
|
91 |
-
public static function get_pdf_filename($form_id, $lead_id)
|
92 |
-
{
|
93 |
-
return "form-$form_id-entry-$lead_id.pdf";
|
94 |
-
}
|
95 |
-
|
96 |
-
/*
|
97 |
-
* Check if mPDF folder exists.
|
98 |
-
* If so, unzip and delete
|
99 |
-
* Helps reduce the package file size
|
100 |
-
*/
|
101 |
-
public static function unpack_mPDF()
|
102 |
-
{
|
103 |
-
$file = PDF_PLUGIN_DIR .'mPDF.zip';
|
104 |
-
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
|
105 |
-
|
106 |
-
if(file_exists($file))
|
107 |
-
{
|
108 |
-
/* unzip folder and delete */
|
109 |
-
$zip = new ZipArchive;
|
110 |
-
$res = $zip->open($file);
|
111 |
-
|
112 |
-
if ($res === TRUE) {
|
113 |
-
$zip->extractTo($path);
|
114 |
-
$zip->close();
|
115 |
-
unlink($file);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
public static function validate_pdf_name($name, $form_id = false, $lead_id = false)
|
121 |
-
{
|
122 |
-
if(substr($name, -4) != '.pdf')
|
123 |
-
{
|
124 |
-
$pdf_name = $name . '.pdf';
|
125 |
-
}
|
126 |
-
$pdf_name = $name;
|
127 |
-
|
128 |
-
if($form_id > 0)
|
129 |
-
{
|
130 |
-
$pdf_name = PDF_Common::do_mergetags($name, $form_id, $lead_id);
|
131 |
-
}
|
132 |
-
|
133 |
-
return $pdf_name;
|
134 |
-
}
|
135 |
-
|
136 |
-
public static function do_mergetags($string, $form_id, $lead_id)
|
137 |
-
{
|
138 |
-
$form = RGFormsModel::get_form_meta($form_id);
|
139 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
140 |
-
|
141 |
-
/* strip {all_fields} merge tag from $string */
|
142 |
-
$string = str_replace('{all_fields}', '', $string);
|
143 |
-
|
144 |
-
return trim(GFCommon::replace_variables($string, $form, $lead, false, false, false));
|
145 |
-
}
|
146 |
-
|
147 |
-
public static function view_data($form_data)
|
148 |
-
{
|
149 |
-
if(isset($_GET['data']) && $_GET['data'] === '1' && GFCommon::current_user_can_any("gravityforms_view_entries"))
|
150 |
-
{
|
151 |
-
print '<pre>';
|
152 |
-
print_r($form_data);
|
153 |
-
print '</pre>';
|
154 |
-
exit;
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
public static function is_gravityforms_supported($version){
|
159 |
-
if(class_exists("GFCommon"))
|
160 |
-
{
|
161 |
-
if(version_compare(GFCommon::$version, $version, ">=") === true)
|
162 |
-
{
|
163 |
-
return true;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
return false;
|
167 |
-
}
|
168 |
-
|
169 |
-
public static function is_wordpress_supported($version){
|
170 |
-
global $wp_version;
|
171 |
-
if(version_compare($wp_version, $version, ">=") === true)
|
172 |
-
{
|
173 |
-
return true;
|
174 |
-
}
|
175 |
-
return false;
|
176 |
-
}
|
177 |
-
|
178 |
-
public static function display_compatibility_error()
|
179 |
-
{
|
180 |
-
$message = sprintf(__("Gravity Forms " . GF_PDF_EXTENDED_SUPPORTED_VERSION . " is required to use this plugin. Activate it now or %spurchase it today!%s"), "<a href='https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154'>", "</a>");
|
181 |
-
PDF_Common::display_plugin_message($message, true);
|
182 |
-
}
|
183 |
-
|
184 |
-
public static function display_wp_compatibility_error()
|
185 |
-
{
|
186 |
-
$message = "Wordpress " . GF_PDF_EXTENDED_WP_SUPPORTED_VERSION . " or higher is required to use this plugin.";
|
187 |
-
PDF_Common::display_plugin_message($message, true);
|
188 |
-
}
|
189 |
-
|
190 |
-
public static function display_documentation_details()
|
191 |
-
{
|
192 |
-
$message = sprintf(__("Please review the %sGravity Forms PDF Extended documentation%s for comprehensive installation instructions. %sUpgraded from v2.x.x? Review our migration guide%s.</span>"), "<a href='http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/'>", "</a>", '<a style="color: red;" href="http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/">', '</a>');
|
193 |
-
PDF_Common::display_plugin_message($message);
|
194 |
-
}
|
195 |
-
|
196 |
-
public static function display_plugin_message($message, $is_error = false){
|
197 |
-
|
198 |
-
$style = $is_error ? 'style="background-color: #ffebe8;"' : "";
|
199 |
-
|
200 |
-
echo '</tr><tr class="plugin-update-tr"><td colspan="5" class="plugin-update"><div class="update-message" ' . $style . '>' . $message . '</div></td>';
|
201 |
-
}
|
202 |
-
|
203 |
-
/*
|
204 |
-
* New to 3.0.2 we will use WP_Filesystem API to manipulate files instead of using in-built PHP functions
|
205 |
-
* $post Array the post data to include in the request_filesystem_credntials API
|
206 |
-
*/
|
207 |
-
public static function initialise_WP_filesystem_API($post, $nonce)
|
208 |
-
{
|
209 |
-
|
210 |
-
$url = wp_nonce_url(PDF_SETTINGS_URL, $nonce);
|
211 |
-
|
212 |
-
if (false === ($creds = request_filesystem_credentials($url, '', false, false, $post) ) ) {
|
213 |
-
/*
|
214 |
-
* If we get here, then we don't have correct permissions and we need to get the FTP details.
|
215 |
-
* request_filesystem_credentials will handle all that
|
216 |
-
*/
|
217 |
-
return false; // stop the normal page form from displaying
|
218 |
-
}
|
219 |
-
|
220 |
-
/*
|
221 |
-
* Check if the credentials are no good and display an error
|
222 |
-
*/
|
223 |
-
if ( ! WP_Filesystem($creds) ) {
|
224 |
-
request_filesystem_credentials($url, '', true, false, $post_credentials);
|
225 |
-
return false;
|
226 |
-
}
|
227 |
-
|
228 |
-
return true;
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PDF_Common
|
4 |
+
{
|
5 |
+
public static function setup_ids()
|
6 |
+
{
|
7 |
+
global $form_id, $lead_id, $lead_ids;
|
8 |
+
|
9 |
+
if(defined('GF_FORM_ID') && defined('GF_LEAD_ID'))
|
10 |
+
{
|
11 |
+
$form_id = GF_FORM_ID;
|
12 |
+
$lead_ids = explode(',', GF_LEAD_ID);
|
13 |
+
}
|
14 |
+
else
|
15 |
+
{
|
16 |
+
$form_id = ($form_id) ? $form_id : absint( rgget("fid") );
|
17 |
+
$lead_ids = ($lead_id) ? array($lead_id) : explode(',', rgget("lid"));
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* If form ID and lead ID hasn't been set stop the PDF from attempting to generate
|
22 |
+
*/
|
23 |
+
if(empty($form_id) || empty($lead_ids))
|
24 |
+
{
|
25 |
+
trigger_error(__("Form Id and Lead Id are required parameters.", "gravityforms"));
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Check if the system is fully installed and return the correct values
|
32 |
+
*/
|
33 |
+
public static function is_fully_installed()
|
34 |
+
{
|
35 |
+
if( (get_option('gf_pdf_extended_installed') != 'installed') || (!is_dir(PDF_TEMPLATE_LOCATION)) )
|
36 |
+
{
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
if(get_option('gf_pdf_extended_version') != PDF_EXTENDED_VERSION)
|
41 |
+
{
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
if(get_option('gf_pdf_extended_deploy') == 'no' && !rgpost('upgrade') && PDF_DEPLOY === true)
|
46 |
+
{
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
if(file_exists(PDF_PLUGIN_DIR .'mPDF.zip'))
|
51 |
+
{
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
return true;
|
56 |
+
}
|
57 |
+
|
58 |
+
public static function getRealIpAddr()
|
59 |
+
{
|
60 |
+
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
|
61 |
+
{
|
62 |
+
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
63 |
+
}
|
64 |
+
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
|
65 |
+
{
|
66 |
+
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
67 |
+
}
|
68 |
+
else
|
69 |
+
{
|
70 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
71 |
+
}
|
72 |
+
return $ip;
|
73 |
+
}
|
74 |
+
|
75 |
+
public static function get_html_template($filename)
|
76 |
+
{
|
77 |
+
global $form_id, $lead_id, $lead_ids;
|
78 |
+
|
79 |
+
ob_start();
|
80 |
+
require($filename);
|
81 |
+
|
82 |
+
$page = ob_get_contents();
|
83 |
+
ob_end_clean();
|
84 |
+
|
85 |
+
return $page;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Get the name of the PDF based on the Form and the submission
|
90 |
+
*/
|
91 |
+
public static function get_pdf_filename($form_id, $lead_id)
|
92 |
+
{
|
93 |
+
return "form-$form_id-entry-$lead_id.pdf";
|
94 |
+
}
|
95 |
+
|
96 |
+
/*
|
97 |
+
* Check if mPDF folder exists.
|
98 |
+
* If so, unzip and delete
|
99 |
+
* Helps reduce the package file size
|
100 |
+
*/
|
101 |
+
public static function unpack_mPDF()
|
102 |
+
{
|
103 |
+
$file = PDF_PLUGIN_DIR .'mPDF.zip';
|
104 |
+
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
|
105 |
+
|
106 |
+
if(file_exists($file))
|
107 |
+
{
|
108 |
+
/* unzip folder and delete */
|
109 |
+
$zip = new ZipArchive;
|
110 |
+
$res = $zip->open($file);
|
111 |
+
|
112 |
+
if ($res === TRUE) {
|
113 |
+
$zip->extractTo($path);
|
114 |
+
$zip->close();
|
115 |
+
unlink($file);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
public static function validate_pdf_name($name, $form_id = false, $lead_id = false)
|
121 |
+
{
|
122 |
+
if(substr($name, -4) != '.pdf')
|
123 |
+
{
|
124 |
+
$pdf_name = $name . '.pdf';
|
125 |
+
}
|
126 |
+
$pdf_name = $name;
|
127 |
+
|
128 |
+
if($form_id > 0)
|
129 |
+
{
|
130 |
+
$pdf_name = PDF_Common::do_mergetags($name, $form_id, $lead_id);
|
131 |
+
}
|
132 |
+
|
133 |
+
return $pdf_name;
|
134 |
+
}
|
135 |
+
|
136 |
+
public static function do_mergetags($string, $form_id, $lead_id)
|
137 |
+
{
|
138 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
139 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
140 |
+
|
141 |
+
/* strip {all_fields} merge tag from $string */
|
142 |
+
$string = str_replace('{all_fields}', '', $string);
|
143 |
+
|
144 |
+
return trim(GFCommon::replace_variables($string, $form, $lead, false, false, false));
|
145 |
+
}
|
146 |
+
|
147 |
+
public static function view_data($form_data)
|
148 |
+
{
|
149 |
+
if(isset($_GET['data']) && $_GET['data'] === '1' && GFCommon::current_user_can_any("gravityforms_view_entries"))
|
150 |
+
{
|
151 |
+
print '<pre>';
|
152 |
+
print_r($form_data);
|
153 |
+
print '</pre>';
|
154 |
+
exit;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
public static function is_gravityforms_supported($version){
|
159 |
+
if(class_exists("GFCommon"))
|
160 |
+
{
|
161 |
+
if(version_compare(GFCommon::$version, $version, ">=") === true)
|
162 |
+
{
|
163 |
+
return true;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
|
169 |
+
public static function is_wordpress_supported($version){
|
170 |
+
global $wp_version;
|
171 |
+
if(version_compare($wp_version, $version, ">=") === true)
|
172 |
+
{
|
173 |
+
return true;
|
174 |
+
}
|
175 |
+
return false;
|
176 |
+
}
|
177 |
+
|
178 |
+
public static function display_compatibility_error()
|
179 |
+
{
|
180 |
+
$message = sprintf(__("Gravity Forms " . GF_PDF_EXTENDED_SUPPORTED_VERSION . " is required to use this plugin. Activate it now or %spurchase it today!%s"), "<a href='https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=235154'>", "</a>");
|
181 |
+
PDF_Common::display_plugin_message($message, true);
|
182 |
+
}
|
183 |
+
|
184 |
+
public static function display_wp_compatibility_error()
|
185 |
+
{
|
186 |
+
$message = "Wordpress " . GF_PDF_EXTENDED_WP_SUPPORTED_VERSION . " or higher is required to use this plugin.";
|
187 |
+
PDF_Common::display_plugin_message($message, true);
|
188 |
+
}
|
189 |
+
|
190 |
+
public static function display_documentation_details()
|
191 |
+
{
|
192 |
+
$message = sprintf(__("Please review the %sGravity Forms PDF Extended documentation%s for comprehensive installation instructions. %sUpgraded from v2.x.x? Review our migration guide%s.</span>"), "<a href='http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/'>", "</a>", '<a style="color: red;" href="http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/">', '</a>');
|
193 |
+
PDF_Common::display_plugin_message($message);
|
194 |
+
}
|
195 |
+
|
196 |
+
public static function display_plugin_message($message, $is_error = false){
|
197 |
+
|
198 |
+
$style = $is_error ? 'style="background-color: #ffebe8;"' : "";
|
199 |
+
|
200 |
+
echo '</tr><tr class="plugin-update-tr"><td colspan="5" class="plugin-update"><div class="update-message" ' . $style . '>' . $message . '</div></td>';
|
201 |
+
}
|
202 |
+
|
203 |
+
/*
|
204 |
+
* New to 3.0.2 we will use WP_Filesystem API to manipulate files instead of using in-built PHP functions
|
205 |
+
* $post Array the post data to include in the request_filesystem_credntials API
|
206 |
+
*/
|
207 |
+
public static function initialise_WP_filesystem_API($post, $nonce)
|
208 |
+
{
|
209 |
+
|
210 |
+
$url = wp_nonce_url(PDF_SETTINGS_URL, $nonce);
|
211 |
+
|
212 |
+
if (false === ($creds = request_filesystem_credentials($url, '', false, false, $post) ) ) {
|
213 |
+
/*
|
214 |
+
* If we get here, then we don't have correct permissions and we need to get the FTP details.
|
215 |
+
* request_filesystem_credentials will handle all that
|
216 |
+
*/
|
217 |
+
return false; // stop the normal page form from displaying
|
218 |
+
}
|
219 |
+
|
220 |
+
/*
|
221 |
+
* Check if the credentials are no good and display an error
|
222 |
+
*/
|
223 |
+
if ( ! WP_Filesystem($creds) ) {
|
224 |
+
request_filesystem_credentials($url, '', true, false, $post_credentials);
|
225 |
+
return false;
|
226 |
+
}
|
227 |
+
|
228 |
+
return true;
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
}
|
pdf-configuration-indexer.php
CHANGED
@@ -1,259 +1,255 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class: PDFGenerator
|
5 |
-
* Plugin: Gravity Forms PDF Extended
|
6 |
-
* Usage: assign options from user configuration file, automatically attach PDFs to specified Gravity Forms, and view PDF from admin area.
|
7 |
-
*/
|
8 |
-
|
9 |
-
class PDFGenerator
|
10 |
-
{
|
11 |
-
|
12 |
-
/*
|
13 |
-
* Set default values for forms not assigned a PDF
|
14 |
-
*/
|
15 |
-
public static $default = array(
|
16 |
-
'template' => 'default-template.php',
|
17 |
-
'pdf_size' => 'a4',
|
18 |
-
'orientation' => 'portrait',
|
19 |
-
'rtf' => false,
|
20 |
-
'security' => false
|
21 |
-
);
|
22 |
-
|
23 |
-
public static $allowed_privileges = array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres');
|
24 |
-
|
25 |
-
public $configuration = array();
|
26 |
-
|
27 |
-
public static $gf_compatibility;
|
28 |
-
|
29 |
-
public static $pre_1_7_notifications = array('Admin Notification', 'User Notification');
|
30 |
-
|
31 |
-
/*
|
32 |
-
* Switch to verify if configuration file exists.
|
33 |
-
* If not, user is using old functions.php method and we
|
34 |
-
* don't want to interfere with it.
|
35 |
-
*/
|
36 |
-
public $disabled = false;
|
37 |
-
|
38 |
-
/*
|
39 |
-
* The index holds the form_id and configuration key in $this->configuration
|
40 |
-
* so each form knows
|
41 |
-
*/
|
42 |
-
public $index = array();
|
43 |
-
|
44 |
-
public function __construct()
|
45 |
-
{
|
46 |
-
/*
|
47 |
-
* Detect Gravity Forms version and use appropriate code
|
48 |
-
*/
|
49 |
-
PDFGenerator::$gf_compatibility = 'post 1.7';
|
50 |
-
if(GFCommon::$version < 1.7)
|
51 |
-
{
|
52 |
-
PDFGenerator::$gf_compatibility = 'pre 1.7';
|
53 |
-
}
|
54 |
-
|
55 |
-
/*
|
56 |
-
* Do configuration pre-processing
|
57 |
-
*/
|
58 |
-
|
59 |
-
/*
|
60 |
-
* Check if user configuration file exists
|
61 |
-
* If not disable $configuration and $index.
|
62 |
-
*/
|
63 |
-
if(!file_exists(PDF_TEMPLATE_LOCATION.'configuration.php'))
|
64 |
-
{
|
65 |
-
$this->disabled = true;
|
66 |
-
return;
|
67 |
-
}
|
68 |
-
else
|
69 |
-
{
|
70 |
-
/*
|
71 |
-
* Include the configuration file and set up the configuration variable.
|
72 |
-
*/
|
73 |
-
require(PDF_TEMPLATE_LOCATION.'configuration.php');
|
74 |
-
/*
|
75 |
-
* $gf_pdf_config included from configuration.php file
|
76 |
-
*/
|
77 |
-
$this->configuration = (isset($gf_pdf_config)) ? $gf_pdf_config : array();
|
78 |
-
}
|
79 |
-
|
80 |
-
$this->pdf_config();
|
81 |
-
}
|
82 |
-
|
83 |
-
/*
|
84 |
-
* Run through user configuration and set PDF options
|
85 |
-
*/
|
86 |
-
private function pdf_config()
|
87 |
-
{
|
88 |
-
if(sizeof($this->configuration) == 0)
|
89 |
-
{
|
90 |
-
return;
|
91 |
-
}
|
92 |
-
|
93 |
-
$this->set_form_pdfs();
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
/*
|
98 |
-
* Set the configuration index so it's faster to access template configuration information
|
99 |
-
*/
|
100 |
-
private function set_form_pdfs()
|
101 |
-
{
|
102 |
-
foreach($this->configuration as $key => $config)
|
103 |
-
{
|
104 |
-
if(!is_array($config['form_id']))
|
105 |
-
{
|
106 |
-
$this->assign_index($config['form_id'], $key);
|
107 |
-
}
|
108 |
-
else
|
109 |
-
{
|
110 |
-
foreach($config['form_id'] as $id)
|
111 |
-
{
|
112 |
-
$this->assign_index($id, $key);
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
/*
|
120 |
-
* Check to see if ID is valid
|
121 |
-
* If so, assign ID => key to index
|
122 |
-
*/
|
123 |
-
protected function assign_index($id, $key)
|
124 |
-
{
|
125 |
-
$id = (int) $id;
|
126 |
-
if($id !== 0)
|
127 |
-
{
|
128 |
-
/*
|
129 |
-
* Assign the outter array with the form ID and the value as the configuration key
|
130 |
-
*/
|
131 |
-
$this->index[$id][] = $key;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
/*
|
136 |
-
* Searches the index for the configuration key
|
137 |
-
* Return: form PDF configuration
|
138 |
-
*/
|
139 |
-
public function get_config($id)
|
140 |
-
{
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
{
|
219 |
-
return
|
220 |
-
}
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
}
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
return false;
|
257 |
-
}
|
258 |
-
|
259 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class: PDFGenerator
|
5 |
+
* Plugin: Gravity Forms PDF Extended
|
6 |
+
* Usage: assign options from user configuration file, automatically attach PDFs to specified Gravity Forms, and view PDF from admin area.
|
7 |
+
*/
|
8 |
+
|
9 |
+
class PDFGenerator
|
10 |
+
{
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Set default values for forms not assigned a PDF
|
14 |
+
*/
|
15 |
+
public static $default = array(
|
16 |
+
'template' => 'default-template.php',
|
17 |
+
'pdf_size' => 'a4',
|
18 |
+
'orientation' => 'portrait',
|
19 |
+
'rtf' => false,
|
20 |
+
'security' => false
|
21 |
+
);
|
22 |
+
|
23 |
+
public static $allowed_privileges = array('copy', 'print', 'modify', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-highres');
|
24 |
+
|
25 |
+
public $configuration = array();
|
26 |
+
|
27 |
+
public static $gf_compatibility;
|
28 |
+
|
29 |
+
public static $pre_1_7_notifications = array('Admin Notification', 'User Notification');
|
30 |
+
|
31 |
+
/*
|
32 |
+
* Switch to verify if configuration file exists.
|
33 |
+
* If not, user is using old functions.php method and we
|
34 |
+
* don't want to interfere with it.
|
35 |
+
*/
|
36 |
+
public $disabled = false;
|
37 |
+
|
38 |
+
/*
|
39 |
+
* The index holds the form_id and configuration key in $this->configuration
|
40 |
+
* so each form knows
|
41 |
+
*/
|
42 |
+
public $index = array();
|
43 |
+
|
44 |
+
public function __construct()
|
45 |
+
{
|
46 |
+
/*
|
47 |
+
* Detect Gravity Forms version and use appropriate code
|
48 |
+
*/
|
49 |
+
PDFGenerator::$gf_compatibility = 'post 1.7';
|
50 |
+
if(GFCommon::$version < 1.7)
|
51 |
+
{
|
52 |
+
PDFGenerator::$gf_compatibility = 'pre 1.7';
|
53 |
+
}
|
54 |
+
|
55 |
+
/*
|
56 |
+
* Do configuration pre-processing
|
57 |
+
*/
|
58 |
+
|
59 |
+
/*
|
60 |
+
* Check if user configuration file exists
|
61 |
+
* If not disable $configuration and $index.
|
62 |
+
*/
|
63 |
+
if(!file_exists(PDF_TEMPLATE_LOCATION.'configuration.php'))
|
64 |
+
{
|
65 |
+
$this->disabled = true;
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
else
|
69 |
+
{
|
70 |
+
/*
|
71 |
+
* Include the configuration file and set up the configuration variable.
|
72 |
+
*/
|
73 |
+
require(PDF_TEMPLATE_LOCATION.'configuration.php');
|
74 |
+
/*
|
75 |
+
* $gf_pdf_config included from configuration.php file
|
76 |
+
*/
|
77 |
+
$this->configuration = (isset($gf_pdf_config)) ? $gf_pdf_config : array();
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->pdf_config();
|
81 |
+
}
|
82 |
+
|
83 |
+
/*
|
84 |
+
* Run through user configuration and set PDF options
|
85 |
+
*/
|
86 |
+
private function pdf_config()
|
87 |
+
{
|
88 |
+
if(sizeof($this->configuration) == 0)
|
89 |
+
{
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$this->set_form_pdfs();
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/*
|
98 |
+
* Set the configuration index so it's faster to access template configuration information
|
99 |
+
*/
|
100 |
+
private function set_form_pdfs()
|
101 |
+
{
|
102 |
+
foreach($this->configuration as $key => $config)
|
103 |
+
{
|
104 |
+
if(!is_array($config['form_id']))
|
105 |
+
{
|
106 |
+
$this->assign_index($config['form_id'], $key);
|
107 |
+
}
|
108 |
+
else
|
109 |
+
{
|
110 |
+
foreach($config['form_id'] as $id)
|
111 |
+
{
|
112 |
+
$this->assign_index($id, $key);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/*
|
120 |
+
* Check to see if ID is valid
|
121 |
+
* If so, assign ID => key to index
|
122 |
+
*/
|
123 |
+
protected function assign_index($id, $key)
|
124 |
+
{
|
125 |
+
$id = (int) $id;
|
126 |
+
if($id !== 0)
|
127 |
+
{
|
128 |
+
/*
|
129 |
+
* Assign the outter array with the form ID and the value as the configuration key
|
130 |
+
*/
|
131 |
+
$this->index[$id][] = $key;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
/*
|
136 |
+
* Searches the index for the configuration key
|
137 |
+
* Return: form PDF configuration
|
138 |
+
*/
|
139 |
+
public function get_config($id)
|
140 |
+
{
|
141 |
+
return (isset($this->index[$id])) ? $this->index[$id] : false;
|
142 |
+
}
|
143 |
+
|
144 |
+
/*
|
145 |
+
* Searches the index for the configuration key and once found return the real configuration
|
146 |
+
* Return: form PDF configuration
|
147 |
+
*/
|
148 |
+
public function get_config_data($form_id)
|
149 |
+
{
|
150 |
+
if(!isset($this->index[$form_id]))
|
151 |
+
{
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
|
155 |
+
$index = $this->index[$form_id];
|
156 |
+
|
157 |
+
/*
|
158 |
+
* Because it is the default template we can assume multiple indexes don't exist as this feature
|
159 |
+
* is something used to assign different templates to notifications in the same form
|
160 |
+
*/
|
161 |
+
return $this->configuration[$index[0]];
|
162 |
+
}
|
163 |
+
|
164 |
+
/*
|
165 |
+
* Search for the template from a given form id
|
166 |
+
* Return: the first template found for the form
|
167 |
+
* TODO: return all PDFs
|
168 |
+
*/
|
169 |
+
public function get_template($form_id)
|
170 |
+
{
|
171 |
+
$template = '';
|
172 |
+
|
173 |
+
if(isset($this->index[$form_id]))
|
174 |
+
{
|
175 |
+
/*
|
176 |
+
* Check if PDF template is avaliable
|
177 |
+
*/
|
178 |
+
if(isset($this->configuration[$this->index[$form_id][0]]['template']))
|
179 |
+
{
|
180 |
+
$user_template = (isset($_GET['template'])) ? $_GET['template'] : '';
|
181 |
+
$match = false;
|
182 |
+
|
183 |
+
foreach($this->index[$form_id] as $index)
|
184 |
+
{
|
185 |
+
if($this->configuration[$index]['template'] === $user_template)
|
186 |
+
{
|
187 |
+
$match = true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$template = ($match === true) ? $user_template : $this->configuration[$this->index[$form_id][0]]['template'];
|
192 |
+
}
|
193 |
+
|
194 |
+
if(strlen($template) == 0)
|
195 |
+
{
|
196 |
+
$template = PDFGenerator::$default['template'];
|
197 |
+
}
|
198 |
+
return $template;
|
199 |
+
}
|
200 |
+
|
201 |
+
if( (strlen($template) == 0) && (GFPDF_SET_DEFAULT_TEMPLATE === true))
|
202 |
+
{
|
203 |
+
/*
|
204 |
+
* If no PDF template exists then we will use $gf_pdf_default_configuration if it exists.
|
205 |
+
* If not, we will set the default
|
206 |
+
*/
|
207 |
+
global $gf_pdf_default_configuration;
|
208 |
+
|
209 |
+
/*
|
210 |
+
* Check if a default configuration is defined
|
211 |
+
*/
|
212 |
+
|
213 |
+
if(is_array($gf_pdf_default_configuration) && sizeof($gf_pdf_default_configuration) > 0 && isset($gf_pdf_default_configuration['template']))
|
214 |
+
{
|
215 |
+
return $gf_pdf_default_configuration['template'];
|
216 |
+
}
|
217 |
+
else
|
218 |
+
{
|
219 |
+
return PDFGenerator::$default['template'];
|
220 |
+
}
|
221 |
+
}
|
222 |
+
else
|
223 |
+
{
|
224 |
+
return false;
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
public function get_pdf_name($index, $form_id = false, $lead_id = false)
|
230 |
+
{
|
231 |
+
return PDF_Common::validate_pdf_name($this->configuration[$index]['filename'], $form_id, $lead_id);
|
232 |
+
}
|
233 |
+
|
234 |
+
public function validate_privileges($privs)
|
235 |
+
{
|
236 |
+
if(!is_array($privs))
|
237 |
+
{
|
238 |
+
return array();
|
239 |
+
}
|
240 |
+
|
241 |
+
$new_privs = array_filter($privs, array($this, 'array_filter_privilages'));
|
242 |
+
|
243 |
+
return $new_privs;
|
244 |
+
}
|
245 |
+
|
246 |
+
private function array_filter_privilages($i)
|
247 |
+
{
|
248 |
+
if(in_array($i, PDFGenerator::$allowed_privileges))
|
249 |
+
{
|
250 |
+
return true;
|
251 |
+
}
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
|
255 |
+
}
|
|
|
|
|
|
|
|
pdf-entry-detail.php
CHANGED
@@ -1,1172 +1,1137 @@
|
|
1 |
-
<?php
|
2 |
-
if(!class_exists('GFPDFEntryDetail'))
|
3 |
-
{
|
4 |
-
class GFPDFEntryDetail {
|
5 |
-
|
6 |
-
/* NEED THIS FUNCTION - BLD */
|
7 |
-
public static function
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$
|
168 |
-
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
179 |
-
break;
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
$
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
/*
|
417 |
-
$form_array['field'][$field['
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
}
|
441 |
-
|
442 |
-
$
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
'subtotal' => $subtotal);
|
486 |
-
}
|
487 |
-
$total += floatval($products["shipping"]["price"]);
|
488 |
-
|
489 |
-
/* add to form data */
|
490 |
-
$form_array['products_totals'] = array(
|
491 |
-
'shipping' => $products["shipping"]["price"],
|
492 |
-
'total' => $total
|
493 |
-
);
|
494 |
-
}
|
495 |
-
}
|
496 |
-
return $form_array;
|
497 |
-
}
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
public static function get_lead_field_display($field, $value, $currency="", $use_text=false, $format="html", $media="screen"){
|
502 |
-
|
503 |
-
if($field['type'] == 'post_category')
|
504 |
-
$value = self::prepare_post_category_value($value, $field);
|
505 |
-
|
506 |
-
switch(RGFormsModel::get_input_type($field)){
|
507 |
-
case "name" :
|
508 |
-
if(is_array($value)){
|
509 |
-
$prefix = trim(rgget($field["id"] . ".2", $value));
|
510 |
-
$first = trim(rgget($field["id"] . ".3", $value));
|
511 |
-
$last = trim(rgget($field["id"] . ".6", $value));
|
512 |
-
$suffix = trim(rgget($field["id"] . ".8", $value));
|
513 |
-
|
514 |
-
return array('prefix' => $prefix, 'first' => $first, 'last' => $last, 'suffix' => $suffix);
|
515 |
-
}
|
516 |
-
else{
|
517 |
-
return $value;
|
518 |
-
}
|
519 |
-
|
520 |
-
break;
|
521 |
-
case "creditcard" :
|
522 |
-
if(is_array($value)){
|
523 |
-
$card_number = trim(rgget($field["id"] . ".1", $value));
|
524 |
-
$card_type = trim(rgget($field["id"] . ".4", $value));
|
525 |
-
$separator = $format == "html" ? "<br/>" : "\n";
|
526 |
-
return empty($card_number) ? "" : $card_type . $separator . $card_number;
|
527 |
-
}
|
528 |
-
else{
|
529 |
-
return "";
|
530 |
-
}
|
531 |
-
break;
|
532 |
-
|
533 |
-
case "address" :
|
534 |
-
if(is_array($value)){
|
535 |
-
$street_value = trim(rgget($field["id"] . ".1", $value));
|
536 |
-
$street2_value = trim(rgget($field["id"] . ".2", $value));
|
537 |
-
$city_value = trim(rgget($field["id"] . ".3", $value));
|
538 |
-
$state_value = trim(rgget($field["id"] . ".4", $value));
|
539 |
-
$zip_value = trim(rgget($field["id"] . ".5", $value));
|
540 |
-
$country_value = trim(rgget($field["id"] . ".6", $value));
|
541 |
-
|
542 |
-
$line_break = $format == "html" ? "<br />" : "\n";
|
543 |
-
|
544 |
-
$address_display_format = apply_filters("gform_address_display_format", "default");
|
545 |
-
|
546 |
-
$address['street'] = $street_value;
|
547 |
-
$address['street2'] = $street2_value;
|
548 |
-
$address['city'] = $city_value;
|
549 |
-
$address['state'] = $state_value;
|
550 |
-
$address['zip'] = $zip_value;
|
551 |
-
$address['country'] = $country_value;
|
552 |
-
|
553 |
-
return $address;
|
554 |
-
}
|
555 |
-
else{
|
556 |
-
return "";
|
557 |
-
}
|
558 |
-
break;
|
559 |
-
|
560 |
-
case "email" :
|
561 |
-
return GFCommon::is_valid_email($value) && $format == "html" ? $value : $value;
|
562 |
-
break;
|
563 |
-
|
564 |
-
case "website" :
|
565 |
-
return GFCommon::is_valid_url($value) && $format == "html" ? $value : $value;
|
566 |
-
break;
|
567 |
-
|
568 |
-
case "checkbox" :
|
569 |
-
if(is_array($value)){
|
570 |
-
|
571 |
-
$items = array();
|
572 |
-
|
573 |
-
foreach($value as $key => $item){
|
574 |
-
if(!empty($item)){
|
575 |
-
switch($format){
|
576 |
-
case "text" :
|
577 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
578 |
-
break;
|
579 |
-
|
580 |
-
default:
|
581 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
582 |
-
break;
|
583 |
-
}
|
584 |
-
}
|
585 |
-
}
|
586 |
-
if(empty($items)){
|
587 |
-
return "";
|
588 |
-
}
|
589 |
-
else if($format == "text"){
|
590 |
-
/*return substr($items, 0, strlen($items)-2); //removing last comma*/
|
591 |
-
}
|
592 |
-
else{
|
593 |
-
return $items;
|
594 |
-
}
|
595 |
-
}
|
596 |
-
else{
|
597 |
-
return $value;
|
598 |
-
}
|
599 |
-
break;
|
600 |
-
|
601 |
-
case "post_image" :
|
602 |
-
$ary = explode("|:|", $value);
|
603 |
-
$url = count($ary) > 0 ? $ary[0] : "";
|
604 |
-
$title = count($ary) > 1 ? $ary[1] : "";
|
605 |
-
$caption = count($ary) > 2 ? $ary[2] : "";
|
606 |
-
$description = count($ary) > 3 ? $ary[3] : "";
|
607 |
-
|
608 |
-
if(!empty($url)){
|
609 |
-
$url = str_replace(" ", "%20", $url);
|
610 |
-
|
611 |
-
$value = array('url' => $url,
|
612 |
-
'path' => str_replace(site_url().'/', ABSPATH, $url),
|
613 |
-
'title' => $title,
|
614 |
-
'caption' => $caption,
|
615 |
-
'description' => $description);
|
616 |
-
}
|
617 |
-
return $value;
|
618 |
-
|
619 |
-
case "fileupload" :
|
620 |
-
$file_path = $value;
|
621 |
-
if(!empty($file_path)){
|
622 |
-
$info = pathinfo($file_path);
|
623 |
-
$file_path = esc_attr(str_replace(" ", "%20", $file_path));
|
624 |
-
$value = $file_path;
|
625 |
-
}
|
626 |
-
return $value;
|
627 |
-
break;
|
628 |
-
|
629 |
-
case "date" :
|
630 |
-
return GFCommon::date_display($value, rgar($field, "dateFormat"));
|
631 |
-
break;
|
632 |
-
|
633 |
-
case "radio" :
|
634 |
-
case "select" :
|
635 |
-
return GFCommon::selection_display($value, $field, $currency, $use_text);
|
636 |
-
break;
|
637 |
-
|
638 |
-
case "multiselect" :
|
639 |
-
if(empty($value) || $format == "text")
|
640 |
-
return $value;
|
641 |
-
|
642 |
-
$value = explode(",", $value);
|
643 |
-
|
644 |
-
$items = '';
|
645 |
-
foreach($value as $item){
|
646 |
-
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
647 |
-
}
|
648 |
-
|
649 |
-
if(sizeof($items) == 1)
|
650 |
-
{
|
651 |
-
return $items[0];
|
652 |
-
}
|
653 |
-
return $items;
|
654 |
-
|
655 |
-
|
656 |
-
break;
|
657 |
-
|
658 |
-
case "calculation" :
|
659 |
-
case "singleproduct" :
|
660 |
-
if(is_array($value)){
|
661 |
-
$product_name = trim($value[$field["id"] . ".1"]);
|
662 |
-
$price = trim($value[$field["id"] . ".2"]);
|
663 |
-
$quantity = trim($value[$field["id"] . ".3"]);
|
664 |
-
|
665 |
-
$product = $product_name . ", " . __("Qty: ", "gravityforms") . $quantity . ", " . __("Price: ", "gravityforms") . $price;
|
666 |
-
return $product;
|
667 |
-
}
|
668 |
-
else{
|
669 |
-
return "";
|
670 |
-
}
|
671 |
-
break;
|
672 |
-
|
673 |
-
case "number" :
|
674 |
-
return GFCommon::format_number($value, rgar($field, "numberFormat"));
|
675 |
break;
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
$
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
$
|
984 |
-
$
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
break;
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
$
|
1018 |
-
|
1019 |
-
$
|
1020 |
-
|
1021 |
-
$
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
{
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1172 |
}
|
1 |
+
<?php
|
2 |
+
if(!class_exists('GFPDFEntryDetail'))
|
3 |
+
{
|
4 |
+
class GFPDFEntryDetail {
|
5 |
+
|
6 |
+
/* NEED THIS FUNCTION - BLD */
|
7 |
+
public static function lead_detail_grid($form, $lead, $allow_display_empty_fields=false, $show_html=false, $show_page_name=false, $return=false){
|
8 |
+
$form_id = $form["id"];
|
9 |
+
$results = array();
|
10 |
+
|
11 |
+
if($return === true)
|
12 |
+
{
|
13 |
+
$results['title'] = '<h2 id="details" class="default">'. $form["title"] .'</h2>';
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
?>
|
18 |
+
<div id="container">
|
19 |
+
<h2 id="details" class="default"><?php echo $form["title"]?></h2>
|
20 |
+
<?php
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
$count = 0;
|
25 |
+
$field_count = sizeof($form["fields"]);
|
26 |
+
|
27 |
+
$has_product_fields = false;
|
28 |
+
|
29 |
+
$page_number = 0;
|
30 |
+
foreach($form["fields"] as $field) {
|
31 |
+
|
32 |
+
/*
|
33 |
+
* Check if we are to show the page names
|
34 |
+
*/
|
35 |
+
if($show_page_name === true)
|
36 |
+
{
|
37 |
+
if((int) $field['pageNumber'] !== $page_number)
|
38 |
+
{
|
39 |
+
/*
|
40 |
+
* Display the page number
|
41 |
+
*/
|
42 |
+
if($return === true)
|
43 |
+
{
|
44 |
+
$results['field'][] = '<h2 class="default entry-view-page-break">'. $form['pagination']['pages'][$page_number] .'</h2>';
|
45 |
+
}
|
46 |
+
else
|
47 |
+
{
|
48 |
+
?>
|
49 |
+
<h2 class="default entry-view-page-break"><?php echo $form['pagination']['pages'][$page_number]; ?></h2>
|
50 |
+
<?php
|
51 |
+
}
|
52 |
+
/*
|
53 |
+
* Increment the page number
|
54 |
+
*/
|
55 |
+
$page_number++;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
$even = $odd = '';
|
60 |
+
switch(RGFormsModel::get_input_type($field)){
|
61 |
+
case "section" :
|
62 |
+
|
63 |
+
if(!GFCommon::is_section_empty($field, $form, $lead) || $allow_display_empty_fields){
|
64 |
+
$count++;
|
65 |
+
$is_last = $count >= $field_count ? true : false;
|
66 |
+
|
67 |
+
if($results === true)
|
68 |
+
{
|
69 |
+
$results['field'][] = '<h2 class="default entry-view-section-break'. $is_last ? " lastrow" : "" .'">'. esc_html(GFCommon::get_label($field)) .'</h2>';
|
70 |
+
}
|
71 |
+
else
|
72 |
+
{
|
73 |
+
?>
|
74 |
+
<h2 class="default entry-view-section-break<?php echo $is_last ? " lastrow" : ""?>"><?php echo esc_html(GFCommon::get_label($field))?></h2>
|
75 |
+
<?php
|
76 |
+
}
|
77 |
+
}
|
78 |
+
break;
|
79 |
+
|
80 |
+
case "captcha":
|
81 |
+
case "password":
|
82 |
+
case "page":
|
83 |
+
//ignore captcha, html, password, page field
|
84 |
+
break;
|
85 |
+
case "html":
|
86 |
+
if($show_html == true)
|
87 |
+
{
|
88 |
+
|
89 |
+
$count++;
|
90 |
+
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
91 |
+
$last_row = $is_last ? " lastrow" : "";
|
92 |
+
$even = ($count%2) ? ' odd' : ' even';
|
93 |
+
|
94 |
+
$display_value = wpautop($field['content']);
|
95 |
+
|
96 |
+
$content = '<div class="entry-view-field-value' . $last_row . $even . '"><div class="value">' . $display_value . '</div></div>';
|
97 |
+
$content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
|
98 |
+
|
99 |
+
if($return === true)
|
100 |
+
{
|
101 |
+
$results['field'][] = $content;
|
102 |
+
}
|
103 |
+
else
|
104 |
+
{
|
105 |
+
echo $content;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
break;
|
109 |
+
case "signature":
|
110 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
111 |
+
$public_folder = RGFormsModel::get_upload_url_root() . 'signatures/';
|
112 |
+
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
113 |
+
$display_value = '<img src="'. $server_folder.$value .'" alt="Signature" width="100" height="60" />';
|
114 |
+
$is_last = $count >= $field_count ? true : false;
|
115 |
+
$last_row = $is_last ? " lastrow" : "";
|
116 |
+
|
117 |
+
if(strlen($value) > 0 && (file_exists($server_folder.$value)) && (is_dir($server_folder.$value) !== true) )
|
118 |
+
{
|
119 |
+
$content = '<div class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div> ';
|
120 |
+
|
121 |
+
if($return === true)
|
122 |
+
{
|
123 |
+
$results['field'][] = $content;
|
124 |
+
}
|
125 |
+
else
|
126 |
+
{
|
127 |
+
echo $content;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
elseif($allow_display_empty_fields)
|
131 |
+
{
|
132 |
+
if($return === true)
|
133 |
+
{
|
134 |
+
$results['field'][] = '<div class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div></div>';
|
135 |
+
}
|
136 |
+
else
|
137 |
+
{
|
138 |
+
print '<div class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div></div>';
|
139 |
+
}
|
140 |
+
|
141 |
+
}
|
142 |
+
break;
|
143 |
+
|
144 |
+
default:
|
145 |
+
|
146 |
+
//ignore product fields as they will be grouped together at the end of the grid
|
147 |
+
if(GFCommon::is_product_field($field["type"])){
|
148 |
+
$has_product_fields = true;
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
|
152 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
153 |
+
$display_value = self::pdf_get_lead_field_display($field, $value, $lead["currency"]);
|
154 |
+
|
155 |
+
$display_value = apply_filters("gform_entry_field_value", $display_value, $field, $lead, $form);
|
156 |
+
|
157 |
+
if( !empty($display_value) || $display_value === "0" || $allow_display_empty_fields){
|
158 |
+
$count++;
|
159 |
+
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
160 |
+
$last_row = $is_last ? " lastrow" : "";
|
161 |
+
$even = ($count%2) ? ' odd' : ' even';
|
162 |
+
|
163 |
+
$display_value = empty($display_value) && $display_value !== "0" ? " " : $display_value;
|
164 |
+
|
165 |
+
$content = '<div class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div>';
|
166 |
+
|
167 |
+
$content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
|
168 |
+
|
169 |
+
if($return === true)
|
170 |
+
{
|
171 |
+
$results['field'][] = $content;
|
172 |
+
}
|
173 |
+
else
|
174 |
+
{
|
175 |
+
echo $content;
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
|
182 |
+
}
|
183 |
+
$products = array();
|
184 |
+
if($has_product_fields){
|
185 |
+
if($return === true)
|
186 |
+
{
|
187 |
+
ob_start();
|
188 |
+
self::product_table($form, $lead);
|
189 |
+
$results['field'][] = ob_get_contents();
|
190 |
+
ob_end_clean();
|
191 |
+
}
|
192 |
+
else
|
193 |
+
{
|
194 |
+
self::product_table($form, $lead);
|
195 |
+
}
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
if($return === true)
|
200 |
+
{
|
201 |
+
return $results;
|
202 |
+
}
|
203 |
+
?>
|
204 |
+
</div>
|
205 |
+
<?php
|
206 |
+
}
|
207 |
+
|
208 |
+
public static function product_table($form, $lead)
|
209 |
+
{
|
210 |
+
$products = GFCommon::get_product_fields($form, $lead, true);
|
211 |
+
|
212 |
+
$form_id = $form['id'];
|
213 |
+
if(!empty($products["products"])){
|
214 |
+
?>
|
215 |
+
|
216 |
+
<h2 class="default entry-view-field-name"><?php echo apply_filters("gform_order_label_{$form["id"]}", apply_filters("gform_order_label", __("Order", "gravityforms"), $form["id"]), $form["id"]) ?></h2>
|
217 |
+
|
218 |
+
<table class="entry-products" autosize="1" cellspacing="0" width="97%">
|
219 |
+
<colgroup>
|
220 |
+
<col class="entry-products-col1" />
|
221 |
+
<col class="entry-products-col2" />
|
222 |
+
<col class="entry-products-col3" />
|
223 |
+
<col class="entry-products-col4" />
|
224 |
+
</colgroup>
|
225 |
+
<thead>
|
226 |
+
<tr>
|
227 |
+
<th scope="col"><?php echo apply_filters("gform_product_{$form_id}", apply_filters("gform_product", __("Product", "gravityforms"), $form_id), $form_id) ?></th>
|
228 |
+
<th scope="col" class="textcenter"><?php echo apply_filters("gform_product_qty_{$form_id}", apply_filters("gform_product_qty", __("Qty", "gravityforms"), $form_id), $form_id) ?></th>
|
229 |
+
<th scope="col"><?php echo apply_filters("gform_product_unitprice_{$form_id}", apply_filters("gform_product_unitprice", __("Unit Price", "gravityforms"), $form_id), $form_id) ?></th>
|
230 |
+
<th scope="col"><?php echo apply_filters("gform_product_price_{$form_id}", apply_filters("gform_product_price", __("Price", "gravityforms"), $form_id), $form_id) ?></th>
|
231 |
+
</tr>
|
232 |
+
</thead>
|
233 |
+
<tbody>
|
234 |
+
<?php
|
235 |
+
|
236 |
+
$total = 0;
|
237 |
+
foreach($products["products"] as $product){
|
238 |
+
?>
|
239 |
+
<tr>
|
240 |
+
<td>
|
241 |
+
<div class="product_name"><?php echo esc_html($product["name"])?></div>
|
242 |
+
|
243 |
+
<?php
|
244 |
+
$price = GFCommon::to_number($product["price"]);
|
245 |
+
if(is_array(rgar($product,"options"))){
|
246 |
+
echo '<ul class="product_options">';
|
247 |
+
$count = sizeof($product["options"]);
|
248 |
+
$index = 1;
|
249 |
+
foreach($product["options"] as $option){
|
250 |
+
$price += GFCommon::to_number($option["price"]);
|
251 |
+
$class = $index == $count ? " class='lastitem'" : "";
|
252 |
+
$index++;
|
253 |
+
?>
|
254 |
+
<li<?php echo $class?>><?php echo $option["option_label"]?></li>
|
255 |
+
<?php
|
256 |
+
}
|
257 |
+
echo '</ul>';
|
258 |
+
}
|
259 |
+
$subtotal = floatval($product["quantity"]) * $price;
|
260 |
+
$total += $subtotal;
|
261 |
+
?>
|
262 |
+
|
263 |
+
</td>
|
264 |
+
<td class="textcenter"><?php echo $product["quantity"] ?></td>
|
265 |
+
<td><?php echo GFCommon::to_money($price, $lead["currency"]) ?></td>
|
266 |
+
<td><?php echo GFCommon::to_money($subtotal, $lead["currency"]) ?></td>
|
267 |
+
</tr>
|
268 |
+
<?php
|
269 |
+
}
|
270 |
+
$total += floatval($products["shipping"]["price"]);
|
271 |
+
?>
|
272 |
+
|
273 |
+
|
274 |
+
<?php
|
275 |
+
if(!empty($products["shipping"]["name"])){
|
276 |
+
?>
|
277 |
+
<tr>
|
278 |
+
<td colspan="2" rowspan="2" class="emptycell"> </td>
|
279 |
+
<td class="textright shipping"><?php echo $products["shipping"]["name"] ?></td>
|
280 |
+
<td class="shipping_amount"><?php echo GFCommon::to_money($products["shipping"]["price"], $lead["currency"])?> </td>
|
281 |
+
</tr>
|
282 |
+
<?php
|
283 |
+
}
|
284 |
+
?>
|
285 |
+
<tr>
|
286 |
+
<?php
|
287 |
+
if(empty($products["shipping"]["name"])){
|
288 |
+
?>
|
289 |
+
<td colspan="2" class="emptycell"> </td>
|
290 |
+
<?php
|
291 |
+
}
|
292 |
+
?>
|
293 |
+
<td class="textright grandtotal"><?php _e("Total", "gravityforms") ?></td>
|
294 |
+
<td class="grandtotal_amount"><?php echo GFCommon::to_money($total, $lead["currency"])?></td>
|
295 |
+
</tr>
|
296 |
+
</tbody>
|
297 |
+
|
298 |
+
</table>
|
299 |
+
|
300 |
+
<?php
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
public static function format_date($date, $usa = false)
|
305 |
+
{
|
306 |
+
$timestamp = strtotime($date);
|
307 |
+
$new_date = (!$usa) ? date('j/n/Y', $timestamp) : date('n/j/Y', $timestamp);
|
308 |
+
return $new_date;
|
309 |
+
}
|
310 |
+
|
311 |
+
/* returns the form values as an array instead of pre-formated html */
|
312 |
+
public static function lead_detail_grid_array($form, $lead, $allow_display_empty_fields=false){
|
313 |
+
$form_id = $form["id"];
|
314 |
+
$display_empty_fields = false;
|
315 |
+
if($allow_display_empty_fields){
|
316 |
+
$display_empty_fields = rgget("gf_display_empty_fields", $_COOKIE);
|
317 |
+
}
|
318 |
+
|
319 |
+
/*
|
320 |
+
* Add form_id and lead_id
|
321 |
+
*/
|
322 |
+
$form_array['form_id'] = $form_id;
|
323 |
+
$form_array['entry_id'] = $lead['id'];
|
324 |
+
|
325 |
+
$form_array['form_title'] = $form['title'];
|
326 |
+
$form_array['date_created'] = self::format_date($lead['date_created']);
|
327 |
+
$form_array['date_created_usa'] = self::format_date($lead['date_created'], true);
|
328 |
+
|
329 |
+
$count = 0;
|
330 |
+
$field_count = sizeof($form["fields"]);
|
331 |
+
$has_product_fields = false;
|
332 |
+
|
333 |
+
foreach($form["fields"] as $field){
|
334 |
+
$display = '';
|
335 |
+
|
336 |
+
switch(RGFormsModel::get_input_type($field)){
|
337 |
+
case "section" :
|
338 |
+
break;
|
339 |
+
|
340 |
+
case "captcha":
|
341 |
+
case "html":
|
342 |
+
$form_array['html'][] = wpautop($field['content']);
|
343 |
+
case "password":
|
344 |
+
case "page":
|
345 |
+
//ignore captcha, html, password, page field
|
346 |
+
break;
|
347 |
+
case "signature":
|
348 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
349 |
+
$http_folder = RGFormsModel::get_upload_url_root(). 'signatures/';;
|
350 |
+
$folder = RGFormsModel::get_upload_root() . 'signatures/';
|
351 |
+
|
352 |
+
if(file_exists($folder.$value) !== false && is_dir($folder.$value) !== true)
|
353 |
+
{
|
354 |
+
$form_array['signature'][] = '<img src="'. $folder.$value .'" alt="Signature" width="100" height="60" />';
|
355 |
+
$form_array['signature_details'][] = array('img' => '<img src="'. $folder.$value .'" alt="Signature" width="100" height="60" />',
|
356 |
+
'path' => $folder.$value,
|
357 |
+
'url' => $http_folder.$value);
|
358 |
+
$form_array['signature_details_id'][$field['id']] = array('img' => '<img src="'. $folder.$value .'" alt="Signature" width="100" height="60" />',
|
359 |
+
'path' => $folder.$value,
|
360 |
+
'url' => $http_folder.$value);
|
361 |
+
}
|
362 |
+
|
363 |
+
/*$count++;*/
|
364 |
+
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
365 |
+
$last_row = $is_last ? " lastrow" : "";
|
366 |
+
break;
|
367 |
+
case "fileupload":
|
368 |
+
|
369 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
370 |
+
$display = self::get_lead_field_display($field, $value, $lead["currency"]);
|
371 |
+
|
372 |
+
/*
|
373 |
+
* Get the absolute path to the upload
|
374 |
+
*/
|
375 |
+
$path = str_replace(home_url().'/', ABSPATH, $display);
|
376 |
+
|
377 |
+
/* add path */
|
378 |
+
$form_array['field'][$field['id'].'_path'] = $path;
|
379 |
+
$form_array['field'][$field['id'].'.'.$field['label'].'_path'] = $path;
|
380 |
+
|
381 |
+
/* add data to field tag correctly */
|
382 |
+
$form_array['field'][$field['id'].'.'.$field['label']] = $display;
|
383 |
+
|
384 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
385 |
+
$form_array['field'][$field['id']] = $display;
|
386 |
+
|
387 |
+
/* keep backwards compatibility */
|
388 |
+
$form_array['field'][$field['label']] = $display;
|
389 |
+
|
390 |
+
|
391 |
+
break;
|
392 |
+
case "list":
|
393 |
+
/*
|
394 |
+
* We want list to run both this and the deafult so don't call break.
|
395 |
+
* Get the list array and store it outside of [field]
|
396 |
+
*/
|
397 |
+
$value = unserialize(RGFormsModel::get_lead_field_value($lead, $field));
|
398 |
+
$form_array['list'][] = $value;
|
399 |
+
|
400 |
+
default:
|
401 |
+
//ignore product fields as they will be grouped together at the end of the grid
|
402 |
+
if(GFCommon::is_product_field($field["type"])){
|
403 |
+
$has_product_fields = true;
|
404 |
+
continue;
|
405 |
+
}
|
406 |
+
|
407 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
408 |
+
|
409 |
+
$display = self::get_lead_field_display($field, $value, $lead["currency"]);
|
410 |
+
/* add data to field tag correctly */
|
411 |
+
$form_array['field'][$field['id'].'.'.$field['label']] = $display;
|
412 |
+
|
413 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
414 |
+
$form_array['field'][$field['id']] = $display;
|
415 |
+
|
416 |
+
/* keep backwards compatibility */
|
417 |
+
$form_array['field'][$field['label']] = $display;
|
418 |
+
|
419 |
+
break;
|
420 |
+
}
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
$products = array();
|
425 |
+
if($has_product_fields){
|
426 |
+
$products = GFCommon::get_product_fields($form, $lead, true);
|
427 |
+
if(!empty($products["products"])){
|
428 |
+
$total = 0;
|
429 |
+
$subtotal = 0;
|
430 |
+
foreach($products["products"] as $product) {
|
431 |
+
$price = GFCommon::to_number($product["price"]);
|
432 |
+
|
433 |
+
if(is_array(rgar($product,"options"))){
|
434 |
+
$count = sizeof($product["options"]);
|
435 |
+
$index = 1;
|
436 |
+
foreach($product["options"] as $option){
|
437 |
+
$price += GFCommon::to_number($option["price"]);
|
438 |
+
$index++;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
/* calculate subtotal */
|
442 |
+
$subtotal = floatval($product["quantity"]) * $price;
|
443 |
+
$total += $subtotal;
|
444 |
+
|
445 |
+
$form_array['products'][] = array(
|
446 |
+
'name' => esc_html($product['name']),
|
447 |
+
'price' => esc_html($product['price']),
|
448 |
+
'options' => $product['options'],
|
449 |
+
'quantity' => $product["quantity"],
|
450 |
+
'subtotal' => $subtotal);
|
451 |
+
}
|
452 |
+
$total += floatval($products["shipping"]["price"]);
|
453 |
+
|
454 |
+
/* add to form data */
|
455 |
+
$form_array['products_totals'] = array(
|
456 |
+
'shipping' => $products["shipping"]["price"],
|
457 |
+
'total' => $total
|
458 |
+
);
|
459 |
+
}
|
460 |
+
}
|
461 |
+
return $form_array;
|
462 |
+
}
|
463 |
+
|
464 |
+
|
465 |
+
|
466 |
+
public static function get_lead_field_display($field, $value, $currency="", $use_text=false, $format="html", $media="screen"){
|
467 |
+
|
468 |
+
if($field['type'] == 'post_category')
|
469 |
+
$value = self::prepare_post_category_value($value, $field);
|
470 |
+
|
471 |
+
switch(RGFormsModel::get_input_type($field)){
|
472 |
+
case "name" :
|
473 |
+
if(is_array($value)){
|
474 |
+
$prefix = trim(rgget($field["id"] . ".2", $value));
|
475 |
+
$first = trim(rgget($field["id"] . ".3", $value));
|
476 |
+
$last = trim(rgget($field["id"] . ".6", $value));
|
477 |
+
$suffix = trim(rgget($field["id"] . ".8", $value));
|
478 |
+
|
479 |
+
return array('prefix' => $prefix, 'first' => $first, 'last' => $last, 'suffix' => $suffix);
|
480 |
+
}
|
481 |
+
else{
|
482 |
+
return $value;
|
483 |
+
}
|
484 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
break;
|
486 |
+
case "creditcard" :
|
487 |
+
if(is_array($value)){
|
488 |
+
$card_number = trim(rgget($field["id"] . ".1", $value));
|
489 |
+
$card_type = trim(rgget($field["id"] . ".4", $value));
|
490 |
+
$separator = $format == "html" ? "<br/>" : "\n";
|
491 |
+
return empty($card_number) ? "" : $card_type . $separator . $card_number;
|
492 |
+
}
|
493 |
+
else{
|
494 |
+
return "";
|
495 |
+
}
|
496 |
+
break;
|
497 |
+
|
498 |
+
case "address" :
|
499 |
+
if(is_array($value)){
|
500 |
+
$street_value = trim(rgget($field["id"] . ".1", $value));
|
501 |
+
$street2_value = trim(rgget($field["id"] . ".2", $value));
|
502 |
+
$city_value = trim(rgget($field["id"] . ".3", $value));
|
503 |
+
$state_value = trim(rgget($field["id"] . ".4", $value));
|
504 |
+
$zip_value = trim(rgget($field["id"] . ".5", $value));
|
505 |
+
$country_value = trim(rgget($field["id"] . ".6", $value));
|
506 |
+
|
507 |
+
$line_break = $format == "html" ? "<br />" : "\n";
|
508 |
+
|
509 |
+
$address_display_format = apply_filters("gform_address_display_format", "default");
|
510 |
+
|
511 |
+
$address['street'] = $street_value;
|
512 |
+
$address['street2'] = $street2_value;
|
513 |
+
$address['city'] = $city_value;
|
514 |
+
$address['state'] = $state_value;
|
515 |
+
$address['zip'] = $zip_value;
|
516 |
+
$address['country'] = $country_value;
|
517 |
+
|
518 |
+
return $address;
|
519 |
+
}
|
520 |
+
else{
|
521 |
+
return "";
|
522 |
+
}
|
523 |
+
break;
|
524 |
+
|
525 |
+
case "email" :
|
526 |
+
return GFCommon::is_valid_email($value) && $format == "html" ? $value : $value;
|
527 |
+
break;
|
528 |
+
|
529 |
+
case "website" :
|
530 |
+
return GFCommon::is_valid_url($value) && $format == "html" ? $value : $value;
|
531 |
+
break;
|
532 |
+
|
533 |
+
case "checkbox" :
|
534 |
+
if(is_array($value)){
|
535 |
+
|
536 |
+
$items = array();
|
537 |
+
|
538 |
+
foreach($value as $key => $item){
|
539 |
+
if(!empty($item)){
|
540 |
+
switch($format){
|
541 |
+
case "text" :
|
542 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
543 |
+
break;
|
544 |
+
|
545 |
+
default:
|
546 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
547 |
+
break;
|
548 |
+
}
|
549 |
+
}
|
550 |
+
}
|
551 |
+
if(empty($items)){
|
552 |
+
return "";
|
553 |
+
}
|
554 |
+
else if($format == "text"){
|
555 |
+
/*return substr($items, 0, strlen($items)-2); //removing last comma*/
|
556 |
+
}
|
557 |
+
else{
|
558 |
+
return $items;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
else{
|
562 |
+
return $value;
|
563 |
+
}
|
564 |
+
break;
|
565 |
+
|
566 |
+
case "post_image" :
|
567 |
+
$ary = explode("|:|", $value);
|
568 |
+
$url = count($ary) > 0 ? $ary[0] : "";
|
569 |
+
$title = count($ary) > 1 ? $ary[1] : "";
|
570 |
+
$caption = count($ary) > 2 ? $ary[2] : "";
|
571 |
+
$description = count($ary) > 3 ? $ary[3] : "";
|
572 |
+
|
573 |
+
if(!empty($url)){
|
574 |
+
$url = str_replace(" ", "%20", $url);
|
575 |
+
|
576 |
+
$value = array('url' => $url,
|
577 |
+
'path' => str_replace(site_url().'/', ABSPATH, $url),
|
578 |
+
'title' => $title,
|
579 |
+
'caption' => $caption,
|
580 |
+
'description' => $description);
|
581 |
+
}
|
582 |
+
return $value;
|
583 |
+
|
584 |
+
case "fileupload" :
|
585 |
+
$file_path = $value;
|
586 |
+
if(!empty($file_path)){
|
587 |
+
$info = pathinfo($file_path);
|
588 |
+
$file_path = esc_attr(str_replace(" ", "%20", $file_path));
|
589 |
+
$value = $file_path;
|
590 |
+
}
|
591 |
+
return $value;
|
592 |
+
break;
|
593 |
+
|
594 |
+
case "date" :
|
595 |
+
return GFCommon::date_display($value, rgar($field, "dateFormat"));
|
596 |
+
break;
|
597 |
+
|
598 |
+
case "radio" :
|
599 |
+
case "select" :
|
600 |
+
return GFCommon::selection_display($value, $field, $currency, $use_text);
|
601 |
+
break;
|
602 |
+
|
603 |
+
case "multiselect" :
|
604 |
+
if(empty($value) || $format == "text")
|
605 |
+
return $value;
|
606 |
+
|
607 |
+
$value = explode(",", $value);
|
608 |
+
|
609 |
+
$items = '';
|
610 |
+
foreach($value as $item){
|
611 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
612 |
+
}
|
613 |
+
|
614 |
+
if(sizeof($items) == 1)
|
615 |
+
{
|
616 |
+
return $items[0];
|
617 |
+
}
|
618 |
+
return $items;
|
619 |
+
|
620 |
+
|
621 |
+
break;
|
622 |
+
|
623 |
+
case "calculation" :
|
624 |
+
case "singleproduct" :
|
625 |
+
if(is_array($value)){
|
626 |
+
$product_name = trim($value[$field["id"] . ".1"]);
|
627 |
+
$price = trim($value[$field["id"] . ".2"]);
|
628 |
+
$quantity = trim($value[$field["id"] . ".3"]);
|
629 |
+
|
630 |
+
$product = $product_name . ", " . __("Qty: ", "gravityforms") . $quantity . ", " . __("Price: ", "gravityforms") . $price;
|
631 |
+
return $product;
|
632 |
+
}
|
633 |
+
else{
|
634 |
+
return "";
|
635 |
+
}
|
636 |
+
break;
|
637 |
+
|
638 |
+
case "number" :
|
639 |
+
return GFCommon::format_number($value, rgar($field, "numberFormat"));
|
640 |
+
break;
|
641 |
+
|
642 |
+
case "singleshipping" :
|
643 |
+
case "donation" :
|
644 |
+
case "total" :
|
645 |
+
case "price" :
|
646 |
+
return GFCommon::to_money($value, $currency);
|
647 |
+
|
648 |
+
case "list" :
|
649 |
+
if(empty($value))
|
650 |
+
return "";
|
651 |
+
$value = unserialize($value);
|
652 |
+
|
653 |
+
$has_columns = is_array($value[0]);
|
654 |
+
|
655 |
+
if(!$has_columns){
|
656 |
+
$items = array();
|
657 |
+
foreach($value as $key => $item){
|
658 |
+
if(!empty($item)){
|
659 |
+
switch($format){
|
660 |
+
case "text" :
|
661 |
+
$items[] = $item;
|
662 |
+
break;
|
663 |
+
case "url" :
|
664 |
+
$items[] = $item;
|
665 |
+
break;
|
666 |
+
default :
|
667 |
+
if($media == "email"){
|
668 |
+
$items[] = $item;
|
669 |
+
}
|
670 |
+
else{
|
671 |
+
$items[] = $item;
|
672 |
+
}
|
673 |
+
break;
|
674 |
+
}
|
675 |
+
}
|
676 |
+
}
|
677 |
+
|
678 |
+
if(empty($items)){
|
679 |
+
return "";
|
680 |
+
}
|
681 |
+
else if($format == "text"){
|
682 |
+
/* return substr($items, 0, strlen($items)-2); //removing last comma*/
|
683 |
+
return $items;
|
684 |
+
}
|
685 |
+
else if($format == "url"){
|
686 |
+
/*return substr($items, 0, strlen($items)-1); //removing last comma*/
|
687 |
+
return $items;
|
688 |
+
}
|
689 |
+
else if($media == "email"){
|
690 |
+
return $items;
|
691 |
+
}
|
692 |
+
else{
|
693 |
+
return $items;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
else if(is_array($value)){
|
697 |
+
$columns = array_keys($value[0]);
|
698 |
+
|
699 |
+
$list = "";
|
700 |
+
|
701 |
+
switch($format){
|
702 |
+
case "text" :
|
703 |
+
$is_first_row = true;
|
704 |
+
foreach($value as $item){
|
705 |
+
if(!$is_first_row)
|
706 |
+
$list .= "\n\n" . $field["label"] . ": ";
|
707 |
+
$list .= implode(",", array_values($item));
|
708 |
+
|
709 |
+
$is_first_row = false;
|
710 |
+
}
|
711 |
+
break;
|
712 |
+
|
713 |
+
case "url" :
|
714 |
+
foreach($value as $item){
|
715 |
+
$list .= implode("|", array_values($item)) . ",";
|
716 |
+
}
|
717 |
+
if(!empty($list))
|
718 |
+
$list = substr($list, 0, strlen($list)-1);
|
719 |
+
break;
|
720 |
+
|
721 |
+
default :
|
722 |
+
if($media == "email"){
|
723 |
+
$list = "<table autosize='1' class='gfield_list' style='border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%'><thead><tr>";
|
724 |
+
|
725 |
+
//reading columns from entry data
|
726 |
+
foreach($columns as $column){
|
727 |
+
$list .= "<th style='background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left'>" . esc_html($column) . "</th>";
|
728 |
+
}
|
729 |
+
$list .= "</tr></thead>";
|
730 |
+
|
731 |
+
$list .= "<tbody style='background-color: #F9F9F9'>";
|
732 |
+
foreach($value as $item){
|
733 |
+
$list .= "<tr>";
|
734 |
+
foreach($columns as $column){
|
735 |
+
$val = rgar($item, $column);
|
736 |
+
$list .= "<td style='padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;'>{$val}</td>";
|
737 |
+
}
|
738 |
+
|
739 |
+
$list .="</tr>";
|
740 |
+
}
|
741 |
+
|
742 |
+
$list .="</tbody></table>";
|
743 |
+
}
|
744 |
+
else{
|
745 |
+
$list = "<table class='gfield_list' autosize='1'><thead><tr>";
|
746 |
+
|
747 |
+
//reading columns from entry data
|
748 |
+
foreach($columns as $column){
|
749 |
+
$list .= "<th>" . esc_html($column) . "</th>";
|
750 |
+
}
|
751 |
+
$list .= "</tr></thead>";
|
752 |
+
|
753 |
+
$list .= "<tbody>";
|
754 |
+
foreach($value as $item){
|
755 |
+
$list .= "<tr>";
|
756 |
+
foreach($columns as $column){
|
757 |
+
$val = rgar($item, $column);
|
758 |
+
$list .= "<td>".htmlspecialchars($val)."</td>";
|
759 |
+
}
|
760 |
+
|
761 |
+
$list .="</tr>";
|
762 |
+
}
|
763 |
+
|
764 |
+
$list .="</tbody></table>";
|
765 |
+
}
|
766 |
+
break;
|
767 |
+
}
|
768 |
+
|
769 |
+
return $list;
|
770 |
+
}
|
771 |
+
return "";
|
772 |
+
break;
|
773 |
+
|
774 |
+
default :
|
775 |
+
if (!is_array($value))
|
776 |
+
{
|
777 |
+
return nl2br($value);
|
778 |
+
}
|
779 |
+
break;
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
function pdf_get_lead_field_display($field, $value, $currency="", $use_text=false, $format="html", $media="screen"){
|
784 |
+
|
785 |
+
if($field['type'] == 'post_category')
|
786 |
+
$value = self::prepare_post_category_value($value, $field);
|
787 |
+
|
788 |
+
switch(RGFormsModel::get_input_type($field)){
|
789 |
+
case "name" :
|
790 |
+
if(is_array($value)){
|
791 |
+
$prefix = trim(rgget($field["id"] . ".2", $value));
|
792 |
+
$first = trim(rgget($field["id"] . ".3", $value));
|
793 |
+
$last = trim(rgget($field["id"] . ".6", $value));
|
794 |
+
$suffix = trim(rgget($field["id"] . ".8", $value));
|
795 |
+
|
796 |
+
$name = $prefix;
|
797 |
+
$name .= !empty($name) && !empty($first) ? " $first" : $first;
|
798 |
+
$name .= !empty($name) && !empty($last) ? " $last" : $last;
|
799 |
+
$name .= !empty($name) && !empty($suffix) ? " $suffix" : $suffix;
|
800 |
+
|
801 |
+
return $name;
|
802 |
+
}
|
803 |
+
else{
|
804 |
+
return $value;
|
805 |
+
}
|
806 |
+
|
807 |
+
break;
|
808 |
+
case "creditcard" :
|
809 |
+
if(is_array($value)){
|
810 |
+
$card_number = trim(rgget($field["id"] . ".1", $value));
|
811 |
+
$card_type = trim(rgget($field["id"] . ".4", $value));
|
812 |
+
$separator = $format == "html" ? "<br/>" : "\n";
|
813 |
+
return empty($card_number) ? "" : $card_type . $separator . $card_number;
|
814 |
+
}
|
815 |
+
else{
|
816 |
+
return "";
|
817 |
+
}
|
818 |
+
break;
|
819 |
+
|
820 |
+
case "address" :
|
821 |
+
if(is_array($value)){
|
822 |
+
$street_value = trim(rgget($field["id"] . ".1", $value));
|
823 |
+
$street2_value = trim(rgget($field["id"] . ".2", $value));
|
824 |
+
$city_value = trim(rgget($field["id"] . ".3", $value));
|
825 |
+
$state_value = trim(rgget($field["id"] . ".4", $value));
|
826 |
+
$zip_value = trim(rgget($field["id"] . ".5", $value));
|
827 |
+
$country_value = trim(rgget($field["id"] . ".6", $value));
|
828 |
+
|
829 |
+
$line_break = $format == "html" ? "<br />" : "\n";
|
830 |
+
|
831 |
+
$address_display_format = apply_filters("gform_address_display_format", "default");
|
832 |
+
if($address_display_format == "zip_before_city"){
|
833 |
+
/*
|
834 |
+
Sample:
|
835 |
+
3333 Some Street
|
836 |
+
suite 16
|
837 |
+
2344 City, State
|
838 |
+
Country
|
839 |
+
*/
|
840 |
+
|
841 |
+
$addr_ary = array();
|
842 |
+
$addr_ary[] = $street_value;
|
843 |
+
|
844 |
+
if(!empty($street2_value))
|
845 |
+
$addr_ary[] = $street2_value;
|
846 |
+
|
847 |
+
$zip_line = trim($zip_value . " " . $city_value);
|
848 |
+
$zip_line .= !empty($zip_line) && !empty($state_value) ? ", {$state_value}" : $state_value;
|
849 |
+
$zip_line = trim($zip_line);
|
850 |
+
if(!empty($zip_line))
|
851 |
+
$addr_ary[] = $zip_line;
|
852 |
+
|
853 |
+
if(!empty($country_value))
|
854 |
+
$addr_ary[] = $country_value;
|
855 |
+
|
856 |
+
$address = implode("<br />", $addr_ary);
|
857 |
+
|
858 |
+
}
|
859 |
+
else{
|
860 |
+
$address = $street_value;
|
861 |
+
$address .= !empty($address) && !empty($street2_value) ? $line_break . $street2_value : $street2_value;
|
862 |
+
$address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? $line_break. $city_value : $city_value;
|
863 |
+
$address .= !empty($address) && !empty($city_value) && !empty($state_value) ? ", $state_value" : $state_value;
|
864 |
+
$address .= !empty($address) && !empty($zip_value) ? " $zip_value" : $zip_value;
|
865 |
+
$address .= !empty($address) && !empty($country_value) ? $line_break . $country_value : $country_value;
|
866 |
+
}
|
867 |
+
|
868 |
+
return $address;
|
869 |
+
}
|
870 |
+
else{
|
871 |
+
return "";
|
872 |
+
}
|
873 |
+
break;
|
874 |
+
|
875 |
+
case "email" :
|
876 |
+
return GFCommon::is_valid_email($value) && $format == "html" ? "<a href='mailto:$value'>$value</a>" : $value;
|
877 |
+
break;
|
878 |
+
|
879 |
+
case "website" :
|
880 |
+
return GFCommon::is_valid_url($value) && $format == "html" ? "<a href='$value' target='_blank'>$value</a>" : $value;
|
881 |
+
break;
|
882 |
+
|
883 |
+
case "checkbox" :
|
884 |
+
if(is_array($value)){
|
885 |
+
|
886 |
+
$items = '';
|
887 |
+
|
888 |
+
foreach($value as $key => $item){
|
889 |
+
if(!empty($item)){
|
890 |
+
switch($format){
|
891 |
+
case "text" :
|
892 |
+
$items .= GFCommon::selection_display($item, $field, $currency, $use_text) . ", ";
|
893 |
+
break;
|
894 |
+
|
895 |
+
default:
|
896 |
+
$items .= "<li>" . GFCommon::selection_display($item, $field, $currency, $use_text) . "</li>";
|
897 |
+
break;
|
898 |
+
}
|
899 |
+
}
|
900 |
+
}
|
901 |
+
if(empty($items)){
|
902 |
+
return "";
|
903 |
+
}
|
904 |
+
else if($format == "text"){
|
905 |
+
return substr($items, 0, strlen($items)-2); //removing last comma
|
906 |
+
}
|
907 |
+
else{
|
908 |
+
return "<ul class='bulleted'>$items</ul>";
|
909 |
+
}
|
910 |
+
}
|
911 |
+
else{
|
912 |
+
return $value;
|
913 |
+
}
|
914 |
+
break;
|
915 |
+
|
916 |
+
case "post_image" :
|
917 |
+
$ary = explode("|:|", $value);
|
918 |
+
$url = count($ary) > 0 ? $ary[0] : "";
|
919 |
+
$title = count($ary) > 1 ? $ary[1] : "";
|
920 |
+
$caption = count($ary) > 2 ? $ary[2] : "";
|
921 |
+
$description = count($ary) > 3 ? $ary[3] : "";
|
922 |
+
|
923 |
+
if(!empty($url)){
|
924 |
+
$url = str_replace(" ", "%20", $url);
|
925 |
+
switch($format){
|
926 |
+
case "text" :
|
927 |
+
$value = $url;
|
928 |
+
$value .= !empty($title) ? "\n\n" . $field["label"] . " (" . __("Title", "gravityforms") . "): " . $title : "";
|
929 |
+
$value .= !empty($caption) ? "\n\n" . $field["label"] . " (" . __("Caption", "gravityforms") . "): " . $caption : "";
|
930 |
+
$value .= !empty($description) ? "\n\n" . $field["label"] . " (" . __("Description", "gravityforms") . "): " . $description : "";
|
931 |
+
break;
|
932 |
+
|
933 |
+
default :
|
934 |
+
$path = str_replace(site_url().'/', ABSPATH, $url);
|
935 |
+
$value = "<a href='$url' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='$path' width='100' /></a>";
|
936 |
+
$value .= !empty($title) ? "<div>Title: $title</div>" : "";
|
937 |
+
$value .= !empty($caption) ? "<div>Caption: $caption</div>" : "";
|
938 |
+
$value .= !empty($description) ? "<div>Description: $description</div>": "";
|
939 |
+
|
940 |
+
break;
|
941 |
+
}
|
942 |
+
}
|
943 |
+
return $value;
|
944 |
+
|
945 |
+
case "fileupload" :
|
946 |
+
$file_path = $value;
|
947 |
+
if(!empty($file_path)){
|
948 |
+
$info = pathinfo($file_path);
|
949 |
+
$file_path = esc_attr(str_replace(" ", "%20", $file_path));
|
950 |
+
$value = $format == "text" ? $file_path : "<a href='$file_path' target='_blank' title='" . __("Click to view", "gravityforms") . "'>" . $info["basename"] . "</a>";
|
951 |
+
}
|
952 |
+
return $value;
|
953 |
+
break;
|
954 |
+
|
955 |
+
case "date" :
|
956 |
+
return GFCommon::date_display($value, rgar($field, "dateFormat"));
|
957 |
+
break;
|
958 |
+
|
959 |
+
case "radio" :
|
960 |
+
case "select" :
|
961 |
+
return GFCommon::selection_display($value, $field, $currency, $use_text);
|
962 |
+
break;
|
963 |
+
|
964 |
+
case "multiselect" :
|
965 |
+
if(empty($value) || $format == "text")
|
966 |
+
return $value;
|
967 |
+
|
968 |
+
$value = explode(",", $value);
|
969 |
+
|
970 |
+
$items = '';
|
971 |
+
foreach($value as $item){
|
972 |
+
$items .= "<li>" . GFCommon::selection_display($item, $field, $currency, $use_text) . "</li>";
|
973 |
+
}
|
974 |
+
|
975 |
+
return "<ul class='bulleted'>{$items}</ul>";
|
976 |
+
|
977 |
+
break;
|
978 |
+
|
979 |
+
case "calculation" :
|
980 |
+
case "singleproduct" :
|
981 |
+
if(is_array($value)){
|
982 |
+
$product_name = trim($value[$field["id"] . ".1"]);
|
983 |
+
$price = trim($value[$field["id"] . ".2"]);
|
984 |
+
$quantity = trim($value[$field["id"] . ".3"]);
|
985 |
+
|
986 |
+
$product = $product_name . ", " . __("Qty: ", "gravityforms") . $quantity . ", " . __("Price: ", "gravityforms") . $price;
|
987 |
+
return $product;
|
988 |
+
}
|
989 |
+
else{
|
990 |
+
return "";
|
991 |
+
}
|
992 |
+
break;
|
993 |
+
|
994 |
+
case "number" :
|
995 |
+
return GFCommon::format_number($value, rgar($field, "numberFormat"));
|
996 |
+
break;
|
997 |
+
|
998 |
+
case "singleshipping" :
|
999 |
+
case "donation" :
|
1000 |
+
case "total" :
|
1001 |
+
case "price" :
|
1002 |
+
return GFCommon::to_money($value, $currency);
|
1003 |
+
|
1004 |
+
case "list" :
|
1005 |
+
if(empty($value))
|
1006 |
+
return "";
|
1007 |
+
$value = unserialize($value);
|
1008 |
+
|
1009 |
+
$has_columns = is_array($value[0]);
|
1010 |
+
|
1011 |
+
if(!$has_columns){
|
1012 |
+
$items = '';
|
1013 |
+
foreach($value as $key => $item){
|
1014 |
+
if(!empty($item)){
|
1015 |
+
switch($format){
|
1016 |
+
case "text" :
|
1017 |
+
$items .= $item . ", ";
|
1018 |
+
break;
|
1019 |
+
case "url" :
|
1020 |
+
$items .= $item . ",";
|
1021 |
+
break;
|
1022 |
+
default :
|
1023 |
+
if($media == "email"){
|
1024 |
+
$items .= "<li>".htmlspecialchars($item)."</li>";
|
1025 |
+
}
|
1026 |
+
else{
|
1027 |
+
$items .= "<li>".htmlspecialchars($item)."</li>";
|
1028 |
+
}
|
1029 |
+
break;
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
if(empty($items)){
|
1035 |
+
return "";
|
1036 |
+
}
|
1037 |
+
else if($format == "text"){
|
1038 |
+
return substr($items, 0, strlen($items)-2); //removing last comma
|
1039 |
+
}
|
1040 |
+
else if($format == "url"){
|
1041 |
+
return substr($items, 0, strlen($items)-1); //removing last comma
|
1042 |
+
}
|
1043 |
+
else if($media == "email"){
|
1044 |
+
return "<ul class='bulleted'>{$items}</ul>";
|
1045 |
+
}
|
1046 |
+
else{
|
1047 |
+
return "<ul class='bulleted'>{$items}</ul>";
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
else if(is_array($value)){
|
1051 |
+
$columns = array_keys($value[0]);
|
1052 |
+
|
1053 |
+
$list = "";
|
1054 |
+
|
1055 |
+
switch($format){
|
1056 |
+
case "text" :
|
1057 |
+
$is_first_row = true;
|
1058 |
+
foreach($value as $item){
|
1059 |
+
if(!$is_first_row)
|
1060 |
+
$list .= "\n\n" . $field["label"] . ": ";
|
1061 |
+
$list .= implode(",", array_values($item));
|
1062 |
+
|
1063 |
+
$is_first_row = false;
|
1064 |
+
}
|
1065 |
+
break;
|
1066 |
+
|
1067 |
+
case "url" :
|
1068 |
+
foreach($value as $item){
|
1069 |
+
$list .= implode("|", array_values($item)) . ",";
|
1070 |
+
}
|
1071 |
+
if(!empty($list))
|
1072 |
+
$list = substr($list, 0, strlen($list)-1);
|
1073 |
+
break;
|
1074 |
+
|
1075 |
+
default :
|
1076 |
+
if($media == "email"){
|
1077 |
+
$list = "<table autosize='1' class='gfield_list' style='border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%'><thead><tr>";
|
1078 |
+
|
1079 |
+
//reading columns from entry data
|
1080 |
+
foreach($columns as $column){
|
1081 |
+
$list .= "<th style='background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left'>" . esc_html($column) . "</th>";
|
1082 |
+
}
|
1083 |
+
$list .= "</tr></thead>";
|
1084 |
+
|
1085 |
+
$list .= "<tbody style='background-color: #F9F9F9'>";
|
1086 |
+
foreach($value as $item){
|
1087 |
+
$list .= "<tr>";
|
1088 |
+
foreach($columns as $column){
|
1089 |
+
$val = rgar($item, $column);
|
1090 |
+
$list .= "<td style='padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;'>{$val}</td>";
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
$list .="</tr>";
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
$list .="</tbody></table>";
|
1097 |
+
}
|
1098 |
+
else{
|
1099 |
+
$list = "<table autosize='1' class='gfield_list'><thead><tr>";
|
1100 |
+
|
1101 |
+
//reading columns from entry data
|
1102 |
+
foreach($columns as $column){
|
1103 |
+
$list .= "<th>" . esc_html($column) . "</th>";
|
1104 |
+
}
|
1105 |
+
$list .= "</tr></thead>";
|
1106 |
+
|
1107 |
+
$list .= "<tbody>";
|
1108 |
+
foreach($value as $item){
|
1109 |
+
$list .= "<tr>";
|
1110 |
+
foreach($columns as $column){
|
1111 |
+
$val = rgar($item, $column);
|
1112 |
+
$list .= "<td>".htmlspecialchars($val)."</td>";
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
$list .="</tr>";
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
$list .="</tbody></table>";
|
1119 |
+
}
|
1120 |
+
break;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
return $list;
|
1124 |
+
}
|
1125 |
+
return "";
|
1126 |
+
break;
|
1127 |
+
|
1128 |
+
default :
|
1129 |
+
if (!is_array($value))
|
1130 |
+
{
|
1131 |
+
return nl2br($value);
|
1132 |
+
}
|
1133 |
+
break;
|
1134 |
+
}
|
1135 |
+
}
|
1136 |
+
}
|
1137 |
}
|
pdf-render.php
CHANGED
@@ -1,263 +1,263 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class PDFRender
|
5 |
-
{
|
6 |
-
/**
|
7 |
-
* Outputs a PDF entry from a Gravity Form
|
8 |
-
* var $form_id integer: The form id
|
9 |
-
* var $lead_id integer: The entry id
|
10 |
-
* var $output string: either view, save or download
|
11 |
-
* save will save a copy of the PDF to the server using the PDF_SAVE_LOCATION constant
|
12 |
-
* var $return boolean: if set to true
|
13 |
-
it will return the path of the saved PDF
|
14 |
-
* var $template string: if you want to use multiple PDF templates - name of the template file
|
15 |
-
* var $pdfname string: allows you to pass a custom PDF name to the generator e.g. 'Application Form.pdf' (ensure .pdf is appended to the filename)
|
16 |
-
* var $fpdf boolean: custom hook to allow the FPDF engine to generate PDFs instead of DOMPDF. Premium Paid Feature.
|
17 |
-
*/
|
18 |
-
public function PDF_Generator($form_id, $lead_id, $arguments = array())
|
19 |
-
{
|
20 |
-
/*
|
21 |
-
* Because we merged the create and attach functions we need a measure to only run this function once per session per lead id.
|
22 |
-
*/
|
23 |
-
static $pdf_creator = array();
|
24 |
-
|
25 |
-
/*
|
26 |
-
* Set user-variable to output HTML instead of PDF
|
27 |
-
*/
|
28 |
-
$html = (isset($_GET['html'])) ? (int) $_GET['html'] : 0;
|
29 |
-
|
30 |
-
/*
|
31 |
-
* Join the form and lead IDs together to get the real ID
|
32 |
-
*/
|
33 |
-
$id = $form_id . $lead_id;
|
34 |
-
|
35 |
-
/*
|
36 |
-
* PDF_Generator was becoming too cluttered so store all the variables in an array
|
37 |
-
*/
|
38 |
-
$filename = $arguments['pdfname'];
|
39 |
-
$template = $arguments['template'];
|
40 |
-
$output = (isset($arguments['output']) && strlen($arguments['output']) > 0) ? $arguments['output'] : 'save';
|
41 |
-
|
42 |
-
/*
|
43 |
-
* Check if the PDF exists and if this function has already run this season
|
44 |
-
*/
|
45 |
-
if(in_array($lead_id, $pdf_creator) && file_exists(PDF_SAVE_LOCATION.$id.'/'. $filename))
|
46 |
-
{
|
47 |
-
/*
|
48 |
-
* Don't generate a new PDF, use the existing one
|
49 |
-
*/
|
50 |
-
return PDF_SAVE_LOCATION.$id.'/'. $filename;
|
51 |
-
}
|
52 |
-
|
53 |
-
/*
|
54 |
-
* Add lead to PDF creation tracker
|
55 |
-
*/
|
56 |
-
$pdf_creator[] = $lead_id;
|
57 |
-
|
58 |
-
/*
|
59 |
-
* Add filter before we load the template file so we can stop the main process
|
60 |
-
* Used in premium plugins
|
61 |
-
* return true to cancel, otherwise run.
|
62 |
-
*/
|
63 |
-
$return = apply_filters('gfpdfe_pre_load_template', $form_id, $lead_id, $template, $id, $output, $filename, $arguments);
|
64 |
-
|
65 |
-
if($return !== true)
|
66 |
-
{
|
67 |
-
/*
|
68 |
-
* Get the tempalte HTML file
|
69 |
-
*/
|
70 |
-
$entry = $this->load_entry_data($form_id, $lead_id, $template);
|
71 |
-
|
72 |
-
/*
|
73 |
-
* Output HTML version and return if user requested a HTML version
|
74 |
-
*/
|
75 |
-
if($html === 1)
|
76 |
-
{
|
77 |
-
echo $entry;
|
78 |
-
exit;
|
79 |
-
}
|
80 |
-
|
81 |
-
/*
|
82 |
-
* If successfully got the entry then run the processor
|
83 |
-
*/
|
84 |
-
if(strlen($entry) > 0)
|
85 |
-
{
|
86 |
-
return $this->PDF_processing($entry, $filename, $id, $output, $arguments);
|
87 |
-
}
|
88 |
-
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
/*
|
92 |
-
* Used in extensions to return the name of the PDF file when attaching to notifications
|
93 |
-
*/
|
94 |
-
return apply_filters('gfpdfe_return_pdf_path', $form_id, $lead_id);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Loads the Gravity Form output script (actually the print preview)
|
99 |
-
*/
|
100 |
-
private function load_entry_data($form_id, $lead_id, $template)
|
101 |
-
{
|
102 |
-
/* set up contstants for gravity forms to use so we can override the security on the printed version */
|
103 |
-
if(file_exists(PDF_TEMPLATE_LOCATION.$template))
|
104 |
-
{
|
105 |
-
return PDF_Common::get_html_template(PDF_TEMPLATE_LOCATION.$template);
|
106 |
-
}
|
107 |
-
else
|
108 |
-
{
|
109 |
-
/*
|
110 |
-
* Check if template file exists in the plugin's core template folder
|
111 |
-
*/
|
112 |
-
if(file_exists(PDF_PLUGIN_DIR."templates/" . $template))
|
113 |
-
{
|
114 |
-
return PDF_Common::get_html_template(PDF_PLUGIN_DIR."templates/" . $template);
|
115 |
-
}
|
116 |
-
/*
|
117 |
-
* If template not found then we will resort to the default template.
|
118 |
-
*/
|
119 |
-
else
|
120 |
-
{
|
121 |
-
return PDF_Common::get_html_template(PDF_PLUGIN_DIR."templates/" . PDFGenerator::$default['template']);
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
129 |
-
*/
|
130 |
-
public function PDF_processing($html, $filename, $id, $output = 'view', $arguments)
|
131 |
-
{
|
132 |
-
/*
|
133 |
-
* DOMPDF replaced with mPDF in v3.0.0
|
134 |
-
* Check which version of mpdf we are calling
|
135 |
-
* Full, Lite or Tiny
|
136 |
-
*/
|
137 |
-
if(!class_exists('mPDF'))
|
138 |
-
{
|
139 |
-
if(PDF_ENABLE_MPDF_TINY === true)
|
140 |
-
{
|
141 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf-extra-lite.php';
|
142 |
-
}
|
143 |
-
elseif(PDF_ENABLE_MPDF_LITE === true)
|
144 |
-
{
|
145 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf-lite.php';
|
146 |
-
}
|
147 |
-
else
|
148 |
-
{
|
149 |
-
include PDF_PLUGIN_DIR .'/mPDF/mpdf.php';
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
/*
|
154 |
-
* Initialise class and set the paper size and orientation
|
155 |
-
*/
|
156 |
-
$paper_size = $arguments['pdf_size'];
|
157 |
-
|
158 |
-
|
159 |
-
if(!is_array($paper_size))
|
160 |
-
{
|
161 |
-
$orientation = ($arguments['orientation'] == 'landscape') ? '-L' : '';
|
162 |
-
$paper_size = $paper_size.$orientation;
|
163 |
-
}
|
164 |
-
else
|
165 |
-
{
|
166 |
-
$orientation = ($arguments['orientation'] == 'landscape') ? 'L' : 'P';
|
167 |
-
}
|
168 |
-
|
169 |
-
$mpdf = new mPDF('', $paper_size, 0, '', 15, 15, 16, 16, 9, 9, $orientation);
|
170 |
-
|
171 |
-
/*
|
172 |
-
* Display PDF is full-page mode which allows the entire PDF page to be viewed
|
173 |
-
* Normally PDF is zoomed right in.
|
174 |
-
*/
|
175 |
-
$mpdf->SetDisplayMode('fullpage');
|
176 |
-
|
177 |
-
/*
|
178 |
-
* Automatically detect fonts and substitue as needed
|
179 |
-
*/
|
180 |
-
$mpdf->SetAutoFont(AUTOFONT_ALL);
|
181 |
-
$mpdf->useSubstitutions = true;
|
182 |
-
|
183 |
-
/*
|
184 |
-
* Set Creator Meta Data
|
185 |
-
*/
|
186 |
-
|
187 |
-
$mpdf->SetCreator('Gravity Forms PDF Extended v'. PDF_EXTENDED_VERSION.'. http://gravityformspdfextended.com');
|
188 |
-
|
189 |
-
/*
|
190 |
-
* Set RTL languages at user request
|
191 |
-
*/
|
192 |
-
if($arguments['rtl'] === true)
|
193 |
-
{
|
194 |
-
$mpdf->SetDirectionality('rtl');
|
195 |
-
}
|
196 |
-
|
197 |
-
/*
|
198 |
-
* Set up security if user requested
|
199 |
-
*/
|
200 |
-
if($arguments['security'] === true)
|
201 |
-
{
|
202 |
-
$password = (strlen($arguments['pdf_password']) > 0) ? $arguments['pdf_password'] : '';
|
203 |
-
$master_password = (strlen($arguments['pdf_password']) > 0) ? $arguments['pdf_password'] : null;
|
204 |
-
$pdf_privileges = (is_array($arguments['pdf_privileges'])) ? $arguments['pdf_privileges'] : array();
|
205 |
-
|
206 |
-
$mpdf->SetProtection($pdf_privileges, $password, $master_password, 128);
|
207 |
-
}
|
208 |
-
|
209 |
-
|
210 |
-
/* load HTML block */
|
211 |
-
$mpdf->WriteHTML($html);
|
212 |
-
|
213 |
-
switch($output)
|
214 |
-
{
|
215 |
-
case 'download':
|
216 |
-
$mpdf->Output($filename, 'D');
|
217 |
-
exit;
|
218 |
-
break;
|
219 |
-
|
220 |
-
case 'view':
|
221 |
-
$mpdf->Output(time(), 'I');
|
222 |
-
exit;
|
223 |
-
break;
|
224 |
-
|
225 |
-
case 'save':
|
226 |
-
/*
|
227 |
-
* PDF wasn't writing to file with the F method - http://mpdf1.com/manual/index.php?tid=125
|
228 |
-
* Return as a string and write to file manually
|
229 |
-
*/
|
230 |
-
$pdf = $mpdf->Output('', 'S');
|
231 |
-
return $this->savePDF($pdf, $filename, $id);
|
232 |
-
break;
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
239 |
-
* var $dompdf Object
|
240 |
-
*/
|
241 |
-
public function savePDF($pdf, $filename, $id)
|
242 |
-
{
|
243 |
-
/* create unique folder for PDFs */
|
244 |
-
if(!is_dir(PDF_SAVE_LOCATION.$id))
|
245 |
-
{
|
246 |
-
if(!mkdir(PDF_SAVE_LOCATION.$id))
|
247 |
-
{
|
248 |
-
trigger_error('Could not create PDF folder in '. PDF_SAVE_LOCATION.$id, E_USER_WARNING);
|
249 |
-
return;
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
$pdf_save = PDF_SAVE_LOCATION.$id.'/'. $filename;
|
254 |
-
|
255 |
-
if(!file_put_contents($pdf_save, $pdf))
|
256 |
-
{
|
257 |
-
trigger_error('Could not save PDF to '. $pdf_save, E_USER_WARNING);
|
258 |
-
return;
|
259 |
-
}
|
260 |
-
return $pdf_save;
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class PDFRender
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* Outputs a PDF entry from a Gravity Form
|
8 |
+
* var $form_id integer: The form id
|
9 |
+
* var $lead_id integer: The entry id
|
10 |
+
* var $output string: either view, save or download
|
11 |
+
* save will save a copy of the PDF to the server using the PDF_SAVE_LOCATION constant
|
12 |
+
* var $return boolean: if set to true
|
13 |
+
it will return the path of the saved PDF
|
14 |
+
* var $template string: if you want to use multiple PDF templates - name of the template file
|
15 |
+
* var $pdfname string: allows you to pass a custom PDF name to the generator e.g. 'Application Form.pdf' (ensure .pdf is appended to the filename)
|
16 |
+
* var $fpdf boolean: custom hook to allow the FPDF engine to generate PDFs instead of DOMPDF. Premium Paid Feature.
|
17 |
+
*/
|
18 |
+
public function PDF_Generator($form_id, $lead_id, $arguments = array())
|
19 |
+
{
|
20 |
+
/*
|
21 |
+
* Because we merged the create and attach functions we need a measure to only run this function once per session per lead id.
|
22 |
+
*/
|
23 |
+
static $pdf_creator = array();
|
24 |
+
|
25 |
+
/*
|
26 |
+
* Set user-variable to output HTML instead of PDF
|
27 |
+
*/
|
28 |
+
$html = (isset($_GET['html'])) ? (int) $_GET['html'] : 0;
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Join the form and lead IDs together to get the real ID
|
32 |
+
*/
|
33 |
+
$id = $form_id . $lead_id;
|
34 |
+
|
35 |
+
/*
|
36 |
+
* PDF_Generator was becoming too cluttered so store all the variables in an array
|
37 |
+
*/
|
38 |
+
$filename = $arguments['pdfname'];
|
39 |
+
$template = $arguments['template'];
|
40 |
+
$output = (isset($arguments['output']) && strlen($arguments['output']) > 0) ? $arguments['output'] : 'save';
|
41 |
+
|
42 |
+
/*
|
43 |
+
* Check if the PDF exists and if this function has already run this season
|
44 |
+
*/
|
45 |
+
if(in_array($lead_id, $pdf_creator) && file_exists(PDF_SAVE_LOCATION.$id.'/'. $filename))
|
46 |
+
{
|
47 |
+
/*
|
48 |
+
* Don't generate a new PDF, use the existing one
|
49 |
+
*/
|
50 |
+
return PDF_SAVE_LOCATION.$id.'/'. $filename;
|
51 |
+
}
|
52 |
+
|
53 |
+
/*
|
54 |
+
* Add lead to PDF creation tracker
|
55 |
+
*/
|
56 |
+
$pdf_creator[] = $lead_id;
|
57 |
+
|
58 |
+
/*
|
59 |
+
* Add filter before we load the template file so we can stop the main process
|
60 |
+
* Used in premium plugins
|
61 |
+
* return true to cancel, otherwise run.
|
62 |
+
*/
|
63 |
+
$return = apply_filters('gfpdfe_pre_load_template', $form_id, $lead_id, $template, $id, $output, $filename, $arguments);
|
64 |
+
|
65 |
+
if($return !== true)
|
66 |
+
{
|
67 |
+
/*
|
68 |
+
* Get the tempalte HTML file
|
69 |
+
*/
|
70 |
+
$entry = $this->load_entry_data($form_id, $lead_id, $template);
|
71 |
+
|
72 |
+
/*
|
73 |
+
* Output HTML version and return if user requested a HTML version
|
74 |
+
*/
|
75 |
+
if($html === 1)
|
76 |
+
{
|
77 |
+
echo $entry;
|
78 |
+
exit;
|
79 |
+
}
|
80 |
+
|
81 |
+
/*
|
82 |
+
* If successfully got the entry then run the processor
|
83 |
+
*/
|
84 |
+
if(strlen($entry) > 0)
|
85 |
+
{
|
86 |
+
return $this->PDF_processing($entry, $filename, $id, $output, $arguments);
|
87 |
+
}
|
88 |
+
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
/*
|
92 |
+
* Used in extensions to return the name of the PDF file when attaching to notifications
|
93 |
+
*/
|
94 |
+
return apply_filters('gfpdfe_return_pdf_path', $form_id, $lead_id);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Loads the Gravity Form output script (actually the print preview)
|
99 |
+
*/
|
100 |
+
private function load_entry_data($form_id, $lead_id, $template)
|
101 |
+
{
|
102 |
+
/* set up contstants for gravity forms to use so we can override the security on the printed version */
|
103 |
+
if(file_exists(PDF_TEMPLATE_LOCATION.$template))
|
104 |
+
{
|
105 |
+
return PDF_Common::get_html_template(PDF_TEMPLATE_LOCATION.$template);
|
106 |
+
}
|
107 |
+
else
|
108 |
+
{
|
109 |
+
/*
|
110 |
+
* Check if template file exists in the plugin's core template folder
|
111 |
+
*/
|
112 |
+
if(file_exists(PDF_PLUGIN_DIR."templates/" . $template))
|
113 |
+
{
|
114 |
+
return PDF_Common::get_html_template(PDF_PLUGIN_DIR."templates/" . $template);
|
115 |
+
}
|
116 |
+
/*
|
117 |
+
* If template not found then we will resort to the default template.
|
118 |
+
*/
|
119 |
+
else
|
120 |
+
{
|
121 |
+
return PDF_Common::get_html_template(PDF_PLUGIN_DIR."templates/" . PDFGenerator::$default['template']);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
129 |
+
*/
|
130 |
+
public function PDF_processing($html, $filename, $id, $output = 'view', $arguments)
|
131 |
+
{
|
132 |
+
/*
|
133 |
+
* DOMPDF replaced with mPDF in v3.0.0
|
134 |
+
* Check which version of mpdf we are calling
|
135 |
+
* Full, Lite or Tiny
|
136 |
+
*/
|
137 |
+
if(!class_exists('mPDF'))
|
138 |
+
{
|
139 |
+
if(PDF_ENABLE_MPDF_TINY === true)
|
140 |
+
{
|
141 |
+
include PDF_PLUGIN_DIR .'/mPDF/mpdf-extra-lite.php';
|
142 |
+
}
|
143 |
+
elseif(PDF_ENABLE_MPDF_LITE === true)
|
144 |
+
{
|
145 |
+
include PDF_PLUGIN_DIR .'/mPDF/mpdf-lite.php';
|
146 |
+
}
|
147 |
+
else
|
148 |
+
{
|
149 |
+
include PDF_PLUGIN_DIR .'/mPDF/mpdf.php';
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* Initialise class and set the paper size and orientation
|
155 |
+
*/
|
156 |
+
$paper_size = $arguments['pdf_size'];
|
157 |
+
|
158 |
+
|
159 |
+
if(!is_array($paper_size))
|
160 |
+
{
|
161 |
+
$orientation = ($arguments['orientation'] == 'landscape') ? '-L' : '';
|
162 |
+
$paper_size = $paper_size.$orientation;
|
163 |
+
}
|
164 |
+
else
|
165 |
+
{
|
166 |
+
$orientation = ($arguments['orientation'] == 'landscape') ? 'L' : 'P';
|
167 |
+
}
|
168 |
+
|
169 |
+
$mpdf = new mPDF('', $paper_size, 0, '', 15, 15, 16, 16, 9, 9, $orientation);
|
170 |
+
|
171 |
+
/*
|
172 |
+
* Display PDF is full-page mode which allows the entire PDF page to be viewed
|
173 |
+
* Normally PDF is zoomed right in.
|
174 |
+
*/
|
175 |
+
$mpdf->SetDisplayMode('fullpage');
|
176 |
+
|
177 |
+
/*
|
178 |
+
* Automatically detect fonts and substitue as needed
|
179 |
+
*/
|
180 |
+
$mpdf->SetAutoFont(AUTOFONT_ALL);
|
181 |
+
$mpdf->useSubstitutions = true;
|
182 |
+
|
183 |
+
/*
|
184 |
+
* Set Creator Meta Data
|
185 |
+
*/
|
186 |
+
|
187 |
+
$mpdf->SetCreator('Gravity Forms PDF Extended v'. PDF_EXTENDED_VERSION.'. http://gravityformspdfextended.com');
|
188 |
+
|
189 |
+
/*
|
190 |
+
* Set RTL languages at user request
|
191 |
+
*/
|
192 |
+
if($arguments['rtl'] === true)
|
193 |
+
{
|
194 |
+
$mpdf->SetDirectionality('rtl');
|
195 |
+
}
|
196 |
+
|
197 |
+
/*
|
198 |
+
* Set up security if user requested
|
199 |
+
*/
|
200 |
+
if($arguments['security'] === true)
|
201 |
+
{
|
202 |
+
$password = (strlen($arguments['pdf_password']) > 0) ? $arguments['pdf_password'] : '';
|
203 |
+
$master_password = (strlen($arguments['pdf_password']) > 0) ? $arguments['pdf_password'] : null;
|
204 |
+
$pdf_privileges = (is_array($arguments['pdf_privileges'])) ? $arguments['pdf_privileges'] : array();
|
205 |
+
|
206 |
+
$mpdf->SetProtection($pdf_privileges, $password, $master_password, 128);
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
/* load HTML block */
|
211 |
+
$mpdf->WriteHTML($html);
|
212 |
+
|
213 |
+
switch($output)
|
214 |
+
{
|
215 |
+
case 'download':
|
216 |
+
$mpdf->Output($filename, 'D');
|
217 |
+
exit;
|
218 |
+
break;
|
219 |
+
|
220 |
+
case 'view':
|
221 |
+
$mpdf->Output(time(), 'I');
|
222 |
+
exit;
|
223 |
+
break;
|
224 |
+
|
225 |
+
case 'save':
|
226 |
+
/*
|
227 |
+
* PDF wasn't writing to file with the F method - http://mpdf1.com/manual/index.php?tid=125
|
228 |
+
* Return as a string and write to file manually
|
229 |
+
*/
|
230 |
+
$pdf = $mpdf->Output('', 'S');
|
231 |
+
return $this->savePDF($pdf, $filename, $id);
|
232 |
+
break;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types)
|
239 |
+
* var $dompdf Object
|
240 |
+
*/
|
241 |
+
public function savePDF($pdf, $filename, $id)
|
242 |
+
{
|
243 |
+
/* create unique folder for PDFs */
|
244 |
+
if(!is_dir(PDF_SAVE_LOCATION.$id))
|
245 |
+
{
|
246 |
+
if(!mkdir(PDF_SAVE_LOCATION.$id))
|
247 |
+
{
|
248 |
+
trigger_error('Could not create PDF folder in '. PDF_SAVE_LOCATION.$id, E_USER_WARNING);
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
$pdf_save = PDF_SAVE_LOCATION.$id.'/'. $filename;
|
254 |
+
|
255 |
+
if(!file_put_contents($pdf_save, $pdf))
|
256 |
+
{
|
257 |
+
trigger_error('Could not save PDF to '. $pdf_save, E_USER_WARNING);
|
258 |
+
return;
|
259 |
+
}
|
260 |
+
return $pdf_save;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
pdf-settings.php
CHANGED
@@ -1,254 +1,230 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin: Gravity Forms PDF Extended
|
5 |
-
* File: settings.php
|
6 |
-
*
|
7 |
-
* Handles the Gravity Forms Settings page in Wordpress
|
8 |
-
*/
|
9 |
-
|
10 |
-
class GFPDF_Settings
|
11 |
-
{
|
12 |
-
/*
|
13 |
-
* Check if we're on the settings page
|
14 |
-
*/
|
15 |
-
public function settings_page() {
|
16 |
-
if(RGForms::get("page") == "gf_settings") {
|
17 |
-
|
18 |
-
/* Call settings page */
|
19 |
-
RGForms::add_settings_page("PDF", array("GFPDF_Settings", "gfpdf_settings_page"),'');
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
private function run_setting_routing()
|
24 |
-
{
|
25 |
-
/*
|
26 |
-
* Check if we need to redeploy default PDF templates/styles to the theme folder
|
27 |
-
*/
|
28 |
-
if( PDF_DEPLOY === true && rgpost("gfpdf_deploy") &&
|
29 |
-
( wp_verify_nonce($_POST['gfpdf_deploy_nonce'],'gfpdf_deploy_nonce_action') || wp_verify_nonce($_GET['_wpnonce'],'pdf-extended-filesystem') ) ) {
|
30 |
-
if(rgpost('upgrade'))
|
31 |
-
{
|
32 |
-
/*
|
33 |
-
* Deploy new template styles
|
34 |
-
* If we get false returned Wordpress is trying to get
|
35 |
-
* access details to update files so don't display anything.
|
36 |
-
*/
|
37 |
-
if(self::deploy() === false)
|
38 |
-
{
|
39 |
-
return true;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
elseif(rgpost('font-initialise'))
|
43 |
-
{
|
44 |
-
/*
|
45 |
-
* We only want to reinitialise the font files and configuration
|
46 |
-
*/
|
47 |
-
if(GFPDF_InstallUpdater::initialise_fonts() === false)
|
48 |
-
{
|
49 |
-
return true;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
/*elseif(rgpost('cancel'))
|
53 |
-
{
|
54 |
-
update_option('gf_pdf_extended_deploy', 'yes');
|
55 |
-
}*/
|
56 |
-
}
|
57 |
-
|
58 |
-
/*
|
59 |
-
* If the user hasn't requested deployment and there is a _wpnonce check which one it is
|
60 |
-
* and call appropriate function
|
61 |
-
*/
|
62 |
-
if(isset($_GET['_wpnonce']))
|
63 |
-
{
|
64 |
-
/*
|
65 |
-
* Check if we want to copy the theme files
|
66 |
-
*/
|
67 |
-
if(wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_sync_now') )
|
68 |
-
{
|
69 |
-
$themes = get_option('gfpdfe_switch_theme');
|
70 |
-
|
71 |
-
if(isset($themes['old']) && isset($themes['new']) && GFPDF_InstallUpdater::do_theme_switch($themes['old'], $themes['new']) === false)
|
72 |
-
{
|
73 |
-
return true;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
/*
|
80 |
-
* Shows the GF PDF Extended settings page
|
81 |
-
*/
|
82 |
-
public function gfpdf_settings_page()
|
83 |
-
{
|
84 |
-
/*
|
85 |
-
* Run the page's configuration/routing options
|
86 |
-
*/
|
87 |
-
if(self::run_setting_routing() === true)
|
88 |
-
{
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
|
92 |
-
/*
|
93 |
-
* Show any messages the plugin might have called
|
94 |
-
* Because we had to run inside the settings page to correctly display the FTP credential form admin_notices was already called.
|
95 |
-
* To get around this we can recall it here.
|
96 |
-
*/
|
97 |
-
do_action('gfpdfe_notices');
|
98 |
-
|
99 |
-
/*
|
100 |
-
* Show the settings page deployment form
|
101 |
-
*/
|
102 |
-
?>
|
103 |
-
|
104 |
-
|
105 |
-
<div id="pdfextended-settings">
|
106 |
-
|
107 |
-
<div class="leftcolumn">
|
108 |
-
<?php
|
109 |
-
if(PDF_DEPLOY === true)
|
110 |
-
{
|
111 |
-
?>
|
112 |
-
<h2>Initialise Plugin</h2>
|
113 |
-
<p>Fresh installations and users who have just upgraded will need to initialise Gravity Forms PDF Extended to ensure it works correctly.</p>
|
114 |
-
|
115 |
-
<p>Initialisation does a number of important things, including:</p>
|
116 |
-
|
117 |
-
<ol>
|
118 |
-
<li><strong>Fresh Installation</strong>: Copies all the required template and configuration files to a folder called PDF_EXTENDED_TEMPLATE in your active theme's directory.<br />
|
119 |
-
<strong>Upgrading</strong>: Copies the latest default templates and template.css file to the PDF_EXTENDED_TEMPLATE folder. <strong>If you modified these files please back them up before re-initialising as they will be removed</strong>.
|
120 |
-
</li>
|
121 |
-
<li>Unzips the mPDF package</li>
|
122 |
-
<li>Installs any fonts found in the PDF_EXTENDED_TEMPLATE/fonts/ folder</li>
|
123 |
-
</ol>
|
124 |
-
|
125 |
-
<form method="post">
|
126 |
-
<?php wp_nonce_field('gfpdf_deploy_nonce_action','gfpdf_deploy_nonce'); ?>
|
127 |
-
<input type="hidden" name="gfpdf_deploy" value="1">
|
128 |
-
<?php
|
129 |
-
|
130 |
-
/*
|
131 |
-
* Remove the cancel feature for the moment
|
132 |
-
*
|
133 |
-
|
134 |
-
if(get_option('gf_pdf_extended_deploy') == 'no') { ?>
|
135 |
-
<input type="submit" value="Cancel Deployment" class="button" id="cancelupgrade" name="cancel">
|
136 |
-
<?php } */ ?>
|
137 |
-
<input type="submit" value="Initialise Plugin" class="button" id="upgrade" name="upgrade">
|
138 |
-
|
139 |
-
<input type="submit" value="Initialise Fonts Only" class="button" id="font-initialise" name="font-initialise">
|
140 |
-
</form>
|
141 |
-
<?php } ?>
|
142 |
-
|
143 |
-
<h2><?php _e('What\'s new in v'.PDF_EXTENDED_VERSION.'?' , "gravityformspdfextended") ?></h2>
|
144 |
-
|
145 |
-
<
|
146 |
-
<li><strong>
|
147 |
-
|
148 |
-
<li><strong>
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
<
|
156 |
-
|
157 |
-
<
|
158 |
-
<li><strong>
|
159 |
-
<li><strong>Bug</strong> - Fixed
|
160 |
-
<li><strong>Bug</strong> - Fixed
|
161 |
-
<li><strong>Bug</strong> - Fixed
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
<
|
174 |
-
|
175 |
-
<
|
176 |
-
|
177 |
-
<
|
178 |
-
<
|
179 |
-
<
|
180 |
-
<li
|
181 |
-
<li
|
182 |
-
<li
|
183 |
-
<li
|
184 |
-
<li
|
185 |
-
<li
|
186 |
-
<li
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
<
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
</div>
|
233 |
-
<?php
|
234 |
-
}
|
235 |
-
|
236 |
-
/*
|
237 |
-
* Deploy the latest template files
|
238 |
-
*/
|
239 |
-
private function deploy()
|
240 |
-
{
|
241 |
-
$return = GFPDF_InstallUpdater::pdf_extended_activate();
|
242 |
-
if($return !== true)
|
243 |
-
{
|
244 |
-
return $return;
|
245 |
-
}
|
246 |
-
add_action('gfpdfe_notices', array("GFPDF_Settings", "gf_pdf_deploy_success"));
|
247 |
-
}
|
248 |
-
|
249 |
-
public function gf_pdf_deploy_success() {
|
250 |
-
echo '<div id="message" class="updated"><p>';
|
251 |
-
echo 'You\'ve successfully initialised Gravity Forms PDF Extended.';
|
252 |
-
echo '</p></div>';
|
253 |
-
}
|
254 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin: Gravity Forms PDF Extended
|
5 |
+
* File: settings.php
|
6 |
+
*
|
7 |
+
* Handles the Gravity Forms Settings page in Wordpress
|
8 |
+
*/
|
9 |
+
|
10 |
+
class GFPDF_Settings
|
11 |
+
{
|
12 |
+
/*
|
13 |
+
* Check if we're on the settings page
|
14 |
+
*/
|
15 |
+
public function settings_page() {
|
16 |
+
if(RGForms::get("page") == "gf_settings") {
|
17 |
+
|
18 |
+
/* Call settings page */
|
19 |
+
RGForms::add_settings_page("PDF", array("GFPDF_Settings", "gfpdf_settings_page"),'');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
private function run_setting_routing()
|
24 |
+
{
|
25 |
+
/*
|
26 |
+
* Check if we need to redeploy default PDF templates/styles to the theme folder
|
27 |
+
*/
|
28 |
+
if( PDF_DEPLOY === true && rgpost("gfpdf_deploy") &&
|
29 |
+
( wp_verify_nonce($_POST['gfpdf_deploy_nonce'],'gfpdf_deploy_nonce_action') || wp_verify_nonce($_GET['_wpnonce'],'pdf-extended-filesystem') ) ) {
|
30 |
+
if(rgpost('upgrade'))
|
31 |
+
{
|
32 |
+
/*
|
33 |
+
* Deploy new template styles
|
34 |
+
* If we get false returned Wordpress is trying to get
|
35 |
+
* access details to update files so don't display anything.
|
36 |
+
*/
|
37 |
+
if(self::deploy() === false)
|
38 |
+
{
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
elseif(rgpost('font-initialise'))
|
43 |
+
{
|
44 |
+
/*
|
45 |
+
* We only want to reinitialise the font files and configuration
|
46 |
+
*/
|
47 |
+
if(GFPDF_InstallUpdater::initialise_fonts() === false)
|
48 |
+
{
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
/*elseif(rgpost('cancel'))
|
53 |
+
{
|
54 |
+
update_option('gf_pdf_extended_deploy', 'yes');
|
55 |
+
}*/
|
56 |
+
}
|
57 |
+
|
58 |
+
/*
|
59 |
+
* If the user hasn't requested deployment and there is a _wpnonce check which one it is
|
60 |
+
* and call appropriate function
|
61 |
+
*/
|
62 |
+
if(isset($_GET['_wpnonce']))
|
63 |
+
{
|
64 |
+
/*
|
65 |
+
* Check if we want to copy the theme files
|
66 |
+
*/
|
67 |
+
if(wp_verify_nonce($_GET['_wpnonce'], 'gfpdfe_sync_now') )
|
68 |
+
{
|
69 |
+
$themes = get_option('gfpdfe_switch_theme');
|
70 |
+
|
71 |
+
if(isset($themes['old']) && isset($themes['new']) && GFPDF_InstallUpdater::do_theme_switch($themes['old'], $themes['new']) === false)
|
72 |
+
{
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/*
|
80 |
+
* Shows the GF PDF Extended settings page
|
81 |
+
*/
|
82 |
+
public function gfpdf_settings_page()
|
83 |
+
{
|
84 |
+
/*
|
85 |
+
* Run the page's configuration/routing options
|
86 |
+
*/
|
87 |
+
if(self::run_setting_routing() === true)
|
88 |
+
{
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
/*
|
93 |
+
* Show any messages the plugin might have called
|
94 |
+
* Because we had to run inside the settings page to correctly display the FTP credential form admin_notices was already called.
|
95 |
+
* To get around this we can recall it here.
|
96 |
+
*/
|
97 |
+
do_action('gfpdfe_notices');
|
98 |
+
|
99 |
+
/*
|
100 |
+
* Show the settings page deployment form
|
101 |
+
*/
|
102 |
+
?>
|
103 |
+
|
104 |
+
|
105 |
+
<div id="pdfextended-settings">
|
106 |
+
|
107 |
+
<div class="leftcolumn">
|
108 |
+
<?php
|
109 |
+
if(PDF_DEPLOY === true)
|
110 |
+
{
|
111 |
+
?>
|
112 |
+
<h2>Initialise Plugin</h2>
|
113 |
+
<p>Fresh installations and users who have just upgraded will need to initialise Gravity Forms PDF Extended to ensure it works correctly.</p>
|
114 |
+
|
115 |
+
<p>Initialisation does a number of important things, including:</p>
|
116 |
+
|
117 |
+
<ol>
|
118 |
+
<li><strong>Fresh Installation</strong>: Copies all the required template and configuration files to a folder called PDF_EXTENDED_TEMPLATE in your active theme's directory.<br />
|
119 |
+
<strong>Upgrading</strong>: Copies the latest default templates and template.css file to the PDF_EXTENDED_TEMPLATE folder. <strong>If you modified these files please back them up before re-initialising as they will be removed</strong>.
|
120 |
+
</li>
|
121 |
+
<li>Unzips the mPDF package</li>
|
122 |
+
<li>Installs any fonts found in the PDF_EXTENDED_TEMPLATE/fonts/ folder</li>
|
123 |
+
</ol>
|
124 |
+
|
125 |
+
<form method="post">
|
126 |
+
<?php wp_nonce_field('gfpdf_deploy_nonce_action','gfpdf_deploy_nonce'); ?>
|
127 |
+
<input type="hidden" name="gfpdf_deploy" value="1">
|
128 |
+
<?php
|
129 |
+
|
130 |
+
/*
|
131 |
+
* Remove the cancel feature for the moment
|
132 |
+
*
|
133 |
+
|
134 |
+
if(get_option('gf_pdf_extended_deploy') == 'no') { ?>
|
135 |
+
<input type="submit" value="Cancel Deployment" class="button" id="cancelupgrade" name="cancel">
|
136 |
+
<?php } */ ?>
|
137 |
+
<input type="submit" value="Initialise Plugin" class="button" id="upgrade" name="upgrade">
|
138 |
+
|
139 |
+
<input type="submit" value="Initialise Fonts Only" class="button" id="font-initialise" name="font-initialise">
|
140 |
+
</form>
|
141 |
+
<?php } ?>
|
142 |
+
|
143 |
+
<h2><?php _e('What\'s new in v'.PDF_EXTENDED_VERSION.'?' , "gravityformspdfextended") ?></h2>
|
144 |
+
<ol>
|
145 |
+
<li><strong>Bug</strong> - Fixed issue with plugin breaking website's when the Gravity Forms plugin wasn't activated.</li>
|
146 |
+
<li><strong>Housekeeping</strong> - The plugin now only supports Gravity Forms 1.7 or higher and Wordpress 3.5 or higher.</li>
|
147 |
+
<li><strong>Housekeeping</strong> - PDF template files can no longer be accessed directly. Instead, add &html=1 to the end of your URL when viewing a PDF.</li>
|
148 |
+
<li><strong>Extension</strong> - Added additional filters to allow the lead ID and notifications to be overridden.</li>
|
149 |
+
</ol>
|
150 |
+
|
151 |
+
<h2>v3.1.3 Changelog</h2>
|
152 |
+
|
153 |
+
|
154 |
+
<ol>
|
155 |
+
<li><strong>Feature</strong> - Added signature_details_id to $form_data array which maps a signatures field ID to the array.</li>
|
156 |
+
<li><strong>Extension</strong> - Added pre-PDF generator filter for use with extensions.</li>
|
157 |
+
<li><strong>Bug</strong> - Fixed issue with quotes in entry data breaking custom templates.</li>
|
158 |
+
<li><strong>Bug</strong> - Fixed issue with the plugin not correctly using the new default configuration template, if set.</li>
|
159 |
+
<li><strong>Bug</strong> - Fixed issue with signature not being removed when only testing with file_exists(). Added second is_dir() test.</li>
|
160 |
+
<li><strong>Bug</strong> - Fixed issue with empty signature field not displaying when option 'default-show-empty' is set.</li>
|
161 |
+
<li><strong>Bug</strong> - Fixed initialisation prompt issue when the MPDF package wasn't unpacked.</li>
|
162 |
+
</ol>
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
</div>
|
168 |
+
<div class="rightcolumn">
|
169 |
+
|
170 |
+
<h2>Upgraded from v2.x.x?</h2>
|
171 |
+
<p>We’ve spend a lot of time ensuring there won’t be compatibility issues when upgrading from v2.x.x to v3.x.x of the software. If you are upgrading ensure you read our <a href="http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/">migration guide</a> to determine what changes you will need to make to take advantage of all the new features.</p>
|
172 |
+
|
173 |
+
<h2>What changed in v3.x.x?</h2>
|
174 |
+
|
175 |
+
<p> <em>Gravity Forms PDF Extended has had some major </em><em>remodelling</em><em> for v3.0.x including removal of the DOMPDF package in favour of the more powerful <a href="http://www.mpdf1.com/mpdf/">mPDF</a> PDF package.</em></p>
|
176 |
+
Along with a new HTML to PDF generator, we’ve rewritten the entire plugin’s base code to make it more user friendly to both hobbyists and rock star web developers. Configuration time is cut in half and advanced features like adding PDF security features like password protection or permissions is now accessible to users who have little experience with PHP.<br />
|
177 |
+
<p> <strong>New Features</strong></p>
|
178 |
+
<p> mPDF offers the following features out of the box:</p>
|
179 |
+
<ul>
|
180 |
+
<li> Language Support – almost all languages are supported including RTL (right to left) languages like Arabic and Hebrew and <a href="http://gravityformspdfextended.com/documentation-v3-x-x/language-support/">CJK languages</a> – Chinese, Japanese and Korean.</li>
|
181 |
+
<li> HTML Page Numbering</li>
|
182 |
+
<li> Odd and even paging with mirrored margins (most commonly used in printing).</li>
|
183 |
+
<li> Nested Tables</li>
|
184 |
+
<li> Text-justification and hyphenation</li>
|
185 |
+
<li> Table of Contents</li>
|
186 |
+
<li> Index</li>
|
187 |
+
<li> Bookmarks</li>
|
188 |
+
<li> Watermarks</li>
|
189 |
+
<li> Password protection</li>
|
190 |
+
<li> UTF-8 encoded HTML</li>
|
191 |
+
<li> Better system resource handling</li>
|
192 |
+
</ul>
|
193 |
+
<p> To see just what mPDF is capable of view the <a href="http://gravityformspdfextended.com/documentation-v3-x-x/templates/getting-started/">custom template examples</a> on our documentation pages.</p>
|
194 |
+
<p> <strong>What else is new in v3.x.x?</strong></p>
|
195 |
+
<p> A new HTML to PDF package wasn’t the only change to this edition of the software. We have rewritten the entire configuration system and made it super easy to get the software up and running.</p>
|
196 |
+
<p> Users will no longer place code in their active theme’s functions.php file. Instead, configuration will happen in a new file called <a href="http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/">configuration.php</a>, inside the PDF_EXTENDED_TEMPLATES folder (in your active theme).</p>
|
197 |
+
<p> Generating the default PDF and sending it via your notifications is now as easy as adding the following code to configuration.php.</p>
|
198 |
+
<pre> $gf_pdf_config[] = array(
|
199 |
+
'form_id' => '1',
|
200 |
+
'notifications' => true
|
201 |
+
);
|
202 |
+
</pre>
|
203 |
+
<p> More advanced features can be <a href="http://gravityformspdfextended.com/documentation-v3-x-x/installation-and-configuration/">added in a similar way</a>.</p>
|
204 |
+
<p> <strong>Documentation</strong></p>
|
205 |
+
<p> We've <a href="http://gravityformspdfextended.com/documentation-v3-x-x/">written the documentation from the ground up</a> with extensive examples of the capabilities of mPDF.</p>
|
206 |
+
</div>
|
207 |
+
|
208 |
+
</div>
|
209 |
+
<?php
|
210 |
+
}
|
211 |
+
|
212 |
+
/*
|
213 |
+
* Deploy the latest template files
|
214 |
+
*/
|
215 |
+
private function deploy()
|
216 |
+
{
|
217 |
+
$return = GFPDF_InstallUpdater::pdf_extended_activate();
|
218 |
+
if($return !== true)
|
219 |
+
{
|
220 |
+
return $return;
|
221 |
+
}
|
222 |
+
add_action('gfpdfe_notices', array("GFPDF_Settings", "gf_pdf_deploy_success"));
|
223 |
+
}
|
224 |
+
|
225 |
+
public function gf_pdf_deploy_success() {
|
226 |
+
echo '<div id="message" class="updated"><p>';
|
227 |
+
echo 'You\'ve successfully initialised Gravity Forms PDF Extended.';
|
228 |
+
echo '</p></div>';
|
229 |
+
}
|
230 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pdf.php
CHANGED
@@ -1,716 +1,735 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Gravity Forms PDF Extended
|
5 |
-
Plugin URI: http://www.gravityformspdfextended.com
|
6 |
-
Description: Gravity Forms PDF Extended allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission. Our Business Plus package also allows you to overlay field onto an existing PDF.
|
7 |
-
Version: 3.1.
|
8 |
-
Author: Blue Liquid Designs
|
9 |
-
Author URI: http://www.blueliquiddesigns.com.au
|
10 |
-
|
11 |
-
------------------------------------------------------------------------
|
12 |
-
|
13 |
-
This program is free software; you can redistribute it and/or modify
|
14 |
-
it under the terms of the GNU General Public License as published by
|
15 |
-
the Free Software Foundation; either version 2 of the License, or
|
16 |
-
(at your option) any later version.
|
17 |
-
|
18 |
-
This program is distributed in the hope that it will be useful,
|
19 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
-
GNU General Public License for more details.
|
22 |
-
*/
|
23 |
-
|
24 |
-
/*
|
25 |
-
* As PDFs can't be generated if notices are displaying turn off error reporting to the screen.
|
26 |
-
* Production servers should already have this done.
|
27 |
-
*/
|
28 |
-
if(WP_DEBUG !== true)
|
29 |
-
{
|
30 |
-
error_reporting(0);
|
31 |
-
}
|
32 |
-
|
33 |
-
/*
|
34 |
-
* Define our constants
|
35 |
-
*/
|
36 |
-
if(!defined('PDF_EXTENDED_VERSION')) { define('PDF_EXTENDED_VERSION', '3.1.
|
37 |
-
if(!defined('GF_PDF_EXTENDED_SUPPORTED_VERSION')) { define('GF_PDF_EXTENDED_SUPPORTED_VERSION', '1.
|
38 |
-
if(!defined('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION')) { define('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION', '3.
|
39 |
-
|
40 |
-
if(!defined('PDF_PLUGIN_DIR')) { define('PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ )); }
|
41 |
-
if(!defined('PDF_PLUGIN_URL')) { define('PDF_PLUGIN_URL', plugin_dir_url( __FILE__ )); }
|
42 |
-
if(!defined('PDF_SETTINGS_URL')) { define("PDF_SETTINGS_URL", site_url() .'/wp-admin/admin.php?page=gf_settings&addon=PDF'); }
|
43 |
-
if(!defined('PDF_SAVE_FOLDER')) { define('PDF_SAVE_FOLDER', 'PDF_EXTENDED_TEMPLATES'); }
|
44 |
-
if(!defined('PDF_SAVE_LOCATION')) { define('PDF_SAVE_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/output/'); }
|
45 |
-
if(!defined('PDF_FONT_LOCATION')) { define('PDF_FONT_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/fonts/'); }
|
46 |
-
if(!defined('PDF_TEMPLATE_LOCATION')) { define('PDF_TEMPLATE_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/'); }
|
47 |
-
if(!defined('PDF_TEMPLATE_URL_LOCATION')) { define('PDF_TEMPLATE_URL_LOCATION', get_stylesheet_directory_uri().'/'. PDF_SAVE_FOLDER .'/'); }
|
48 |
-
if(!defined('GF_PDF_EXTENDED_PLUGIN_BASENAME')) { define('GF_PDF_EXTENDED_PLUGIN_BASENAME', plugin_basename(__FILE__)); }
|
49 |
-
|
50 |
-
/*
|
51 |
-
* Do we need to deploy template files this edition? If yes set to true.
|
52 |
-
*/
|
53 |
-
if(!defined('PDF_DEPLOY')) { define('PDF_DEPLOY', true); }
|
54 |
-
|
55 |
-
/*
|
56 |
-
* Include the core files
|
57 |
-
*/
|
58 |
-
include PDF_PLUGIN_DIR . 'pdf-common.php';
|
59 |
-
include PDF_PLUGIN_DIR . 'pdf-configuration-indexer.php';
|
60 |
-
include PDF_PLUGIN_DIR . 'installation-update-manager.php';
|
61 |
-
include PDF_PLUGIN_DIR . 'pdf-render.php';
|
62 |
-
include PDF_PLUGIN_DIR . 'pdf-settings.php';
|
63 |
-
include PDF_PLUGIN_DIR . 'pdf-entry-detail.php';
|
64 |
-
|
65 |
-
/*
|
66 |
-
* Initiate the class after Gravity Forms has been loaded using the init hook.
|
67 |
-
*/
|
68 |
-
add_action('init', array('GFPDF_Core', 'pdf_init'));
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
*
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
add_action('
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
add_action(
|
146 |
-
add_action(
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
*
|
156 |
-
*
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
*
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
*
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
update_option('
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
*
|
294 |
-
*
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
$
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
*
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
$
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
<?php
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
*
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
$
|
346 |
-
$
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
*
|
351 |
-
|
352 |
-
|
353 |
-
$
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
*
|
358 |
-
*
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
*
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
* Set
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
$
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
if
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
$
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Gravity Forms PDF Extended
|
5 |
+
Plugin URI: http://www.gravityformspdfextended.com
|
6 |
+
Description: Gravity Forms PDF Extended allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission. Our Business Plus package also allows you to overlay field onto an existing PDF.
|
7 |
+
Version: 3.1.4
|
8 |
+
Author: Blue Liquid Designs
|
9 |
+
Author URI: http://www.blueliquiddesigns.com.au
|
10 |
+
|
11 |
+
------------------------------------------------------------------------
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* As PDFs can't be generated if notices are displaying turn off error reporting to the screen.
|
26 |
+
* Production servers should already have this done.
|
27 |
+
*/
|
28 |
+
if(WP_DEBUG !== true)
|
29 |
+
{
|
30 |
+
error_reporting(0);
|
31 |
+
}
|
32 |
+
|
33 |
+
/*
|
34 |
+
* Define our constants
|
35 |
+
*/
|
36 |
+
if(!defined('PDF_EXTENDED_VERSION')) { define('PDF_EXTENDED_VERSION', '3.1.4'); }
|
37 |
+
if(!defined('GF_PDF_EXTENDED_SUPPORTED_VERSION')) { define('GF_PDF_EXTENDED_SUPPORTED_VERSION', '1.7'); }
|
38 |
+
if(!defined('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION')) { define('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION', '3.5'); }
|
39 |
+
|
40 |
+
if(!defined('PDF_PLUGIN_DIR')) { define('PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ )); }
|
41 |
+
if(!defined('PDF_PLUGIN_URL')) { define('PDF_PLUGIN_URL', plugin_dir_url( __FILE__ )); }
|
42 |
+
if(!defined('PDF_SETTINGS_URL')) { define("PDF_SETTINGS_URL", site_url() .'/wp-admin/admin.php?page=gf_settings&addon=PDF'); }
|
43 |
+
if(!defined('PDF_SAVE_FOLDER')) { define('PDF_SAVE_FOLDER', 'PDF_EXTENDED_TEMPLATES'); }
|
44 |
+
if(!defined('PDF_SAVE_LOCATION')) { define('PDF_SAVE_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/output/'); }
|
45 |
+
if(!defined('PDF_FONT_LOCATION')) { define('PDF_FONT_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/fonts/'); }
|
46 |
+
if(!defined('PDF_TEMPLATE_LOCATION')) { define('PDF_TEMPLATE_LOCATION', get_stylesheet_directory().'/'.PDF_SAVE_FOLDER.'/'); }
|
47 |
+
if(!defined('PDF_TEMPLATE_URL_LOCATION')) { define('PDF_TEMPLATE_URL_LOCATION', get_stylesheet_directory_uri().'/'. PDF_SAVE_FOLDER .'/'); }
|
48 |
+
if(!defined('GF_PDF_EXTENDED_PLUGIN_BASENAME')) { define('GF_PDF_EXTENDED_PLUGIN_BASENAME', plugin_basename(__FILE__)); }
|
49 |
+
|
50 |
+
/*
|
51 |
+
* Do we need to deploy template files this edition? If yes set to true.
|
52 |
+
*/
|
53 |
+
if(!defined('PDF_DEPLOY')) { define('PDF_DEPLOY', true); }
|
54 |
+
|
55 |
+
/*
|
56 |
+
* Include the core files
|
57 |
+
*/
|
58 |
+
include PDF_PLUGIN_DIR . 'pdf-common.php';
|
59 |
+
include PDF_PLUGIN_DIR . 'pdf-configuration-indexer.php';
|
60 |
+
include PDF_PLUGIN_DIR . 'installation-update-manager.php';
|
61 |
+
include PDF_PLUGIN_DIR . 'pdf-render.php';
|
62 |
+
include PDF_PLUGIN_DIR . 'pdf-settings.php';
|
63 |
+
include PDF_PLUGIN_DIR . 'pdf-entry-detail.php';
|
64 |
+
|
65 |
+
/*
|
66 |
+
* Initiate the class after Gravity Forms has been loaded using the init hook.
|
67 |
+
*/
|
68 |
+
add_action('init', array('GFPDF_Core', 'pdf_init'));
|
69 |
+
|
70 |
+
|
71 |
+
class GFPDF_Core extends PDFGenerator
|
72 |
+
{
|
73 |
+
private $render;
|
74 |
+
|
75 |
+
|
76 |
+
/*
|
77 |
+
* Run public initialisation function
|
78 |
+
*/
|
79 |
+
public static function pdf_init()
|
80 |
+
{
|
81 |
+
/*
|
82 |
+
* Check if Gravity Forms is installed before we continue
|
83 |
+
* Include common functions for test
|
84 |
+
*/
|
85 |
+
if(PDF_Common::is_gravityforms_supported(GF_PDF_EXTENDED_SUPPORTED_VERSION) === false)
|
86 |
+
{
|
87 |
+
add_action('after_plugin_row_' . GF_PDF_EXTENDED_PLUGIN_BASENAME, array('GFPDF_Core', 'add_compatibility_error'));
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
elseif(PDF_Common::is_wordpress_supported(GF_PDF_EXTENDED_WP_SUPPORTED_VERSION) === false)
|
91 |
+
{
|
92 |
+
add_action('after_plugin_row_' . GF_PDF_EXTENDED_PLUGIN_BASENAME, array('GFPDF_Core', 'add_wp_compatibility_error'));
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
else
|
96 |
+
{
|
97 |
+
add_action('after_plugin_row_' . GF_PDF_EXTENDED_PLUGIN_BASENAME, array('GFPDF_Core', 'add_documentation_byline'));
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
/*
|
102 |
+
* As it's called inside a undefined function we need to globalise the $gfpdf namespace
|
103 |
+
*/
|
104 |
+
global $gfpdf;
|
105 |
+
$gfpdf = new GFPDF_Core();
|
106 |
+
|
107 |
+
if(PDFGenerator::$gf_compatibility != 'post 1.7')
|
108 |
+
{
|
109 |
+
/*
|
110 |
+
* Look up notifications from INDEX and determine whether to fire or not
|
111 |
+
*/
|
112 |
+
add_action("gform_pre_submission", array('GFPDF_Core', 'determine_notification_hook'), 1, 1);
|
113 |
+
}
|
114 |
+
|
115 |
+
/*
|
116 |
+
* Some functions require the Wordpress Admin area to be fully loaded before we do any processing
|
117 |
+
*/
|
118 |
+
add_action('wp_loaded', array('GFPDF_Core', 'fully_loaded_admin'));
|
119 |
+
}
|
120 |
+
|
121 |
+
public function __construct()
|
122 |
+
{
|
123 |
+
/*
|
124 |
+
* Set up the PDF configuration and indexer
|
125 |
+
* Accessed through $this->configuration and $this->index.
|
126 |
+
*/
|
127 |
+
parent::__construct();
|
128 |
+
|
129 |
+
/*
|
130 |
+
* Add our installation/file handling hooks
|
131 |
+
*/
|
132 |
+
add_action('admin_init', array($this, 'gfe_admin_init'), 9);
|
133 |
+
add_action('after_switch_theme', array('GFPDF_InstallUpdater', 'gf_pdf_on_switch_theme'), 10, 2);
|
134 |
+
register_activation_hook( __FILE__, array('GFPDF_InstallUpdater', 'install') );
|
135 |
+
|
136 |
+
|
137 |
+
/*
|
138 |
+
* Add our main hooks if the system is installed correctly
|
139 |
+
*/
|
140 |
+
if(PDF_Common::is_fully_installed() === false)
|
141 |
+
{
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
add_action('gform_entries_first_column_actions', array($this, 'pdf_link'), 10, 4);
|
146 |
+
add_action("gform_entry_info", array($this, 'detail_pdf_link'), 10, 2);
|
147 |
+
add_action('wp', array($this, 'process_exterior_pages'));
|
148 |
+
|
149 |
+
/*
|
150 |
+
* Register render class
|
151 |
+
*/
|
152 |
+
$this->render = new PDFRender();
|
153 |
+
|
154 |
+
/*
|
155 |
+
* Run PDF generate / email code based on version
|
156 |
+
* $gf_compatibility located in pdf-configuration-indexer.php
|
157 |
+
* Values are either pre 1.7 or post 1.7
|
158 |
+
*/
|
159 |
+
if(PDFGenerator::$gf_compatibility == 'post 1.7')
|
160 |
+
{
|
161 |
+
add_filter('gform_notification', array('GFPDF_Core', 'gfpdfe_create_and_attach_pdf'), 10, 3);
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
/*
|
167 |
+
* Do processes that require Wordpress Admin to be fully loaded
|
168 |
+
*/
|
169 |
+
public static function fully_loaded_admin()
|
170 |
+
{
|
171 |
+
/*
|
172 |
+
* Check if the user has switched themes and they haven't yet prompt user to copy over directory structure
|
173 |
+
* If the plugin has just initialised we won't check for a theme swap as initialisation will reset this value
|
174 |
+
*/
|
175 |
+
if(!rgpost('upgrade'))
|
176 |
+
{
|
177 |
+
GFPDF_InstallUpdater::check_theme_switch();
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/*
|
182 |
+
* Display compatibility error about Gravity Forms on the plugins page
|
183 |
+
*/
|
184 |
+
public static function add_compatibility_error()
|
185 |
+
{
|
186 |
+
PDF_Common::display_compatibility_error();
|
187 |
+
}
|
188 |
+
|
189 |
+
/*
|
190 |
+
* Display compatibility error about Gravity Forms on the plugins page
|
191 |
+
*/
|
192 |
+
public static function add_wp_compatibility_error()
|
193 |
+
{
|
194 |
+
PDF_Common::display_wp_compatibility_error();
|
195 |
+
}
|
196 |
+
|
197 |
+
/*
|
198 |
+
* Display note about documentation
|
199 |
+
*/
|
200 |
+
public static function add_documentation_byline()
|
201 |
+
{
|
202 |
+
PDF_Common::display_documentation_details();
|
203 |
+
}
|
204 |
+
|
205 |
+
/*
|
206 |
+
* Add pre-submission hook to determine if notifications are fired or not
|
207 |
+
*/
|
208 |
+
public static function determine_notification_hook($form) {
|
209 |
+
global $gfpdf;
|
210 |
+
|
211 |
+
$form_id = $form['id'];
|
212 |
+
|
213 |
+
/*
|
214 |
+
* Get indexes which include this form
|
215 |
+
* Only need the first value if it exists
|
216 |
+
*/
|
217 |
+
$config = $gfpdf->get_config($form_id);
|
218 |
+
|
219 |
+
if(sizeof($config) > 0)
|
220 |
+
{
|
221 |
+
/*
|
222 |
+
* Get user configured notifications and call appropriate hook
|
223 |
+
*/
|
224 |
+
$notifications = $gfpdf->get_form_notifications($form, $config[0]);
|
225 |
+
|
226 |
+
if(in_array('Admin Notification', $notifications))
|
227 |
+
{
|
228 |
+
add_filter("gform_admin_notification_attachments", array('GFPDF_Core', 'gfpdfe_create_and_attach_pdf'), 1, 3);
|
229 |
+
}
|
230 |
+
|
231 |
+
if(in_array('User Notification', $notifications))
|
232 |
+
{
|
233 |
+
add_filter("gform_user_notification_attachments", array('GFPDF_Core', 'gfpdfe_create_and_attach_pdf'), 1, 3);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
return $form;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Check to see if Gravity Forms is actually installed
|
241 |
+
*/
|
242 |
+
function gfe_admin_init()
|
243 |
+
{
|
244 |
+
|
245 |
+
/*
|
246 |
+
* Check if database plugin version matches current plugin version and updates if needed
|
247 |
+
*/
|
248 |
+
if(get_option('gf_pdf_extended_version') != PDF_EXTENDED_VERSION)
|
249 |
+
{
|
250 |
+
update_option('gf_pdf_extended_deploy', 'no');
|
251 |
+
update_option('gf_pdf_extended_version', PDF_EXTENDED_VERSION);
|
252 |
+
/* redirect */
|
253 |
+
Header('Location: '.PDF_SETTINGS_URL);
|
254 |
+
exit;
|
255 |
+
}
|
256 |
+
|
257 |
+
/*
|
258 |
+
* Check if GF PDF Extended is correctly installed. If not we'll run the installer.
|
259 |
+
*/
|
260 |
+
$theme_switch = get_option('gfpdfe_switch_theme');
|
261 |
+
|
262 |
+
if( ( (get_option('gf_pdf_extended_installed') != 'installed') || (!is_dir(PDF_TEMPLATE_LOCATION)) ) && (!rgpost('upgrade') && (empty($theme_switch['old']) ) ) )
|
263 |
+
{
|
264 |
+
/*
|
265 |
+
* Prompt user to initialise plugin
|
266 |
+
*/
|
267 |
+
add_action('admin_notices', array("GFPDF_InstallUpdater", "gf_pdf_not_deployed_fresh"));
|
268 |
+
}
|
269 |
+
else
|
270 |
+
{
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Check if deployed new template files after update
|
274 |
+
*/
|
275 |
+
if( (get_option('gf_pdf_extended_deploy') == 'no' && !rgpost('upgrade') && PDF_DEPLOY === true) || (file_exists(PDF_PLUGIN_DIR .'mPDF.zip') && !rgpost('upgrade') ) ) {
|
276 |
+
/*show warning message */
|
277 |
+
add_action('admin_notices', array("GFPDF_InstallUpdater", "gf_pdf_not_deployed"));
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
/*
|
282 |
+
* Configure the settings page
|
283 |
+
*/
|
284 |
+
wp_enqueue_style( 'pdfextended-admin-styles', PDF_PLUGIN_URL . 'styles/admin-styles.css' );
|
285 |
+
|
286 |
+
GFPDF_Settings::settings_page();
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
|
291 |
+
function detail_pdf_link($form_id, $lead) {
|
292 |
+
/*
|
293 |
+
* Get the template name
|
294 |
+
* Class: PDFGenerator
|
295 |
+
* File: pdf-configuration-indexer.php
|
296 |
+
*/
|
297 |
+
$template = $this->get_template($form_id);
|
298 |
+
|
299 |
+
if($template !== false)
|
300 |
+
{
|
301 |
+
$lead_id = $lead['id'];
|
302 |
+
$url = home_url() .'/?gf_pdf=print-entry&fid=' . $form_id . '&lid=' . $lead_id . '&template=' . $template;
|
303 |
+
|
304 |
+
?>
|
305 |
+
PDF: <a href="<?php echo $url; ?>" onclick="var url='<?php echo $url; ?>'; window.open (url); return false;" class="button">View</a>
|
306 |
+
<a href="<?php echo $url.'&download=1'; ?>" onclick="var url='<?php echo $url.'&download=1'; ?>'; window.open (url); return false;" class="button">Download</a>
|
307 |
+
<?php
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
function pdf_link($form_id, $field_id, $value, $lead) {
|
312 |
+
/*
|
313 |
+
* Get the template name
|
314 |
+
* Class: PDFGenerator
|
315 |
+
* File: pdf-configuration-indexer.php
|
316 |
+
*/
|
317 |
+
$template = $this->get_template($form_id);
|
318 |
+
|
319 |
+
if($template !== false)
|
320 |
+
{
|
321 |
+
$lead_id = $lead['id'];
|
322 |
+
$url = home_url() .'/?gf_pdf=print-entry&fid=' . $form_id . '&lid=' . $lead_id . '&template=' . $template;
|
323 |
+
|
324 |
+
?>
|
325 |
+
| <a href="<?php echo $url; ?>" onclick="var url='<?php echo $url; ?>'; window.open (url); return false;"> View PDF</a>
|
326 |
+
<?php
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
/*
|
331 |
+
* Handle incoming routes
|
332 |
+
* Look for $_GET['gf_pdf'] variable, authenticate user and generate/display PDF
|
333 |
+
*/
|
334 |
+
function process_exterior_pages() {
|
335 |
+
global $wpdb;
|
336 |
+
|
337 |
+
/*
|
338 |
+
* If $_GET variable isn't set then stop function
|
339 |
+
*/
|
340 |
+
if(rgempty("gf_pdf", $_GET))
|
341 |
+
{
|
342 |
+
return;
|
343 |
+
}
|
344 |
+
|
345 |
+
$form_id = (int) $_GET['fid'];
|
346 |
+
$lead_id = (int) $_GET['lid'];
|
347 |
+
$ip = PDF_Common::getRealIpAddr();
|
348 |
+
|
349 |
+
/*
|
350 |
+
* Before setting up PDF options we will check if a configuration is found
|
351 |
+
* If not, we will set up defaults defined in configuration.php
|
352 |
+
*/
|
353 |
+
$all_indexes = $this->check_configuration($form_id);
|
354 |
+
$index = $all_indexes[0];
|
355 |
+
|
356 |
+
/*
|
357 |
+
* Get the template name
|
358 |
+
* Class: PDFGenerator
|
359 |
+
* File: pdf-configuration-indexer.php
|
360 |
+
*/
|
361 |
+
$template = $this->get_template($form_id);
|
362 |
+
|
363 |
+
/*
|
364 |
+
* Run if user is not logged in
|
365 |
+
*/
|
366 |
+
if(!is_user_logged_in())
|
367 |
+
{
|
368 |
+
/*
|
369 |
+
* Check the lead is in the database and the IP address matches (little security booster)
|
370 |
+
*/
|
371 |
+
$form_entries = $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM `".$wpdb->prefix."rg_lead` WHERE form_id = ".$form_id." AND status = 'active' AND id = ".$lead_id." AND ip = '".$ip."'", array() ) );
|
372 |
+
|
373 |
+
if($form_entries == 0 && $this->configuration[$index]['access'] !== 'all')
|
374 |
+
{
|
375 |
+
auth_redirect();
|
376 |
+
}
|
377 |
+
|
378 |
+
}
|
379 |
+
else
|
380 |
+
{
|
381 |
+
/*
|
382 |
+
* Ensure logged in users have the correct privilages
|
383 |
+
*/
|
384 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries"))
|
385 |
+
{
|
386 |
+
/*
|
387 |
+
* User doesn't have the correct access privilages so don't generate PDF
|
388 |
+
*/
|
389 |
+
break;
|
390 |
+
}
|
391 |
+
|
392 |
+
/*
|
393 |
+
* Because this user is logged in with the correct access
|
394 |
+
* we will allow a template to be shown by setting the template variable
|
395 |
+
*/
|
396 |
+
|
397 |
+
if( ($template != $_GET['template']) && (substr($_GET['template'], -4) == '.php') )
|
398 |
+
{
|
399 |
+
$template = $_GET['template'];
|
400 |
+
}
|
401 |
+
|
402 |
+
}
|
403 |
+
|
404 |
+
|
405 |
+
switch(rgget("gf_pdf")){
|
406 |
+
case "print-entry" :
|
407 |
+
|
408 |
+
$pdf_arguments = $this->generate_pdf_parameters($index, $form_id, $lead_id, $template);
|
409 |
+
|
410 |
+
/*
|
411 |
+
* Add output to arguments
|
412 |
+
*/
|
413 |
+
$output = 'view';
|
414 |
+
if(isset($_GET['download']))
|
415 |
+
{
|
416 |
+
$output = 'download';
|
417 |
+
}
|
418 |
+
|
419 |
+
$pdf_arguments['output'] = $output;
|
420 |
+
|
421 |
+
$this->render->PDF_Generator($form_id, $lead_id, $pdf_arguments);
|
422 |
+
break;
|
423 |
+
}
|
424 |
+
exit();
|
425 |
+
}
|
426 |
+
|
427 |
+
public static function gfpdfe_create_and_attach_pdf($notification, $form, $entry)
|
428 |
+
{
|
429 |
+
$notification = self::do_notification($notification, $form, $entry);
|
430 |
+
return $notification;
|
431 |
+
}
|
432 |
+
|
433 |
+
/*
|
434 |
+
* Handles the Gravity Forms notification logic
|
435 |
+
*/
|
436 |
+
public static function do_notification($notification, $form, $entry)
|
437 |
+
{
|
438 |
+
/*
|
439 |
+
* Allow the template/function access to these variables
|
440 |
+
*/
|
441 |
+
global $gfpdf, $form_id, $lead_id;
|
442 |
+
|
443 |
+
if(self::$gf_compatibility != 'post 1.7')
|
444 |
+
{
|
445 |
+
/*
|
446 |
+
* Prior to 1.7 the notifications hook was $attachments, $lead, $form
|
447 |
+
* Swap $form and $entry values around to match 1.7
|
448 |
+
*/
|
449 |
+
$temp_form = $form;
|
450 |
+
$temp_entry = $entry;
|
451 |
+
$form = $temp_entry;
|
452 |
+
$entry = $temp_form;
|
453 |
+
|
454 |
+
$temp_form = $temp_entry = false;
|
455 |
+
}
|
456 |
+
else
|
457 |
+
{
|
458 |
+
$notification_name = (isset($notification['name'])) ? $notification['name'] : '';
|
459 |
+
}
|
460 |
+
|
461 |
+
/*
|
462 |
+
* Set data used to determine if PDF needs to be created and attached to notification
|
463 |
+
* Don't change anything here.
|
464 |
+
*/
|
465 |
+
$form_title = $form['title'];
|
466 |
+
$form_id = $entry['form_id'];
|
467 |
+
$lead_id = apply_filters('gfpdfe_lead_id', $entry['id'], $form, $entry, $gfpdf); /* allow premium plugins to override the lead ID */
|
468 |
+
$folder_id = $form_id.$lead_id.'/';
|
469 |
+
|
470 |
+
/*
|
471 |
+
* Depreciated - Backwards Compatibility
|
472 |
+
* Set Constants
|
473 |
+
*/
|
474 |
+
if(!defined('GF_FORM_ID'))
|
475 |
+
{
|
476 |
+
/* TODO */
|
477 |
+
define('GF_FORM_ID', $form_id);
|
478 |
+
define('GF_LEAD_ID', $lead_id);
|
479 |
+
}
|
480 |
+
|
481 |
+
/*
|
482 |
+
* Before setting up PDF options we will check if a configuration is found
|
483 |
+
* If not, we will set up defaults defined in configuration.php
|
484 |
+
*/
|
485 |
+
$gfpdf->check_configuration($form_id);
|
486 |
+
|
487 |
+
|
488 |
+
/*
|
489 |
+
* Check if form is in configuration
|
490 |
+
*/
|
491 |
+
|
492 |
+
if(!$config = $gfpdf->get_config($form_id))
|
493 |
+
{
|
494 |
+
return $notification;
|
495 |
+
}
|
496 |
+
|
497 |
+
/*
|
498 |
+
* To have our configuration indexes so loop through the PDF template configuration
|
499 |
+
* and generate and attach PDF files.
|
500 |
+
*/
|
501 |
+
foreach($config as $index)
|
502 |
+
{
|
503 |
+
$template = (isset($gfpdf->configuration[$index]['template'])) ? $gfpdf->configuration[$index]['template'] : '';
|
504 |
+
|
505 |
+
$pdf_arguments = $gfpdf->generate_pdf_parameters($index, $form_id, $lead_id, $template);
|
506 |
+
|
507 |
+
/* generate and save default PDF */
|
508 |
+
$filename = $gfpdf->render->PDF_Generator($form_id, $lead_id, $pdf_arguments);
|
509 |
+
|
510 |
+
/* Get notifications user wants PDF attached to and check if the correct notifications hook is running */
|
511 |
+
$notifications = $gfpdf->get_form_notifications($form, $index);
|
512 |
+
|
513 |
+
/* Set attachment name */
|
514 |
+
$attachment_file = $filename;
|
515 |
+
|
516 |
+
/*
|
517 |
+
* Version Control
|
518 |
+
* Do additional checks on 1.7 as it passed the notification name to the hook
|
519 |
+
* Checks done for prior versions done before assigning hook
|
520 |
+
*/
|
521 |
+
if(PDFGenerator::$gf_compatibility == 'post 1.7')
|
522 |
+
{
|
523 |
+
/*
|
524 |
+
* Premium plugin filter
|
525 |
+
* Allows manual override of the notification
|
526 |
+
* Allows the multi-report plugin to automate PDFs based on weekly/fortnightly/monthly basis
|
527 |
+
* Only allow boolean to be returned
|
528 |
+
*/
|
529 |
+
$notification_override = (bool) apply_filters('gfpdfe_notification_override', false, $notification_name, $notifications, $form, $entry, $gfpdf);
|
530 |
+
|
531 |
+
if ($gfpdf->check_notification($notification_name, $notifications) || $notification_override === true)
|
532 |
+
{
|
533 |
+
$notification['attachments'][] = $attachment_file;
|
534 |
+
}
|
535 |
+
}
|
536 |
+
else
|
537 |
+
{
|
538 |
+
/*
|
539 |
+
* Did notification validation prior to running hook as pre 1.7 only
|
540 |
+
* passed admin and user notifications and doesn't tell you which one is running
|
541 |
+
*/
|
542 |
+
$notification[] = $attachment_file;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
return $notification;
|
546 |
+
}
|
547 |
+
|
548 |
+
/*
|
549 |
+
* Check if name in notification_name String/Array matches value in $notifcations array
|
550 |
+
*/
|
551 |
+
public function check_notification($notification_name, $notifications)
|
552 |
+
{
|
553 |
+
if(is_array($notification_name))
|
554 |
+
{
|
555 |
+
foreach($notification_name as $name)
|
556 |
+
{
|
557 |
+
if(in_array($name, $notifications))
|
558 |
+
{
|
559 |
+
return true;
|
560 |
+
}
|
561 |
+
}
|
562 |
+
}
|
563 |
+
else
|
564 |
+
{
|
565 |
+
if(in_array($notification_name, $notifications))
|
566 |
+
{
|
567 |
+
return true;
|
568 |
+
}
|
569 |
+
}
|
570 |
+
|
571 |
+
return false;
|
572 |
+
}
|
573 |
+
|
574 |
+
public static function get_notifications_name($action, $form){
|
575 |
+
if(rgempty("notifications", $form))
|
576 |
+
return array();
|
577 |
+
|
578 |
+
$notifications = array();
|
579 |
+
foreach($form["notifications"] as $notification){
|
580 |
+
if(rgar($notification, "event") == $action)
|
581 |
+
$notifications[] = $notification['name'];
|
582 |
+
}
|
583 |
+
|
584 |
+
return $notifications;
|
585 |
+
}
|
586 |
+
|
587 |
+
public static function get_form_notifications($form, $index)
|
588 |
+
{
|
589 |
+
global $gfpdf;
|
590 |
+
|
591 |
+
/*
|
592 |
+
* Check if notification field even exists
|
593 |
+
*/
|
594 |
+
if(!isset($gfpdf->configuration[$index]['notifications']))
|
595 |
+
{
|
596 |
+
return array();
|
597 |
+
}
|
598 |
+
|
599 |
+
/*
|
600 |
+
* Get all form_submission notifications and
|
601 |
+
*/
|
602 |
+
if(self::$gf_compatibility != 'post 1.7')
|
603 |
+
{
|
604 |
+
$notifications = self::$pre_1_7_notifications;
|
605 |
+
}
|
606 |
+
else
|
607 |
+
{
|
608 |
+
$notifications = self::get_notifications_name('form_submission', $form);
|
609 |
+
}
|
610 |
+
$new_notifications = array();
|
611 |
+
|
612 |
+
/*
|
613 |
+
* If notifications is true the user wants to attach the PDF to all notifications
|
614 |
+
*/
|
615 |
+
if($gfpdf->configuration[$index]['notifications'] === true)
|
616 |
+
{
|
617 |
+
$new_notifications = $notifications;
|
618 |
+
}
|
619 |
+
/*
|
620 |
+
* Only a single notification is selected
|
621 |
+
*/
|
622 |
+
else if(!is_array($gfpdf->configuration[$index]['notifications']))
|
623 |
+
{
|
624 |
+
/*
|
625 |
+
* Ensure that notification is valid
|
626 |
+
*/
|
627 |
+
if(in_array($gfpdf->configuration[$index]['notifications'], $notifications))
|
628 |
+
{
|
629 |
+
$new_notifications = array($gfpdf->configuration[$index]['notifications']);
|
630 |
+
}
|
631 |
+
}
|
632 |
+
else
|
633 |
+
{
|
634 |
+
foreach($gfpdf->configuration[$index]['notifications'] as $name)
|
635 |
+
{
|
636 |
+
if(in_array($name, $notifications))
|
637 |
+
{
|
638 |
+
$new_notifications[] = $name;
|
639 |
+
}
|
640 |
+
}
|
641 |
+
}
|
642 |
+
|
643 |
+
return $new_notifications;
|
644 |
+
}
|
645 |
+
|
646 |
+
/*
|
647 |
+
* Generate PDF parameters to pass to the PDF renderer
|
648 |
+
* $index Integer The configuration index number
|
649 |
+
*/
|
650 |
+
private function generate_pdf_parameters($index, $form_id, $lead_id, $template = '')
|
651 |
+
{
|
652 |
+
|
653 |
+
$pdf_name = (isset($this->configuration[$index]['filename']) && strlen($this->configuration[$index]['filename']) > 0) ? $this->get_pdf_name($index, $form_id, $lead_id) : PDF_Common::get_pdf_filename($form_id, $lead_id);
|
654 |
+
$template = (isset($template) && strlen($template) > 0) ? $template : $this->get_template($index);
|
655 |
+
|
656 |
+
$pdf_size = (isset($this->configuration[$index]['pdf_size']) && (is_array($this->configuration[$index]['pdf_size']) || strlen($this->configuration[$index]['pdf_size']) > 0)) ? $this->configuration[$index]['pdf_size'] : self::$default['pdf_size'];
|
657 |
+
$orientation = (isset($this->configuration[$index]['orientation']) && strlen($this->configuration[$index]['orientation']) > 0) ? $this->configuration[$index]['orientation'] : self::$default['orientation'];
|
658 |
+
$security = (isset($this->configuration[$index]['security']) && $this->configuration[$index]['security']) ? $this->configuration[$index]['security'] : self::$default['security'];
|
659 |
+
$premium = (isset($this->configuration[$index]['premium']) && $this->configuration[$index]['premium'] === true) ? true: false;
|
660 |
+
|
661 |
+
|
662 |
+
/*
|
663 |
+
* Validate privileges
|
664 |
+
* If blank and security is true then set privileges to all
|
665 |
+
*/
|
666 |
+
$privileges = (isset($this->configuration[$index]['pdf_privileges'])) ? $this->validate_privileges($this->configuration[$index]['pdf_privileges']) : $this->validate_privileges('');
|
667 |
+
|
668 |
+
$pdf_password = (isset($this->configuration[$index]['pdf_password'])) ? $this->configuration[$index]['pdf_password'] : '';
|
669 |
+
$master_password = (isset($this->configuration[$index]['pdf_master_password'])) ? $this->configuration[$index]['pdf_master_password'] : '';
|
670 |
+
$rtl = (isset($this->configuration[$index]['rtl'])) ? $this->configuration[$index]['rtl'] : false;
|
671 |
+
|
672 |
+
$pdf_arguments = array(
|
673 |
+
'pdfname' => apply_filters('gfpdfe_pdf_name', $pdf_name, RGFormsModel::get_form_meta($form_id), RGFormsModel::get_lead($lead_id)),
|
674 |
+
'template' => apply_filters('gfpdfe_template', $template, RGFormsModel::get_form_meta($form_id), RGFormsModel::get_lead($lead_id)),
|
675 |
+
'pdf_size' => $pdf_size, /* set to one of the following, or array - in millimeters */
|
676 |
+
'orientation' => $orientation, /* landscape or portrait */
|
677 |
+
|
678 |
+
'security' => $security, /* true or false. if true the security settings below will be applied. Default false. */
|
679 |
+
'pdf_password' => $pdf_password, /* set a password to view the PDF */
|
680 |
+
'pdf_privileges' => $privileges, /* assign user privliages to the PDF */
|
681 |
+
'pdf_master_password' => $master_password, /* set a master password to the PDF can't be modified without it */
|
682 |
+
'rtl' => $rtl,
|
683 |
+
'premium' => $premium
|
684 |
+
);
|
685 |
+
|
686 |
+
return $pdf_arguments;
|
687 |
+
}
|
688 |
+
|
689 |
+
/*
|
690 |
+
* Checks if a configuration index is found
|
691 |
+
* If not, we will set up defaults defined in configuration.php if they exist
|
692 |
+
*/
|
693 |
+
public function check_configuration($form_id)
|
694 |
+
{
|
695 |
+
|
696 |
+
global $gf_pdf_default_configuration;
|
697 |
+
|
698 |
+
/*
|
699 |
+
* Check if configuration index already defined
|
700 |
+
*/
|
701 |
+
if(empty($this->index[$form_id]))
|
702 |
+
{
|
703 |
+
|
704 |
+
/*
|
705 |
+
* Check if a default configuration is defined
|
706 |
+
*/
|
707 |
+
if(is_array($gf_pdf_default_configuration) && sizeof($gf_pdf_default_configuration) > 0)
|
708 |
+
{
|
709 |
+
|
710 |
+
/*
|
711 |
+
* Add form_id to the defualt configuration
|
712 |
+
*/
|
713 |
+
$default_configuration = array_merge($gf_pdf_default_configuration, array('form_id' => $form_id));
|
714 |
+
|
715 |
+
/*
|
716 |
+
* There is no configuration index and there is a default index so add the defaults to this form's configuration
|
717 |
+
*/
|
718 |
+
$this->configuration[] = $default_configuration;
|
719 |
+
|
720 |
+
/* get the id of the newly added configuration */
|
721 |
+
end($this->configuration);
|
722 |
+
$index = key($this->configuration);
|
723 |
+
|
724 |
+
/* now add to the index */
|
725 |
+
$this->assign_index($form_id, $index);
|
726 |
+
|
727 |
+
}
|
728 |
+
}
|
729 |
+
else
|
730 |
+
{
|
731 |
+
$index = $this->index[$form_id];
|
732 |
+
}
|
733 |
+
return $index;
|
734 |
+
}
|
735 |
+
}
|
render_to_pdf.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* File: render_to_pdf.php
|
5 |
-
* Status: Depreciated as of GF PDF Extended 3.0.0
|
6 |
-
* Left here to ensure backward compatibility
|
7 |
-
* File replaced by pdf-render.php
|
8 |
-
* Add compatibility functions to ensure backwards compatibility with the software
|
9 |
-
*/
|
10 |
-
|
11 |
-
/*
|
12 |
-
* Added to ensure backwards compatibility with older versions of the software
|
13 |
-
*/
|
14 |
-
|
15 |
-
if(!function_exists('PDF_Generator'))
|
16 |
-
{
|
17 |
-
function PDF_Generator($form_id, $lead_id, $arguments = 'view', $return = false, $template = 'default-template.php', $pdfname = '', $fpdf = false)
|
18 |
-
{
|
19 |
-
if(is_array($arguments))
|
20 |
-
{
|
21 |
-
$output = (isset($arguments['output']) && strlen($arguments['output']) > 0) ? $arguments['output'] : 'save';
|
22 |
-
$return = (isset($arguments['return']) && $arguments['return'] === true) ? $arguments['return'] : false;
|
23 |
-
$fpdf = (isset($arguments['fpdf']) && $arguments['fpdf'] === true) ? $arguments['fpdf'] : false;
|
24 |
-
$template = (isset($arguments['template']) && strlen($arguments['template']) > 0) ? $arguments['template'] : 'default-template.php';
|
25 |
-
$pdfname = (isset($arguments['pdfname']) && strlen($arguments['pdfname']) > 0) ? $arguments['pdfname'] : get_pdf_filename($form_id, $lead_id);
|
26 |
-
}
|
27 |
-
else
|
28 |
-
{
|
29 |
-
/* maintain backwards compatibility */
|
30 |
-
$output = $arguments;
|
31 |
-
}
|
32 |
-
|
33 |
-
if(strlen($pdfname) == 0)
|
34 |
-
{
|
35 |
-
$pdfname = get_pdf_filename($form_id, $lead_id);
|
36 |
-
}
|
37 |
-
|
38 |
-
$new_arguments = array(
|
39 |
-
'output' => $output,
|
40 |
-
'return' => $return,
|
41 |
-
'template' => $template,
|
42 |
-
'pdfname' => $pdfname,
|
43 |
-
'fpdf' => $fpdf
|
44 |
-
);
|
45 |
-
|
46 |
-
/*
|
47 |
-
* Depreciated - Backwards Compatibility
|
48 |
-
* Set Constants
|
49 |
-
*/
|
50 |
-
if(!defined('GF_FORM_ID'))
|
51 |
-
{
|
52 |
-
/* TODO */
|
53 |
-
trigger_error('Gravity Forms PDF Extended constants GF_FORM_ID and GF_LEAD_ID depreciated in v3.0.0. Custom template files should be updated with the new code. See http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/ for upgrade instructions.');
|
54 |
-
define('GF_FORM_ID', $form_id);
|
55 |
-
define('GF_LEAD_ID', $lead_id);
|
56 |
-
}
|
57 |
-
|
58 |
-
$render = new PDFRender();
|
59 |
-
return $render->PDF_Generator($form_id, $lead_id, $new_arguments);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
if(!function_exists('get_pdf_filename'))
|
64 |
-
{
|
65 |
-
function get_pdf_filename($form_id, $lead_id)
|
66 |
-
{
|
67 |
-
return PDF_Common::get_pdf_filename($form_id, $lead_id);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* File: render_to_pdf.php
|
5 |
+
* Status: Depreciated as of GF PDF Extended 3.0.0
|
6 |
+
* Left here to ensure backward compatibility
|
7 |
+
* File replaced by pdf-render.php
|
8 |
+
* Add compatibility functions to ensure backwards compatibility with the software
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
* Added to ensure backwards compatibility with older versions of the software
|
13 |
+
*/
|
14 |
+
|
15 |
+
if(!function_exists('PDF_Generator'))
|
16 |
+
{
|
17 |
+
function PDF_Generator($form_id, $lead_id, $arguments = 'view', $return = false, $template = 'default-template.php', $pdfname = '', $fpdf = false)
|
18 |
+
{
|
19 |
+
if(is_array($arguments))
|
20 |
+
{
|
21 |
+
$output = (isset($arguments['output']) && strlen($arguments['output']) > 0) ? $arguments['output'] : 'save';
|
22 |
+
$return = (isset($arguments['return']) && $arguments['return'] === true) ? $arguments['return'] : false;
|
23 |
+
$fpdf = (isset($arguments['fpdf']) && $arguments['fpdf'] === true) ? $arguments['fpdf'] : false;
|
24 |
+
$template = (isset($arguments['template']) && strlen($arguments['template']) > 0) ? $arguments['template'] : 'default-template.php';
|
25 |
+
$pdfname = (isset($arguments['pdfname']) && strlen($arguments['pdfname']) > 0) ? $arguments['pdfname'] : get_pdf_filename($form_id, $lead_id);
|
26 |
+
}
|
27 |
+
else
|
28 |
+
{
|
29 |
+
/* maintain backwards compatibility */
|
30 |
+
$output = $arguments;
|
31 |
+
}
|
32 |
+
|
33 |
+
if(strlen($pdfname) == 0)
|
34 |
+
{
|
35 |
+
$pdfname = get_pdf_filename($form_id, $lead_id);
|
36 |
+
}
|
37 |
+
|
38 |
+
$new_arguments = array(
|
39 |
+
'output' => $output,
|
40 |
+
'return' => $return,
|
41 |
+
'template' => $template,
|
42 |
+
'pdfname' => $pdfname,
|
43 |
+
'fpdf' => $fpdf
|
44 |
+
);
|
45 |
+
|
46 |
+
/*
|
47 |
+
* Depreciated - Backwards Compatibility
|
48 |
+
* Set Constants
|
49 |
+
*/
|
50 |
+
if(!defined('GF_FORM_ID'))
|
51 |
+
{
|
52 |
+
/* TODO */
|
53 |
+
trigger_error('Gravity Forms PDF Extended constants GF_FORM_ID and GF_LEAD_ID depreciated in v3.0.0. Custom template files should be updated with the new code. See http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/ for upgrade instructions.');
|
54 |
+
define('GF_FORM_ID', $form_id);
|
55 |
+
define('GF_LEAD_ID', $lead_id);
|
56 |
+
}
|
57 |
+
|
58 |
+
$render = new PDFRender();
|
59 |
+
return $render->PDF_Generator($form_id, $lead_id, $new_arguments);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
if(!function_exists('get_pdf_filename'))
|
64 |
+
{
|
65 |
+
function get_pdf_filename($form_id, $lead_id)
|
66 |
+
{
|
67 |
+
return PDF_Common::get_pdf_filename($form_id, $lead_id);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
?>
|
templates/default-template-no-style.php
CHANGED
@@ -1,77 +1,54 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
?>
|
55 |
-
|
56 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
57 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
58 |
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
59 |
-
<head>
|
60 |
-
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
61 |
-
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
62 |
-
<title>Gravity Forms PDF Extended</title>
|
63 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
64 |
-
</head>
|
65 |
-
<body>
|
66 |
-
<div class="no-style">
|
67 |
-
<?php
|
68 |
-
|
69 |
-
foreach($lead_ids as $lead_id) {
|
70 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
71 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
72 |
-
}
|
73 |
-
|
74 |
-
?>
|
75 |
-
</div>
|
76 |
-
</body>
|
77 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
global $gfpdf;
|
19 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
20 |
+
|
21 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
22 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
23 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
27 |
+
*/
|
28 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
29 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
30 |
+
|
31 |
+
?>
|
32 |
+
|
33 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
34 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
35 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
36 |
+
<head>
|
37 |
+
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
38 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
39 |
+
<title>Gravity Forms PDF Extended</title>
|
40 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
41 |
+
</head>
|
42 |
+
<body>
|
43 |
+
<div class="no-style">
|
44 |
+
<?php
|
45 |
+
|
46 |
+
foreach($lead_ids as $lead_id) {
|
47 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
48 |
+
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
49 |
+
}
|
50 |
+
|
51 |
+
?>
|
52 |
+
</div>
|
53 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</html>
|
templates/default-template-two-rows.php
CHANGED
@@ -1,79 +1,55 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
57 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
58 |
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
59 |
-
<head>
|
60 |
-
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
61 |
-
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
62 |
-
<title>Gravity Forms PDF Extended</title>
|
63 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
64 |
-
|
65 |
-
</head>
|
66 |
-
<body>
|
67 |
-
<div class="two_row">
|
68 |
-
<?php
|
69 |
-
|
70 |
-
foreach($lead_ids as $lead_id) {
|
71 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
72 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
?>
|
77 |
-
</div>
|
78 |
-
</body>
|
79 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
/**
|
12 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
13 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
14 |
+
*/
|
15 |
+
PDF_Common::setup_ids();
|
16 |
+
|
17 |
+
global $gfpdf;
|
18 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
19 |
+
|
20 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
21 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
22 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
26 |
+
*/
|
27 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
28 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
29 |
+
|
30 |
+
?>
|
31 |
+
|
32 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
33 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
34 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
35 |
+
<head>
|
36 |
+
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
37 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
38 |
+
<title>Gravity Forms PDF Extended</title>
|
39 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
40 |
+
|
41 |
+
</head>
|
42 |
+
<body>
|
43 |
+
<div class="two_row">
|
44 |
+
<?php
|
45 |
+
|
46 |
+
foreach($lead_ids as $lead_id) {
|
47 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
48 |
+
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
?>
|
53 |
+
</div>
|
54 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
</html>
|
templates/default-template.php
CHANGED
@@ -1,75 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
53 |
-
|
54 |
-
?>
|
55 |
-
|
56 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
57 |
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
58 |
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
59 |
-
<head>
|
60 |
-
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
61 |
-
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
62 |
-
<title>Gravity Forms PDF Extended</title>
|
63 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
64 |
-
</head>
|
65 |
-
<body>
|
66 |
-
<?php
|
67 |
-
|
68 |
-
foreach($lead_ids as $lead_id) {
|
69 |
-
$lead = RGFormsModel::get_lead($lead_id);
|
70 |
-
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
71 |
-
}
|
72 |
-
|
73 |
-
?>
|
74 |
-
</body>
|
75 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
global $gfpdf;
|
19 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
20 |
+
|
21 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
22 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
23 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
27 |
+
*/
|
28 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
29 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
30 |
+
|
31 |
+
?>
|
32 |
+
|
33 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
34 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
35 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
36 |
+
<head>
|
37 |
+
<link rel='stylesheet' href='<?php echo GFCommon::get_base_url(); ?>/css/print.css' type='text/css' />
|
38 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
39 |
+
<title>Gravity Forms PDF Extended</title>
|
40 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
41 |
+
</head>
|
42 |
+
<body>
|
43 |
+
<?php
|
44 |
+
|
45 |
+
foreach($lead_ids as $lead_id) {
|
46 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
47 |
+
GFPDFEntryDetail::lead_detail_grid($form, $lead, $show_empty_fields, $show_html_fields, $show_page_names);
|
48 |
+
}
|
49 |
+
|
50 |
+
?>
|
51 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</html>
|
templates/example-advanced-headers_07.php
CHANGED
@@ -1,140 +1,118 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
<
|
83 |
-
<
|
84 |
-
<td width="50%">
|
85 |
-
|
86 |
-
</
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
<
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
<
|
98 |
-
<
|
99 |
-
<
|
100 |
-
|
101 |
-
</
|
102 |
-
|
103 |
-
|
104 |
-
<
|
105 |
-
<
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
<div>
|
120 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
121 |
-
<h2>Advanced Headers</h2>
|
122 |
-
|
123 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
124 |
-
<pagebreak />
|
125 |
-
|
126 |
-
<h2>Advanced Headers</h2>
|
127 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
128 |
-
|
129 |
-
<!-- Note the html_ prefix when referencing an HTML header using one of the pagebreaks -->
|
130 |
-
<pagebreak odd-header-name="html_myHTMLHeader2" odd-header-value="1" even-header-name="html_myHTMLHeader2Even" even-header-value="1" />
|
131 |
-
|
132 |
-
<h2>Advanced Headers</h2>
|
133 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
134 |
-
</div>
|
135 |
-
<?php
|
136 |
-
}
|
137 |
-
|
138 |
-
?>
|
139 |
-
</body>
|
140 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<title>Gravity Forms PDF Extended</title>
|
32 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
33 |
+
</head>
|
34 |
+
<body>
|
35 |
+
<?php
|
36 |
+
|
37 |
+
foreach($lead_ids as $lead_id) {
|
38 |
+
|
39 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
+
do_action("gform_print_entry_header", $form, $lead);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];*/
|
52 |
+
|
53 |
+
/* format the template */
|
54 |
+
?>
|
55 |
+
|
56 |
+
<!-- defines the headers/footers - this must occur before the headers/footers are set -->
|
57 |
+
|
58 |
+
<!--mpdf
|
59 |
+
|
60 |
+
<htmlpageheader name="myHTMLHeader1">
|
61 |
+
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
62 |
+
<td width="50%">Left header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
63 |
+
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader1</span></td>
|
64 |
+
</tr></table>
|
65 |
+
</htmlpageheader>
|
66 |
+
|
67 |
+
<htmlpageheader name="myHTMLHeader1Even">
|
68 |
+
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
69 |
+
<td width="50%"><span style="font-weight: bold;">myHTMLHeader1Even</span></td>
|
70 |
+
<td width="50%" style="text-align: right;">Inner header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
71 |
+
</tr></table>
|
72 |
+
</htmlpageheader>
|
73 |
+
|
74 |
+
<htmlpageheader name="myHTMLHeader2">
|
75 |
+
<table width="100%" style="border-bottom: 1px solid #880000; vertical-align: bottom; font-family: sans; font-size: 9pt; color: #880000;"><tr>
|
76 |
+
<td width="50%">myHTMLHeader2 p.<span style="font-size:14pt;">{PAGENO}</span></td>
|
77 |
+
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader2</span></td>
|
78 |
+
</tr></table>
|
79 |
+
</htmlpageheader>
|
80 |
+
|
81 |
+
<htmlpageheader name="myHTMLHeader2Even">
|
82 |
+
<table width="100%" style="border-bottom: 1px solid #880000; vertical-align: bottom; font-family: sans; font-size: 9pt; color: #880000;"><tr>
|
83 |
+
<td width="50%"><span style="font-weight: bold;">myHTMLHeader2Even</span></td>
|
84 |
+
<td width="50%" style="text-align: right;">Inner header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
85 |
+
</tr></table>
|
86 |
+
</htmlpageheader>
|
87 |
+
|
88 |
+
mpdf-->
|
89 |
+
|
90 |
+
<!-- set the headers/footers - they will occur from here on in the document -->
|
91 |
+
<!--mpdf
|
92 |
+
<sethtmlpageheader name="myHTMLHeader1" page="O" value="on" show-this-page="1" />
|
93 |
+
<sethtmlpageheader name="myHTMLHeader1Even" page="E" value="on" />
|
94 |
+
mpdf-->
|
95 |
+
|
96 |
+
|
97 |
+
<div>
|
98 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
99 |
+
<h2>Advanced Headers</h2>
|
100 |
+
|
101 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
102 |
+
<pagebreak />
|
103 |
+
|
104 |
+
<h2>Advanced Headers</h2>
|
105 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
106 |
+
|
107 |
+
<!-- Note the html_ prefix when referencing an HTML header using one of the pagebreaks -->
|
108 |
+
<pagebreak odd-header-name="html_myHTMLHeader2" odd-header-value="1" even-header-name="html_myHTMLHeader2Even" even-header-value="1" />
|
109 |
+
|
110 |
+
<h2>Advanced Headers</h2>
|
111 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
|
116 |
+
?>
|
117 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
</html>
|
templates/example-backgrounds-and-borders02.php
CHANGED
@@ -1,203 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
}
|
65 |
-
.
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
<
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
</
|
134 |
-
|
135 |
-
|
136 |
-
<
|
137 |
-
|
138 |
-
<span style="font-family: mono; font-size: 9pt;">background
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
<
|
145 |
-
|
146 |
-
|
147 |
-
The
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
</div>
|
154 |
-
|
155 |
-
<
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<
|
165 |
-
<
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 4em;<br />
|
182 |
-
border-top-right-radius: 4em;<br />
|
183 |
-
border-bottom-right-radius: 4em;<br />
|
184 |
-
border-bottom-left-radius: 4em;</span><br />
|
185 |
-
<br />
|
186 |
-
and<br />
|
187 |
-
<span style="font-family: mono; font-size: 9pt;">border-radius: 2em 1em 4em / 0.5em 3em;</span><br />
|
188 |
-
would be equivalent to<br />
|
189 |
-
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 2em 0.5em;<br />
|
190 |
-
border-top-right-radius: 1em 3em;<br />
|
191 |
-
border-bottom-right-radius: 4em 0.5em;<br />
|
192 |
-
border-bottom-left-radius: 1em 3em;</span>
|
193 |
-
</div>
|
194 |
-
|
195 |
-
</div>
|
196 |
-
|
197 |
-
|
198 |
-
<?php
|
199 |
-
}
|
200 |
-
|
201 |
-
?>
|
202 |
-
</body>
|
203 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
32 |
+
<title>Gravity Forms PDF Extended</title>
|
33 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
34 |
+
<style>
|
35 |
+
|
36 |
+
body {
|
37 |
+
background: linear-gradient(bottom, #0b91c2, #FFFFFF 65%);
|
38 |
+
}
|
39 |
+
.gradient {
|
40 |
+
border:0.1mm solid #220044;
|
41 |
+
background: #f0f2ff linear-gradient(top, #e1e1e1 65%, #c7c7c7);
|
42 |
+
}
|
43 |
+
.radialgradient {
|
44 |
+
border:0.1mm solid #220044;
|
45 |
+
background: #f0f2ff radial-gradient(center circle, #00FFFF, #FFFF00)
|
46 |
+
margin: auto;
|
47 |
+
}
|
48 |
+
.rounded {
|
49 |
+
border:0.1mm solid #220044;
|
50 |
+
background: #f0f2ff linear-gradient(top, #c7cdde 65%, #f0f2ff);
|
51 |
+
border-radius: 2mm;
|
52 |
+
background-clip: border-box;
|
53 |
+
}
|
54 |
+
h4 {
|
55 |
+
font-family: sans;
|
56 |
+
font-weight: bold;
|
57 |
+
margin-top: 1em;
|
58 |
+
margin-bottom: 0.5em;
|
59 |
+
}
|
60 |
+
div {
|
61 |
+
padding:1em;
|
62 |
+
margin-bottom: 1em;
|
63 |
+
text-align:left;
|
64 |
+
}
|
65 |
+
.example pre {
|
66 |
+
background-color: #d5d5d5;
|
67 |
+
margin: 1em 1cm;
|
68 |
+
padding: 0 0.3cm;
|
69 |
+
}
|
70 |
+
|
71 |
+
pre { text-align:left }
|
72 |
+
pre.code { font-family: monospace }
|
73 |
+
|
74 |
+
</style>
|
75 |
+
|
76 |
+
</head>
|
77 |
+
<body>
|
78 |
+
<?php
|
79 |
+
|
80 |
+
foreach($lead_ids as $lead_id) {
|
81 |
+
|
82 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
83 |
+
do_action("gform_print_entry_header", $form, $lead);
|
84 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
85 |
+
/*
|
86 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
87 |
+
*/
|
88 |
+
PDF_Common::view_data($form_data);
|
89 |
+
|
90 |
+
/* get all the form values */
|
91 |
+
/*$date_created = $form_data['date_created'];
|
92 |
+
|
93 |
+
$first_name = $form_data['1.Name']['first'];
|
94 |
+
$last_name = $form_data['1.Name']['last'];*/
|
95 |
+
|
96 |
+
/* format the template */
|
97 |
+
?>
|
98 |
+
|
99 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
<h1>Backgrounds & Borders</h1>
|
106 |
+
|
107 |
+
<div style="border:0.1mm solid #220044; padding:1em 2em; background-color:#ffffcc; ">
|
108 |
+
<h4>Page background</h4>
|
109 |
+
<div class="gradient">
|
110 |
+
The background colour can be set by CSS styles on the <body> tag. This will set the background for the whole page. In this document, the background has been set as a gradient (see below).
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<h4>Background Gradients</h4>
|
114 |
+
<div class="gradient">
|
115 |
+
Background can be set as a linear or radial gradient between two colours. The background has been set on this <div> element to a linear gradient. CSS style used here is:<br />
|
116 |
+
<span style="font-family: mono; font-size: 9pt;">background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;</span><br />
|
117 |
+
The four numbers are coordinates in the form (x1, y1, x2, y2) which defines the gradient vector. x and y are values from 0 to 1, where 1 represents the height or width of the box as it is printed.
|
118 |
+
<br />
|
119 |
+
<br />
|
120 |
+
Background gradients can be set on all block elements e.g. P, DIV, H1-H6, as well as on BODY.
|
121 |
+
</div>
|
122 |
+
<div class="radialgradient">
|
123 |
+
The background has been set on this <div> element to a radial gradient. CSS style used here is:<br />
|
124 |
+
<span style="font-family: mono; font-size: 9pt;">background-gradient: radial #00FFFF #FFFF00 0.5 0.5 0.5 0.5 0.65;</span><br />
|
125 |
+
The five numbers are coordinates in the form (x1, y1, x2, y2, r) where (x1, y1) is the starting point of the gradient with color1,
|
126 |
+
(x2, y2) is the center of the circle with color2, and r is the radius of the circle.
|
127 |
+
(x1, y1) should be inside the circle, otherwise some areas will not be defined.
|
128 |
+
<br />
|
129 |
+
<br />
|
130 |
+
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec mattis lacus ac purus feugiat semper. Donec aliquet nunc odio, vitae pellentesque diam. Pellentesque sed velit lacus. Duis quis dui quis sem consectetur sollicitudin. Cras dolor quam, dapibus et pretium sit amet, elementum vel arcu. Duis rhoncus facilisis erat nec mattis. In hac habitasse platea dictumst. Vivamus hendrerit sem in justo aliquet a pellentesque lorem scelerisque. Suspendisse a augue sed urna rhoncus elementum. Aliquam erat volutpat.
|
131 |
+
</div>
|
132 |
+
|
133 |
+
<h4>Background Images</h4>
|
134 |
+
<div style="border:0.1mm solid #880000; background: transparent url(<?php echo PDF_PLUGIN_DIR; ?>/images/bg.jpg) repeat fixed right top; background-color:#ccffff; ">
|
135 |
+
The CSS properties background-image, background-position, and background-repeat are supported as defined in CSS2, as well as the shorthand form "background".
|
136 |
+
<br />
|
137 |
+
The background has been set on this <div> element to:<br />
|
138 |
+
<span style="font-family: mono; font-size: 9pt;">background: transparent url(\'bg.jpg\') repeat fixed right top;</span><br />
|
139 |
+
Background gradients can be set on all block elements e.g. P, DIV, H1-H6, as well as on BODY.
|
140 |
+
</div>
|
141 |
+
|
142 |
+
<h4>Rounded Borders</h4>
|
143 |
+
<div class="rounded">
|
144 |
+
Rounded corners to borders can be added using border-radius as defined in the draft spec. of <a href="http://www.w3.org/TR/2008/WD-css3-background-20080910/#layering">CSS3</a>. <br />
|
145 |
+
|
146 |
+
The two length values of the border-*-radius properties define the radii of a quarter ellipse that defines the shape of the corner of the outer border edge.
|
147 |
+
The first value is the horizontal radius. <br />
|
148 |
+
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 55pt 25pt;</span> 55pt is radius of curve from top end of left border starting to go round to the top.<br />
|
149 |
+
|
150 |
+
If the second length is omitted it is equal to the first (and the corner is thus a quarter circle). If either length is zero, the corner is square, not rounded.<br />
|
151 |
+
|
152 |
+
The border-radius shorthand sets all four border-*-radius properties. If values are given before and after a slash, then the values before the slash set the horizontal radius and the values after the slash set the vertical radius. If there is no slash, then the values set both radii equally. The four values for each radii are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left. If top-right is omitted it is the same as top-left.
|
153 |
+
</div>
|
154 |
+
<div class="rounded">
|
155 |
+
<span style="font-family: mono; font-size: 9pt;">border-radius: 4em;</span><br />
|
156 |
+
|
157 |
+
would be equivalent to<br />
|
158 |
+
|
159 |
+
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 4em;<br />
|
160 |
+
border-top-right-radius: 4em;<br />
|
161 |
+
border-bottom-right-radius: 4em;<br />
|
162 |
+
border-bottom-left-radius: 4em;</span><br />
|
163 |
+
<br />
|
164 |
+
and<br />
|
165 |
+
<span style="font-family: mono; font-size: 9pt;">border-radius: 2em 1em 4em / 0.5em 3em;</span><br />
|
166 |
+
would be equivalent to<br />
|
167 |
+
<span style="font-family: mono; font-size: 9pt;">border-top-left-radius: 2em 0.5em;<br />
|
168 |
+
border-top-right-radius: 1em 3em;<br />
|
169 |
+
border-bottom-right-radius: 4em 0.5em;<br />
|
170 |
+
border-bottom-left-radius: 1em 3em;</span>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
</div>
|
174 |
+
|
175 |
+
|
176 |
+
<?php
|
177 |
+
}
|
178 |
+
|
179 |
+
?>
|
180 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
</html>
|
templates/example-basic-html01.php
CHANGED
@@ -1,203 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
<
|
84 |
-
<
|
85 |
-
|
86 |
-
<
|
87 |
-
<
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
<
|
95 |
-
|
96 |
-
<
|
97 |
-
|
98 |
-
<
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
<
|
107 |
-
|
108 |
-
<
|
109 |
-
|
110 |
-
</
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
<
|
116 |
-
|
117 |
-
|
118 |
-
<
|
119 |
-
|
120 |
-
<
|
121 |
-
|
122 |
-
<
|
123 |
-
|
124 |
-
<
|
125 |
-
|
126 |
-
<
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
<
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
<
|
142 |
-
|
143 |
-
<
|
144 |
-
<
|
145 |
-
<
|
146 |
-
<
|
147 |
-
<
|
148 |
-
<
|
149 |
-
|
150 |
-
</
|
151 |
-
</
|
152 |
-
|
153 |
-
|
154 |
-
</
|
155 |
-
<
|
156 |
-
</
|
157 |
-
|
158 |
-
|
159 |
-
<
|
160 |
-
<
|
161 |
-
</
|
162 |
-
|
163 |
-
<
|
164 |
-
|
165 |
-
<
|
166 |
-
<
|
167 |
-
<
|
168 |
-
<
|
169 |
-
<td>Data</td>
|
170 |
-
|
171 |
-
|
172 |
-
</
|
173 |
-
|
174 |
-
<
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
</
|
181 |
-
<tr>
|
182 |
-
<th>Data</th>
|
183 |
-
<td>Data</td>
|
184 |
-
<td>Data</td>
|
185 |
-
<td>Data<br />2nd line</td>
|
186 |
-
</tr>
|
187 |
-
<tr>
|
188 |
-
<th>Data</th>
|
189 |
-
<td>Data</td>
|
190 |
-
<td>Data</td>
|
191 |
-
<td>Data<br />2nd line</td>
|
192 |
-
</tr>
|
193 |
-
</tbody>
|
194 |
-
</table>
|
195 |
-
|
196 |
-
<p>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Cras tellus. Fusce aliquet. Curabitur tincidunt viverra ligula. Fusce eget erat. Donec pede. Vestibulum id felis. Phasellus tincidunt ligula non pede. Morbi turpis. In vitae dui non erat placerat malesuada. Mauris adipiscing congue ante. Proin at erat. Aliquam mattis. </p>
|
197 |
-
|
198 |
-
<?php
|
199 |
-
}
|
200 |
-
|
201 |
-
?>
|
202 |
-
</body>
|
203 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
31 |
+
<title>Gravity Forms PDF Extended</title>
|
32 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
33 |
+
</head>
|
34 |
+
<body>
|
35 |
+
<?php
|
36 |
+
|
37 |
+
foreach($lead_ids as $lead_id) {
|
38 |
+
|
39 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
+
do_action("gform_print_entry_header", $form, $lead);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];*/
|
52 |
+
|
53 |
+
/* format the template */
|
54 |
+
?>
|
55 |
+
|
56 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
57 |
+
|
58 |
+
|
59 |
+
<h2>Basic HTML Example</h2>
|
60 |
+
This file demonstrates most of the HTML elements.
|
61 |
+
<h3>Heading 3</h3>
|
62 |
+
<h4>Heading 4</h4>
|
63 |
+
<h5>Heading 5</h5>
|
64 |
+
<h6>Heading 6</h6>
|
65 |
+
<p>P: Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
66 |
+
|
67 |
+
<hr />
|
68 |
+
|
69 |
+
<div><img src="<?php echo PDF_PLUGIN_DIR; ?>/images/tiger.wmf" style="float:right;">DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>
|
70 |
+
<div><img src="<?php echo PDF_PLUGIN_DIR; ?>/images/klematis.jpg" style="opacity: 0.5; float: left;" />DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>
|
71 |
+
|
72 |
+
<blockquote>Blockquote: Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus. Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus.</blockquote>
|
73 |
+
|
74 |
+
<address>Address: Vestibulum feugiat, orci at imperdiet tincidunt, mauris erat facilisis urna, sagittis ultricies dui nisl et lectus. Sed lacinia, lectus vitae dictum sodales, elit ipsum ultrices orci, non euismod arcu diam non metus.</address>
|
75 |
+
|
76 |
+
<pre>PRE: Cum sociis natoque penatibus et magnis dis parturient montes,
|
77 |
+
nascetur ridiculus mus. In suscipit turpis vitae odio. Integer convallis
|
78 |
+
dui at metus. Fusce magna. Sed sed lectus vitae enim tempor cursus. Cras
|
79 |
+
sed, posuere et, urna. Quisque ut leo. Aliquam interdum hendrerit tortor.
|
80 |
+
Vestibulum elit. Vestibulum et arcu at diam mattis commodo. Nam ipsum sem,
|
81 |
+
ultricies at, rutrum sit amet, posuere nec, velit. Sed molestie mollis dui.</pre>
|
82 |
+
|
83 |
+
<div><a href="#top">Hyperlink (<a>)</a></div>
|
84 |
+
<div><a href="http://www.gravityformspdfextended.com">Hyperlink (<a>)</a></div>
|
85 |
+
|
86 |
+
<div>Styles - <tt>tt(teletype)</tt> <i>italic</i> <b>bold</b> <big>big</big> <small>small</small> <em>emphasis</em> <strong>strong</strong> <br />new lines<br>
|
87 |
+
<code>code</code> <samp>sample</samp> <kbd>keyboard</kbd> <var>variable</var> <cite>citation</cite> <abbr>abbr.</abbr> <acronym>ACRONYM</acronym> <sup>sup</sup> <sub>sub</sub> <strike>strike</strike> <s>strike-s</s> <u>underline</u> <del>delete</del> <ins>insert</ins> <q>To be or not to be</q> <font face="sans-serif" color="#880000" size="5">font changing face, size and color</font>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<p style="font-size:15pt; color:#440066">Paragraph using the in-line style to determine the font-size (15pt) and colour</p>
|
91 |
+
|
92 |
+
|
93 |
+
<h3>Testing BIG, SMALL, UNDERLINE, STRIKETHROUGH, FONT color, ACRONYM, SUPERSCRIPT and SUBSCRIPT</h3>
|
94 |
+
<p>This is <s>strikethrough</s> in <b><s>block</s></b> and <small>small <s>strikethrough</s> in <i>small span</i></small> and <big>big <s>strikethrough</s> in big span</big> and then <u>underline and <s>strikethrough and <sup>sup</sup></s></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
95 |
+
|
96 |
+
<p>This is a <font color="#008800">green reference<sup>32-47</sup></font> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> then <s>Strikethrough reference<sup>32-47</sup></s> and <s>strikethrough reference<sub>32-47</sub></s></p>
|
97 |
+
|
98 |
+
<p><big>Repeated in <u>BIG</u>: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</big></p>
|
99 |
+
|
100 |
+
<p><small>Repeated in small: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</small></p>
|
101 |
+
|
102 |
+
<p>The above repeated, but starting with a paragraph with font-size specified (7pt)</p>
|
103 |
+
|
104 |
+
<p style="font-size:7pt;">This is <s>strikethrough</s> in block and <small>small <s>strikethrough</s> in small span</small> and then <u>underline</u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
105 |
+
|
106 |
+
<p style="font-size:7pt;">This is <s>strikethrough</s> in block and <big>big <s>strikethrough</s> in big span</big> and then <u>underline</u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</p>
|
107 |
+
|
108 |
+
<p style="font-size:7pt;">This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> then <s>Strikethrough reference<sup>32-47</sup></s> and <s>strikethrough reference<sub>32-47</sub></s></p>
|
109 |
+
|
110 |
+
<p><small>This tests <u>underline</u> and <s>strikethrough</s> when they are <s><u>used together</u></s> as they both use text-decoration</small></p>
|
111 |
+
|
112 |
+
|
113 |
+
<p><small>Repeated in small: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</small></p>
|
114 |
+
|
115 |
+
<p style="font-size:7pt;"><big>Repeated in BIG but with font-size set to 7pt by in-line css: This is reference<sup>32-47</sup> and <u>underlined reference<sup>32-47</sup></u> then reference<sub>32-47</sub> and <u>underlined reference<sub>32-47</sub></u> but out of span again but <font color="#000088">blue</font> font and <acronym>ACRONYM</acronym> text</big></p>
|
116 |
+
|
117 |
+
<ol>
|
118 |
+
<li>Item <b><u>1</u></b></li>
|
119 |
+
<li>Item 2<sup>32</sup></li>
|
120 |
+
<li><small>Item</small> 3</li>
|
121 |
+
<li>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
122 |
+
<ul>
|
123 |
+
<li>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. </li>
|
124 |
+
<li>Subitem 2
|
125 |
+
<ul>
|
126 |
+
<li>
|
127 |
+
Level 3 subitem
|
128 |
+
</li>
|
129 |
+
</ul>
|
130 |
+
</li>
|
131 |
+
</ul>
|
132 |
+
</li>
|
133 |
+
<li>Item 5</li>
|
134 |
+
</ol>
|
135 |
+
|
136 |
+
<dl>
|
137 |
+
<dt>Definition list</dt>
|
138 |
+
<dd>List defined by DL, DD and DT tags</dd>
|
139 |
+
</dl>
|
140 |
+
|
141 |
+
<p>Sed bibendum. Nunc eleifend ornare velit. Sed consectetuer urna in erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris sodales semper metus. Maecenas justo libero, pretium at, malesuada eu, mollis et, arcu. Ut suscipit pede in nulla. Praesent elementum, dolor ac fringilla posuere, elit libero rutrum massa, vel tincidunt dui tellus a ante. Sed aliquet euismod dolor. Vestibulum sed dui. Duis lobortis hendrerit quam. Donec tempus orci ut libero. Pellentesque suscipit malesuada nisi. </p>
|
142 |
+
|
143 |
+
<table border="1">
|
144 |
+
<thead>
|
145 |
+
<tr>
|
146 |
+
<th>Data</th>
|
147 |
+
<td>Data</td>
|
148 |
+
<td>Data</td>
|
149 |
+
<td>Data<br />2nd line</td>
|
150 |
+
</tr>
|
151 |
+
</thead>
|
152 |
+
<tbody>
|
153 |
+
<tr>
|
154 |
+
<th>More Data</th>
|
155 |
+
<td>More Data</td>
|
156 |
+
<td>More Data</td>
|
157 |
+
<td>Data<br />2nd line</td>
|
158 |
+
</tr>
|
159 |
+
<tr>
|
160 |
+
<th>Data</th>
|
161 |
+
<td>Data</td>
|
162 |
+
<td>Data</td>
|
163 |
+
<td>Data<br />2nd line</td>
|
164 |
+
</tr>
|
165 |
+
<tr>
|
166 |
+
<th>Data</th>
|
167 |
+
<td>Data</td>
|
168 |
+
<td>Data</td>
|
169 |
+
<td>Data<br />2nd line</td>
|
170 |
+
</tr>
|
171 |
+
</tbody>
|
172 |
+
</table>
|
173 |
+
|
174 |
+
<p>Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Cras tellus. Fusce aliquet. Curabitur tincidunt viverra ligula. Fusce eget erat. Donec pede. Vestibulum id felis. Phasellus tincidunt ligula non pede. Morbi turpis. In vitae dui non erat placerat malesuada. Mauris adipiscing congue ante. Proin at erat. Aliquam mattis. </p>
|
175 |
+
|
176 |
+
<?php
|
177 |
+
}
|
178 |
+
|
179 |
+
?>
|
180 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
</html>
|
templates/example-different-page-size_08.php
CHANGED
@@ -1,94 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
</
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
$first_name = $form_data['1.Name']['first'];
|
73 |
-
$last_name = $form_data['1.Name']['last'];*/
|
74 |
-
|
75 |
-
/* format the template */
|
76 |
-
?>
|
77 |
-
<p>This should print on an A4 (portrait) sheet</p>
|
78 |
-
|
79 |
-
<pagebreak sheet-size="A4-L" />
|
80 |
-
<p>This page appears after the A4 portrait sheet and should print on an A4 (landscape) sheet</p>
|
81 |
-
<h1>mPDF Page Sizes</h1>
|
82 |
-
<h3>Changing page (sheet) sizes within the document</h3>
|
83 |
-
<pagebreak sheet-size="A5-L" />
|
84 |
-
|
85 |
-
<p>This should print on an A5 (landscape) sheet</p>
|
86 |
-
<h1>mPDF Page Sizes</h1>
|
87 |
-
<h3>Changing page (sheet) sizes within the document</h3>
|
88 |
-
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
|
92 |
-
?>
|
93 |
-
</body>
|
94 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<title>Gravity Forms PDF Extended</title>
|
32 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
33 |
+
</head>
|
34 |
+
<body>
|
35 |
+
<?php
|
36 |
+
|
37 |
+
foreach($lead_ids as $lead_id) {
|
38 |
+
|
39 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
+
do_action("gform_print_entry_header", $form, $lead);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];*/
|
52 |
+
|
53 |
+
/* format the template */
|
54 |
+
?>
|
55 |
+
<p>This should print on an A4 (portrait) sheet</p>
|
56 |
+
|
57 |
+
<pagebreak sheet-size="A4-L" />
|
58 |
+
<p>This page appears after the A4 portrait sheet and should print on an A4 (landscape) sheet</p>
|
59 |
+
<h1>mPDF Page Sizes</h1>
|
60 |
+
<h3>Changing page (sheet) sizes within the document</h3>
|
61 |
+
<pagebreak sheet-size="A5-L" />
|
62 |
+
|
63 |
+
<p>This should print on an A5 (landscape) sheet</p>
|
64 |
+
<h1>mPDF Page Sizes</h1>
|
65 |
+
<h3>Changing page (sheet) sizes within the document</h3>
|
66 |
+
|
67 |
+
<?php
|
68 |
+
}
|
69 |
+
|
70 |
+
?>
|
71 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
</html>
|
templates/example-float-and-positioning05.php
CHANGED
@@ -1,195 +1,173 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
<h4>CSS "
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
<
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
<div
|
139 |
-
|
140 |
-
</div>
|
141 |
-
<div
|
142 |
-
|
143 |
-
</div>
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
<div
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
<div style="float: right; width: 30%; background: #222222; color: #FFF">
|
174 |
-
Floated right with a width of 30%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
|
178 |
-
<pagebreak />
|
179 |
-
|
180 |
-
<div style="float: left; width: 20%; background: #EEE;">
|
181 |
-
Floated left with a width of 20%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
182 |
-
</div>
|
183 |
-
|
184 |
-
<div style="margin-left: 25%">
|
185 |
-
By default this element will be positioned inline with the float. The start of the element should be inline with the top of the float. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
186 |
-
</div>
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
<?php
|
191 |
-
}
|
192 |
-
|
193 |
-
?>
|
194 |
-
</body>
|
195 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<title>Gravity Forms PDF Extended</title>
|
32 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
33 |
+
</head>
|
34 |
+
<body>
|
35 |
+
<?php
|
36 |
+
|
37 |
+
foreach($lead_ids as $lead_id) {
|
38 |
+
|
39 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
+
do_action("gform_print_entry_header", $form, $lead);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];*/
|
52 |
+
|
53 |
+
/* format the template */
|
54 |
+
?>
|
55 |
+
|
56 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
57 |
+
|
58 |
+
|
59 |
+
<style>
|
60 |
+
.gradient {
|
61 |
+
border:0.1mm solid #220044;
|
62 |
+
background-color: #f0f2ff;
|
63 |
+
background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
|
64 |
+
}
|
65 |
+
h4 {
|
66 |
+
font-family: sans;
|
67 |
+
font-weight: bold;
|
68 |
+
margin-top: 1em;
|
69 |
+
margin-bottom: 0.5em;
|
70 |
+
}
|
71 |
+
div {
|
72 |
+
padding:1em;
|
73 |
+
margin-bottom: 1em;
|
74 |
+
text-align:justify;
|
75 |
+
}
|
76 |
+
.myfixed1 { position: absolute;
|
77 |
+
overflow: visible;
|
78 |
+
left: 0;
|
79 |
+
bottom: 0;
|
80 |
+
border: 1px solid #880000;
|
81 |
+
background-color: #FFEEDD;
|
82 |
+
background-gradient: linear #dec7cd #fff0f2 0 1 0 0.5;
|
83 |
+
padding: 1.5em;
|
84 |
+
font-family:sans;
|
85 |
+
margin: 0;
|
86 |
+
}
|
87 |
+
.myfixed2 { position: fixed;
|
88 |
+
overflow: auto;
|
89 |
+
right: 0;
|
90 |
+
bottom: 0mm;
|
91 |
+
width: 65mm;
|
92 |
+
border: 1px solid #880000;
|
93 |
+
background-color: #FFEEDD;
|
94 |
+
background-gradient: linear #dec7cd #fff0f2 0 1 0 0.5;
|
95 |
+
padding: 0.5em;
|
96 |
+
font-family:sans;
|
97 |
+
margin: 0;
|
98 |
+
rotate: 90;
|
99 |
+
}
|
100 |
+
</style>
|
101 |
+
|
102 |
+
<h2>Floating & Fixed Position elements</h2>
|
103 |
+
|
104 |
+
<h4>CSS "Float"</h4>
|
105 |
+
<div class="gradient">
|
106 |
+
Block elements can be positioned alongside each other using the CSS property float: left or right. The clear property can also be used, set as left|right|both. Float is only supported on block elements (i.e. not SPAN etc.) and is not fully compliant with the CSS specification.
|
107 |
+
Float only works properly if a width is set for the float, otherwise the width is set to the maximum available (full width, or less if floats already set).
|
108 |
+
<br />
|
109 |
+
Margin-right can still be set for a float:right and vice-versa.
|
110 |
+
<br />
|
111 |
+
A block element next to a float has the padding adjusted so that content fits in the remaining width. Text next to a float should wrap correctly, but backgrounds and borders will overlap and/or lie under the floats in a mess.
|
112 |
+
<br />
|
113 |
+
NB The width that is set defines the width of the content-box. So if you have two floats with width=50% and either of them has padding, margin or border, they will not fit together on the page.
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="gradient" style="float: right; width: 28%; margin-bottom: 0pt; ">
|
117 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/tiger.wmf" style="float:right" width="70" />This is text in a <div> element that is set to float:right and width:28%. It also has an image with float:right inside. With this exception, you cannot nest elements with the float property set inside one another.
|
118 |
+
</div>
|
119 |
+
<div class="gradient" style="float: left; width: 54%; margin-bottom: 0pt; ">
|
120 |
+
This is text in a <div> element that is set to float:left and width:54%.
|
121 |
+
</div>
|
122 |
+
|
123 |
+
<div style="clear: both; margin: 0pt; padding: 0pt; "></div>
|
124 |
+
This is text that follows a <div> element that is set to clear:both.
|
125 |
+
|
126 |
+
<h4>CSS "Position"</h4>
|
127 |
+
At the bottom of the page are two DIV elements with position:fixed and position:absolute set
|
128 |
+
|
129 |
+
<div class="myfixed1">1 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.</div>
|
130 |
+
|
131 |
+
<div class="myfixed2">2 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.</div>
|
132 |
+
<pagebreak />
|
133 |
+
|
134 |
+
|
135 |
+
<div style="float: left; width: 29%; background: green">
|
136 |
+
These are all floated left. 1 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
137 |
+
</div>
|
138 |
+
<div style="float: left; width: 29%; background: grey">
|
139 |
+
2 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
140 |
+
</div>
|
141 |
+
<div style="float: left; width: 29%; background: black; color: white;">
|
142 |
+
3 Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
143 |
+
</div>
|
144 |
+
|
145 |
+
|
146 |
+
<div style="clear: both">
|
147 |
+
<div style="float: left; width: 20%; background: #EEE;">
|
148 |
+
Floated left with a width of 20%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right; width: 30%; background: #222222; color: #FFF">
|
152 |
+
Floated right with a width of 30%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
|
156 |
+
<pagebreak />
|
157 |
+
|
158 |
+
<div style="float: left; width: 20%; background: #EEE;">
|
159 |
+
Floated left with a width of 20%. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
160 |
+
</div>
|
161 |
+
|
162 |
+
<div style="margin-left: 25%">
|
163 |
+
By default this element will be positioned inline with the float. The start of the element should be inline with the top of the float. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Praesent pharetra nulla in turpis. Sed ipsum nulla, sodales nec, vulputate in, scelerisque vitae, magna. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo. Sed egestas justo nec ipsum. Nulla facilisi. Praesent sit amet pede quis metus aliquet vulputate. Donec luctus. Cras euismod tellus vel leo.
|
164 |
+
</div>
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
<?php
|
169 |
+
}
|
170 |
+
|
171 |
+
?>
|
172 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
</html>
|
templates/example-header-and-footer_06.php
CHANGED
@@ -1,128 +1,106 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
<
|
86 |
-
|
87 |
-
</
|
88 |
-
|
89 |
-
<
|
90 |
-
<
|
91 |
-
|
92 |
-
<
|
93 |
-
<
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
<div>
|
108 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
109 |
-
<h2>Basic Headers</h2>
|
110 |
-
|
111 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
112 |
-
<pagebreak />
|
113 |
-
|
114 |
-
<h2>Basic Headers</h2>
|
115 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
116 |
-
|
117 |
-
<!-- Note the html_ prefix when referencing an HTML header using one of the pagebreaks -->
|
118 |
-
<pagebreak />
|
119 |
-
|
120 |
-
<h2>Basic Headers</h2>
|
121 |
-
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
122 |
-
</div>
|
123 |
-
<?php
|
124 |
-
}
|
125 |
-
|
126 |
-
?>
|
127 |
-
</body>
|
128 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<title>Gravity Forms PDF Extended</title>
|
32 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
33 |
+
</head>
|
34 |
+
<body>
|
35 |
+
<?php
|
36 |
+
|
37 |
+
foreach($lead_ids as $lead_id) {
|
38 |
+
|
39 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
40 |
+
do_action("gform_print_entry_header", $form, $lead);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];*/
|
52 |
+
|
53 |
+
/* format the template */
|
54 |
+
?>
|
55 |
+
|
56 |
+
<!-- defines the headers/footers - this must occur before the headers/footers are set -->
|
57 |
+
|
58 |
+
<!--mpdf
|
59 |
+
|
60 |
+
<htmlpageheader name="myHTMLHeader1">
|
61 |
+
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
|
62 |
+
<td width="50%">Left header p <span style="font-size:14pt;">{PAGENO}</span></td>
|
63 |
+
<td width="50%" style="text-align: right;"><span style="font-weight: bold;">myHTMLHeader1</span></td>
|
64 |
+
</tr></table>
|
65 |
+
</htmlpageheader>
|
66 |
+
|
67 |
+
<htmlpagefooter name="myFooter1">
|
68 |
+
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
|
69 |
+
color: #000000; font-weight: bold; font-style: italic;"><tr>
|
70 |
+
<td width="33%"><span style="font-weight: bold; font-style: italic;">{DATE j-m-Y}</span></td>
|
71 |
+
<td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
|
72 |
+
<td width="33%" style="text-align: right; ">My document</td>
|
73 |
+
</tr></table>
|
74 |
+
</htmlpagefooter>
|
75 |
+
|
76 |
+
mpdf-->
|
77 |
+
|
78 |
+
<!-- set the headers/footers - they will occur from here on in the document -->
|
79 |
+
<!--mpdf
|
80 |
+
<sethtmlpageheader name="myHTMLHeader1" value="on" show-this-page="1" />
|
81 |
+
<sethtmlpagefooter name="myFooter1" value="on" show-this-page="1" />
|
82 |
+
mpdf-->
|
83 |
+
|
84 |
+
|
85 |
+
<div>
|
86 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
87 |
+
<h2>Basic Headers</h2>
|
88 |
+
|
89 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
90 |
+
<pagebreak />
|
91 |
+
|
92 |
+
<h2>Basic Headers</h2>
|
93 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
94 |
+
|
95 |
+
<!-- Note the html_ prefix when referencing an HTML header using one of the pagebreaks -->
|
96 |
+
<pagebreak />
|
97 |
+
|
98 |
+
<h2>Basic Headers</h2>
|
99 |
+
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
|
100 |
+
</div>
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
?>
|
105 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
</html>
|
templates/example-images03.php
CHANGED
@@ -1,270 +1,248 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
<style>
|
83 |
-
|
84 |
-
td
|
85 |
-
|
86 |
-
</
|
87 |
-
<
|
88 |
-
|
89 |
-
|
90 |
-
<tr>
|
91 |
-
<
|
92 |
-
<td
|
93 |
-
<td
|
94 |
-
<td
|
95 |
-
<td
|
96 |
-
<td
|
97 |
-
<td
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
<
|
103 |
-
<
|
104 |
-
<
|
105 |
-
<td
|
106 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/
|
107 |
-
|
108 |
-
|
109 |
-
<
|
110 |
-
<td
|
111 |
-
</tr>
|
112 |
-
|
113 |
-
<
|
114 |
-
<
|
115 |
-
<td
|
116 |
-
<td><img style="vertical-align: top
|
117 |
-
<td><img style="vertical-align: top
|
118 |
-
<td><img style="vertical-align: top
|
119 |
-
<td><img style="vertical-align: top
|
120 |
-
|
121 |
-
</
|
122 |
-
|
123 |
-
|
124 |
-
<
|
125 |
-
<
|
126 |
-
|
127 |
-
<td>
|
128 |
-
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/
|
129 |
-
<td style="background-color:#
|
130 |
-
<td style="background-color:#
|
131 |
-
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/
|
132 |
-
|
133 |
-
</
|
134 |
-
|
135 |
-
<
|
136 |
-
<
|
137 |
-
<td
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
<
|
144 |
-
<
|
145 |
-
<
|
146 |
-
<
|
147 |
-
<
|
148 |
-
</
|
149 |
-
|
150 |
-
<
|
151 |
-
|
152 |
-
|
153 |
-
<
|
154 |
-
|
155 |
-
|
156 |
-
<
|
157 |
-
|
158 |
-
<
|
159 |
-
<
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
<
|
173 |
-
|
174 |
-
|
175 |
-
<
|
176 |
-
<
|
177 |
-
</
|
178 |
-
<
|
179 |
-
|
180 |
-
<
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
</
|
186 |
-
<
|
187 |
-
|
188 |
-
<
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
</
|
194 |
-
<
|
195 |
-
|
196 |
-
<
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
</
|
202 |
-
<
|
203 |
-
|
204 |
-
<
|
205 |
-
|
206 |
-
|
207 |
-
<
|
208 |
-
|
209 |
-
|
210 |
-
<
|
211 |
-
|
212 |
-
<
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
<
|
219 |
-
|
220 |
-
<
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
|
225 |
-
|
226 |
-
<
|
227 |
-
|
228 |
-
<
|
229 |
-
<
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
<
|
239 |
-
|
240 |
-
<
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" width="100" />
|
249 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="90" width="100" />
|
250 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="180" width="100" />
|
251 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="-90" width="100" />
|
252 |
-
<br />
|
253 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="80" />
|
254 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="90" width="80" />
|
255 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="180" width="80" />
|
256 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="-90" width="80" />
|
257 |
-
<br />
|
258 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="100" />
|
259 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="90" width="85" />
|
260 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="180" width="100" />
|
261 |
-
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="-90" width="85" />
|
262 |
-
<br />
|
263 |
-
|
264 |
-
|
265 |
-
<?php
|
266 |
-
}
|
267 |
-
|
268 |
-
?>
|
269 |
-
</body>
|
270 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
32 |
+
<title>Gravity Forms PDF Extended</title>
|
33 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
34 |
+
|
35 |
+
</head>
|
36 |
+
<body>
|
37 |
+
<?php
|
38 |
+
|
39 |
+
foreach($lead_ids as $lead_id) {
|
40 |
+
|
41 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
42 |
+
do_action("gform_print_entry_header", $form, $lead);
|
43 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
44 |
+
/*
|
45 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
46 |
+
*/
|
47 |
+
PDF_Common::view_data($form_data);
|
48 |
+
|
49 |
+
/* get all the form values */
|
50 |
+
/*$date_created = $form_data['date_created'];
|
51 |
+
|
52 |
+
$first_name = $form_data['1.Name']['first'];
|
53 |
+
$last_name = $form_data['1.Name']['last'];*/
|
54 |
+
|
55 |
+
/* format the template */
|
56 |
+
?>
|
57 |
+
|
58 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/gravityformspdfextended.jpg" width="311" height="110" />
|
59 |
+
|
60 |
+
<style>
|
61 |
+
table { border-collapse: collapse; margin-top: 0; text-align: center; }
|
62 |
+
td { padding: 0.5em; }
|
63 |
+
h1 { margin-bottom: 0; }
|
64 |
+
</style>
|
65 |
+
<h1>mPDF Images</h1>
|
66 |
+
|
67 |
+
<table>
|
68 |
+
<tr>
|
69 |
+
<td>GIF</td>
|
70 |
+
<td>JPG</td>
|
71 |
+
<td>JPG (CMYK)</td>
|
72 |
+
<td>PNG</td>
|
73 |
+
<td>BMP</td>
|
74 |
+
<td>WMF</td>
|
75 |
+
<td>SVG</td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.gif" width="80" /></td>
|
79 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" width="80" /></td>
|
80 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tigercmyk.jpg" width="80" /></td>
|
81 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" width="80" /></td>
|
82 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.bmp" width="80" /></td>
|
83 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="80" /></td>
|
84 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="80" /></td>
|
85 |
+
</tr>
|
86 |
+
</tr>
|
87 |
+
<tr>
|
88 |
+
<td colspan="7" style="text-align: left" ><h4>Opacity 50%</h4></td>
|
89 |
+
</tr>
|
90 |
+
<tr>
|
91 |
+
<tr>
|
92 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.gif" width="80" /></td>
|
93 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" width="80" /></td>
|
94 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tigercmyk.jpg" width="80" /></td>
|
95 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" width="80" /></td>
|
96 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.bmp" width="80" /></td>
|
97 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="80" /></td>
|
98 |
+
<td><img style="vertical-align: top; opacity: 0.5" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="80" /></td>
|
99 |
+
</tr>
|
100 |
+
</table>
|
101 |
+
|
102 |
+
<h4>Alpha channel</h4>
|
103 |
+
<table>
|
104 |
+
<tr>
|
105 |
+
<td>PNG</td>
|
106 |
+
<td><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/alpha.png" width="85" /></td>
|
107 |
+
<td style="background-color:#FFCCFF; "><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/alpha.png" width="85" /></td>
|
108 |
+
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/alpha.png" width="85" /></td>
|
109 |
+
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/alpha.png" width="85" /></td>
|
110 |
+
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/alpha.png" width="85" /></td>
|
111 |
+
</tr>
|
112 |
+
</table>
|
113 |
+
<h4>Transparency</h4>
|
114 |
+
<table><tr>
|
115 |
+
<td>PNG</td>
|
116 |
+
<td style="background-color:#FFCCFF; "><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger24trns.png" width="85" /></td>
|
117 |
+
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger24trns.png" width="85" /></td>
|
118 |
+
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger24trns.png" width="85" /></td>
|
119 |
+
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger24trns.png" width="85" /></td>
|
120 |
+
</tr><tr>
|
121 |
+
<td>GIF</td>
|
122 |
+
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger8trns.gif" width="85" /></td>
|
123 |
+
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger8trns.gif" width="85" /></td>
|
124 |
+
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger8trns.gif" width="85" /></td>
|
125 |
+
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger8trns.gif" width="85" /></td>
|
126 |
+
</tr><tr>
|
127 |
+
<td>WMF</td>
|
128 |
+
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="85" /></td>
|
129 |
+
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="85" /></td>
|
130 |
+
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="85" /></td>
|
131 |
+
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="85" /></td>
|
132 |
+
</tr><tr>
|
133 |
+
<td>SVG</td>
|
134 |
+
<td style="background-color:#FFCCFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="85" /></td>
|
135 |
+
<td style="background-color:#FFFFCC;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="85" /></td>
|
136 |
+
<td style="background-color:#CCFFFF;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="85" /></td>
|
137 |
+
<td style="background-color:#CCFFFF; background: transparent url('<?php echo PDF_PLUGIN_DIR; ?>images/bg.jpg') repeat scroll right top;"><img style="vertical-align: top" src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="85" /></td>
|
138 |
+
</tr></table>
|
139 |
+
|
140 |
+
|
141 |
+
Images returned from tiger.php
|
142 |
+
<div>
|
143 |
+
GIF <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_URL; ?>images/tiger.gif" width="85" />
|
144 |
+
JPG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_URL; ?>images/tiger.jpg" width="85" />
|
145 |
+
PNG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_URL; ?>images/tiger.png" width="85" />
|
146 |
+
WMF <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_URL; ?>images/tiger.wmf" width="85" />
|
147 |
+
SVG <img style="vertical-align: top" src="<?php echo PDF_PLUGIN_URL; ?>images/tiger.svg" width="85" />
|
148 |
+
</div>
|
149 |
+
|
150 |
+
<pagebreak />
|
151 |
+
|
152 |
+
|
153 |
+
<h3>Image Alignment</h3>
|
154 |
+
<div>From mPDF version 4.2 onwards, in-line images can be individually aligned (vertically). Most of the values for "vertical-align" are supported: top, bottom, middle, baseline, text-top, and text-bottom. The default value for vertical alignment has been changed to baseline, and the default padding to 0, consistent with most browsers.
|
155 |
+
</div>
|
156 |
+
<br />
|
157 |
+
|
158 |
+
<div style="background-color:#CCFFFF;">
|
159 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: top;" />
|
160 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: top;" />
|
161 |
+
<b>top</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: top;" />
|
162 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img4.png" style="vertical-align: middle;" />
|
163 |
+
</div>
|
164 |
+
<br />
|
165 |
+
|
166 |
+
<div style="background-color:#CCFFFF;">
|
167 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: text-top;" />
|
168 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: text-top;" />
|
169 |
+
<b>text-top</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: text-top;" />
|
170 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img4.png" style="vertical-align: middle;" />
|
171 |
+
</div>
|
172 |
+
<br />
|
173 |
+
|
174 |
+
<div style="background-color:#CCFFFF;">
|
175 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: bottom;" />
|
176 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: bottom;" />
|
177 |
+
<b>bottom</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: bottom;" />
|
178 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img4.png" style="vertical-align: middle;" />
|
179 |
+
</div>
|
180 |
+
<br />
|
181 |
+
|
182 |
+
<div style="background-color:#CCFFFF;">
|
183 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: text-bottom;" />
|
184 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: text-bottom;" />
|
185 |
+
<b>text-bottom</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: text-bottom;" />
|
186 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img4.png" style="vertical-align: middle;" />
|
187 |
+
</div>
|
188 |
+
<br />
|
189 |
+
|
190 |
+
<div style="background-color:#CCFFFF;">
|
191 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: baseline;" />
|
192 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: baseline;" />
|
193 |
+
<b>baseline</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: baseline;" />
|
194 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img4.png" style="vertical-align: middle;" />
|
195 |
+
</div>
|
196 |
+
<br />
|
197 |
+
|
198 |
+
<div style="background-color:#CCFFFF;">
|
199 |
+
These images <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img1.png" style="vertical-align: middle;" />
|
200 |
+
are <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img2.png" style="vertical-align: middle;" />
|
201 |
+
<b>middle</b> <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img3.png" style="vertical-align: middle;" />
|
202 |
+
aligned <img src="<?php echo PDF_PLUGIN_DIR; ?>images/img5.png" style="vertical-align: bottom;" />
|
203 |
+
</div>
|
204 |
+
<br />
|
205 |
+
|
206 |
+
<h4>Mixed alignment</h4>
|
207 |
+
<div style="background-color:#CCFFFF;">
|
208 |
+
baseline: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="50" style="vertical-align: baseline;" />
|
209 |
+
text-bottom: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="30" style="vertical-align: text-bottom;" />
|
210 |
+
middle: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="30" style="vertical-align: middle;" />
|
211 |
+
bottom: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="80" style="vertical-align: bottom;" />
|
212 |
+
text-top: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="50" style="vertical-align: text-top;" />
|
213 |
+
top: <img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="100" style="vertical-align: top;" />
|
214 |
+
</div>
|
215 |
+
|
216 |
+
<h3>Image Border and padding</h3>
|
217 |
+
From mPDF v4.2, Image padding is supported as well as border and margin.
|
218 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/sunset.jpg" width="100" style="border:3px solid #44FF44; padding: 1em;" />
|
219 |
+
|
220 |
+
<h3>Rotated Images</h3>
|
221 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" width="100" />
|
222 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" rotate="90" width="100" />
|
223 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" rotate="180" width="100" />
|
224 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.png" rotate="-90" width="100" />
|
225 |
+
<br />
|
226 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" width="100" />
|
227 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="90" width="100" />
|
228 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="180" width="100" />
|
229 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.jpg" rotate="-90" width="100" />
|
230 |
+
<br />
|
231 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" width="80" />
|
232 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="90" width="80" />
|
233 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="180" width="80" />
|
234 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger2.wmf" rotate="-90" width="80" />
|
235 |
+
<br />
|
236 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" width="100" />
|
237 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="90" width="85" />
|
238 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="180" width="100" />
|
239 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>images/tiger.svg" rotate="-90" width="85" />
|
240 |
+
<br />
|
241 |
+
|
242 |
+
|
243 |
+
<?php
|
244 |
+
}
|
245 |
+
|
246 |
+
?>
|
247 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
</html>
|
templates/example-tables04.php
CHANGED
@@ -1,1197 +1,1175 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
.
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
padding-
|
75 |
-
padding-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
text-align:
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
.
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
.
|
140 |
-
.
|
141 |
-
|
142 |
-
.
|
143 |
-
.
|
144 |
-
.
|
145 |
-
.
|
146 |
-
|
147 |
-
.
|
148 |
-
|
149 |
-
.
|
150 |
-
.
|
151 |
-
.
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
<
|
208 |
-
<
|
209 |
-
<p>
|
210 |
-
<
|
211 |
-
<
|
212 |
-
|
213 |
-
<tr><td>Row
|
214 |
-
|
215 |
-
|
216 |
-
<p>This
|
217 |
-
|
218 |
-
<
|
219 |
-
<
|
220 |
-
This is
|
221 |
-
<
|
222 |
-
<
|
223 |
-
|
224 |
-
<
|
225 |
-
|
226 |
-
</
|
227 |
-
|
228 |
-
|
229 |
-
<
|
230 |
-
<tr><td
|
231 |
-
<tr><td
|
232 |
-
<tr><td>Row
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
</
|
237 |
-
|
238 |
-
<p>
|
239 |
-
<table
|
240 |
-
<
|
241 |
-
<
|
242 |
-
<
|
243 |
-
<
|
244 |
-
|
245 |
-
<tr
|
246 |
-
<
|
247 |
-
<
|
248 |
-
</
|
249 |
-
|
250 |
-
<
|
251 |
-
<
|
252 |
-
|
253 |
-
|
254 |
-
<tr
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
<
|
259 |
-
<p>
|
260 |
-
|
261 |
-
<
|
262 |
-
|
263 |
-
<
|
264 |
-
<td>
|
265 |
-
<
|
266 |
-
</
|
267 |
-
<
|
268 |
-
<td>
|
269 |
-
<
|
270 |
-
|
271 |
-
</
|
272 |
-
<
|
273 |
-
<
|
274 |
-
</td>
|
275 |
-
</
|
276 |
-
|
277 |
-
<
|
278 |
-
<
|
279 |
-
</td>
|
280 |
-
<td>
|
281 |
-
|
282 |
-
|
283 |
-
<td>
|
284 |
-
</
|
285 |
-
<
|
286 |
-
|
287 |
-
<
|
288 |
-
</td>
|
289 |
-
<td>
|
290 |
-
<td>
|
291 |
-
|
292 |
-
</
|
293 |
-
|
294 |
-
<
|
295 |
-
|
296 |
-
<
|
297 |
-
<
|
298 |
-
|
299 |
-
<
|
300 |
-
<
|
301 |
-
|
302 |
-
<td>
|
303 |
-
</tr>
|
304 |
-
|
305 |
-
<
|
306 |
-
<td>
|
307 |
-
<td>
|
308 |
-
</tr>
|
309 |
-
<tr>
|
310 |
-
<td>
|
311 |
-
<
|
312 |
-
|
313 |
-
|
314 |
-
</
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
<p>
|
319 |
-
|
320 |
-
<
|
321 |
-
<
|
322 |
-
|
323 |
-
</td>
|
324 |
-
|
325 |
-
|
326 |
-
</
|
327 |
-
<
|
328 |
-
|
329 |
-
<td>This is data</td>
|
330 |
-
|
331 |
-
<
|
332 |
-
|
333 |
-
|
334 |
-
</
|
335 |
-
<td>
|
336 |
-
<
|
337 |
-
</
|
338 |
-
|
339 |
-
<
|
340 |
-
<
|
341 |
-
</
|
342 |
-
<
|
343 |
-
<
|
344 |
-
</td>
|
345 |
-
|
346 |
-
|
347 |
-
<
|
348 |
-
<
|
349 |
-
|
350 |
-
</
|
351 |
-
|
352 |
-
<
|
353 |
-
|
354 |
-
</
|
355 |
-
|
356 |
-
<tr
|
357 |
-
<td>
|
358 |
-
<td>
|
359 |
-
</
|
360 |
-
|
361 |
-
<
|
362 |
-
<td>
|
363 |
-
|
364 |
-
<
|
365 |
-
|
366 |
-
<td>
|
367 |
-
</
|
368 |
-
|
369 |
-
|
370 |
-
<
|
371 |
-
|
372 |
-
</
|
373 |
-
|
374 |
-
<
|
375 |
-
|
376 |
-
|
377 |
-
<
|
378 |
-
|
379 |
-
<
|
380 |
-
<td>
|
381 |
-
<
|
382 |
-
</
|
383 |
-
<
|
384 |
-
<td>
|
385 |
-
<
|
386 |
-
|
387 |
-
</
|
388 |
-
<
|
389 |
-
<
|
390 |
-
</td>
|
391 |
-
</
|
392 |
-
|
393 |
-
<
|
394 |
-
<
|
395 |
-
</td>
|
396 |
-
<td>
|
397 |
-
|
398 |
-
|
399 |
-
<td>
|
400 |
-
</
|
401 |
-
<
|
402 |
-
|
403 |
-
<
|
404 |
-
</td>
|
405 |
-
<td>
|
406 |
-
<td>
|
407 |
-
|
408 |
-
</
|
409 |
-
|
410 |
-
<
|
411 |
-
<
|
412 |
-
<
|
413 |
-
<td>
|
414 |
-
</
|
415 |
-
|
416 |
-
<td>
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
<
|
421 |
-
<td>
|
422 |
-
|
423 |
-
<
|
424 |
-
|
425 |
-
<
|
426 |
-
|
427 |
-
<td>
|
428 |
-
<
|
429 |
-
</
|
430 |
-
</
|
431 |
-
<
|
432 |
-
<p>
|
433 |
-
|
434 |
-
<
|
435 |
-
<
|
436 |
-
|
437 |
-
</td>
|
438 |
-
|
439 |
-
|
440 |
-
</
|
441 |
-
<
|
442 |
-
|
443 |
-
<td>This is data</td>
|
444 |
-
|
445 |
-
<
|
446 |
-
|
447 |
-
|
448 |
-
</
|
449 |
-
<td>
|
450 |
-
<
|
451 |
-
</
|
452 |
-
|
453 |
-
<
|
454 |
-
<
|
455 |
-
</
|
456 |
-
<
|
457 |
-
<
|
458 |
-
</td>
|
459 |
-
|
460 |
-
|
461 |
-
<
|
462 |
-
<
|
463 |
-
|
464 |
-
</
|
465 |
-
|
466 |
-
<
|
467 |
-
|
468 |
-
</
|
469 |
-
|
470 |
-
<tr class="
|
471 |
-
<td>
|
472 |
-
<
|
473 |
-
</
|
474 |
-
|
475 |
-
<td>
|
476 |
-
|
477 |
-
</
|
478 |
-
<tr class="oddrow"><th>
|
479 |
-
<
|
480 |
-
|
481 |
-
</
|
482 |
-
<
|
483 |
-
|
484 |
-
<
|
485 |
-
</
|
486 |
-
|
487 |
-
|
488 |
-
<p
|
489 |
-
|
490 |
-
|
491 |
-
<
|
492 |
-
<
|
493 |
-
|
494 |
-
<
|
495 |
-
<p>
|
496 |
-
</
|
497 |
-
<
|
498 |
-
</
|
499 |
-
|
500 |
-
|
501 |
-
<
|
502 |
-
</
|
503 |
-
<
|
504 |
-
<td>
|
505 |
-
</
|
506 |
-
|
507 |
-
<td
|
508 |
-
|
509 |
-
<
|
510 |
-
<
|
511 |
-
</
|
512 |
-
</
|
513 |
-
|
514 |
-
<p
|
515 |
-
|
516 |
-
<
|
517 |
-
<
|
518 |
-
<
|
519 |
-
<
|
520 |
-
<p>
|
521 |
-
<p>
|
522 |
-
</td>
|
523 |
-
<td>
|
524 |
-
</tr>
|
525 |
-
|
526 |
-
<
|
527 |
-
<p>
|
528 |
-
</
|
529 |
-
<td>
|
530 |
-
</
|
531 |
-
|
532 |
-
<
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
<
|
537 |
-
|
538 |
-
<
|
539 |
-
<
|
540 |
-
<
|
541 |
-
<
|
542 |
-
<
|
543 |
-
|
544 |
-
</
|
545 |
-
|
546 |
-
</
|
547 |
-
</
|
548 |
-
<
|
549 |
-
<
|
550 |
-
|
551 |
-
<
|
552 |
-
|
553 |
-
</
|
554 |
-
<
|
555 |
-
|
556 |
-
|
557 |
-
<
|
558 |
-
|
559 |
-
<
|
560 |
-
<li>
|
561 |
-
<li>
|
562 |
-
<
|
563 |
-
<li>
|
564 |
-
<li>
|
565 |
-
|
566 |
-
</li>
|
567 |
-
</
|
568 |
-
</li>
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
<li>
|
574 |
-
</
|
575 |
-
</
|
576 |
-
|
577 |
-
</
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
<
|
582 |
-
<
|
583 |
-
<
|
584 |
-
<
|
585 |
-
<
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
<
|
590 |
-
<
|
591 |
-
|
592 |
-
</
|
593 |
-
</
|
594 |
-
|
595 |
-
|
596 |
-
</
|
597 |
-
|
598 |
-
|
599 |
-
</
|
600 |
-
<
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
<
|
605 |
-
<
|
606 |
-
|
607 |
-
<td>
|
608 |
-
|
609 |
-
|
610 |
-
</
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
</
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
<
|
619 |
-
<
|
620 |
-
<
|
621 |
-
<
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
</
|
626 |
-
<
|
627 |
-
<
|
628 |
-
|
629 |
-
<
|
630 |
-
|
631 |
-
</
|
632 |
-
</
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
<
|
637 |
-
<
|
638 |
-
|
639 |
-
<
|
640 |
-
<
|
641 |
-
<
|
642 |
-
<
|
643 |
-
|
644 |
-
</
|
645 |
-
<
|
646 |
-
</
|
647 |
-
</
|
648 |
-
<
|
649 |
-
<
|
650 |
-
|
651 |
-
<
|
652 |
-
</
|
653 |
-
<
|
654 |
-
</
|
655 |
-
|
656 |
-
<
|
657 |
-
|
658 |
-
|
659 |
-
<
|
660 |
-
</
|
661 |
-
<
|
662 |
-
|
663 |
-
<
|
664 |
-
<
|
665 |
-
</td>
|
666 |
-
</tr>
|
667 |
-
<tr><th>
|
668 |
-
<
|
669 |
-
</
|
670 |
-
|
671 |
-
<
|
672 |
-
</td>
|
673 |
-
<td>
|
674 |
-
</tr>
|
675 |
-
<tr><th>Row header
|
676 |
-
<td>
|
677 |
-
<td>
|
678 |
-
|
679 |
-
</td>
|
680 |
-
</tr>
|
681 |
-
<tr><th>Row header
|
682 |
-
<td>Also data</td>
|
683 |
-
<td>Also data</td>
|
684 |
-
</tr>
|
685 |
-
<tr><th>Row header
|
686 |
-
<td>Also data</td>
|
687 |
-
<td>Also data</td>
|
688 |
-
</tr>
|
689 |
-
<tr><th>Row header
|
690 |
-
<td>Also data</td>
|
691 |
-
<td>Also data</td>
|
692 |
-
</tr>
|
693 |
-
<tr><th>Row header
|
694 |
-
<td>Also data</td>
|
695 |
-
<td>Also data</td>
|
696 |
-
</tr>
|
697 |
-
<tr><th>Row header
|
698 |
-
<td>Also data</td>
|
699 |
-
<td>Also data</td>
|
700 |
-
</tr>
|
701 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
702 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
703 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
704 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
705 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
706 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
707 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
708 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
709 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
710 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
711 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
712 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
713 |
-
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
714 |
-
|
715 |
-
<
|
716 |
-
|
717 |
-
<
|
718 |
-
<
|
719 |
-
|
720 |
-
<
|
721 |
-
|
722 |
-
<
|
723 |
-
<tr><th>
|
724 |
-
<tr
|
725 |
-
<
|
726 |
-
|
727 |
-
<tr
|
728 |
-
<
|
729 |
-
<
|
730 |
-
<
|
731 |
-
|
732 |
-
<tr
|
733 |
-
<
|
734 |
-
<
|
735 |
-
<
|
736 |
-
</
|
737 |
-
<
|
738 |
-
|
739 |
-
<
|
740 |
-
<
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
<
|
745 |
-
<
|
746 |
-
<
|
747 |
-
<td
|
748 |
-
</
|
749 |
-
<
|
750 |
-
<td>
|
751 |
-
<td
|
752 |
-
<td>
|
753 |
-
</tr>
|
754 |
-
<tr>
|
755 |
-
<td>
|
756 |
-
<td>
|
757 |
-
<td
|
758 |
-
<td>
|
759 |
-
<td>
|
760 |
-
<td>
|
761 |
-
<td>
|
762 |
-
<td>
|
763 |
-
<td>
|
764 |
-
</
|
765 |
-
<
|
766 |
-
<td>
|
767 |
-
<td>
|
768 |
-
<td
|
769 |
-
<td>
|
770 |
-
<td>
|
771 |
-
<td>
|
772 |
-
<td>
|
773 |
-
|
774 |
-
<
|
775 |
-
</
|
776 |
-
<
|
777 |
-
<td>
|
778 |
-
<td>
|
779 |
-
<td>
|
780 |
-
<td>
|
781 |
-
<td>
|
782 |
-
<td>
|
783 |
-
<td>
|
784 |
-
<td>
|
785 |
-
<td>
|
786 |
-
<td>
|
787 |
-
<td>
|
788 |
-
<td>
|
789 |
-
<td>
|
790 |
-
<td>
|
791 |
-
<td>
|
792 |
-
<td>
|
793 |
-
|
794 |
-
<
|
795 |
-
</
|
796 |
-
<
|
797 |
-
<td>
|
798 |
-
<td>
|
799 |
-
<td>
|
800 |
-
<td>
|
801 |
-
<td>
|
802 |
-
<td>
|
803 |
-
<td>
|
804 |
-
<td>
|
805 |
-
<td>
|
806 |
-
<td>
|
807 |
-
<td>
|
808 |
-
<td>
|
809 |
-
<td>
|
810 |
-
<td>
|
811 |
-
<td>
|
812 |
-
<td>
|
813 |
-
|
814 |
-
<
|
815 |
-
</
|
816 |
-
<
|
817 |
-
<td>
|
818 |
-
<td
|
819 |
-
|
820 |
-
<
|
821 |
-
<td
|
822 |
-
|
823 |
-
<
|
824 |
-
<td
|
825 |
-
<td>
|
826 |
-
<td>
|
827 |
-
<td>
|
828 |
-
<td>
|
829 |
-
<td>
|
830 |
-
<td>
|
831 |
-
<td>
|
832 |
-
<td>
|
833 |
-
<td>
|
834 |
-
<td>
|
835 |
-
</
|
836 |
-
<
|
837 |
-
<td>
|
838 |
-
<td>
|
839 |
-
<td
|
840 |
-
|
841 |
-
|
842 |
-
<
|
843 |
-
<td
|
844 |
-
</
|
845 |
-
<
|
846 |
-
<td
|
847 |
-
<td>
|
848 |
-
<td>
|
849 |
-
<td>
|
850 |
-
<td>
|
851 |
-
<td>
|
852 |
-
<td>
|
853 |
-
<td>
|
854 |
-
<td>
|
855 |
-
<td>
|
856 |
-
<td>
|
857 |
-
<td
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
<
|
862 |
-
|
863 |
-
<
|
864 |
-
<
|
865 |
-
|
866 |
-
<
|
867 |
-
<
|
868 |
-
<
|
869 |
-
<
|
870 |
-
<
|
871 |
-
<td
|
872 |
-
<td
|
873 |
-
|
874 |
-
<
|
875 |
-
<td>
|
876 |
-
<td
|
877 |
-
<td
|
878 |
-
<td>
|
879 |
-
|
880 |
-
|
881 |
-
</
|
882 |
-
|
883 |
-
<
|
884 |
-
|
885 |
-
<
|
886 |
-
<
|
887 |
-
|
888 |
-
<
|
889 |
-
<
|
890 |
-
|
891 |
-
<tr
|
892 |
-
<
|
893 |
-
<td
|
894 |
-
<td colspan="
|
895 |
-
</
|
896 |
-
<
|
897 |
-
<td>
|
898 |
-
<td
|
899 |
-
<td
|
900 |
-
<td>
|
901 |
-
</tr>
|
902 |
-
<tr>
|
903 |
-
<td>
|
904 |
-
<td>
|
905 |
-
<td
|
906 |
-
<td>
|
907 |
-
<td>
|
908 |
-
<td>
|
909 |
-
<td>
|
910 |
-
<td>
|
911 |
-
<td>
|
912 |
-
</
|
913 |
-
<
|
914 |
-
<td>
|
915 |
-
<td>
|
916 |
-
<td
|
917 |
-
<td>
|
918 |
-
<td>
|
919 |
-
<td>
|
920 |
-
<td>
|
921 |
-
|
922 |
-
<
|
923 |
-
</
|
924 |
-
<
|
925 |
-
<td>
|
926 |
-
<td>
|
927 |
-
<td>
|
928 |
-
<td>
|
929 |
-
<td>
|
930 |
-
<td>
|
931 |
-
<td>
|
932 |
-
<td>
|
933 |
-
<td>
|
934 |
-
<td>
|
935 |
-
<td>
|
936 |
-
<td>
|
937 |
-
<td>
|
938 |
-
<td>
|
939 |
-
<td>
|
940 |
-
<td>
|
941 |
-
|
942 |
-
<
|
943 |
-
</
|
944 |
-
<
|
945 |
-
<td>
|
946 |
-
<td>
|
947 |
-
<td>
|
948 |
-
<td>
|
949 |
-
<td>
|
950 |
-
<td>
|
951 |
-
<td>
|
952 |
-
<td>
|
953 |
-
<td>
|
954 |
-
<td>
|
955 |
-
<td>
|
956 |
-
<td>
|
957 |
-
<td>
|
958 |
-
<td>
|
959 |
-
<td>
|
960 |
-
<td>
|
961 |
-
|
962 |
-
<
|
963 |
-
</
|
964 |
-
<
|
965 |
-
<td>
|
966 |
-
|
967 |
-
<
|
968 |
-
<td
|
969 |
-
<td
|
970 |
-
|
971 |
-
<
|
972 |
-
<td
|
973 |
-
<td>
|
974 |
-
<td>
|
975 |
-
<td>
|
976 |
-
<td>
|
977 |
-
<td>
|
978 |
-
<td>
|
979 |
-
<td>
|
980 |
-
<td>
|
981 |
-
<td>
|
982 |
-
<td>
|
983 |
-
</
|
984 |
-
<
|
985 |
-
<td>
|
986 |
-
<td>
|
987 |
-
<td
|
988 |
-
</tr>
|
989 |
-
<tr>
|
990 |
-
<td></td>
|
991 |
-
<td
|
992 |
-
</
|
993 |
-
<
|
994 |
-
<td
|
995 |
-
<td>
|
996 |
-
<td>
|
997 |
-
<td>
|
998 |
-
<td>
|
999 |
-
<td>
|
1000 |
-
<td>
|
1001 |
-
<td>
|
1002 |
-
<td>
|
1003 |
-
<td>
|
1004 |
-
<td>
|
1005 |
-
<td
|
1006 |
-
|
1007 |
-
|
1008 |
-
<
|
1009 |
-
|
1010 |
-
|
1011 |
-
<
|
1012 |
-
|
1013 |
-
<
|
1014 |
-
<
|
1015 |
-
<
|
1016 |
-
<
|
1017 |
-
<
|
1018 |
-
<
|
1019 |
-
<
|
1020 |
-
<
|
1021 |
-
<
|
1022 |
-
<
|
1023 |
-
<
|
1024 |
-
<
|
1025 |
-
<
|
1026 |
-
<
|
1027 |
-
<
|
1028 |
-
</
|
1029 |
-
</
|
1030 |
-
<
|
1031 |
-
|
1032 |
-
<
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
<
|
1037 |
-
<
|
1038 |
-
<
|
1039 |
-
<
|
1040 |
-
<
|
1041 |
-
<
|
1042 |
-
|
1043 |
-
<
|
1044 |
-
<
|
1045 |
-
<
|
1046 |
-
<
|
1047 |
-
<
|
1048 |
-
<
|
1049 |
-
<
|
1050 |
-
<
|
1051 |
-
<
|
1052 |
-
<
|
1053 |
-
|
1054 |
-
<
|
1055 |
-
</
|
1056 |
-
</
|
1057 |
-
|
1058 |
-
<
|
1059 |
-
<
|
1060 |
-
<td>
|
1061 |
-
<td
|
1062 |
-
<td
|
1063 |
-
<td>
|
1064 |
-
</tr>
|
1065 |
-
<tr>
|
1066 |
-
<td>
|
1067 |
-
<td>
|
1068 |
-
<td
|
1069 |
-
<td>
|
1070 |
-
<td>
|
1071 |
-
<td>
|
1072 |
-
<td>
|
1073 |
-
<td>
|
1074 |
-
<td>
|
1075 |
-
</
|
1076 |
-
<
|
1077 |
-
<td>
|
1078 |
-
<td>
|
1079 |
-
<td
|
1080 |
-
<td>
|
1081 |
-
<td>
|
1082 |
-
<td>
|
1083 |
-
<td>
|
1084 |
-
|
1085 |
-
<
|
1086 |
-
</
|
1087 |
-
<
|
1088 |
-
<td>
|
1089 |
-
<td>
|
1090 |
-
<td>
|
1091 |
-
<td>
|
1092 |
-
<td>
|
1093 |
-
<td>
|
1094 |
-
<td>
|
1095 |
-
<td>
|
1096 |
-
<td>
|
1097 |
-
<td>
|
1098 |
-
<td>
|
1099 |
-
<td>
|
1100 |
-
<td>
|
1101 |
-
<td>
|
1102 |
-
<td>
|
1103 |
-
<td>
|
1104 |
-
|
1105 |
-
<
|
1106 |
-
</
|
1107 |
-
<
|
1108 |
-
<td>
|
1109 |
-
<td>
|
1110 |
-
<td>
|
1111 |
-
<td>
|
1112 |
-
<td>
|
1113 |
-
<td>
|
1114 |
-
<td>
|
1115 |
-
<td>
|
1116 |
-
<td
|
1117 |
-
<td>
|
1118 |
-
<td>
|
1119 |
-
<td>
|
1120 |
-
<td>
|
1121 |
-
<td>
|
1122 |
-
<td>
|
1123 |
-
<td>
|
1124 |
-
|
1125 |
-
<
|
1126 |
-
</
|
1127 |
-
<
|
1128 |
-
<td>
|
1129 |
-
|
1130 |
-
<
|
1131 |
-
<td
|
1132 |
-
<td>
|
1133 |
-
<td>
|
1134 |
-
<td>
|
1135 |
-
<td>
|
1136 |
-
<td>
|
1137 |
-
<td>
|
1138 |
-
<td>
|
1139 |
-
<td>
|
1140 |
-
<td>
|
1141 |
-
<td>
|
1142 |
-
<td>
|
1143 |
-
<td>
|
1144 |
-
<td>
|
1145 |
-
<td>
|
1146 |
-
|
1147 |
-
|
1148 |
-
<
|
1149 |
-
<td
|
1150 |
-
<td
|
1151 |
-
</
|
1152 |
-
<
|
1153 |
-
<td
|
1154 |
-
<td>
|
1155 |
-
<td>
|
1156 |
-
<td>
|
1157 |
-
<td>
|
1158 |
-
<td>
|
1159 |
-
<td>
|
1160 |
-
<td>
|
1161 |
-
<td>
|
1162 |
-
<td>
|
1163 |
-
<td>
|
1164 |
-
<td
|
1165 |
-
|
1166 |
-
|
1167 |
-
<
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
<td>Np </td>
|
1176 |
-
<td>Pu </td>
|
1177 |
-
<td>Am </td>
|
1178 |
-
<td>Cm </td>
|
1179 |
-
<td>Bk </td>
|
1180 |
-
<td>Cf </td>
|
1181 |
-
<td>Es </td>
|
1182 |
-
<td>Fm </td>
|
1183 |
-
<td>Md </td>
|
1184 |
-
<td>No </td>
|
1185 |
-
<td>Lr </td>
|
1186 |
-
<td></td>
|
1187 |
-
</tr>
|
1188 |
-
</tbody></table>
|
1189 |
-
<p> </p>
|
1190 |
-
|
1191 |
-
|
1192 |
-
<?php
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
?>
|
1196 |
-
</body>
|
1197 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
<style>
|
31 |
+
|
32 |
+
body { font-family: DejaVuSansCondensed; font-size: 11pt; }
|
33 |
+
p { text-align: justify; margin-bottom: 4pt; margin-top:0pt; }
|
34 |
+
|
35 |
+
table {font-family: DejaVuSansCondensed; font-size: 9pt; line-height: 1.2;
|
36 |
+
margin-top: 2pt; margin-bottom: 5pt;
|
37 |
+
border-collapse: collapse; }
|
38 |
+
|
39 |
+
thead { font-weight: bold; vertical-align: bottom; }
|
40 |
+
tfoot { font-weight: bold; vertical-align: top; }
|
41 |
+
thead td { font-weight: bold; }
|
42 |
+
tfoot td { font-weight: bold; }
|
43 |
+
|
44 |
+
thead td, thead th, tfoot td, tfoot th { font-variant: small-caps; }
|
45 |
+
|
46 |
+
.headerrow td, .headerrow th { background-gradient: linear #b7cebd #f5f8f5 0 1 0 0.2; }
|
47 |
+
.footerrow td, .footerrow th { background-gradient: linear #b7cebd #f5f8f5 0 1 0 0.2; }
|
48 |
+
|
49 |
+
th { font-weight: bold;
|
50 |
+
vertical-align: top;
|
51 |
+
text-align:left;
|
52 |
+
padding-left: 2mm;
|
53 |
+
padding-right: 2mm;
|
54 |
+
padding-top: 0.5mm;
|
55 |
+
padding-bottom: 0.5mm;
|
56 |
+
}
|
57 |
+
|
58 |
+
td { padding-left: 2mm;
|
59 |
+
vertical-align: top;
|
60 |
+
text-align:left;
|
61 |
+
padding-right: 2mm;
|
62 |
+
padding-top: 0.5mm;
|
63 |
+
padding-bottom: 0.5mm;
|
64 |
+
}
|
65 |
+
|
66 |
+
th p { text-align: left; margin:0pt; }
|
67 |
+
td p { text-align: left; margin:0pt; }
|
68 |
+
|
69 |
+
table.widecells td {
|
70 |
+
padding-left: 5mm;
|
71 |
+
padding-right: 5mm;
|
72 |
+
}
|
73 |
+
table.tallcells td {
|
74 |
+
padding-top: 3mm;
|
75 |
+
padding-bottom: 3mm;
|
76 |
+
}
|
77 |
+
|
78 |
+
hr { width: 70%; height: 1px;
|
79 |
+
text-align: center; color: #999999;
|
80 |
+
margin-top: 8pt; margin-bottom: 8pt; }
|
81 |
+
|
82 |
+
a { color: #000066; font-style: normal; text-decoration: underline;
|
83 |
+
font-weight: normal; }
|
84 |
+
|
85 |
+
ul { text-indent: 5mm; margin-bottom: 9pt; }
|
86 |
+
ol { text-indent: 5mm; margin-bottom: 9pt; }
|
87 |
+
|
88 |
+
pre { font-family: DejaVuSansMono; font-size: 9pt; margin-top: 5pt; margin-bottom: 5pt; }
|
89 |
+
|
90 |
+
h1 { font-weight: normal; font-size: 26pt; color: #000066;
|
91 |
+
font-family: DejaVuSansCondensed; margin-top: 18pt; margin-bottom: 6pt;
|
92 |
+
border-top: 0.075cm solid #000000; border-bottom: 0.075cm solid #000000;
|
93 |
+
text-align: ; page-break-after:avoid; }
|
94 |
+
h2 { font-weight: bold; font-size: 12pt; color: #000066;
|
95 |
+
font-family: DejaVuSansCondensed; margin-top: 6pt; margin-bottom: 6pt;
|
96 |
+
border-top: 0.07cm solid #000000; border-bottom: 0.07cm solid #000000;
|
97 |
+
text-align: ; text-transform:uppercase; page-break-after:avoid; }
|
98 |
+
h3 { font-weight: normal; font-size: 26pt; color: #000000;
|
99 |
+
font-family: DejaVuSansCondensed; margin-top: 0pt; margin-bottom: 6pt;
|
100 |
+
border-top: 0; border-bottom: 0;
|
101 |
+
text-align: ; page-break-after:avoid; }
|
102 |
+
h4 { font-weight: ; font-size: 13pt; color: #9f2b1e;
|
103 |
+
font-family: DejaVuSansCondensed; margin-top: 10pt; margin-bottom: 7pt;
|
104 |
+
font-variant: small-caps;
|
105 |
+
text-align: ; margin-collapse:collapse; page-break-after:avoid; }
|
106 |
+
h5 { font-weight: bold; font-style:italic; ; font-size: 11pt; color: #000044;
|
107 |
+
font-family: DejaVuSansCondensed; margin-top: 8pt; margin-bottom: 4pt;
|
108 |
+
text-align: ; page-break-after:avoid; }
|
109 |
+
h6 { font-weight: bold; font-size: 9.5pt; color: #333333;
|
110 |
+
font-family: DejaVuSansCondensed; margin-top: 6pt; margin-bottom: ;
|
111 |
+
text-align: ; page-break-after:avoid; }
|
112 |
+
|
113 |
+
.breadcrumb {
|
114 |
+
text-align: right; font-size: 8pt; font-family: DejaVuSerifCondensed; color: #666666;
|
115 |
+
font-weight: bold; font-style: normal; margin-bottom: 6pt; }
|
116 |
+
|
117 |
+
.evenrow td, .evenrow th { background-color: #f5f8f5; }
|
118 |
+
.oddrow td, .oddrow th { background-color: #e3ece4; }
|
119 |
+
|
120 |
+
.bpmTopic { background-color: #e3ece4; }
|
121 |
+
.bpmTopicC { background-color: #e3ece4; }
|
122 |
+
.bpmNoLines { background-color: #e3ece4; }
|
123 |
+
.bpmNoLinesC { background-color: #e3ece4; }
|
124 |
+
.bpmClear { }
|
125 |
+
.bpmClearC { text-align: center; }
|
126 |
+
.bpmTopnTail { background-color: #e3ece4; topntail: 0.02cm solid #495b4a;}
|
127 |
+
.bpmTopnTailC { background-color: #e3ece4; topntail: 0.02cm solid #495b4a;}
|
128 |
+
.bpmTopnTailClear { topntail: 0.02cm solid #495b4a; }
|
129 |
+
.bpmTopnTailClearC { topntail: 0.02cm solid #495b4a; }
|
130 |
+
|
131 |
+
.bpmTopicC td, .bpmTopicC td p { text-align: center; }
|
132 |
+
.bpmNoLinesC td, .bpmNoLinesC td p { text-align: center; }
|
133 |
+
.bpmClearC td, .bpmClearC td p { text-align: center; }
|
134 |
+
.bpmTopnTailC td, .bpmTopnTailC td p { text-align: center; }
|
135 |
+
.bpmTopnTailClearC td, .bpmTopnTailClearC td p { text-align: center; }
|
136 |
+
|
137 |
+
.pmhMiddleCenter { text-align:center; vertical-align:middle; }
|
138 |
+
.pmhMiddleRight { text-align:right; vertical-align:middle; }
|
139 |
+
.pmhBottomCenter { text-align:center; vertical-align:bottom; }
|
140 |
+
.pmhBottomRight { text-align:right; vertical-align:bottom; }
|
141 |
+
.pmhTopCenter { text-align:center; vertical-align:top; }
|
142 |
+
.pmhTopRight { text-align:right; vertical-align:top; }
|
143 |
+
.pmhTopLeft { text-align:left; vertical-align:top; }
|
144 |
+
.pmhBottomLeft { text-align:left; vertical-align:bottom; }
|
145 |
+
.pmhMiddleLeft { text-align:left; vertical-align:middle; }
|
146 |
+
|
147 |
+
.infobox { margin-top:10pt; background-color:#DDDDBB; text-align:center; border:1px solid #880000; }
|
148 |
+
|
149 |
+
.bpmTopic td, .bpmTopic th { border-top: 1px solid #FFFFFF; }
|
150 |
+
.bpmTopicC td, .bpmTopicC th { border-top: 1px solid #FFFFFF; }
|
151 |
+
.bpmTopnTail td, .bpmTopnTail th { border-top: 1px solid #FFFFFF; }
|
152 |
+
.bpmTopnTailC td, .bpmTopnTailC th { border-top: 1px solid #FFFFFF; }
|
153 |
+
|
154 |
+
|
155 |
+
</style>
|
156 |
+
<title>Gravity Forms PDF Extended</title>
|
157 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
158 |
+
</head>
|
159 |
+
<body>
|
160 |
+
<?php
|
161 |
+
|
162 |
+
foreach($lead_ids as $lead_id) {
|
163 |
+
|
164 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
165 |
+
do_action("gform_print_entry_header", $form, $lead);
|
166 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
167 |
+
/*
|
168 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
169 |
+
*/
|
170 |
+
PDF_Common::view_data($form_data);
|
171 |
+
|
172 |
+
/* get all the form values */
|
173 |
+
/*$date_created = $form_data['date_created'];
|
174 |
+
|
175 |
+
$first_name = $form_data['1.Name']['first'];
|
176 |
+
$last_name = $form_data['1.Name']['last'];*/
|
177 |
+
|
178 |
+
/* format the template */
|
179 |
+
?>
|
180 |
+
|
181 |
+
<img src="<?php echo PDF_PLUGIN_DIR; ?>/images/gravityformspdfextended.jpg" width="311" height="110" />
|
182 |
+
|
183 |
+
|
184 |
+
<h1>mPDF</h1>
|
185 |
+
<h2>Tables</h2>
|
186 |
+
<h3>CSS Styles</h3>
|
187 |
+
<p>The CSS properties for tables and cells is increased over that in html2fpdf. It includes recognition of THEAD, TFOOT and TH.<br />See below for other facilities such as autosizing, and rotation.</p>
|
188 |
+
<table border="1">
|
189 |
+
<tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr>
|
190 |
+
|
191 |
+
<tr><td>Row 2</td>
|
192 |
+
|
193 |
+
<td style="background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;">
|
194 |
+
<p>This is data p</p>
|
195 |
+
This is data out of p
|
196 |
+
<p style="font-weight:bold; font-size:20pt; background-color:#FFBBFF;">This is bold data p</p>
|
197 |
+
<b>This is bold data out of p</b><br />
|
198 |
+
This is normal data after br
|
199 |
+
<h3>H3 in a table</h3>
|
200 |
+
<div>This is data div</div>
|
201 |
+
This is data out of div
|
202 |
+
<div style="font-weight:bold;">This is data div (bold)</div>
|
203 |
+
This is data out of div
|
204 |
+
</td>
|
205 |
+
|
206 |
+
|
207 |
+
<td><p>More data</p><p style="font-size:12pt;">This is large text</p></td></tr>
|
208 |
+
<tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr>
|
209 |
+
<tr><td><p>Row 4 <td> cell</p></td><td>This is data</td><td><p>This is data</p></td></tr>
|
210 |
+
<tr><td>Row 5</td><td>Also data</td><td>Also data</td></tr>
|
211 |
+
<tr><td>Row 6</td><td>Also data</td><td>Also data</td></tr>
|
212 |
+
<tr><td>Row 7</td><td>Also data</td><td>Also data</td></tr>
|
213 |
+
<tr><td>Row 8</td><td>Also data</td><td>Also data</td></tr>
|
214 |
+
</tbody></table>
|
215 |
+
|
216 |
+
<p>This table has padding-left and -right set to 5mm i.e. padding within the cells. Also border colour and style, font family and size are set by <acronym>CSS</acronym>.</p>
|
217 |
+
<table align="right" style="border: 1px solid #880000; font-family: Mono; font-size: 7pt; " class="widecells">
|
218 |
+
<tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr>
|
219 |
+
<tr><td>Row 2</td><td><p>This is data p</p></td><td><p>More data</p></td></tr>
|
220 |
+
<tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr>
|
221 |
+
<tr><td><p>Row 4 <td> cell</p></td><td>This is data</td><td><p>This is data</p></td></tr>
|
222 |
+
<tr><td>Row 5</td><td>Also data</td><td>Also data</td></tr>
|
223 |
+
<tr><td>Row 6</td><td>Also data</td><td>Also data</td></tr>
|
224 |
+
<tr><td>Row 7</td><td>Also data</td><td>Also data</td></tr>
|
225 |
+
<tr><td>Row 8</td><td>Also data</td><td>Also data</td></tr>
|
226 |
+
</tbody></table>
|
227 |
+
|
228 |
+
<p>This table has padding-top and -bottom set to 3mm i.e. padding within the cells. Also background-, border colour and style, font family and size are set by in-line <acronym>CSS</acronym>.</p>
|
229 |
+
<table style="border: 1px solid #880000; background-color: #BBCCDD; font-family: Mono; font-size: 7pt; " class="tallcells">
|
230 |
+
<tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr>
|
231 |
+
<tr><td>Row 2</td><td><p>This is data p</p></td><td><p>More data</p></td></tr>
|
232 |
+
<tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr>
|
233 |
+
</tbody></table>
|
234 |
+
|
235 |
+
|
236 |
+
<h3 style="margin-top: 20pt; margin-collapse:collapse;">Table Styles</h3>
|
237 |
+
<p>The style sheet used for these examples shows some of the table styles I use on my website. The property 'topntail' defined by a border-type definition e.g. "1px solid #880000" puts a border at the top and bottom of the table, and also below a header row (thead) if defined. Note also that <thead> will automatically turn on the header-repeat i.e. reproduce the header row at the top of each page.</p>
|
238 |
+
<p>bpmTopic Class</p>
|
239 |
+
<table class="bpmTopic"><thead></thead><tbody>
|
240 |
+
<tr>
|
241 |
+
<td>Row 1</td>
|
242 |
+
<td>This is data</td>
|
243 |
+
<td>This is data</td>
|
244 |
+
</tr>
|
245 |
+
<tr>
|
246 |
+
<td>Row 2</td>
|
247 |
+
<td>
|
248 |
+
<p>This is data p</p>
|
249 |
+
</td>
|
250 |
+
<td>
|
251 |
+
<p>More data</p>
|
252 |
+
</td>
|
253 |
+
</tr>
|
254 |
+
<tr>
|
255 |
+
<td>
|
256 |
+
<p>Row 3</p>
|
257 |
+
</td>
|
258 |
+
<td>
|
259 |
+
<p>This is long data</p>
|
260 |
+
</td>
|
261 |
+
<td>This is data</td>
|
262 |
+
</tr>
|
263 |
+
<tr>
|
264 |
+
<td>
|
265 |
+
<p>Row 4 <td> cell</p>
|
266 |
+
</td>
|
267 |
+
<td>This is data</td>
|
268 |
+
<td>
|
269 |
+
<p>This is data</p>
|
270 |
+
</td>
|
271 |
+
</tr>
|
272 |
+
<tr>
|
273 |
+
<td>Row 5</td>
|
274 |
+
<td>Also data</td>
|
275 |
+
<td>Also data</td>
|
276 |
+
</tr>
|
277 |
+
<tr>
|
278 |
+
<td>Row 6</td>
|
279 |
+
<td>Also data</td>
|
280 |
+
<td>Also data</td>
|
281 |
+
</tr>
|
282 |
+
<tr>
|
283 |
+
<td>Row 7</td>
|
284 |
+
<td>Also data</td>
|
285 |
+
<td>Also data</td>
|
286 |
+
</tr>
|
287 |
+
<tr>
|
288 |
+
<td>Row 8</td>
|
289 |
+
<td>Also data</td>
|
290 |
+
<td>Also data</td>
|
291 |
+
</tr>
|
292 |
+
</tbody></table>
|
293 |
+
|
294 |
+
<p> </p>
|
295 |
+
|
296 |
+
<p>bpmTopic<b>C</b> Class (centered) Odd and Even rows</p>
|
297 |
+
<table class="bpmTopicC"><thead>
|
298 |
+
<tr class="headerrow"><th>Col/Row Header</th>
|
299 |
+
<td>
|
300 |
+
<p>Second column header p</p>
|
301 |
+
</td>
|
302 |
+
<td>Third column header</td>
|
303 |
+
</tr>
|
304 |
+
</thead><tbody>
|
305 |
+
<tr class="oddrow"><th>Row header 1</th>
|
306 |
+
<td>This is data</td>
|
307 |
+
<td>This is data</td>
|
308 |
+
</tr>
|
309 |
+
<tr class="evenrow"><th>Row header 2</th>
|
310 |
+
<td>
|
311 |
+
<p>This is data p</p>
|
312 |
+
</td>
|
313 |
+
<td>
|
314 |
+
<p>This is data</p>
|
315 |
+
</td>
|
316 |
+
</tr>
|
317 |
+
<tr class="oddrow"><th>
|
318 |
+
<p>Row header 3</p>
|
319 |
+
</th>
|
320 |
+
<td>
|
321 |
+
<p>This is long data</p>
|
322 |
+
</td>
|
323 |
+
<td>This is data</td>
|
324 |
+
</tr>
|
325 |
+
<tr class="evenrow"><th>
|
326 |
+
<p>Row header 4</p>
|
327 |
+
<p><th> cell acting as header</p>
|
328 |
+
</th>
|
329 |
+
<td>This is data</td>
|
330 |
+
<td>
|
331 |
+
<p>This is data</p>
|
332 |
+
</td>
|
333 |
+
</tr>
|
334 |
+
<tr class="oddrow"><th>Row header 5</th>
|
335 |
+
<td>Also data</td>
|
336 |
+
<td>Also data</td>
|
337 |
+
</tr>
|
338 |
+
<tr class="evenrow"><th>Row header 6</th>
|
339 |
+
<td>Also data</td>
|
340 |
+
<td>Also data</td>
|
341 |
+
</tr>
|
342 |
+
<tr class="oddrow"><th>Row header 7</th>
|
343 |
+
<td>Also data</td>
|
344 |
+
<td>Also data</td>
|
345 |
+
</tr>
|
346 |
+
<tr class="evenrow"><th>Row header 8</th>
|
347 |
+
<td>Also data</td>
|
348 |
+
<td>Also data</td>
|
349 |
+
</tr>
|
350 |
+
</tbody></table>
|
351 |
+
|
352 |
+
<p> </p>
|
353 |
+
|
354 |
+
<p>bpmTopnTail Class </p>
|
355 |
+
<table class="bpmTopnTail"><thead></thead><tbody>
|
356 |
+
<tr>
|
357 |
+
<td>Row 1</td>
|
358 |
+
<td>This is data</td>
|
359 |
+
<td>This is data</td>
|
360 |
+
</tr>
|
361 |
+
<tr>
|
362 |
+
<td>Row 2</td>
|
363 |
+
<td>
|
364 |
+
<p>This is data p</p>
|
365 |
+
</td>
|
366 |
+
<td>
|
367 |
+
<p>This is data</p>
|
368 |
+
</td>
|
369 |
+
</tr>
|
370 |
+
<tr>
|
371 |
+
<td>
|
372 |
+
<p>Row 3</p>
|
373 |
+
</td>
|
374 |
+
<td>
|
375 |
+
<p>This is long data</p>
|
376 |
+
</td>
|
377 |
+
<td>This is data</td>
|
378 |
+
</tr>
|
379 |
+
<tr>
|
380 |
+
<td>
|
381 |
+
<p>Row 4 <td> cell</p>
|
382 |
+
</td>
|
383 |
+
<td>This is data</td>
|
384 |
+
<td>
|
385 |
+
<p>This is data</p>
|
386 |
+
</td>
|
387 |
+
</tr>
|
388 |
+
<tr>
|
389 |
+
<td>Row 5</td>
|
390 |
+
<td>Also data</td>
|
391 |
+
<td>Also data</td>
|
392 |
+
</tr>
|
393 |
+
<tr>
|
394 |
+
<td>Row 6</td>
|
395 |
+
<td>Also data</td>
|
396 |
+
<td>Also data</td>
|
397 |
+
</tr>
|
398 |
+
<tr>
|
399 |
+
<td>Row 7</td>
|
400 |
+
<td>Also data</td>
|
401 |
+
<td>Also data</td>
|
402 |
+
</tr>
|
403 |
+
<tr>
|
404 |
+
<td>Row 8</td>
|
405 |
+
<td>Also data</td>
|
406 |
+
<td>Also data</td>
|
407 |
+
</tr>
|
408 |
+
</tbody></table>
|
409 |
+
<p> </p>
|
410 |
+
<p>bpmTopnTail<b>C</b> Class (centered) Odd and Even rows</p>
|
411 |
+
<table class="bpmTopnTailC"><thead>
|
412 |
+
<tr class="headerrow"><th>Col/Row Header</th>
|
413 |
+
<td>
|
414 |
+
<p>Second column header p</p>
|
415 |
+
</td>
|
416 |
+
<td>Third column header</td>
|
417 |
+
</tr>
|
418 |
+
</thead><tbody>
|
419 |
+
<tr class="oddrow"><th>Row header 1</th>
|
420 |
+
<td>This is data</td>
|
421 |
+
<td>This is data</td>
|
422 |
+
</tr>
|
423 |
+
<tr class="evenrow"><th>Row header 2</th>
|
424 |
+
<td>
|
425 |
+
<p>This is data p</p>
|
426 |
+
</td>
|
427 |
+
<td>
|
428 |
+
<p>This is data</p>
|
429 |
+
</td>
|
430 |
+
</tr>
|
431 |
+
<tr class="oddrow"><th>
|
432 |
+
<p>Row header 3</p>
|
433 |
+
</th>
|
434 |
+
<td>
|
435 |
+
<p>This is long data</p>
|
436 |
+
</td>
|
437 |
+
<td>This is data</td>
|
438 |
+
</tr>
|
439 |
+
<tr class="evenrow"><th>
|
440 |
+
<p>Row header 4</p>
|
441 |
+
<p><th> cell acting as header</p>
|
442 |
+
</th>
|
443 |
+
<td>This is data</td>
|
444 |
+
<td>
|
445 |
+
<p>This is data</p>
|
446 |
+
</td>
|
447 |
+
</tr>
|
448 |
+
<tr class="oddrow"><th>Row header 5</th>
|
449 |
+
<td>Also data</td>
|
450 |
+
<td>Also data</td>
|
451 |
+
</tr>
|
452 |
+
<tr class="evenrow"><th>Row header 6</th>
|
453 |
+
<td>Also data</td>
|
454 |
+
<td>Also data</td>
|
455 |
+
</tr>
|
456 |
+
<tr class="oddrow"><th>Row header 7</th>
|
457 |
+
<td>Also data</td>
|
458 |
+
<td>Also data</td>
|
459 |
+
</tr>
|
460 |
+
<tr class="evenrow"><th>Row header 8</th>
|
461 |
+
<td>Also data</td>
|
462 |
+
<td>Also data</td>
|
463 |
+
</tr>
|
464 |
+
</tbody></table>
|
465 |
+
|
466 |
+
<p> </p>
|
467 |
+
|
468 |
+
<p>TopnTail Class</p>
|
469 |
+
<table class="bpmTopnTail"><thead>
|
470 |
+
<tr class="headerrow"><th>Col and Row Header</th>
|
471 |
+
<td>
|
472 |
+
<p>Second</p>
|
473 |
+
<p>column</p>
|
474 |
+
</td>
|
475 |
+
<td class="pmhTopRight">Top right align</td>
|
476 |
+
</tr>
|
477 |
+
</thead><tbody>
|
478 |
+
<tr class="oddrow"><th>
|
479 |
+
<p>Row header 1 p</p>
|
480 |
+
</th>
|
481 |
+
<td>This is data</td>
|
482 |
+
<td>This is data</td>
|
483 |
+
</tr>
|
484 |
+
<tr class="evenrow"><th>Row header 2</th>
|
485 |
+
<td class="pmhBottomRight"><b><i>Bottom right align</i></b></td>
|
486 |
+
<td>
|
487 |
+
<p>This is data. Can use</p>
|
488 |
+
<p><b>bold</b> <i>italic </i><sub>sub</sub> or <sup>sup</sup> text</p>
|
489 |
+
</td>
|
490 |
+
</tr>
|
491 |
+
<tr class="oddrow"><th class="pmhBottomRight">
|
492 |
+
<p>Bottom right align</p>
|
493 |
+
</th>
|
494 |
+
<td class="pmhMiddleCenter" style="border: #000000 1px solid">
|
495 |
+
<p>This is data. This cell</p>
|
496 |
+
<p>uses Cell Styles to set</p>
|
497 |
+
<p>the borders.</p>
|
498 |
+
<p>All borders are collapsible</p>
|
499 |
+
<p>in mPDF.</p>
|
500 |
+
</td>
|
501 |
+
<td>This is data</td>
|
502 |
+
</tr>
|
503 |
+
<tr class="evenrow"><th>Row header 4</th>
|
504 |
+
<td>
|
505 |
+
<p>This is data p</p>
|
506 |
+
</td>
|
507 |
+
<td>More data</td>
|
508 |
+
</tr>
|
509 |
+
<tr class="oddrow"><th>Row header 5</th>
|
510 |
+
<td colspan="2" class="pmhTopCenter">Also data merged and centered</td>
|
511 |
+
</tr>
|
512 |
+
</tbody></table>
|
513 |
+
|
514 |
+
<p> </p>
|
515 |
+
|
516 |
+
<h4>Lists in a Table</h4>
|
517 |
+
<table class="bpmTopnTail"><thead>
|
518 |
+
<tr class="headerrow"><th>Col and Row Header</th>
|
519 |
+
<td>
|
520 |
+
<p>Second</p>
|
521 |
+
<p>column</p>
|
522 |
+
</td>
|
523 |
+
<td class="pmhTopRight">Top right align</td>
|
524 |
+
</tr>
|
525 |
+
</thead><tbody>
|
526 |
+
<tr class="oddrow"><th>
|
527 |
+
<p>Row header 1 p</p>
|
528 |
+
</th>
|
529 |
+
<td>This is data</td>
|
530 |
+
<td>This is data</td>
|
531 |
+
</tr>
|
532 |
+
<tr class="evenrow"><th>Row header 2</th>
|
533 |
+
<td>
|
534 |
+
<ol>
|
535 |
+
<li>Item 1</li>
|
536 |
+
<li>Item 2
|
537 |
+
<ol type="a">
|
538 |
+
<li>Subitem of ordered list</li>
|
539 |
+
<li>Subitem 2
|
540 |
+
<ol type="i">
|
541 |
+
<li>Level 3 subitem</li>
|
542 |
+
<li>Level 3 subitem</li>
|
543 |
+
</ol>
|
544 |
+
</li>
|
545 |
+
</ol>
|
546 |
+
</li>
|
547 |
+
<li>Item 3</li>
|
548 |
+
<li>Another Item</li>
|
549 |
+
<li>Subitem
|
550 |
+
<ol>
|
551 |
+
<li>Level 3 subitem</li>
|
552 |
+
</ol>
|
553 |
+
</li>
|
554 |
+
<li>Another Item</li>
|
555 |
+
</ol>
|
556 |
+
</td>
|
557 |
+
<td>
|
558 |
+
Unordered list:
|
559 |
+
<ul>
|
560 |
+
<li>Item 1</li>
|
561 |
+
<li>Item 2
|
562 |
+
<ul>
|
563 |
+
<li>Subitem of unordered list</li>
|
564 |
+
<li>Subitem 2
|
565 |
+
<ul>
|
566 |
+
<li>Level 3 subitem</li>
|
567 |
+
<li>Level 3 subitem</li>
|
568 |
+
<li>Level 3 subitem</li>
|
569 |
+
</ul>
|
570 |
+
</li>
|
571 |
+
</ul>
|
572 |
+
</li>
|
573 |
+
<li>Item 3</li>
|
574 |
+
</ul>
|
575 |
+
</td>
|
576 |
+
</tr>
|
577 |
+
</tbody></table>
|
578 |
+
<p> </p>
|
579 |
+
|
580 |
+
|
581 |
+
<h4>Automatic Column Width</h4>
|
582 |
+
<table class="bpmTopnTail"><tbody>
|
583 |
+
<tr>
|
584 |
+
<td>Causes</td>
|
585 |
+
<td>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. <br />
|
586 |
+
Ut a eros at ligula vehicula pretium; maecenas feugiat pede vel risus.<br />
|
587 |
+
Suspendisse potenti</td>
|
588 |
+
</tr>
|
589 |
+
<tr>
|
590 |
+
<td>Mechanisms</td>
|
591 |
+
<td>Ut magna ipsum, tempus in, condimentum at, rutrum et, nisl. Vestibulum interdum luctus sapien. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Maecenas consectetuer eros quis massa. Mauris semper velit vehicula purus. Duis lacus. Aenean pretium consectetuer mauris. Ut purus sem, consequat ut, fermentum sit amet, ornare sit amet, ipsum. Donec non nunc. Maecenas fringilla. Curabitur libero. In dui massa, malesuada sit amet, hendrerit vitae, viverra nec, tortor. Donec varius. Ut ut dolor et tellus adipiscing adipiscing.</td>
|
592 |
+
</tr>
|
593 |
+
</tbody></table>
|
594 |
+
|
595 |
+
|
596 |
+
<h4>ColSpan & Rowspan</h4>
|
597 |
+
<table class="bpmTopnTail"><tbody>
|
598 |
+
<tr>
|
599 |
+
<td rowspan="2">Causes</td>
|
600 |
+
<td colspan="2">Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. <br />
|
601 |
+
Ut a eros at ligula vehicula pretium; maecenas feugiat pede vel risus.<br />
|
602 |
+
Suspendisse potenti</td>
|
603 |
+
</tr>
|
604 |
+
<tr>
|
605 |
+
<td>Fusce eleifend neque sit amet erat.<br />
|
606 |
+
Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus.</td>
|
607 |
+
<td>Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla.<br />
|
608 |
+
Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien.</td>
|
609 |
+
</tr>
|
610 |
+
</tbody></table>
|
611 |
+
|
612 |
+
|
613 |
+
|
614 |
+
<h4>Table Header & Footer Rows</h4>
|
615 |
+
<p>A table using a header row should repeat the header row across pages:</p>
|
616 |
+
<p>bpmTopic<b>C</b> Class</p>
|
617 |
+
<table class="bpmTopicC">
|
618 |
+
<thead>
|
619 |
+
<tr class="headerrow"><th>Col and Row Header</th>
|
620 |
+
<td>
|
621 |
+
<p>Second column header</p>
|
622 |
+
</td>
|
623 |
+
<td>Third column header</td>
|
624 |
+
</tr>
|
625 |
+
</thead>
|
626 |
+
<tfoot>
|
627 |
+
<tr class="footerrow"><th>Col and Row Footer</th>
|
628 |
+
<td>
|
629 |
+
<p>Second column footer</p>
|
630 |
+
</td>
|
631 |
+
<td>Third column footer</td>
|
632 |
+
</tr>
|
633 |
+
</tfoot>
|
634 |
+
<tbody>
|
635 |
+
<tr><th>Row header 1</th>
|
636 |
+
<td>This is data</td>
|
637 |
+
<td>This is data</td>
|
638 |
+
</tr>
|
639 |
+
<tr><th>Row header 2</th>
|
640 |
+
<td>This is data</td>
|
641 |
+
<td>
|
642 |
+
<p>This is data</p>
|
643 |
+
</td>
|
644 |
+
</tr>
|
645 |
+
<tr><th>
|
646 |
+
<p>Row header 3</p>
|
647 |
+
</th>
|
648 |
+
<td>
|
649 |
+
<p>This is data</p>
|
650 |
+
</td>
|
651 |
+
<td>This is data</td>
|
652 |
+
</tr>
|
653 |
+
<tr><th>Row header 4</th>
|
654 |
+
<td>This is data</td>
|
655 |
+
<td>
|
656 |
+
<p>This is data</p>
|
657 |
+
</td>
|
658 |
+
</tr>
|
659 |
+
<tr><th>Row header 5</th>
|
660 |
+
<td>Also data</td>
|
661 |
+
<td>Also data</td>
|
662 |
+
</tr>
|
663 |
+
<tr><th>Row header 6</th>
|
664 |
+
<td>Also data</td>
|
665 |
+
<td>Also data</td>
|
666 |
+
</tr>
|
667 |
+
<tr><th>Row header 7</th>
|
668 |
+
<td>Also data</td>
|
669 |
+
<td>Also data</td>
|
670 |
+
</tr>
|
671 |
+
<tr><th>Row header 8</th>
|
672 |
+
<td>Also data</td>
|
673 |
+
<td>Also data</td>
|
674 |
+
</tr>
|
675 |
+
<tr><th>Row header 9</th>
|
676 |
+
<td>Also data</td>
|
677 |
+
<td>Also data</td>
|
678 |
+
</tr>
|
679 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
680 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
681 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
682 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
683 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
684 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
685 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
686 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
687 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
688 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
689 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
690 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
691 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
692 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
693 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
694 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
695 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
696 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
697 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
698 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
699 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
700 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
701 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
702 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
703 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
704 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
705 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
706 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
707 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
708 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
709 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
710 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
711 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
712 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
713 |
+
<tr><th>Another Row header</th><td>Also data</td><td>Also data</td></tr>
|
714 |
+
</tbody></table>
|
715 |
+
<p> </p>
|
716 |
+
|
717 |
+
<h3>Autosizing Tables</h3>
|
718 |
+
<p>Periodic Table of elements. Tables are set by default to reduce font size if complete words will not fit inside each cell, to a maximum of 1/1.4 * the set font-size. This value can be changed by setting $mpdf->shrink_tables_to_fit=1.8 or using html attribute <table autosize="1.8">.</p>
|
719 |
+
|
720 |
+
<h5>Periodic Table</h5>
|
721 |
+
|
722 |
+
<table style="border:1px solid #000000;" cellPadding="9"><thead>
|
723 |
+
<tr><th>1A</th><th>2A</th><th>3B</th><th>4B</th><th>5B</th><th>6B</th><th>7B</th><th>8B</th><th>8B</th><th>8B</th><th>1B</th><th>2B</th><th>3A</th><th>4A</th><th>5A</th><th>6A</th><th>7A</th><th>8A</th></tr></thead><tbody>
|
724 |
+
<tr>
|
725 |
+
<td colspan="18"></td>
|
726 |
+
</tr>
|
727 |
+
<tr>
|
728 |
+
<td>H </td>
|
729 |
+
<td colspan="16"></td>
|
730 |
+
<td>He </td>
|
731 |
+
</tr>
|
732 |
+
<tr>
|
733 |
+
<td>Li </td>
|
734 |
+
<td>Be </td>
|
735 |
+
<td colspan="10"></td>
|
736 |
+
<td>B </td>
|
737 |
+
<td>C </td>
|
738 |
+
<td>N </td>
|
739 |
+
<td>O </td>
|
740 |
+
<td>F </td>
|
741 |
+
<td>Ne </td>
|
742 |
+
</tr>
|
743 |
+
<tr>
|
744 |
+
<td>Na </td>
|
745 |
+
<td>Mg </td>
|
746 |
+
<td colspan="10"></td>
|
747 |
+
<td>Al </td>
|
748 |
+
<td>Si </td>
|
749 |
+
<td>P </td>
|
750 |
+
<td>S </td>
|
751 |
+
<td>Cl </td>
|
752 |
+
<td>Ar </td>
|
753 |
+
</tr>
|
754 |
+
<tr>
|
755 |
+
<td>K </td>
|
756 |
+
<td>Ca </td>
|
757 |
+
<td>Sc </td>
|
758 |
+
<td>Ti </td>
|
759 |
+
<td>V </td>
|
760 |
+
<td>Cr </td>
|
761 |
+
<td>Mn </td>
|
762 |
+
<td>Fe </td>
|
763 |
+
<td>Co </td>
|
764 |
+
<td>Ni </td>
|
765 |
+
<td>Cu </td>
|
766 |
+
<td>Zn </td>
|
767 |
+
<td>Ga </td>
|
768 |
+
<td>Ge </td>
|
769 |
+
<td>As </td>
|
770 |
+
<td>Se </td>
|
771 |
+
<td>Br </td>
|
772 |
+
<td>Kr </td>
|
773 |
+
</tr>
|
774 |
+
<tr>
|
775 |
+
<td>Rb </td>
|
776 |
+
<td>Sr </td>
|
777 |
+
<td>Y </td>
|
778 |
+
<td>Zr </td>
|
779 |
+
<td>Nb </td>
|
780 |
+
<td>Mo </td>
|
781 |
+
<td>Tc </td>
|
782 |
+
<td>Ru </td>
|
783 |
+
<td>Rh </td>
|
784 |
+
<td>Pd </td>
|
785 |
+
<td>Ag </td>
|
786 |
+
<td>Cd </td>
|
787 |
+
<td>In </td>
|
788 |
+
<td>Sn </td>
|
789 |
+
<td>Sb </td>
|
790 |
+
<td>Te </td>
|
791 |
+
<td>I </td>
|
792 |
+
<td>Xe </td>
|
793 |
+
</tr>
|
794 |
+
<tr>
|
795 |
+
<td>Cs </td>
|
796 |
+
<td>Ba </td>
|
797 |
+
<td>La </td>
|
798 |
+
<td>Hf </td>
|
799 |
+
<td>Ta </td>
|
800 |
+
<td>W </td>
|
801 |
+
<td>Re </td>
|
802 |
+
<td>Os </td>
|
803 |
+
<td>Ir </td>
|
804 |
+
<td>Pt </td>
|
805 |
+
<td>Au </td>
|
806 |
+
<td>Hg </td>
|
807 |
+
<td>Tl </td>
|
808 |
+
<td>Pb </td>
|
809 |
+
<td>Bi </td>
|
810 |
+
<td>Po </td>
|
811 |
+
<td>At </td>
|
812 |
+
<td>Rn </td>
|
813 |
+
</tr>
|
814 |
+
<tr>
|
815 |
+
<td>Fr </td>
|
816 |
+
<td>Ra </td>
|
817 |
+
<td>Ac </td>
|
818 |
+
<td colspan="15"></td>
|
819 |
+
</tr>
|
820 |
+
<tr>
|
821 |
+
<td colspan="18"></td>
|
822 |
+
</tr>
|
823 |
+
<tr>
|
824 |
+
<td colspan="3"></td>
|
825 |
+
<td>Ce </td>
|
826 |
+
<td>Pr </td>
|
827 |
+
<td>Nd </td>
|
828 |
+
<td>Pm </td>
|
829 |
+
<td>Sm </td>
|
830 |
+
<td>Eu </td>
|
831 |
+
<td>Gd </td>
|
832 |
+
<td>Tb </td>
|
833 |
+
<td>Dy </td>
|
834 |
+
<td>Ho </td>
|
835 |
+
<td>Er </td>
|
836 |
+
<td>Tm </td>
|
837 |
+
<td>Yb </td>
|
838 |
+
<td>Lu </td>
|
839 |
+
<td></td>
|
840 |
+
</tr>
|
841 |
+
<tr>
|
842 |
+
<td colspan="3"></td>
|
843 |
+
<td>Th </td>
|
844 |
+
<td>Pa </td>
|
845 |
+
<td>U </td>
|
846 |
+
<td>Np </td>
|
847 |
+
<td>Pu </td>
|
848 |
+
<td>Am </td>
|
849 |
+
<td>Cm </td>
|
850 |
+
<td>Bk </td>
|
851 |
+
<td>Cf </td>
|
852 |
+
<td>Es </td>
|
853 |
+
<td>Fm </td>
|
854 |
+
<td>Md </td>
|
855 |
+
<td>No </td>
|
856 |
+
<td>Lr </td>
|
857 |
+
<td></td>
|
858 |
+
</tr>
|
859 |
+
</tbody></table>
|
860 |
+
|
861 |
+
<pagebreak />
|
862 |
+
|
863 |
+
<h3>Rotating Tables</h3>
|
864 |
+
<p>This is set to rotate -90 degrees (counterclockwise).</p>
|
865 |
+
|
866 |
+
<h5>Periodic Table</h5>
|
867 |
+
<p>
|
868 |
+
<table rotate="-90" class="bpmClearC"><thead>
|
869 |
+
<tr><th>1A</th><th>2A</th><th>3B</th><th>4B</th><th>5B</th><th>6B</th><th>7B</th><th>8B</th><th>8B</th><th>8B</th><th>1B</th><th>2B</th><th>3A</th><th>4A</th><th>5A</th><th>6A</th><th>7A</th><th>8A</th></tr></thead><tbody>
|
870 |
+
<tr>
|
871 |
+
<td></td>
|
872 |
+
<td colspan="18"></td>
|
873 |
+
</tr>
|
874 |
+
<tr>
|
875 |
+
<td>H </td>
|
876 |
+
<td colspan="15"></td>
|
877 |
+
<td></td>
|
878 |
+
<td>He </td>
|
879 |
+
</tr>
|
880 |
+
<tr>
|
881 |
+
<td>Li </td>
|
882 |
+
<td>Be </td>
|
883 |
+
<td colspan="10"></td>
|
884 |
+
<td>B </td>
|
885 |
+
<td>C </td>
|
886 |
+
<td>N </td>
|
887 |
+
<td>O </td>
|
888 |
+
<td>F </td>
|
889 |
+
<td>Ne </td>
|
890 |
+
</tr>
|
891 |
+
<tr>
|
892 |
+
<td>Na </td>
|
893 |
+
<td>Mg </td>
|
894 |
+
<td colspan="10"></td>
|
895 |
+
<td>Al </td>
|
896 |
+
<td>Si </td>
|
897 |
+
<td>P </td>
|
898 |
+
<td>S </td>
|
899 |
+
<td>Cl </td>
|
900 |
+
<td>Ar </td>
|
901 |
+
</tr>
|
902 |
+
<tr>
|
903 |
+
<td>K </td>
|
904 |
+
<td>Ca </td>
|
905 |
+
<td>Sc </td>
|
906 |
+
<td>Ti </td>
|
907 |
+
<td>V </td>
|
908 |
+
<td>Cr </td>
|
909 |
+
<td>Mn </td>
|
910 |
+
<td>Fe </td>
|
911 |
+
<td>Co </td>
|
912 |
+
<td>Ni </td>
|
913 |
+
<td>Cu </td>
|
914 |
+
<td>Zn </td>
|
915 |
+
<td>Ga </td>
|
916 |
+
<td>Ge </td>
|
917 |
+
<td>As </td>
|
918 |
+
<td>Se </td>
|
919 |
+
<td>Br </td>
|
920 |
+
<td>Kr </td>
|
921 |
+
</tr>
|
922 |
+
<tr>
|
923 |
+
<td>Rb </td>
|
924 |
+
<td>Sr </td>
|
925 |
+
<td>Y </td>
|
926 |
+
<td>Zr </td>
|
927 |
+
<td>Nb </td>
|
928 |
+
<td>Mo </td>
|
929 |
+
<td>Tc </td>
|
930 |
+
<td>Ru </td>
|
931 |
+
<td>Rh </td>
|
932 |
+
<td>Pd </td>
|
933 |
+
<td>Ag </td>
|
934 |
+
<td>Cd </td>
|
935 |
+
<td>In </td>
|
936 |
+
<td>Sn </td>
|
937 |
+
<td>Sb </td>
|
938 |
+
<td>Te </td>
|
939 |
+
<td>I </td>
|
940 |
+
<td>Xe </td>
|
941 |
+
</tr>
|
942 |
+
<tr>
|
943 |
+
<td>Cs </td>
|
944 |
+
<td>Ba </td>
|
945 |
+
<td>La </td>
|
946 |
+
<td>Hf </td>
|
947 |
+
<td>Ta </td>
|
948 |
+
<td>W </td>
|
949 |
+
<td>Re </td>
|
950 |
+
<td>Os </td>
|
951 |
+
<td>Ir </td>
|
952 |
+
<td>Pt </td>
|
953 |
+
<td>Au </td>
|
954 |
+
<td>Hg </td>
|
955 |
+
<td>Tl </td>
|
956 |
+
<td>Pb </td>
|
957 |
+
<td>Bi </td>
|
958 |
+
<td>Po </td>
|
959 |
+
<td>At </td>
|
960 |
+
<td>Rn </td>
|
961 |
+
</tr>
|
962 |
+
<tr>
|
963 |
+
<td>Fr </td>
|
964 |
+
<td>Ra </td>
|
965 |
+
<td>Ac </td>
|
966 |
+
</tr>
|
967 |
+
<tr>
|
968 |
+
<td></td>
|
969 |
+
<td colspan="18"></td>
|
970 |
+
</tr>
|
971 |
+
<tr>
|
972 |
+
<td colspan="3"></td>
|
973 |
+
<td>Ce </td>
|
974 |
+
<td>Pr </td>
|
975 |
+
<td>Nd </td>
|
976 |
+
<td>Pm </td>
|
977 |
+
<td>Sm </td>
|
978 |
+
<td>Eu </td>
|
979 |
+
<td>Gd </td>
|
980 |
+
<td>Tb </td>
|
981 |
+
<td>Dy </td>
|
982 |
+
<td>Ho </td>
|
983 |
+
<td>Er </td>
|
984 |
+
<td>Tm </td>
|
985 |
+
<td>Yb </td>
|
986 |
+
<td>Lu </td>
|
987 |
+
<td></td>
|
988 |
+
</tr>
|
989 |
+
<tr>
|
990 |
+
<td colspan="3"></td>
|
991 |
+
<td>Th </td>
|
992 |
+
<td>Pa </td>
|
993 |
+
<td>U </td>
|
994 |
+
<td>Np </td>
|
995 |
+
<td>Pu </td>
|
996 |
+
<td>Am </td>
|
997 |
+
<td>Cm </td>
|
998 |
+
<td>Bk </td>
|
999 |
+
<td>Cf </td>
|
1000 |
+
<td>Es </td>
|
1001 |
+
<td>Fm </td>
|
1002 |
+
<td>Md </td>
|
1003 |
+
<td>No </td>
|
1004 |
+
<td>Lr </td>
|
1005 |
+
<td></td>
|
1006 |
+
</tr>
|
1007 |
+
</tbody></table>
|
1008 |
+
<p> </p>
|
1009 |
+
|
1010 |
+
<pagebreak />
|
1011 |
+
<h3>Rotated text in Table Cells</h3>
|
1012 |
+
|
1013 |
+
<h5>Periodic Table</h5>
|
1014 |
+
<table>
|
1015 |
+
<thead>
|
1016 |
+
<tr text-rotate="45">
|
1017 |
+
<th><p>Element type 1A</p><p>Second line</p><th><p>Element type longer 2A</p></th>
|
1018 |
+
<th>Element type 3B</th>
|
1019 |
+
<th>Element type 4B</th>
|
1020 |
+
<th>Element type 5B</th>
|
1021 |
+
<th>Element type 6B</th>
|
1022 |
+
<th>7B</th><th>8B</th>
|
1023 |
+
<th>Element type 8B R</th>
|
1024 |
+
<th>8B</th>
|
1025 |
+
<th>Element <span>type</span> 1B</th>
|
1026 |
+
<th>2B</th>
|
1027 |
+
<th>Element type 3A</th>
|
1028 |
+
<th>Element type 4A</th>
|
1029 |
+
<th>Element type 5A</th>
|
1030 |
+
<th>Element type 6A</th>
|
1031 |
+
<th>7A</th>
|
1032 |
+
<th>Element type 8A</th>
|
1033 |
+
</tr>
|
1034 |
+
</thead>
|
1035 |
+
|
1036 |
+
<tbody>
|
1037 |
+
<tr>
|
1038 |
+
<td>H</td>
|
1039 |
+
<td colspan="15"></td>
|
1040 |
+
<td></td>
|
1041 |
+
<td>He </td>
|
1042 |
+
</tr>
|
1043 |
+
<tr>
|
1044 |
+
<td>Li </td>
|
1045 |
+
<td>Be </td>
|
1046 |
+
<td colspan="10"></td>
|
1047 |
+
<td>B </td>
|
1048 |
+
<td>C </td>
|
1049 |
+
<td>N </td>
|
1050 |
+
<td>O </td>
|
1051 |
+
<td>F </td>
|
1052 |
+
<td>Ne </td>
|
1053 |
+
</tr>
|
1054 |
+
<tr>
|
1055 |
+
<td>Na </td>
|
1056 |
+
<td>Mg </td>
|
1057 |
+
<td colspan="10"></td>
|
1058 |
+
<td>Al </td>
|
1059 |
+
<td>Si </td>
|
1060 |
+
<td>P </td>
|
1061 |
+
<td>S </td>
|
1062 |
+
<td>Cl </td>
|
1063 |
+
<td>Ar </td>
|
1064 |
+
</tr>
|
1065 |
+
<tr style="text-rotate: 45">
|
1066 |
+
<td>K </td>
|
1067 |
+
<td>Ca </td>
|
1068 |
+
<td>Sc </td>
|
1069 |
+
<td>Ti</td>
|
1070 |
+
<td>Va</td>
|
1071 |
+
<td>Cr</td>
|
1072 |
+
<td>Mn</td>
|
1073 |
+
<td>Fe</td>
|
1074 |
+
<td>Co</td>
|
1075 |
+
<td>Ni </td>
|
1076 |
+
<td>Cu </td>
|
1077 |
+
<td>Zn </td>
|
1078 |
+
<td>Ga </td>
|
1079 |
+
<td>Ge </td>
|
1080 |
+
<td>As </td>
|
1081 |
+
<td>Se </td>
|
1082 |
+
<td>Br </td>
|
1083 |
+
<td>Kr </td>
|
1084 |
+
</tr>
|
1085 |
+
<tr>
|
1086 |
+
<td>Rb </td>
|
1087 |
+
<td>Sr </td>
|
1088 |
+
<td>Y </td>
|
1089 |
+
<td>Zr </td>
|
1090 |
+
<td>Nb </td>
|
1091 |
+
<td>Mo </td>
|
1092 |
+
<td>Tc </td>
|
1093 |
+
<td>Ru </td>
|
1094 |
+
<td style="text-align:right; ">Rh</td>
|
1095 |
+
<td>Pd </td>
|
1096 |
+
<td>Ag </td>
|
1097 |
+
<td>Cd </td>
|
1098 |
+
<td>In </td>
|
1099 |
+
<td>Sn </td>
|
1100 |
+
<td>Sb </td>
|
1101 |
+
<td>Te </td>
|
1102 |
+
<td>I </td>
|
1103 |
+
<td>Xe </td>
|
1104 |
+
</tr>
|
1105 |
+
<tr>
|
1106 |
+
<td>Cs </td>
|
1107 |
+
<td>Ba </td>
|
1108 |
+
<td>La </td>
|
1109 |
+
<td>Hf </td>
|
1110 |
+
<td>Ta </td>
|
1111 |
+
<td>W </td>
|
1112 |
+
<td>Re </td>
|
1113 |
+
<td>Os </td>
|
1114 |
+
<td>Ir </td>
|
1115 |
+
<td>Pt </td>
|
1116 |
+
<td>Au </td>
|
1117 |
+
<td>Hg </td>
|
1118 |
+
<td>Tl </td>
|
1119 |
+
<td>Pb </td>
|
1120 |
+
<td>Bi </td>
|
1121 |
+
<td>Po </td>
|
1122 |
+
<td>At </td>
|
1123 |
+
<td>Rn </td>
|
1124 |
+
</tr>
|
1125 |
+
<tr>
|
1126 |
+
<td>Fr </td>
|
1127 |
+
<td>Ra </td>
|
1128 |
+
<td colspan="16">Ac </td>
|
1129 |
+
</tr>
|
1130 |
+
<tr>
|
1131 |
+
<td colspan="3"></td>
|
1132 |
+
<td>Ce </td>
|
1133 |
+
<td>Pr </td>
|
1134 |
+
<td>Nd </td>
|
1135 |
+
<td>Pm </td>
|
1136 |
+
<td>Sm </td>
|
1137 |
+
<td>Eu </td>
|
1138 |
+
<td>Gd </td>
|
1139 |
+
<td>Tb </td>
|
1140 |
+
<td>Dy </td>
|
1141 |
+
<td>Ho </td>
|
1142 |
+
<td>Er </td>
|
1143 |
+
<td>Tm </td>
|
1144 |
+
<td>Yb </td>
|
1145 |
+
<td>Lu </td>
|
1146 |
+
<td></td>
|
1147 |
+
</tr>
|
1148 |
+
<tr>
|
1149 |
+
<td colspan="3"></td>
|
1150 |
+
<td>Th </td>
|
1151 |
+
<td>Pa </td>
|
1152 |
+
<td>U </td>
|
1153 |
+
<td>Np </td>
|
1154 |
+
<td>Pu </td>
|
1155 |
+
<td>Am </td>
|
1156 |
+
<td>Cm </td>
|
1157 |
+
<td>Bk </td>
|
1158 |
+
<td>Cf </td>
|
1159 |
+
<td>Es </td>
|
1160 |
+
<td>Fm </td>
|
1161 |
+
<td>Md </td>
|
1162 |
+
<td>No </td>
|
1163 |
+
<td>Lr </td>
|
1164 |
+
<td></td>
|
1165 |
+
</tr>
|
1166 |
+
</tbody></table>
|
1167 |
+
<p> </p>
|
1168 |
+
|
1169 |
+
|
1170 |
+
<?php
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
?>
|
1174 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1175 |
</html>
|
templates/example-template.php
CHANGED
@@ -1,145 +1,104 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
<p class="whom_concern_intro">Dear User,</p>
|
105 |
-
|
106 |
-
<p class="body_text"> Gravity Forms PDF Extended allows you to directly access Gravity Form field data so you can create custom PDFs like this one. You'll need to copy the <em>example-template.php</em> file now located in your active theme's PDF_EXTENDED_TEMPLATES/ folder (as of version 2.0.0). There's a <strong>print_r()</strong> statement on line 84 you can uncomment that will help you access the $form_data array when customising the PDF template.</p>
|
107 |
-
|
108 |
-
<p>To create a PDF with the new template file you'll need to change the <em>PDF_Generator</em> call in your <em>gform_pdf_create()</em> function, which should be inside your theme's functions.php file.</p>
|
109 |
-
|
110 |
-
<p><strong>$filename = PDF_Generator($form_id, $user_id, 'save', true, 'your-new-template.php');</strong></p>
|
111 |
-
|
112 |
-
<p>When testing your new template file you can use the <em>View PDF</em> button on an entry in the admin area and tack <strong>&template=your-new-template.php</strong> onto the end of the url.</p>
|
113 |
-
|
114 |
-
<p><strong>Example:</strong> http://www.yourdomain.com/?gf_pdf=print-entry&fid=5&lid=142&notes=1&template=example-template.php</p>
|
115 |
-
|
116 |
-
<p><strong>Because the template folder has now moved into your active theme's directory your custom templates will no longer be deleted when you upgrade the plugin.</strong></p>
|
117 |
-
|
118 |
-
<p>For more information about custom templates <a href="http://gravityformspdfextended.com/documentation/2.0.0/10/custom-templates/">review the plugin's documentation</a></p>
|
119 |
-
<h3>Custom PDF Name</h3>
|
120 |
-
<p>As of version 2.0.0 you can easily create PDFs using a custom name instead of the default <em>form-fid-entry-lid.pdf</em> value. For more information <a href="http://gravityformspdfextended.com/documentation/2.0.0/11/pdf-naming/">review the plugin documentation</a>.</p>
|
121 |
-
|
122 |
-
|
123 |
-
<br /><br />
|
124 |
-
|
125 |
-
<p class="signature">
|
126 |
-
Jake Jackson<br />
|
127 |
-
<img src="<?php echo home_url(); ?>/wp-content/plugins/gravity-forms-pdf-extended/images/signature.png" alt="Signature" width="100" height="60" /><br />
|
128 |
-
Developer, Gravity Forms PDF Extended<br />
|
129 |
-
<a href="http://www.gravityformspdfextended.com">www.gravityformspdfextended.com</a>
|
130 |
-
</p>
|
131 |
-
|
132 |
-
</div>
|
133 |
-
|
134 |
-
<?php
|
135 |
-
|
136 |
-
|
137 |
-
?>
|
138 |
-
|
139 |
-
|
140 |
-
<?php
|
141 |
-
}
|
142 |
-
|
143 |
-
?>
|
144 |
-
</body>
|
145 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF
|
5 |
+
* We no longer need to access the file directly.
|
6 |
+
*/
|
7 |
+
if(!class_exists('RGForms') ) {
|
8 |
+
/* Accessed directly */
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
14 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
15 |
+
*/
|
16 |
+
PDF_Common::setup_ids();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file.
|
20 |
+
*/
|
21 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
22 |
+
$stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF_TEMPLATE_URL_LOCATION.'template.css' : PDF_PLUGIN_URL .'styles/template.css' ;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
27 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
29 |
+
<head>
|
30 |
+
|
31 |
+
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?>' type='text/css' />
|
32 |
+
<title>Gravity Forms PDF Extended</title>
|
33 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
34 |
+
</head>
|
35 |
+
<body>
|
36 |
+
<?php
|
37 |
+
|
38 |
+
foreach($lead_ids as $lead_id) {
|
39 |
+
|
40 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
41 |
+
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
42 |
+
/*
|
43 |
+
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
44 |
+
*/
|
45 |
+
PDF_Common::view_data($form_data);
|
46 |
+
|
47 |
+
/* get all the form values */
|
48 |
+
/*$date_created = $form_data['date_created'];
|
49 |
+
|
50 |
+
$first_name = $form_data['1.Name']['first'];
|
51 |
+
$last_name = $form_data['1.Name']['last'];
|
52 |
+
|
53 |
+
$address_street = $form_data['2.Address']['street'];
|
54 |
+
$address_city = $form_data['2.Address']['city'];
|
55 |
+
$address_state = $form_data['2.Address']['state'];
|
56 |
+
$address_zip = $form_data['2.Address']['zip'];
|
57 |
+
$address_country = $form_data['2.Address']['country'];
|
58 |
+
|
59 |
+
$phone = $form_data['3.Phone'];*/
|
60 |
+
|
61 |
+
/* format the template */
|
62 |
+
?>
|
63 |
+
|
64 |
+
<img src="<?php echo PDF_PLUGIN_DIR ?>images/gravityformspdfextended.jpg" width="311" height="110" />
|
65 |
+
|
66 |
+
|
67 |
+
<div class="body_copy">
|
68 |
+
|
69 |
+
<p class="date"><?php echo $date_created; ?></p>
|
70 |
+
|
71 |
+
<p class="client_address">
|
72 |
+
<?php if(strlen($first_name) > 0) { ?>
|
73 |
+
<?php echo $first_name .' '. $last_name; ?><br />
|
74 |
+
<?php } ?>
|
75 |
+
<?php if(strlen($address_street) > 0) { ?>
|
76 |
+
<?php echo $address_street; ?><br />
|
77 |
+
<?php echo $address_city .', '. $address_state .' '. $address_zip; ?><br />
|
78 |
+
<?php echo $address_country; ?>
|
79 |
+
<?php } ?>
|
80 |
+
</p>
|
81 |
+
|
82 |
+
<p class="whom_concern_intro">Dear User,</p>
|
83 |
+
|
84 |
+
<p>Anything you put here will output to the PDF</p>
|
85 |
+
|
86 |
+
|
87 |
+
<br /><br />
|
88 |
+
|
89 |
+
<p class="signature">
|
90 |
+
Jake Jackson<br />
|
91 |
+
<img src="<?php echo PDF_PLUGIN_DIR ?>/images/signature.png" alt="Signature" width="100" height="60" /><br />
|
92 |
+
Developer, Gravity Forms PDF Extended<br />
|
93 |
+
<a href="http://www.gravityformspdfextended.com">www.gravityformspdfextended.com</a>
|
94 |
+
</p>
|
95 |
+
|
96 |
+
</div>
|
97 |
+
|
98 |
+
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
|
102 |
+
?>
|
103 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</html>
|