Version Description
- Feature - Can now view multiple PDFs assigned to a single form via the admin area. Note: You must provide a unique 'filename' parameter in configuration.php for multiple PDFs assigned to a single form.
- Feature - You can exclude a field from the default templates using the class name 'exclude'. See our FAQ topic for more details.
- Bug - Fixed issue viewing own PDF entry when logged in as anything lower than editor.
- Bug - Fixed data return bug in pdf-entry-details.php that was preventing all data returning correctly.
- Bug - Fixed PHP Warning when using products with no options
- Bug - Fixed issue with invalid characters being added to the PDF filename. Most notably the date mergetag.
- Bug - Limit filename length to 150 characters which should work on the majority of web servers.
- Bug - Fixed problem sending duplicate PDF when using mass resend notification feature
- Depreciated - Removed GF_FORM_ID and GF_LEAD_ID constants which were used in v2.x.x of the software. Ensure you follow v2.x.x upgrade guide to your templates before upgrading.
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 3.2.0 |
Comparing to | |
See all releases |
Code changes from version 3.1.4 to 3.2.0
- README.txt +19 -7
- images/_notes/dwsync.xml +58 -0
- installation-update-manager.php +2 -2
- javascript/_notes/dwsync.xml +4 -0
- javascript/entries-admin.js +10 -0
- mPDF.zip +0 -0
- pdf-common.php +39 -18
- pdf-configuration-indexer.php +20 -15
- pdf-entry-detail.php +20 -8
- pdf-render.php +2 -3
- pdf-settings.php +24 -35
- pdf.php +161 -160
- styles/_notes/dwsync.xml +7 -0
- styles/admin-styles.css +60 -34
- styles/template.css +167 -167
- templates/_notes/dwsync.xml +19 -0
- templates/default-template-no-style.php +76 -53
- templates/default-template-two-rows.php +78 -54
- templates/default-template.php +74 -51
- templates/example-advanced-headers_07.php +27 -5
- templates/example-backgrounds-and-borders02.php +27 -5
- templates/example-basic-html01.php +27 -5
- templates/example-different-page-size_08.php +27 -5
- templates/example-float-and-positioning05.php +27 -5
- templates/example-header-and-footer_06.php +27 -5
- templates/example-images03.php +27 -5
- templates/example-tables04.php +27 -5
- templates/example-template.php +51 -10
README.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: blueliquiddesigns
|
3 |
Donate link: http://www.gravityformspdfextended.com
|
4 |
Tags: gravity, forms, pdf, automation, attachment
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -52,8 +52,8 @@ Along with the above features, the new PDF features include:
|
|
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.
|
56 |
-
3. Gravity Forms 1.
|
57 |
|
58 |
**Documentation and Support**
|
59 |
|
@@ -78,6 +78,17 @@ All FAQs can be [viewed on the Gravity Forms PDF Extended website](http://gravit
|
|
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.
|
@@ -239,5 +250,6 @@ For more details [view the 3.x.x online documentation](http://gravityformspdfext
|
|
239 |
|
240 |
== Upgrade Notice ==
|
241 |
|
242 |
-
= 3.
|
243 |
-
|
|
2 |
Contributors: blueliquiddesigns
|
3 |
Donate link: http://www.gravityformspdfextended.com
|
4 |
Tags: gravity, forms, pdf, automation, attachment
|
5 |
+
Requires at least: 3.5
|
6 |
+
Tested up to: 3.6
|
7 |
+
Stable tag: 3.2.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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.5+
|
56 |
+
3. Gravity Forms 1.7+
|
57 |
|
58 |
**Documentation and Support**
|
59 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 3.2.0 =
|
82 |
+
* Feature - Can now view multiple PDFs assigned to a single form via the admin area. Note: You must provide a unique 'filename' parameter in configuration.php for multiple PDFs assigned to a single form.
|
83 |
+
* Feature - You can exclude a field from the default templates using the class name 'exclude'. See our [FAQ topic](http://gravityformspdfextended.com/faq/can-exclude-field-showing-pdf/) for more details.
|
84 |
+
* Bug - Fixed issue viewing own PDF entry when logged in as anything lower than editor.
|
85 |
+
* Bug - Fixed data return bug in pdf-entry-details.php that was preventing all data returning correctly.
|
86 |
+
* Bug - Fixed PHP Warning when using products with no options
|
87 |
+
* Bug - Fixed issue with invalid characters being added to the PDF filename. Most notably the date mergetag.
|
88 |
+
* Bug - Limit filename length to 150 characters which should work on the majority of web servers.
|
89 |
+
* Bug - Fixed problem sending duplicate PDF when using mass resend notification feature
|
90 |
+
* Depreciated - Removed GF_FORM_ID and GF_LEAD_ID constants which were used in v2.x.x of the software. Ensure you follow [v2.x.x upgrade guide](http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/) to your templates before upgrading.
|
91 |
+
|
92 |
= 3.1.4 =
|
93 |
* Bug - Fixed issue with plugin breaking website's when the Gravity Forms plugin wasn't activated.
|
94 |
* Housekeeping - The plugin now only supports Gravity Forms 1.7 or higher and Wordpress 3.5 or higher.
|
250 |
|
251 |
== Upgrade Notice ==
|
252 |
|
253 |
+
= 3.3.0 =
|
254 |
+
|
255 |
+
Now support multiple PDF templates in admin area, plus a number of bug fixes. Gravity Forms PDF Extended only supports Gravity Forms 1.7.x+ and Wordpress 3.5+. V2.x.x PDF templates are no longer supported; [see upgrade guide for details](http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/).
|
images/_notes/dwsync.xml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="gravityformspdfextended.jpg" server="blueliquiddesigns.com.au" local="130050839400000000" remote="130050839400000000" />
|
4 |
+
<file name="signature.png" server="blueliquiddesigns.com.au" local="130050839400000000" remote="130050839400000000" />
|
5 |
+
<file name="alpha3.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
6 |
+
<file name="alpha.gif" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
7 |
+
<file name="alpha.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
8 |
+
<file name="bayeux1.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
9 |
+
<file name="bgbarcode.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
10 |
+
<file name="bg.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
11 |
+
<file name="bgrock.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
12 |
+
<file name="borders2FF.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
13 |
+
<file name="borders2IE.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
14 |
+
<file name="borders3FF.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
15 |
+
<file name="borders3IE.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
16 |
+
<file name="borders4FF.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
17 |
+
<file name="borders4IE.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
18 |
+
<file name="bordersFF.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
19 |
+
<file name="bordersIE.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
20 |
+
<file name="bordersMPDF2.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
21 |
+
<file name="clematis.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
22 |
+
<file name="firefox-48.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
23 |
+
<file name="flowers-pattern.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
24 |
+
<file name="goto.gif" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
25 |
+
<file name="gravityformspdfextended.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
26 |
+
<file name="img1.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
27 |
+
<file name="img2.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
28 |
+
<file name="img3.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
29 |
+
<file name="img4.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
30 |
+
<file name="img5.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
31 |
+
<file name="klematis.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
32 |
+
<file name="loading.gif" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
33 |
+
<file name="mpdfstyleA4.css" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
34 |
+
<file name="mpdfstylePaged.css" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
35 |
+
<file name="mpdfstyletables.css" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
36 |
+
<file name="quran282.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
37 |
+
<file name="signature.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
38 |
+
<file name="sunset.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
39 |
+
<file name="sunsetv.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
40 |
+
<file name="tiger24trns.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
41 |
+
<file name="tiger2.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
42 |
+
<file name="tiger2.wmf" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
43 |
+
<file name="tiger300px300dpi.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
44 |
+
<file name="tiger300px300dpi.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
45 |
+
<file name="tiger300px72dpi.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
46 |
+
<file name="tiger300px96dpi.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
47 |
+
<file name="tiger300px96dpi.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
48 |
+
<file name="tiger8trns.gif" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
49 |
+
<file name="tiger8trns.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
50 |
+
<file name="tiger.bmp" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
51 |
+
<file name="tigercmyk.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
52 |
+
<file name="tiger.gif" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
53 |
+
<file name="tiger.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
54 |
+
<file name="tiger.png" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
55 |
+
<file name="tiger.svg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
56 |
+
<file name="tiger.wmf" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
57 |
+
<file name="windmill.jpg" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
58 |
+
</dwsync>
|
installation-update-manager.php
CHANGED
@@ -313,7 +313,7 @@ class GFPDF_InstallUpdater
|
|
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 |
|
@@ -409,7 +409,7 @@ class GFPDF_InstallUpdater
|
|
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 |
}
|
313 |
public function gf_pdf_not_installed()
|
314 |
{
|
315 |
echo '<div id="message" class="error"><p>';
|
316 |
+
echo 'You need to install/update <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 |
|
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 |
}
|
javascript/_notes/dwsync.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="entries-admin.js" server="54.252.94.54" local="130232460567311373" remote="130243474200000000" />
|
4 |
+
</dwsync>
|
javascript/entries-admin.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
$('.gf_form_action_has_submenu').hover(function(){
|
3 |
+
var l = jQuery(this).offset().left;
|
4 |
+
jQuery(this).find('.gf_submenu')
|
5 |
+
.toggle()
|
6 |
+
.offset({ left: l });
|
7 |
+
}, function(){
|
8 |
+
jQuery(this).find('.gf_submenu').hide();
|
9 |
+
});
|
10 |
+
});
|
mPDF.zip
CHANGED
Binary file
|
pdf-common.php
CHANGED
@@ -6,16 +6,8 @@ class PDF_Common
|
|
6 |
{
|
7 |
global $form_id, $lead_id, $lead_ids;
|
8 |
|
9 |
-
|
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
|
@@ -119,27 +111,56 @@ class PDF_Common
|
|
119 |
|
120 |
public static function validate_pdf_name($name, $form_id = false, $lead_id = false)
|
121 |
{
|
122 |
-
|
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($
|
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 |
}
|
6 |
{
|
7 |
global $form_id, $lead_id, $lead_ids;
|
8 |
|
9 |
+
$form_id = ($form_id) ? $form_id : absint( rgget("fid") );
|
10 |
+
$lead_ids = ($lead_id) ? array($lead_id) : explode(',', rgget("lid"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
/**
|
13 |
* If form ID and lead ID hasn't been set stop the PDF from attempting to generate
|
111 |
|
112 |
public static function validate_pdf_name($name, $form_id = false, $lead_id = false)
|
113 |
{
|
114 |
+
$pdf_name = $name;
|
|
|
|
|
|
|
|
|
115 |
|
116 |
if($form_id > 0)
|
117 |
{
|
118 |
+
$pdf_name = PDF_Common::do_mergetags($pdf_name, $form_id, $lead_id);
|
119 |
}
|
120 |
|
121 |
+
/*
|
122 |
+
* Limit the size of the filename to 100 characters
|
123 |
+
*/
|
124 |
+
if(strlen($pdf_name) > 150)
|
125 |
+
{
|
126 |
+
$pdf_name = substr($pdf_name, 0, 150);
|
127 |
+
}
|
128 |
+
|
129 |
+
/*
|
130 |
+
* Remove extension from the end of the filename so we can replace all '.'
|
131 |
+
* Will add back before we are finished
|
132 |
+
*/
|
133 |
+
if(substr($pdf_name, -4) == '.pdf')
|
134 |
+
{
|
135 |
+
$pdf_name = substr($pdf_name, 0, -4);
|
136 |
+
}
|
137 |
+
|
138 |
+
/*
|
139 |
+
* Remove any invalid (mostly Windows) characters from filename
|
140 |
+
*/
|
141 |
+
$pdf_name = str_replace('/', '-', $pdf_name);
|
142 |
+
$pdf_name = str_replace('\\', '-', $pdf_name);
|
143 |
+
$pdf_name = str_replace('"', '-', $pdf_name);
|
144 |
+
$pdf_name = str_replace('*', '-', $pdf_name);
|
145 |
+
$pdf_name = str_replace('?', '-', $pdf_name);
|
146 |
+
$pdf_name = str_replace('|', '-', $pdf_name);
|
147 |
+
$pdf_name = str_replace(':', '-', $pdf_name);
|
148 |
+
$pdf_name = str_replace('<', '-', $pdf_name);
|
149 |
+
$pdf_name = str_replace('>', '-', $pdf_name);
|
150 |
+
$pdf_name = str_replace('.', '_', $pdf_name);
|
151 |
+
|
152 |
+
$pdf_name = $pdf_name . '.pdf';
|
153 |
+
|
154 |
return $pdf_name;
|
155 |
}
|
156 |
|
157 |
public static function do_mergetags($string, $form_id, $lead_id)
|
158 |
+
{
|
159 |
$form = RGFormsModel::get_form_meta($form_id);
|
160 |
$lead = RGFormsModel::get_lead($lead_id);
|
161 |
|
162 |
/* strip {all_fields} merge tag from $string */
|
163 |
+
$string = str_replace('{all_fields}', '', $string);
|
164 |
|
165 |
return trim(GFCommon::replace_variables($string, $form, $lead, false, false, false));
|
166 |
}
|
pdf-configuration-indexer.php
CHANGED
@@ -24,10 +24,6 @@
|
|
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
|
@@ -43,14 +39,6 @@
|
|
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
|
@@ -145,7 +133,7 @@
|
|
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 |
{
|
@@ -164,14 +152,31 @@
|
|
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 |
*/
|
24 |
|
25 |
public $configuration = array();
|
26 |
|
|
|
|
|
|
|
|
|
27 |
/*
|
28 |
* Switch to verify if configuration file exists.
|
29 |
* If not, user is using old functions.php method and we
|
39 |
|
40 |
public function __construct()
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
/*
|
44 |
* Do configuration pre-processing
|
133 |
* Searches the index for the configuration key and once found return the real configuration
|
134 |
* Return: form PDF configuration
|
135 |
*/
|
136 |
+
public function get_config_data($form_id, $return_all = false)
|
137 |
{
|
138 |
if(!isset($this->index[$form_id]))
|
139 |
{
|
152 |
/*
|
153 |
* Search for the template from a given form id
|
154 |
* Return: the first template found for the form
|
|
|
155 |
*/
|
156 |
+
public function get_template($form_id, $return_all = false)
|
157 |
{
|
158 |
$template = '';
|
159 |
|
160 |
if(isset($this->index[$form_id]))
|
161 |
{
|
162 |
+
/*
|
163 |
+
* Currently only show first PDF
|
164 |
+
* A dropdown will be added at a later date
|
165 |
+
*/
|
166 |
+
if($return_all === true && sizeof($this->index[$form_id]) > 1)
|
167 |
+
{
|
168 |
+
|
169 |
+
$templates = array();
|
170 |
+
foreach($this->index[$form_id] as $id)
|
171 |
+
{
|
172 |
+
$templates[$id] = array(
|
173 |
+
'template' => (isset($this->configuration[$id]['template'])) ? $this->configuration[$id]['template'] : FPPDFGenerator::$default['template'],
|
174 |
+
'filename' => $this->configuration[$id]['filename']
|
175 |
+
);
|
176 |
+
}
|
177 |
+
return $templates;
|
178 |
+
}
|
179 |
+
|
180 |
/*
|
181 |
* Check if PDF template is avaliable
|
182 |
*/
|
pdf-entry-detail.php
CHANGED
@@ -29,6 +29,15 @@ if(!class_exists('GFPDFEntryDetail'))
|
|
29 |
$page_number = 0;
|
30 |
foreach($form["fields"] as $field) {
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/*
|
33 |
* Check if we are to show the page names
|
34 |
*/
|
@@ -62,16 +71,15 @@ if(!class_exists('GFPDFEntryDetail'))
|
|
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($
|
68 |
{
|
69 |
-
$results['field'][] = '<h2 class="default entry-view-section-break
|
70 |
}
|
71 |
else
|
72 |
{
|
73 |
?>
|
74 |
-
<h2 class="default entry-view-section-break
|
75 |
<?php
|
76 |
}
|
77 |
}
|
@@ -93,7 +101,7 @@ if(!class_exists('GFPDFEntryDetail'))
|
|
93 |
|
94 |
$display_value = wpautop($field['content']);
|
95 |
|
96 |
-
$content = '<div class="entry-view-
|
97 |
$content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
|
98 |
|
99 |
if($return === true)
|
@@ -324,7 +332,9 @@ if(!class_exists('GFPDFEntryDetail'))
|
|
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"]);
|
@@ -440,12 +450,14 @@ if(!class_exists('GFPDFEntryDetail'))
|
|
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' => $
|
449 |
'quantity' => $product["quantity"],
|
450 |
'subtotal' => $subtotal);
|
451 |
}
|
29 |
$page_number = 0;
|
30 |
foreach($form["fields"] as $field) {
|
31 |
|
32 |
+
/*
|
33 |
+
* Check if this field has been excluded from the list
|
34 |
+
*/
|
35 |
+
if(isset($field['cssClass']) && strpos($field['cssClass'], 'exclude') !== false)
|
36 |
+
{
|
37 |
+
/* skip this field */
|
38 |
+
continue;
|
39 |
+
}
|
40 |
+
|
41 |
/*
|
42 |
* Check if we are to show the page names
|
43 |
*/
|
71 |
|
72 |
if(!GFCommon::is_section_empty($field, $form, $lead) || $allow_display_empty_fields){
|
73 |
$count++;
|
|
|
74 |
|
75 |
+
if($return === true)
|
76 |
{
|
77 |
+
$results['field'][] = '<h2 class="default entry-view-section-break">'. esc_html(GFCommon::get_label($field)) .'</h2>';
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
?>
|
82 |
+
<h2 class="default entry-view-section-break"><?php echo esc_html(GFCommon::get_label($field))?></h2>
|
83 |
<?php
|
84 |
}
|
85 |
}
|
101 |
|
102 |
$display_value = wpautop($field['content']);
|
103 |
|
104 |
+
$content = '<div class="entry-view-html-value' . $last_row . $even . '"><div class="value">' . $display_value . '</div></div>';
|
105 |
$content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
|
106 |
|
107 |
if($return === true)
|
332 |
|
333 |
$form_array['form_title'] = $form['title'];
|
334 |
$form_array['date_created'] = self::format_date($lead['date_created']);
|
335 |
+
$form_array['date_created_usa'] = self::format_date($lead['date_created'], true);
|
336 |
+
|
337 |
+
$form_array['pages'] = $form['pagination']['pages'];
|
338 |
|
339 |
$count = 0;
|
340 |
$field_count = sizeof($form["fields"]);
|
450 |
}
|
451 |
/* calculate subtotal */
|
452 |
$subtotal = floatval($product["quantity"]) * $price;
|
453 |
+
$total += $subtotal;
|
454 |
+
|
455 |
+
$options = isset($product['options']) ? $product['options'] : '';
|
456 |
|
457 |
$form_array['products'][] = array(
|
458 |
'name' => esc_html($product['name']),
|
459 |
'price' => esc_html($product['price']),
|
460 |
+
'options' => $options,
|
461 |
'quantity' => $product["quantity"],
|
462 |
'subtotal' => $subtotal);
|
463 |
}
|
pdf-render.php
CHANGED
@@ -43,7 +43,7 @@ class PDFRender
|
|
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 |
*/
|
@@ -153,8 +153,7 @@ class PDFRender
|
|
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 |
{
|
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 |
*/
|
153 |
/*
|
154 |
* Initialise class and set the paper size and orientation
|
155 |
*/
|
156 |
+
$paper_size = $arguments['pdf_size'];
|
|
|
157 |
|
158 |
if(!is_array($paper_size))
|
159 |
{
|
pdf-settings.php
CHANGED
@@ -110,6 +110,10 @@ class GFPDF_Settings
|
|
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>
|
@@ -138,43 +142,37 @@ class GFPDF_Settings
|
|
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 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
<p> <strong>
|
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>
|
@@ -191,18 +189,9 @@ Along with a new HTML to PDF generator, we’ve rewritten the entire plugin
|
|
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>
|
110 |
{
|
111 |
?>
|
112 |
<h2>Initialise Plugin</h2>
|
113 |
+
|
114 |
+
<div class="updated"><p><strong>Note:</strong> We've depreciated v2.x.x templates in this release. If you are still using a v2.x.x template ensure you follow our <a href="http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/">v3 migration guide</a> before initialising. <strong>This does not apply to fresh installations of the plugin</strong>.</p></div>
|
115 |
+
|
116 |
+
|
117 |
<p>Fresh installations and users who have just upgraded will need to initialise Gravity Forms PDF Extended to ensure it works correctly.</p>
|
118 |
|
119 |
<p>Initialisation does a number of important things, including:</p>
|
142 |
|
143 |
<input type="submit" value="Initialise Fonts Only" class="button" id="font-initialise" name="font-initialise">
|
144 |
</form>
|
145 |
+
<?php } ?>
|
146 |
+
|
147 |
<h2><?php _e('What\'s new in v'.PDF_EXTENDED_VERSION.'?' , "gravityformspdfextended") ?></h2>
|
148 |
<ol>
|
149 |
+
<li><strong>Feature</strong> - Can now view multiple PDFs assigned to a single form via the admin area. Note: You must provide a unique 'filename' parameter in configuration.php for multiple PDFs assigned to a single form. </li>
|
150 |
+
<li><strong>Feature</strong> - You can exclude a field from the default templates using the class name 'exclude'. See our <a href="http://gravityformspdfextended.com/faq/can-exclude-field-showing-pdf/">FAQ topic</a> for more details.</li>
|
151 |
+
<li><strong>Bug</strong> - Fixed issue viewing own PDF entry when logged in as anything lower than editor.
|
152 |
+
<li><strong>Bug</strong> - Fix data return bug in pdf-entry-details.php that was preventing all data returning correctly.</li>
|
153 |
+
<li><strong>Bug</strong> - Fix PHP Warning when using products with no options</li>
|
154 |
+
<li><strong>Bug</strong> - Fixed issue with invalid characters being added to the PDF filename. Most notably the date mergetag.</li>
|
155 |
+
<li><strong>Bug</strong> - Limit filename length to 150 characters which should work on the majority of web servers.</li>
|
156 |
+
<li><strong>Bug</strong> - Fixed problem sending duplicate PDF when using mass resend notification feature</li>
|
157 |
+
<li><strong>Depreciated</strong> - Removed GF_FORM_ID and GF_LEAD_ID constants which were used in v2.x.x of the software. Ensure you follow <a href="http://gravityformspdfextended.com/documentation-v3-x-x/v3-0-0-migration-guide/">v2.x.x upgrade guide</a> to your templates before upgrading.</li>
|
158 |
+
|
159 |
</ol>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
+
<h2>Need Support?</h2>
|
162 |
+
|
163 |
+
<p>Head to our <a href="http://gravityformspdfextended.com/support/gravity-forms-pdf-extended/">support forum and start a new topic</a>. Provide as much details as you can about the issue and we'll aid you in your problem.</p>
|
164 |
|
|
|
|
|
165 |
</div>
|
166 |
<div class="rightcolumn">
|
167 |
|
168 |
<h2>Upgraded from v2.x.x?</h2>
|
169 |
<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>
|
170 |
|
171 |
+
<h2>What is Gravity Forms PDF Extended capable of?</h2>
|
172 |
|
173 |
+
<p>
|
174 |
+
We are utilising the most advanced open source HTML to PDF software available to turn Gravity Form data into PDFs. Development 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.</p>
|
175 |
+
<p> <strong> Features</strong></p>
|
176 |
<p> mPDF offers the following features out of the box:</p>
|
177 |
<ul>
|
178 |
<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>
|
189 |
<li> Better system resource handling</li>
|
190 |
</ul>
|
191 |
<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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
<p> <strong>Documentation</strong></p>
|
193 |
<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>
|
194 |
+
|
195 |
</div>
|
196 |
|
197 |
</div>
|
pdf.php
CHANGED
@@ -4,7 +4,7 @@
|
|
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.
|
8 |
Author: Blue Liquid Designs
|
9 |
Author URI: http://www.blueliquiddesigns.com.au
|
10 |
|
@@ -33,7 +33,7 @@ GNU General Public License for more details.
|
|
33 |
/*
|
34 |
* Define our constants
|
35 |
*/
|
36 |
-
if(!defined('PDF_EXTENDED_VERSION')) { define('PDF_EXTENDED_VERSION', '3.
|
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 |
|
@@ -104,14 +104,6 @@ class GFPDF_Core extends PDFGenerator
|
|
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 |
*/
|
@@ -146,6 +138,12 @@ class GFPDF_Core extends PDFGenerator
|
|
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 |
*/
|
@@ -156,10 +154,7 @@ class GFPDF_Core extends PDFGenerator
|
|
156 |
* $gf_compatibility located in pdf-configuration-indexer.php
|
157 |
* Values are either pre 1.7 or post 1.7
|
158 |
*/
|
159 |
-
|
160 |
-
{
|
161 |
-
add_filter('gform_notification', array('GFPDF_Core', 'gfpdfe_create_and_attach_pdf'), 10, 3);
|
162 |
-
}
|
163 |
|
164 |
}
|
165 |
|
@@ -200,41 +195,7 @@ class GFPDF_Core extends PDFGenerator
|
|
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
|
@@ -289,40 +250,92 @@ class GFPDF_Core extends PDFGenerator
|
|
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 |
-
$
|
298 |
-
|
299 |
-
if($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
{
|
301 |
-
$
|
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; ?>"
|
306 |
-
<a href="<?php echo $url.'&download=1'; ?>"
|
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 |
-
$
|
318 |
-
|
319 |
-
if($
|
320 |
{
|
321 |
-
|
322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
|
324 |
?>
|
325 |
-
| <a href="<?php echo $url; ?>"
|
326 |
<?php
|
327 |
}
|
328 |
}
|
@@ -337,7 +350,7 @@ class GFPDF_Core extends PDFGenerator
|
|
337 |
/*
|
338 |
* If $_GET variable isn't set then stop function
|
339 |
*/
|
340 |
-
if(rgempty(
|
341 |
{
|
342 |
return;
|
343 |
}
|
@@ -346,19 +359,18 @@ class GFPDF_Core extends PDFGenerator
|
|
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
|
@@ -381,29 +393,50 @@ class GFPDF_Core extends PDFGenerator
|
|
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
|
|
|
388 |
*/
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
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 |
|
@@ -419,8 +452,7 @@ class GFPDF_Core extends PDFGenerator
|
|
419 |
$pdf_arguments['output'] = $output;
|
420 |
|
421 |
$this->render->PDF_Generator($form_id, $lead_id, $pdf_arguments);
|
422 |
-
|
423 |
-
}
|
424 |
exit();
|
425 |
}
|
426 |
|
@@ -439,24 +471,8 @@ class GFPDF_Core extends PDFGenerator
|
|
439 |
* Allow the template/function access to these variables
|
440 |
*/
|
441 |
global $gfpdf, $form_id, $lead_id;
|
442 |
-
|
443 |
-
|
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
|
@@ -467,29 +483,17 @@ class GFPDF_Core extends PDFGenerator
|
|
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 |
-
|
493 |
{
|
494 |
return $notification;
|
495 |
}
|
@@ -505,42 +509,27 @@ class GFPDF_Core extends PDFGenerator
|
|
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 |
-
*
|
518 |
-
*
|
519 |
-
*
|
|
|
520 |
*/
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
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 |
}
|
@@ -598,15 +587,9 @@ class GFPDF_Core extends PDFGenerator
|
|
598 |
|
599 |
/*
|
600 |
* Get all form_submission notifications and
|
601 |
-
*/
|
602 |
-
|
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 |
/*
|
@@ -658,7 +641,6 @@ class GFPDF_Core extends PDFGenerator
|
|
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
|
@@ -690,7 +672,7 @@ class GFPDF_Core extends PDFGenerator
|
|
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;
|
@@ -728,7 +710,26 @@ class GFPDF_Core extends PDFGenerator
|
|
728 |
}
|
729 |
else
|
730 |
{
|
731 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
}
|
733 |
return $index;
|
734 |
}
|
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.2.0
|
8 |
Author: Blue Liquid Designs
|
9 |
Author URI: http://www.blueliquiddesigns.com.au
|
10 |
|
33 |
/*
|
34 |
* Define our constants
|
35 |
*/
|
36 |
+
if(!defined('PDF_EXTENDED_VERSION')) { define('PDF_EXTENDED_VERSION', '3.2.0'); }
|
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 |
|
104 |
global $gfpdf;
|
105 |
$gfpdf = new GFPDF_Core();
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
/*
|
108 |
* Some functions require the Wordpress Admin area to be fully loaded before we do any processing
|
109 |
*/
|
138 |
add_action("gform_entry_info", array($this, 'detail_pdf_link'), 10, 2);
|
139 |
add_action('wp', array($this, 'process_exterior_pages'));
|
140 |
|
141 |
+
/* Check if on the entries page and output javascript */
|
142 |
+
if(is_admin() && rgget('page') == 'gf_entries')
|
143 |
+
{
|
144 |
+
wp_enqueue_script( 'gfpdfeentries', PDF_PLUGIN_URL . 'javascript/entries-admin.js', array('jquery') );
|
145 |
+
}
|
146 |
+
|
147 |
/*
|
148 |
* Register render class
|
149 |
*/
|
154 |
* $gf_compatibility located in pdf-configuration-indexer.php
|
155 |
* Values are either pre 1.7 or post 1.7
|
156 |
*/
|
157 |
+
add_filter('gform_notification', array('GFPDF_Core', 'gfpdfe_create_and_attach_pdf'), 10, 3);
|
|
|
|
|
|
|
158 |
|
159 |
}
|
160 |
|
195 |
public static function add_documentation_byline()
|
196 |
{
|
197 |
PDF_Common::display_documentation_details();
|
198 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
/**
|
201 |
* Check to see if Gravity Forms is actually installed
|
250 |
|
251 |
|
252 |
function detail_pdf_link($form_id, $lead) {
|
253 |
+
$lead_id = $lead['id'];
|
254 |
+
|
255 |
/*
|
256 |
* Get the template name
|
257 |
* Class: PDFGenerator
|
258 |
* File: pdf-configuration-indexer.php
|
259 |
*/
|
260 |
+
$templates = $this->get_template($form_id, true);
|
261 |
+
|
262 |
+
if(is_array($templates))
|
263 |
+
{
|
264 |
+
?>
|
265 |
+
<strong>PDFs</strong><br />
|
266 |
+
|
267 |
+
<?php foreach($templates as $id => $val):
|
268 |
+
$name = $this->get_pdf_name($id, $form_id, $lead['id']);
|
269 |
+
?>
|
270 |
+
<div class="detailed_pdf">
|
271 |
+
<span><?php
|
272 |
+
echo $name;
|
273 |
+
$url = home_url() .'/?gf_pdf=1&fid=' . $form_id . '&lid=' . $lead_id . '&template=' . $val['template'];
|
274 |
+
?></span>
|
275 |
+
<a href="<?php echo $url; ?>" target="_blank" class="button">View</a>
|
276 |
+
<a href="<?php echo $url.'&download=1'; ?>" target="_blank" class="button">Download</a></div>
|
277 |
+
|
278 |
+
<?php endforeach; ?>
|
279 |
+
|
280 |
+
|
281 |
+
<?php
|
282 |
+
}
|
283 |
+
elseif($templates !== false)
|
284 |
{
|
285 |
+
$url = home_url() .'/?gf_pdf=1&fid=' . $form_id . '&lid=' . $lead_id . '&template=' . $templates;
|
|
|
286 |
|
287 |
?>
|
288 |
+
PDF: <a href="<?php echo $url; ?>" target="_blank" class="button">View</a>
|
289 |
+
<a href="<?php echo $url.'&download=1'; ?>" target="_blank" class="button">Download</a>
|
290 |
<?php
|
291 |
}
|
292 |
}
|
293 |
|
294 |
function pdf_link($form_id, $field_id, $value, $lead) {
|
295 |
+
$lead_id = $lead['id'];
|
296 |
+
|
297 |
/*
|
298 |
* Get the template name
|
299 |
* Class: PDFGenerator
|
300 |
* File: pdf-configuration-indexer.php
|
301 |
*/
|
302 |
+
$templates = $this->get_template($form_id, true);
|
303 |
+
|
304 |
+
if(is_array($templates))
|
305 |
{
|
306 |
+
?>
|
307 |
+
<span class="gf_form_toolbar_settings gf_form_action_has_submenu">
|
308 |
+
| <a href="#" title="View PDF configured for this form" onclick="return false" class="">View PDFs</a>
|
309 |
+
|
310 |
+
<div class="gf_submenu">
|
311 |
+
<ul>
|
312 |
+
<?php foreach($templates as $id => $t):
|
313 |
+
/*
|
314 |
+
* Replace MergeTags in filename
|
315 |
+
*/
|
316 |
+
$name = $this->get_pdf_name($id, $form_id, $lead['id']);
|
317 |
+
?>
|
318 |
+
<li class="">
|
319 |
+
<?php
|
320 |
+
$url = home_url() . '/?gf_pdf=1&fid=' . $form_id .'&lid=' . $lead_id . '&template=' . $t['template'];
|
321 |
+
?>
|
322 |
+
<a href="<?php echo $url; ?>" target="_blank"><?php echo $name; ?></a>
|
323 |
+
</li>
|
324 |
+
<?php endforeach; ?>
|
325 |
+
</ul>
|
326 |
+
</div>
|
327 |
+
</span>
|
328 |
+
|
329 |
+
<?php
|
330 |
+
|
331 |
+
}
|
332 |
+
else
|
333 |
+
{
|
334 |
+
|
335 |
+
$url = home_url() . '/?gf_pdf=1&fid=' . $form_id .'&lid=' . $lead_id . '&template=' . $templates;
|
336 |
|
337 |
?>
|
338 |
+
| <a href="<?php echo $url; ?>" target="_blank">View PDF</a>
|
339 |
<?php
|
340 |
}
|
341 |
}
|
350 |
/*
|
351 |
* If $_GET variable isn't set then stop function
|
352 |
*/
|
353 |
+
if(rgempty( 'gf_pdf', $_GET))
|
354 |
{
|
355 |
return;
|
356 |
}
|
359 |
$lead_id = (int) $_GET['lid'];
|
360 |
$ip = PDF_Common::getRealIpAddr();
|
361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
/*
|
363 |
* Get the template name
|
364 |
* Class: PDFGenerator
|
365 |
* File: pdf-configuration-indexer.php
|
366 |
*/
|
367 |
+
$template = $this->get_template($form_id);
|
368 |
+
|
369 |
+
/*
|
370 |
+
* Before setting up PDF options we will check if a configuration is found
|
371 |
+
* If not, we will set up defaults defined in configuration.php
|
372 |
+
*/
|
373 |
+
$index = $this->check_configuration($form_id, $template);
|
374 |
|
375 |
/*
|
376 |
* Run if user is not logged in
|
393 |
/*
|
394 |
* Ensure logged in users have the correct privilages
|
395 |
*/
|
396 |
+
|
397 |
+
|
398 |
if(!GFCommon::current_user_can_any("gravityforms_view_entries"))
|
399 |
{
|
400 |
/*
|
401 |
+
* User doesn't have the correct access privilages
|
402 |
+
* Let's check if they are assigned to the form
|
403 |
*/
|
404 |
+
$user_logged_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 created_by = '". get_current_user_id() ."'", array() ) );
|
405 |
+
|
406 |
+
/*
|
407 |
+
* Failed again.
|
408 |
+
* One last check against the IP
|
409 |
+
* If it matches the record then we will show the PDF
|
410 |
+
*/
|
411 |
+
if($user_logged_entries == 0)
|
412 |
+
{
|
413 |
+
$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() ) );
|
414 |
+
|
415 |
+
if($form_entries == 0)
|
416 |
+
{
|
417 |
+
/*
|
418 |
+
* Don't show the PDF
|
419 |
+
*/
|
420 |
+
break;
|
421 |
+
}
|
422 |
+
|
423 |
+
}
|
424 |
+
}
|
425 |
+
else
|
426 |
+
{
|
427 |
+
/*
|
428 |
+
* Because this user is logged in with the correct access
|
429 |
+
* we will allow a template to be shown by setting the template variable
|
430 |
+
*/
|
431 |
+
|
432 |
+
if( ($template != $_GET['template']) && (substr($_GET['template'], -4) == '.php') )
|
433 |
+
{
|
434 |
+
$template = $_GET['template'];
|
435 |
+
}
|
436 |
+
}
|
437 |
|
438 |
}
|
439 |
|
|
|
|
|
|
|
440 |
|
441 |
$pdf_arguments = $this->generate_pdf_parameters($index, $form_id, $lead_id, $template);
|
442 |
|
452 |
$pdf_arguments['output'] = $output;
|
453 |
|
454 |
$this->render->PDF_Generator($form_id, $lead_id, $pdf_arguments);
|
455 |
+
|
|
|
456 |
exit();
|
457 |
}
|
458 |
|
471 |
* Allow the template/function access to these variables
|
472 |
*/
|
473 |
global $gfpdf, $form_id, $lead_id;
|
474 |
+
|
475 |
+
$notification_name = (isset($notification['name'])) ? $notification['name'] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
/*
|
478 |
* Set data used to determine if PDF needs to be created and attached to notification
|
483 |
$lead_id = apply_filters('gfpdfe_lead_id', $entry['id'], $form, $entry, $gfpdf); /* allow premium plugins to override the lead ID */
|
484 |
$folder_id = $form_id.$lead_id.'/';
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
/*
|
487 |
* Before setting up PDF options we will check if a configuration is found
|
488 |
* If not, we will set up defaults defined in configuration.php
|
489 |
*/
|
490 |
$gfpdf->check_configuration($form_id);
|
491 |
|
|
|
492 |
/*
|
493 |
* Check if form is in configuration
|
494 |
*/
|
495 |
|
496 |
+
if(!$config = $gfpdf->get_config($form_id))
|
497 |
{
|
498 |
return $notification;
|
499 |
}
|
509 |
$pdf_arguments = $gfpdf->generate_pdf_parameters($index, $form_id, $lead_id, $template);
|
510 |
|
511 |
/* generate and save default PDF */
|
512 |
+
$filename = $gfpdf->render->PDF_Generator($form_id, $lead_id, $pdf_arguments);
|
513 |
|
514 |
/* Get notifications user wants PDF attached to and check if the correct notifications hook is running */
|
515 |
$notifications = $gfpdf->get_form_notifications($form, $index);
|
516 |
|
517 |
/* Set attachment name */
|
518 |
$attachment_file = $filename;
|
519 |
+
|
520 |
+
/*
|
521 |
+
* Premium plugin filter
|
522 |
+
* Allows manual override of the notification
|
523 |
+
* Allows the multi-report plugin to automate PDFs based on weekly/fortnightly/monthly basis
|
524 |
+
* Only allow boolean to be returned
|
525 |
*/
|
526 |
+
$notification_override = (bool) apply_filters('gfpdfe_notification_override', false, $notification_name, $notifications, $form, $entry, $gfpdf);
|
527 |
+
|
528 |
+
if ($gfpdf->check_notification($notification_name, $notifications) || $notification_override === true)
|
529 |
+
{
|
530 |
+
$notification['attachments'][] = $attachment_file;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
}
|
532 |
+
|
533 |
}
|
534 |
return $notification;
|
535 |
}
|
587 |
|
588 |
/*
|
589 |
* Get all form_submission notifications and
|
590 |
+
*/
|
591 |
+
$notifications = self::get_notifications_name('form_submission', $form);
|
592 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
$new_notifications = array();
|
594 |
|
595 |
/*
|
641 |
$security = (isset($this->configuration[$index]['security']) && $this->configuration[$index]['security']) ? $this->configuration[$index]['security'] : self::$default['security'];
|
642 |
$premium = (isset($this->configuration[$index]['premium']) && $this->configuration[$index]['premium'] === true) ? true: false;
|
643 |
|
|
|
644 |
/*
|
645 |
* Validate privileges
|
646 |
* If blank and security is true then set privileges to all
|
672 |
* Checks if a configuration index is found
|
673 |
* If not, we will set up defaults defined in configuration.php if they exist
|
674 |
*/
|
675 |
+
public function check_configuration($form_id, $template = '')
|
676 |
{
|
677 |
|
678 |
global $gf_pdf_default_configuration;
|
710 |
}
|
711 |
else
|
712 |
{
|
713 |
+
if(sizeof($this->index[$form_id]) > 1 && strlen($template) > 0 )
|
714 |
+
{
|
715 |
+
$index = false;
|
716 |
+
foreach($this->index[$form_id] as $i)
|
717 |
+
{
|
718 |
+
if(isset($this->configuration[$i]['template']) && $this->configuration[$i]['template'] == $template)
|
719 |
+
{
|
720 |
+
$index = $i;
|
721 |
+
}
|
722 |
+
}
|
723 |
+
|
724 |
+
if($index === false)
|
725 |
+
{
|
726 |
+
$index = $this->index[$form_id][0];
|
727 |
+
}
|
728 |
+
}
|
729 |
+
else
|
730 |
+
{
|
731 |
+
$index = $this->index[$form_id][0];
|
732 |
+
}
|
733 |
}
|
734 |
return $index;
|
735 |
}
|
styles/_notes/dwsync.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="admin-styles.css" server="blueliquiddesigns.com.au" local="130059183000000000" remote="130059183000000000" />
|
4 |
+
<file name="template.css" server="blueliquiddesigns.com.au" local="130062317478790999" remote="130061922600000000" />
|
5 |
+
<file name="admin-styles.css" server="54.252.94.54" local="130263504501956024" remote="130263108600000000" />
|
6 |
+
<file name="template.css" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
7 |
+
</dwsync>
|
styles/admin-styles.css
CHANGED
@@ -1,35 +1,61 @@
|
|
1 |
-
#pdfextended-settings .leftcolumn {
|
2 |
-
width: 50%;
|
3 |
-
float: left;
|
4 |
-
}
|
5 |
-
|
6 |
-
#pdfextended-settings .rightcolumn {
|
7 |
-
margin-left: 55%;
|
8 |
-
}
|
9 |
-
|
10 |
-
#pdfextended-settings ol, #pdfextended-settings ul {
|
11 |
-
margin-left: 25px;
|
12 |
-
}
|
13 |
-
#pdfextended-settings ul > li {
|
14 |
-
list-style: disc;
|
15 |
-
}
|
16 |
-
|
17 |
-
#pdfextended-settings ol > li {
|
18 |
-
list-style: decimal;
|
19 |
-
}
|
20 |
-
|
21 |
-
#pdfextended-settings ol li > ul, #pdfextended-settings ul li > ul {
|
22 |
-
margin: 5px 0 0 20px;
|
23 |
-
}
|
24 |
-
|
25 |
-
#pdfextended-settings ul ul > li {
|
26 |
-
list-style: circle;
|
27 |
-
}
|
28 |
-
|
29 |
-
#pdfextended-settings ol ul > li {
|
30 |
-
list-style: disc;
|
31 |
-
}
|
32 |
-
|
33 |
-
#gform_tab_group #icon-gf_edit_forms {
|
34 |
-
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
1 |
+
#pdfextended-settings .leftcolumn {
|
2 |
+
width: 50%;
|
3 |
+
float: left;
|
4 |
+
}
|
5 |
+
|
6 |
+
#pdfextended-settings .rightcolumn {
|
7 |
+
margin-left: 55%;
|
8 |
+
}
|
9 |
+
|
10 |
+
#pdfextended-settings ol, #pdfextended-settings ul {
|
11 |
+
margin-left: 25px;
|
12 |
+
}
|
13 |
+
#pdfextended-settings ul > li {
|
14 |
+
list-style: disc;
|
15 |
+
}
|
16 |
+
|
17 |
+
#pdfextended-settings ol > li {
|
18 |
+
list-style: decimal;
|
19 |
+
}
|
20 |
+
|
21 |
+
#pdfextended-settings ol li > ul, #pdfextended-settings ul li > ul {
|
22 |
+
margin: 5px 0 0 20px;
|
23 |
+
}
|
24 |
+
|
25 |
+
#pdfextended-settings ul ul > li {
|
26 |
+
list-style: circle;
|
27 |
+
}
|
28 |
+
|
29 |
+
#pdfextended-settings ol ul > li {
|
30 |
+
list-style: disc;
|
31 |
+
}
|
32 |
+
|
33 |
+
#gform_tab_group #icon-gf_edit_forms {
|
34 |
+
display: none;
|
35 |
+
}
|
36 |
+
|
37 |
+
.detailed_pdf {
|
38 |
+
clear: left;
|
39 |
+
}
|
40 |
+
|
41 |
+
.detailed_pdf span {
|
42 |
+
float: left;
|
43 |
+
width: 10em;
|
44 |
+
margin-right: 10px;
|
45 |
+
|
46 |
+
-ms-word-break: break-all;
|
47 |
+
word-break: break-all;
|
48 |
+
|
49 |
+
/* Non standard for webkit */
|
50 |
+
word-break: break-word;
|
51 |
+
|
52 |
+
-webkit-hyphens: auto;
|
53 |
+
-moz-hyphens: auto;
|
54 |
+
hyphens: auto;
|
55 |
+
}
|
56 |
+
|
57 |
+
.detailed_pdf:after {
|
58 |
+
clear: both;
|
59 |
+
display: block;
|
60 |
+
content: '';
|
61 |
}
|
styles/template.css
CHANGED
@@ -1,167 +1,167 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* Add custom user CSS below here
|
5 |
-
*/
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
/* END USER STYLES */
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
/**
|
14 |
-
* The following snippet of CSS styles the default templates and the example template
|
15 |
-
* The uncompressed version can be found in uncompressed-template.css in the plugin's folder
|
16 |
-
* DO NO REMOVE THESE STYLES.
|
17 |
-
*/
|
18 |
-
body {
|
19 |
-
font-family:DejaVu Sans, Helvetica, sans-serif;
|
20 |
-
letter-spacing: -0.2px;
|
21 |
-
}
|
22 |
-
|
23 |
-
#container {
|
24 |
-
border-radius:4px 4px 4px 4px;
|
25 |
-
border-spacing:0;
|
26 |
-
clear:both;
|
27 |
-
width:100%;
|
28 |
-
background-color:#fff;
|
29 |
-
border-color:#dfdfdf;
|
30 |
-
border-style:solid;
|
31 |
-
border-width:1px;
|
32 |
-
margin:0 0 16px;
|
33 |
-
}
|
34 |
-
|
35 |
-
h2.default {
|
36 |
-
background-color:#e3e3e3;
|
37 |
-
font-size:14px;
|
38 |
-
text-align:left;
|
39 |
-
text-shadow:0 1px 0 #fff;
|
40 |
-
margin:0;
|
41 |
-
padding:7px;
|
42 |
-
}
|
43 |
-
|
44 |
-
.entry-view-field-value {
|
45 |
-
border-bottom:1px solid #dfdfdf;
|
46 |
-
line-height:150%;
|
47 |
-
padding:6px 6px 6px 7px;
|
48 |
-
}
|
49 |
-
|
50 |
-
.lastrow {
|
51 |
-
border-bottom: none;
|
52 |
-
}
|
53 |
-
|
54 |
-
.entry-view-field-value ul {
|
55 |
-
margin-left:25px;
|
56 |
-
}
|
57 |
-
|
58 |
-
.entry-view-field-value div.strong {
|
59 |
-
font-weight: bold;
|
60 |
-
}
|
61 |
-
|
62 |
-
.no-style .entry-view-field-value,.no-style #container, .no-style h2 {
|
63 |
-
background:none;
|
64 |
-
border:none;
|
65 |
-
}
|
66 |
-
|
67 |
-
.two_row .entry-view-field-value {
|
68 |
-
border:0;
|
69 |
-
line-height:normal;
|
70 |
-
padding:0;
|
71 |
-
}
|
72 |
-
|
73 |
-
.two_row .entry-view-field-value div.strong {
|
74 |
-
font-weight: bold;
|
75 |
-
width:100%;
|
76 |
-
border-bottom:1px solid #dfdfdf;
|
77 |
-
line-height:150%;
|
78 |
-
background-color:#eaf2fa;
|
79 |
-
padding:6px 6px 6px 7px;
|
80 |
-
}
|
81 |
-
|
82 |
-
.two_row .entry-view-field-value div.value {
|
83 |
-
display:block;
|
84 |
-
width:100%;
|
85 |
-
border-bottom:1px solid #fff;
|
86 |
-
line-height:150%;
|
87 |
-
padding:6px 6px 6px 7px;
|
88 |
-
}
|
89 |
-
|
90 |
-
.two_row .entry-view-field-value span {
|
91 |
-
font-weight:normal;
|
92 |
-
}
|
93 |
-
|
94 |
-
td.entry-view-field-value {
|
95 |
-
padding-left:9px;
|
96 |
-
}
|
97 |
-
|
98 |
-
.even {
|
99 |
-
background:#eaf2fa;
|
100 |
-
}
|
101 |
-
|
102 |
-
.body_copy {
|
103 |
-
padding-top:50px;
|
104 |
-
}
|
105 |
-
|
106 |
-
.pdf_logo_area {
|
107 |
-
text-align:center;
|
108 |
-
margin:0 auto;
|
109 |
-
}
|
110 |
-
|
111 |
-
table.entry-products th {
|
112 |
-
background-color: #F4F4F4;
|
113 |
-
border-bottom: 1px solid #DFDFDF;
|
114 |
-
border-right: 1px solid #DFDFDF !important;
|
115 |
-
}
|
116 |
-
|
117 |
-
table.entry-products td.textcenter, table.entry-products th.textcenter {
|
118 |
-
text-align: center;
|
119 |
-
}
|
120 |
-
|
121 |
-
table.entry-products col.entry-products-col2 {
|
122 |
-
width: 50px;
|
123 |
-
}
|
124 |
-
|
125 |
-
table.entry-products col.entry-products-col3 {
|
126 |
-
width: 155px;
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
table.entry-products col.entry-products-col4 {
|
131 |
-
width: 155px;
|
132 |
-
}
|
133 |
-
|
134 |
-
table.entry-products {
|
135 |
-
border: 1px solid #DFDFDF;
|
136 |
-
margin: 10px 0;
|
137 |
-
}
|
138 |
-
|
139 |
-
table.entry-products td {
|
140 |
-
border-bottom: 1px solid #DFDFDF;
|
141 |
-
border-right: 1px solid #DFDFDF !important;
|
142 |
-
padding: 7px 7px 8px;
|
143 |
-
vertical-align: top;
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
table.entry-products td.emptycell {
|
148 |
-
background-color: #F4F4F4;
|
149 |
-
}
|
150 |
-
|
151 |
-
table.entry-products td.grandtotal, table.entry-products td.grandtotal_amount, table.entry-products td.shipping, table.entry-products td.shipping_amount {
|
152 |
-
font-size: 13px;
|
153 |
-
font-weight: bold;
|
154 |
-
padding-bottom: 8px;
|
155 |
-
padding-top: 7px;
|
156 |
-
}
|
157 |
-
|
158 |
-
table.entry-products td.textright, table.entry-products th.textright {
|
159 |
-
text-align: right;
|
160 |
-
}
|
161 |
-
|
162 |
-
.two_row .odd, .two_row .even {
|
163 |
-
background: none;
|
164 |
-
}
|
165 |
-
|
166 |
-
/* FINISHED REQUIRED CSS */
|
167 |
-
|
1 |
+
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Add custom user CSS below here
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
/* END USER STYLES */
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The following snippet of CSS styles the default templates and the example template
|
15 |
+
* The uncompressed version can be found in uncompressed-template.css in the plugin's folder
|
16 |
+
* DO NO REMOVE THESE STYLES.
|
17 |
+
*/
|
18 |
+
body {
|
19 |
+
font-family:DejaVu Sans, Helvetica, sans-serif;
|
20 |
+
letter-spacing: -0.2px;
|
21 |
+
}
|
22 |
+
|
23 |
+
#container {
|
24 |
+
border-radius:4px 4px 4px 4px;
|
25 |
+
border-spacing:0;
|
26 |
+
clear:both;
|
27 |
+
width:100%;
|
28 |
+
background-color:#fff;
|
29 |
+
border-color:#dfdfdf;
|
30 |
+
border-style:solid;
|
31 |
+
border-width:1px;
|
32 |
+
margin:0 0 16px;
|
33 |
+
}
|
34 |
+
|
35 |
+
h2.default {
|
36 |
+
background-color:#e3e3e3;
|
37 |
+
font-size:14px;
|
38 |
+
text-align:left;
|
39 |
+
text-shadow:0 1px 0 #fff;
|
40 |
+
margin:0;
|
41 |
+
padding:7px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.entry-view-field-value {
|
45 |
+
border-bottom:1px solid #dfdfdf;
|
46 |
+
line-height:150%;
|
47 |
+
padding:6px 6px 6px 7px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.lastrow {
|
51 |
+
border-bottom: none;
|
52 |
+
}
|
53 |
+
|
54 |
+
.entry-view-field-value ul {
|
55 |
+
margin-left:25px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.entry-view-field-value div.strong {
|
59 |
+
font-weight: bold;
|
60 |
+
}
|
61 |
+
|
62 |
+
.no-style .entry-view-field-value,.no-style #container, .no-style h2 {
|
63 |
+
background:none;
|
64 |
+
border:none;
|
65 |
+
}
|
66 |
+
|
67 |
+
.two_row .entry-view-field-value {
|
68 |
+
border:0;
|
69 |
+
line-height:normal;
|
70 |
+
padding:0;
|
71 |
+
}
|
72 |
+
|
73 |
+
.two_row .entry-view-field-value div.strong {
|
74 |
+
font-weight: bold;
|
75 |
+
width:100%;
|
76 |
+
border-bottom:1px solid #dfdfdf;
|
77 |
+
line-height:150%;
|
78 |
+
background-color:#eaf2fa;
|
79 |
+
padding:6px 6px 6px 7px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.two_row .entry-view-field-value div.value {
|
83 |
+
display:block;
|
84 |
+
width:100%;
|
85 |
+
border-bottom:1px solid #fff;
|
86 |
+
line-height:150%;
|
87 |
+
padding:6px 6px 6px 7px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.two_row .entry-view-field-value span {
|
91 |
+
font-weight:normal;
|
92 |
+
}
|
93 |
+
|
94 |
+
td.entry-view-field-value {
|
95 |
+
padding-left:9px;
|
96 |
+
}
|
97 |
+
|
98 |
+
.even {
|
99 |
+
background:#eaf2fa;
|
100 |
+
}
|
101 |
+
|
102 |
+
.body_copy {
|
103 |
+
padding-top:50px;
|
104 |
+
}
|
105 |
+
|
106 |
+
.pdf_logo_area {
|
107 |
+
text-align:center;
|
108 |
+
margin:0 auto;
|
109 |
+
}
|
110 |
+
|
111 |
+
table.entry-products th {
|
112 |
+
background-color: #F4F4F4;
|
113 |
+
border-bottom: 1px solid #DFDFDF;
|
114 |
+
border-right: 1px solid #DFDFDF !important;
|
115 |
+
}
|
116 |
+
|
117 |
+
table.entry-products td.textcenter, table.entry-products th.textcenter {
|
118 |
+
text-align: center;
|
119 |
+
}
|
120 |
+
|
121 |
+
table.entry-products col.entry-products-col2 {
|
122 |
+
width: 50px;
|
123 |
+
}
|
124 |
+
|
125 |
+
table.entry-products col.entry-products-col3 {
|
126 |
+
width: 155px;
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
table.entry-products col.entry-products-col4 {
|
131 |
+
width: 155px;
|
132 |
+
}
|
133 |
+
|
134 |
+
table.entry-products {
|
135 |
+
border: 1px solid #DFDFDF;
|
136 |
+
margin: 10px 0;
|
137 |
+
}
|
138 |
+
|
139 |
+
table.entry-products td {
|
140 |
+
border-bottom: 1px solid #DFDFDF;
|
141 |
+
border-right: 1px solid #DFDFDF !important;
|
142 |
+
padding: 7px 7px 8px;
|
143 |
+
vertical-align: top;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
table.entry-products td.emptycell {
|
148 |
+
background-color: #F4F4F4;
|
149 |
+
}
|
150 |
+
|
151 |
+
table.entry-products td.grandtotal, table.entry-products td.grandtotal_amount, table.entry-products td.shipping, table.entry-products td.shipping_amount {
|
152 |
+
font-size: 13px;
|
153 |
+
font-weight: bold;
|
154 |
+
padding-bottom: 8px;
|
155 |
+
padding-top: 7px;
|
156 |
+
}
|
157 |
+
|
158 |
+
table.entry-products td.textright, table.entry-products th.textright {
|
159 |
+
text-align: right;
|
160 |
+
}
|
161 |
+
|
162 |
+
.two_row .odd, .two_row .even {
|
163 |
+
background: none;
|
164 |
+
}
|
165 |
+
|
166 |
+
/* FINISHED REQUIRED CSS */
|
167 |
+
|
templates/_notes/dwsync.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="default-template-no-style.php" server="blueliquiddesigns.com.au" local="130062310330614598" remote="130061914200000000" />
|
4 |
+
<file name="default-template-two-rows.php" server="blueliquiddesigns.com.au" local="130062310330989604" remote="130061914200000000" />
|
5 |
+
<file name="default-template.php" server="blueliquiddesigns.com.au" local="130062310331339609" remote="130061914200000000" />
|
6 |
+
<file name="example-template.php" server="blueliquiddesigns.com.au" local="130062310331689614" remote="130061914200000000" />
|
7 |
+
<file name="default-template-no-style.php" server="54.252.94.54" local="130166065410188964" remote="130165705200000000" />
|
8 |
+
<file name="default-template-two-rows.php" server="54.252.94.54" local="130166065410558985" remote="130165705200000000" />
|
9 |
+
<file name="default-template.php" server="54.252.94.54" local="130166065410879003" remote="130165705200000000" />
|
10 |
+
<file name="example-advanced-headers_07.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
11 |
+
<file name="example-backgrounds-and-borders02.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
12 |
+
<file name="example-basic-html01.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
13 |
+
<file name="example-different-page-size_08.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
14 |
+
<file name="example-float-and-positioning05.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
15 |
+
<file name="example-header-and-footer_06.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
16 |
+
<file name="example-images03.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
17 |
+
<file name="example-tables04.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
18 |
+
<file name="example-template.php" server="54.252.94.54" local="130196765400000000" remote="130196765400000000" />
|
19 |
+
</dwsync>
|
templates/default-template-no-style.php
CHANGED
@@ -1,54 +1,77 @@
|
|
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 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
+
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-blog-header.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-blog-header.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
37 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
38 |
+
*/
|
39 |
+
PDF_Common::setup_ids();
|
40 |
+
|
41 |
+
global $gfpdf;
|
42 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
43 |
+
|
44 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
45 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
46 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* 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.
|
50 |
+
*/
|
51 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
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 |
+
<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>
|
templates/default-template-two-rows.php
CHANGED
@@ -1,55 +1,79 @@
|
|
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 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
+
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-blog-header.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-blog-header.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
37 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
38 |
+
*/
|
39 |
+
PDF_Common::setup_ids();
|
40 |
+
|
41 |
+
global $gfpdf;
|
42 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
43 |
+
|
44 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
45 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
46 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* 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.
|
50 |
+
*/
|
51 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
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 |
+
|
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>
|
templates/default-template.php
CHANGED
@@ -1,52 +1,75 @@
|
|
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 |
</html>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
+
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-blog-header.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-blog-header.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Set up the form ID and lead ID, as well as we want page breaks displayed.
|
37 |
+
* Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10
|
38 |
+
*/
|
39 |
+
PDF_Common::setup_ids();
|
40 |
+
|
41 |
+
global $gfpdf;
|
42 |
+
$configuration_data = $gfpdf->get_config_data($form_id);
|
43 |
+
|
44 |
+
$show_html_fields = ($configuration_data['default-show-html'] == 1) ? true : false;
|
45 |
+
$show_empty_fields = ($configuration_data['default-show-empty'] == 1) ? true : false;
|
46 |
+
$show_page_names = ($configuration_data['default-show-page-names'] == 1) ? true : false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* 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.
|
50 |
+
*/
|
51 |
+
$form = RGFormsModel::get_form_meta($form_id);
|
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>
|
templates/example-advanced-headers_07.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-backgrounds-and-borders02.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-basic-html01.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-different-page-size_08.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-float-and-positioning05.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-header-and-footer_06.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-images03.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-tables04.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
templates/example-template.php
CHANGED
@@ -1,12 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
*/
|
7 |
-
if(!class_exists(
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
/**
|
@@ -38,6 +60,7 @@ $stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF
|
|
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
|
@@ -57,11 +80,10 @@ $stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF
|
|
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
|
65 |
|
66 |
|
67 |
<div class="body_copy">
|
@@ -80,21 +102,40 @@ $stylesheet_location = (file_exists(PDF_TEMPLATE_LOCATION.'template.css')) ? PDF
|
|
80 |
</p>
|
81 |
|
82 |
<p class="whom_concern_intro">Dear User,</p>
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
|
87 |
<br /><br />
|
88 |
|
89 |
<p class="signature">
|
90 |
Jake Jackson<br />
|
91 |
-
<img src="<?php echo
|
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 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* If the template is being loaded directy we'll call the Wordpress Core
|
5 |
+
* Used when attempting to debug the template
|
6 |
*/
|
7 |
+
if(!class_exists("RGForms")){
|
8 |
+
for ( $i = 0; $i < $depth = 10; $i++ ) {
|
9 |
+
$wp_root_path = str_repeat( '../', $i );
|
10 |
+
|
11 |
+
if ( file_exists("{$wp_root_path}wp-load.php" ) ) {
|
12 |
+
require_once("{$wp_root_path}wp-load.php");
|
13 |
+
require_once("{$wp_root_path}wp-admin/includes/admin.php");
|
14 |
+
break;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/*stop the script if user isn't logged in*/
|
19 |
+
if(!is_user_logged_in())
|
20 |
+
{
|
21 |
+
echo 'You need to be logged in to view this document';
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Added security measure. If the user is logged in but doesn't have permission to view entries then the PDF won't be displayed.
|
27 |
+
*/
|
28 |
+
if(!GFCommon::current_user_can_any("gravityforms_view_entries") && !defined('GF_FORM_ID') )
|
29 |
+
{
|
30 |
+
die(__("You don't have adequate permission to view entries.", "gravityforms"));
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
60 |
foreach($lead_ids as $lead_id) {
|
61 |
|
62 |
$lead = RGFormsModel::get_lead($lead_id);
|
63 |
+
do_action("gform_print_entry_header", $form, $lead);
|
64 |
$form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
|
65 |
/*
|
66 |
* Add &data=1 when viewing the PDF via the admin area to view the $form_data array
|
80 |
$address_country = $form_data['2.Address']['country'];
|
81 |
|
82 |
$phone = $form_data['3.Phone'];*/
|
|
|
83 |
/* format the template */
|
84 |
?>
|
85 |
|
86 |
+
<img src="<?php echo home_url() ?>/wp-content/plugins/gravity-forms-pdf-extended/images/gravityformspdfextended.jpg" width="311" height="110" />
|
87 |
|
88 |
|
89 |
<div class="body_copy">
|
102 |
</p>
|
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 |
}
|